internal override void Update()
        {
            if (_steps == ESteps.None || _steps == ESteps.Done)
            {
                return;
            }

            if (_steps == ESteps.InitCache)
            {
                // 每次启动时比对APP版本号是否一致
                CacheData cacheData = CacheData.LoadCache();
                if (cacheData.CacheAppVersion != Application.version)
                {
                    YooLogger.Warning($"Cache is dirty ! Cache application version is {cacheData.CacheAppVersion}, Current application version is {Application.version}");

                    // 注意:在覆盖安装的时候,会保留APP沙盒目录,可以选择清空缓存目录
                    if (_impl.ClearCacheWhenDirty)
                    {
                        YooLogger.Warning("Clear cache files.");
                        SandboxHelper.DeleteCacheFolder();
                    }

                    // 更新缓存文件
                    CacheData.UpdateCache();
                }
                _steps = ESteps.Update;
            }

            if (_steps == ESteps.Update)
            {
                _appManifestLoader.Update();
                Progress = _appManifestLoader.Progress();
                if (_appManifestLoader.IsDone() == false)
                {
                    return;
                }

                if (_appManifestLoader.Result == null)
                {
                    _steps = ESteps.Done;
                    Status = EOperationStatus.Failed;
                    Error  = _appManifestLoader.Error;
                }
                else
                {
                    _steps = ESteps.Done;
                    Status = EOperationStatus.Succeed;
                    _impl.SetAppPatchManifest(_appManifestLoader.Result);
                    _impl.SetLocalPatchManifest(_appManifestLoader.Result);
                }
            }
        }
Example #2
0
 /// <summary>
 /// 清空所有的缓存文件
 /// </summary>
 public static void ClearAllCacheFiles()
 {
     SandboxHelper.DeleteCacheFolder();
 }