public override bool Check(ActionParameter parameter) { string message = null; if (Packet.Data.TryReadString(ref message)) { parameter["message"] = message; return(true); } return(false); }
public override bool SendProcess(ActionParameter parameter) { string message = parameter.GetValue <string>("message"); if (string.IsNullOrEmpty(message)) { return(false); } Packet.Data.WriteValue(message); return(true); }
public override bool SendProcess(ActionParameter parameter) { string message = null; if (parameter.TryGetValue("message", ref message) && string.IsNullOrEmpty(message)) { return(false); } Packet.Data.WriteValue(message); return(true); }
public override bool ReceiveProcess(ActionParameter parameter) { string message = null; if (Packet.Data.TryReadString(ref message)) { parameter["message"] = message; return(true); } else { return(false); } }
public override bool ReceiveProcess(ActionParameter parameter) { List <string> onlineList = null; if (Packet.Data.TryObject(ref onlineList)) { parameter["onlineList"] = onlineList; return(true); } else { return(false); } }
public override bool Process(ActionParameter parameter) { string message = "【系统通知】 " + parameter.GetValue <string>("message"); DynamicBuffer buffer = new DynamicBuffer(); buffer.WriteValue(message); DataPackage packet = new DataPackage(buffer, 100); foreach (var session in SessionClientPool.GetOnlineSession()) { session.Send(packet); } return(true); }
public override bool Process(ActionParameter parameter) { List <string> onlineList = new List <string>(); foreach (var session in SessionClientPool.GetOnlineSession()) { onlineList.Add(session.GetRemoteAddress()); } DynamicBuffer buffer = new DynamicBuffer(0); buffer.WriteObject(onlineList); DataPackage packet = new DataPackage(buffer, 100); Session.Send(packet); return(true); }
/// <summary> /// 数据包处理过程 /// </summary> public void Process(DataPackage packet) { if (!actions.ContainsKey(packet.PacketType)) { return; } ActionParameter parameter = new ActionParameter(); ActionBase handler = actions[packet.PacketType]; handler.Packet = packet; if (handler.Check(parameter)) { if (!handler.Process(parameter)) { Console.WriteLine("{0}请求处理失败", packet.PacketType); } } handler.Clean(); }
public override bool Check(ActionParameter parameter) { return(true); }
public override bool SendProcess(ActionParameter parameter) { return(true); }
/// <summary> /// 逻辑处理过程 /// </summary> public abstract bool Process(ActionParameter parameter);
/// <summary> /// 验证数据包 /// </summary> public abstract bool Check(ActionParameter parameter);