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:
@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user