mirror of
https://github.com/kwsch/pkNX.git
synced 2026-05-14 15:50:14 -05:00
39 lines
993 B
C#
39 lines
993 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(DeleteMode mode = DeleteMode.TopMostLayer)
|
|
{
|
|
FileSystem.Delete(Path, mode);
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|