예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <summary>
        ///     Called when a <see cref="ExecuteAdminCommandMessage"/> is received.
        /// </summary>
        private void ExecuteAdminCommandMessageReceived(ExecuteAdminCommandMessage message)
        {
            byte[] sessionId = message.RemoveSessionId();

            if (NetAvatarSessionManager.TryGet(sessionId, out NetAvatarSession session))
            {
                AdminCommand adminCommand = message.RemoveDebugCommand();

                if (adminCommand.GetServiceNodeType() == ServiceCore.ServiceNodeType)
                {
                    switch (adminCommand.GetCommandType())
                    {
                    default:
                        Logging.Print(string.Format("executeAdminCommandMessageReceived unknown debug command received ({0})", adminCommand.GetCommandType()));
                        break;
                    }
                }
                else
                {
                    Logging.Print(string.Format("executeAdminCommandMessageReceived invalid debug command received ({0})", adminCommand.GetCommandType()));
                }
            }
        }