public void ParseSerializeData(CCCommunicateClass.Seria_BaseMessage obj) { base.ParseSerializeData(obj as CCCommunicateClass.Seria_ParamPackage); BaseMessageType tmpObj = new BaseMessageType(); tmpObj.ParseSerializeData(obj.MessageType); this.mMessageType = tmpObj; }
public void RegistMessage(BaseMessageType typMsg, Type t_Msg) { if ((null != typMsg) && (!mTypTable.ContainsKey(typMsg.Id))) { mTypTable.Add(typMsg.Id, t_Msg); } else { throw new InvalidOperationException("已经注册的消息类型: " + typMsg.Id); } }
public BaseMessage CreateMessage(BaseMessageType typMsg) { if ((null != typMsg) && (mTypTable.ContainsKey(typMsg.Id))) { BaseMessage msg = Activator.CreateInstance(mTypTable[typMsg.Id] as Type) as BaseMessage; msg.Type = typMsg; return(msg); } else { throw new InvalidOperationException("未知的消息类型: " + typMsg.Id); } }
public BaseMessage(BaseMessageType t_msg) { mMessageType = t_msg; }