Exemplo n.º 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);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 3
0
        public void Start()
        {
            ProgressID_         = StageProgressID.Idle;
            ProgressValue_      = 0;
            ResVersionInfo_     = null;
            CurrentVersionInfo_ = null;
            ResPatchInfoList_   = null;
            CurrentPatchInfo_   = null;
            ErrorCode_          = ErrorCode.Ok;
            ErrorInfo_          = string.Empty;
            ContentInfo_        = string.Empty;

            Pipline_ = new Pipline();
            Pipline_.InitStage(this);

            Downloader.StopAllTask();
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
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;
        }
Exemplo n.º 6
0
 public void SetCurrentResPatchInfo(ResPatchInfo PatchInfo)
 {
     CurrentPatchInfo_ = PatchInfo;
 }