IFileSystem.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. using System.Collections.Generic;
  9. using System.IO;
  10. namespace DiskAccessLibrary.FileSystems.Abstractions
  11. {
  12. public interface IFileSystem
  13. {
  14. /// <exception cref="System.IO.DirectoryNotFoundException"></exception>
  15. /// <exception cref="System.IO.FileNotFoundException"></exception>
  16. /// <exception cref="System.IO.IOException"></exception>
  17. /// <exception cref="System.UnauthorizedAccessException"></exception>
  18. FileSystemEntry GetEntry(string path);
  19. /// <exception cref="System.IO.DirectoryNotFoundException"></exception>
  20. /// <exception cref="System.IO.IOException"></exception>
  21. /// <exception cref="System.UnauthorizedAccessException"></exception>
  22. FileSystemEntry CreateFile(string path);
  23. /// <exception cref="System.IO.DirectoryNotFoundException"></exception>
  24. /// <exception cref="System.IO.IOException"></exception>
  25. /// <exception cref="System.UnauthorizedAccessException"></exception>
  26. FileSystemEntry CreateDirectory(string path);
  27. /// <exception cref="System.IO.DirectoryNotFoundException"></exception>
  28. /// <exception cref="System.IO.FileNotFoundException"></exception>
  29. /// <exception cref="System.IO.IOException"></exception>
  30. /// <exception cref="System.UnauthorizedAccessException"></exception>
  31. void Move(string source, string destination);
  32. /// <exception cref="System.IO.DirectoryNotFoundException"></exception>
  33. /// <exception cref="System.IO.FileNotFoundException"></exception>
  34. /// <exception cref="System.IO.IOException"></exception>
  35. /// <exception cref="System.UnauthorizedAccessException"></exception>
  36. void Delete(string path);
  37. /// <exception cref="System.IO.DirectoryNotFoundException"></exception>
  38. /// <exception cref="System.IO.IOException"></exception>
  39. /// <exception cref="System.UnauthorizedAccessException"></exception>
  40. List<FileSystemEntry> ListEntriesInDirectory(string path);
  41. /// <exception cref="System.IO.DirectoryNotFoundException"></exception>
  42. /// <exception cref="System.IO.FileNotFoundException"></exception>
  43. /// <exception cref="System.IO.IOException"></exception>
  44. /// <exception cref="System.UnauthorizedAccessException"></exception>
  45. List<KeyValuePair<string, ulong>> ListDataStreams(string path);
  46. /// <exception cref="System.IO.DirectoryNotFoundException"></exception>
  47. /// <exception cref="System.IO.FileNotFoundException"></exception>
  48. /// <exception cref="System.IO.IOException"></exception>
  49. /// <exception cref="System.UnauthorizedAccessException"></exception>
  50. Stream OpenFile(string path, FileMode mode, FileAccess access, FileShare share, FileOptions options);
  51. /// <exception cref="System.IO.FileNotFoundException"></exception>
  52. /// <exception cref="System.IO.IOException"></exception>
  53. /// <exception cref="System.UnauthorizedAccessException"></exception>
  54. void SetAttributes(string path, bool? isHidden, bool? isReadonly, bool? isArchived);
  55. /// <exception cref="System.IO.FileNotFoundException"></exception>
  56. /// <exception cref="System.IO.IOException"></exception>
  57. /// <exception cref="System.UnauthorizedAccessException"></exception>
  58. void SetDates(string path, DateTime? creationDT, DateTime? lastWriteDT, DateTime? lastAccessDT);
  59. string Name
  60. {
  61. get;
  62. }
  63. /// <exception cref="System.IO.IOException"></exception>
  64. long Size
  65. {
  66. get;
  67. }
  68. /// <exception cref="System.IO.IOException"></exception>
  69. long FreeSpace
  70. {
  71. get;
  72. }
  73. /// <summary>
  74. /// Indicates support for opening named streams (alternate data streams).
  75. /// Named streams are opened using the filename:stream syntax.
  76. /// </summary>
  77. bool SupportsNamedStreams
  78. {
  79. get;
  80. }
  81. }
  82. }