Tested first run

This commit is contained in:
2022-08-29 19:30:36 -07:00
parent 659e0e39bf
commit 753eeaba2a
26 changed files with 711 additions and 458 deletions

View File

@ -5,26 +5,26 @@ namespace View_by_Distance.Shared.Models;
public class FileHolder : Properties.IFileHolder
{
protected readonly DateTime _CreationTime;
protected readonly DateTime? _CreationTime;
protected readonly string? _DirectoryName;
protected readonly bool _Exists;
protected readonly string _ExtensionLowered;
protected readonly string _FullName;
protected readonly DateTime _LastWriteTime;
protected readonly DateTime? _LastWriteTime;
protected readonly long? _Length;
protected readonly string _Name;
protected readonly string _NameWithoutExtension;
public DateTime CreationTime => _CreationTime;
public DateTime? CreationTime => _CreationTime;
public string? DirectoryName => _DirectoryName;
public bool Exists => _Exists;
public string ExtensionLowered => _ExtensionLowered;
public string FullName => _FullName;
public DateTime LastWriteTime => _LastWriteTime;
public DateTime? LastWriteTime => _LastWriteTime;
public long? Length => _Length;
public string Name => _Name;
public string NameWithoutExtension => _NameWithoutExtension;
public FileHolder(DateTime creationTime, string? directoryName, bool exists, string extensionLowered, string fullName, DateTime lastWriteTime, long? length, string name, string nameWithoutExtension)
public FileHolder(DateTime? creationTime, string? directoryName, bool exists, string extensionLowered, string fullName, DateTime? lastWriteTime, long? length, string name, string nameWithoutExtension)
{
_CreationTime = creationTime;
_DirectoryName = directoryName;
@ -37,36 +37,26 @@ public class FileHolder : Properties.IFileHolder
_NameWithoutExtension = nameWithoutExtension;
}
public FileHolder(string fileName)
public FileHolder(FileInfo fileInfo)
{
FileInfo fileInfo = new(fileName);
_CreationTime = fileInfo.CreationTime;
_CreationTime = fileInfo.CreationTime;
if (fileInfo.Exists)
{
_CreationTime = fileInfo.CreationTime;
_CreationTime = fileInfo.CreationTime;
_LastWriteTime = fileInfo.LastWriteTime;
_Length = fileInfo.Length;
}
_DirectoryName = fileInfo.DirectoryName;
_Exists = fileInfo.Exists;
_ExtensionLowered = fileInfo.Extension.ToLower();
_FullName = fileInfo.FullName;
_LastWriteTime = fileInfo.LastWriteTime;
if (fileInfo.Exists)
_Length = fileInfo.Length;
_Name = fileInfo.Name;
_NameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.FullName);
}
public FileHolder(FileInfo fileInfo)
{
_CreationTime = fileInfo.CreationTime;
_CreationTime = fileInfo.CreationTime;
_DirectoryName = fileInfo.DirectoryName;
_Exists = fileInfo.Exists;
_ExtensionLowered = fileInfo.Extension.ToLower();
_FullName = fileInfo.FullName;
_LastWriteTime = fileInfo.LastWriteTime;
if (fileInfo.Exists)
_Length = fileInfo.Length;
_Name = fileInfo.Name;
_NameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.FullName);
}
public FileHolder(string fileName) :
this(new FileInfo(fileName))
{ }
public override string ToString()
{