Closed JackGuogit closed 1 year ago
你调用的参数贴出来看看
你调用的参数贴出来看看
public GeneralClientBootstrap Config(string url, string appSecretKey, string appName = "GeneralUpdate.Upgrade")
{
if (string.IsNullOrEmpty(url)) throw new Exception("Url cannot be empty !");
try
{
string basePath = System.Threading.Thread.GetDomain().BaseDirectory;
Packet.InstallPath = basePath;
Packet.AppSecretKey = appSecretKey;
//update app.
Packet.AppName = appName;
string clienVersion = GetFileVersion(Path.Combine(basePath, $"{Packet.AppName}.exe"));
Packet.ClientVersion = clienVersion;
Packet.AppType = AppType.UpgradeApp;
Packet.UpdateUrl = $"{url}/versions/{AppType.UpgradeApp}/{clienVersion}/{Packet.AppSecretKey}";
//main app.
string mainAppName = Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName);
string mainVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
Packet.MainUpdateUrl = $"{url}/versions/{AppType.ClientApp}/{mainVersion}/{Packet.AppSecretKey}";
Packet.MainAppName = mainAppName;
return this;
}
catch (Exception ex)
{
throw new GeneralUpdateException<ExceptionArgs>(ex.Message, ex.InnerException);
}
}
这是源代码的调用参数,用的是默认的Packet.AppType = AppType.UpgradeApp;这个参数传递到
switch (appType)
{
case AppType.ClientApp:
Process.Start(path, Packet.ProcessBase64);
Process.GetCurrentProcess().Kill();
break;
case AppType.UpgradeApp:
Process.Start(path);
break;
}
是无法成功唤起升级程序的,使用默认参数的情况下,只有更改此处才能正确启动升级程序
谢谢提交issue该问题已修复,可能是之前的PR修改错误了。
这个方法public override bool StartApp(string appName, int appType)有逻辑bug,导致主程序无法唤醒升级程序。
修改为这样就可以了