Mass push
This commit is contained in:
.vscode
Compare
Date-Group
Delete-By-Relative
.vscode
Delete-By-Relative.csprojDeleteByRelative.csModels
Program.csappsettings.Development.jsonappsettings.jsonDistance
Drag-Drop
Duplicate-Search
.vscode
Duplicate-Search.csprojDuplicateSearch.csModels
Program.csappsettings.Development.jsonappsettings.jsonFace
FaceParts
FaceRecognitionDotNet
Instance
DlibDotNet.csInstance.csproj
Models
Program.csappsettings.Development.jsonappsettings.Staging.jsonappsettings.jsonMap
Metadata
Not-Copy-Copy
PrepareForOld
Property-Compare
Property
Models
Property.csprojResize
Shared
Models
FaceDistance.csFileHolder.csItem.csLocation.csMapping.csMarker.csMarkerWith.cs
View-by-Distance.Shared.csprojProperties
IFaceDistance.csIItem.csIMapping.csIProperty.csIPropertyConfiguration.csIRelativeLocation.csISorting.cs
Property.csRelativeLocation.csSorting.csSortingContainer.csStateless
Tests
Models
Tests.csprojUnitTestCalculations.csUnitTestExample.csUnitTestIsEnvironment.csUnitTestResize.csTestsWithFaceRecognitionDotNet
View-by-Distance-MKLink-Console.sln
70
Delete-By-Relative/Program.cs
Normal file
70
Delete-By-Relative/Program.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Phares.Shared;
|
||||
using Serilog;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using View_by_Distance.Delete.By.Relative.Models;
|
||||
using View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
|
||||
namespace View_by_Distance.Delete.By.Relative;
|
||||
|
||||
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);
|
||||
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 DeleteByRelative(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>());
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user