コード例 #1
0
 private void OnValidatePatchEnter(int eventID, FSMState preState, FSMState currentState)
 {
     Debug.Log("正在校验补丁");
     PreloadingUIView.SetProgressName("正在校验更新文件,过程中不消耗流量");
     Loom.Current.RunAsync(delegate
     {
         bool isAllValid = true;
         for (UpdateManager.PatchFileType patchFileType = UpdateManager.PatchFileType.Extend; patchFileType < UpdateManager.PatchFileType.Max; patchFileType++)
         {
             UpdateManager.DownloadFileInfo downloadInfo = this.UpdateInfo.GetDownloadInfo(patchFileType);
             if (downloadInfo != null)
             {
                 string text = MD5Util.EncryptFile(downloadInfo.LocalPath);
                 if (!downloadInfo.TargetBaseInfo.Md5.Equals(text))
                 {
                     isAllValid = false;
                     downloadInfo.TargetFileInfo.Delete();
                     downloadInfo.TargetFileInfo.Refresh();
                 }
             }
         }
         Loom.Current.QueueOnMainThread(delegate
         {
             this.OnValidateFinish(isAllValid);
         });
     });
 }
コード例 #2
0
 private void DoInstallNext()
 {
     this.CurrentInstallIndex++;
     if (this.CurrentInstallIndex < this.InstallOrder.get_Count())
     {
         this.InstallUpdate = null;
         UpdateManager.PatchFileType type = this.InstallOrder.get_Item(this.CurrentInstallIndex);
         if (this.UpdateInfo.GetDownloadInfo(type) == null)
         {
             this.InstallNext();
         }
         else
         {
             this.InstallCount++;
             string progressName = string.Format("正在解压安装文件,过程中不消耗流量({0}/{1})", this.InstallCount, this.UpdateInfo.DownloadFiles.get_Count());
             PreloadingUIView.SetProgressName(progressName);
             PreloadingUIView.ResetProgress();
             this.InstallByType(type);
         }
     }
     else
     {
         base.ReactSync(UpdateEvent.True);
     }
 }
コード例 #3
0
    private void DoDownload()
    {
        List <string> list  = new List <string>();
        List <string> list2 = new List <string>();
        List <string> list3 = new List <string>();
        List <long>   list4 = new List <long>();

        for (UpdateManager.PatchFileType patchFileType = UpdateManager.PatchFileType.Extend; patchFileType < UpdateManager.PatchFileType.Max; patchFileType++)
        {
            UpdateManager.DownloadFileInfo downloadInfo = this.UpdateInfo.GetDownloadInfo(patchFileType);
            if (downloadInfo != null)
            {
                if (!downloadInfo.IfFull())
                {
                    list.Add(downloadInfo.Url);
                    list2.Add(downloadInfo.LocalPath);
                    list3.Add(downloadInfo.TargetBaseInfo.Md5);
                    list4.Add((long)downloadInfo.TargetBaseInfo.FileSize);
                }
            }
        }
        PreloadingUIView.SetProgressName("正在下载更新文件...");
        PreloadingUIView.ResetProgress();
        this.Downloading = true;
        this.CurrentDownloader.Download(list, list2, list3, list4, null, new Action <bool>(this.OnDownloadEnd));
    }
コード例 #4
0
 private void AddResPatchDownload(UpdateManager.PatchFileType fileType, UpdateManager.ResPathDir dir, string version, UpdateManager.FileBaseInfo fbi)
 {
     UpdateManager.DownloadFileInfo info = new UpdateManager.DownloadFileInfo
     {
         FileType       = fileType,
         Url            = this.GetResPatchUrl(dir, version),
         LocalPath      = this.GetResPatchPath(dir, version),
         TargetBaseInfo = fbi
     };
     this.UpdateInfo.AddDownloadFile(info);
 }
コード例 #5
0
        public long GetCurrentFilesSize()
        {
            long num = 0L;

            for (UpdateManager.PatchFileType patchFileType = UpdateManager.PatchFileType.Extend; patchFileType < UpdateManager.PatchFileType.Max; patchFileType++)
            {
                UpdateManager.DownloadFileInfo downloadInfo = this.GetDownloadInfo(patchFileType);
                if (downloadInfo != null)
                {
                    downloadInfo.TargetFileInfo.Refresh();
                    if (downloadInfo.TargetFileInfo.get_Exists())
                    {
                        num += downloadInfo.TargetFileInfo.get_Length();
                    }
                }
            }
            return(num);
        }
コード例 #6
0
    private void InstallByType(UpdateManager.PatchFileType type)
    {
        switch (type)
        {
        case UpdateManager.PatchFileType.Extend:
        case UpdateManager.PatchFileType.ExtendPatch:
        case UpdateManager.PatchFileType.CorePatch:
        {
            UpdateManager.DownloadFileInfo downloadInfo = this.UpdateInfo.GetDownloadInfo(type);
            this.UnzipPatch(downloadInfo);
            break;
        }

        case UpdateManager.PatchFileType.ApkPatch:
            this.InstallByApkPatch();
            break;

        case UpdateManager.PatchFileType.Apk:
            this.InstallByApk();
            break;
        }
    }
コード例 #7
0
 private void InitInstallOrder()
 {
     this.InstallOrder.Clear();
     if (this.UpdateInfo.CurrentResInfo == null)
     {
         for (UpdateManager.PatchFileType patchFileType = UpdateManager.PatchFileType.Extend; patchFileType < UpdateManager.PatchFileType.Max; patchFileType++)
         {
             this.InstallOrder.Add(patchFileType);
         }
     }
     else
     {
         string[] array = this.UpdateInfo.CurrentResInfo.InstallOrder.Split(new char[]
         {
             ','
         });
         string[] array2 = array;
         for (int i = 0; i < array2.Length; i++)
         {
             string text = array2[i];
             try
             {
                 UpdateManager.PatchFileType patchFileType2 = (UpdateManager.PatchFileType)((int)Enum.Parse(typeof(UpdateManager.PatchFileType), text));
                 this.InstallOrder.Add(patchFileType2);
             }
             catch
             {
                 Debug.LogFormat("{0}类型解析错误:{1}", new object[]
                 {
                     typeof(UpdateManager.PatchFileType),
                     text
                 });
             }
         }
     }
 }
コード例 #8
0
 public UpdateManager.DownloadFileInfo GetDownloadInfo(UpdateManager.PatchFileType type)
 {
     UpdateManager.DownloadFileInfo downloadFileInfo;
     return((!this.DownloadFiles.TryGetValue(type, ref downloadFileInfo)) ? null : downloadFileInfo);
 }