Removed Obsolete A_Property Methods

Changed GetDimensions to handle a stream at the end and one exit

Switched to using Action? over IDlibDotNet for Tick method

Switched to using AsReadOnly over new()

Moved Meta Base to Shared
This commit is contained in:
2025-06-30 16:42:34 -07:00
parent c7ded16e50
commit 30d8a270f9
39 changed files with 903 additions and 962 deletions

View File

@ -21,6 +21,20 @@ public record FilePath(long CreationTicks,
int? SortOrder)
{
public static FilePath? GetNullSafe(Properties.IPropertyConfiguration propertyConfiguration, FileHolder fileHolder, int? index)
{
FilePath? result;
if (fileHolder.CreationTime is null)
result = null;
else if (fileHolder.LastWriteTime is null)
result = null;
else if (fileHolder.Length is null)
result = null;
else
result = Get(propertyConfiguration, fileHolder, index);
return result;
}
public static FilePath Get(Properties.IPropertyConfiguration propertyConfiguration, FileHolder fileHolder, int? index)
{
if (fileHolder.CreationTime is null)
@ -78,28 +92,6 @@ public record FilePath(long CreationTicks,
return result;
}
public static ReadOnlyDictionary<int, List<FilePath>> GetFilesKeyValuePairs(ReadOnlyCollection<ReadOnlyCollection<FilePath>> filePathsCollection)
{
Dictionary<int, List<FilePath>> results = [];
List<FilePath>? collection;
foreach (ReadOnlyCollection<FilePath> filePaths in filePathsCollection)
{
foreach (FilePath filePath in filePaths)
{
if (filePath.Id is null)
continue;
if (!results.TryGetValue(filePath.Id.Value, out collection))
{
results.Add(filePath.Id.Value, []);
if (!results.TryGetValue(filePath.Id.Value, out collection))
throw new Exception();
}
collection.Add(filePath);
}
}
return new(results);
}
public static ReadOnlyDictionary<int, ReadOnlyCollection<FilePath>> GetKeyValuePairs(ReadOnlyCollection<ReadOnlyCollection<FilePath>> filePathsCollection)
{
Dictionary<int, ReadOnlyCollection<FilePath>> results = [];
@ -123,7 +115,7 @@ public record FilePath(long CreationTicks,
}
}
foreach (KeyValuePair<int, List<FilePath>> keyValuePair in keyValuePairs)
results.Add(keyValuePair.Key, new(keyValuePair.Value));
results.Add(keyValuePair.Key, keyValuePair.Value.AsReadOnly());
return results.AsReadOnly();
}