mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Remove .NET Framework 4.6.2/4.7.2 (#24)
* Remove < .NET 4.8, general cleanup * Abstract * Tango * Banner * Scan no more * Common * Application * Access * Filter-feeder * Graffiti * Paint-over * Law and Order * XOR-o * Unused staircase * Maybe * Maybe not * Delete this * The word is "no" * Emit * Improper * Aye aye * Fence * Barrier * Monkey * Pail * Lines
This commit is contained in:
@@ -128,7 +128,7 @@ namespace SabreTools.Library.Readers
|
||||
{
|
||||
GroupCollection gc = Regex.Match(line, Constants.InternalPatternCMP).Groups;
|
||||
string normalizedValue = gc[1].Value.ToLowerInvariant();
|
||||
string[] linegc = Utilities.SplitLineAsCMP(gc[2].Value);
|
||||
string[] linegc = SplitLineAsCMP(gc[2].Value);
|
||||
|
||||
Internal = new Dictionary<string, string>();
|
||||
for (int i = 0; i < linegc.Length; i++)
|
||||
@@ -225,6 +225,32 @@ namespace SabreTools.Library.Readers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Split a line as if it were a CMP rom line
|
||||
/// </summary>
|
||||
/// <param name="s">Line to split</param>
|
||||
/// <returns>Line split</returns>
|
||||
/// <remarks>Uses code from http://stackoverflow.com/questions/554013/regular-expression-to-split-on-spaces-unless-in-quotes</remarks>
|
||||
private string[] SplitLineAsCMP(string s)
|
||||
{
|
||||
// Get the opening and closing brace locations
|
||||
int openParenLoc = s.IndexOf('(');
|
||||
int closeParenLoc = s.LastIndexOf(')');
|
||||
|
||||
// Now remove anything outside of those braces, including the braces
|
||||
s = s.Substring(openParenLoc + 1, closeParenLoc - openParenLoc - 1);
|
||||
s = s.Trim();
|
||||
|
||||
// Now we get each string, divided up as cleanly as possible
|
||||
string[] matches = Regex
|
||||
.Matches(s, Constants.InternalPatternAttributesCMP)
|
||||
.Cast<Match>()
|
||||
.Select(m => m.Groups[0].Value)
|
||||
.ToArray();
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dispose of the underlying reader
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user