Save-Image-Info

This commit is contained in:
Mike Phares 2023-06-29 22:41:09 -07:00
parent a4dd0fae45
commit 12d2779fa3
21 changed files with 681 additions and 21 deletions

View File

@ -11,22 +11,23 @@ completedColumns:
- [asdf](tasks/asdf.md)
- [merge-scan-photos](tasks/merge-scan-photos.md)
- [setup-syncthing-server](tasks/setup-syncthing-server.md)
- [google-timeline-for-geo](tasks/google-timeline-for-geo.md)
- [use-photo-prism-to-map](tasks/use-photo-prism-to-map.md)
- [import-face-region-metadata](tasks/import-face-region-metadata.md)
## Todo
- [import-face-region-metadata](tasks/import-face-region-metadata.md)
- [use-photo-prism-to-map](tasks/use-photo-prism-to-map.md)
- [determine-if-location-container-collection-is-needed-in-get-faces](tasks/determine-if-location-container-collection-is-needed-in-get-faces.md)
- [google-timeline-for-geo](tasks/google-timeline-for-geo.md)
- [merge-kristy-files](tasks/merge-kristy-files.md)
- [setup-syncthing-server](tasks/setup-syncthing-server.md)
- [import-know-faces-into-db](tasks/import-know-faces-into-db.md)
- [compression-only-difference](tasks/compression-only-difference.md)
## In Progress
- [find-incorrectly-mapped-faces](tasks/find-incorrectly-mapped-faces.md)
- [nef-support](tasks/nef-support.md)
- [use-eyes-to-find-orientation](tasks/use-eyes-to-find-orientation.md)
- [import-know-faces-into-db](tasks/import-know-faces-into-db.md)
## Done

View File

@ -0,0 +1,14 @@
---
created: 2023-06-12T21:54:44.803Z
updated: 2023-06-12T21:54:44.803Z
assigned: ""
progress: 0
tags: []
status: "1-Backlog"
---
# compression-only-difference
## Sub-tasks
- [ ] See images -711794998 && -787220963

17
.vscode/launch.json vendored
View File

@ -259,6 +259,23 @@
"stopAtEntry": false,
"requireExactSource": false
},
{
"name": "Save-Image-Info",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Save-Image-Info/bin/Debug/net7.0/win-x64/Save-Image-Info.dll",
"args": [
"s"
],
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"cwd": "${workspaceFolder}",
"console": "externalTerminal",
"stopAtEntry": false,
"requireExactSource": false
},
{
"name": "Set-Created-Date",
"type": "coreclr",

View File

@ -31,8 +31,7 @@ public class CopyDistinct
_ConfigurationRoot = configurationRoot;
ILogger? log = Log.ForContext<CopyDistinct>();
Property.Models.Configuration propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot);
string[] directories = new string[] { propertyConfiguration.ResultContent };
_FileGroups = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(propertyConfiguration, appSettings.CopyTo, directories);
_FileGroups = Shared.Models.Stateless.Methods.IPath.GetKeyValuePairs(propertyConfiguration, appSettings.CopyTo, new string[] { appSettings.ResultDirectoryKey });
Configuration configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration);
_PropertyConfiguration = propertyConfiguration;
_Configuration = configuration;
@ -90,6 +89,7 @@ public class CopyDistinct
string directoryName;
bool wrapped = false;
List<string> distinct = new();
string key = string.IsNullOrEmpty(_AppSettings.ResultDirectoryKey) ? _PropertyConfiguration.ResultAllInOne : _AppSettings.ResultDirectoryKey;
foreach (FileHolder fileHolder in fileHolders)
{
progressBar.Tick();
@ -101,17 +101,19 @@ public class CopyDistinct
{
if (wrapped)
continue;
directory = _FileGroups[_PropertyConfiguration.ResultContent][directoryIndex];
directory = _FileGroups[key][directoryIndex];
}
else
{
if (!wrapped)
wrapped = true;
directory = Path.Combine(_FileGroups[_PropertyConfiguration.ResultContent][directoryIndex], directoryName);
directory = Path.Combine(_FileGroups[key][directoryIndex], directoryName);
}
checkFile = Path.Combine(directory, $"{fileHolder.NameWithoutExtension}{fileHolder.ExtensionLowered}");
if (distinct.Contains(checkFile))
{
if (!_AppSettings.CopyDuplicates)
continue;
for (int i = 1; i < int.MaxValue; i++)
{
fileInfo = new(checkFile);

View File

@ -7,19 +7,25 @@ public class AppSettings
{
public string Company { init; get; }
public bool CopyDuplicates { init; get; }
public string CopyTo { init; get; }
public int MaxDegreeOfParallelism { init; get; }
public string ResultDirectoryKey { init; get; }
public string WorkingDirectoryName { init; get; }
[JsonConstructor]
public AppSettings(string company,
bool copyDuplicates,
string copyTo,
int maxDegreeOfParallelism,
string resultDirectoryKey,
string workingDirectoryName)
{
Company = company;
CopyTo = copyTo;
CopyDuplicates = copyDuplicates;
MaxDegreeOfParallelism = maxDegreeOfParallelism;
ResultDirectoryKey = resultDirectoryKey;
WorkingDirectoryName = workingDirectoryName;
}

View File

@ -6,14 +6,12 @@ namespace View_by_Distance.Copy.Distinct.Models.Binder;
public class AppSettings
{
#nullable disable
public string Company { get; set; }
public string? Company { get; set; }
public int? MaxDegreeOfParallelism { get; set; }
public string CopyTo { get; set; }
public string WorkingDirectoryName { get; set; }
#nullable restore
public bool? CopyDuplicates { get; set; }
public string? CopyTo { get; set; }
public string? ResultDirectoryKey { init; get; }
public string? WorkingDirectoryName { get; set; }
public override string ToString()
{
@ -24,12 +22,24 @@ public class AppSettings
private static Models.AppSettings Get(AppSettings? appSettings)
{
Models.AppSettings result;
if (appSettings?.Company is null)
throw new NullReferenceException(nameof(appSettings.Company));
if (appSettings?.CopyDuplicates is null)
throw new NullReferenceException(nameof(appSettings.CopyDuplicates));
if (appSettings?.CopyTo is null)
throw new NullReferenceException(nameof(appSettings.CopyTo));
if (appSettings?.MaxDegreeOfParallelism is null)
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
if (appSettings?.ResultDirectoryKey is null)
throw new NullReferenceException(nameof(appSettings.ResultDirectoryKey));
if (appSettings?.WorkingDirectoryName is null)
throw new NullReferenceException(nameof(appSettings.WorkingDirectoryName));
result = new(
appSettings.Company,
appSettings.CopyDuplicates.Value,
appSettings.CopyTo,
appSettings.MaxDegreeOfParallelism.Value,
appSettings.ResultDirectoryKey,
appSettings.WorkingDirectoryName
);
return result;

View File

@ -1,6 +1,7 @@
{
"ComparePathsFile": "",
"Company": "Mike Phares",
"CopyDuplicates": true,
"CopyTo": "",
"Linux": {},
"Logging": {

View File

@ -794,6 +794,7 @@ public partial class DlibDotNet
if (distinctFilteredMappingCollection.Any())
{
Shared.Models.Stateless.Methods.IPath.ChangeDateForEmptyDirectories(d2FacePartsContentDirectory, ticks);
if (Directory.Exists(d2FacePartsContentCollectionDirectory))
Shared.Models.Stateless.Methods.IPath.MakeHiddenIfAllItemsAreHidden(d2FacePartsContentCollectionDirectory);
}
Dictionary<int, Dictionary<int, Mapping>> idToWholePercentagesToMapping = Map.Models.Stateless.Methods.IMapLogic.GetIdToWholePercentagesToFace(distinctFilteredMappingCollection);

View File

@ -0,0 +1,29 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace View_by_Distance.Save.Image.Info.Models;
public class AppSettings
{
public string Company { init; get; }
public int MaxDegreeOfParallelism { init; get; }
public string WorkingDirectoryName { init; get; }
[JsonConstructor]
public AppSettings(string company,
int maxDegreeOfParallelism,
string workingDirectoryName)
{
Company = company;
MaxDegreeOfParallelism = maxDegreeOfParallelism;
WorkingDirectoryName = workingDirectoryName;
}
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
}

View File

@ -0,0 +1,44 @@
using Microsoft.Extensions.Configuration;
using System.Text.Json;
namespace View_by_Distance.Save.Image.Info.Models.Binder;
public class AppSettings
{
public string? Company { get; set; }
public int? MaxDegreeOfParallelism { get; set; }
public string? WorkingDirectoryName { get; set; }
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
private static Models.AppSettings Get(AppSettings? appSettings)
{
Models.AppSettings result;
if (appSettings?.Company is null)
throw new NullReferenceException(nameof(appSettings.Company));
if (appSettings?.MaxDegreeOfParallelism is null)
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
if (appSettings?.WorkingDirectoryName is null)
throw new NullReferenceException(nameof(appSettings.WorkingDirectoryName));
result = new(
appSettings.Company,
appSettings.MaxDegreeOfParallelism.Value,
appSettings.WorkingDirectoryName
);
return result;
}
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
{
Models.AppSettings result;
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
result = Get(appSettings);
return result;
}
}

View File

@ -0,0 +1,59 @@
using Microsoft.Extensions.Configuration;
using Phares.Shared;
using System.ComponentModel.DataAnnotations;
using System.Text.Json;
namespace View_by_Distance.Save.Image.Info.Models.Binder;
public class Configuration
{
#nullable disable
[Display(Name = "Ignore Extensions"), Required] public string[] IgnoreExtensions { get; set; }
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration PropertyConfiguration { get; set; }
[Display(Name = "Person Birthday Format"), Required] public string PersonBirthdayFormat { get; set; }
#nullable restore
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
private static Models.Configuration Get(Configuration? configuration)
{
Models.Configuration result;
if (configuration is null)
throw new NullReferenceException(nameof(configuration));
if (configuration.IgnoreExtensions is null)
throw new NullReferenceException(nameof(configuration.IgnoreExtensions));
if (configuration.PersonBirthdayFormat is null)
throw new NullReferenceException(nameof(configuration.PersonBirthdayFormat));
result = new(
configuration.IgnoreExtensions,
configuration.PersonBirthdayFormat,
configuration.PropertyConfiguration);
return result;
}
public static Models.Configuration Get(IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, Property.Models.Configuration propertyConfiguration)
{
Models.Configuration result;
Configuration? configuration;
if (isEnvironment is null)
configuration = configurationRoot.Get<Configuration>();
else
{
string environmentName = IsEnvironment.GetEnvironmentName(isEnvironment);
string section = string.Concat(environmentName, ":", nameof(Configuration));
IConfigurationSection configurationSection = configurationRoot.GetSection(section);
configuration = configurationSection.Get<Configuration>();
}
result = Get(configuration);
result.SetAndUpdate(propertyConfiguration);
return result;
}
}

View File

@ -0,0 +1,38 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace View_by_Distance.Save.Image.Info.Models;
public class Configuration
{
protected Property.Models.Configuration _PropertyConfiguration;
public string[] IgnoreExtensions { init; get; }
public string PersonBirthdayFormat { init; get; }
public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration;
[JsonConstructor]
public Configuration(
string[] ignoreExtensions,
string personBirthdayFormat,
Property.Models.Configuration propertyConfiguration)
{
IgnoreExtensions = ignoreExtensions;
PersonBirthdayFormat = personBirthdayFormat;
_PropertyConfiguration = propertyConfiguration;
}
public override string ToString()
{
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
return result;
}
public void SetAndUpdate(Property.Models.Configuration configuration)
{
_PropertyConfiguration = configuration;
_PropertyConfiguration.Update();
}
}

View File

@ -0,0 +1,21 @@
using System.Text.Json.Serialization;
namespace View_by_Distance.Save.Image.Info.Models;
public class ImageInfo
{
public DateTime? CreationTime { get; init; }
public DateTime? LastWriteTime { get; init; }
public long? Length { get; init; }
public string Name { get; init; }
[JsonConstructor]
public ImageInfo(DateTime? creationTime, DateTime? lastWriteTime, long? length, string name)
{
CreationTime = creationTime;
LastWriteTime = lastWriteTime;
Length = length;
Name = name;
}
}

View File

@ -0,0 +1,10 @@
namespace View_by_Distance.Save.Image.Info.Models.Stateless;
public static class SerilogExtensionMethods
{
internal static void Warn(this Serilog.ILogger log, string messageTemplate) => log.Warning(messageTemplate);
internal static void Info(this Serilog.ILogger log, string messageTemplate) => log.Information(messageTemplate);
}

View File

@ -0,0 +1,71 @@
using Microsoft.Extensions.Configuration;
using Phares.Shared;
using Serilog;
using System.Diagnostics;
using System.Reflection;
using View_by_Distance.Save.Image.Info.Models;
using View_by_Distance.Shared.Models.Stateless.Methods;
namespace View_by_Distance.Save.Image.Info;
public class Program
{
public static void Secondary(List<string> args)
{
LoggerConfiguration loggerConfiguration = new();
Assembly assembly = Assembly.GetExecutingAssembly();
bool debuggerWasAttachedAtLineZero = Debugger.IsAttached || assembly.Location.Contains(@"\bin\Debug");
IsEnvironment isEnvironment = new(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: debuggerWasAttachedAtLineZero, nullASPNetCoreEnvironmentIsProduction: !debuggerWasAttachedAtLineZero);
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder()
.AddEnvironmentVariables()
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile(isEnvironment.AppSettingsFileName, optional: false, reloadOnChange: true)
.AddUserSecrets<Program>();
IConfigurationRoot configurationRoot = configurationBuilder.Build();
AppSettings appSettings = Models.Binder.AppSettings.Get(configurationRoot);
if (appSettings.MaxDegreeOfParallelism > Environment.ProcessorCount)
throw new Exception("MaxDegreeOfParallelism must be =< Environment.ProcessorCount!");
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
throw new Exception("Working directory name must have a value!");
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assembly.GetName().Name, appSettings.WorkingDirectoryName);
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot);
Log.Logger = loggerConfiguration.CreateLogger();
ILogger log = Log.ForContext<Program>();
int silentIndex = args.IndexOf("s");
if (silentIndex > -1)
args.RemoveAt(silentIndex);
try
{
if (args is null)
throw new Exception("args is null!");
Shared.Models.Console console = new();
_ = new SaveImageInfo(args, isEnvironment, configurationRoot, appSettings, workingDirectory, silentIndex > -1, console);
}
catch (Exception ex)
{
log.Fatal(string.Concat(ex.Message, Environment.NewLine, ex.StackTrace));
}
finally
{
Log.CloseAndFlush();
}
if (silentIndex > -1)
log.Debug("Done. Bye");
else
{
log.Debug("Done. Press 'Enter' to end");
_ = Console.ReadLine();
}
}
public static void Main(string[] args)
{
if (args is not null)
Secondary(args.ToList());
else
Secondary(new List<string>());
}
}

View File

@ -0,0 +1,60 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<TargetFramework>net7.0</TargetFramework>
<UserSecretsId>fa06c6db-0226-42ca-8728-68b1e336184d</UserSecretsId>
</PropertyGroup>
<PropertyGroup>
<PackageId>Phares.View.by.Distance.Save.Image.Info</PackageId>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Version>7.0.101.1</Version>
<Authors>Mike Phares</Authors>
<Company>Phares</Company>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<PropertyGroup>
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
</PropertyGroup>
<PropertyGroup Condition="'$(IsWindows)'=='true'">
<DefineConstants>Windows</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(IsOSX)'=='true'">
<DefineConstants>OSX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(IsLinux)'=='true'">
<DefineConstants>Linux</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="System.Text.Json" Version="7.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Property\Property.csproj" />
<ProjectReference Include="..\Shared\View-by-Distance.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,121 @@
using Microsoft.Extensions.Configuration;
using Phares.Shared;
using Serilog;
using ShellProgressBar;
using System.Text;
using System.Text.Json;
using View_by_Distance.Save.Image.Info.Models;
using View_by_Distance.Shared.Models;
using View_by_Distance.Shared.Models.Methods;
namespace View_by_Distance.Save.Image.Info;
public class SaveImageInfo
{
private readonly AppSettings _AppSettings;
private readonly string _WorkingDirectory;
private readonly Configuration _Configuration;
private readonly IsEnvironment _IsEnvironment;
private readonly IConfigurationRoot _ConfigurationRoot;
private readonly Property.Models.Configuration _PropertyConfiguration;
public SaveImageInfo(List<string> args, IsEnvironment isEnvironment, IConfigurationRoot configurationRoot, AppSettings appSettings, string workingDirectory, bool isSilent, IConsole console)
{
if (isSilent)
{ }
if (console is null)
{ }
_AppSettings = appSettings;
_IsEnvironment = isEnvironment;
_WorkingDirectory = workingDirectory;
_ConfigurationRoot = configurationRoot;
ILogger? log = Log.ForContext<SaveImageInfo>();
Property.Models.Configuration propertyConfiguration = Property.Models.Binder.Configuration.Get(isEnvironment, configurationRoot);
Configuration configuration = Models.Binder.Configuration.Get(isEnvironment, configurationRoot, propertyConfiguration);
_PropertyConfiguration = propertyConfiguration;
_Configuration = configuration;
propertyConfiguration.Update();
log.Information(propertyConfiguration.RootDirectory);
Verify();
List<string> lines = SaveImageInfoFilesInDirectories(log);
File.WriteAllLines($"D:/Tmp/Phares/{DateTime.Now.Ticks}.tsv", lines);
if (!lines.Any())
_ = Shared.Models.Stateless.Methods.IPath.DeleteEmptyDirectories(propertyConfiguration.RootDirectory);
}
private void Verify()
{
if (_AppSettings is null)
{ }
if (_IsEnvironment is null)
{ }
if (_Configuration is null)
{ }
if (_ConfigurationRoot is null)
{ }
if (_WorkingDirectory is null)
{ }
if (_PropertyConfiguration is null)
{ }
}
private static StringBuilder GetLines(ProgressBar progressBar, List<string[]> filesCollection)
{
StringBuilder result = new();
string json;
string? directory;
ImageInfo imageInfo;
FileHolder[] fileHolders;
List<string> lines = new();
foreach (string[] files in filesCollection)
{
lines.Clear();
progressBar.Tick();
fileHolders = (from l in files select new FileHolder(l)).ToArray();
foreach (FileHolder fileHolder in from l in fileHolders orderby l.Name.Length, l.Name select l)
{
if (fileHolder.ExtensionLowered == ".id" || fileHolder.ExtensionLowered == ".lsv" || fileHolder.DirectoryName is null)
continue;
imageInfo = new(fileHolder.CreationTime, fileHolder.LastWriteTime, fileHolder.Length, fileHolder.Name);
json = JsonSerializer.Serialize(imageInfo);
lines.Add(json);
}
if (lines.Any())
{
directory = Path.GetDirectoryName(files.First());
if (directory is null)
continue;
_ = result.AppendLine(directory);
foreach (string line in lines)
_ = result.AppendLine(line);
}
}
return result;
}
private void Save(StringBuilder stringBuilder)
{
string checkFile = Path.Combine(_PropertyConfiguration.RootDirectory, ".json");
string text = stringBuilder.ToString();
_ = Shared.Models.Stateless.Methods.IPath.WriteAllText(checkFile, text, updateToWhenMatches: null, compareBeforeWrite: true, updateDateWhenMatches: false);
}
private List<string> SaveImageInfoFilesInDirectories(ILogger log)
{
List<string> results = new();
ProgressBar progressBar;
const string fileSearchFilter = "*";
string message = nameof(SaveImageInfo);
const string directorySearchFilter = "*";
List<string> distinctDirectories = new();
List<string[]> filesCollection = Shared.Models.Stateless.Methods.IDirectory.GetFilesCollection(_PropertyConfiguration.RootDirectory, directorySearchFilter, fileSearchFilter);
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
progressBar = new(filesCollection.Count, message, options);
StringBuilder lines = GetLines(progressBar, filesCollection);
progressBar.Dispose();
Save(lines);
return results;
}
}

View File

@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Log4netProvider": "Debug"
}
},
"Serilog": {
"MinimumLevel": "Debug"
}
}

View File

@ -0,0 +1,126 @@
{
"Company": "Mike Phares",
"Linux": {},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Log4netProvider": "Debug",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"MaxDegreeOfParallelism": 6,
"Serilog": {
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.File"
],
"MinimumLevel": "Information",
"WriteTo": [
{
"Name": "Debug",
"Args": {
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
}
},
{
"Name": "Console",
"Args": {
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"path": "%workingDirectory% - Log/log-.txt",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] ({SourceContext}.{MethodName}) ({InstanceId}) ({RemoteIpAddress}) {Message}{NewLine}{Exception}",
"rollingInterval": "Hour"
}
}
],
"Enrich": [
"FromLogContext",
"WithMachineName",
"WithThreadId"
],
"Properties": {
"Application": "Sample"
}
},
"WorkingDirectoryName": "PharesApps",
"Windows": {
"Configuration": {
"DateGroup": "dd514b88",
"DiffPropertyDirectory": "",
"FileNameDirectorySeparator": ".Z.",
"ForcePropertyLastWriteTimeToCreationTime": false,
"MaxImagesInDirectoryForTopLevelFirstPass": 10,
"OutputExtension": ".jpg",
"Pattern": "[^ABCDEFGHIJKLMNOPQRSTUVWXYZbcdfghjklmnpqrstvwxyz0-9]",
"PersonBirthdayFormat": "yyyy-MM-dd_HH",
"PopulatePropertyId": true,
"PropertiesChangedForProperty": false,
"ResultAllInOne": "_ _ _",
"ResultAllInOneSubdirectoryLength": 2,
"ResultCollection": "[]",
"ResultContent": "()",
"ResultSingleton": "{}",
"RootDirectory": "D:/Images",
"WriteBitmapDataBytes": false,
"IgnoreExtensions": [
".gif",
".GIF",
".nef",
".NEF",
".pdf",
".PDF"
],
"ValidImageFormatExtensions": [
".bmp",
".BMP",
".gif",
".GIF",
".jpeg",
".JPEG",
".jpg",
".JPG",
".png",
".PNG",
".tiff",
".TIFF",
".tif",
".TIF"
],
"ValidMetadataExtensions": [
".3gp",
".3GP",
".avi",
".AVI",
".bmp",
".BMP",
".gif",
".GIF",
".ico",
".ICO",
".jpeg",
".JPEG",
".jpg",
".JPG",
".m4v",
".M4V",
".mov",
".MOV",
".mp4",
".MP4",
".mta",
".MTA",
".png",
".PNG",
".tiff",
".TIFF",
".tif",
".TIF"
]
}
}
}

View File

@ -292,16 +292,29 @@ internal abstract class XPath
continue;
collection.Clear();
for (int i = 0; i < plusOne; i++)
{
if (string.IsNullOrEmpty(key))
{
if (i == converted)
checkDirectory = Path.GetFullPath(Path.Combine(resultsFullGroupDirectory, new('-', propertyConfiguration.ResultAllInOneSubdirectoryLength)));
else
checkDirectory = Path.GetFullPath(Path.Combine(resultsFullGroupDirectory, i.ToString().PadLeft(propertyConfiguration.ResultAllInOneSubdirectoryLength, '0')));
}
else
{
if (i == converted)
checkDirectory = Path.GetFullPath(Path.Combine(resultsFullGroupDirectory, key, propertyConfiguration.ResultAllInOne, new('-', propertyConfiguration.ResultAllInOneSubdirectoryLength)));
else
checkDirectory = Path.GetFullPath(Path.Combine(resultsFullGroupDirectory, key, propertyConfiguration.ResultAllInOne, i.ToString().PadLeft(propertyConfiguration.ResultAllInOneSubdirectoryLength, '0')));
}
if (!Directory.Exists(checkDirectory))
_ = Directory.CreateDirectory(checkDirectory);
collection.Add(checkDirectory);
}
if (!string.IsNullOrEmpty(key))
results.Add(key, collection.ToArray());
else
results.Add(propertyConfiguration.ResultAllInOne, collection.ToArray());
}
}
return results;

View File

@ -51,6 +51,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rename", "Rename\Rename.csp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Resize", "Resize\Resize.csproj", "{27D0D869-394D-4B07-83DF-2095B16026FC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Save-Image-Info", "Save-Image-Info\Save-Image-Info.csproj", "{22B8C2B6-2D6E-4166-86CD-D37D11617A79}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Set-Created-Date", "Set-Created-Date\Set-Created-Date.csproj", "{B067643E-9F59-46A1-A001-ACF4661F059C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{B4FB6B43-36EC-404D-B934-5C695C6E32CC}"
@ -190,5 +192,9 @@ Global
{B067643E-9F59-46A1-A001-ACF4661F059C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B067643E-9F59-46A1-A001-ACF4661F059C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B067643E-9F59-46A1-A001-ACF4661F059C}.Release|Any CPU.Build.0 = Release|Any CPU
{22B8C2B6-2D6E-4166-86CD-D37D11617A79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22B8C2B6-2D6E-4166-86CD-D37D11617A79}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22B8C2B6-2D6E-4166-86CD-D37D11617A79}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22B8C2B6-2D6E-4166-86CD-D37D11617A79}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal