Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

MoveOptions.cs 4.2 KiB

7 anos atrás
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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>Used by MoveFileXxx.Flags that specify how a file or directory is to be moved.</summary>
  26. [Flags]
  27. public enum MoveOptions
  28. {
  29. /// <summary>No MoveOptions used, this fails when the file name already exists.</summary>
  30. None = 0,
  31. /// <summary>MOVE_FILE_REPLACE_EXISTSING
  32. /// <para>If the destination file name already exists, the function replaces its contents with the contents of the source file.</para>
  33. /// <para>This value cannot be used if lpNewFileName or lpExistingFileName names a directory.</para>
  34. /// <para>This value cannot be used if either source or destination names a directory.</para>
  35. /// </summary>
  36. ReplaceExisting = 1,
  37. /// <summary>MOVE_FILE_COPY_ALLOWED
  38. /// <para>If the file is to be moved to a different volume, the function simulates the move by using the CopyFile and DeleteFile functions.</para>
  39. /// <para>This value cannot be used with <see cref="MoveOptions.DelayUntilReboot"/>.</para>
  40. /// </summary>
  41. CopyAllowed = 2,
  42. /// <summary>MOVE_FILE_DELAY_UNTIL_REBOOT
  43. /// <para>
  44. /// The system does not move the file until the operating system is restarted.
  45. /// The system moves the file immediately after AUTOCHK is executed, but before creating any paging files.
  46. /// </para>
  47. /// <para>
  48. /// Consequently, this parameter enables the function to delete paging files from previous startups.
  49. /// This value can only be used if the process is in the context of a user who belongs to the administrators group or the LocalSystem account.
  50. /// </para>
  51. /// <para>This value cannot be used with <see cref="MoveOptions.CopyAllowed"/>.</para>
  52. /// </summary>
  53. DelayUntilReboot = 4,
  54. /// <summary>MOVE_FILE_WRITE_THROUGH
  55. /// <para>The function does not return until the file has actually been moved on the disk.</para>
  56. /// <para>
  57. /// Setting this value guarantees that a move performed as a copy and delete operation is flushed to disk before the function returns.
  58. /// The flush occurs at the end of the copy operation.
  59. /// </para>
  60. /// <para>This value has no effect if <see cref="MoveOptions.DelayUntilReboot"/> is set.</para>
  61. /// </summary>
  62. WriteThrough = 8,
  63. /// <summary>MOVE_FILE_CREATE_HARDLINK
  64. /// <para>Reserved for future use.</para>
  65. /// </summary>
  66. [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Hardlink")]
  67. CreateHardlink = 16,
  68. /// <summary>MOVE_FILE_FAIL_IF_NOT_TRACKABLE
  69. /// <para>The function fails if the source file is a link source, but the file cannot be tracked after the move.</para>
  70. /// <para>This situation can occur if the destination is a volume formatted with the FAT file system.</para>
  71. /// </summary>
  72. [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Trackable")]
  73. FailIfNotTrackable = 32
  74. }
  75. }