示例#1
0
        void TickFetchTask()
        {
            if (fetchTask == null)
            {
                return;
            }
            fetchTask.Tick();
            UpdateProgress(fetchTask);
            if (!fetchTask.Completed)
            {
                return;
            }

            if (!fetchTask.Success)
            {
                view.statusText = "&cFailed to fetch update";
                UpdateStatus();
            }
            else
            {
                csZip     = fetchTask.ZipFile;
                buildName = "&eFetching latest C client";
                UpdateStatus();
            }
            fetchTask = null;
        }
        void TickFetchTask()
        {
            if (fetchTask == null)
            {
                return;
            }
            fetchTask.Tick();
            UpdateFetchProgress();
            if (!fetchTask.Completed)
            {
                return;
            }

            if (!fetchTask.Success)
            {
                view.statusText = "&cFailed to fetch update";
                UpdateStatus();
            }
            else
            {
                Applier.ExtractUpdate(fetchTask.ZipFile);
                game.ShouldExit   = true;
                game.ShouldUpdate = true;
            }
            fetchTask = null;
        }
示例#3
0
        void UpdateBuild(bool release, bool dx)
        {
            DateTime last  = release ? view.LastStable : view.LastDev;
            Build    build = release ? stable : dev;

            if (last == DateTime.MinValue || fetchTask != null)
            {
                return;
            }
            if (fetchCClientTask != null)
            {
                return;
            }
            if (build.DirectXSize < 50000 || build.OpenGLSize < 50000)
            {
                return;
            }

            bool gameOpen = CheckClientInstances();

            view.statusText = gameOpen ? "&cThe game must be closed before updating" : "";
            UpdateStatus();
            if (gameOpen)
            {
                return;
            }
            string path;

            path      = dx ? build.DirectXPath : build.OpenGLPath;
            fetchTask = new UpdateDownloadTask(path);
            fetchTask.RunAsync(game);

            path             = GetCExe(dx);
            fetchCClientTask = new UpdateCClientTask(path);
            fetchCClientTask.RunAsync(game);

            if (release && dx)
            {
                buildName = "&eFetching latest release (Direct3D9)";
            }
            if (release && !dx)
            {
                buildName = "&eFetching latest release (OpenGL)";
            }
            if (!release && dx)
            {
                buildName = "&eFetching latest dev build (Direct3D9)";
            }
            if (!release && !dx)
            {
                buildName = "&eFetching latest dev build (OpenGL)";
            }

            buildProgress     = -1;
            Applier.PatchTime = build.TimeBuilt;
            view.statusText   = buildName + "..";
            UpdateStatus();
        }