Exemplo n.º 1
0
 public DirectoryPatcher(XdeltaPatcher filePatcher, string targetPath, string backupPath, string tempPath, IPatchSource patchSource)
 {
     FilePatcher = filePatcher;
     TargetPath  = targetPath;
     BackupPath  = backupPath;
     TempPath    = tempPath;
     PatchSource = patchSource;
 }
Exemplo n.º 2
0
        private void AddPatchSource(IPatchSource patchSource)
        {
            Assert.IsNotNull(patchSource);

            var item = new PatchSourceListItem(patchSource);

            item.CheckedState = Framework.Controls.CheckedState.Checked;
            _lstPatches.Items.Add(item);
            item.FocusAndSelect();
        }
Exemplo n.º 3
0
        /// <summary>Apply patch.</summary>
        /// <param name="patchSource">Patch source.</param>
        /// <param name="applyTo">Patch target.</param>
        /// <param name="reverse">Reverse patches.</param>
        public void ApplyPatch(IPatchSource patchSource, ApplyPatchTo applyTo, bool reverse)
        {
            Verify.Argument.IsNotNull(patchSource, "patchSource");

            using (Repository.Monitor.BlockNotifications(
                       RepositoryNotifications.IndexUpdated,
                       RepositoryNotifications.WorktreeUpdated))
            {
                using (var patch = patchSource.PreparePatchFile())
                {
                    Repository.Accessor.ApplyPatch.Invoke(
                        new ApplyPatchParameters()
                    {
                        Patches = new[] { patch.FileName },
                        ApplyTo = applyTo,
                        Reverse = reverse,
                    });
                }
            }
            Refresh();
        }
Exemplo n.º 4
0
        public Patcher(IPatchSource patchSource, IndexFile index, ArchiveFile coreData = null, string target = null)
        {
            PatchSource = patchSource;
            Index       = index;
            if (target == null)
            {
                target = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(index.FileName), "..",
                                                       Path.GetFileNameWithoutExtension(index.FileName)));
            }

            if (Path.GetExtension(target).TrimStart('.').ToLower() != "archive")
            {
                PatchWriter = new FolderPatchWriter(target, coreData);
            }
            else
            {
                // TODO: Implement actual archive writing.
                throw new InvalidOperationException();
            }
            PatchWriter.ProgressUpdated += PatchWriter_ProgressUpdated;
        }
Exemplo n.º 5
0
 public PatchSourceFixture()
 {
     PatchSource = new HttpPatchSource("https://patch.logg.coffee/");
 }
 public HttpPatchSourceTests(ITestOutputHelper output, PatchSourceFixture patchSourceFixture)
 {
     Output = output;
     Output.WriteLine("New test instance constructed");
     PatchSource = patchSourceFixture.PatchSource;
 }
Exemplo n.º 7
0
        /// <summary>Apply patch.</summary>
        /// <param name="patchSource">Patch source.</param>
        /// <param name="applyTo">Patch target.</param>
        /// <param name="reverse">Reverse patches.</param>
        public void ApplyPatch(IPatchSource patchSource, ApplyPatchTo applyTo, bool reverse)
        {
            Verify.Argument.IsNotNull(patchSource, "patchSource");

            using(Repository.Monitor.BlockNotifications(
                RepositoryNotifications.IndexUpdated,
                RepositoryNotifications.WorktreeUpdated))
            {
                using(var patch = patchSource.PreparePatchFile())
                {
                    Repository.Accessor.ApplyPatch.Invoke(
                        new ApplyPatchParameters()
                        {
                            Patches = new[] { patch.FileName },
                            ApplyTo = applyTo,
                            Reverse = reverse,
                        });
                }
            }
            Refresh();
        }
Exemplo n.º 8
0
        private void AddPatchSource(IPatchSource patchSource)
        {
            Assert.IsNotNull(patchSource);

            var item = new PatchSourceListItem(patchSource);
            item.CheckedState = Framework.Controls.CheckedState.Checked;
            _lstPatches.Items.Add(item);
            item.FocusAndSelect();
        }