This commit is contained in:
2023-09-29 19:47:27 -07:00
parent f540cac462
commit 2cd2c2b434
23 changed files with 94 additions and 89 deletions

View File

@ -20,7 +20,7 @@ public class OffsetDateTimeOriginal
private record Record(FileHolder FileHolder,
bool IsIgnoreExtension,
bool IsValidImageFormatExtension,
int Id,
int? Id,
DateTime DateTime);
private readonly AppSettings _AppSettings;
@ -48,24 +48,26 @@ public class OffsetDateTimeOriginal
log.Information(propertyConfiguration.RootDirectory);
Verify();
List<string> lines = OffsetDateTimeOriginalFilesInDirectories(log);
if (!lines.Any())
if (lines.Any())
File.WriteAllLines($"D:/Tmp/Phares/{DateTime.Now.Ticks}.tsv", lines);
}
private void Verify()
{
if (_AppSettings is null)
{ }
throw new NullReferenceException(nameof(_AppSettings));
if (_IsEnvironment is null)
{ }
throw new NullReferenceException(nameof(_IsEnvironment));
if (_Configuration is null)
{ }
throw new NullReferenceException(nameof(_Configuration));
if (_ConfigurationRoot is null)
{ }
throw new NullReferenceException(nameof(_ConfigurationRoot));
if (_WorkingDirectory is null)
{ }
throw new NullReferenceException(nameof(_WorkingDirectory));
if (_PropertyConfiguration is null)
{ }
throw new NullReferenceException(nameof(_PropertyConfiguration));
if (!_PropertyConfiguration.PopulatePropertyId)
throw new NotSupportedException("Must have!");
}
private List<Record> GetRecords(ASCIIEncoding asciiEncoding, string checkDirectory, DateTime minimumDateTime, DateTime maximumDateTime, long ticks)
@ -95,7 +97,7 @@ public class OffsetDateTimeOriginal
continue;
if (dateTime > maximumDateTime)
continue;
results.Add(new(fileHolder, isIgnoreExtension, isValidImageFormatExtension, id.Value, dateTimeOriginal.Value.AddTicks(ticks)));
results.Add(new(fileHolder, isIgnoreExtension, isValidImageFormatExtension, id, dateTimeOriginal.Value.AddTicks(ticks)));
}
if (files.Length != results.Count)
throw new Exception();