This commit is contained in:
Mike Phares 2023-10-15 12:15:22 -07:00
parent 37b7ad2a1f
commit d17b051da7
10 changed files with 247 additions and 234 deletions

View File

@ -21,7 +21,7 @@ public class DeleteByRelative
string searchPattern = "*";
long ticks = DateTime.Now.Ticks;
Configuration configuration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot);
logger?.LogInformation(configuration.RootDirectory);
logger?.LogInformation(configuration.RootDirectory);
int length = configuration.RootDirectory.Length;
if (string.IsNullOrEmpty(appSettings.CompareRootDirectory) || Path.GetFullPath(appSettings.CompareRootDirectory) == Path.GetFullPath(configuration.RootDirectory))
throw new Exception("Check AppSettings file!");
@ -59,14 +59,14 @@ public class DeleteByRelative
File.WriteAllLines(deleteLog, deleteFiles);
if (deleteFiles.Count > 0)
{
logger?.LogInformation($"Ready to delete {deleteFiles.Count} file(s)? See <{deleteLog}>");
logger?.LogInformation($"Ready to delete {deleteFiles.Count} file(s)? See <{deleteLog}>");
for (int y = 0; y < int.MaxValue; y++)
{
logger?.LogInformation("Press \"Y\" key to delete file(s) or close console to not delete files");
logger?.LogInformation("Press \"Y\" key to delete file(s) or close console to not delete files");
if (Console.ReadKey().Key == ConsoleKey.Y)
break;
}
logger?.LogInformation(". . .");
logger?.LogInformation(". . .");
foreach (string deleteFile in deleteFiles)
{
File.Delete(deleteFile);

View File

@ -34,7 +34,7 @@ public class MetadataQuery
Configuration configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration);
_PropertyConfiguration = propertyConfiguration;
_Configuration = configuration;
logger?.LogInformation(propertyConfiguration.RootDirectory);
logger?.LogInformation(propertyConfiguration.RootDirectory);
Verify();
MetadataQueryFilesInDirectories(logger, ticks);
}
@ -124,7 +124,7 @@ public class MetadataQuery
private void MetadataQueryFilesInDirectories(ILogger<Program>? logger, long ticks)
{
List<(string FileName, string Count, string TagGroup, string TagIdName, string Value)> collection = GetCollection(ticks);
logger?.LogInformation($"Ready to query {collection.Count} entries?");
logger?.LogInformation($"Ready to query {collection.Count} entries?");
IEnumerable<(string FileName, string Count, string TagGroup, string TagIdName, string Value)> enumerable()
{
foreach ((string FileName, string Count, string TagGroup, string TagIdName, string Value) l in collection)

View File

@ -3,15 +3,15 @@ using System.Text.Json.Serialization;
namespace View_by_Distance.Metadata.Models;
public record Avi(string? FramesPerSecond1,
string? SamplesPerSecond2,
string? Duration3,
string? VideoCodec4,
string? AudioCodec5,
string? Width6,
string? Height7,
string? Streams8,
string? DateTimeOriginal320)
public record Avi(string? FramesPerSecond1,
string? SamplesPerSecond2,
string? Duration3,
string? VideoCodec4,
string? AudioCodec5,
string? Width6,
string? Height7,
string? Streams8,
string? DateTimeOriginal320)
{
public override string ToString()

View File

@ -3,180 +3,180 @@ using System.Text.Json.Serialization;
namespace View_by_Distance.Metadata.Models;
public record Exif(string? InteropIndex1,
string? Noise37389,
string? FocalPlaneXResolutionTiffEp37390,
string? FocalPlaneYResolutionTiffEp37391,
string? ImageNumber37393,
string? SecurityClassification37394,
string? ImageHistory37395,
string? SubjectLocationTiffEp37396,
string? ExposureIndexTiffEp37397,
string? SpatialFreqResponseTiffEp37388,
string? StandardIdTiffEp37398,
string? UserComment37510,
string? SubsecondTime37520,
string? SubsecondTimeOriginal37521,
string? SubsecondTimeDigitized37522,
string? WinTitle40091,
string? WinComment40092,
string? WinAuthor40093,
string? WinKeywords40094,
string? Makernote37500,
string? WinSubject40095,
string? FlashEnergyTiffEp37387,
string? Flash37385,
string? IsoSpeedLatitudeYYY34868,
string? IsoSpeedLatitudeZZZ34869,
string? ExifVersion36864,
string? DateTimeOriginal36867,
string? DateTimeDigitized36868,
string? TimeZone36880,
string? TimeZoneOriginal36881,
string? TimeZoneDigitized36882,
string? FocalLength37386,
string? ComponentsConfiguration37121,
string? ShutterSpeed37377,
string? Aperture37378,
string? BrightnessValue37379,
string? ExposureBias37380,
string? MaxAperture37381,
string? SubjectDistance37382,
string? MeteringMode37383,
string? WhiteBalance37384,
string? CompressedAverageBitsPerPixel37122,
string? IsoSpeed34867,
string? FlashpixVersion40960,
string? ExifImageWidth40962,
string? Sharpness41994,
string? DeviceSettingDescription41995,
string? SubjectDistanceRange41996,
string? ImageUniqueId42016,
string? CameraOwnerName42032,
string? BodySerialNumber42033,
string? LensSpecification42034,
string? LensMake42035,
string? Saturation41993,
string? LensModel42036,
string? GdalMetadata42112,
string? GdalNoData42113,
string? Gamma42240,
string? PrintImageMatchingInfo50341,
string? PanasonicTitle50898,
string? PanasonicTitle250899,
string? Padding59932,
string? Lens65002,
string? LensSerialNumber42037,
string? ColorSpace40961,
string? Contrast41992,
string? SceneCaptureType41990,
string? ExifImageHeight40963,
string? RelatedSoundFile40964,
string? FlashEnergy41483,
string? SpatialFreqResponse41484,
string? FocalPlaneXResolution41486,
string? FocalPlaneYResolution41487,
string? FocalPlaneResolutionUnit41488,
string? SubjectLocation41492,
string? GainControl41991,
string? ExposureIndex41493,
string? FileSource41728,
string? SceneType41729,
string? CfaPattern41730,
string? CustomRendered41985,
string? ExposureMode41986,
string? WhiteBalanceMode41987,
string? DigitalZoomRatio41988,
string? Film35MMEquivFocalLength41989,
string? SensingMethod41495,
string? RecommendedExposureIndex34866,
string? StandardOutputSensitivity34865,
string? SensitivityType34864,
string? YResolution283,
string? PlanarConfiguration284,
string? PageName285,
string? ResolutionUnit296,
string? PageNumber297,
string? TransferFunction301,
string? Software305,
string? DateTime306,
string? XResolution282,
string? Artist315,
string? Predictor317,
string? WhitePoint318,
string? PrimaryChromaticities319,
string? TileWidth322,
string? TileLength323,
string? TileOffsets324,
string? TileByteCounts325,
string? SubIfdOffset330,
string? HostComputer316,
string? ExtraSamples338,
string? MaxSampleValue281,
string? StripByteCounts279,
string? InteropVersion2,
string? NewSubfileType254,
string? SubfileType255,
string? ImageWidth256,
string? ImageHeight257,
string? BitsPerSample258,
string? Compression259,
string? PhotometricInterpretation262,
string? MinSampleValue280,
string? Thresholding263,
string? DocumentName269,
string? ImageDescription270,
string? Make271,
string? Model272,
string? StripOffsets273,
string? Orientation274,
string? SamplesPerPixel277,
string? RowsPerStrip278,
string? FillOrder266,
string? SampleFormat339,
string? TransferRange342,
string? JpegTables347,
string? FNumber33437,
string? PixelScale33550,
string? IptcNaa33723,
string? ModelTiePoint33922,
string? PhotoshopSettings34377,
string? InterColorProfile34675,
string? GeoTiffGeoKeys34735,
string? GeoTiffGeoDoubleParams34736,
string? ExposureTime33434,
string? GeoTiffGeoAsciiParams34737,
string? SpectralSensitivity34852,
string? IsoEquivalent34855,
string? OptoElectricConversionFunction34856,
string? Interlace34857,
string? TimeZoneOffsetTiffEp34858,
string? SelfTimerModeTiffEp34859,
string? TimeZoneOffset34858,
string? SelfTimerMode34859,
string? ExposureProgram34850,
string? Copyright33432,
string? BatteryLevel33423,
string? CfaPattern233422,
string? JpegProc512,
string? JpegRestartInterval515,
string? JpegLosslessPredictors517,
string? JpegPointTransforms518,
string? JpegQTables519,
string? JpegDcTables520,
string? JpegAcTables521,
string? YCbCrCoefficients529,
string? YCbCrSubsampling530,
string? YCbCrPositioning531,
string? ReferenceBlackWhite532,
string? StripRowCounts559,
string? ApplicationNotes700,
string? RelatedImageFileFormat4096,
string? RelatedImageWidth4097,
string? RelatedImageHeight4098,
string? Rating18246,
string? RatingPercent18249,
string? CfaRepeatPatternDim33421)
public record Exif(string? InteropIndex1,
string? Noise37389,
string? FocalPlaneXResolutionTiffEp37390,
string? FocalPlaneYResolutionTiffEp37391,
string? ImageNumber37393,
string? SecurityClassification37394,
string? ImageHistory37395,
string? SubjectLocationTiffEp37396,
string? ExposureIndexTiffEp37397,
string? SpatialFreqResponseTiffEp37388,
string? StandardIdTiffEp37398,
string? UserComment37510,
string? SubsecondTime37520,
string? SubsecondTimeOriginal37521,
string? SubsecondTimeDigitized37522,
string? WinTitle40091,
string? WinComment40092,
string? WinAuthor40093,
string? WinKeywords40094,
string? Makernote37500,
string? WinSubject40095,
string? FlashEnergyTiffEp37387,
string? Flash37385,
string? IsoSpeedLatitudeYYY34868,
string? IsoSpeedLatitudeZZZ34869,
string? ExifVersion36864,
string? DateTimeOriginal36867,
string? DateTimeDigitized36868,
string? TimeZone36880,
string? TimeZoneOriginal36881,
string? TimeZoneDigitized36882,
string? FocalLength37386,
string? ComponentsConfiguration37121,
string? ShutterSpeed37377,
string? Aperture37378,
string? BrightnessValue37379,
string? ExposureBias37380,
string? MaxAperture37381,
string? SubjectDistance37382,
string? MeteringMode37383,
string? WhiteBalance37384,
string? CompressedAverageBitsPerPixel37122,
string? IsoSpeed34867,
string? FlashpixVersion40960,
string? ExifImageWidth40962,
string? Sharpness41994,
string? DeviceSettingDescription41995,
string? SubjectDistanceRange41996,
string? ImageUniqueId42016,
string? CameraOwnerName42032,
string? BodySerialNumber42033,
string? LensSpecification42034,
string? LensMake42035,
string? Saturation41993,
string? LensModel42036,
string? GdalMetadata42112,
string? GdalNoData42113,
string? Gamma42240,
string? PrintImageMatchingInfo50341,
string? PanasonicTitle50898,
string? PanasonicTitle250899,
string? Padding59932,
string? Lens65002,
string? LensSerialNumber42037,
string? ColorSpace40961,
string? Contrast41992,
string? SceneCaptureType41990,
string? ExifImageHeight40963,
string? RelatedSoundFile40964,
string? FlashEnergy41483,
string? SpatialFreqResponse41484,
string? FocalPlaneXResolution41486,
string? FocalPlaneYResolution41487,
string? FocalPlaneResolutionUnit41488,
string? SubjectLocation41492,
string? GainControl41991,
string? ExposureIndex41493,
string? FileSource41728,
string? SceneType41729,
string? CfaPattern41730,
string? CustomRendered41985,
string? ExposureMode41986,
string? WhiteBalanceMode41987,
string? DigitalZoomRatio41988,
string? Film35MMEquivFocalLength41989,
string? SensingMethod41495,
string? RecommendedExposureIndex34866,
string? StandardOutputSensitivity34865,
string? SensitivityType34864,
string? YResolution283,
string? PlanarConfiguration284,
string? PageName285,
string? ResolutionUnit296,
string? PageNumber297,
string? TransferFunction301,
string? Software305,
string? DateTime306,
string? XResolution282,
string? Artist315,
string? Predictor317,
string? WhitePoint318,
string? PrimaryChromaticities319,
string? TileWidth322,
string? TileLength323,
string? TileOffsets324,
string? TileByteCounts325,
string? SubIfdOffset330,
string? HostComputer316,
string? ExtraSamples338,
string? MaxSampleValue281,
string? StripByteCounts279,
string? InteropVersion2,
string? NewSubfileType254,
string? SubfileType255,
string? ImageWidth256,
string? ImageHeight257,
string? BitsPerSample258,
string? Compression259,
string? PhotometricInterpretation262,
string? MinSampleValue280,
string? Thresholding263,
string? DocumentName269,
string? ImageDescription270,
string? Make271,
string? Model272,
string? StripOffsets273,
string? Orientation274,
string? SamplesPerPixel277,
string? RowsPerStrip278,
string? FillOrder266,
string? SampleFormat339,
string? TransferRange342,
string? JpegTables347,
string? FNumber33437,
string? PixelScale33550,
string? IptcNaa33723,
string? ModelTiePoint33922,
string? PhotoshopSettings34377,
string? InterColorProfile34675,
string? GeoTiffGeoKeys34735,
string? GeoTiffGeoDoubleParams34736,
string? ExposureTime33434,
string? GeoTiffGeoAsciiParams34737,
string? SpectralSensitivity34852,
string? IsoEquivalent34855,
string? OptoElectricConversionFunction34856,
string? Interlace34857,
string? TimeZoneOffsetTiffEp34858,
string? SelfTimerModeTiffEp34859,
string? TimeZoneOffset34858,
string? SelfTimerMode34859,
string? ExposureProgram34850,
string? Copyright33432,
string? BatteryLevel33423,
string? CfaPattern233422,
string? JpegProc512,
string? JpegRestartInterval515,
string? JpegLosslessPredictors517,
string? JpegPointTransforms518,
string? JpegQTables519,
string? JpegDcTables520,
string? JpegAcTables521,
string? YCbCrCoefficients529,
string? YCbCrSubsampling530,
string? YCbCrPositioning531,
string? ReferenceBlackWhite532,
string? StripRowCounts559,
string? ApplicationNotes700,
string? RelatedImageFileFormat4096,
string? RelatedImageWidth4097,
string? RelatedImageHeight4098,
string? Rating18246,
string? RatingPercent18249,
string? CfaRepeatPatternDim33421)
{
public override string ToString()

View File

@ -3,22 +3,22 @@ using System.Text.Json.Serialization;
namespace View_by_Distance.Metadata.Models;
public record QuickTimeMovieHeader(string? Version1,
string? NextTrackId16,
string? CurrentTime15,
string? SelectionDuration14,
string? SelectionTime13,
string? PosterTime12,
string? PreviewDuration11,
string? PreviewTime10,
string? Matrix9,
string? PreferredVolume8,
string? PreferredRate7,
string? Duration6,
string? TimeScale5,
string? Modified4,
string? Created3,
string? Flags2)
public record QuickTimeMovieHeader(string? Version1,
string? NextTrackId16,
string? CurrentTime15,
string? SelectionDuration14,
string? SelectionTime13,
string? PosterTime12,
string? PreviewDuration11,
string? PreviewTime10,
string? Matrix9,
string? PreferredVolume8,
string? PreferredRate7,
string? Duration6,
string? TimeScale5,
string? Modified4,
string? Created3,
string? Flags2)
{
public override string ToString()

View File

@ -3,19 +3,19 @@ using System.Text.Json.Serialization;
namespace View_by_Distance.Metadata.Models;
public record QuickTimeTrackHeader(string? Version1,
string? Flags2,
string? Created3,
string? Modified4,
string? TrackId5,
string? Duration6,
string? Layer7,
string? AlternateGroup8,
string? Volume9,
string? Width10,
string? Height11,
string? Matrix12,
string? Rotation13)
public record QuickTimeTrackHeader(string? Version1,
string? Flags2,
string? Created3,
string? Modified4,
string? TrackId5,
string? Duration6,
string? Layer7,
string? AlternateGroup8,
string? Volume9,
string? Width10,
string? Height11,
string? Matrix12,
string? Rotation13)
{
public override string ToString()

View File

@ -38,7 +38,7 @@ public class MoveById
string? comparePathRoot = Path.GetDirectoryName(appSettings.ComparePathsFile);
if (comparePathRoot is null || comparePathRoot == propertyConfiguration.RootDirectory)
throw new Exception("Nested isn't allowed!");
logger?.LogInformation(propertyConfiguration.RootDirectory);
logger?.LogInformation(propertyConfiguration.RootDirectory);
Property.Models.Configuration.Verify(propertyConfiguration, requireExist: false);
Verify();
string json = File.ReadAllText(appSettings.ComparePathsFile);

View File

@ -16,7 +16,8 @@ public abstract class Configuration
Binder.Configuration? configuration = configurationSection.Get<Binder.Configuration>();
string json = JsonSerializer.Serialize(configuration, new JsonSerializerOptions() { WriteIndented = true });
result = JsonSerializer.Deserialize<Models.Configuration>(json);
if (result is null) throw new Exception(json);
if (result is null)
throw new Exception(json);
string jsonThis = result.ToString();
if (jsonThis != json)
{
@ -29,10 +30,11 @@ public abstract class Configuration
check = i;
break;
}
if (check is null) throw new Exception();
if (check is null)
throw new Exception();
string a = json[..check.Value].Split(',')[^1];
string b = json[check.Value..].Split(',')[0];
throw new Exception($"{a}{b}");
throw new Exception($"{a}{b}");
}
return result;
}

View File

@ -51,7 +51,7 @@ public class Configuration
// 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.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));

View File

@ -95,17 +95,28 @@ 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.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();
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();
}
}