internal PackageSummary(Catalog data, string selectedVersion) { Catalogentry catalogEntry = data.GetAllCatalogEntry().First(entry => entry.version == selectedVersion); PackageId = catalogEntry.id; Title = catalogEntry.title; Image = data.icon; SelectedVersion = selectedVersion; InstalledVersion = selectedVersion; AllVersion = data.GetAllVersion().AsEnumerable().Reverse().ToList(); StableVersion = AllVersion.Where(version => !version.Contains('-') && version[0] != '0').ToList(); }
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" //}; }