Esempio n. 1
0
    private void handleMessage(string msgBody)
    {
        if (msgBody.Length >= 4)
        {
            string msgType = msgBody.Substring(0, 3);
            string tmpStr  = msgBody.Substring(4);

            int locoffset = tmpStr.IndexOf('|');

            if (locoffset != -1)
            {
                string msgLocation = tmpStr.Substring(0, locoffset);
                string msgText     = tmpStr.Substring(locoffset + 1);

                mEvents.onMessage(msgType, msgLocation, msgText);
            }
            else
            {
                // ignore incorrectly formatted messages
            }
        }
        else
        {
            // ignore too short messages
        }
    }