private UpgradeFileInfo UF_CreateUpgradeFileInfo(string chunk) { UpgradeFileInfo ret = new UpgradeFileInfo(); string[] value = GHelper.UF_SplitStringWithCount(chunk, 3); ret.version = value [0].Substring(value [0].IndexOf('-') + 1); ret.size = int.Parse(value [1].Trim()); ret.zip = value [0].Trim() + ".zip"; //取用CDN资源 ret.url = string.Format("{0}/{1}", GlobalSettings.UrlAssetsUpgrade.Trim(), ret.zip); ret.ucode = value [2]; return(ret); }
//格式: // base=61598 // 61598-61685;1685;3504492d24d3e43f8eb174e60241fb21 // 61685-61917;31190;3504492d24d3e43f8eb174e60241fb22 // 61917-61982;2893;3504492d24d3e43f8eb174e60241fb23 // 61982-62029;4503;3504492d24d3e43f8eb174e60241fb24 // 62029-62057;1711;3504492d24d3e43f8eb174e60241fb25 // *61598-62057;345672;3504492d24d3e43f8eb174e60241fb26 // 62057-62097;2721;3504492d24d3e43f8eb174e60241fb27 // *61598-62097;6725;3504492d24d3e43f8eb174e60241fb28 // 62097-62104;13725;3504492d24d3e43f8eb172453241fb28 //注:* 为整合包,也就是从原始base版本包与最新的版本包所打的集合更新包 //获取更新列表只取最新的 整合包数据,并且按照版本排列更新包队列 private void UF_WrapUpdateList(string filechunk, string curResVersion, List <UpgradeFileInfo> outUpdateFileinfos) { //全部都的更新信息 List <UpgradeFileInfo> lstTotalUpdateInfo = new List <UpgradeFileInfo>(); if (string.IsNullOrEmpty(filechunk)) { return; } StringReader sr = new StringReader(filechunk); string line = ""; string assembleChunk = ""; line = sr.ReadLine(); //获取base版本 webBaseResVersion = line.Substring(line.IndexOf("=") + 1); UF_LogInfo("WebBaseAssetVersion: " + webBaseResVersion); while ((line = sr.ReadLine()) != null) { if (line != "") { //只取最后版本的整合包作为最新整合包 if (line.StartsWith("*")) { assembleChunk = line.Trim().Substring(1); } else { var upgradeinfo = UF_CreateUpgradeFileInfo(line.Trim()); lstTotalUpdateInfo.Add(upgradeinfo); } } } //当前版本等于web base版本,即为随包版本 //检查是否有整合包,并设置为首个更新包 if (curResVersion == webBaseResVersion && !string.IsNullOrEmpty(assembleChunk)) { UpgradeFileInfo assemblePack = UF_CreateUpgradeFileInfo(assembleChunk); outUpdateFileinfos.Add(assemblePack); //以最新版本继续往下检测更新包 curResVersion = assemblePack.version; UF_LogInfo("Add Upgrade Assemble Info: " + assemblePack.version); } bool hook_mark = false; for (int k = 0; k < lstTotalUpdateInfo.Count; k++) { if (curResVersion == webBaseResVersion) { hook_mark = true; } else if (curResVersion == lstTotalUpdateInfo[k].version) { hook_mark = true; continue; } if (hook_mark) { outUpdateFileinfos.Add(lstTotalUpdateInfo[k]); UF_LogInfo("Add Upgrade File Info: " + lstTotalUpdateInfo[k].version); } } }