示例#1
0
        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_);
                    }
                }
            }
        }
示例#2
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;
        }