diff --git a/MSCLoader/CoolUpdater/Program.cs b/MSCLoader/CoolUpdater/Program.cs index 7fd5b3f..f5450c8 100644 --- a/MSCLoader/CoolUpdater/Program.cs +++ b/MSCLoader/CoolUpdater/Program.cs @@ -6,6 +6,7 @@ using System.Windows.Forms; using System.Diagnostics; using System.Reflection; +using System.Security.Principal; namespace CoolUpdater { @@ -84,6 +85,18 @@ static void Main(string[] args) DownloadFile(args[1], args[2], token2); break; case "update-all": + if (!IsUserAdministrator()) + { + // Restart as an admin, if no admin right has been given + Process p = new Process(); + p.StartInfo.FileName = Assembly.GetEntryAssembly().Location; + p.StartInfo.Arguments = string.Join(" ", args); + p.StartInfo.Verb = "runas"; + p.Start(); + Environment.Exit(0); + return; + } + string pathToMods = args.Length < 2 ? "" : args[1].Replace("%20", " "); UpdateView view = new UpdateView(pathToMods); Application.Run(view); @@ -193,5 +206,27 @@ private static void Client_DownloadProgressChanged(object sender, DownloadProgre { Console.WriteLine(e.ProgressPercentage + "%"); } + + public static bool IsUserAdministrator() + { + //bool value to hold our return value + bool isAdmin; + try + { + //get the currently logged in user + WindowsIdentity user = WindowsIdentity.GetCurrent(); + WindowsPrincipal principal = new WindowsPrincipal(user); + isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator); + } + catch (UnauthorizedAccessException ex) + { + isAdmin = false; + } + catch (Exception ex) + { + isAdmin = false; + } + return isAdmin; + } } } \ No newline at end of file diff --git a/MSCLoader/CoolUpdater/UpdateView.cs b/MSCLoader/CoolUpdater/UpdateView.cs index be311bb..e7c903f 100644 --- a/MSCLoader/CoolUpdater/UpdateView.cs +++ b/MSCLoader/CoolUpdater/UpdateView.cs @@ -68,7 +68,7 @@ public UpdateView(string modsPath) title.MouseMove += DragWindowByThis; Version version = Assembly.GetExecutingAssembly().GetName().Version; - labVer.Text = "GM-" + version.Major + "." + version.Minor; + labVer.Text = version.Major + "." + version.Minor; if (version.Build != 0) { labVer.Text += "." + version.Build; diff --git a/MSCLoader/MSCLoader/CHANGELOG.md b/MSCLoader/MSCLoader/CHANGELOG.md index 0671efc..62a60f3 100644 --- a/MSCLoader/MSCLoader/CHANGELOG.md +++ b/MSCLoader/MSCLoader/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 1.0.4 (tba) + +### Bug Fixes + +- Mod Auto Updater should now prioritze archives with .pro.zip extension as intended +- CoolUpdater: Fixed "Start Game" button not starting the game with Mod Loader Pro + ## 1.0.3 (30.04.2021) ### Added diff --git a/MSCLoader/MSCLoader/ModUpdater.cs b/MSCLoader/MSCLoader/ModUpdater.cs index 949611b..45e84a9 100644 --- a/MSCLoader/MSCLoader/ModUpdater.cs +++ b/MSCLoader/MSCLoader/ModUpdater.cs @@ -330,7 +330,7 @@ IEnumerator CheckForModUpdates(IEnumerable mods) } // Breaking out of the loop, if we found all that we've been looking for. - if (!string.IsNullOrEmpty(mod.ModUpdateData.ZipUrl) && !string.IsNullOrEmpty(mod.ModUpdateData.LatestVersion) && foundProBuild) + if (!string.IsNullOrEmpty(mod.ModUpdateData.ZipUrl) && !string.IsNullOrEmpty(mod.ModUpdateData.LatestVersion) || foundProBuild) { break; }