public override void ReplaceFile(string sourceFullPath, string destFullPath, string destBackupFullPath, bool ignoreMetadataErrors) { int flags = Interop.Kernel32.REPLACEFILE_WRITE_THROUGH; if (ignoreMetadataErrors) { flags |= Interop.Kernel32.REPLACEFILE_IGNORE_MERGE_ERRORS; } if (!Interop.Kernel32.ReplaceFile(destFullPath, sourceFullPath, destBackupFullPath, flags, IntPtr.Zero, IntPtr.Zero)) { throw Win32Marshal.GetExceptionForWin32Error(Marshal.GetLastWin32Error()); } }