mirror of
https://github.com/knah/VRCMelonAssistant.git
synced 2024-05-21 12:53:18 +12:00
Fixes #165
This commit is contained in:
parent
ec03c8127b
commit
c9bceb8a21
|
@ -25,6 +25,7 @@ namespace ModAssistant
|
|||
public static string Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
public static List<string> SavedMods = ModAssistant.Properties.Settings.Default.SavedMods.Split(',').ToList();
|
||||
public static MainWindow window;
|
||||
public static string Arguments;
|
||||
public static bool Update = true;
|
||||
public static bool GUI = true;
|
||||
|
||||
|
@ -72,6 +73,8 @@ namespace ModAssistant
|
|||
ReinstallInstalledMods = ModAssistant.Properties.Settings.Default.ReinstallInstalled;
|
||||
CloseWindowOnFinish = ModAssistant.Properties.Settings.Default.CloseWindowOnFinish;
|
||||
|
||||
MessageBox.Show(string.Join(" ", e.Args));
|
||||
|
||||
await ArgumentHandler(e.Args);
|
||||
await Init();
|
||||
}
|
||||
|
@ -80,7 +83,14 @@ namespace ModAssistant
|
|||
{
|
||||
if (Update)
|
||||
{
|
||||
await Task.Run(async () => await Updater.Run());
|
||||
try
|
||||
{
|
||||
await Task.Run(async () => await Updater.Run());
|
||||
}
|
||||
catch (UnauthorizedAccessException e)
|
||||
{
|
||||
Utils.StartAsAdmin(Arguments, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (GUI)
|
||||
|
@ -96,6 +106,7 @@ namespace ModAssistant
|
|||
|
||||
private async Task ArgumentHandler(string[] args)
|
||||
{
|
||||
Arguments = string.Join(" ", args);
|
||||
while (args.Length > 0)
|
||||
{
|
||||
switch (args[0])
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace ModAssistant
|
|||
private static Version LatestVersion;
|
||||
private static bool NeedsUpdate = false;
|
||||
private static string NewExe = Path.Combine(Path.GetDirectoryName(Utils.ExePath), "ModAssistant.exe");
|
||||
private static string Arguments = App.Arguments;
|
||||
|
||||
public static async Task<bool> CheckForUpdate()
|
||||
{
|
||||
|
@ -77,7 +78,7 @@ namespace ModAssistant
|
|||
|
||||
private static void RunNew()
|
||||
{
|
||||
Process.Start(NewExe);
|
||||
Process.Start(NewExe, Arguments);
|
||||
Application.Current.Dispatcher.Invoke(() => { Application.Current.Shutdown(); });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue