| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- using Quadarax.Foundation.Core.IO.FileSystem.Memory;
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.IO;
- using System.IO.Abstractions;
- namespace Quadarax.Foundation.Core.IO.FileSystem.Memory
- {
- public class MemoryFileInfo : IFileInfo
- {
- private readonly MemoryFileSystem _fileSystem;
- private readonly string _path;
- public MemoryFileInfo(MemoryFileSystem fileSystem, string path)
- {
- _fileSystem = fileSystem;
- _path = path;
- }
- public bool Exists => _fileSystem.FileSystemDictionary.ContainsKey(_path);
- public string Name => Path.GetFileName(_path);
- public string FullName => _path;
- public bool IsSymbolicLink
- {
- get
- {
- if (_fileSystem.FileSystemDictionary.TryGetValue(_path, out var entry))
- {
- return entry.IsSymbolicLink;
- }
- return false;
- }
- }
- public string? LinkTarget
- {
- get
- {
- if (_fileSystem.FileSystemDictionary.TryGetValue(_path, out var entry) && entry.IsSymbolicLink)
- {
- return entry.SymbolicLinkTarget;
- }
- return null;
- }
- }
- public IDirectoryInfo? Directory => throw new NotImplementedException();
- public string? DirectoryName => throw new NotImplementedException();
- public bool IsReadOnly { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public long Length => throw new NotImplementedException();
- public IFileSystem FileSystem => throw new NotImplementedException();
- public FileAttributes Attributes { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public DateTime CreationTime { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public DateTime CreationTimeUtc { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public string Extension => throw new NotImplementedException();
- public DateTime LastAccessTime { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public DateTime LastAccessTimeUtc { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public DateTime LastWriteTime { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public DateTime LastWriteTimeUtc { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public UnixFileMode UnixFileMode { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
- public StreamWriter AppendText()
- {
- throw new NotImplementedException();
- }
- public IFileInfo CopyTo(string destFileName)
- {
- throw new NotImplementedException();
- }
- public IFileInfo CopyTo(string destFileName, bool overwrite)
- {
- throw new NotImplementedException();
- }
- public FileSystemStream Create()
- {
- throw new NotImplementedException();
- }
- public void CreateAsSymbolicLink(string pathToTarget)
- {
- throw new NotImplementedException();
- }
- public StreamWriter CreateText()
- {
- throw new NotImplementedException();
- }
- public void Decrypt()
- {
- throw new NotImplementedException();
- }
- public void Delete()
- {
- throw new NotImplementedException();
- }
- public void Encrypt()
- {
- throw new NotImplementedException();
- }
- public void MoveTo(string destFileName)
- {
- throw new NotImplementedException();
- }
- public void MoveTo(string destFileName, bool overwrite)
- {
- throw new NotImplementedException();
- }
- public FileSystemStream Open(FileMode mode)
- {
- throw new NotImplementedException();
- }
- public FileSystemStream Open(FileMode mode, FileAccess access)
- {
- throw new NotImplementedException();
- }
- public FileSystemStream Open(FileMode mode, FileAccess access, FileShare share)
- {
- throw new NotImplementedException();
- }
- public FileSystemStream Open(FileStreamOptions options)
- {
- throw new NotImplementedException();
- }
- public FileSystemStream OpenRead()
- {
- throw new NotImplementedException();
- }
- public StreamReader OpenText()
- {
- throw new NotImplementedException();
- }
- public FileSystemStream OpenWrite()
- {
- throw new NotImplementedException();
- }
- public void Refresh()
- {
- throw new NotImplementedException();
- }
- public IFileInfo Replace(string destinationFileName, string? destinationBackupFileName)
- {
- throw new NotImplementedException();
- }
- public IFileInfo Replace(string destinationFileName, string? destinationBackupFileName, bool ignoreMetadataErrors)
- {
- throw new NotImplementedException();
- }
- public IFileSystemInfo? ResolveLinkTarget(bool returnFinalTarget)
- {
- throw new NotImplementedException();
- }
- // Implement other properties and methods as needed
- }
-
- public class MemoryFileInfoFactory : IFileInfoFactory
- {
- private readonly MemoryFileSystem _fileSystem;
- public MemoryFileInfoFactory(MemoryFileSystem fileSystem)
- {
- _fileSystem = fileSystem;
- }
- public IFileSystem FileSystem => throw new NotImplementedException();
- public IFileInfo New(string fileName)
- {
- return new MemoryFileInfo(_fileSystem, fileName);
- }
- [return: NotNullIfNotNull("fileInfo")]
- public IFileInfo? Wrap(FileInfo? fileInfo)
- {
- throw new NotImplementedException();
- }
- }
- public class MemoryDirectoryInfoFactory : IDirectoryInfoFactory
- {
- private readonly MemoryFileSystem _fileSystem;
- public MemoryDirectoryInfoFactory(MemoryFileSystem fileSystem)
- {
- _fileSystem = fileSystem;
- }
- public IFileSystem FileSystem => throw new NotImplementedException();
- public IDirectoryInfo New(string path)
- {
- return new MemoryDirectoryInfo(_fileSystem, path);
- }
- [return: NotNullIfNotNull("directoryInfo")]
- public IDirectoryInfo? Wrap(DirectoryInfo? directoryInfo)
- {
- throw new NotImplementedException();
- }
- }
- }
|