Ejemplo n.º 1
0
        private async Task ApplyPatchWithInstructions(IEnumerable <FilePatchInstruction> instructions)
        {
            var instructionsJson     = JsonConvert.SerializeObject(instructions);
            var instructionsFilename = Path.Combine(_patchDir.Path, "instructions.json");

            File.WriteAllText(instructionsFilename, instructionsJson);

            try
            {
                await _directoryPatcher.ApplyPatchAsync(TestProgressHandlerFactory.Create(), new CancellationToken(), await SHA256.GetFileHashAsync(instructionsFilename));
            }
            finally
            {
                File.Delete(instructionsFilename);
            }
        }
Ejemplo n.º 2
0
        private async Task RoundtripTest(string OldDir, string NewDir, string TargetDir, string PatchDir, string ApplicationDir)
        {
            var patchInfo = new PatchInfo
            {
                OldPath   = OldDir,
                NewPath   = NewDir,
                PatchPath = PatchDir,
            };

            var builder = new RXPatchBuilder();
            await builder.CreatePatchAsync(patchInfo);

            await new RXPatcher().ApplyPatchFromWeb("file:///" + PatchDir, TargetDir, ApplicationDir, TestProgressHandlerFactory.Create(), new CancellationToken(), null);

            await DirectoryAssertions.IsSubsetOf(NewDir, TargetDir);
        }
Ejemplo n.º 3
0
        public async Task Beta2to3Patch()
        {
            var NewDir         = "C:\\games\\Renegade X Beta 3";
            var TargetDir      = "C:\\games\\Renegade X patchtest";
            var ApplicationDir = "C:\\games\\Renegade X patchtest\\patch";
            var PatchDir       = "C:\\games\\Renegade X patchtest source";

            await new RXPatcher().ApplyPatchFromWeb("file:///" + PatchDir, TargetDir, ApplicationDir, TestProgressHandlerFactory.Create(), new CancellationToken(), null);

            await DirectoryAssertions.IsSubsetOf(NewDir, TargetDir);
        }