IgnoreExtensions-nef
Config-LoadPhotoPrismLocations TestMethodIntersect
This commit is contained in:
@ -607,7 +607,7 @@ internal abstract class MapLogic
|
||||
return results;
|
||||
}
|
||||
|
||||
private static void ParallelFor(Configuration configuration, string eDistanceContentDirectory, List<LocationContainer<MetadataExtractor.Directory>> collection, long personKey, string file)
|
||||
private static void ParallelFor(Configuration configuration, string eDistanceContentDirectory, List<LocationContainer<MetadataExtractor.Directory>> locationContainers, long personKey, string file)
|
||||
{
|
||||
const string lnk = ".lnk";
|
||||
int? id, wholePercentages;
|
||||
@ -623,29 +623,29 @@ internal abstract class MapLogic
|
||||
directories = new List<MetadataExtractor.Directory>();
|
||||
else
|
||||
directories = MetadataExtractor.ImageMetadataReader.ReadMetadata(file);
|
||||
Rectangle? rectangle = ILocation.GetWholePercentages(configuration.LocationDigits, wholePercentages.Value);
|
||||
lock (collection)
|
||||
collection.Add(new(fromDistanceContent, file, personKey, id.Value, wholePercentages.Value, directories, rectangle, null));
|
||||
RectangleF? rectangle = ILocation.GetPercentagesRectangle(configuration.LocationDigits, wholePercentages.Value);
|
||||
lock (locationContainers)
|
||||
locationContainers.Add(new(fromDistanceContent, file, personKey, id.Value, wholePercentages.Value, directories, rectangle, null));
|
||||
}
|
||||
|
||||
private static void OpenPossibleDuplicates(Configuration configuration, List<(long, int, string, double?)> duplicates)
|
||||
private static void OpenPossibleDuplicates(Configuration configuration, List<(long, int, string, float?)> duplicates)
|
||||
{
|
||||
string personKeyFormatted;
|
||||
foreach ((long personKey, int id, string file, double? percent) in duplicates)
|
||||
foreach ((long personKey, int id, string file, float? percent) in duplicates)
|
||||
{
|
||||
if (percent is null)
|
||||
continue;
|
||||
_ = Process.Start("explorer.exe", string.Concat("\"", Path.GetDirectoryName(file), "\""));
|
||||
personKeyFormatted = IPersonBirthday.GetFormatted(configuration.PersonBirthdayFormat, personKey);
|
||||
}
|
||||
foreach ((long personKey, int id, string file, double? percent) in duplicates)
|
||||
foreach ((long personKey, int id, string file, float? percent) in duplicates)
|
||||
{
|
||||
if (percent is not null && percent.Value == 0)
|
||||
continue;
|
||||
_ = Process.Start("explorer.exe", string.Concat("\"", Path.GetDirectoryName(file), "\""));
|
||||
personKeyFormatted = IPersonBirthday.GetFormatted(configuration.PersonBirthdayFormat, personKey);
|
||||
}
|
||||
foreach ((long personKey, int id, string file, double? percent) in duplicates)
|
||||
foreach ((long personKey, int id, string file, float? percent) in duplicates)
|
||||
{
|
||||
if (percent is not null && percent.Value > 0)
|
||||
continue;
|
||||
@ -654,35 +654,30 @@ internal abstract class MapLogic
|
||||
}
|
||||
}
|
||||
|
||||
private static void LookForPossibleDuplicates(Configuration configuration, List<LocationContainer<MetadataExtractor.Directory>> collection)
|
||||
private static void LookForPossibleDuplicates(Configuration configuration, List<LocationContainer<MetadataExtractor.Directory>> locationContainers)
|
||||
{
|
||||
string key;
|
||||
double? percent;
|
||||
Rectangle? rectangle;
|
||||
float? percent;
|
||||
float itemPercentagesArea;
|
||||
List<string> delete = new();
|
||||
Rectangle intersectRectangle;
|
||||
RectangleF? itemPercentagesRectangle;
|
||||
(string File, int WholePercentages) item;
|
||||
Dictionary<string, (string, int)> distinct = new();
|
||||
List<(long, int, string, double?)> duplicates = new();
|
||||
foreach (LocationContainer<MetadataExtractor.Directory> locationContainer in collection)
|
||||
List<(long, int, string, float?)> duplicates = new();
|
||||
foreach (LocationContainer<MetadataExtractor.Directory> locationContainer in locationContainers)
|
||||
{
|
||||
key = string.Concat(locationContainer.PersonKey, locationContainer.Id);
|
||||
if (distinct.TryGetValue(key, out item))
|
||||
{
|
||||
if (item.WholePercentages == locationContainer.WholePercentages)
|
||||
continue;
|
||||
if (locationContainer.Rectangle is null)
|
||||
itemPercentagesRectangle = ILocation.GetPercentagesRectangle(configuration.LocationDigits, item.WholePercentages);
|
||||
if (itemPercentagesRectangle is null || locationContainer.Rectangle is null)
|
||||
percent = null;
|
||||
else
|
||||
{
|
||||
rectangle = ILocation.GetWholePercentages(configuration.LocationDigits, item.WholePercentages);
|
||||
if (locationContainer.Rectangle is null || rectangle is null)
|
||||
percent = null;
|
||||
else
|
||||
{
|
||||
intersectRectangle = Rectangle.Intersect(locationContainer.Rectangle.Value, rectangle.Value);
|
||||
percent = intersectRectangle.Width * intersectRectangle.Height;
|
||||
}
|
||||
itemPercentagesArea = itemPercentagesRectangle.Value.Width * itemPercentagesRectangle.Value.Height;
|
||||
percent = ILocation.GetIntersectPercent(itemPercentagesRectangle.Value, itemPercentagesArea, locationContainer.Rectangle.Value);
|
||||
}
|
||||
delete.Add(item.File);
|
||||
delete.Add(locationContainer.File);
|
||||
|
Reference in New Issue
Block a user