MemoryPath.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. using System;
  2. using System.Diagnostics.CodeAnalysis;
  3. using System.IO;
  4. using System.IO.Abstractions;
  5. namespace Quadarax.Foundation.Core.IO.FileSystem.Memory
  6. {
  7. public class MemoryPath : IPath
  8. {
  9. private readonly MemoryFileSystem _fileSystem;
  10. private readonly string _tempPath;
  11. public char DirectorySeparatorChar => Path.DirectorySeparatorChar;
  12. public char AltDirectorySeparatorChar => Path.AltDirectorySeparatorChar;
  13. public char PathSeparator => throw new NotImplementedException();
  14. public char VolumeSeparatorChar => throw new NotImplementedException();
  15. public IFileSystem FileSystem => _fileSystem;
  16. public MemoryPath(MemoryFileSystem fileSystem)
  17. {
  18. _fileSystem = fileSystem;
  19. _tempPath = System.IO.Path.GetTempPath(); // Use the real system's temp path
  20. }
  21. [return: NotNullIfNotNull("path")]
  22. public string? ChangeExtension(string? path, string? extension)
  23. {
  24. throw new NotImplementedException();
  25. }
  26. public string Combine(string path1, string path2)
  27. {
  28. return Path.Combine(path1, path2);
  29. }
  30. public string Combine(string path1, string path2, string path3)
  31. {
  32. throw new NotImplementedException();
  33. }
  34. public string Combine(string path1, string path2, string path3, string path4)
  35. {
  36. throw new NotImplementedException();
  37. }
  38. public string Combine(params string[] paths)
  39. {
  40. throw new NotImplementedException();
  41. }
  42. public bool EndsInDirectorySeparator(ReadOnlySpan<char> path)
  43. {
  44. throw new NotImplementedException();
  45. }
  46. public bool EndsInDirectorySeparator(string path)
  47. {
  48. throw new NotImplementedException();
  49. }
  50. public bool Exists([NotNullWhen(true)] string? path)
  51. {
  52. throw new NotImplementedException();
  53. }
  54. public string? GetDirectoryName(string? path)
  55. {
  56. return Path.GetDirectoryName(path);
  57. }
  58. public ReadOnlySpan<char> GetDirectoryName(ReadOnlySpan<char> path)
  59. {
  60. throw new NotImplementedException();
  61. }
  62. public ReadOnlySpan<char> GetExtension(ReadOnlySpan<char> path)
  63. {
  64. throw new NotImplementedException();
  65. }
  66. [return: NotNullIfNotNull("path")]
  67. public string? GetExtension(string? path)
  68. {
  69. throw new NotImplementedException();
  70. }
  71. public string? GetFileName(string? path)
  72. {
  73. return Path.GetFileName(path);
  74. }
  75. public ReadOnlySpan<char> GetFileName(ReadOnlySpan<char> path)
  76. {
  77. throw new NotImplementedException();
  78. }
  79. public ReadOnlySpan<char> GetFileNameWithoutExtension(ReadOnlySpan<char> path)
  80. {
  81. throw new NotImplementedException();
  82. }
  83. [return: NotNullIfNotNull("path")]
  84. public string? GetFileNameWithoutExtension(string? path)
  85. {
  86. throw new NotImplementedException();
  87. }
  88. public string GetFullPath(string path)
  89. {
  90. throw new NotImplementedException();
  91. }
  92. public string GetFullPath(string path, string basePath)
  93. {
  94. throw new NotImplementedException();
  95. }
  96. public char[] GetInvalidFileNameChars()
  97. {
  98. throw new NotImplementedException();
  99. }
  100. public char[] GetInvalidPathChars()
  101. {
  102. throw new NotImplementedException();
  103. }
  104. public ReadOnlySpan<char> GetPathRoot(ReadOnlySpan<char> path)
  105. {
  106. throw new NotImplementedException();
  107. }
  108. public string? GetPathRoot(string? path)
  109. {
  110. throw new NotImplementedException();
  111. }
  112. public string GetRandomFileName()
  113. {
  114. throw new NotImplementedException();
  115. }
  116. public string GetRelativePath(string relativeTo, string path)
  117. {
  118. throw new NotImplementedException();
  119. }
  120. public string GetTempFileName()
  121. {
  122. throw new NotImplementedException();
  123. }
  124. public string GetTempPath()
  125. {
  126. return _tempPath;
  127. }
  128. public bool HasExtension(ReadOnlySpan<char> path)
  129. {
  130. throw new NotImplementedException();
  131. }
  132. public bool HasExtension([NotNullWhen(true)] string? path)
  133. {
  134. throw new NotImplementedException();
  135. }
  136. public bool IsPathFullyQualified(ReadOnlySpan<char> path)
  137. {
  138. throw new NotImplementedException();
  139. }
  140. public bool IsPathFullyQualified(string path)
  141. {
  142. throw new NotImplementedException();
  143. }
  144. public bool IsPathRooted(ReadOnlySpan<char> path)
  145. {
  146. throw new NotImplementedException();
  147. }
  148. public bool IsPathRooted([NotNullWhen(true)] string? path)
  149. {
  150. throw new NotImplementedException();
  151. }
  152. public string Join(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2)
  153. {
  154. throw new NotImplementedException();
  155. }
  156. public string Join(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2, ReadOnlySpan<char> path3)
  157. {
  158. throw new NotImplementedException();
  159. }
  160. public string Join(string? path1, string? path2)
  161. {
  162. throw new NotImplementedException();
  163. }
  164. public string Join(string? path1, string? path2, string? path3)
  165. {
  166. throw new NotImplementedException();
  167. }
  168. public string Join(params string?[] paths)
  169. {
  170. throw new NotImplementedException();
  171. }
  172. public string Join(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2, ReadOnlySpan<char> path3, ReadOnlySpan<char> path4)
  173. {
  174. throw new NotImplementedException();
  175. }
  176. public string Join(string? path1, string? path2, string? path3, string? path4)
  177. {
  178. throw new NotImplementedException();
  179. }
  180. public ReadOnlySpan<char> TrimEndingDirectorySeparator(ReadOnlySpan<char> path)
  181. {
  182. throw new NotImplementedException();
  183. }
  184. public string TrimEndingDirectorySeparator(string path)
  185. {
  186. throw new NotImplementedException();
  187. }
  188. public bool TryJoin(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2, Span<char> destination, out int charsWritten)
  189. {
  190. throw new NotImplementedException();
  191. }
  192. public bool TryJoin(ReadOnlySpan<char> path1, ReadOnlySpan<char> path2, ReadOnlySpan<char> path3, Span<char> destination, out int charsWritten)
  193. {
  194. throw new NotImplementedException();
  195. }
  196. // Implement other methods as needed
  197. }
  198. }