Rename
editorconfig
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user