Beispiel #1
0
 private static PdnVersionManifest GetUpdatesManifest(out Exception exception)
 {
     try
     {
         Uri    uri   = new Uri(VersionManifestUrl);
         byte[] bytes = WebHelpers.DownloadSmallFile(uri);
         NameValueCollection nameValues   = LinesToNameValues(BreakIntoLines(Encoding.UTF8.GetString(bytes)));
         string           downloadPageUrl = nameValues["DownloadPageUrl"];
         string           versions        = nameValues["StableVersions"];
         Version[]        versionArray    = VersionStringToArray(versions);
         string[]         strArray2       = BuildVersionValueMapping(nameValues, versionArray, "{0}_Name");
         string[]         strArray3       = BuildVersionValueMapping(nameValues, versionArray, "{0}_NetFxVersion");
         string[]         strArray4       = BuildVersionValueMapping(nameValues, versionArray, "{0}_InfoUrl");
         string[]         strArray5       = BuildVersionValueMapping(nameValues, versionArray, "{0}_ZipUrlList");
         string[]         strArray6       = BuildVersionValueMapping(nameValues, versionArray, "{0}_FullZipUrlList");
         string           str5            = nameValues["BetaVersions"];
         Version[]        versionArray2   = VersionStringToArray(str5);
         string[]         strArray7       = BuildVersionValueMapping(nameValues, versionArray2, "{0}_Name");
         string[]         strArray8       = BuildVersionValueMapping(nameValues, versionArray2, "{0}_NetFxVersion");
         string[]         strArray9       = BuildVersionValueMapping(nameValues, versionArray2, "{0}_InfoUrl");
         string[]         strArray10      = BuildVersionValueMapping(nameValues, versionArray2, "{0}_ZipUrlList");
         string[]         strArray11      = BuildVersionValueMapping(nameValues, versionArray2, "{0}_FullZipUrlList");
         PdnVersionInfo[] versionInfos    = new PdnVersionInfo[versionArray2.Length + versionArray.Length];
         int index = 0;
         for (int i = 0; i < versionArray.Length; i++)
         {
             List <string> urlsOutput = new List <string>();
             SplitUrlList(strArray5[i], urlsOutput);
             List <string> list2 = new List <string>();
             SplitUrlList(strArray6[i], list2);
             Version version = new Version(strArray3[i]);
             if ((version.Major == 2) && (version.Minor == 0))
             {
                 version = new Version(2, 0, 0);
             }
             versionInfos[index] = new PdnVersionInfo(versionArray[i], strArray2[i], version.Major, version.Minor, version.Build, strArray4[i], urlsOutput.ToArrayEx <string>(), list2.ToArrayEx <string>(), true);
             index++;
         }
         for (int j = 0; j < versionArray2.Length; j++)
         {
             List <string> list3 = new List <string>();
             SplitUrlList(strArray10[j], list3);
             List <string> list4 = new List <string>();
             SplitUrlList(strArray11[j], list4);
             Version version2 = new Version(strArray8[j]);
             if ((version2.Major == 2) && (version2.Minor == 0))
             {
                 version2 = new Version(2, 0, 0);
             }
             versionInfos[index] = new PdnVersionInfo(versionArray2[j], strArray7[j], version2.Major, version2.Minor, version2.Build, strArray9[j], list3.ToArrayEx <string>(), list4.ToArrayEx <string>(), false);
             index++;
         }
         PdnVersionManifest manifest = new PdnVersionManifest(downloadPageUrl, versionInfos);
         exception = null;
         return(manifest);
     }
     catch (Exception exception2)
     {
         exception = exception2;
         return(null);
     }
 }