editorconfig
This commit is contained in:
2023-10-20 19:37:19 -07:00
parent b54ea97c67
commit a4a92aacd2
68 changed files with 703 additions and 553 deletions

View File

@ -45,7 +45,7 @@ public class MoveById
MatchNginx[]? matchNginxCollection = System.Text.Json.JsonSerializer.Deserialize<MatchNginx[]>(json);
if (matchNginxCollection is null)
throw new NullReferenceException(nameof(matchNginxCollection));
if (matchNginxCollection.Any())
if (matchNginxCollection.Length != 0)
{
List<string> lines = MoveFilesByIdInDirectories(options, matchNginxCollection);
File.WriteAllLines($"D:/Tmp/Phares/{DateTime.Now.Ticks}.tsv", lines);
@ -70,7 +70,7 @@ public class MoveById
private static List<string> GetAllFiles(MatchNginx[] matchNginxCollection)
{
List<string> allFiles = new();
List<string> allFiles = [];
string[] files;
string directoryName;
ReadOnlySpan<char> span;
@ -101,7 +101,7 @@ public class MoveById
private List<string> GetToDoCollection(ProgressBar progressBar, List<string> allFiles)
{
List<string> results = new();
List<string> results = [];
int? id;
string? message;
string[] matches;
@ -136,7 +136,7 @@ public class MoveById
if (id is null)
continue;
matches = (from l in allFiles where l.Contains($"{id}{fileHolder.ExtensionLowered}") select l).ToArray();
if (!matches.Any())
if (matches.Length == 0)
continue;
results.Add(fileHolder.FullName);
results.AddRange(matches);
@ -156,16 +156,16 @@ public class MoveById
private List<string> MoveFilesByIdInDirectories(ProgressBarOptions options, MatchNginx[] matchNginxCollection)
{
List<string> results = new();
List<string> results = [];
string moveTo;
string? directory;
string message = "Moving allFiles";
List<string> distinctDirectories = new();
List<string> distinctDirectories = [];
List<string> allFiles = GetAllFiles(matchNginxCollection);
ProgressBar progressBar = new(allFiles.Count, message, options);
List<string> toDoCollection = GetToDoCollection(progressBar, allFiles);
progressBar.Dispose();
List<(string, string)> moveCollection = new();
List<(string, string)> moveCollection = [];
foreach (string file in toDoCollection)
{
moveTo = $"{_AppSettings.MoveTo}{file[1..]}";