Removed SortContainers

useCeilingAverage as parameter
This commit is contained in:
2023-08-08 21:09:26 -07:00
parent 77f800d1a4
commit b3da09c757
33 changed files with 147 additions and 381 deletions

View File

@ -23,7 +23,6 @@ public class A_Property
private readonly List<string> _AngleBracketCollection;
private readonly IPropertyConfiguration _PropertyConfiguration;
private readonly IReadOnlyDictionary<string, string[]> _FileGroups;
private readonly JsonSerializerOptions _WriteIndentedJsonSerializerOptions;
public A_Property(int maxDegreeOfParallelism, Configuration propertyConfiguration, string outputExtension, bool reverse, string aResultsFullGroupDirectory)
{
@ -36,7 +35,6 @@ public class A_Property
_AngleBracketCollection = new List<string>();
_PropertyConfiguration = propertyConfiguration;
_MaxDegreeOfParallelism = maxDegreeOfParallelism;
_WriteIndentedJsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true };
_FileGroups = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(propertyConfiguration, aResultsFullGroupDirectory, new string[] { propertyConfiguration.ResultSingleton });
}
@ -150,7 +148,7 @@ public class A_Property
{
id ??= item.ImageFileHolder.Id;
(_, _, result) = Stateless.Property.GetProperty(populateId, metadata, item.ImageFileHolder, result, isIgnoreExtension, item.IsValidImageFormatExtension, id, _ASCIIEncoding);
json = JsonSerializer.Serialize(result, _WriteIndentedJsonSerializerOptions);
json = JsonSerializer.Serialize(result, PropertyGenerationContext.Default.Property);
if (populateId && Shared.Models.Stateless.Methods.IPath.WriteAllText(fileInfo.FullName, json, updateDateWhenMatches: true, compareBeforeWrite: true))
{
File.SetCreationTime(fileInfo.FullName, result.LastWriteTime);
@ -166,7 +164,7 @@ public class A_Property
}
else if (hasWrongYearProperty)
{
json = JsonSerializer.Serialize(result, _WriteIndentedJsonSerializerOptions);
json = JsonSerializer.Serialize(result, PropertyGenerationContext.Default.Property);
if (Shared.Models.Stateless.Methods.IPath.WriteAllText(fileInfo.FullName, json, updateDateWhenMatches: true, compareBeforeWrite: true))
{
File.SetCreationTime(fileInfo.FullName, result.LastWriteTime);

View File

@ -213,9 +213,9 @@ internal class Property
string? model = null;
DateTime?[] dateTimes;
string dateTimeFormat;
string[]? tags = null;
DateTime checkDateTime;
DateTime? dateTime = null;
string[]? keywords = null;
PropertyItem? propertyItem;
string? orientation = null;
DateTime? gpsDateStamp = null;
@ -341,9 +341,9 @@ internal class Property
if (propertyItem?.Value is not null)
{
if (propertyItem.Type == 2)
tags = asciiEncoding.GetString(propertyItem.Value).Trim('\0', ' ').Split(';');
keywords = asciiEncoding.GetString(propertyItem.Value).Trim('\0', ' ').Split(';');
else if (propertyItem.Type == 1)
tags = Encoding.Unicode.GetString(propertyItem.Value).Trim('\0', ' ').Split(';');
keywords = Encoding.Unicode.GetString(propertyItem.Value).Trim('\0', ' ').Split(';');
}
}
message = null;
@ -381,9 +381,9 @@ internal class Property
if (fileHolder.LastWriteTime is null && property?.LastWriteTime is null)
throw new NullReferenceException(nameof(fileHolder.LastWriteTime));
if (fileHolder.CreationTime is not null && fileHolder.LastWriteTime is not null)
result = new(fileHolder.CreationTime.Value, dateTime, dateTimeDigitized, dateTimeFromName, dateTimeOriginalByLogic, fileLength, gpsDateStamp, height, id, fileHolder.LastWriteTime.Value, make, model, orientation, tags, width);
result = new(fileHolder.CreationTime.Value, dateTime, dateTimeDigitized, dateTimeFromName, dateTimeOriginalByLogic, fileLength, gpsDateStamp, height, id, keywords, fileHolder.LastWriteTime.Value, make, model, orientation, width);
else if (property is not null)
result = new(property.CreationTime, dateTime, dateTimeDigitized, dateTimeFromName, dateTimeOriginalByLogic, fileLength, gpsDateStamp, height, id, property.LastWriteTime, make, model, orientation, tags, width);
result = new(property.CreationTime, dateTime, dateTimeDigitized, dateTimeFromName, dateTimeOriginalByLogic, fileLength, gpsDateStamp, height, id, keywords, property.LastWriteTime, make, model, orientation, width);
else
throw new NullReferenceException(nameof(property));
return (message, dateTimesByLogic.ToArray(), result);