コード例 #1
0
        /// <summary>
        ///     Decodes this instance.
        /// </summary>
        public override void Decode()
        {
            base.Decode();
            this._adminCommand = AdminCommandFactory.CreateDebugCommandByType(this.Stream.ReadVInt());

            if (this._adminCommand != null)
            {
                this._adminCommand.Decode(this.Stream);
            }
        }
コード例 #2
0
ファイル: MessageManager.cs プロジェクト: NotHuza/Cerberus-v4
        /// <summary>
        ///     Called when a <see cref="SendGlobalChatLineMessage"/> is received.
        /// </summary>
        private void SendGlobalChatLineMessageReceived(SendGlobalChatLineMessage message)
        {
            string chatMessage = message.RemoveMessage();

            if (chatMessage.StartsWith("/admin ", StringComparison.InvariantCultureIgnoreCase))
            {
                AdminCommand adminCommand = AdminCommandFactory.CreateDebugCommandByName(chatMessage.Substring(7).ToLowerInvariant());

                if (adminCommand != null)
                {
                    if (adminCommand.GetServiceNodeType() != -1)
                    {
                        ExecuteAdminCommandMessage executeAdminCommandMessage = new ExecuteAdminCommandMessage();
                        executeAdminCommandMessage.SetDebugCommand(adminCommand);
                        this._session.SendMessage(adminCommand.GetServiceNodeType(), executeAdminCommandMessage);
                        return;
                    }
                }
            }

            this._session.Room.ReceiveMessage(this._session.AvatarEntry, chatMessage);
        }