修改程序逻辑,准备批量打包

This commit is contained in:
wule committed 2026-05-28 17:28:08 +08:00
1 parent aab73b978f
commit 55528e5109
30 files changed
+297 -150

No files matched your search

+35 -2
View File
@@ -23,8 +23,41 @@ namespace Update
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
static void Main(string[] args)
{
if (args.Length > 0)
{
try
{
var arr = args[0].TrimStart('-').Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
if (arr.Length > 3)
{
softName = arr[0];
oldVersion = Convert.ToInt32(arr[1]);
newVersion = Convert.ToInt32(arr[2]);
updateUrl = arr[3];
if (oldVersion == 0 || string.IsNullOrEmpty(softName) || string.IsNullOrEmpty(updateUrl))
return;
// 如果有新版本,就继续升级
if (newVersion > oldVersion)
{
//Application.Current.Shutdown(); // 强制升级
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
// 仍然删除旧版数据防止残留
if (File.Exists("UpdateConfig.ini"))
File.Delete("UpdateConfig.ini");
return;
}
}
catch (Exception ex) { }
}
if (File.Exists("UpdateConfig.ini"))
{
try
@@ -193,7 +226,7 @@ namespace Update
try
{
WebClientUtils webClient = new WebClientUtils();
webClient.Timeout = 600;
webClient.Timeout = 1200; // 20分钟
if (File.Exists(FilePath))
File.Delete(FilePath);
webClient.DownloadProgressChanged += WebClient_DownloadProgressChanged;