mirror of
https://github.com/kwsch/pkNX.git
synced 2026-05-20 19:38:15 -05:00
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..
39 lines
946 B
C#
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);
|
|
}
|
|
}
|
|
|