Rename
editorconfig
This commit is contained in:
@ -26,14 +26,14 @@ public class A_Property
|
||||
public A_Property(int maxDegreeOfParallelism, Configuration propertyConfiguration, string outputExtension, bool reverse, string aResultsFullGroupDirectory)
|
||||
{
|
||||
Reverse = reverse;
|
||||
_ExceptionsDirectories = new();
|
||||
_ExceptionsDirectories = [];
|
||||
_OutputExtension = outputExtension;
|
||||
_ASCIIEncoding = new ASCIIEncoding();
|
||||
_Configuration = propertyConfiguration;
|
||||
_AngleBracketCollection = new List<string>();
|
||||
_AngleBracketCollection = [];
|
||||
_PropertyConfiguration = propertyConfiguration;
|
||||
_MaxDegreeOfParallelism = maxDegreeOfParallelism;
|
||||
_FileGroups = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(propertyConfiguration, aResultsFullGroupDirectory, new string[] { propertyConfiguration.ResultSingleton });
|
||||
_FileGroups = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(propertyConfiguration, aResultsFullGroupDirectory, [propertyConfiguration.ResultSingleton]);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -49,7 +49,7 @@ public class A_Property
|
||||
FileInfo fileInfo;
|
||||
string? json = null;
|
||||
bool hasWrongYearProperty = false;
|
||||
string[] changesFrom = Array.Empty<string>();
|
||||
string[] changesFrom = [];
|
||||
string angleBracket = _AngleBracketCollection[0];
|
||||
bool populateId = _Configuration.PopulatePropertyId;
|
||||
if (!item.IsUniqueFileName)
|
||||
@ -76,7 +76,7 @@ public class A_Property
|
||||
result = null;
|
||||
else if (!fileInfo.FullName.EndsWith(".json") && !fileInfo.FullName.EndsWith(".old"))
|
||||
throw new ArgumentException("must be a *.json file");
|
||||
else if (dateTimes.Any() && dateTimes.Max() > fileInfo.LastWriteTime)
|
||||
else if (dateTimes.Count != 0 && dateTimes.Max() > fileInfo.LastWriteTime)
|
||||
result = null;
|
||||
else
|
||||
{
|
||||
@ -181,7 +181,7 @@ public class A_Property
|
||||
private void SavePropertyParallelForWork(Shared.Models.Methods.IMetadata<MetadataExtractor.Directory> metadata, string sourceDirectory, List<Tuple<string, DateTime>> sourceDirectoryFileTuples, List<Tuple<string, DateTime>> sourceDirectoryChanges, Item item)
|
||||
{
|
||||
Shared.Models.Property property;
|
||||
List<string> parseExceptions = new();
|
||||
List<string> parseExceptions = [];
|
||||
bool isIgnoreExtension = item.IsValidImageFormatExtension && _PropertyConfiguration.IgnoreExtensions.Contains(item.ImageFileHolder.ExtensionLowered);
|
||||
string filteredSourceDirectoryFileExtensionLowered = Path.Combine(sourceDirectory, $"{item.ImageFileHolder.NameWithoutExtension}{item.ImageFileHolder.ExtensionLowered}");
|
||||
if (item.IsValidImageFormatExtension && item.ImageFileHolder.FullName.Length == filteredSourceDirectoryFileExtensionLowered.Length && item.ImageFileHolder.FullName != filteredSourceDirectoryFileExtensionLowered)
|
||||
@ -210,7 +210,7 @@ public class A_Property
|
||||
|
||||
private void SavePropertyParallelWork(int maxDegreeOfParallelism, Shared.Models.Methods.IMetadata<MetadataExtractor.Directory> metadata, List<Exception> exceptions, List<Tuple<string, DateTime>> sourceDirectoryChanges, Container container, List<Item> items, string message)
|
||||
{
|
||||
List<Tuple<string, DateTime>> sourceDirectoryFileTuples = new();
|
||||
List<Tuple<string, DateTime>> sourceDirectoryFileTuples = [];
|
||||
ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = maxDegreeOfParallelism };
|
||||
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
|
||||
using ProgressBar progressBar = new(items.Count, message, options);
|
||||
@ -222,7 +222,7 @@ public class A_Property
|
||||
DateTime dateTime = DateTime.Now;
|
||||
List<Tuple<string, DateTime>> collection;
|
||||
SavePropertyParallelForWork(metadata, container.SourceDirectory, sourceDirectoryChanges, sourceDirectoryFileTuples, items[i]);
|
||||
if (i == 0 || sourceDirectoryChanges.Any())
|
||||
if (i == 0 || sourceDirectoryChanges.Count != 0)
|
||||
progressBar.Tick();
|
||||
lock (sourceDirectoryFileTuples)
|
||||
collection = (from l in sourceDirectoryFileTuples where l.Item2 > dateTime select l).ToList();
|
||||
@ -244,18 +244,18 @@ public class A_Property
|
||||
int totalSeconds;
|
||||
Container container;
|
||||
bool anyNullOrNoIsUniqueFileName;
|
||||
List<Exception> exceptions = new();
|
||||
List<Exception> exceptions = [];
|
||||
int containersLength = containers.Length;
|
||||
const string outputResolution = "Original";
|
||||
List<Tuple<string, DateTime>> sourceDirectoryChanges = new();
|
||||
List<Tuple<string, DateTime>> sourceDirectoryChanges = [];
|
||||
string propertyRoot = IResult.GetResultsGroupDirectory(_PropertyConfiguration, nameof(A_Property));
|
||||
for (int i = 0; i < containers.Length; i++)
|
||||
{
|
||||
container = containers[i];
|
||||
if (!container.Items.Any())
|
||||
if (container.Items.Count == 0)
|
||||
continue;
|
||||
sourceDirectoryChanges.Clear();
|
||||
if (!container.Items.Any())
|
||||
if (container.Items.Count == 0)
|
||||
continue;
|
||||
anyNullOrNoIsUniqueFileName = container.Items.Any(l => !l.IsUniqueFileName);
|
||||
SetAngleBracketCollection(container.SourceDirectory, anyNullOrNoIsUniqueFileName);
|
||||
@ -273,7 +273,7 @@ public class A_Property
|
||||
public Shared.Models.Property GetProperty(Shared.Models.Methods.IMetadata<MetadataExtractor.Directory> metadata, Item item, List<Tuple<string, DateTime>> sourceDirectoryFileTuples, List<string> parseExceptions)
|
||||
{
|
||||
Shared.Models.Property result;
|
||||
bool angleBracketCollectionAny = _AngleBracketCollection.Any();
|
||||
bool angleBracketCollectionAny = _AngleBracketCollection.Count != 0;
|
||||
if (!angleBracketCollectionAny)
|
||||
{
|
||||
if (item.ImageFileHolder.DirectoryName is null)
|
||||
|
@ -81,7 +81,7 @@ public class Configuration
|
||||
configuration.PopulatePropertyId.Value,
|
||||
configuration.PredictorModelName,
|
||||
configuration.PropertiesChangedForProperty.Value,
|
||||
configuration.PropertyContentCollectionFiles ?? Array.Empty<string>(),
|
||||
configuration.PropertyContentCollectionFiles ?? [],
|
||||
configuration.ResultAllInOne,
|
||||
configuration.ResultAllInOneSubdirectoryLength.Value,
|
||||
configuration.ResultCollection,
|
||||
@ -89,7 +89,7 @@ public class Configuration
|
||||
configuration.ResultSingleton,
|
||||
Path.GetFullPath(configuration.RootDirectory),
|
||||
configuration.ValidImageFormatExtensions,
|
||||
configuration.VerifyToSeason ?? Array.Empty<string>());
|
||||
configuration.VerifyToSeason ?? []);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -12,12 +12,15 @@ using View_by_Distance.Shared.Models.Stateless;
|
||||
|
||||
namespace View_by_Distance.Property.Models.Stateless;
|
||||
|
||||
internal class Property
|
||||
internal partial class Property
|
||||
{
|
||||
|
||||
[GeneratedRegex(@"\D+")]
|
||||
private static partial Regex Digit();
|
||||
|
||||
private static List<DateTime> GetDateTimes(DateTime dateTimeFromName, DateTime?[] dateTimes)
|
||||
{
|
||||
List<DateTime> results = new() { dateTimeFromName };
|
||||
List<DateTime> results = [dateTimeFromName];
|
||||
foreach (DateTime? dateTime in dateTimes)
|
||||
{
|
||||
if (dateTime is null)
|
||||
@ -29,7 +32,7 @@ internal class Property
|
||||
|
||||
private static List<DateTime> GetDateTimes(DateTime?[] dateTimes, DateTime?[] metadataDateTimes)
|
||||
{
|
||||
List<DateTime> results = new();
|
||||
List<DateTime> results = [];
|
||||
foreach (DateTime? dateTime in metadataDateTimes)
|
||||
{
|
||||
if (dateTime is null || results.Contains(dateTime.Value))
|
||||
@ -47,8 +50,8 @@ internal class Property
|
||||
|
||||
private static List<DateTime> GetDateTimes(FileHolder fileHolder, DateTime?[] dateTimes)
|
||||
{
|
||||
List<DateTime> results = new();
|
||||
string[] digits = Regex.Split(fileHolder.FullName, @"\D+");
|
||||
List<DateTime> results = [];
|
||||
string[] digits = Digit().Split(fileHolder.FullName);
|
||||
foreach (string digit in digits)
|
||||
{
|
||||
if (digit.Length != 4 || digit[..2] is not "19" and not "20" || !int.TryParse(digit, out int year))
|
||||
@ -81,23 +84,23 @@ internal class Property
|
||||
string fullFormat;
|
||||
StringBuilder value = new();
|
||||
const string ticksExample = "##################";
|
||||
string[][] dateFormats = new string[][]
|
||||
{
|
||||
new string[] { string.Empty, "yyyyMMdd_HHmmss", string.Empty },
|
||||
new string[] { string.Empty, "yyyyMMddHHmmssfff", string.Empty },
|
||||
new string[] { string.Empty, "yyyyMMdd_", ticksExample },
|
||||
new string[] { string.Empty, "yyyy-MM-dd_", ticksExample },
|
||||
new string[] { string.Empty, "yyyy-MM-dd.", ticksExample },
|
||||
new string[] { string.Empty, "yyyy-MM-dd.", $"{ticksExample}.{fileHolder.Length}" },
|
||||
new string[] { string.Empty, "yyyy-MM-dd HH.mm.ss", string.Empty },
|
||||
new string[] { string.Empty, "yyyyMMdd_HHmmss", "_LLS" },
|
||||
new string[] { string.Empty, "yyyyMMdd_HHmmss", "_HDR" },
|
||||
new string[] { "WIN_", "yyyyMMdd_HH_mm_ss", "_Pro" },
|
||||
new string[] { "IMG_", "yyyyMMdd_HHmmss", string.Empty },
|
||||
new string[] { "IMG#####-", "yyyyMMdd-HHmm", string.Empty },
|
||||
new string[] { "CameraZOOM-", "yyyyMMddHHmmss", string.Empty },
|
||||
new string[] { "VideoCapture_", "yyyyMMdd-HHmmss ", string.Empty }
|
||||
};
|
||||
string[][] dateFormats =
|
||||
[
|
||||
[string.Empty, "yyyyMMdd_HHmmss", string.Empty],
|
||||
[string.Empty, "yyyyMMddHHmmssfff", string.Empty],
|
||||
[string.Empty, "yyyyMMdd_", ticksExample],
|
||||
[string.Empty, "yyyy-MM-dd_", ticksExample],
|
||||
[string.Empty, "yyyy-MM-dd.", ticksExample],
|
||||
[string.Empty, "yyyy-MM-dd.", $"{ticksExample}.{fileHolder.Length}"],
|
||||
[string.Empty, "yyyy-MM-dd HH.mm.ss", string.Empty],
|
||||
[string.Empty, "yyyyMMdd_HHmmss", "_LLS"],
|
||||
[string.Empty, "yyyyMMdd_HHmmss", "_HDR"],
|
||||
["WIN_", "yyyyMMdd_HH_mm_ss", "_Pro"],
|
||||
["IMG_", "yyyyMMdd_HHmmss", string.Empty],
|
||||
["IMG#####-", "yyyyMMdd-HHmm", string.Empty],
|
||||
["CameraZOOM-", "yyyyMMddHHmmss", string.Empty],
|
||||
["VideoCapture_", "yyyyMMdd-HHmmss ", string.Empty]
|
||||
];
|
||||
foreach (string[] dateFormat in dateFormats)
|
||||
{
|
||||
_ = value.Clear();
|
||||
@ -126,7 +129,7 @@ internal class Property
|
||||
|
||||
private static List<DateTime> GetDateTimes(DateTime?[] metadataDateTimes)
|
||||
{
|
||||
List<DateTime> results = new();
|
||||
List<DateTime> results = [];
|
||||
foreach (DateTime? dateTime in metadataDateTimes)
|
||||
{
|
||||
if (dateTime is null || results.Contains(dateTime.Value))
|
||||
@ -236,7 +239,7 @@ internal class Property
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
dateTimesByLogic = new();
|
||||
dateTimesByLogic = [];
|
||||
message = string.Concat(new StackFrame().GetMethod()?.Name, " <", fileHolder.FullName, ">");
|
||||
}
|
||||
}
|
||||
@ -338,11 +341,11 @@ internal class Property
|
||||
}
|
||||
}
|
||||
message = null;
|
||||
dateTimes = new DateTime?[] { fileHolder.LastWriteTime, fileHolder.CreationTime, dateTime, dateTimeDigitized, dateTimeOriginal, gpsDateStamp };
|
||||
dateTimes = [fileHolder.LastWriteTime, fileHolder.CreationTime, dateTime, dateTimeDigitized, dateTimeOriginal, gpsDateStamp];
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
dateTimes = Array.Empty<DateTime?>();
|
||||
dateTimes = [];
|
||||
message = string.Concat(new StackFrame().GetMethod()?.Name, " <", fileHolder.FullName, ">");
|
||||
}
|
||||
if (metadata is not null && dateTimeOriginal is null)
|
||||
@ -362,7 +365,7 @@ internal class Property
|
||||
(dateTimeOriginalByLogic, dateTimesByLogic) = (dateTimeOriginal, GetDateTimes(dateTimeFromName.Value, dateTimes));
|
||||
}
|
||||
else
|
||||
(message, dateTimeOriginalByLogic, dateTimesByLogic) = (null, null, new());
|
||||
(message, dateTimeOriginalByLogic, dateTimesByLogic) = (null, null, []);
|
||||
if (fileHolder.Length is null)
|
||||
fileLength = 0;
|
||||
else
|
||||
@ -389,7 +392,7 @@ internal class Property
|
||||
DateTime[] dateTimes;
|
||||
Shared.Models.Property? property = null;
|
||||
if (isIgnoreExtension || !isValidImageFormatExtension)
|
||||
(message, dateTimes, property) = (null, Array.Empty<DateTime>(), null);
|
||||
(message, dateTimes, property) = (null, [], null);
|
||||
else
|
||||
(message, dateTimes, property) = GetProperty(populateId, metadata, fileHolder, property, isIgnoreExtension, isValidImageFormatExtension, id, asciiEncoding);
|
||||
return new(property?.DateTimeOriginal, dateTimes, property?.Id, message);
|
||||
|
@ -105,7 +105,7 @@ internal class Result
|
||||
|
||||
internal static List<string> GetDirectoryInfoCollection(Shared.Models.Properties.IPropertyConfiguration propertyConfiguration, string sourceDirectory, string dateGroupDirectory, string contentDescription, string singletonDescription, string collectionDescription, bool converted)
|
||||
{
|
||||
List<string> results = new();
|
||||
List<string> results = [];
|
||||
string sourceDirectorySegment = GetRelativePath(propertyConfiguration, sourceDirectory);
|
||||
string result = string.Concat(Path.Combine(dateGroupDirectory, "<>"), sourceDirectorySegment);
|
||||
if (!string.IsNullOrEmpty(contentDescription))
|
||||
|
Reference in New Issue
Block a user