Exemple #1
0
		/// <summary>
		/// Initializes a new instance of the PatchBuilder class.
		/// </summary>
		/// <param name="oldDir">Directory with old product version.</param>
		/// <param name="newDir">Directory with new product version.</param>
		/// <param name="tmpDir">Directory for temporary files.</param>
		/// <param name="deltaTool">Current delta tool.</param>
		public PatchBuilder(string oldDir, string newDir, string tmpDir, IDeltaTool deltaTool = null)
		{
			this.FormatVersion = 1;
			this.OldDir = oldDir;
			this.NewDir = newDir;
			this.TmpDir = tmpDir;
			this.IncludeAddedFileContents = true;
			this.DeltaTool = deltaTool ?? new Xdelta3DeltaTool();
		}
        /// <summary>
        /// Register delta tool in container.
        /// </summary>
        /// <param name="tool">Delta tool instance.</param>
        public void Register(IDeltaTool tool)
        {
            if (tool == null)
            {
                throw new ArgumentNullException("tool");
            }

            if (this._DeltaTools.ContainsKey(tool.Code))
            {
                this._DeltaTools.Remove(tool.Code);
            }

            this._DeltaTools.Add(tool.Code, tool);
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the AddFileCommand class.
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="fileInfo"></param>
        /// <param name="hash"></param>
        /// <param name="includeFileContents"></param>
        /// <param name="deltaTool"></param>
        public AddFileCommand(string filename, FileInfo fileInfo, string hash, bool includeFileContents = false, IDeltaTool deltaTool = null)
            : base((byte)CommandCode.AddFile)
        {
            if (includeFileContents && deltaTool == null)
            {
                throw new ArgumentNullException("deltaTool", "deltaTool argument can not be null if includeFileContents argument is set to true");
            }

            this.Filename            = filename;
            this.FileInfo            = fileInfo;
            this.Hash                = hash;
            this.IncludeFileContents = includeFileContents;
            this.DeltaTool           = deltaTool;
            this.Overwrite           = true;
        }
        /// <summary>
        /// Initializes a new instance of the ModifyCommand class.
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="oldFile"></param>
        /// <param name="newFile"></param>
        /// <param name="oldHash"></param>
        /// <param name="newHash"></param>
        /// <param name="deltaTool"></param>
        public ModifyCommand(string filename, FileInfo oldFile, FileInfo newFile, string oldHash, string newHash, IDeltaTool deltaTool)
            : base((byte)CommandCode.ModifyFile)
        {
            if (deltaTool == null)
            {
                throw new ArgumentNullException("deltaTool");
            }

            this.Filename  = filename;
            this.OldFile   = oldFile;
            this.NewFile   = newFile;
            this.OldHash   = oldHash;
            this.NewHash   = newHash;
            this.DeltaTool = deltaTool;
        }