Example #1
0
    private void RecordResInfo()
    {
        Debug.Log("查询资源下载信息");
        if (this.UpdateInfo.IsCoreUpdate)
        {
            string text = this.DateToString(this.GetCoreVersion());
            UpdateManager.FileBaseInfo fileBaseInfo = this.UpdateInfo.CurrentResInfo.TryGetCorePatch(text);
            if (fileBaseInfo == null)
            {
                Debug.LogErrorFormat("错误的coreVersion :{0}", new object[]
                {
                    text
                });
                this.ShowVersionError();
                return;
            }
            this.AddResPatchDownload(UpdateManager.PatchFileType.CorePatch, UpdateManager.ResPathDir.corePatch, text, fileBaseInfo);
        }
        string text2 = string.Empty;

        if (this.UpdateInfo.IsDownloadExtend)
        {
            this.AddResPatchDownload(UpdateManager.PatchFileType.Extend, UpdateManager.ResPathDir.extend, this.UpdateInfo.CurrentResInfo.ExtendVersion, this.UpdateInfo.CurrentResInfo.ExtendFileInfo);
            if (!this.UpdateInfo.CurrentResInfo.ExtendVersion.Equals(GameManager.Instance.ResVersion))
            {
                text2 = this.UpdateInfo.CurrentResInfo.ExtendVersion;
            }
        }
        if (this.UpdateInfo.IsExtendUpdate)
        {
            text2 = this.DateToString(this.GetExtendVersion());
        }
        if (!string.IsNullOrEmpty(text2))
        {
            UpdateManager.FileBaseInfo fileBaseInfo2 = this.UpdateInfo.CurrentResInfo.TryGetExtendPatch(text2);
            if (fileBaseInfo2 == null)
            {
                Debug.LogErrorFormat("错误的extendPatchVersion :{0}", new object[]
                {
                    text2
                });
                this.ShowVersionError();
                return;
            }
            this.AddResPatchDownload(UpdateManager.PatchFileType.ExtendPatch, UpdateManager.ResPathDir.extendPatch, text2, fileBaseInfo2);
        }
        this.RecordCount++;
    }
Example #2
0
 private void DoRecordApkInfo(string apkMd5)
 {
     try
     {
         UpdateManager.FileBaseInfo targetBaseInfo = null;
         Debug.Log("获取apk下载信息");
         UpdateManager.DownloadFileInfo info;
         if (this.UpdateInfo.CurrentApkInfo.PatchFileInfo.TryGetValue(apkMd5, ref targetBaseInfo))
         {
             Debug.Log("下载apkpatch");
             info = new UpdateManager.DownloadFileInfo
             {
                 FileType       = UpdateManager.PatchFileType.ApkPatch,
                 Url            = GameManager.Instance.GetApkPatchUrl(this.GetNewPatchName()),
                 LocalPath      = this.GetNewPatchPath(),
                 TargetBaseInfo = targetBaseInfo
             };
         }
         else
         {
             Debug.Log("下载apk整包");
             info = new UpdateManager.DownloadFileInfo
             {
                 FileType       = UpdateManager.PatchFileType.Apk,
                 Url            = GameManager.Instance.GetApkPatchUrl(this.GetNewApkName()),
                 LocalPath      = this.GetNewApkPath(),
                 TargetBaseInfo = this.UpdateInfo.CurrentApkInfo.ApkFileInfo
             };
         }
         this.UpdateInfo.AddDownloadFile(info);
         this.RecordCount++;
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
         throw ex;
     }
 }
Example #3
0
 public UpdateManager.FileBaseInfo TryGetExtendPatch(string version)
 {
     UpdateManager.FileBaseInfo fileBaseInfo = null;
     return((!this.ExtendPatchMap.TryGetValue(version, ref fileBaseInfo)) ? null : fileBaseInfo);
 }
Example #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);
 }