Re-write
This commit is contained in:
@ -6,52 +6,40 @@ namespace View_by_Distance.Property.Models;
|
||||
public class Configuration
|
||||
{
|
||||
|
||||
protected readonly string _DateGroup;
|
||||
protected readonly string _FileNameDirectorySeparator;
|
||||
protected readonly bool? _ForcePropertyLastWriteTimeToCreationTime;
|
||||
protected readonly string[] _IgnoreExtensions;
|
||||
protected readonly int? _MaxImagesInDirectoryForTopLevelFirstPass;
|
||||
protected readonly string _Pattern;
|
||||
protected readonly bool? _PopulatePropertyId;
|
||||
protected readonly bool? _PropertiesChangedForProperty;
|
||||
protected readonly string[] _PropertyContentCollectionFiles;
|
||||
protected string _RootDirectory;
|
||||
protected readonly string[] _ValidImageFormatExtensions;
|
||||
protected readonly string[] _ValidMetadataExtensions;
|
||||
protected readonly string[] _VerifyToSeason;
|
||||
protected readonly bool? _WriteBitmapDataBytes;
|
||||
public string DateGroup => _DateGroup;
|
||||
public string FileNameDirectorySeparator => _FileNameDirectorySeparator;
|
||||
public bool? ForcePropertyLastWriteTimeToCreationTime => _ForcePropertyLastWriteTimeToCreationTime;
|
||||
public string[] IgnoreExtensions => _IgnoreExtensions;
|
||||
public int? MaxImagesInDirectoryForTopLevelFirstPass => _MaxImagesInDirectoryForTopLevelFirstPass;
|
||||
public string Pattern => _Pattern;
|
||||
public bool? PopulatePropertyId => _PopulatePropertyId;
|
||||
public bool? PropertiesChangedForProperty => _PropertiesChangedForProperty;
|
||||
public string[] PropertyContentCollectionFiles => _PropertyContentCollectionFiles;
|
||||
public string RootDirectory => _RootDirectory;
|
||||
public string[] ValidImageFormatExtensions => _ValidImageFormatExtensions;
|
||||
public string[] ValidMetadataExtensions => _ValidMetadataExtensions;
|
||||
public string[] VerifyToSeason => _VerifyToSeason;
|
||||
public bool? WriteBitmapDataBytes => _WriteBitmapDataBytes;
|
||||
|
||||
public string DateGroup { init; get; }
|
||||
public string FileNameDirectorySeparator { init; get; }
|
||||
public bool ForcePropertyLastWriteTimeToCreationTime { init; get; }
|
||||
public string[] IgnoreExtensions { init; get; }
|
||||
public int MaxImagesInDirectoryForTopLevelFirstPass { init; get; }
|
||||
public string Pattern { init; get; }
|
||||
public bool PopulatePropertyId { init; get; }
|
||||
public bool PropertiesChangedForProperty { init; get; }
|
||||
public string[] PropertyContentCollectionFiles { init; get; }
|
||||
public string[] ValidImageFormatExtensions { init; get; }
|
||||
public string[] ValidMetadataExtensions { init; get; }
|
||||
public string[] VerifyToSeason { init; get; }
|
||||
public bool WriteBitmapDataBytes { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public Configuration(string dateGroup, string fileNameDirectorySeparator, bool? forcePropertyLastWriteTimeToCreationTime, string[] ignoreExtensions, int? maxImagesInDirectoryForTopLevelFirstPass, string pattern, bool? populatePropertyId, bool? propertiesChangedForProperty, string[] propertyContentCollectionFiles, string rootDirectory, string[] validImageFormatExtensions, string[] validMetadataExtensions, string[] verifyToSeason, bool? writeBitmapDataBytes)
|
||||
public Configuration(string dateGroup, string fileNameDirectorySeparator, bool forcePropertyLastWriteTimeToCreationTime, string[] ignoreExtensions, int maxImagesInDirectoryForTopLevelFirstPass, string pattern, bool populatePropertyId, bool propertiesChangedForProperty, string[] propertyContentCollectionFiles, string rootDirectory, string[] validImageFormatExtensions, string[] validMetadataExtensions, string[] verifyToSeason, bool writeBitmapDataBytes)
|
||||
{
|
||||
_DateGroup = dateGroup;
|
||||
_FileNameDirectorySeparator = fileNameDirectorySeparator;
|
||||
_ForcePropertyLastWriteTimeToCreationTime = forcePropertyLastWriteTimeToCreationTime;
|
||||
_IgnoreExtensions = ignoreExtensions;
|
||||
_MaxImagesInDirectoryForTopLevelFirstPass = maxImagesInDirectoryForTopLevelFirstPass;
|
||||
_Pattern = pattern;
|
||||
_PopulatePropertyId = populatePropertyId;
|
||||
_PropertiesChangedForProperty = propertiesChangedForProperty;
|
||||
_PropertyContentCollectionFiles = propertyContentCollectionFiles;
|
||||
DateGroup = dateGroup;
|
||||
FileNameDirectorySeparator = fileNameDirectorySeparator;
|
||||
ForcePropertyLastWriteTimeToCreationTime = forcePropertyLastWriteTimeToCreationTime;
|
||||
IgnoreExtensions = ignoreExtensions;
|
||||
MaxImagesInDirectoryForTopLevelFirstPass = maxImagesInDirectoryForTopLevelFirstPass;
|
||||
Pattern = pattern;
|
||||
PopulatePropertyId = populatePropertyId;
|
||||
PropertiesChangedForProperty = propertiesChangedForProperty;
|
||||
PropertyContentCollectionFiles = propertyContentCollectionFiles;
|
||||
_RootDirectory = rootDirectory;
|
||||
_ValidImageFormatExtensions = validImageFormatExtensions;
|
||||
_ValidMetadataExtensions = validMetadataExtensions;
|
||||
_VerifyToSeason = verifyToSeason;
|
||||
_WriteBitmapDataBytes = writeBitmapDataBytes;
|
||||
ValidImageFormatExtensions = validImageFormatExtensions;
|
||||
ValidMetadataExtensions = validMetadataExtensions;
|
||||
VerifyToSeason = verifyToSeason;
|
||||
WriteBitmapDataBytes = writeBitmapDataBytes;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -62,18 +50,14 @@ public class Configuration
|
||||
|
||||
public void Update() => _RootDirectory = Path.GetFullPath(_RootDirectory);
|
||||
|
||||
public static void Verify(Configuration? propertyConfiguration)
|
||||
public void ChangeRootDirectory(string rootDirectory) => _RootDirectory = rootDirectory;
|
||||
|
||||
public static void Verify(Configuration propertyConfiguration)
|
||||
{
|
||||
if (propertyConfiguration is null)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration));
|
||||
if (propertyConfiguration.ForcePropertyLastWriteTimeToCreationTime is null)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.ForcePropertyLastWriteTimeToCreationTime));
|
||||
if (propertyConfiguration.IgnoreExtensions is null || !propertyConfiguration.IgnoreExtensions.Any())
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.IgnoreExtensions));
|
||||
if (propertyConfiguration.PopulatePropertyId is null)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.PopulatePropertyId));
|
||||
if (propertyConfiguration.PropertiesChangedForProperty is null)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.PropertiesChangedForProperty));
|
||||
if (propertyConfiguration.PropertyContentCollectionFiles is null)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.PropertyContentCollectionFiles));
|
||||
if (propertyConfiguration.ValidImageFormatExtensions is null || !propertyConfiguration.ValidImageFormatExtensions.Any())
|
||||
@ -82,8 +66,6 @@ public class Configuration
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.ValidMetadataExtensions));
|
||||
if (propertyConfiguration.VerifyToSeason is null || !propertyConfiguration.VerifyToSeason.Any())
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.VerifyToSeason));
|
||||
if (propertyConfiguration.WriteBitmapDataBytes is null)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.WriteBitmapDataBytes));
|
||||
if (Path.GetPathRoot(propertyConfiguration.RootDirectory) == propertyConfiguration.RootDirectory)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.RootDirectory));
|
||||
if (propertyConfiguration is null)
|
||||
@ -98,6 +80,4 @@ public class Configuration
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.RootDirectory));
|
||||
}
|
||||
|
||||
public void ChangeRootDirectory(string rootDirectory) => _RootDirectory = rootDirectory;
|
||||
|
||||
}
|
Reference in New Issue
Block a user