System.IO.Win32FileSystem.ReplaceFile C# (CSharp) Méthode

ReplaceFile() public méthode

public ReplaceFile ( string sourceFullPath, string destFullPath, string destBackupFullPath, bool ignoreMetadataErrors ) : void
sourceFullPath string
destFullPath string
destBackupFullPath string
ignoreMetadataErrors bool
Résultat void
        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());
            }
        }