public override bool Check(ActionParameter parameter)
        {
            string message = null;

            if (Packet.Data.TryReadString(ref message))
            {
                parameter["message"] = message;
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        public override bool SendProcess(ActionParameter parameter)
        {
            string message = parameter.GetValue <string>("message");

            if (string.IsNullOrEmpty(message))
            {
                return(false);
            }

            Packet.Data.WriteValue(message);
            return(true);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        public override bool ReceiveProcess(ActionParameter parameter)
        {
            string message = null;

            if (Packet.Data.TryReadString(ref message))
            {
                parameter["message"] = message;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #5
0
        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);
        }
Beispiel #7
0
        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);
        }
Beispiel #8
0
        /// <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();
        }
Beispiel #9
0
 public override bool Check(ActionParameter parameter)
 {
     return(true);
 }
Beispiel #10
0
 public override bool SendProcess(ActionParameter parameter)
 {
     return(true);
 }
Beispiel #11
0
 /// <summary>
 /// 逻辑处理过程
 /// </summary>
 public abstract bool Process(ActionParameter parameter);
Beispiel #12
0
 /// <summary>
 /// 验证数据包
 /// </summary>
 public abstract bool Check(ActionParameter parameter);