Rename
editorconfig
This commit is contained in:
@ -32,11 +32,11 @@ public class D2_FaceParts
|
||||
|
||||
public D2_FaceParts(IPropertyConfiguration propertyConfiguration, ImageCodecInfo imageCodecInfo, EncoderParameters encoderParameters, string filenameExtension, bool checkDFaceAndUpWriteDates, bool overrideForFaceLandmarkImages)
|
||||
{
|
||||
_FileGroups = new();
|
||||
_FileGroups = [];
|
||||
_ImageCodecInfo = imageCodecInfo;
|
||||
_EncoderParameters = encoderParameters;
|
||||
_FileNameExtension = filenameExtension;
|
||||
_AngleBracketCollection = new List<string>();
|
||||
_AngleBracketCollection = [];
|
||||
_PropertyConfiguration = propertyConfiguration;
|
||||
_CheckDFaceAndUpWriteDates = checkDFaceAndUpWriteDates;
|
||||
_OverrideForFaceLandmarkImages = overrideForFaceLandmarkImages;
|
||||
@ -51,7 +51,7 @@ public class D2_FaceParts
|
||||
public void Update(string dResultsFullGroupDirectory)
|
||||
{
|
||||
_FileGroups.Clear();
|
||||
Dictionary<string, string[]> keyValuePairs = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(_PropertyConfiguration, dResultsFullGroupDirectory, new string[] { _PropertyConfiguration.ResultContent });
|
||||
Dictionary<string, string[]> keyValuePairs = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(_PropertyConfiguration, dResultsFullGroupDirectory, [_PropertyConfiguration.ResultContent]);
|
||||
foreach (KeyValuePair<string, string[]> keyValuePair in keyValuePairs)
|
||||
_FileGroups.Add(keyValuePair.Key, keyValuePair.Value);
|
||||
}
|
||||
@ -71,7 +71,7 @@ public class D2_FaceParts
|
||||
public string GetFacePartsDirectory(Configuration configuration, string dResultsFullGroupDirectory, Item item, bool includeNameWithoutExtension)
|
||||
{
|
||||
string result;
|
||||
bool angleBracketCollectionAny = _AngleBracketCollection.Any();
|
||||
bool angleBracketCollectionAny = _AngleBracketCollection.Count != 0;
|
||||
if (!angleBracketCollectionAny)
|
||||
{
|
||||
if (item.ImageFileHolder.DirectoryName is null)
|
||||
@ -128,12 +128,12 @@ public class D2_FaceParts
|
||||
// Rotate the image's corners to see how big
|
||||
// it will be after rotation.
|
||||
PointF[] points =
|
||||
{
|
||||
new (0, 0),
|
||||
new (bitmap.Width, 0),
|
||||
new (bitmap.Width, bitmap.Height),
|
||||
new (0, bitmap.Height),
|
||||
};
|
||||
[
|
||||
new(0, 0),
|
||||
new(bitmap.Width, 0),
|
||||
new(bitmap.Width, bitmap.Height),
|
||||
new(0, bitmap.Height),
|
||||
];
|
||||
rotate_at_origin.TransformPoints(points);
|
||||
float xMinimum, xMaximum, yMinimum, yMaximum;
|
||||
GetPointBounds(points, out xMinimum, out xMaximum, out yMinimum, out yMaximum);
|
||||
@ -199,7 +199,7 @@ public class D2_FaceParts
|
||||
using (Image image = Image.FromFile(resizedFileHolder.FullName))
|
||||
{
|
||||
using Graphics graphic = Graphics.FromImage(image);
|
||||
if (face.FaceParts is null || !face.FaceParts.Any())
|
||||
if (face.FaceParts is null || face.FaceParts.Count == 0)
|
||||
{
|
||||
if (face.Location is null)
|
||||
continue;
|
||||
@ -254,8 +254,8 @@ public class D2_FaceParts
|
||||
long ticks = DateTime.Now.Ticks;
|
||||
string deterministicHashCodeKey;
|
||||
bool updateDateWhenMatches = false;
|
||||
List<(Shared.Models.Face, string, string)> collection = new();
|
||||
string[] changesFrom = new string[] { nameof(A_Property), nameof(B_Metadata), nameof(C_Resize), nameof(D_Face) };
|
||||
List<(Shared.Models.Face, string, string)> collection = [];
|
||||
string[] changesFrom = [nameof(A_Property), nameof(B_Metadata), nameof(C_Resize), nameof(D_Face)];
|
||||
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||
(_, int directoryIndex) = Shared.Models.Stateless.Methods.IPath.GetDirectoryNameAndIndex(_PropertyConfiguration.ResultAllInOneSubdirectoryLength, mappingFromItem.ImageFileHolder.Name);
|
||||
string directory = Path.Combine(_FileGroups[_PropertyConfiguration.ResultContent][directoryIndex], mappingFromItem.ImageFileHolder.NameWithoutExtension);
|
||||
@ -283,11 +283,11 @@ public class D2_FaceParts
|
||||
check = true;
|
||||
else if (saveRotated && !rotatedFileInfo.Exists)
|
||||
check = true;
|
||||
else if (_CheckDFaceAndUpWriteDates && dateTimes.Any() && dateTimes.Max() > fileInfo.LastWriteTime)
|
||||
else if (_CheckDFaceAndUpWriteDates && dateTimes.Count != 0 && dateTimes.Max() > fileInfo.LastWriteTime)
|
||||
check = true;
|
||||
if (check && !updateDateWhenMatches)
|
||||
{
|
||||
updateDateWhenMatches = dateTimes.Any() && fileInfo.Exists && dateTimes.Max() > fileInfo.LastWriteTime;
|
||||
updateDateWhenMatches = dateTimes.Count != 0 && fileInfo.Exists && dateTimes.Max() > fileInfo.LastWriteTime;
|
||||
dateTime = !updateDateWhenMatches ? null : dateTimes.Max();
|
||||
}
|
||||
}
|
||||
@ -308,7 +308,7 @@ public class D2_FaceParts
|
||||
using Graphics graphic = Graphics.FromImage(image);
|
||||
foreach ((Shared.Models.Face face, FileInfo? fileInfo, string _, bool _) in faceCollection)
|
||||
{
|
||||
if (face.FaceEncoding is null || face.Location is null || face.OutputResolution is null || face.FaceParts is null || !face.FaceParts.Any())
|
||||
if (face.FaceEncoding is null || face.Location is null || face.OutputResolution is null || face.FaceParts is null || face.FaceParts.Count == 0)
|
||||
continue;
|
||||
pen = face.Mapping?.MappingFromPerson is null ? Pens.Red : Pens.GreenYellow;
|
||||
try
|
||||
@ -363,7 +363,7 @@ public class D2_FaceParts
|
||||
{
|
||||
bool hasNotMapped = GetNotMapped(facePartsCollectionDirectory, faceCollection);
|
||||
string fileName = Path.Combine(facePartsCollectionDirectory, $"{mappingFromItem.ImageFileHolder.Name}{_FileNameExtension}");
|
||||
bool save = faceCollection.Any(l => l.Face.FaceEncoding is not null && l.Face.Location is not null && l.Face.OutputResolution is not null && l.Face.FaceParts is not null && l.Face.FaceParts.Any());
|
||||
bool save = faceCollection.Any(l => l.Face.FaceEncoding is not null && l.Face.Location is not null && l.Face.OutputResolution is not null && l.Face.FaceParts is not null && l.Face.FaceParts.Count != 0);
|
||||
FileInfo fileInfo = new(fileName);
|
||||
if (save && (!fileInfo.Exists || new TimeSpan(DateTime.Now.Ticks - fileInfo.LastWriteTime.Ticks).TotalDays > 10))
|
||||
{
|
||||
|
Reference in New Issue
Block a user