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

@@ -33,7 +33,7 @@ namespace SabreTools.IO.Writers
public void WriteSection(string value)
{
if (string.IsNullOrWhiteSpace(value))
throw new ArgumentException(nameof(value));
throw new ArgumentException("Section tag cannot be null or empty", nameof(value));
sw.WriteLine($"[{value.TrimStart('[').TrimEnd(']')}]");
}
@@ -44,11 +44,9 @@ namespace SabreTools.IO.Writers
public void WriteKeyValuePair(string key, string value)
{
if (string.IsNullOrWhiteSpace(key))
throw new ArgumentException(nameof(key));
if (value == null)
value = string.Empty;
throw new ArgumentException("Key cannot be null or empty", nameof(key));
value ??= string.Empty;
sw.WriteLine($"{key}={value}");
}
@@ -57,9 +55,7 @@ namespace SabreTools.IO.Writers
/// </summary>
public void WriteComment(string value)
{
if (value == null)
value = string.Empty;
value ??= string.Empty;
sw.WriteLine($";{value}");
}
@@ -68,9 +64,7 @@ namespace SabreTools.IO.Writers
/// </summary>
public void WriteString(string value)
{
if (value == null)
value = string.Empty;
value ??= string.Empty;
sw.Write(value);
}