This commit is contained in:
2022-08-22 09:10:19 -07:00
parent f72fcee1db
commit bc2174b17a
150 changed files with 4323 additions and 6259 deletions

View File

@ -6,61 +6,52 @@ namespace View_by_Distance.Shared.Models;
public class Property : Properties.IProperty
{
protected bool? _WrongYear;
protected DateTime _CreationTime;
protected DateTime _LastWriteTime;
protected DateTime? _DateTime;
protected DateTime? _DateTimeDigitized;
protected DateTime? _DateTimeOriginal;
protected long _FileSize;
protected DateTime? _GPSDateStamp;
protected int? _Height;
protected int? _Id;
protected int[] _Indices;
protected int? _Height;
protected int? _Width;
protected DateTime _LastWriteTime;
protected string _Make;
protected int? _MetadataGroups;
protected string _Model;
protected string _Orientation;
protected string _UniqueImageId;
public bool? WrongYear => _WrongYear;
protected int? _Width;
public DateTime CreationTime => _CreationTime;
public DateTime LastWriteTime => _LastWriteTime;
public DateTime? DateTime => _DateTime;
public DateTime? DateTimeDigitized => _DateTimeDigitized;
public DateTime? DateTimeOriginal => _DateTimeOriginal;
public long FileSize => _FileSize;
public DateTime? GPSDateStamp => _GPSDateStamp;
public int? Height => _Height;
public int? Id => _Id;
public int[] Indices => _Indices;
public int? Height => _Height;
public int? Width => _Width;
public DateTime LastWriteTime => _LastWriteTime;
public string Make => _Make;
public int? MetadataGroups => _MetadataGroups;
public string Model => _Model;
public string Orientation => _Orientation;
public string UniqueImageId => _UniqueImageId;
public int? Width => _Width;
[JsonConstructor]
public Property(bool? wrongYear, DateTime creationTime, DateTime lastWriteTime, DateTime? dateTime, DateTime? dateTimeDigitized, DateTime? dateTimeOriginal, DateTime? gpsDateStamp, long fileSize, int? id, int[] indices, int? height, int? width, string make, int? metadataGroups, string model, string orientation, string uniqueImageId)
public Property(DateTime creationTime, DateTime? dateTime, DateTime? dateTimeDigitized, DateTime? dateTimeOriginal, long fileSize, DateTime? gpsDateStamp, int? height, int? id, int[] indices, DateTime lastWriteTime, string make, string model, string orientation, int? width)
{
_CreationTime = creationTime;
_DateTime = dateTime;
_DateTimeDigitized = dateTimeDigitized;
_DateTimeOriginal = dateTimeOriginal;
_GPSDateStamp = gpsDateStamp;
_FileSize = fileSize;
_GPSDateStamp = gpsDateStamp;
_Height = height;
_Id = id;
_Indices = indices;
_LastWriteTime = lastWriteTime;
_Make = make;
_MetadataGroups = metadataGroups;
_Model = model;
_Orientation = orientation;
_Width = width;
_WrongYear = wrongYear;
_UniqueImageId = uniqueImageId;
}
public override string ToString()
@ -69,4 +60,38 @@ public class Property : Properties.IProperty
return result;
} // ...
public List<DateTime> GetDateTimes() => Stateless.Methods.Property.GetDateTimes(_CreationTime, _LastWriteTime, _DateTime, _DateTimeDigitized, _DateTimeOriginal, _GPSDateStamp);
public (bool?, string[]) IsWrongYear(string filteredSourceDirectoryFile, DateTime? minimumDateTime)
{
string[] results = Array.Empty<string>();
bool? result = null;
string year;
string directoryName;
string[] directorySegments;
string? check = Path.GetFullPath(filteredSourceDirectoryFile);
string? pathRoot = Path.GetPathRoot(filteredSourceDirectoryFile);
if (string.IsNullOrEmpty(pathRoot))
throw new Exception();
if (minimumDateTime.HasValue)
year = minimumDateTime.Value.ToString("yyyy");
else
{
List<DateTime> dateTimes = GetDateTimes();
year = dateTimes.Min().ToString("yyyy");
}
for (int i = 0; i < int.MaxValue; i++)
{
check = Path.GetDirectoryName(check);
if (string.IsNullOrEmpty(check) || check == pathRoot)
break;
directoryName = Path.GetFileName(check);
directorySegments = directoryName.Split(' ');
(result, results) = Stateless.Methods.Property.IsWrongYear(directorySegments, year);
if (result.HasValue)
break;
}
return new(result, results);
}
}