Merge Kristy Files
This commit is contained in:
@ -87,6 +87,8 @@ public class CopyDistinct
|
||||
}
|
||||
}
|
||||
}
|
||||
if (move && _AppSettings.IfCanUseId)
|
||||
throw new NotSupportedException("Not allowed because it would irreversible!");
|
||||
return (move, filesCollection, anyLenFiles, moveBack);
|
||||
}
|
||||
|
||||
@ -128,9 +130,6 @@ public class CopyDistinct
|
||||
distinctFound.Add(file);
|
||||
}
|
||||
}
|
||||
if (distinctNeeded.Count != distinctFound.Count)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (string[] files in filesCollection)
|
||||
@ -176,7 +175,7 @@ public class CopyDistinct
|
||||
progressBar = new(count, message, options);
|
||||
string key = string.IsNullOrEmpty(_AppSettings.ResultDirectoryKey) ? _PropertyConfiguration.ResultAllInOne : _AppSettings.ResultDirectoryKey;
|
||||
string[] directories = _FileGroups[key];
|
||||
(distinctDirectories, toDoCollection) = Shared.Models.Stateless.Methods.IDirectory.GetToDoCollection(_PropertyConfiguration, _AppSettings.CopyDuplicates, filesCollection, directories, () => progressBar.Tick());
|
||||
(distinctDirectories, toDoCollection) = Shared.Models.Stateless.Methods.IDirectory.GetToDoCollection(_PropertyConfiguration, _AppSettings.CopyDuplicates, _AppSettings.IfCanUseId, filesCollection, directories, () => progressBar.Tick());
|
||||
progressBar.Dispose();
|
||||
}
|
||||
foreach (string distinctDirectory in distinctDirectories)
|
||||
|
@ -1,10 +1,12 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Copy.Distinct.Models;
|
||||
|
||||
public record AppSettings(string Company,
|
||||
bool CopyDuplicates,
|
||||
string CopyTo,
|
||||
bool IfCanUseId,
|
||||
int MaxDegreeOfParallelism,
|
||||
string ResultDirectoryKey,
|
||||
string WorkingDirectoryName)
|
||||
@ -12,8 +14,14 @@ public record AppSettings(string Company,
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
string result = JsonSerializer.Serialize(this, AppSettingsSourceGenerationContext.Default.AppSettings);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(AppSettings))]
|
||||
internal partial class AppSettingsSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace View_by_Distance.Copy.Distinct.Models.Binder;
|
||||
|
||||
@ -7,15 +8,16 @@ public class AppSettings
|
||||
{
|
||||
|
||||
public string? Company { get; set; }
|
||||
public int? MaxDegreeOfParallelism { get; set; }
|
||||
public bool? CopyDuplicates { get; set; }
|
||||
public string? CopyTo { get; set; }
|
||||
public string? ResultDirectoryKey { init; get; }
|
||||
public bool? IfCanUseId { get; set; }
|
||||
public int? MaxDegreeOfParallelism { get; set; }
|
||||
public string? ResultDirectoryKey { get; set; }
|
||||
public string? WorkingDirectoryName { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = JsonSerializer.Serialize(this, new JsonSerializerOptions() { WriteIndented = true });
|
||||
string result = JsonSerializer.Serialize(this, BinderAppSettingsSourceGenerationContext.Default.AppSettings);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -28,6 +30,8 @@ public class AppSettings
|
||||
throw new NullReferenceException(nameof(appSettings.CopyDuplicates));
|
||||
if (appSettings?.CopyTo is null)
|
||||
throw new NullReferenceException(nameof(appSettings.CopyTo));
|
||||
if (appSettings?.IfCanUseId is null)
|
||||
throw new NullReferenceException(nameof(appSettings.IfCanUseId));
|
||||
if (appSettings?.MaxDegreeOfParallelism is null)
|
||||
throw new NullReferenceException(nameof(appSettings.MaxDegreeOfParallelism));
|
||||
if (appSettings?.ResultDirectoryKey is null)
|
||||
@ -38,6 +42,7 @@ public class AppSettings
|
||||
appSettings.Company,
|
||||
appSettings.CopyDuplicates.Value,
|
||||
appSettings.CopyTo,
|
||||
appSettings.IfCanUseId.Value,
|
||||
appSettings.MaxDegreeOfParallelism.Value,
|
||||
appSettings.ResultDirectoryKey,
|
||||
appSettings.WorkingDirectoryName
|
||||
@ -48,9 +53,17 @@ public class AppSettings
|
||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||
{
|
||||
Models.AppSettings result;
|
||||
#pragma warning disable IL3050, IL2026
|
||||
AppSettings? appSettings = configurationRoot.Get<AppSettings>();
|
||||
#pragma warning restore IL3050, IL2026
|
||||
result = Get(appSettings);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(WriteIndented = true)]
|
||||
[JsonSerializable(typeof(AppSettings))]
|
||||
internal partial class BinderAppSettingsSourceGenerationContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
"Company": "Mike Phares",
|
||||
"CopyDuplicates": true,
|
||||
"CopyTo": "",
|
||||
"IfCanUseId": true,
|
||||
"Linux": {},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
|
Reference in New Issue
Block a user