예제 #1
0
        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);
        }
예제 #2
0
        protected override void OnExit()
        {
            if (StageCode_ == StageCode.Succeeded)
            {
                ResPatchInfo PatchInfo = Updater_.GetCurrentResPatchInfo();

                if (PatchInfo == null)
                {
                    return;
                }

                UpdateTool.UpdateResVersionInfo(PatchInfo.To_);
                Updater_.SetCurrentVersionInfo(PatchInfo.To_);
                Updater_.SetCurrentResPatchInfo(null);
            }
        }
예제 #3
0
        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;
        }