public static async Task <bool> IsGameVersionCodeEqual() { string versionCodeInner = GlobalConfigComponent.Instance.GlobalProto.VersionCodeInner; Log.Debug($"versionCodeInner:{versionCodeInner}"); string versionCodeOuter = GlobalConfigComponent.Instance.GlobalProto.VersionCodeOuter; Log.Debug($"versionCodeOuter:{versionCodeOuter}"); string versionCode = versionCodeOuter; if (ETModel.Define.isInnetNet) { versionCode = versionCodeInner; } UnityWebRequestAsync webRequestAsync = ComponentFactory.Create <UnityWebRequestAsync>(); try { //下载VersionCode var webRequestGameVersion = webRequestAsync.DownloadAsync(versionCode); await webRequestGameVersion; var versionCodeText = webRequestAsync.Request.downloadHandler.text; ZLog.Info($"versionCode:{versionCodeText}"); webRequestAsync.Dispose(); //比较VersionCode ZLog.Info($"ETModel.Define.versionGameCode:{ETModel.Define.versionGameCode}"); if (versionCodeText.Equals(ETModel.Define.versionGameCode)) { ZLog.Info($"versionGameCode Equal"); return(true); } else { ZLog.Info($"versionGameCode Not Equal"); //while (!VideoUtil.videoFinished) // await UniRx.Async.UniTask.DelayFrame(1); UIComponent uiComponent = Game.Scene.GetComponent <UIComponent>(); UI uiLoading = uiComponent.Get(UIType.UILoading); var uiLoadingComponent = uiLoading.GetComponent <UILoadingComponent>(); //弹提示. var trans = uiLoadingComponent.view.transform.Find("ConfirmWindowVersion"); var tip = new UIUpdateVersionTip(trans); tip.OnConfirm = () => { ETModel.Define.QuitApplication(); }; return(false); } } catch (Exception e) { if (e.Message.Contains("request error")) { webRequestAsync.Dispose(); ZLog.Info("load VersionGameCode err", e.Message); return(false); } } return(false); }
public void TestToStream() { using (var stringWriter = new StringWriter()) { SceneConvert.ToXmlStream(stringWriter, new SceneDef { Name = "hand_left", BgType = BackgroundType.External, Entities = new List <Entity> { new Entity { Tag = "WOUND_GLASS", Position = new Vector2(1.4f, 1.4f), Rotation = 1.4f } } }); string result = stringWriter.ToString(); ZLog.Info(result); SceneDef sceneDef = SceneConvert.FromXmlText(result); Assert.AreEqual(BackgroundType.External, sceneDef.BgType); } }
public override void Awake(UI self, GameObject gameObject) { //ZLog.Error($"UiBgMaskSystem Awake {gameObject.name}"); var canvasConfig = gameObject.GetComponent <CanvasConfig>(); if (canvasConfig == null) { return; } var blacks = FindAllBlack(gameObject.transform)?.ToArray(); if (blacks == null) { return; } var bgMaskManager = Game.Scene.GetComponent <UIComponent>().BgMaskmanager; //if (bgMaskManager.IsShowedBlack) //{ // black.gameObject.SetActive(false); //} var id = bgMaskManager.AddNewBlack(gameObject, blacks); if (id == -1) { ZLog.Info($"不合法的ui..{gameObject.name}"); return; } self.OnUIShowed = () => bgMaskManager.TryShowBlack(id); self.OnUIDisposeBefore = () => bgMaskManager.RemoveBlack(id); self.OnChangeBlack = () => bgMaskManager.UpdateUISelfBlack(id); //查找bgmask //var isTop = gameObject.transform.GetSiblingIndex()== (gameObject.transform.childCount-1); }
void PackageInstallProgress() { if (remRequest.IsCompleted) { switch (remRequest.Status) { case StatusCode.Failure: ZLog.Error("Couldn't install package '" + remRequest.Result.displayName + "': " + remRequest.Error.message); break; case StatusCode.InProgress: break; case StatusCode.Success: ZLog.Info("Installed package: " + remRequest.Result.displayName); break; } if (urlQueue.Count > 0) { remRequest = Client.Add(urlQueue.Dequeue()); } else { // no more packages to remove EditorApplication.update -= PackageInstallProgress; isAddMultiPkg = false; } } }
private void RemoveButton(ProviderModel providerData) { GUI.enabled = true; var btn = GUILayout.Button(new GUIContent { text = "Remove", }, buttonWidth, buttonHeight); if (btn && !isProcessing) { GUI.enabled = true; try { ZLog.Warning(">>>>>>>>> Remove Click! <<<<<<<<<<"); if (EditorUtility.DisplayDialog("Remove Package", "Are you sure you want to remove this package?", "Remove", "Cancle")) { ZBaseEditorCoroutines.StartEditorCoroutine(RemovePackage(providerData.providerName, (result) => { if (result.Status == StatusCode.Success) { ZLog.Info(string.Format("***Remove Success {0} {1}***", providerData.providerName, providerData.latestUnityVersion)); canRefresh = true; } })); } } catch (System.Exception e) { ZLog.Error("Error " + e.Message); } } }
void OnInspectorUpdate() { if (canRefresh) { ZLog.Info("**********Refresh*************"); Refresh(); } }
public void SetActive(bool active) { IsActive = active; ZLog.Info($"设置 image颜色 {active} {transform.name}"); var transActive = transform.gameObject.activeInHierarchy; //优化显示 image.color = !active && transActive ? noShowColor : oldColor; }
private void InstallButton(ProviderModel providerData) { bool btn = GUILayout.Button(new GUIContent { text = "Install", }, buttonWidth, buttonHeight); if (btn && !isProcessing) { GUI.enabled = true; try { ZLog.Warning(">>>>>>>>> Install Click! <<<<<<<<<<"); if (providersSet[providerData.providerName].dependencies.Count == 0) { ZBaseEditorCoroutines.StartEditorCoroutine(AddPackage(providerData, (result) => { if (result.Status == StatusCode.Success) { ZLog.Info(string.Format("***Install Success {0} {1}***", providerData.providerName, providerData.latestUnityVersion)); canRefresh = true; if (!providerData.providerName.StartsWith("com")) { EditorPrefs.SetString("key_package_import", providerData.providerName); } } })); } else { ZBaseEditorCoroutines.StartEditorCoroutine(AddPackageWithDependencie(providerData, (result) => { if (result.Status == StatusCode.Success) { ZLog.Info(string.Format("***Install Success {0} {1}***", providerData.providerName, providerData.latestUnityVersion)); EditorApplication.UnlockReloadAssemblies(); canRefresh = true; if (!providerData.providerName.StartsWith("com")) { EditorPrefs.SetString("key_package_import", providerData.providerName); } } })); } } catch (System.Exception e) { ZLog.Error("Error " + e.Message); } } }
public Task <bool> DownloadAsync(string url) { this.tcs = new TaskCompletionSource <bool>(); url = url.Replace(" ", "%20"); this.Request = UnityWebRequest.Get(url); ZLog.Info("下载: ", url); //ZLog.Info("UnityWebRequest 默认超时: ", Request.timeout); //Request.timeout = 10; this.Request.SendWebRequest(); return(this.tcs.Task); }
private async Task DownServerBundle() { while (true) { try { using (this.webRequest = ComponentFactory.Create<UnityWebRequestAsync>()) { DownloadInfo.IsStart = true; if (ETModel.Define.IsABNotFromServer) { await this.webRequest.DownloadAsync(GetUrlWithPlatform(ETModel.Define.SelfResourceServerIpAndPort + "/") + "StreamingAssets/" + this.downloadingBundle); } else { await this.webRequest.DownloadAsync(GlobalConfigComponent.Instance.GlobalProto.GetUrl() + "StreamingAssets/" + this.downloadingBundle); } //await this.webRequest.DownloadAsync(GlobalConfigComponent.Instance.GlobalProto.GetUrl() + "StreamingAssets/" + this.downloadingBundle); byte[] data = this.webRequest.Request.downloadHandler.data; string path = Path.Combine(PathHelper.AppHotfixResPath, this.downloadingBundle); if (!Directory.Exists(Path.GetDirectoryName(path))) { Directory.CreateDirectory(Path.GetDirectoryName(path)); } using (FileStream fs = new FileStream(path, FileMode.Create)) { fs.Write(data, 0, data.Length); ZLog.Info($"更新Bundle:{path} 完成"); } var p = this.Progress; BundleRealProgress?.Invoke(p); } } catch (Exception e) { Log.Error($"download bundle error: {this.downloadingBundle}\n{e}"); //如果报错了,等1秒 await UniRx.Async.UniTask.Delay(1); continue; } break; } }
private IEnumerator GetRequest(string url, System.Action <Dictionary <string, object> > callback) { UnityWebRequest unityWebRequest = UnityWebRequest.Get(url); var webRequest = unityWebRequest.SendWebRequest(); if (!unityWebRequest.isHttpError && !unityWebRequest.isNetworkError) { ZLog.Info("[Get] URL: " + url); while (!webRequest.isDone) { yield return(new WaitForSeconds(0.1f)); if (EditorUtility.DisplayCancelableProgressBar("Downloading...", "", webRequest.progress)) { ZLog.Error(string.Format("[Get] URL: {0}\n{1}", url, unityWebRequest.error)); CancelDownload(); } } EditorUtility.ClearProgressBar(); string json = unityWebRequest.downloadHandler.text; ZLog.Info("Data: " + json); Dictionary <string, object> dic = new Dictionary <string, object>(); // try { dic = Json.Deserialize(json) as Dictionary <string, object>; if (callback != null) { callback(dic); } } catch (Exception e) { ZLog.Error("[Get] URL: " + url + "\n" + "[Parse Data] Error: " + e.ToString()); } } else { ZLog.Error("[Error] Load Fail: " + unityWebRequest.error); } }
public override IEnumerable <T> Deserialize <T>(IEnumerable <LineMeta> lines) { List <TokenNode> rootTokens = GenerateTokens(lines); Type resultType = typeof(T); List <ParsingError> errors = new List <ParsingError>(); foreach (TokenNode rootToken in rootTokens) { if (rootToken.Type == TokenType.BREAK) { continue; } if (rootToken.Type != TokenType.KEYWORD) { throw new InvalidOperationException($"Expected keyword token: {rootToken.Type}, found token, content {rootToken.Content}"); } if (!ParserKeywordRegistry.TryGetValue(rootToken.Keyword, out IDefParser parser)) { throw new InvalidOperationException($"Unknown top-level token keyword: {rootToken.Keyword}"); } T data = new T(); if (parser.DefType != resultType) { throw new InvalidOperationException($"Expected last parsed keyword: {rootToken.Keyword} to parse as {resultType}"); } ZLog.Info("[ROOT]"); ZLog.Info(rootToken.ToString()); parser.Def = data; ParseNode(null, parser, rootToken, errors); CheckForErrors(rootToken, errors); yield return(data); } }
public void GetVersionInfoFromLocal(Dictionary <string, object> data) { foreach (var item in data) { try { if (item.Key.ToLower().Equals("version")) { this.currentUnityVersion = item.Value as string; } } catch (Exception e) { ZLog.Error("Error parse tool version info " + e.ToString()); } } ZLog.Info(string.Format("***Pack {0} on local, version {1}***", this.displayProviderName, this.currentUnityVersion)); }
private void GetDataFromPackageLockServer(Dictionary <string, object> data) { providersSet.Clear(); try { object dependencies; if (data.TryGetValue("dependencies", out dependencies)) { if (dependencies != null) { foreach (var item in dependencies as Dictionary <string, object> ) { ProviderModel info = new ProviderModel(); if (ZBasePackageIdConfig.ListPackages.ContainsKey(item.Key)) { if (info.GetFromJson(item.Key, item.Value as Dictionary <string, object>)) { providersSet.Add(info.providerName, info); if (info.currentUnityVersion != "none") { ZLog.Info(string.Format("***Package {0} on server, version {1}***", info.displayProviderName, info.latestUnityVersion)); } } } } } } progressLoadData++; ZBaseEditorCoroutines.StartEditorCoroutine(GetVersionForEmbeddedPack()); } catch (Exception e) { ZLog.Error("Error Get Version From Package Lock Server: " + e.Message); } }
public void LoadOneBundle(string assetBundleName) { //Log.Debug($"---------------load one bundle {assetBundleName}"); ABInfo abInfo; if (this.bundles.TryGetValue(assetBundleName, out abInfo)) { ++abInfo.RefCount; return; } if (this.cacheDictionary.ContainsKey(assetBundleName)) { abInfo = this.cacheDictionary[assetBundleName]; ++abInfo.RefCount; this.bundles[assetBundleName] = abInfo; this.cacheDictionary.Remove(assetBundleName); return; } if (!Define.isUseAssetBundle) { #if UNITY_EDITOR //string[] realPath = null; //realPath = AssetDatabase.GetAssetPathsFromAssetBundle(assetBundleName); //foreach (string s in realPath) //{ // string assetName = Path.GetFileNameWithoutExtension(s); // string path = $"{assetBundleName}/{assetName}".ToLower(); // UnityEngine.Object resource = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(s); // this.resourceCache[path] = resource; //} this.bundles[assetBundleName] = new ABInfo(assetBundleName, null); #endif return; } string p = Path.Combine(PathHelper.AppHotfixResPath, assetBundleName); AssetBundle assetBundle = null; if (File.Exists(p)) { assetBundle = AssetBundle.LoadFromFile(p); } else { p = Path.Combine(PathHelper.AppResPath, assetBundleName); assetBundle = AssetBundle.LoadFromFile(p); } if (assetBundle == null) { throw new Exception($"assets bundle not found: {assetBundleName}"); } //if (!assetBundle.isStreamedSceneAssetBundle) //{ // // 异步load资源到内存cache住 // UnityEngine.Object[] assets = assetBundle.LoadAllAssets(); // foreach (UnityEngine.Object asset in assets) // { // string path = $"{assetBundleName}/{asset.name}".ToLower(); // this.resourceCache[path] = asset; // } //} ZLog.Info("读取 assetBundle", assetBundleName, " loaded: ", assetBundle); this.bundles[assetBundleName] = new ABInfo(assetBundleName, assetBundle); }
public static void FindBlack() { var tag = "BgBlack"; var commonSprite = AssetDatabase.LoadAssetAtPath <UnityEngine.Sprite>("Assets/UIResource/CommonUI/BgMask.png"); var s = new UnityEngine.Vector2(1280, 720); var prefabs = UIPrefabs(); //ZLog.Info(prefabs[0]); for (int j = 0; j < prefabs.Count; j++) { var prefab = prefabs[j]; var ui = AssetDatabase.LoadAssetAtPath <UnityEngine.GameObject>(prefab); var images = ui.transform.GetComponentsInChildren <UnityEngine.UI.Image>(true); var prefabName = Path.GetFileName(prefab); for (int i = 0; i < images.Length; i++) { var item = images[i]; if (item.rectTransform.sizeDelta == s) { if (item.sprite != null) { if (item.GetComponent <UnityEngine.UI.Mask>() != null) { continue; } if (item.sprite.name.Contains("mask") || item.sprite.name.Contains("Mask")) { } else { continue; //ZLog.Info($"找到 {item.name} 引用 {item.sprite.name} {prefabName}"); } //if (item.sprite.rect.size != s) //{ // if (item.sprite.name != "BgMask") // { // ZLog.Info($"尺寸不一样的 {item.name} {item.sprite.name} {prefabName}"); // continue; // } //} if (item.tag == tag) { if (item.sprite != commonSprite) { item.sprite = commonSprite; ZLog.Info($"手动指定tag的修改sprite图片 {item.name} {prefabName}"); } continue; } ; item.tag = tag; item.sprite = commonSprite; //item.sprite = ZLog.Info($"设置 {item.name} 引用 {item.sprite.name} {prefabName}"); } else { //ZLog.Error($"找到 {item.name} {prefabName} 未设置 sprite"); } } else { if (item.sprite != null && (item.sprite.name.Contains("mask") || item.sprite.name.Contains("Mask") )) { if (item.GetComponent <UnityEngine.UI.Mask>() != null) { continue; } //ZLog.Error($"尺寸不对? {item.name} 引用 {item.sprite.name} " + // $"{prefabName} size {item.sprite.rect.size}" + // $"sizeDelta {item.rectTransform.sizeDelta}"); } } } } //ZLog.Info($"{prefabs[0]} count: {images.Length}"); }
public void 执行静态方法(string str) { //限制同一个Assembly if (string.IsNullOrEmpty(str)) { return; } var dotStrs = str.Split('.'); var paramStrs = new List <string>(); var paramStr = ""; var fnName = ""; if (dotStrs.Length == 1) { ZLog.Error("格式不对"); return; } { var fnStr = dotStrs[dotStrs.Length - 1]; int index = fnStr.IndexOf('('); if (index < 0) { ZLog.Error("格式不对"); return; } int last = fnStr.LastIndexOf(')'); fnName = fnStr.Substring(0, index).Trim(); paramStr = fnStr.Substring(index + 1, last - index - 1); } // 解析方法参数 { var paramsList = paramStr.Split(','); for (int i = 0; i < paramsList.Length; i++) { bool isSucc = true; var code = paramsList[i].Trim(); var param = ""; var value = ""; { var arr = code.Split(':'); if (arr.Length >= 2) { param = arr[0].Trim(); value = arr[1].Trim(); } else if (arr.Length == 1) { value = arr[0].Trim(); } else { isSucc = false; } } if (isSucc) { paramStrs.Add(value); } else { paramStrs.Add(null); } } } { var assembly = this.GetType().Assembly; string typestr = ""; for (int i = 0; i < (dotStrs.Length - 1); i++) { typestr += dotStrs[i]; if (i != (dotStrs.Length - 2)) { typestr += "."; } } var type = assembly.GetType(typestr); if (type == null) { ZLog.Error("找不到类: ", typestr); return; } else { ZLog.Info("找到类: ", typestr); } //ActorTaskHelp.SetActiveWall var methodInfo = type.GetMethod(fnName); if (methodInfo == null) { ZLog.Error("找不到方法: ", fnName); return; } { var paramList = methodInfo.GetParameters(); object[] params1 = new object[paramList.Length]; for (int i = 0; i < params1.Length; i++) { var info = paramList[i]; if (info.ParameterType == typeof(bool)) { params1[i] = bool.Parse(paramStrs[i]); } else if (info.ParameterType == typeof(string)) { params1[i] = paramStrs[i]; } else if (info.ParameterType == typeof(int)) { params1[i] = int.Parse(paramStrs[i]); } else if (info.ParameterType == typeof(float)) { params1[i] = float.Parse(paramStrs[i]); } } methodInfo.Invoke(null, params1); } } }
// local private IEnumerator GetVersionFromPackageLockLocal() { while (!IsLoadDataServerDone()) { yield return(new WaitForSeconds(0.1f)); } Dictionary <string, object> dic = new Dictionary <string, object>(); providersLocal.Clear(); try { string fileContent = File.ReadAllText(PackLockLocalDir); dic = Json.Deserialize(fileContent) as Dictionary <string, object>; object dependencies; if (dic.TryGetValue("dependencies", out dependencies)) { if (dependencies != null) { foreach (var item in dependencies as Dictionary <string, object> ) { ProviderModel info = new ProviderModel(); if (ZBasePackageIdConfig.ListPackages.ContainsKey(item.Key)) { if (info.GetFromJson(item.Key, item.Value as Dictionary <string, object>)) { providersLocal.Add(info.providerName, info); if (info.currentUnityVersion != "none") { ZLog.Info(string.Format(">>>Package {0} on local, version {1}<<<", info.displayProviderName, info.currentUnityVersion)); } } } } foreach (var item in providersLocal) { ProviderModel info = item.Value; if (info.source == ZBaseEnum.Source.embedded && info.currentUnityVersion == "none") { LoadPackageFromLocal(info.providerName, info.GetVersionInfoFromLocal); } else if (info.source == ZBaseEnum.Source.git && info.currentUnityVersion == "none" && !string.IsNullOrEmpty(info.hash)) { LoadPackageCacheFromLocal(info.providerName, info.hash, info.GetVersionInfoFromLocal); } } CompareVersion(); //check package not install if (providersLocal.Count != ZBasePackageIdConfig.ListPackages.Count) //skip item package manager { foreach (var item in ZBasePackageIdConfig.ListPackages) { if (providersLocal.ContainsKey(item.Key)) { continue; } if (!providersSet.ContainsKey(item.Key)) { continue; } ProviderModel info = providersSet[item.Key].ShallowCopy(); info.currentStatues = ZBaseEnum.Status.none; info.currentUnityVersion = "none"; if (!item.Key.StartsWith("com")) { info.source = ZBaseEnum.Source.package; } providersLocal.Add(info.providerName, info); ZLog.Info(string.Format(">>>Package {0} not install<<<", info.displayProviderName)); } } } } SortListLocal(); ScopedRegistryConfig(); } catch (Exception e) { ZLog.Info("Error Get Version From Package Lock Local: " + e.Message); } var packageImport = EditorPrefs.GetString("key_package_import", string.Empty); if (!string.IsNullOrEmpty(packageImport)) { if (providersSet.Keys.Contains(packageImport)) { ImportPackage(providersSet[packageImport]); } EditorPrefs.SetString("key_package_import", string.Empty); } Repaint(); }
public override void ParseOptions(string[] options) { ZLog.Info($"[PREOP] [ParseOptions] options: {options}"); }
/// <summary> /// 返回是否需要下载 /// </summary> /// <returns></returns> public async Task<bool> LoadInfo() { isNetNotReach = false; string versionUploadSelfResUrl = GlobalConfigComponent.Instance.GlobalProto.VersionUploadSelfResUrl; Log.Debug($"versionUploadSelfResUrl:{versionUploadSelfResUrl}"); if (ETModel.Define.isInnetNet) { versionUploadSelfResUrl = GlobalConfigComponent.Instance.GlobalProto.VersionUploadSelfResUrl_InnerNet; Log.Debug($"VersionUploadSelfResUrl_InnerNet:{versionUploadSelfResUrl}"); } UnityWebRequestAsync webRequestSelfVersionAsync = ComponentFactory.Create<UnityWebRequestAsync>(); UnityWebRequestAsync webRequestAsync = ComponentFactory.Create<UnityWebRequestAsync>(); string versionText = string.Empty; try { //下载外层资源文件夹版本,即父目录 var webRequestSelfResVersionTask = webRequestSelfVersionAsync.DownloadAsync(versionUploadSelfResUrl); await webRequestSelfResVersionTask; ZLog.Info($"webRequestSelfResVersionText:{webRequestSelfVersionAsync.Request.downloadHandler.text}"); ETModel.Define.ParentResABDirectory = webRequestSelfVersionAsync.Request.downloadHandler.text; ZLog.Info($"ParentDirectory:{ETModel.Define.ParentResABDirectory}"); webRequestSelfVersionAsync.Dispose(); //下载bundle流程 string versionUrl = GlobalConfigComponent.Instance.GlobalProto.GetUrl() + "StreamingAssets/" + "Version.txt"; if (ETModel.Define.IsABNotFromServer) { versionUrl = GetUrlWithPlatform(ETModel.Define.SelfResourceServerIpAndPort + "/") + "StreamingAssets/" + "Version.txt"; } Log.Debug($"versionUrl:{versionUrl}"); var webRequestTask = webRequestAsync.DownloadAsync(versionUrl); await webRequestTask; versionText = webRequestAsync.Request.downloadHandler.text; webRequestSelfVersionAsync.Dispose(); } catch (Exception e) { if (e.Message.Contains("request error")) { webRequestSelfVersionAsync.Dispose(); webRequestAsync.Dispose(); ZLog.Info("load Version err", e.Message); Define.isUseStreamingAssetRes = true; OnFileServerNotReach(e.Message); return false; } } ZLog.Info($"versionText:{versionText}"); if (!versionText.StartsWith("{")) { this.VersionConfig = null; return false; } this.VersionConfig = JsonHelper.FromJson<VersionConfig>(versionText); //Log.Debug(JsonHelper.ToJson(this.VersionConfig)); if (isNetNotReach)//文件服务器没开启 { //var timeTask = DelayFrame(); //this.TagDownloadFinish(); //await timeTask; return false; } else //成功的事情 { VersionConfig localVersionConfig; // 对比本地的Version.txt string versionPath = Path.Combine(PathHelper.AppHotfixResPath, "Version.txt"); if (File.Exists(versionPath)) { localVersionConfig = JsonHelper.FromJson<VersionConfig>(File.ReadAllText(versionPath)); } else { versionPath = Path.Combine(PathHelper.AppResPath4Web, "Version.txt"); using (UnityWebRequestAsync request = ComponentFactory.Create<UnityWebRequestAsync>()) { try { await request.DownloadAsync(versionPath); localVersionConfig = JsonHelper.FromJson<VersionConfig>(request.Request.downloadHandler.text); } catch (System.Exception e) { Log.Debug(e.ToString()); localVersionConfig = null; } } } if (localVersionConfig != null) { // 先删除服务器端没有的ab foreach (FileVersionInfo fileVersionInfo in localVersionConfig.FileInfoDict.Values) { if (this.VersionConfig.FileInfoDict.ContainsKey(fileVersionInfo.File)) { continue; } string abPath = Path.Combine(PathHelper.AppHotfixResPath, fileVersionInfo.File); if(File.Exists(abPath))File.Delete(abPath); } } // 再下载 foreach (FileVersionInfo fileVersionInfo in this.VersionConfig.FileInfoDict.Values) { FileVersionInfo localVersionInfo; if (localVersionConfig != null && localVersionConfig.FileInfoDict.TryGetValue(fileVersionInfo.File, out localVersionInfo)) { if (fileVersionInfo.MD5 == localVersionInfo.MD5) { continue; } } if (fileVersionInfo.File == "Version.txt") { continue; } this.bundles.Enqueue(fileVersionInfo.File); this.TotalSize += fileVersionInfo.Size; } DownloadInfo.TotalSize = TotalSize; //if (this.bundles.Count == 0) //{ // return; //} //Log.Debug($"need download bundles: {this.bundles.ToList().ListToString()}"); return true; //await Down(); } }