a
This commit is contained in:
@ -11,10 +11,12 @@ public class Configuration
|
||||
public string? FileNameDirectorySeparator { get; set; }
|
||||
public bool? ForcePropertyLastWriteTimeToCreationTime { get; set; }
|
||||
public string[]? IgnoreExtensions { get; set; }
|
||||
public string[]? IgnoreRulesKeyWords { get; set; }
|
||||
public int? MaxImagesInDirectoryForTopLevelFirstPass { get; set; }
|
||||
public string? ModelName { init; get; }
|
||||
public int? NumberOfJitters { init; get; }
|
||||
public int? NumberOfTimesToUpsample { init; get; }
|
||||
public int? Offset { init; get; }
|
||||
public string? Pattern { get; set; }
|
||||
public string? PersonBirthdayFormat { get; set; }
|
||||
public bool? PopulatePropertyId { get; set; }
|
||||
@ -43,11 +45,13 @@ public class Configuration
|
||||
if (configuration.DateGroup is null) throw new NullReferenceException(nameof(configuration.DateGroup));
|
||||
if (configuration.FileNameDirectorySeparator is null) throw new NullReferenceException(nameof(configuration.FileNameDirectorySeparator));
|
||||
if (configuration.ForcePropertyLastWriteTimeToCreationTime is null) throw new NullReferenceException(nameof(configuration.ForcePropertyLastWriteTimeToCreationTime));
|
||||
// if (configuration.IgnoreExtensions is null) throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
||||
if (configuration.IgnoreExtensions is null) throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
|
||||
if (configuration.IgnoreRulesKeyWords is null) throw new NullReferenceException(nameof(configuration.IgnoreRulesKeyWords));
|
||||
if (configuration.MaxImagesInDirectoryForTopLevelFirstPass is null) throw new NullReferenceException(nameof(configuration.MaxImagesInDirectoryForTopLevelFirstPass));
|
||||
// if (configuration.ModelName is null) throw new NullReferenceException(nameof(configuration.ModelName));
|
||||
// if (configuration.NumberOfJitters is null) throw new NullReferenceException(nameof(configuration.NumberOfJitters));
|
||||
// if (configuration.NumberOfTimesToUpsample is null) throw new NullReferenceException(nameof(configuration.NumberOfTimesToUpsample));
|
||||
if (configuration.Offset is null) throw new NullReferenceException(nameof(configuration.Offset));;
|
||||
if (configuration.Pattern is null) throw new NullReferenceException(nameof(configuration.Pattern));
|
||||
if (configuration.PersonBirthdayFormat is null) throw new NullReferenceException(nameof(configuration.PersonBirthdayFormat));
|
||||
if (configuration.PopulatePropertyId is null) throw new NullReferenceException(nameof(configuration.PopulatePropertyId));
|
||||
@ -60,16 +64,18 @@ public class Configuration
|
||||
if (configuration.ResultContent is null) throw new NullReferenceException(nameof(configuration.ResultContent));
|
||||
if (configuration.ResultSingleton is null) throw new NullReferenceException(nameof(configuration.ResultSingleton));
|
||||
if (configuration.RootDirectory is null) throw new NullReferenceException(nameof(configuration.RootDirectory));
|
||||
// if (configuration.ValidImageFormatExtensions is null) throw new NullReferenceException(nameof(configuration.ValidImageFormatExtensions));
|
||||
if (configuration.ValidImageFormatExtensions is null) throw new NullReferenceException(nameof(configuration.ValidImageFormatExtensions));
|
||||
// if (configuration.VerifyToSeason is null) throw new NullReferenceException(nameof(configuration.VerifyToSeason));
|
||||
result = new(configuration.DateGroup,
|
||||
configuration.FileNameDirectorySeparator,
|
||||
configuration.ForcePropertyLastWriteTimeToCreationTime.Value,
|
||||
configuration.IgnoreExtensions ?? Array.Empty<string>(),
|
||||
configuration.IgnoreExtensions,
|
||||
configuration.IgnoreRulesKeyWords,
|
||||
configuration.MaxImagesInDirectoryForTopLevelFirstPass.Value,
|
||||
configuration.ModelName,
|
||||
configuration.NumberOfJitters,
|
||||
configuration.NumberOfTimesToUpsample,
|
||||
configuration.Offset.Value,
|
||||
configuration.Pattern,
|
||||
configuration.PersonBirthdayFormat,
|
||||
configuration.PopulatePropertyId.Value,
|
||||
@ -82,7 +88,7 @@ public class Configuration
|
||||
configuration.ResultContent,
|
||||
configuration.ResultSingleton,
|
||||
Path.GetFullPath(configuration.RootDirectory),
|
||||
configuration.ValidImageFormatExtensions ?? Array.Empty<string>(),
|
||||
configuration.ValidImageFormatExtensions,
|
||||
configuration.VerifyToSeason ?? Array.Empty<string>());
|
||||
return result;
|
||||
}
|
||||
|
@ -14,10 +14,12 @@ public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
||||
public string FileNameDirectorySeparator { init; get; }
|
||||
public bool ForcePropertyLastWriteTimeToCreationTime { init; get; }
|
||||
public string[] IgnoreExtensions { init; get; }
|
||||
public string[] IgnoreRulesKeyWords { init; get; }
|
||||
public int MaxImagesInDirectoryForTopLevelFirstPass { init; get; }
|
||||
public string? ModelName { init; get; }
|
||||
public int? NumberOfJitters { init; get; }
|
||||
public int? NumberOfTimesToUpsample { init; get; }
|
||||
public int Offset { init; get; }
|
||||
public string Pattern { init; get; }
|
||||
public string PersonBirthdayFormat { init; get; }
|
||||
public bool PopulatePropertyId { init; get; }
|
||||
@ -36,10 +38,12 @@ public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
||||
string fileNameDirectorySeparator,
|
||||
bool forcePropertyLastWriteTimeToCreationTime,
|
||||
string[] ignoreExtensions,
|
||||
string[] ignoreRulesKeyWords,
|
||||
int maxImagesInDirectoryForTopLevelFirstPass,
|
||||
string? modelName,
|
||||
int? numberOfJitters,
|
||||
int? numberOfTimesToUpsample,
|
||||
int offset,
|
||||
string pattern,
|
||||
string personBirthdayFormat,
|
||||
bool populatePropertyId,
|
||||
@ -59,10 +63,12 @@ public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
||||
FileNameDirectorySeparator = fileNameDirectorySeparator;
|
||||
ForcePropertyLastWriteTimeToCreationTime = forcePropertyLastWriteTimeToCreationTime;
|
||||
IgnoreExtensions = ignoreExtensions;
|
||||
IgnoreRulesKeyWords = ignoreRulesKeyWords;
|
||||
MaxImagesInDirectoryForTopLevelFirstPass = maxImagesInDirectoryForTopLevelFirstPass;
|
||||
ModelName = modelName;
|
||||
NumberOfJitters = numberOfJitters;
|
||||
NumberOfTimesToUpsample = numberOfTimesToUpsample;
|
||||
Offset = offset;
|
||||
Pattern = pattern;
|
||||
PersonBirthdayFormat = personBirthdayFormat;
|
||||
PredictorModelName = predictorModelName;
|
||||
@ -89,26 +95,17 @@ public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
||||
|
||||
public static void Verify(Configuration propertyConfiguration, bool requireExist)
|
||||
{
|
||||
if (propertyConfiguration is null)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration));
|
||||
if (propertyConfiguration.IgnoreExtensions is null || propertyConfiguration.IgnoreExtensions.Length == 0)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.IgnoreExtensions));
|
||||
if (propertyConfiguration.PropertyContentCollectionFiles is null)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.PropertyContentCollectionFiles));
|
||||
if (propertyConfiguration.ValidImageFormatExtensions is null || propertyConfiguration.ValidImageFormatExtensions.Length == 0)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.ValidImageFormatExtensions));
|
||||
if (propertyConfiguration is null)
|
||||
throw new NullReferenceException(nameof(propertyConfiguration));
|
||||
if (string.IsNullOrEmpty(propertyConfiguration.DateGroup))
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.DateGroup));
|
||||
if (string.IsNullOrEmpty(propertyConfiguration.FileNameDirectorySeparator))
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.FileNameDirectorySeparator));
|
||||
if (string.IsNullOrEmpty(propertyConfiguration.Pattern))
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.Pattern));
|
||||
if (string.IsNullOrEmpty(propertyConfiguration.RootDirectory) || (requireExist && !Directory.Exists(propertyConfiguration.RootDirectory)))
|
||||
throw new NullReferenceException(nameof(propertyConfiguration.RootDirectory));
|
||||
if (propertyConfiguration.RootDirectory != Path.GetFullPath(propertyConfiguration.RootDirectory))
|
||||
throw new Exception();
|
||||
if (propertyConfiguration is null) throw new NullReferenceException(nameof(propertyConfiguration));
|
||||
if (propertyConfiguration.IgnoreExtensions is null || propertyConfiguration.IgnoreExtensions.Length == 0) throw new NullReferenceException(nameof(propertyConfiguration.IgnoreExtensions));
|
||||
if (propertyConfiguration.IgnoreRulesKeyWords is null || propertyConfiguration.IgnoreRulesKeyWords.Length == 0) throw new NullReferenceException(nameof(propertyConfiguration.IgnoreRulesKeyWords));
|
||||
if (propertyConfiguration.PropertyContentCollectionFiles is null) throw new NullReferenceException(nameof(propertyConfiguration.PropertyContentCollectionFiles));
|
||||
if (propertyConfiguration.ValidImageFormatExtensions is null || propertyConfiguration.ValidImageFormatExtensions.Length == 0) throw new NullReferenceException(nameof(propertyConfiguration.ValidImageFormatExtensions));
|
||||
if (propertyConfiguration is null) throw new NullReferenceException(nameof(propertyConfiguration));
|
||||
if (string.IsNullOrEmpty(propertyConfiguration.DateGroup)) throw new NullReferenceException(nameof(propertyConfiguration.DateGroup));
|
||||
if (string.IsNullOrEmpty(propertyConfiguration.FileNameDirectorySeparator)) throw new NullReferenceException(nameof(propertyConfiguration.FileNameDirectorySeparator));
|
||||
if (string.IsNullOrEmpty(propertyConfiguration.Pattern)) throw new NullReferenceException(nameof(propertyConfiguration.Pattern));
|
||||
if (string.IsNullOrEmpty(propertyConfiguration.RootDirectory) || (requireExist && !Directory.Exists(propertyConfiguration.RootDirectory))) throw new NullReferenceException(nameof(propertyConfiguration.RootDirectory));
|
||||
if (propertyConfiguration.RootDirectory != Path.GetFullPath(propertyConfiguration.RootDirectory)) throw new Exception();
|
||||
}
|
||||
|
||||
}
|
@ -214,10 +214,10 @@ internal class Property
|
||||
DateTime?[] dateTimes;
|
||||
string dateTimeFormat;
|
||||
DateTime checkDateTime;
|
||||
int? orientation = null;
|
||||
DateTime? dateTime = null;
|
||||
string[]? keywords = null;
|
||||
PropertyItem? propertyItem;
|
||||
string? orientation = null;
|
||||
DateTime? gpsDateStamp = null;
|
||||
List<DateTime> dateTimesByLogic;
|
||||
DateTime? dateTimeOriginal = null;
|
||||
@ -312,28 +312,19 @@ internal class Property
|
||||
{
|
||||
propertyItem = image.GetPropertyItem((int)IExif.Tags.Make);
|
||||
if (propertyItem?.Value is not null)
|
||||
{
|
||||
value = asciiEncoding.GetString(propertyItem.Value, 0, propertyItem.Len - 1);
|
||||
make = value;
|
||||
}
|
||||
make = asciiEncoding.GetString(propertyItem.Value, 0, propertyItem.Len - 1);
|
||||
}
|
||||
if (image.PropertyIdList.Contains((int)IExif.Tags.Model))
|
||||
{
|
||||
propertyItem = image.GetPropertyItem((int)IExif.Tags.Model);
|
||||
if (propertyItem?.Value is not null)
|
||||
{
|
||||
value = asciiEncoding.GetString(propertyItem.Value, 0, propertyItem.Len - 1);
|
||||
model = value;
|
||||
}
|
||||
model = asciiEncoding.GetString(propertyItem.Value, 0, propertyItem.Len - 1);
|
||||
}
|
||||
if (image.PropertyIdList.Contains((int)IExif.Tags.Orientation))
|
||||
{
|
||||
propertyItem = image.GetPropertyItem((int)IExif.Tags.Orientation);
|
||||
if (propertyItem?.Value is not null)
|
||||
{
|
||||
value = BitConverter.ToInt16(propertyItem.Value, 0).ToString();
|
||||
orientation = value;
|
||||
}
|
||||
orientation = BitConverter.ToInt16(propertyItem.Value, 0);
|
||||
}
|
||||
if (image.PropertyIdList.Contains((int)IExif.Tags.XPKeywords))
|
||||
{
|
||||
@ -381,9 +372,9 @@ internal class Property
|
||||
if (fileHolder.LastWriteTime is null && property?.LastWriteTime is null)
|
||||
throw new NullReferenceException(nameof(fileHolder.LastWriteTime));
|
||||
if (fileHolder.CreationTime is not null && fileHolder.LastWriteTime is not null)
|
||||
result = new(fileHolder.CreationTime.Value, dateTime, dateTimeDigitized, dateTimeFromName, dateTimeOriginalByLogic, fileLength, gpsDateStamp, height, id, keywords, fileHolder.LastWriteTime.Value, make, model, orientation, width);
|
||||
result = new(fileHolder.CreationTime.Value, dateTime, dateTimeDigitized, dateTimeFromName, dateTimeOriginalByLogic, fileLength, gpsDateStamp, height, id, keywords, fileHolder.LastWriteTime.Value, make, model, orientation?.ToString(), width);
|
||||
else if (property is not null)
|
||||
result = new(property.CreationTime, dateTime, dateTimeDigitized, dateTimeFromName, dateTimeOriginalByLogic, fileLength, gpsDateStamp, height, id, keywords, property.LastWriteTime, make, model, orientation, width);
|
||||
result = new(property.CreationTime, dateTime, dateTimeDigitized, dateTimeFromName, dateTimeOriginalByLogic, fileLength, gpsDateStamp, height, id, keywords, property.LastWriteTime, make, model, orientation?.ToString(), width);
|
||||
else
|
||||
throw new NullReferenceException(nameof(property));
|
||||
return (message, dateTimesByLogic.ToArray(), result);
|
||||
|
Reference in New Issue
Block a user