Panagiotis D. Satos,Arta - 希腊
1。创建C#控制台应用程序(项目名称:更新程序)。
在Main方法内部编写以下代码块:
Console.Write(“更新应用程序...”);
的Excel();
private static void Excel()
{
string l_strFileName = "\\\\192.168.1.3\\update\\Updater\\Updater.xls";
String l_strCon = "provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + l_strFileName + "';Extended Properties='Excel 12.0;HDR=No'";
OleDbConnection l_oleDBcon = new OleDbConnection(l_strCon);
l_oleDBcon.Open();
DataTable dt = l_oleDBcon.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
String[] l_strExcelSheetsNames = new String[dt.Rows.Count];
int i = 0;
foreach (DataRow row in dt.Rows)
{
l_strExcelSheetsNames[i] = row["TABLE_NAME"].ToString();
i++;
}
OleDbCommand l_oleDBcommand = new OleDbCommand("SELECT * FROM [" + l_strExcelSheetsNames[0] + "]", l_oleDBcon);
OleDbDataAdapter l_loeDBadapter = new OleDbDataAdapter();
l_loeDBadapter.SelectCommand = l_oleDBcommand;
DataSet l_ds = new DataSet();
l_loeDBadapter.Fill(l_ds);
ArrayList l_listPaths = new ArrayList();
string l_strPath;
for (i = 0; i <= l_ds.Tables[0].Rows.Count - 1; i++)
{
l_strPath = l_ds.Tables[0].Rows[i].ItemArray[0].ToString();
if (l_strPath.Equals(""))
{
continue;
}
else
{
l_listPaths.Add(l_strPath);
}
}
l_oleDBcon.Close();
if (l_listPaths.Count > 0)
{
for (i = 0; i < l_listPaths.Count; i++)
{
System.Diagnostics.Process.Start(l_listPaths[i].ToString());
}
}
}
2. 在网络路径(文件夹)中添加控制台应用程序( Updater.exe ),这与我们的应用程序安装到LAN计算机的路径相同。例如:
\\ 192.168.1.3 \更新\更新\
3. 在同一路径中,还添加一个Excel文件( Updater.xls )。 在那里,您可以添加新版本应用程序的路径。例如,这些是两个应用程序的新版本的路径:
\\ 192.168.1.3 \更新\更新\ UWP \ AppPackages \ UWP_1.0.8.0_Debug_Test \ UWP_1.0.8.0_x86_x64_arm_Debug.appxbundle
\\ 192.168.1.3 \更新\更新\ AppUpdate \ AppPackages \ AppUpdate_1.0.3.0_Debug_Test \ AppUpdate_1.0.3.0_x86_x64_arm_Debug.appxbundle
4. 在启动文件夹中创建一个Updater.exe(\\ 192.168.1.3 \ update \ Updater \ Updater.exe)的快照(打开文件夹:按WinKey + R(运行...) ),写:shell:启动,按下每个局域网计算机的Enter键。
5. 在Intranet设置中添加服务器路径\\ 192.168.1.3