mirror of
https://github.com/knah/VRCMelonAssistant.git
synced 2024-05-17 19:02:18 +12:00
Fixed issue with running ModAssistant.old.exe
This commit is contained in:
parent
97d98b809d
commit
eb2ab28c73
|
@ -15,6 +15,7 @@ namespace ModAssistant
|
||||||
private static Version CurrentVersion;
|
private static Version CurrentVersion;
|
||||||
private static Version LatestVersion;
|
private static Version LatestVersion;
|
||||||
private static bool NeedsUpdate = false;
|
private static bool NeedsUpdate = false;
|
||||||
|
private static string NewExe = Path.Combine(Path.GetDirectoryName(Utils.ExePath), "ModAssistant.exe");
|
||||||
|
|
||||||
public static async Task<bool> CheckForUpdate()
|
public static async Task<bool> CheckForUpdate()
|
||||||
{
|
{
|
||||||
|
@ -30,6 +31,7 @@ namespace ModAssistant
|
||||||
|
|
||||||
public static async Task Run()
|
public static async Task Run()
|
||||||
{
|
{
|
||||||
|
if (Path.GetFileName(Utils.ExePath).Equals("ModAssistant.old.exe")) RunNew();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NeedsUpdate = await CheckForUpdate();
|
NeedsUpdate = await CheckForUpdate();
|
||||||
|
@ -44,9 +46,7 @@ namespace ModAssistant
|
||||||
|
|
||||||
public static async Task StartUpdate()
|
public static async Task StartUpdate()
|
||||||
{
|
{
|
||||||
string Directory = Path.GetDirectoryName(Utils.ExePath);
|
string OldExe = Path.Combine(Path.GetDirectoryName(Utils.ExePath), "ModAssistant.old.exe");
|
||||||
string OldExe = Path.Combine(Directory, "ModAssistant.old.exe");
|
|
||||||
|
|
||||||
string DownloadLink = null;
|
string DownloadLink = null;
|
||||||
|
|
||||||
foreach (Update.Asset asset in LatestUpdate.assets)
|
foreach (Update.Asset asset in LatestUpdate.assets)
|
||||||
|
@ -70,14 +70,16 @@ namespace ModAssistant
|
||||||
|
|
||||||
File.Move(Utils.ExePath, OldExe);
|
File.Move(Utils.ExePath, OldExe);
|
||||||
|
|
||||||
await Utils.Download(DownloadLink, Utils.ExePath);
|
await Utils.Download(DownloadLink, NewExe);
|
||||||
Process.Start(Utils.ExePath);
|
RunNew();
|
||||||
App.Current.Shutdown();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void RunNew()
|
||||||
|
{
|
||||||
|
Process.Start(NewExe);
|
||||||
|
Application.Current.Dispatcher.Invoke(() => { Application.Current.Shutdown(); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Update
|
public class Update
|
||||||
|
|
Loading…
Reference in a new issue