示例#1
0
 private void m_OnDataReceived(byte[] data, int offset, int length)
 {
     while (true)
     {
         if (this.CommandReader == null)
         {
             return;
         }
         int             rest;
         BaseCommandInfo commandInfo = this.CommandReader.GetCommandInfo(data, offset, length, out rest);
         if (this.CommandReader.NextCommandReader != null)
         {
             this.CommandReader = this.CommandReader.NextCommandReader;
         }
         if (commandInfo != null)
         {
             this.ExecuteCommand(commandInfo);
         }
         if (rest <= 0)
         {
             return;
         }
         offset = (offset + length) - rest;
         length = rest;
     }
 }
示例#2
0
        private void ExecuteCommand(BaseCommandInfo commandInfo)
        {
            ICommand <ChatEngine, BaseCommandInfo> command;

            if (this.m_CommandDict.TryGetValue(commandInfo.Key, out command))
            {
                command.ExecuteCommand(this, commandInfo);
            }
        }