示例#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);
        }
示例#2
0
 /// <summary>
 /// TODO: description
 /// </summary>
 /// <param name="partSize"></param>
 /// <param name="partExtension"></param>
 /// <param name="patchAlgorithm"></param>
 /// <param name="compressionEnabled"></param>
 public PackageSettings(int partSize = DefaultContentPartSize, string partExtension = DefaultContentPartExtension, PatchAlgorithmType patchAlgorithm = DefaultPatchAlgorithmType, bool compressionEnabled = DefaultCompressionEnabled)
 {
     PartSize           = partSize;
     PartExtension      = partExtension;
     PatchAlgorithmType = patchAlgorithm;
     CompressionEnabled = compressionEnabled;
 }
示例#3
0
 /// <summary>
 /// TODO: description
 /// </summary>
 /// <param name="sourcePath"></param>
 /// <param name="targetPath"></param>
 /// <param name="algorithm"></param>
 /// <param name="content"></param>
 /// <param name="overwrite"></param>
 /// <param name="optional"></param>
 public PatchAction(Path sourcePath, Path targetPath, PatchAlgorithmType algorithm, Content content, bool overwrite = true, bool optional = false)
 {
     SourcePath = sourcePath ?? throw new ArgumentException(nameof(sourcePath));
     TargetPath = targetPath ?? throw new ArgumentException(nameof(targetPath));
     Algorithm  = algorithm;
     Content    = content ?? throw new ArgumentException(nameof(content));
     Overwrite  = overwrite;
     Optional   = optional;
 }