25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 

644 satır
26 KiB

  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. using System.IO;
  24. using System.Runtime.InteropServices;
  25. using System.Security;
  26. namespace Alphaleonis.Win32.Filesystem
  27. {
  28. /// <summary>Provides the base class for both <see cref="FileInfo"/> and <see cref="DirectoryInfo"/> objects.</summary>
  29. [SerializableAttribute]
  30. [ComVisibleAttribute(true)]
  31. public abstract class FileSystemInfo : MarshalByRefObject
  32. {
  33. #region Methods
  34. #region .NET
  35. #region Delete
  36. /// <summary>Deletes a file or directory.</summary>
  37. [SecurityCritical]
  38. public abstract void Delete();
  39. #endregion // Delete
  40. #region Refresh
  41. /// <summary>Refreshes the state of the object.</summary>
  42. /// <remarks>
  43. /// <para>FileSystemInfo.Refresh() takes a snapshot of the file from the current file system.</para>
  44. /// <para>Refresh cannot correct the underlying file system even if the file system returns incorrect or outdated information.</para>
  45. /// <para>This can happen on platforms such as Windows 98.</para>
  46. /// <para>Calls must be made to Refresh() before attempting to get the attribute information, or the information will be
  47. /// outdated.</para>
  48. /// </remarks>
  49. [SecurityCritical]
  50. protected void Refresh()
  51. {
  52. DataInitialised = File.FillAttributeInfoCore(Transaction, LongFullName, ref Win32AttributeData, false, false);
  53. }
  54. #endregion // Refresh
  55. #region ToString
  56. /// <summary>Returns a string that represents the current object.</summary>
  57. /// <remarks>
  58. /// ToString is the major formatting method in the .NET Framework. It converts an object to its string representation so that it is
  59. /// suitable for display.
  60. /// </remarks>
  61. /// <returns>A string that represents this instance.</returns>
  62. public override string ToString()
  63. {
  64. // "Alphaleonis.Win32.Filesystem.FileSystemInfo"
  65. return GetType().ToString();
  66. }
  67. #endregion // ToString
  68. #region Equality
  69. /// <summary>Determines whether the specified Object is equal to the current Object.</summary>
  70. /// <param name="obj">Another object to compare to.</param>
  71. /// <returns><see langword="true"/> if the specified Object is equal to the current Object; otherwise, <see langword="false"/>.</returns>
  72. public override bool Equals(object obj)
  73. {
  74. if (obj == null || GetType() != obj.GetType())
  75. return false;
  76. FileSystemInfo other = obj as FileSystemInfo;
  77. return other != null && (other.Name != null &&
  78. (other.FullName.Equals(FullName, StringComparison.OrdinalIgnoreCase) &&
  79. other.Attributes.Equals(Attributes) &&
  80. other.CreationTimeUtc.Equals(CreationTimeUtc) &&
  81. other.LastWriteTimeUtc.Equals(LastWriteTimeUtc)));
  82. }
  83. // A random prime number will be picked and added to the HashCode, each time an instance is created.
  84. [NonSerialized]
  85. private readonly int _random = new Random().Next(0, 19);
  86. [NonSerialized]
  87. private static readonly int[] Primes = { 17, 23, 29, 37, 47, 59, 71, 89, 107, 131, 163, 197, 239, 293, 353, 431, 521, 631, 761, 919 };
  88. /// <summary>Serves as a hash function for a particular type.</summary>
  89. /// <returns>A hash code for the current Object.</returns>
  90. public override int GetHashCode()
  91. {
  92. string fullName = FullName;
  93. string name = Name;
  94. unchecked
  95. {
  96. int hash = Primes[_random];
  97. if (!Utils.IsNullOrWhiteSpace(fullName))
  98. hash = hash * Primes[1] + fullName.GetHashCode();
  99. if (!Utils.IsNullOrWhiteSpace(name))
  100. hash = hash * Primes[1] + name.GetHashCode();
  101. hash = hash * Primes[1] + Attributes.GetHashCode();
  102. hash = hash * Primes[1] + CreationTimeUtc.GetHashCode();
  103. hash = hash * Primes[1] + LastWriteTimeUtc.GetHashCode();
  104. return hash;
  105. }
  106. }
  107. /// <summary>Implements the operator ==</summary>
  108. /// <param name="left">A.</param>
  109. /// <param name="right">B.</param>
  110. /// <returns>The result of the operator.</returns>
  111. public static bool operator ==(FileSystemInfo left, FileSystemInfo right)
  112. {
  113. return ReferenceEquals(left, null) && ReferenceEquals(right, null) ||
  114. !ReferenceEquals(left, null) && !ReferenceEquals(right, null) && left.Equals(right);
  115. }
  116. /// <summary>Implements the operator !=</summary>
  117. /// <param name="left">A.</param>
  118. /// <param name="right">B.</param>
  119. /// <returns>The result of the operator.</returns>
  120. public static bool operator !=(FileSystemInfo left, FileSystemInfo right)
  121. {
  122. return !(left == right);
  123. }
  124. #endregion // Equality
  125. #endregion // .NET
  126. #region AlphaFS
  127. #region RefreshEntryInfo
  128. /// <summary>Refreshes the state of the <see cref="FileSystemEntryInfo"/> EntryInfo instance.</summary>
  129. /// <remarks>
  130. /// <para>FileSystemInfo.RefreshEntryInfo() takes a snapshot of the file from the current file system.</para>
  131. /// <para>Refresh cannot correct the underlying file system even if the file system returns incorrect or outdated information.</para>
  132. /// <para>This can happen on platforms such as Windows 98.</para>
  133. /// <para>Calls must be made to Refresh() before attempting to get the attribute information, or the information will be outdated.</para>
  134. /// </remarks>
  135. [SecurityCritical]
  136. protected void RefreshEntryInfo()
  137. {
  138. _entryInfo = File.GetFileSystemEntryInfoCore(IsDirectory, Transaction, LongFullName, true, PathFormat.LongFullPath);
  139. if (_entryInfo == null)
  140. DataInitialised = -1;
  141. else
  142. {
  143. DataInitialised = 0;
  144. Win32AttributeData = new NativeMethods.WIN32_FILE_ATTRIBUTE_DATA(_entryInfo.Win32FindData);
  145. }
  146. }
  147. #endregion // RefreshEntryInfo
  148. #region Reset
  149. /// <summary>[AlphaFS] Resets the state of the file system object to uninitialized.</summary>
  150. internal void Reset()
  151. {
  152. DataInitialised = -1;
  153. }
  154. #endregion // Reset
  155. #region InitializeCore
  156. /// <summary>Initializes the specified file name.</summary>
  157. /// <exception cref="ArgumentException"/>
  158. /// <exception cref="NotSupportedException"/>
  159. /// <param name="isFolder">Specifies that <paramref name="path"/> is a file or directory.</param>
  160. /// <param name="transaction">The transaction.</param>
  161. /// <param name="path">The full path and name of the file.</param>
  162. /// <param name="pathFormat">Indicates the format of the path parameter(s).</param>
  163. internal void InitializeCore(bool isFolder, KernelTransaction transaction, string path, PathFormat pathFormat)
  164. {
  165. if (pathFormat == PathFormat.RelativePath)
  166. Path.CheckSupportedPathFormat(path, true, true);
  167. LongFullName = Path.GetExtendedLengthPathCore(transaction, path, pathFormat, GetFullPathOptions.TrimEnd | (isFolder ? GetFullPathOptions.RemoveTrailingDirectorySeparator : 0) | GetFullPathOptions.ContinueOnNonExist);
  168. // (Not on MSDN): .NET 4+ Trailing spaces are removed from the end of the path parameter before creating the FileSystemInfo instance.
  169. FullPath = Path.GetRegularPathCore(LongFullName, GetFullPathOptions.None, false);
  170. IsDirectory = isFolder;
  171. Transaction = transaction;
  172. OriginalPath = FullPath.Length == 2 && (FullPath[1] == Path.VolumeSeparatorChar)
  173. ? Path.CurrentDirectoryPrefix
  174. : path;
  175. DisplayPath = OriginalPath.Length != 2 || OriginalPath[1] != Path.VolumeSeparatorChar
  176. ? Path.GetRegularPathCore(OriginalPath, GetFullPathOptions.None, false)
  177. : Path.CurrentDirectoryPrefix;
  178. }
  179. #endregion // InitializeCore
  180. #endregion // AlphaFS
  181. #endregion // Methods
  182. #region Properties
  183. #region .NET
  184. #region Attributes
  185. /// <summary>
  186. /// Gets or sets the attributes for the current file or directory.
  187. /// </summary>
  188. /// <remarks>
  189. /// <para>The value of the CreationTime property is pre-cached</para>
  190. /// <para>To get the latest value, call the Refresh method.</para>
  191. /// </remarks>
  192. /// <value><see cref="FileAttributes"/> of the current <see cref="FileSystemInfo"/>.</value>
  193. ///
  194. /// <exception cref="FileNotFoundException"/>
  195. /// <exception cref="DirectoryNotFoundException"/>
  196. /// <exception cref="IOException"/>
  197. public FileAttributes Attributes
  198. {
  199. [SecurityCritical]
  200. get
  201. {
  202. if (DataInitialised == -1)
  203. {
  204. Win32AttributeData = new NativeMethods.WIN32_FILE_ATTRIBUTE_DATA();
  205. Refresh();
  206. }
  207. // MSDN: .NET 3.5+: IOException: Refresh cannot initialize the data.
  208. if (DataInitialised != 0)
  209. NativeError.ThrowException(DataInitialised, LongFullName);
  210. return Win32AttributeData.dwFileAttributes;
  211. }
  212. [SecurityCritical]
  213. set
  214. {
  215. File.SetAttributesCore(IsDirectory, Transaction, LongFullName, value, PathFormat.LongFullPath);
  216. Reset();
  217. }
  218. }
  219. #endregion // Attributes
  220. #region CreationTime
  221. /// <summary>Gets or sets the creation time of the current file or directory.</summary>
  222. /// <remarks>
  223. /// <para>The value of the CreationTime property is pre-cached To get the latest value, call the Refresh method.</para>
  224. /// <para>This method may return an inaccurate value, because it uses native functions whose values may not be continuously updated by
  225. /// the operating system.</para>
  226. /// <para>If the file described in the FileSystemInfo object does not exist, this property will return
  227. /// 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time.</para>
  228. /// <para>NTFS-formatted drives may cache file meta-info, such as file creation time, for a short period of time.
  229. /// This process is known as file tunneling. As a result, it may be necessary to explicitly set the creation time of a file if you are
  230. /// overwriting or replacing an existing file.</para>
  231. /// </remarks>
  232. /// <value>The creation date and time of the current <see cref="FileSystemInfo"/> object.</value>
  233. ///
  234. /// <exception cref="DirectoryNotFoundException"/>
  235. /// <exception cref="IOException"/>
  236. public DateTime CreationTime
  237. {
  238. [SecurityCritical] get { return CreationTimeUtc.ToLocalTime(); }
  239. [SecurityCritical] set { CreationTimeUtc = value.ToUniversalTime(); }
  240. }
  241. #endregion // CreationTime
  242. #region CreationTimeUtc
  243. /// <summary>Gets or sets the creation time, in coordinated universal time (UTC), of the current file or directory.</summary>
  244. /// <remarks>
  245. /// <para>The value of the CreationTimeUtc property is pre-cached
  246. /// To get the latest value, call the Refresh method.</para>
  247. /// <para>This method may return an inaccurate value, because it uses native functions
  248. /// whose values may not be continuously updated by the operating system.</para>
  249. /// <para>To get the latest value, call the Refresh method.</para>
  250. /// <para>If the file described in the FileSystemInfo object does not exist, this property will return
  251. /// 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC).</para>
  252. /// <para>NTFS-formatted drives may cache file meta-info, such as file creation time, for a short period of time.
  253. /// This process is known as file tunneling. As a result, it may be necessary to explicitly set the creation time
  254. /// of a file if you are overwriting or replacing an existing file.</para>
  255. /// </remarks>
  256. /// <value>The creation date and time in UTC format of the current <see cref="FileSystemInfo"/> object.</value>
  257. ///
  258. /// <exception cref="DirectoryNotFoundException"/>
  259. /// <exception cref="IOException"/>
  260. [ComVisible(false)]
  261. public DateTime CreationTimeUtc
  262. {
  263. [SecurityCritical]
  264. get
  265. {
  266. if (DataInitialised == -1)
  267. {
  268. Win32AttributeData = new NativeMethods.WIN32_FILE_ATTRIBUTE_DATA();
  269. Refresh();
  270. }
  271. // MSDN: .NET 3.5+: IOException: Refresh cannot initialize the data.
  272. if (DataInitialised != 0)
  273. NativeError.ThrowException(DataInitialised, LongFullName);
  274. return DateTime.FromFileTimeUtc(Win32AttributeData.ftCreationTime);
  275. }
  276. [SecurityCritical]
  277. set
  278. {
  279. File.SetFsoDateTimeCore(IsDirectory, Transaction, LongFullName, value, null, null, false, PathFormat.LongFullPath);
  280. Reset();
  281. }
  282. }
  283. #endregion // CreationTimeUtc
  284. #region Exists
  285. /// <summary>
  286. /// Gets a value indicating whether the file or directory exists.
  287. /// </summary>
  288. /// <remarks>
  289. /// <para>The <see cref="Exists"/> property returns <see langword="false"/> if any error occurs while trying to determine if the
  290. /// specified file or directory exists.</para>
  291. /// <para>This can occur in situations that raise exceptions such as passing a directory- or file name with invalid characters or too
  292. /// many characters,</para>
  293. /// <para>a failing or missing disk, or if the caller does not have permission to read the file or directory.</para>
  294. /// </remarks>
  295. /// <value><see langword="true"/> if the file or directory exists; otherwise, <see langword="false"/>.</value>
  296. public abstract bool Exists { get; }
  297. #endregion // Exists
  298. #region Extension
  299. /// <summary>
  300. /// Gets the string representing the extension part of the file.
  301. /// </summary>
  302. /// <remarks>
  303. /// <para>The Extension property returns the <see cref="FileSystemInfo"/> extension, including the period (.).</para>
  304. /// <para>For example, for a file c:\NewFile.txt, this property returns ".txt".</para>
  305. /// </remarks>
  306. /// <value>A string containing the <see cref="FileSystemInfo"/> extension.</value>
  307. public string Extension
  308. {
  309. get { return Path.GetExtension(FullPath, false); }
  310. }
  311. #endregion // Extension
  312. #region FullName
  313. /// <summary>
  314. /// Gets the full path of the directory or file.
  315. /// </summary>
  316. /// <value>A string containing the full path.</value>
  317. public virtual string FullName
  318. {
  319. [SecurityCritical]
  320. get { return FullPath; }
  321. }
  322. #endregion // FullName
  323. #region LastAccessTime
  324. /// <summary>Gets or sets the time the current file or directory was last accessed.</summary>
  325. /// <remarks>
  326. /// <para>The value of the LastAccessTime property is pre-cached
  327. /// To get the latest value, call the Refresh method.</para>
  328. /// <para>This method may return an inaccurate value, because it uses native functions
  329. /// whose values may not be continuously updated by the operating system.</para>
  330. /// <para>If the file described in the FileSystemInfo object does not exist, this property will return
  331. /// 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time.</para>
  332. /// </remarks>
  333. /// <value>The time that the current file or directory was last accessed.</value>
  334. ///
  335. /// <exception cref="IOException"/>
  336. public DateTime LastAccessTime
  337. {
  338. [SecurityCritical] get { return LastAccessTimeUtc.ToLocalTime(); }
  339. [SecurityCritical] set { LastAccessTimeUtc = value.ToUniversalTime(); }
  340. }
  341. #endregion // LastAccessTime
  342. #region LastAccessTimeUtc
  343. /// <summary>Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was last accessed.</summary>
  344. /// <remarks>
  345. /// <para>The value of the LastAccessTimeUtc property is pre-cached.
  346. /// To get the latest value, call the Refresh method.</para>
  347. /// <para>This method may return an inaccurate value, because it uses native functions
  348. /// whose values may not be continuously updated by the operating system.</para>
  349. /// <para>If the file described in the FileSystemInfo object does not exist, this property will return
  350. /// 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time.</para>
  351. /// </remarks>
  352. /// <value>The UTC time that the current file or directory was last accessed.</value>
  353. ///
  354. /// <exception cref="IOException"/>
  355. [ComVisible(false)]
  356. public DateTime LastAccessTimeUtc
  357. {
  358. [SecurityCritical]
  359. get
  360. {
  361. if (DataInitialised == -1)
  362. {
  363. Win32AttributeData = new NativeMethods.WIN32_FILE_ATTRIBUTE_DATA();
  364. Refresh();
  365. }
  366. // MSDN: .NET 3.5+: IOException: Refresh cannot initialize the data.
  367. if (DataInitialised != 0)
  368. NativeError.ThrowException(DataInitialised, LongFullName);
  369. return DateTime.FromFileTimeUtc(Win32AttributeData.ftLastAccessTime);
  370. }
  371. [SecurityCritical]
  372. set
  373. {
  374. File.SetFsoDateTimeCore(IsDirectory, Transaction, LongFullName, null, value, null, false, PathFormat.LongFullPath);
  375. Reset();
  376. }
  377. }
  378. #endregion // LastAccessTimeUtc
  379. #region LastWriteTime
  380. /// <summary>Gets or sets the time when the current file or directory was last written to.</summary>
  381. /// <remarks>
  382. /// <para>The value of the LastWriteTime property is pre-cached.
  383. /// To get the latest value, call the Refresh method.</para>
  384. /// <para>This method may return an inaccurate value, because it uses native functions
  385. /// whose values may not be continuously updated by the operating system.</para>
  386. /// <para>If the file described in the FileSystemInfo object does not exist, this property will return
  387. /// 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time.</para>
  388. /// </remarks>
  389. /// <value>The time the current file was last written.</value>
  390. ///
  391. /// <exception cref="IOException"/>
  392. public DateTime LastWriteTime
  393. {
  394. get { return LastWriteTimeUtc.ToLocalTime(); }
  395. set { LastWriteTimeUtc = value.ToUniversalTime(); }
  396. }
  397. #endregion // LastWriteTime
  398. #region LastWriteTimeUtc
  399. /// <summary>Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.</summary>
  400. /// <remarks>
  401. /// <para>The value of the LastWriteTimeUtc property is pre-cached. To get the latest value, call the Refresh method.</para>
  402. /// <para>This method may return an inaccurate value, because it uses native functions whose values may not be continuously updated by
  403. /// the operating system.</para>
  404. /// <para>If the file described in the FileSystemInfo object does not exist, this property will return 12:00 midnight, January 1, 1601
  405. /// A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time.</para>
  406. /// </remarks>
  407. /// <value>The UTC time when the current file was last written to.</value>
  408. [ComVisible(false)]
  409. public DateTime LastWriteTimeUtc
  410. {
  411. [SecurityCritical]
  412. get
  413. {
  414. if (DataInitialised == -1)
  415. {
  416. Win32AttributeData = new NativeMethods.WIN32_FILE_ATTRIBUTE_DATA();
  417. Refresh();
  418. }
  419. // MSDN: .NET 3.5+: IOException: Refresh cannot initialize the data.
  420. if (DataInitialised != 0)
  421. NativeError.ThrowException(DataInitialised, LongFullName);
  422. return DateTime.FromFileTimeUtc(Win32AttributeData.ftLastWriteTime);
  423. }
  424. [SecurityCritical]
  425. set
  426. {
  427. File.SetFsoDateTimeCore(IsDirectory, Transaction, LongFullName, null, null, value, false, PathFormat.LongFullPath);
  428. Reset();
  429. }
  430. }
  431. #endregion // LastWriteTimeUtc
  432. #region Name
  433. /// <summary>
  434. /// For files, gets the name of the file. For directories, gets the name of the last directory in the hierarchy if a hierarchy exists.
  435. /// <para>Otherwise, the Name property gets the name of the directory.</para>
  436. /// </summary>
  437. /// <remarks>
  438. /// <para>For a directory, Name returns only the name of the parent directory, such as Dir, not c:\Dir.</para>
  439. /// <para>For a subdirectory, Name returns only the name of the subdirectory, such as Sub1, not c:\Dir\Sub1.</para>
  440. /// <para>For a file, Name returns only the file name and file name extension, such as MyFile.txt, not c:\Dir\Myfile.txt.</para>
  441. /// </remarks>
  442. /// <value>
  443. /// <para>A string that is the name of the parent directory, the name of the last directory in the hierarchy,</para>
  444. /// <para>or the name of a file, including the file name extension.</para>
  445. /// </value>
  446. public abstract string Name { get; }
  447. #endregion // Name
  448. #endregion // .NET
  449. #region AlphaFS
  450. #region DisplayPath
  451. /// <summary>Returns the path as a string.</summary>
  452. protected internal string DisplayPath { get; protected set; }
  453. #endregion // DisplayPath
  454. #region EntryInfo
  455. private FileSystemEntryInfo _entryInfo;
  456. /// <summary>[AlphaFS] Gets the instance of the <see cref="FileSystemEntryInfo"/> class.</summary>
  457. public FileSystemEntryInfo EntryInfo
  458. {
  459. [SecurityCritical]
  460. get
  461. {
  462. if (_entryInfo == null)
  463. {
  464. Win32AttributeData = new NativeMethods.WIN32_FILE_ATTRIBUTE_DATA();
  465. RefreshEntryInfo();
  466. }
  467. // MSDN: .NET 3.5+: IOException: Refresh cannot initialize the data.
  468. if (DataInitialised > 0)
  469. NativeError.ThrowException(DataInitialised, LongFullName);
  470. return _entryInfo;
  471. }
  472. internal set
  473. {
  474. _entryInfo = value;
  475. DataInitialised = value == null ? -1 : 0;
  476. if (DataInitialised == 0)
  477. Win32AttributeData = new NativeMethods.WIN32_FILE_ATTRIBUTE_DATA(_entryInfo.Win32FindData);
  478. }
  479. }
  480. #endregion // EntryInfo
  481. #region IsDirectory
  482. /// <summary>[AlphaFS] The initial "IsDirectory" indicator that was passed to the constructor.</summary>
  483. protected bool IsDirectory { get; set; }
  484. #endregion // IsDirectory
  485. #region LongFullName
  486. /// <summary>The full path of the file system object in Unicode (LongPath) format.</summary>
  487. protected string LongFullName { get; set; }
  488. #endregion // LongFullName
  489. #region Transaction
  490. /// <summary>[AlphaFS] Represents the KernelTransaction that was passed to the constructor.</summary>
  491. protected KernelTransaction Transaction { get; set; }
  492. #endregion // Transaction
  493. #endregion // AlphaFS
  494. #endregion // Properties
  495. #region Fields
  496. // We use this field in conjunction with the Refresh methods, if we succeed
  497. // we store a zero, on failure we store the HResult in it so that we can
  498. // give back a generic error back.
  499. [NonSerialized] internal int DataInitialised = -1;
  500. // The pre-cached FileSystemInfo information.
  501. [NonSerialized] internal NativeMethods.WIN32_FILE_ATTRIBUTE_DATA Win32AttributeData;
  502. #region .NET
  503. /// <summary>Represents the fully qualified path of the file or directory.</summary>
  504. /// <remarks>
  505. /// <para>Classes derived from <see cref="FileSystemInfo"/> can use the FullPath field</para>
  506. /// <para>to determine the full path of the object being manipulated.</para>
  507. /// </remarks>
  508. [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
  509. protected string FullPath;
  510. /// <summary>The path originally specified by the user, whether relative or absolute.</summary>
  511. [SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
  512. protected string OriginalPath;
  513. #endregion // .NET
  514. #endregion // Fields
  515. }
  516. }