pkNX/pkNX.Containers/VFS/Util/IFileSystemEntity.cs
duckdoom4 e74bfbc365 Made VFS fully functional
Still need to start using it, but want to do it a bit slow to test it out. Also should really build some unit tests for this one..
2023-09-08 22:58:26 +02:00

39 lines
946 B
C#

namespace pkNX.Containers.VFS;
public interface IFileSystemEntity
{
IFileSystem FileSystem { get; }
FileSystemPath Path { get; }
string Name { get; }
VirtualDirectory ParentDirectory { get; }
public void CopyTo(IFileSystem destinationFileSystem, FileSystemPath destinationPath)
{
FileSystem.Copy(Path, destinationFileSystem, destinationPath);
}
public void MoveTo(IFileSystem destinationFileSystem, FileSystemPath destinationPath)
{
FileSystem.Move(Path, destinationFileSystem, destinationPath);
}
public void Delete()
{
FileSystem.Delete(Path);
}
public void Exists()
{
FileSystem.Exists(Path);
}
internal static IFileSystemEntity Create(IFileSystem fileSystem, FileSystemPath path)
{
if (path.IsFile)
return VirtualFile.Create(fileSystem, path);
return VirtualDirectory.Create(fileSystem, path);
}
}