40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using System.Security.AccessControl;
|
|
|
|
namespace DevDrive;
|
|
|
|
/// <summary>
|
|
/// Represents a file or directory node in the virtual file system.
|
|
/// </summary>
|
|
public class FloppyFileNode
|
|
{
|
|
public string Name { get; set; }
|
|
public string FullPath { get; set; }
|
|
public bool IsDirectory { get; set; }
|
|
public FileAttributes Attributes { get; set; }
|
|
public byte[] Data { get; set; }
|
|
public DateTime CreationTime { get; set; }
|
|
public DateTime LastAccessTime { get; set; }
|
|
public DateTime LastWriteTime { get; set; }
|
|
public FileSystemSecurity? Security { get; set; }
|
|
public string? SymlinkTarget { get; set; }
|
|
public bool IsSymlink => !string.IsNullOrEmpty(SymlinkTarget);
|
|
|
|
public FloppyFileNode(string fullPath, bool isDirectory)
|
|
{
|
|
FullPath = fullPath.TrimEnd('\\');
|
|
Name = Path.GetFileName(fullPath);
|
|
if (string.IsNullOrEmpty(Name))
|
|
{
|
|
Name = "\\";
|
|
}
|
|
IsDirectory = isDirectory;
|
|
Attributes = isDirectory ? FileAttributes.Directory : FileAttributes.Normal;
|
|
Data = [];
|
|
CreationTime = DateTime.Now;
|
|
LastAccessTime = DateTime.Now;
|
|
LastWriteTime = DateTime.Now;
|
|
}
|
|
|
|
public long FileSize => IsDirectory ? 0 : Data.Length;
|
|
}
|