feat: add config instance.

This commit is contained in:
Tungdv
2026-03-09 19:28:45 +07:00
parent e9a909fa35
commit 51667e8867
12 changed files with 2528 additions and 13 deletions
@@ -256,5 +256,66 @@ namespace BrewMonster.Common
public bool IsEnd() { return m_Script.pCurIndex >= m_Script.pFileBuf.Length; }
// Get current line
public int GetCurLine() { return m_Script.iLine; }
/* Search specified token. This function get next token and check whether it match
specified string, if match, then stop and return true, otherwise get next token
again until all file is checked or token is found.
Note: This will be crossing-line search.
Return true for success, otherwise return false.
wszToken: specified token will be searched
bCaseSensitive: true, case sensitive
*/
public bool MatchToken(ushort[] wszToken, bool bCaseSensitive)
{
while (GetNextToken(true))
{
if (bCaseSensitive)
{
if (string.Compare(ByteToStringUtils.UshortArrayToUnicodeString(m_szToken),
ByteToStringUtils.UshortArrayToUnicodeString(wszToken),
StringComparison.Ordinal) == 0)
{
return true;
}
}
else
{
if (string.Compare(ByteToStringUtils.UshortArrayToUnicodeString(m_szToken),
ByteToStringUtils.UshortArrayToUnicodeString(wszToken),
StringComparison.OrdinalIgnoreCase) == 0)
{
return true;
}
}
}
return false;
}
public bool MatchToken(string wszToken, bool bCaseSensitive)
{
while (GetNextToken(true))
{
if (bCaseSensitive)
{
if (string.Compare(ByteToStringUtils.UshortArrayToUnicodeString(m_szToken),
wszToken, StringComparison.Ordinal) == 0)
{
return true;
}
}
else
{
if (string.Compare(ByteToStringUtils.UshortArrayToUnicodeString(m_szToken),
wszToken, StringComparison.OrdinalIgnoreCase) == 0)
{
return true;
}
}
}
return false;
}
}
}