系统升级目录

This commit is contained in:
wule committed 2025-07-14 11:11:08 +08:00
1 parent 892d7e1f6c
commit 106f60bcf8
7 files changed
+121 -110

No files matched your search

+63 -1
View File
@@ -19,6 +19,7 @@ using System.Net;
using System.Collections;
using System.Linq;
using System.Threading.Tasks;
using NaiBa.Util.Extension;
namespace Work
{
@@ -84,7 +85,8 @@ prefixTextPara,;shopthreadCountPara,3;singeThreadCountPara,1;singleUploadPara,50
offCountPara,false;offProductPara,100;IrregularitiesPara,true;noNeerPara,true;noNeerDaysPara,3;limitReplacePara,true;replaceCountPara,3;errorDownPara,false;apiPara,false";
CheckXmlValue(checkvalue, ConfigFilePach);
Task.Run(() => { Update(); InitProgress(1); });
//Task.Run(() => { Update(); InitProgress(1); });
Task.Run(() => { CheckUpdate(); InitProgress(1); });
Task.Run(() => { GetAuthConfig(); InitProgress(1); });
Task.Run(() => { CheckFiles(); IsCheckFilesFinish = true; InitProgress(1); });
//Task.Run(() => { CheckUpdataFile(); });
@@ -302,6 +304,66 @@ offCountPara,false;offProductPara,100;IrregularitiesPara,true;noNeerPara,true;no
InitProgress(1);
}
public static void CheckUpdate()
{
try
{
// while (true)
{
string updatefilepath = System.Environment.CurrentDirectory + "\\Update.exe";
var url = BaseClass.BuildObjString("update/get_update");
var data = UserLogin.GetSignaturex();
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
return;
var updateExeChk = BaseRegex.GetStringJson(ref html, "exe_check").ParseToString();
var updateExeAddress = BaseRegex.GetStringJson(ref html, "exe_address");
var updateFileAddress = BaseRegex.GetStringJson(ref html, "file_address");
var newVersion = BaseRegex.GetIntJson(ref html, "next_version").ParseToInt();
if (File.Exists(updatefilepath))
{
string fc = BaseClass.GetFileMd5(updatefilepath);
if (fc != updateExeChk)
{
NaiBa.Util.Helper.HttpHelper.DownloadFile(updateExeAddress, updatefilepath);
}
}
else // 如果自动更新exe文件不存在,则强制更新exe文件
NaiBa.Util.Helper.HttpHelper.DownloadFile(updateExeAddress, updatefilepath);
if (newVersion > BaseClass.VersionCount)
{
try
{
if (File.Exists(updatefilepath))
{
File.WriteAllText(System.Environment.CurrentDirectory + "\\UpdateConfig.ini",
"TemuKJD.exe\r\n" +
BaseClass.VersionCount + "\r\n" +
newVersion + "\r\n" +
updateFileAddress);
Process.Start(updatefilepath);
}
}
catch (Exception ex)
{
//BaseMsgForm.ShowError(ex.Message);
}
}
//Thread.Sleep(1000 * 60 * 60);
}
}
catch (Exception ex)
{
//BaseMsgForm.ShowError(ex.Message);
}
InitProgress(1);
}
/// <summary>
/// 获取签名验证配置
/// </summary>