/// <summary> /// Registers the cmd. /// </summary> /// <param name="szCmd">Size cmd.</param> /// <param name="callback">Callback.</param> protected void RegisterCmd(string szCmd, ParseCmd callback) { if (!m_dCmdParse.ContainsKey(szCmd)) { m_dCmdParse.Add(szCmd, callback); } }
private void parseString(string str) { bool pend = false; int pos = 0; int length = str.Length; string tmp = ""; string cmd = ""; ParseCmd pCmd = ParseCmd.ParseString; while (pos < length) { char c = str[pos++]; switch (c) { case '[': pCmd = ParseCmd.ParseStart; continue; break; case ']': pCmd = ParseCmd.ParseEnd; continue; break; default: switch (pCmd) { case ParseCmd.ParseStart: cmd += c; break; case ParseCmd.ParseEnd: tmp += ParseCmd(cmd); break; case ParseCmd.ParseString: tmp += c; break; } break; } } }