private static List <ProgramVersion> GetVersions() { try { WebClient webClient; webClient = new WebClient(); string getStringTask = webClient.DownloadString("http://www.IdleClicker.hexcore.pl/FilesInfo/NewestVersion.php"); //Task<string> getStringTask = webClient.GetStringAsync("http://localhost/IdleClicker/FilesInfo/NewestVersion.php"); List <ProgramVersion> versions = new List <ProgramVersion>(); string[] stringVersions = getStringTask.Split('|'); foreach (string item in stringVersions) { ProgramVersion newVersion = new ProgramVersion(0, 0, 0); newVersion.FromString(item); versions.Add(newVersion); } return(versions); } catch// (Exception e) { throw new Exception("Błąd sprawdzania wersji"); } }
private static bool CheckIfUpToDatePriv(List <ProgramVersion> versions) { isError = false; StatusText = "Sprawdzanie wersji"; ProgramVersion newestVersion = versions.First <ProgramVersion>(); Program.NewestVersion = newestVersion; if (newestVersion.CompareTo(Program.Version) > 0) { string t1 = GetChangeLogs(); isError = false; StatusText = "Dostępna nowa wersja!"; return(true); } else { isError = false; StatusText = "Program aktualny!"; return(false); } }
static Program() { version = new ProgramVersion(1, 0, 0); }