protected override void OnEnter() { Updater_.SetProgressID(StageProgressID.CopyResInfoToDocBegin); Updater_.SetProgressValue(0); Updater_.ClearError(); ResPatchInfo PatchInfo = Updater_.GetCurrentResPatchInfo(); if (PatchInfo == null) { StageCode_ = StageCode.Failed; Updater_.SetError(ErrorCode.GetResPatchInfoListFailed, UpdateTool.ServerVersionInfoPath_); return; } CurSize_ = 0; MaxSize_ = 1; IsDone_ = false; ErrorInfo_ = string.Empty; UnZipInfo_ = string.Empty; ProgressLockObject_ = new object(); string PatchDataPath = UpdateTool.DataPath_ + "\\" + Path.GetFileName(PatchInfo.PatchUrl_); UnZipThread_ = new Thread(UnZipFunc); UnZipThread_.Start(PatchDataPath); }
protected override void OnUpdate() { lock (ProgressLockObject_) { float Value = (float)CurSize_ / (float)MaxSize_; Updater_.SetProgressValue(Value); Updater_.SetContentInfo(UnZipInfo_); if (IsDone_) { UnZipThread_.Join(); UnZipThread_ = null; Updater_.SetProgressID(StageProgressID.CopyResInfoToDocEnd); Updater_.SetProgressValue(1.0f); if (string.IsNullOrEmpty(ErrorInfo_)) { StageCode_ = StageCode.Succeeded; } else { StageCode_ = StageCode.Failed; Updater_.SetError(ErrorCode.CopyResInfoToDocFailed, ErrorInfo_); } } } }
protected override void OnEnter() { Updater_.SetProgressID(StageProgressID.DownloadResInfoBegin); Updater_.SetProgressValue(0); Updater_.ClearError(); StageCode_ = StageCode.Continue; DownloadTask Task = Downloader.Start(Updater_.GetResVersionInfo().ResUrl_, UpdateTool.ServerVersionInfoPath_, string.Empty, true); Task.Progress += OnProgressCallback; Task.Completed += OnCompletedCallback; }
private void OnCompletedCallback(string FileName, string ErrorInfo, bool Successed) { Updater_.SetProgressID(StageProgressID.DownloadResInfoEnd); Updater_.SetProgressValue(1.0f); if (Successed) { StageCode_ = StageCode.Succeeded; } else { StageCode_ = StageCode.Failed; Updater_.SetError(ErrorCode.DownloadResInfoFailed, ErrorInfo); } }
protected override void OnEnter() { Updater_.SetProgressID(StageProgressID.GetResVersionBegin); Updater_.SetProgressValue(0); Updater_.ClearError(); ResVersionInfo VersionInfo = UpdateTool.GetResVersionInfo(); if (VersionInfo == null) { StageCode_ = StageCode.Failed; Updater_.SetError(ErrorCode.GetResVersionInfoFailed, UpdateTool.VersionInfoPath_); } else { Updater_.SetResVersionInfo(VersionInfo); Updater_.SetCurrentVersionInfo(VersionInfo.Version_); StageCode_ = StageCode.Succeeded; } Updater_.SetProgressID(StageProgressID.GetResVersionEnd); Updater_.SetProgressValue(1.0f); }
protected override void OnEnter() { Updater_.SetProgressID(StageProgressID.CheckResVersionBegin); Updater_.SetProgressValue(0); Updater_.ClearError(); ResPatchInfoList PatchInfoList = Updater_.GetResPatchInfoList(); if (PatchInfoList == null) { PatchInfoList = UpdateTool.GetResPatchInfoList(); if (PatchInfoList == null) { StageCode_ = StageCode.Failed; Updater_.SetError(ErrorCode.GetResPatchInfoListFailed, UpdateTool.ServerVersionInfoPath_); return; } Updater_.SetResPatchInfoList(PatchInfoList); } ResPatchInfo PatchInfo = PatchInfoList.GetPatchWithVersion(Updater_.GetCurrentVersionInfo()); if (PatchInfo != null) { Updater_.SetCurrentResPatchInfo(PatchInfo); } else { SetNextStageID(StageID.Final); } StageCode_ = StageCode.Succeeded; Updater_.SetProgressID(StageProgressID.CheckResVersionEnd); Updater_.SetProgressValue(1.0f); }
protected override void OnEnter() { Updater_.SetProgressID(StageProgressID.DownloadResBegin); Updater_.SetProgressValue(0); Updater_.ClearError(); StageCode_ = StageCode.Continue; ResPatchInfo PatchInfo = Updater_.GetCurrentResPatchInfo(); if (PatchInfo == null) { StageCode_ = StageCode.Failed; Updater_.SetError(ErrorCode.GetResPatchInfoListFailed, UpdateTool.ServerVersionInfoPath_); return; } Updater_.SetContentInfo(string.Format("{0}->{1}", PatchInfo.From_, PatchInfo.To_)); string PatchDataPath = Path.Combine(UpdateTool.DataPath_, Path.GetFileName(PatchInfo.PatchUrl_)); DownloadTask Task = Downloader.Start(PatchInfo.PatchUrl_, PatchDataPath, PatchInfo.MD5_, true); Task.Progress += OnProgressCallback; Task.Completed += OnCompletedCallback; }
protected override void OnEnter() { Updater_.SetProgressID(StageProgressID.Done); Updater_.SetProgressValue(1.0f); }
protected override void OnEnter() { Updater_.SetProgressID(StageProgressID.Error); Updater_.SetProgressValue(0); }