FileSystemEntry.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Copyright (C) 2014-2020 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  2. *
  3. * You can redistribute this program and/or modify it under the terms of
  4. * the GNU Lesser Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. */
  7. using System;
  8. namespace DiskAccessLibrary.FileSystems.Abstractions
  9. {
  10. public class FileSystemEntry
  11. {
  12. /// <summary>
  13. /// Full Path. Directory path should end with a trailing slash.
  14. /// </summary>
  15. public string FullName;
  16. public string Name;
  17. public bool IsDirectory;
  18. public ulong Size;
  19. public DateTime CreationTime;
  20. public DateTime LastWriteTime;
  21. public DateTime LastAccessTime;
  22. public bool IsHidden;
  23. public bool IsReadonly;
  24. public bool IsArchived;
  25. public FileSystemEntry(string fullName, string name, bool isDirectory, ulong size, DateTime creationTime, DateTime lastWriteTime, DateTime lastAccessTime, bool isHidden, bool isReadonly, bool isArchived)
  26. {
  27. FullName = fullName;
  28. Name = name;
  29. IsDirectory = isDirectory;
  30. Size = size;
  31. CreationTime = creationTime;
  32. LastWriteTime = lastWriteTime;
  33. LastAccessTime = lastAccessTime;
  34. IsHidden = isHidden;
  35. IsReadonly = isHidden;
  36. IsArchived = isHidden;
  37. if (isDirectory)
  38. {
  39. FullName = FileSystem.GetDirectoryPath(FullName);
  40. }
  41. }
  42. public FileSystemEntry Clone()
  43. {
  44. FileSystemEntry clone = (FileSystemEntry)MemberwiseClone();
  45. return clone;
  46. }
  47. }
  48. }