Perform mass cleanup

This is cleanup based on both new .NET functionality (in 6 and 7) as well as a ton of simplifications and things that were missed that were caught due to the cleanup.
This commit is contained in:
Matt Nadareski
2023-04-19 16:39:58 -04:00
parent fd5fd79b95
commit 728b5d6b27
95 changed files with 1353 additions and 1572 deletions

View File

@@ -21,7 +21,7 @@ namespace SabreTools.IO
/// <returns>List of strings representing just directories from the inputs</returns>
public static List<ParentablePath> GetDirectoriesOnly(List<string> inputs, bool appendparent = false)
{
List<ParentablePath> outputs = new List<ParentablePath>();
List<ParentablePath> outputs = new();
for (int i = 0; i < inputs.Count; i++)
{
string input = inputs[i];
@@ -32,10 +32,10 @@ namespace SabreTools.IO
// If we have a wildcard
string pattern = "*";
if (input.Contains("*") || input.Contains("?"))
if (input.Contains('*') || input.Contains('?'))
{
pattern = Path.GetFileName(input);
input = input.Substring(0, input.Length - pattern.Length);
input = input[..^pattern.Length];
}
// Get the parent path in case of appending
@@ -96,7 +96,7 @@ namespace SabreTools.IO
/// <returns>List of strings representing just files from the inputs</returns>
public static List<ParentablePath> GetFilesOnly(List<string> inputs, bool appendparent = false)
{
List<ParentablePath> outputs = new List<ParentablePath>();
List<ParentablePath> outputs = new();
for (int i = 0; i < inputs.Count; i++)
{
string input = inputs[i].Trim('"');
@@ -107,10 +107,10 @@ namespace SabreTools.IO
// If we have a wildcard
string pattern = "*";
if (input.Contains("*") || input.Contains("?"))
if (input.Contains('*') || input.Contains('?'))
{
pattern = Path.GetFileName(input);
input = input.Substring(0, input.Length - pattern.Length);
input = input[..^pattern.Length];
}
// Get the parent path in case of appending