internal override void Update()
        {
            if (_steps == ESteps.Builder)
            {
                _simulatePatchManifestPath = EditorSimulateModeHelper.SimulateBuild();
                if (string.IsNullOrEmpty(_simulatePatchManifestPath))
                {
                    _steps = ESteps.Done;
                    Status = EOperationStatus.Failed;
                    Error  = "Simulate build failed, see the detail info on the console window.";
                    return;
                }
                _steps = ESteps.Load;
            }

            if (_steps == ESteps.Load)
            {
                if (File.Exists(_simulatePatchManifestPath) == false)
                {
                    _steps = ESteps.Done;
                    Status = EOperationStatus.Failed;
                    Error  = $"Manifest file not found : {_simulatePatchManifestPath}";
                    return;
                }

                YooLogger.Log($"Load manifest file : {_simulatePatchManifestPath}");
                string jsonContent           = FileUtility.ReadFile(_simulatePatchManifestPath);
                var    simulatePatchManifest = PatchManifest.Deserialize(jsonContent);
                _impl.SetSimulatePatchManifest(simulatePatchManifest);
                _steps = ESteps.Done;
                Status = EOperationStatus.Succeed;
            }
        }
예제 #2
0
        /// <summary>
        /// 加载沙盒内的补丁清单
        /// 注意:在加载本地补丁清单之前,已经验证过文件的哈希值
        /// </summary>
        private void LoadSandboxPatchManifest(int updateResourceVersion)
        {
            YooLogger.Log("Load sandbox patch manifest file.");
            string filePath             = PathHelper.MakePersistentLoadPath(YooAssetSettingsData.GetPatchManifestFileName(updateResourceVersion));
            string jsonData             = File.ReadAllText(filePath);
            var    sandboxPatchManifest = PatchManifest.Deserialize(jsonData);

            _impl.SetLocalPatchManifest(sandboxPatchManifest);
        }
예제 #3
0
 /// <summary>
 /// 解析远端请求的补丁清单
 /// </summary>
 private bool ParseRemotePatchManifest(string content)
 {
     try
     {
         _remotePatchManifest = PatchManifest.Deserialize(content);
         return(true);
     }
     catch (Exception e)
     {
         YooLogger.Warning(e.ToString());
         return(false);
     }
 }
예제 #4
0
        /// <summary>
        /// 解析并保存远端请求的补丁清单
        /// </summary>
        private bool ParseAndSaveRemotePatchManifest(int updateResourceVersion, string content)
        {
            try
            {
                var remotePatchManifest = PatchManifest.Deserialize(content);
                _impl.SetLocalPatchManifest(remotePatchManifest);

                YooLogger.Log("Save remote patch manifest file.");
                string savePath = PathHelper.MakePersistentLoadPath(YooAssetSettingsData.GetPatchManifestFileName(updateResourceVersion));
                PatchManifest.Serialize(savePath, remotePatchManifest);
                return(true);
            }
            catch (Exception e)
            {
                YooLogger.Error(e.ToString());
                return(false);
            }
        }
        public void Update()
        {
            if (IsDone())
            {
                return;
            }

            if (_steps == ESteps.LoadStaticVersion)
            {
                YooLogger.Log($"Load application static version.");
                string filePath = PathHelper.MakeStreamingLoadPath(YooAssetSettings.VersionFileName);
                string url      = PathHelper.ConvertToWWWPath(filePath);
                _downloader1 = new UnityWebDataRequester();
                _downloader1.SendRequest(url);
                _steps = ESteps.CheckStaticVersion;
            }

            if (_steps == ESteps.CheckStaticVersion)
            {
                if (_downloader1.IsDone() == false)
                {
                    return;
                }

                if (_downloader1.HasError())
                {
                    Error  = _downloader1.GetError();
                    _steps = ESteps.Failed;
                }
                else
                {
                    _staticVersion = int.Parse(_downloader1.GetText());
                    _steps         = ESteps.LoadAppManifest;
                }
                _downloader1.Dispose();
            }

            if (_steps == ESteps.LoadAppManifest)
            {
                YooLogger.Log($"Load application patch manifest.");
                string filePath = PathHelper.MakeStreamingLoadPath(YooAssetSettingsData.GetPatchManifestFileName(_staticVersion));
                string url      = PathHelper.ConvertToWWWPath(filePath);
                _downloader2 = new UnityWebDataRequester();
                _downloader2.SendRequest(url);
                _steps = ESteps.CheckAppManifest;
            }

            if (_steps == ESteps.CheckAppManifest)
            {
                if (_downloader2.IsDone() == false)
                {
                    return;
                }

                if (_downloader2.HasError())
                {
                    Error  = _downloader2.GetError();
                    _steps = ESteps.Failed;
                }
                else
                {
                    // 解析APP里的补丁清单
                    Result = PatchManifest.Deserialize(_downloader2.GetText());
                    _steps = ESteps.Succeed;
                }
                _downloader2.Dispose();
            }
        }