示例#1
0
        private void FetchLogsFromPatcher()
        {
            string log = patcher.FetchLog();

            while (log != null)
            {
                if (logToConsole)
                {
                    Debug.Log(log);
                }

                patcherLogText.text = log;
                log = patcher.FetchLog();
            }

            IOperationProgress progress = patcher.FetchProgress();

            while (progress != null)
            {
                if (logToConsole)
                {
                    Debug.Log(string.Concat(progress.Percentage, "% ", progress.ProgressInfo));
                }

                patcherProgressText.text = progress.ProgressInfo;
                patcherProgressbar.value = progress.Percentage;

                progress = patcher.FetchProgress();
            }
        }
示例#2
0
        private void FetchLogsFromPatcher()
        {
            string log = patcher.FetchLog();

            while (log != null)
            {
                UpdateLabel(statusText, log);
                log = patcher.FetchLog();
            }

            IOperationProgress progress = patcher.FetchProgress();

            while (progress != null)
            {
                UpdateLabel(progressText, progress.ProgressInfo);
                UpdateProgressbar(progressBar, progress.Percentage);

                progress = patcher.FetchProgress();
            }
        }
示例#3
0
        private static void LogPatcherToConsole(SimplePatchTool patcher)
        {
            string log = patcher.FetchLog();

            while (log != null)
            {
                LogToConsole(log);
                log = patcher.FetchLog();
            }

            IOperationProgress progress = patcher.FetchProgress();

            if (progress != null)
            {
                LogToConsole(progress.ProgressInfo);
            }
        }
示例#4
0
        private static void ApplyPatch()
        {
            bool   silent             = HasArgument("silent");
            string versionInfoKeyPath = GetArgument("versionInfoKey");
            string patchInfoKeyPath   = GetArgument("patchInfoKey");

            SimplePatchTool patcher = new SimplePatchTool(GetArgument("root"), GetArgument("versionURL")).UseIncrementalPatch(!HasArgument("dontUseIncrementalPatch")).
                                      UseRepairPatch(!HasArgument("dontUseRepairPatch")).VerifyFilesOnServer(HasArgument("verifyFiles")).LogProgress(!silent).SilentMode(silent);

            if (versionInfoKeyPath != null)
            {
                string publicKey = File.ReadAllText(versionInfoKeyPath);
                patcher.UseVersionInfoVerifier(( ref string xml ) => XMLSigner.VerifyXMLContents(xml, publicKey));
            }

            if (patchInfoKeyPath != null)
            {
                string publicKey = File.ReadAllText(patchInfoKeyPath);
                patcher.UsePatchInfoVerifier(( ref string xml ) => XMLSigner.VerifyXMLContents(xml, publicKey));
            }

            bool hasPatchStarted = patcher.Run(false);

            if (hasPatchStarted)
            {
                while (patcher.IsRunning)
                {
                    Thread.Sleep(100);

                    string log = patcher.FetchLog();
                    while (log != null)
                    {
                        LogToConsole(log);
                        log = patcher.FetchLog();
                    }

                    IOperationProgress progress = patcher.FetchProgress();
                    if (progress != null)
                    {
                        LogToConsole(progress.ProgressInfo);
                    }
                }

                if (patcher.Result == PatchResult.Failed)
                {
                    Console.WriteLine("\nPatch failed: " + patcher.FailReason + " " + (patcher.FailDetails ?? ""));
                }
                else if (patcher.Result == PatchResult.AlreadyUpToDate)
                {
                    Console.WriteLine("\nAlready up-to-date!");
                }
                else
                {
                    Console.WriteLine("\nPatch is successful!");
                }
            }
            else
            {
                Console.WriteLine("\nPatch could not be started; maybe it is already executing?");
            }
        }