Move DevDrive project to repo root
This commit is contained in:
39
FloppyFileNode.cs
Normal file
39
FloppyFileNode.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user