public bool CheckForUpdate(string url, string deleteText, int lineNumber, string currentVersion) //Use this to check for updates { if (reader == null) { reader = new WebHandler(); } string processedUrl = reader.processGit_Text(reader.WaitOn_URL(url), deleteText, lineNumber); string gitVersion = reader.Get_GitVersion(processedUrl); LatestVersionNumber = gitVersion; if (!Guard.IsStringValid(currentVersion)) { return(true); } if (!Guard.IsStringValid(gitVersion)) { ConsoleHandler.append("Unable to determine latest version"); return(false); } int number = 0; string toolboxVersion = ""; foreach (char c in currentVersion) { if (Int32.TryParse(c.ToString(), out number)) { toolboxVersion = toolboxVersion + c; } } if (Int32.Parse(toolboxVersion) < Int32.Parse(gitVersion)) { return(true); } else { return(false); } }
private void Download_ModLoader() { WebHandler web = new WebHandler(); WebClient client = new WebClient(); string url = "https://raw.githubusercontent.com/TDToolbox/BTDToolbox-2019_LiveFIles/master/Version"; string gitText = web.WaitOn_URL(url); string downloadURL = web.processGit_Text(gitText, "modloader: ", 2); client.DownloadFile(downloadURL, "Update"); if (File.Exists(modloader_zipName)) { File.Delete(modloader_zipName); } File.Move("Update", modloader_zipName); ConsoleHandler.append("Mod Loader successfully downloaded!"); }