.vscode
Compare
Date-Group
Delete-By-Distinct
Delete-By-Relative
Distance
Drag-Drop
Duplicate-Search
Face
FaceParts
FaceRecognitionDotNet
Instance
Map
Metadata
.vscode
Models
Stateless
IMetadata.cs
Metadata.cs
SerilogExtensionMethods.cs
B_Metadata.cs
Metadata.csproj
Not-Copy-Copy
PrepareForOld
Property
Property-Compare
Resize
Shared
Tests
TestsWithFaceRecognitionDotNet
.editorconfig
.gitattributes
.gitignore
.txt
View-by-Distance-MKLink-Console.sln
package.json
50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
namespace View_by_Distance.Metadata.Models.Stateless;
|
|
|
|
internal class Metadata
|
|
{
|
|
|
|
internal static string? GetFaceEncoding(IReadOnlyList<MetadataExtractor.Directory> directories)
|
|
{
|
|
string? result;
|
|
List<string> results = new();
|
|
const string comment = "Comment: ";
|
|
foreach (MetadataExtractor.Directory directory in directories)
|
|
{
|
|
if (directory.Name != "PNG-tEXt")
|
|
continue;
|
|
foreach (MetadataExtractor.Tag tag in directory.Tags)
|
|
{
|
|
if (tag.Name != "Textual Data" || string.IsNullOrEmpty(tag.Description))
|
|
continue;
|
|
if (!tag.Description.StartsWith(comment))
|
|
continue;
|
|
results.Add(tag.Description);
|
|
}
|
|
}
|
|
result = results.Any() ? results[0][comment.Length..] : null;
|
|
return result;
|
|
}
|
|
|
|
internal static string? GetFaceX(IReadOnlyList<MetadataExtractor.Directory> directories)
|
|
{
|
|
string? result;
|
|
List<string> results = new();
|
|
const string artist = "Artist: ";
|
|
foreach (MetadataExtractor.Directory directory in directories)
|
|
{
|
|
if (directory.Name != "PNG-tEXt")
|
|
continue;
|
|
foreach (MetadataExtractor.Tag tag in directory.Tags)
|
|
{
|
|
if (tag.Name != "Textual Data" || string.IsNullOrEmpty(tag.Description))
|
|
continue;
|
|
if (!tag.Description.StartsWith(artist))
|
|
continue;
|
|
results.Add(tag.Description);
|
|
}
|
|
}
|
|
result = results.Any() ? results[0][artist.Length..] : null;
|
|
return result;
|
|
}
|
|
|
|
} |