removed debug code and fixed some bugs
This commit is contained in:
@@ -16,9 +16,6 @@ public class SaveParserEU4
|
||||
private readonly ObjectPool<StringBuilder> _stringBuilderPool;
|
||||
private ISearchExpression? _searchExprCurrent;
|
||||
|
||||
public int SBPoolGetCount = 0;
|
||||
public int SBPoolReturnCount = 0;
|
||||
|
||||
/// <param name="savefile">
|
||||
/// Uncompressed stream of <c>gamestate</c> file which can be extracted from save archive
|
||||
/// </param>
|
||||
@@ -50,7 +47,6 @@ public class SaveParserEU4
|
||||
throw new Exception($"Invalid gamestate header. Expected '{expectedHeader}', got '{headStr}'.");
|
||||
|
||||
StringBuilder strb = _stringBuilderPool.Get();
|
||||
SBPoolGetCount++;
|
||||
int line = 2;
|
||||
int column = 0;
|
||||
bool isQuoteOpen = false;
|
||||
@@ -80,7 +76,6 @@ public class SaveParserEU4
|
||||
value = strb,
|
||||
};
|
||||
strb = _stringBuilderPool.Get();
|
||||
SBPoolGetCount++;
|
||||
isStrInQuotes = false;
|
||||
return true;
|
||||
}
|
||||
@@ -95,7 +90,6 @@ public class SaveParserEU4
|
||||
if (TryCompleteStringToken())
|
||||
yield return strToken;
|
||||
_stringBuilderPool.Return(strb);
|
||||
SBPoolReturnCount++;
|
||||
yield break;
|
||||
case '\"':
|
||||
isQuoteOpen = !isQuoteOpen;
|
||||
@@ -150,7 +144,6 @@ public class SaveParserEU4
|
||||
}
|
||||
|
||||
_stringBuilderPool.Return(strb);
|
||||
SBPoolReturnCount++;
|
||||
}
|
||||
|
||||
|
||||
@@ -161,9 +154,12 @@ public class SaveParserEU4
|
||||
switch (tok.type)
|
||||
{
|
||||
case TokenType.StringOrNumber:
|
||||
string tokStr = tok.value!.ToString();
|
||||
// string values can be empty
|
||||
if(tok.value!.Length == 0)
|
||||
return string.Empty;
|
||||
|
||||
string tokStr = tok.value.ToString();
|
||||
_stringBuilderPool.Return(tok.value);
|
||||
SBPoolReturnCount++;
|
||||
if (tokStr[0] != '-' && !char.IsDigit(tokStr[0]))
|
||||
return tokStr;
|
||||
if (tokStr.Contains('.') && double.TryParse(tokStr, out double d))
|
||||
@@ -194,7 +190,6 @@ public class SaveParserEU4
|
||||
return true;
|
||||
case TokenType.StringOrNumber:
|
||||
_stringBuilderPool.Return(tok.value!);
|
||||
SBPoolReturnCount++;
|
||||
return true;
|
||||
case TokenType.Equals:
|
||||
return true;
|
||||
@@ -218,7 +213,6 @@ public class SaveParserEU4
|
||||
else if (tok.type == TokenType.StringOrNumber)
|
||||
{
|
||||
_stringBuilderPool.Return(tok.value!);
|
||||
SBPoolReturnCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -302,7 +296,6 @@ public class SaveParserEU4
|
||||
{
|
||||
SkipValue();
|
||||
_stringBuilderPool.Return(keySB);
|
||||
SBPoolReturnCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -315,7 +308,6 @@ public class SaveParserEU4
|
||||
|
||||
string keyStr = keySB.ToString();
|
||||
_stringBuilderPool.Return(keySB);
|
||||
SBPoolReturnCount++;
|
||||
if (!dict.TryGetValue(keyStr, out var list))
|
||||
{
|
||||
list = new List<object>();
|
||||
|
||||
Reference in New Issue
Block a user