Exemplo n.º 1
0
        public void SendCmd(MessageCmdData data) // Make it Ob's name is the message.
        {
            string     name   = MessageCmdDataNameDB.GetCmdName(data.GetType());
            MessageCmd msgCmd = new MessageCmd(name, data);

            m_server.SendCmd("client", m_id, msgCmd);
        }
Exemplo n.º 2
0
        public void RegisterCmdHandler <T>(TypedCmdEventHandler <T> callback) where T : MessageCmdData
        {
            string name = MessageCmdDataNameDB.GetCmdName(typeof(T));

            if (name == null)
            {
                throw new System.InvalidOperationException("no CmdNameAttribute on " + typeof(T).Name);
            }
            CmdConverter <T> converter = new CmdConverter <T>(callback);

            m_handlers[name] = converter.Callback;
            m_mcdc.RegisterCreator(typeof(T));
        }