Bug fix from
Single Level AppSettings
This commit is contained in:
parent
17532d2698
commit
0fa899f65d
4
.gitignore
vendored
4
.gitignore
vendored
@ -470,5 +470,7 @@ globalStorage/
|
||||
Shared/.kanbn
|
||||
|
||||
.vscode/Har-Files
|
||||
Rename/.vscode/.UserSecrets/secrets.json
|
||||
Compare/.vscode/.UserSecrets/secrets.json
|
||||
Rename/.vscode/.UserSecrets/secrets.json
|
||||
Rename/.vscode/.UserSecretsOld/rename.json
|
||||
Rename/.vscode/.UserSecretsOld/secrets.json
|
||||
|
5
.vscode/mklink.md
vendored
5
.vscode/mklink.md
vendored
@ -23,6 +23,11 @@ mklink /J "L:\Git\AA\Rename\.vscode\.UserSecrets" "C:\Users\mikep\AppData\Roamin
|
||||
mklink /J "L:\Git\AA\Compare\.vscode\.UserSecrets" "C:\Users\mikep\AppData\Roaming\Microsoft\UserSecrets\770b6ae3-266e-4d5f-970a-173709b064de"
|
||||
```
|
||||
|
||||
```bash 1736011475498 = 638716082754980000 = Sat Jan 04 2025 10:24:35 GMT-0700 (Mountain Standard Time)
|
||||
mklink /J "L:\Git\AA\Rename\.vscode\.UserSecrets" "C:\Users\mikep\AppData\Roaming\Microsoft\UserSecrets\843db3e1-e18f-4cba-8b00-967529a32635"
|
||||
mklink /J "L:\Git\AA\Compare\.vscode\.UserSecrets" "C:\Users\mikep\AppData\Roaming\Microsoft\UserSecrets\770b6ae3-266e-4d5f-970a-173709b064de"
|
||||
```
|
||||
|
||||
```json 1735493575037 = 638710903750370000 = Sun Dec 29 2024 10:32:54 GMT-0700 (Mountain Standard Time)
|
||||
{ "label": "Build-Compare", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/Compare/AA.Compare.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" },
|
||||
{ "label": "Build-Distance", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/Distance/AA.Distance.csproj", "/property:GenerateFullPaths=true", "/consoleloggerparameters:NoSummary" ], "problemMatcher": "$msCompile" },
|
||||
|
@ -56,8 +56,8 @@ internal static class MappedLogicA
|
||||
PersonContainer? personContainer;
|
||||
string? personDisplayDirectoryName;
|
||||
results.AddRange(GetDisplayDirectoryAllFiles(peopleSettings, compareSettings, readOnlyCollections));
|
||||
ReadOnlyDictionary<long, PersonContainer> keyValuePairs = PersonContainer.Extract(readOnlyCollections.PersonContainers);
|
||||
PersonKeyFormattedAndKeyTicksAndDisplayDirectoryName personKeyFormattedAndKeyTicksAndDisplayDirectoryName;
|
||||
ReadOnlyDictionary<long, PersonContainer> keyValuePairs = PersonContainer.Extract(readOnlyCollections.PersonContainers);
|
||||
foreach (MappedLogicB.Record record in records)
|
||||
{
|
||||
personBirthday = IPersonBirthday.GetPersonBirthday(peopleSettings.PersonBirthdayFormat, record.PersonKeyFormatted);
|
||||
@ -65,8 +65,8 @@ internal static class MappedLogicA
|
||||
continue;
|
||||
if (distinct.Contains(record.MappedFaceFilePath.Name))
|
||||
continue;
|
||||
distinct.Add(record.MappedFaceFilePath.Name);
|
||||
personKey = personBirthday.Value.Ticks;
|
||||
distinct.Add(record.MappedFaceFilePath.Name);
|
||||
if (!keyValuePairs.TryGetValue(personKey, out personContainer))
|
||||
personDisplayDirectoryName = record.PersonDisplayDirectoryName;
|
||||
else
|
||||
|
@ -2,7 +2,6 @@ using MetadataExtractor;
|
||||
using MetadataExtractor.Formats.Exif;
|
||||
using MetadataExtractor.Formats.Exif.Makernotes;
|
||||
using System.Globalization;
|
||||
using View_by_Distance.Metadata.Models.Stateless;
|
||||
|
||||
namespace View_by_Distance.Metadata.Models.Stateless;
|
||||
|
||||
|
@ -39,6 +39,7 @@ internal static class Get
|
||||
FileInfo fileInfo;
|
||||
ExifDirectory exifDirectory;
|
||||
MetadataGroup metadataGroup;
|
||||
DeterministicHashCode deterministicHashCode;
|
||||
FileHolder fileHolder = FileHolder.Get(file);
|
||||
bool fastForwardMovingPictureExpertsGroupUsed;
|
||||
FilePath? fastForwardMovingPictureExpertsGroupFilePath;
|
||||
@ -50,12 +51,17 @@ internal static class Get
|
||||
if (!renameSettings.SkipIdFiles || filePath.Id is null || (!filePath.IsIntelligentIdFormat && filePath.SortOrder is not null))
|
||||
{
|
||||
if (filePath.Id is not null)
|
||||
{
|
||||
fastForwardMovingPictureExpertsGroupFiles = null;
|
||||
deterministicHashCode = new(null, filePath.Id, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
fastForwardMovingPictureExpertsGroupFiles = rename.ConvertAndGetFastForwardMovingPictureExpertsGroupFiles(renameSettings, filePath);
|
||||
fastForwardMovingPictureExpertsGroupFilePath = fastForwardMovingPictureExpertsGroupFiles.Count == 0 ? null : FilePath.Get(resultSettings, metadataSettings, FileHolder.Get(fastForwardMovingPictureExpertsGroupFiles[0]), index: null);
|
||||
deterministicHashCode = fastForwardMovingPictureExpertsGroupFilePath is null ? rename.GetDeterministicHashCode(filePath) : rename.GetDeterministicHashCode(fastForwardMovingPictureExpertsGroupFilePath);
|
||||
}
|
||||
filePath = FilePath.Get(filePath, deterministicHashCode);
|
||||
fastForwardMovingPictureExpertsGroupUsed = fastForwardMovingPictureExpertsGroupFiles is not null && fastForwardMovingPictureExpertsGroupFiles.Count > 0;
|
||||
(fileInfo, exifDirectory) = metadata.GetMetadataCollection(resultSettings, metadataSettings, filePath);
|
||||
metadataGroup = new(fastForwardMovingPictureExpertsGroupUsed, filePath, fileInfo, exifDirectory, new([]));
|
||||
|
@ -1,11 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<UserSecretsId>fa0fa59b-afe4-4960-9afc-18fcbc7fb41b</UserSecretsId>
|
||||
<UserSecretsIdOld>fa0fa59b-afe4-4960-9afc-18fcbc7fb41b</UserSecretsIdOld>
|
||||
<UserSecretsId>843db3e1-e18f-4cba-8b00-967529a32635</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PackageId>Phares.View.by.Distance.Rename</PackageId>
|
||||
|
@ -175,6 +175,7 @@ public partial class Rename : IRename, IDisposable
|
||||
string directoryName;
|
||||
ExifDirectory exifDirectory;
|
||||
List<FileHolder> sidecarFiles;
|
||||
DeterministicHashCode deterministicHashCode;
|
||||
bool fastForwardMovingPictureExpertsGroupUsed;
|
||||
FilePath? fastForwardMovingPictureExpertsGroupFilePath;
|
||||
ReadOnlyCollection<string>? fastForwardMovingPictureExpertsGroupFiles;
|
||||
@ -203,6 +204,7 @@ public partial class Rename : IRename, IDisposable
|
||||
if (!appSettings.RenameSettings.ForceNewId && filePath.Id is not null)
|
||||
{
|
||||
fastForwardMovingPictureExpertsGroupFiles = null;
|
||||
deterministicHashCode = new(null, filePath.Id, null);
|
||||
directoryName = Path.GetFileName(filePath.DirectoryFullPath);
|
||||
if (appSettings.RenameSettings.InPlaceWithOriginalName || (appSettings.RenameSettings.InPlace && directoryName.EndsWith(filePath.Id.Value.ToString())))
|
||||
continue;
|
||||
@ -211,8 +213,10 @@ public partial class Rename : IRename, IDisposable
|
||||
{
|
||||
fastForwardMovingPictureExpertsGroupFiles = rename.ConvertAndGetFastForwardMovingPictureExpertsGroupFiles(appSettings.RenameSettings, filePath);
|
||||
fastForwardMovingPictureExpertsGroupFilePath = fastForwardMovingPictureExpertsGroupFiles.Count == 0 ? null : FilePath.Get(appSettings.ResultSettings, appSettings.MetadataSettings, FileHolder.Get(fastForwardMovingPictureExpertsGroupFiles[0]), index);
|
||||
deterministicHashCode = fastForwardMovingPictureExpertsGroupFilePath is null ? rename.GetDeterministicHashCode(filePath) : rename.GetDeterministicHashCode(fastForwardMovingPictureExpertsGroupFilePath);
|
||||
}
|
||||
sidecarFiles = [];
|
||||
filePath = FilePath.Get(filePath, deterministicHashCode);
|
||||
for (int i = 0; i < keyValuePair.Value.Count; i++)
|
||||
{
|
||||
if (keyValuePair.Value[i].ExtensionLowered == fileHolder.ExtensionLowered)
|
||||
@ -331,10 +335,10 @@ public partial class Rename : IRename, IDisposable
|
||||
{
|
||||
string tfw = GetTFW(record, isWrongYear);
|
||||
string? maker = IMetadata.GetMaker(record.ExifDirectory);
|
||||
string[] segments = checkDirectoryName.Split(years, StringSplitOptions.None);
|
||||
string? splat = checkDirectoryName[^3..][1] == '!' ? checkDirectoryName[^3..] : null;
|
||||
(int seasonValue, string seasonName) = IDate.GetSeason(record.DateTime.DayOfYear);
|
||||
string rootDirectory = appSettings.ResultSettings.RootDirectory;
|
||||
string[] segments = checkDirectoryName.Split(years, StringSplitOptions.None);
|
||||
(int seasonValue, string seasonName) = IDate.GetSeason(record.DateTime.DayOfYear);
|
||||
string? splat = checkDirectoryName.Length > 3 && checkDirectoryName[^3..][1] == '!' ? checkDirectoryName[^3..] : null;
|
||||
string contains = record.ExifDirectory.FilePath.Id is null || ids.Contains(record.ExifDirectory.FilePath.Id.Value) ? "_ Exists _" : "_ New-Destination _";
|
||||
string makerSplit = string.IsNullOrEmpty(maker) ? string.IsNullOrEmpty(appSettings.RenameSettings.DefaultMaker) ? string.Empty : appSettings.RenameSettings.DefaultMaker : $" {maker.Split(' ')[0]}";
|
||||
string directoryName = GetDirectoryName(year, tfw, segments[0], splat, seasonValue, seasonName, makerSplit);
|
||||
|
@ -38,7 +38,7 @@ public record FilePath(long CreationTicks,
|
||||
throw new NullReferenceException(nameof(fileHolder.Length));
|
||||
FilePath result;
|
||||
int? id;
|
||||
int? sortOder;
|
||||
int? sortOrder;
|
||||
string fileNameFirstSegment = fileHolder.Name.Split('.')[0];
|
||||
int sortOrderOnlyLengthIndex = metadataSettings.Offset.ToString().Length;
|
||||
string fileDirectoryFullPath = fileHolder.DirectoryFullPath ?? throw new NullReferenceException();
|
||||
@ -48,15 +48,15 @@ public record FilePath(long CreationTicks,
|
||||
bool? hasIgnoreKeyword = !isIntelligentIdFormat && !isPaddedIntelligentIdFormat ? null : fileNameFirstSegment[^1] is '2' or '8';
|
||||
bool? hasDateTimeOriginal = !isIntelligentIdFormat && !isPaddedIntelligentIdFormat ? null : fileNameFirstSegment[^1] is '1' or '9';
|
||||
if (!fileNameFirstSegmentIsIdFormat && !isIntelligentIdFormat && !isPaddedIntelligentIdFormat)
|
||||
(id, sortOder) = (null, null);
|
||||
(id, sortOrder) = (null, null);
|
||||
else if (isIntelligentIdFormat)
|
||||
(id, sortOder) = (IId.GetId(resultSettings, metadataSettings, fileNameFirstSegment), null);
|
||||
(id, sortOrder) = (IId.GetId(resultSettings, metadataSettings, fileNameFirstSegment), null);
|
||||
else if (isPaddedIntelligentIdFormat)
|
||||
{
|
||||
if (!int.TryParse(fileNameFirstSegment[..sortOrderOnlyLengthIndex], out int absoluteValueOfSortOrder))
|
||||
(id, sortOder) = (null, null);
|
||||
(id, sortOrder) = (null, null);
|
||||
else
|
||||
(id, sortOder) = (IId.GetId(resultSettings, metadataSettings, fileNameFirstSegment[sortOrderOnlyLengthIndex..]), absoluteValueOfSortOrder);
|
||||
(id, sortOrder) = (IId.GetId(resultSettings, metadataSettings, fileNameFirstSegment[sortOrderOnlyLengthIndex..]), absoluteValueOfSortOrder);
|
||||
}
|
||||
else if (fileNameFirstSegmentIsIdFormat)
|
||||
{
|
||||
@ -64,7 +64,7 @@ public record FilePath(long CreationTicks,
|
||||
throw new NullReferenceException(nameof(index));
|
||||
if (!int.TryParse(fileNameFirstSegment, out int valueOfFileNameFirstSegment))
|
||||
throw new NotSupportedException();
|
||||
(id, sortOder) = (valueOfFileNameFirstSegment, metadataSettings.Offset + index);
|
||||
(id, sortOrder) = (valueOfFileNameFirstSegment, metadataSettings.Offset + index);
|
||||
}
|
||||
else
|
||||
throw new NotSupportedException();
|
||||
@ -81,10 +81,26 @@ public record FilePath(long CreationTicks,
|
||||
fileHolder.Length.Value,
|
||||
fileHolder.Name,
|
||||
fileHolder.NameWithoutExtension,
|
||||
sortOder);
|
||||
sortOrder);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static FilePath Get(FilePath filePath, DeterministicHashCode deterministicHashCode) =>
|
||||
new(filePath.CreationTicks,
|
||||
filePath.DirectoryFullPath,
|
||||
filePath.ExtensionLowered,
|
||||
filePath.FileNameFirstSegment,
|
||||
filePath.FullName,
|
||||
deterministicHashCode.Id ?? filePath.Id,
|
||||
filePath.HasIgnoreKeyword,
|
||||
filePath.HasDateTimeOriginal,
|
||||
filePath.IsIntelligentIdFormat,
|
||||
filePath.LastWriteTicks,
|
||||
filePath.Length,
|
||||
filePath.Name,
|
||||
filePath.NameWithoutExtension,
|
||||
filePath.SortOrder);
|
||||
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user