|
|
|
@ -299,8 +299,8 @@ public class DlibDotNet
|
|
|
|
|
|
|
|
|
|
private void FullParallelForWork(PropertyLogic propertyLogic, object @lock, string outputResolution, List<Tuple<string, DateTime>> sourceDirectoryChanges, List<FileInfo?> propertyFileInfoCollection, List<A_Property> propertyCollection, List<List<KeyValuePair<string, string>>> metadataCollections, List<Dictionary<string, int[]>> resizeKeyValuePairs, List<List<D_Face>> imageFaceCollections, string sourceDirectory, int index, PropertyHolder propertyHolder)
|
|
|
|
|
{
|
|
|
|
|
if (propertyHolder.FileInfo is null)
|
|
|
|
|
throw new Exception($"{nameof(propertyHolder.FileInfo)} is null!");
|
|
|
|
|
if (propertyHolder.ImageFileInfo is null)
|
|
|
|
|
throw new Exception($"{nameof(propertyHolder.ImageFileInfo)} is null!");
|
|
|
|
|
if (_AppSettings.MaxDegreeOfParallelism is null)
|
|
|
|
|
throw new Exception($"{nameof(_AppSettings.MaxDegreeOfParallelism)} is null!");
|
|
|
|
|
if (_Configuration.SaveResizedSubfiles is null)
|
|
|
|
@ -320,34 +320,34 @@ public class DlibDotNet
|
|
|
|
|
List<KeyValuePair<string, string>> metadataCollection;
|
|
|
|
|
if (propertyHolder.Property is null)
|
|
|
|
|
{
|
|
|
|
|
sourceDirectoryChanges.Add(new Tuple<string, DateTime>(nameof(A_Property), propertyHolder.FileInfo.LastWriteTime));
|
|
|
|
|
property = propertyLogic.GetProperty(propertyLogic.AngleBracketCollection[0], sourceDirectory, propertyHolder.FileInfo.FullName, subFileTuples, parseExceptions, propertyHolder.FileInfo);
|
|
|
|
|
sourceDirectoryChanges.Add(new Tuple<string, DateTime>(nameof(A_Property), propertyHolder.ImageFileInfo.LastWriteTime));
|
|
|
|
|
property = propertyLogic.GetProperty(propertyLogic.AngleBracketCollection[0], propertyHolder, subFileTuples, parseExceptions);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
property = propertyHolder.Property;
|
|
|
|
|
if (propertyHolder.Changed.HasValue && propertyHolder.Changed.Value)
|
|
|
|
|
sourceDirectoryChanges.Add(new Tuple<string, DateTime>(nameof(A_Property), propertyHolder.FileInfo.LastWriteTime));
|
|
|
|
|
sourceDirectoryChanges.Add(new Tuple<string, DateTime>(nameof(A_Property), propertyHolder.ImageFileInfo.LastWriteTime));
|
|
|
|
|
}
|
|
|
|
|
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(propertyHolder.FileInfo.FullName);
|
|
|
|
|
(int metadataGroups, metadataCollection) = _Metadata.GetMetadataCollection(subFileTuples, parseExceptions, propertyHolder.FileInfo.FullName, propertyHolder.RelativePath, fileNameWithoutExtension);
|
|
|
|
|
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(propertyHolder.ImageFileInfo.FullName);
|
|
|
|
|
(int metadataGroups, metadataCollection) = _Metadata.GetMetadataCollection(subFileTuples, parseExceptions, propertyHolder.ImageFileInfo.FullName, propertyHolder.RelativePath, fileNameWithoutExtension);
|
|
|
|
|
if (_AppSettings.MaxDegreeOfParallelism.Value < 2)
|
|
|
|
|
ticks = LogDelta(ticks, nameof(B_Metadata.GetMetadataCollection));
|
|
|
|
|
FileInfo resizedFileInfo = new(Path.Combine(_Resize.AngleBracketCollection[0].Replace("<>", "()"), Path.GetFileName(propertyHolder.FileInfo.FullName)));
|
|
|
|
|
FileInfo resizedFileInfo = new(Path.Combine(_Resize.AngleBracketCollection[0].Replace("<>", "()"), Path.GetFileName(propertyHolder.ImageFileInfo.FullName)));
|
|
|
|
|
propertyHolder.SetResizedFileInfo(resizedFileInfo);
|
|
|
|
|
imageResizeKeyValuePairs = _Resize.GetResizeKeyValuePairs(subFileTuples, parseExceptions, original, metadataCollection, property, propertyHolder.FileInfo.FullName, propertyHolder.RelativePath, fileNameWithoutExtension);
|
|
|
|
|
imageResizeKeyValuePairs = _Resize.GetResizeKeyValuePairs(subFileTuples, parseExceptions, original, metadataCollection, property, propertyHolder.ImageFileInfo.FullName, propertyHolder.RelativePath, fileNameWithoutExtension);
|
|
|
|
|
if (_AppSettings.MaxDegreeOfParallelism.Value < 2)
|
|
|
|
|
ticks = LogDelta(ticks, nameof(C_Resize.GetResizeKeyValuePairs));
|
|
|
|
|
if (_Configuration.SaveResizedSubfiles.Value)
|
|
|
|
|
{
|
|
|
|
|
_Resize.SaveResizedSubfile(outputResolution, subFileTuples, propertyHolder.FileInfo.FullName, original, property, imageResizeKeyValuePairs, resizedFileInfo);
|
|
|
|
|
_Resize.SaveResizedSubfile(outputResolution, subFileTuples, propertyHolder.ImageFileInfo.FullName, original, property, imageResizeKeyValuePairs, resizedFileInfo);
|
|
|
|
|
if (_AppSettings.MaxDegreeOfParallelism.Value < 2)
|
|
|
|
|
ticks = LogDelta(ticks, nameof(C_Resize.SaveResizedSubfile));
|
|
|
|
|
resizedFileInfo.Refresh();
|
|
|
|
|
}
|
|
|
|
|
else if (outputResolution == _Configuration.OutputResolutions[0] && false)
|
|
|
|
|
{
|
|
|
|
|
byte[] bytes = _Resize.GetResizedBytes(outputResolution, subFileTuples, propertyHolder.FileInfo.FullName, property, imageResizeKeyValuePairs);
|
|
|
|
|
byte[] bytes = _Resize.GetResizedBytes(outputResolution, subFileTuples, propertyHolder.ImageFileInfo.FullName, property, imageResizeKeyValuePairs);
|
|
|
|
|
if (_AppSettings.MaxDegreeOfParallelism.Value < 2)
|
|
|
|
|
ticks = LogDelta(ticks, nameof(C_Resize.GetResizedBytes));
|
|
|
|
|
string path = Path.Combine(resizedFileInfo.DirectoryName, Path.GetFileNameWithoutExtension(resizedFileInfo.Name));
|
|
|
|
@ -380,7 +380,7 @@ public class DlibDotNet
|
|
|
|
|
imageFaceCollections[index] = faceCollection;
|
|
|
|
|
metadataCollections[index] = metadataCollection;
|
|
|
|
|
resizeKeyValuePairs[index] = imageResizeKeyValuePairs;
|
|
|
|
|
propertyFileInfoCollection[index] = propertyHolder.FileInfo;
|
|
|
|
|
propertyFileInfoCollection[index] = propertyHolder.ImageFileInfo;
|
|
|
|
|
sourceDirectoryChanges.AddRange(from l in subFileTuples where l.Item2 > dateTime select l);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -495,9 +495,9 @@ public class DlibDotNet
|
|
|
|
|
propertyHolder = filteredPropertyHolderCollection[i];
|
|
|
|
|
if (propertyHolder.Property is null)
|
|
|
|
|
continue;
|
|
|
|
|
if (propertyHolder.FileInfo is null)
|
|
|
|
|
if (propertyHolder.ImageFileInfo is null)
|
|
|
|
|
continue;
|
|
|
|
|
key = Property.Models.Stateless.IPath.GetRelativePath(propertyHolder.FileInfo.FullName, sourceDirectoryLength);
|
|
|
|
|
key = Property.Models.Stateless.IPath.GetRelativePath(propertyHolder.ImageFileInfo.FullName, sourceDirectoryLength);
|
|
|
|
|
_FileKeyValuePairs.Add(new KeyValuePair<string, string>(sourceDirectory, key));
|
|
|
|
|
_FilePropertiesKeyValuePairs[sourceDirectory].Add(new Tuple<string, A_Property>(key, propertyCollection[i]));
|
|
|
|
|
faceCollectionsKeyValuePairs.Add(new KeyValuePair<string, List<D_Face>>(key, faceCollections[i]));
|
|
|
|
@ -587,7 +587,7 @@ public class DlibDotNet
|
|
|
|
|
continue;
|
|
|
|
|
if (!_ArgZeroIsConfigurationRootDirectory && !propertyHolderCollection[0].SourceDirectory.StartsWith(argZero))
|
|
|
|
|
continue;
|
|
|
|
|
filteredPropertyHolderCollection = (from l in propertyHolderCollection where l.FileInfo is not null && l.Property is not null && l.ValidImageFormatExtension.HasValue && l.ValidImageFormatExtension.Value && !_Configuration.IgnoreExtensions.Contains(l.FileInfo.Extension) select l).ToArray();
|
|
|
|
|
filteredPropertyHolderCollection = (from l in propertyHolderCollection where l.ImageFileInfo is not null && l.Property is not null && l.ValidImageFormatExtension.HasValue && l.ValidImageFormatExtension.Value && !_Configuration.IgnoreExtensions.Contains(l.ImageFileInfo.Extension) select l).ToArray();
|
|
|
|
|
if (!filteredPropertyHolderCollection.Any())
|
|
|
|
|
continue;
|
|
|
|
|
faceCollections.Clear();
|
|
|
|
|