Exemple #1
0
        /// <summary>
        /// TODO: description
        /// </summary>
        /// <param name="algorithm"></param>
        /// <returns></returns>
        public static IPatcher GetPatcher(PatchAlgorithmType algorithm)
        {
            IPatcher patcher;

            switch (algorithm)
            {
            case PatchAlgorithmType.BsDiff:
                patcher = new BsDiffPatcher();
                break;

            case PatchAlgorithmType.Fossil:
                patcher = new FossilPatcher();
                break;

            case PatchAlgorithmType.MsDelta:
                patcher = new MsDeltaPatcher();
                break;

            case PatchAlgorithmType.Octodiff:
                patcher = new OctodiffPatcher();
                break;

            case PatchAlgorithmType.PatchApi:
                patcher = new PatchApiPatcher();
                break;

            case PatchAlgorithmType.XDelta:
                patcher = new XDeltaPatcher();
                break;

            default:
                throw new NotSupportedException("Invalid patch algorithm.");
            }
            return(patcher);
        }
Exemple #2
0
        public void XDeltaPatcherTest()
        {
            IPatcher patcher = new XDeltaPatcher();

            patcher.Create(SourceFilePath, TargetFilePath, PatchFilePath);
            patcher.Apply(SourceFilePath, PatchFilePath, PatchedFilePath);
            Assert.IsTrue(File.ReadAllBytes(TargetFilePath).IsEqual(File.ReadAllBytes(PatchedFilePath)));
        }