/// <summary> /// /// </summary> /// <param name="buf"></param> /// <param name="ofs"></param> /// <param name="len"></param> /// <returns></returns> /// public void DispatchMessage(byte[] buf, ushort ofs, ushort len, object state = null) { if (buf == null) { throw new ArgumentNullException("buf"); } if (len == 0) // actually, len should be >= header size... { throw new ArgumentException("len", "len must be nonzero"); } byte rawOpcode = TransportProtocol.GetMessageOpcode(buf, ofs); if (!Enum.IsDefined(typeof(AURAMsgOpcode), rawOpcode)) { throw new InvalidOperationException(string.Format("MessageFactory.DispatchMessage(): opcode 0x{0:x2} unknown", rawOpcode)); } AURAMsgOpcode opcode = (AURAMsgOpcode)rawOpcode; MsgInfo msgInfo = null; if (!msgHandlerMap_.TryGetValue(opcode, out msgInfo)) { throw new InvalidOperationException(string.Format("MessageFactory.DispatchMessage(): no handler registered for {0}", opcode)); } msgInfo.ReconstituteAndDispatchMessage(buf, ofs, len, state); }
public AURAMessageAttribute(AURAMsgOpcode opcode) { Opcode = opcode; }
public MsgInfo2ParamHandler(AURAMsgOpcode opcode, ConstructorInfo ci, Action <AURAAppMessage, object> handler) : base(opcode, ci) { msgHandler_ = handler; }
public MsgInfo(AURAMsgOpcode opcode, ConstructorInfo ci) { Opcode = opcode; ctorInfo_ = ci; }