feat: add config instance.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user