Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Directory.TransferTimestamps.cs 4.3 KiB

il y a 7 ans
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.Security;
  22. namespace Alphaleonis.Win32.Filesystem
  23. {
  24. partial class Directory
  25. {
  26. /// <summary>[AlphaFS] Transfers the date and time stamps for the specified directories.</summary>
  27. /// <remarks>This method uses BackupSemantics flag to get Timestamp changed for directories.</remarks>
  28. /// <param name="sourcePath">The source directory to get the date and time stamps from.</param>
  29. /// <param name="destinationPath">The destination directory to set the date and time stamps.</param>
  30. [SecurityCritical]
  31. public static void TransferTimestamps(string sourcePath, string destinationPath)
  32. {
  33. File.TransferTimestampsCore(true, null, sourcePath, destinationPath, PathFormat.RelativePath);
  34. }
  35. /// <summary>[AlphaFS] Transfers the date and time stamps for the specified directories.</summary>
  36. /// <remarks>This method uses BackupSemantics flag to get Timestamp changed for directories.</remarks>
  37. /// <param name="sourcePath">The source directory to get the date and time stamps from.</param>
  38. /// <param name="destinationPath">The destination directory to set the date and time stamps.</param>
  39. /// <param name="pathFormat">Indicates the format of the path parameter(s).</param>
  40. [SecurityCritical]
  41. public static void TransferTimestamps(string sourcePath, string destinationPath, PathFormat pathFormat)
  42. {
  43. File.TransferTimestampsCore(true, null, sourcePath, destinationPath, pathFormat);
  44. }
  45. #region Transactional
  46. /// <summary>[AlphaFS] Transfers the date and time stamps for the specified directories.</summary>
  47. /// <remarks>This method uses BackupSemantics flag to get Timestamp changed for directories.</remarks>
  48. /// <param name="transaction">The transaction.</param>
  49. /// <param name="sourcePath">The source directory to get the date and time stamps from.</param>
  50. /// <param name="destinationPath">The destination directory to set the date and time stamps.</param>
  51. [SecurityCritical]
  52. public static void TransferTimestampsTransacted(KernelTransaction transaction, string sourcePath, string destinationPath)
  53. {
  54. File.TransferTimestampsCore(true, transaction, sourcePath, destinationPath, PathFormat.RelativePath);
  55. }
  56. /// <summary>[AlphaFS] Transfers the date and time stamps for the specified directories.</summary>
  57. /// <remarks>This method uses BackupSemantics flag to get Timestamp changed for directories.</remarks>
  58. /// <param name="transaction">The transaction.</param>
  59. /// <param name="sourcePath">The source directory to get the date and time stamps from.</param>
  60. /// <param name="destinationPath">The destination directory to set the date and time stamps.</param>
  61. /// <param name="pathFormat">Indicates the format of the path parameter(s).</param>
  62. [SecurityCritical]
  63. public static void TransferTimestampsTransacted(KernelTransaction transaction, string sourcePath, string destinationPath, PathFormat pathFormat)
  64. {
  65. File.TransferTimestampsCore(true, transaction, sourcePath, destinationPath, pathFormat);
  66. }
  67. #endregion // Transactional
  68. }
  69. }