コード例 #1
0
        private async Task <int> RunAsync(string[] remainingArguments)
        {
            var patchDir       = remainingArguments[0];
            var destinationDir = remainingArguments[1];
            var applicationDir = remainingArguments[2];

            var errors = new List <string>();

            if (!Directory.Exists(patchDir))
            {
                errors.Add("Patch dir does not exist.");
            }

            if (!Directory.Exists(destinationDir))
            {
                errors.Add("Target dir does not exist.");
            }

            if (errors.Count > 0)
            {
                foreach (var error in errors)
                {
                    Console.Error.WriteLine("Error: " + error);
                }
                return(1);
            }

            await ProgressReporter.AwaitWithProgressReporting <DirectoryPatcherProgressReport>(
                (progress) => new RXPatcher().ApplyPatchFromFilesystem(patchDir, destinationDir, applicationDir, progress, new CancellationToken(), null)
                );

            return(0);
        }
コード例 #2
0
        private async Task <int> RunAsync(string[] remainingArguments)
        {
            var patchUrl       = remainingArguments[0];
            var targetDir      = remainingArguments[1];
            var applicationDir = remainingArguments[2];

            var errors = new List <string>();

            if (!Directory.Exists(targetDir))
            {
                errors.Add("Target dir does not exist.");
            }

            if (errors.Count > 0)
            {
                foreach (var error in errors)
                {
                    Console.Error.WriteLine("Error: " + error);
                }
                return(1);
            }

            RxPatcher.Instance.AddNewUpdateServer(remainingArguments[0], "");

            await ProgressReporter.AwaitWithProgressReporting <DirectoryPatcherProgressReport>(
                (progress) => RxPatcher.Instance.ApplyPatchFromWebDownloadTask(RxPatcher.Instance.GetNextUpdateServerEntry(), targetDir, applicationDir, progress, new CancellationToken(), null) // intentionally skipping instructions.json verification
                );

            return(0);
        }
コード例 #3
0
        private async Task <int> RunAsync(string[] remainingArguments)
        {
            var patchUrl       = remainingArguments[0];
            var targetDir      = remainingArguments[1];
            var applicationDir = remainingArguments[2];

            var errors = new List <string>();

            if (!Directory.Exists(targetDir))
            {
                errors.Add("Target dir does not exist.");
            }

            if (errors.Count > 0)
            {
                foreach (var error in errors)
                {
                    Console.Error.WriteLine("Error: " + error);
                }
                return(1);
            }

            var splitIndex = patchUrl.LastIndexOf('/');
            var mirrorUrl  = patchUrl.Substring(0, splitIndex + 1);
            var patchPath  = patchUrl.Substring(splitIndex + 1);

            RxPatcher.Instance.WebPatchPath = patchPath;
            RxPatcher.Instance.AddNewUpdateServer(mirrorUrl);

            var entry = RxPatcher.Instance.GetNextUpdateServerEntry();
            //await RxPatcher.Instance.UpdateServerSelector.QueryHost(entry);
            // await UpdateServerSelector.SelectHosts(UpdateServerHandler.GetUpdateServers());
            await RxPatcher.Instance.UpdateServerSelector.SelectHosts(RxPatcher.Instance.UpdateServerHandler.GetUpdateServers());

            await ProgressReporter.AwaitWithProgressReporting <DirectoryPatcherProgressReport>(
                (progress) => RxPatcher.Instance.ApplyPatchFromWebDownloadTask(entry, targetDir, applicationDir, progress, new CancellationToken(), null) // intentionally skipping instructions.json verification
                );

            return(0);
        }