You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CopyOptions.cs 3.2 KiB

7 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* Copyright (C) 2008-2016 Peter Palotas, Jeffrey Jangli, Alexandr Normuradov
  2. *
  3. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4. * of this software and associated documentation files (the "Software"), to deal
  5. * in the Software without restriction, including without limitation the rights
  6. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. * copies of the Software, and to permit persons to whom the Software is
  8. * furnished to do so, subject to the following conditions:
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. *
  13. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. * THE SOFTWARE.
  20. */
  21. using System;
  22. using System.Diagnostics.CodeAnalysis;
  23. namespace Alphaleonis.Win32.Filesystem
  24. {
  25. /// <summary>Flags that specify how a file or directory is to be copied.</summary>
  26. [Flags]
  27. public enum CopyOptions
  28. {
  29. /// <summary>No CopyOptions used, this allows overwriting the file.</summary>
  30. None = 0,
  31. /// <summary>COPY_FILE_FAIL_IF_EXISTS
  32. /// <para>The copy operation fails immediately if the target file already exists.</para>
  33. /// </summary>
  34. FailIfExists = 1,
  35. /// <summary>COPY_FILE_RESTARTABLE
  36. /// <para>
  37. /// Progress of the copy is tracked in the target file in case the copy fails. The failed copy can be restarted at a later time by specifying the same values
  38. /// forexisting file name and new file name as those used in the call that failed. This can significantly slow down the copy operation as the new file may be
  39. /// flushed multiple times during the copy operation.
  40. /// </para>
  41. /// </summary>
  42. [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Restartable")]
  43. Restartable = 2,
  44. /// <summary>COPY_FILE_OPEN_SOURCE_FOR_WRITE
  45. /// <para>The file is copied and the original file is opened for write access.</para>
  46. /// </summary>
  47. OpenSourceForWrite = 4,
  48. /// <summary>COPY_FILE_ALLOW_DECRYPTED_DESTINATION
  49. /// <para>An attempt to copy an encrypted file will succeed even if the destination copy cannot be encrypted.</para>
  50. /// </summary>
  51. AllowDecryptedDestination = 8,
  52. /// <summary>COPY_FILE_COPY_SYMLINK
  53. /// <para>If the source file is a symbolic link, the destination file is also a symbolic link pointing to the same file that the source symbolic link is pointing to.</para>
  54. /// </summary>
  55. CopySymbolicLink = 2048,
  56. /// <summary>COPY_FILE_NO_BUFFERING
  57. /// <para>The copy operation is performed using unbuffered I/O, bypassing system I/O cache resources. Recommended for very large file transfers.</para>
  58. /// </summary>
  59. NoBuffering = 4096
  60. }
  61. }