Example #1
0
        private void OnMergePatchEnter(int eventID, FSMState preState, FSMState currentState)
        {
            PreloadingUIView.SetProgressName("正在解压安装文件...");
            PreloadingUIView.ResetProgress();
            Debug.Log("正在合并apk包");
            string current       = Application.get_dataPath();
            string newApk        = this.GetNewApkPath();
            string patch         = this.GetNewPatchPath();
            string directoryName = Path.GetDirectoryName(newApk);

            DirectoryUtil.CreateIfNotExist(directoryName);
            this.ApkMerging = false;
            Loom.Current.RunAsync(delegate
            {
                FileHelper.DeleteIfExist(newApk);
                this.ApkMerging = true;
                using (FileStream fileStream = File.Open(current, 3, 1, 1))
                {
                    using (FileStream fileStream2 = File.Open(newApk, 2, 2))
                    {
                        BinaryPatchUtility.Apply(fileStream, () => File.Open(patch, 3, 1, 1), fileStream2);
                    }
                }
                this.ReactSync(UpdateEvent2.Next);
            });
        }
Example #2
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));
    }
Example #3
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);
     }
 }
Example #4
0
        private void BeginDownloadPackage(string url, string localPath, FileBaseInfo fileInfo)
        {
            GameManager.Instance.OpenPreloadingUI();
            PreloadingUIView.SetProgressName("正在下载更新文件...");
            PreloadingUIView.ResetProgress();
            List <string> list = new List <string>();

            list.Add(url);
            List <string> list2 = new List <string>();

            list2.Add(localPath);
            List <string> list3 = new List <string>();

            list3.Add(fileInfo.Md5);
            List <long> list4 = new List <long>();

            list4.Add((long)fileInfo.FileSize);
            Downloader.Instance.Download(list, list2, list3, list4, new Action <int, int, string>(this.DownloadPackageUpdate), new Action <bool>(this.EndDownloadPackage));
        }