public ExtractingState(string extractMe, PdnVersionInfo newVersionInfo) : base(false, false, MarqueeStyle.Smooth) { this.extractMe = extractMe; this.newVersionInfo = newVersionInfo; }
/// <summary> /// Downloads the latest updates manifest from the Paint.NET web server. /// </summary> /// <returns>The latest updates manifest, or null if there was an error in which case the exception argument will be non-null.</returns> // TODO: throw the exception, don't return it via an out parameter private static PdnVersionManifest GetUpdatesManifest(out Exception exception) { try { string versionsUrl = VersionManifestUrl; Uri versionsUri = new Uri(versionsUrl); byte[] manifestBuffer = Utility.DownloadSmallFile(versionsUri); string manifestText = System.Text.Encoding.UTF8.GetString(manifestBuffer); string[] manifestLines = BreakIntoLines(manifestText); NameValueCollection nameValues = LinesToNameValues(manifestLines); string downloadPageUrl = nameValues[downloadPageUrlName]; string stableVersionsStrings = nameValues[stableVersionsName]; Version[] stableVersions = VersionStringToArray(stableVersionsStrings); string[] stableNames = BuildVersionValueMapping(nameValues, stableVersions, nameNameFormat); string[] stableNetFxVersions = BuildVersionValueMapping(nameValues, stableVersions, netFxVersionNameFormat); string[] stableInfoUrls = BuildVersionValueMapping(nameValues, stableVersions, infoUrlNameFormat); string[] stableZipUrls = BuildVersionValueMapping(nameValues, stableVersions, zipUrlListNameFormat); string[] stableFullZipUrls = BuildVersionValueMapping(nameValues, stableVersions, fullZipUrlListNameFormat); string betaVersionsStrings = nameValues[betaVersionsName]; Version[] betaVersions = VersionStringToArray(betaVersionsStrings); string[] betaNames = BuildVersionValueMapping(nameValues, betaVersions, nameNameFormat); string[] betaNetFxVersions = BuildVersionValueMapping(nameValues, betaVersions, netFxVersionNameFormat); string[] betaInfoUrls = BuildVersionValueMapping(nameValues, betaVersions, infoUrlNameFormat); string[] betaZipUrls = BuildVersionValueMapping(nameValues, betaVersions, zipUrlListNameFormat); string[] betaFullZipUrls = BuildVersionValueMapping(nameValues, betaVersions, fullZipUrlListNameFormat); PdnVersionInfo[] versionInfos = new PdnVersionInfo[betaVersions.Length + stableVersions.Length]; int cursor = 0; for (int i = 0; i < stableVersions.Length; ++i) { List<string> zipUrlList = new List<string>(); SplitUrlList(stableZipUrls[i], zipUrlList); List<string> fullZipUrlList = new List<string>(); SplitUrlList(stableFullZipUrls[i], fullZipUrlList); PdnVersionInfo info = new PdnVersionInfo(stableVersions[i], stableNames[i], new Version(stableNetFxVersions[i]), stableInfoUrls[i], zipUrlList.ToArray(), fullZipUrlList.ToArray(), true); versionInfos[cursor] = info; ++cursor; } for (int i = 0; i < betaVersions.Length; ++i) { List<string> zipUrlList = new List<string>(); SplitUrlList(betaZipUrls[i], zipUrlList); List<string> fullZipUrlList = new List<string>(); SplitUrlList(betaFullZipUrls[i], fullZipUrlList); PdnVersionInfo info = new PdnVersionInfo(betaVersions[i], betaNames[i], new Version(betaNetFxVersions[i]), betaInfoUrls[i], zipUrlList.ToArray(), fullZipUrlList.ToArray(), false); versionInfos[cursor] = info; ++cursor; } PdnVersionManifest manifest = new PdnVersionManifest(downloadPageUrl, versionInfos); exception = null; return manifest; } catch (Exception ex) { exception = ex; return null; } }
public UpdateAvailableState(PdnVersionInfo newVersionInfo) : base(false, true, MarqueeStyle.None) { this.newVersionInfo = newVersionInfo; }
public DownloadingState(PdnVersionInfo downloadMe) : base(false, false, MarqueeStyle.Smooth) { this.downloadMe = downloadMe; }
public ReadyToInstallState(string installerPath, PdnVersionInfo newVersionInfo) : base(false, true, MarqueeStyle.None) { this.installerPath = installerPath; this.newVersionInfo = newVersionInfo; }