Пример #1
0
        private IEnumerator CheckForUpdates(bool checkVersionOnly)
        {
            patchButton.interactable = false;
            playButton.interactable  = true;

            patcher.LogProgress(false);

            // = checkVersionOnly =
            // true (default): only version number (e.g. 1.0) is compared against VersionInfo to see if there is an update
            // false: hashes and sizes of the local files are compared against VersionInfo (if there are any different/missing files, we'll patch the app)
            if (patcher.CheckForUpdates(checkVersionOnly))
            {
                Debug.Log("Checking for updates...");

                while (patcher.IsRunning)
                {
                    FetchLogsFromPatcher();
                    yield return(null);
                }

                FetchLogsFromPatcher();

                if (patcher.Result == PatchResult.AlreadyUpToDate)
                {
                    // If launcher is already up-to-date, check if there is an update for the main app
                    if (isPatchingLauncher)
                    {
                        StartMainAppPatch(true);
                    }
                }
                else if (patcher.Result == PatchResult.Success)
                {
                    // There is an update, enable the Patch button
                    patchButton.interactable = true;
                }
                else
                {
                    // An error occurred, user can click the Patch button to try again
                    patchButton.interactable = true;
                }
            }
            else
            {
                Debug.LogWarning("Operation could not be started; maybe it is already executing?");
            }
        }
Пример #2
0
        // = checkVersionOnly =
        // true (default): only version number (e.g. 1.0) is compared against VersionInfo to see if there is an update
        // false: hashes and sizes of the local files are compared against VersionInfo (if there are any different/missing files, we'll patch the app)
        private void CheckForUpdates(bool checkVersionOnly)
        {
            StartThread(() =>
            {
                ButtonSetEnabled(patchButton, false);
                ButtonSetEnabled(playButton, true);

                patcher.LogProgress(false);
                if (patcher.CheckForUpdates(checkVersionOnly))
                {
                    while (patcher.IsRunning)
                    {
                        FetchLogsFromPatcher();
                        Thread.Sleep(500);
                    }

                    FetchLogsFromPatcher();

                    if (patcher.Result == PatchResult.AlreadyUpToDate)
                    {
                        // If launcher is already up-to-date, check if there is an update for the main app
                        if (isPatchingLauncher)
                        {
                            StartMainAppPatch(true);
                        }
                    }
                    else if (patcher.Result == PatchResult.Success)
                    {
                        // There is an update, enable the Patch button
                        ButtonSetEnabled(patchButton, true);
                    }
                    else
                    {
                        // An error occurred, user can click the Patch button to try again
                        ButtonSetEnabled(patchButton, true);
                    }
                }
            });
        }