NullReferenceException
This commit is contained in:
@ -39,7 +39,7 @@ public class B_Metadata
|
||||
{
|
||||
Dictionary<string, List<KeyValuePair<string, string>>> results = new();
|
||||
if (_Log is null)
|
||||
throw new ArgumentNullException(nameof(_Log));
|
||||
throw new NullReferenceException(nameof(_Log));
|
||||
try
|
||||
{
|
||||
object? @object;
|
||||
@ -78,16 +78,16 @@ public class B_Metadata
|
||||
return results;
|
||||
}
|
||||
|
||||
public (int, List<KeyValuePair<string, string>>) GetMetadataCollection(List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, Property.Models.PropertyHolder propertyHolder)
|
||||
public (int, List<KeyValuePair<string, string>>) GetMetadataCollection(List<Tuple<string, DateTime>> subFileTuples, List<string> parseExceptions, Property.Models.Item item)
|
||||
{
|
||||
List<KeyValuePair<string, string>> results = new();
|
||||
if (propertyHolder.ImageFileHolder is null)
|
||||
throw new Exception($"{propertyHolder.ImageFileHolder} is null!");
|
||||
if (item.ImageFileHolder is null)
|
||||
throw new NullReferenceException(nameof(item.ImageFileHolder));
|
||||
Dictionary<string, List<KeyValuePair<string, string>>>? dictionary;
|
||||
string json = string.Empty;
|
||||
string[] changesFrom = Array.Empty<string>();
|
||||
List<DateTime> dateTimes = (from l in subFileTuples where changesFrom.Contains(l.Item1) select l.Item2).ToList();
|
||||
FileInfo fileInfo = new(Path.Combine(AngleBracketCollection[0].Replace("<>", "{}"), string.Concat(propertyHolder.ImageFileNameWithoutExtension, ".json")));
|
||||
FileInfo fileInfo = new(Path.Combine(AngleBracketCollection[0].Replace("<>", "{}"), string.Concat(item.ImageFileHolder.NameWithoutExtension, ".json")));
|
||||
if (!fileInfo.Exists)
|
||||
{
|
||||
if (fileInfo.Directory?.Parent is null)
|
||||
@ -135,7 +135,7 @@ public class B_Metadata
|
||||
}
|
||||
if (dictionary is null || !dictionary.Any())
|
||||
{
|
||||
dictionary = GetMetadataCollection(propertyHolder.ImageFileHolder.FullName);
|
||||
dictionary = GetMetadataCollection(item.ImageFileHolder.FullName);
|
||||
json = JsonSerializer.Serialize(dictionary, _WriteIndentedJsonSerializerOptions);
|
||||
bool updateDateWhenMatches = dateTimes.Any() && fileInfo.Exists && dateTimes.Max() > fileInfo.LastWriteTime;
|
||||
DateTime? dateTime = !updateDateWhenMatches ? null : dateTimes.Max();
|
||||
|
Reference in New Issue
Block a user