public static void CreateDelta(string originalFile, string newFile, string deltaFile, bool isExecutable) { DELTA_INPUT options = new DELTA_INPUT(); long fileType = isExecutable ? NativeConstants.DELTA_FILE_TYPE_SET_EXECUTABLES : NativeConstants.DELTA_FILE_TYPE_RAW; NativeMethods.CreateDeltaW( NativeConstants.DELTA_FILE_TYPE_SET_EXECUTABLES, NativeConstants.DELTA_FLAG_NONE, NativeConstants.DELTA_FLAG_NONE, originalFile, newFile, null, null, options, IntPtr.Zero, 0, deltaFile); }
private static bool CheckApiSupport() { if (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 6) { // Windows Vista or later return true; } try { // Try to call the API. DELTA_INPUT options = new DELTA_INPUT(); NativeMethods.CreateDeltaW( NativeConstants.DELTA_FILE_TYPE_SET_EXECUTABLES, NativeConstants.DELTA_FLAG_NONE, NativeConstants.DELTA_FLAG_NONE, null, null, null, null, options, IntPtr.Zero, 0, null); // The API is supported. return true; } catch (DllNotFoundException) { // Unable to load DLL 'msdelta.dll' return false; } catch (Exception) { return false; } }
public static extern bool GetDeltaInfoB(DELTA_INPUT Delta, [OutAttribute()] out DELTA_HEADER_INFO lpHeaderInfo);
public static extern bool GetDeltaSignatureB(long FileTypeSet, uint HashAlgId, DELTA_INPUT Source, [OutAttribute()] out DELTA_HASH lpHash);
public static extern bool DeltaNormalizeProvidedB(long FileTypeSet, long NormalizeFlags, DELTA_INPUT NormalizeOptions, System.IntPtr lpSource, uint uSourceSize);
public static extern bool CreateDeltaB(long FileTypeSet, long SetFlags, long ResetFlags, DELTA_INPUT Source, DELTA_INPUT Target, DELTA_INPUT SourceOptions, DELTA_INPUT TargetOptions, DELTA_INPUT GlobalOptions, [InAttribute()] System.IntPtr lpTargetFileTime, uint HashAlgId, [OutAttribute()] out DELTA_OUTPUT lpDelta);
public static extern bool CreateDeltaA(long FileTypeSet, long SetFlags, long ResetFlags, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string lpSourceName, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string lpTargetName, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string lpSourceOptionsName, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string lpTargetOptionsName, DELTA_INPUT GlobalOptions, [InAttribute()] System.IntPtr lpTargetFileTime, uint HashAlgId, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPStr)] string lpDeltaName);
public static extern bool ApplyDeltaProvidedB(long ApplyFlags, DELTA_INPUT Source, DELTA_INPUT Delta, System.IntPtr lpTarget, uint uTargetSize);
public static extern bool ApplyDeltaB(long ApplyFlags, DELTA_INPUT Source, DELTA_INPUT Delta, [OutAttribute()] out DELTA_OUTPUT lpTarget);