void runUpdater(Classes.Version version) { string newFilename = Path.Combine(Application.StartupPath, "808DesktopApp.exe"); var cParams = version.vid + " " + version.description + " " + version.force_update + " " + version.update_link + " " + newFilename; string filename = Path.Combine(Application.StartupPath, "808Updater.exe"); var proc = System.Diagnostics.Process.Start(filename, cParams); proc.CloseMainWindow(); proc.Close(); }
Classes.Version checkUpdate() { AllVersion allVersion = null; try { var isOffline = Classes.WebService.CheckForInternetConnection(); if (!isOffline) { allVersion = Classes.WebService.getAllVersion(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } if (allVersion == null) { return(null); } var currentVersion = new System.Version(ProductVersion); var newVersions = allVersion.versions.Where(c => System.Version.Parse(c.vid) > currentVersion); if (newVersions.Count() < 1) { return(null); } var newVersion = new Classes.Version(); newVersion.force_update = "0"; foreach (Classes.Version version in newVersions) { newVersion.force_update = version.force_update == "1" ? "1" : "0"; newVersion.description += version.description + "&&"; } newVersion.update_link = newVersions.LastOrDefault().update_link; newVersion.vid = newVersions.LastOrDefault().vid; newVersion.description = newVersion.description.Replace(" ", "_"); return(newVersion);// = new Classes.Version //{ // description = "تست_برای_کلاینت", // force_update = "1", // update_link = "https://as5.cdn.asset.aparat.com/aparat-video/39647e23a9f2298041c47e645023d7f3765579__29934.mp4", // vid = "1.2.4" //}; }