diff --git a/SabreTools.Library/IO/ClrMameProReader.cs b/SabreTools.Library/IO/ClrMameProReader.cs
index 124c7654..c54953fc 100644
--- a/SabreTools.Library/IO/ClrMameProReader.cs
+++ b/SabreTools.Library/IO/ClrMameProReader.cs
@@ -14,7 +14,7 @@ namespace SabreTools.Library.IO
///
/// Internal stream reader for inputting
///
- private StreamReader sr;
+ private readonly StreamReader sr;
///
/// Contents of the current line, unprocessed
@@ -104,26 +104,24 @@ namespace SabreTools.Library.IO
CurrentLine = sr.ReadLine().Trim();
LineNumber++;
-
- // TODO: Act like IniReader here
- ProcessLine(CurrentLine);
+ ProcessLine();
return true;
}
///
/// Process the current line and extract out values
///
- private void ProcessLine(string line)
+ private void ProcessLine()
{
// Standalone (special case for DC dats)
- if (line.StartsWith("Name:"))
+ if (CurrentLine.StartsWith("Name:"))
{
- string temp = line.Substring("Name:".Length).Trim();
- line = $"Name: {temp}";
+ string temp = CurrentLine.Substring("Name:".Length).Trim();
+ CurrentLine = $"Name: {temp}";
}
// Comment
- if (line.StartsWith("#"))
+ if (CurrentLine.StartsWith("#"))
{
Internal = null;
InternalName = null;
@@ -132,9 +130,9 @@ namespace SabreTools.Library.IO
}
// Top-level
- else if (Regex.IsMatch(line, Constants.HeaderPatternCMP))
+ else if (Regex.IsMatch(CurrentLine, Constants.HeaderPatternCMP))
{
- GroupCollection gc = Regex.Match(line, Constants.HeaderPatternCMP).Groups;
+ GroupCollection gc = Regex.Match(CurrentLine, Constants.HeaderPatternCMP).Groups;
string normalizedValue = gc[1].Value.ToLowerInvariant();
Internal = null;
@@ -145,9 +143,9 @@ namespace SabreTools.Library.IO
}
// Internal
- else if (Regex.IsMatch(line, Constants.InternalPatternCMP))
+ else if (Regex.IsMatch(CurrentLine, Constants.InternalPatternCMP))
{
- GroupCollection gc = Regex.Match(line, Constants.InternalPatternCMP).Groups;
+ GroupCollection gc = Regex.Match(CurrentLine, Constants.InternalPatternCMP).Groups;
string normalizedValue = gc[1].Value.ToLowerInvariant();
string[] linegc = SplitLineAsCMP(gc[2].Value);
@@ -234,9 +232,9 @@ namespace SabreTools.Library.IO
}
// Standalone
- else if (Regex.IsMatch(line, Constants.ItemPatternCMP))
+ else if (Regex.IsMatch(CurrentLine, Constants.ItemPatternCMP))
{
- GroupCollection gc = Regex.Match(line, Constants.ItemPatternCMP).Groups;
+ GroupCollection gc = Regex.Match(CurrentLine, Constants.ItemPatternCMP).Groups;
string itemval = gc[2].Value.Replace("\"", string.Empty);
Internal = null;
@@ -246,7 +244,7 @@ namespace SabreTools.Library.IO
}
// End section
- else if (Regex.IsMatch(line, Constants.EndPatternCMP))
+ else if (Regex.IsMatch(CurrentLine, Constants.EndPatternCMP))
{
Internal = null;
InternalName = null;
diff --git a/SabreTools.Library/IO/IniReader.cs b/SabreTools.Library/IO/IniReader.cs
index d946cb28..fa092689 100644
--- a/SabreTools.Library/IO/IniReader.cs
+++ b/SabreTools.Library/IO/IniReader.cs
@@ -11,7 +11,7 @@ namespace SabreTools.Library.IO
///
/// Internal stream reader for inputting
///
- private StreamReader sr;
+ private readonly StreamReader sr;
///
/// Get if at end of stream
diff --git a/SabreTools.Library/IO/SeparatedValueReader.cs b/SabreTools.Library/IO/SeparatedValueReader.cs
index cfe0941a..8064b14d 100644
--- a/SabreTools.Library/IO/SeparatedValueReader.cs
+++ b/SabreTools.Library/IO/SeparatedValueReader.cs
@@ -12,7 +12,7 @@ namespace SabreTools.Library.IO
///
/// Internal stream reader for inputting
///
- private StreamReader sr;
+ private readonly StreamReader sr;
///
/// Internal value to say how many fields should be written