コード例 #1
0
 public static extern bool CreateDelta(
     [MarshalAs(UnmanagedType.I8)] FileTypeSet fileTypeSet,
     [MarshalAs(UnmanagedType.I8)] CreateFlags setFlags,
     [MarshalAs(UnmanagedType.I8)] CreateFlags resetFlags,
     string sourceName,
     string targetName,
     string sourceOptionsName,
     string targetOptionsName,
     DeltaInput globalOptions,
     IntPtr targetFileTime,
     [MarshalAs(UnmanagedType.U4)] HashAlgId hashAlgId,
     string deltaName);
コード例 #2
0
        /// <summary>
        /// Creates a delta from an existing binary file
        /// </summary>
        /// <param name="sourceFilePath">The path where the source file is located</param>
        /// <param name="newFilePath">The path where the new file is located, to compare them</param>
        /// <param name="deltaFilePath">The path where the delta path will be located</param>
        public void CreateDelta(string sourceFilePath, string newFilePath, string deltaFilePath)
        {
            const string sourceOptionsName = null;
            const string targetOptionsName = null;
            var          globalOptions     = new DeltaInput();
            var          targetFileTime    = IntPtr.Zero;

            // Create delta
            if (!NativeMethods.CreateDelta(
                    FileTypeSet.Executables, CreateFlags.IgnoreFileSizeLimit, CreateFlags.None, sourceFilePath, newFilePath,
                    sourceOptionsName, targetOptionsName, globalOptions, targetFileTime, HashAlgId.Crc32, deltaFilePath))
            {
                // Throw exception if something went wrong
                throw new Win32Exception();
            }
        }