示例#1
0
文件: ServerPacket.cs 项目: sr314/ACE
        public ServerPacket(ushort id, PacketHeaderFlags flags = PacketHeaderFlags.None)
        {
            Direction = PacketDirection.Server;

            Data    = new MemoryStream((int)MaxPacketSize);
            Payload = new BinaryWriter(Data);
            Header  = new PacketHeader()
            {
                Id    = id,
                Flags = flags
            };
        }
示例#2
0
        public static string UnfoldFlags(PacketHeaderFlags flags)
        {
            List <string> result = new List <string>();

            foreach (PacketHeaderFlags r in System.Enum.GetValues(typeof(PacketHeaderFlags)))
            {
                if ((flags & r) != 0)
                {
                    result.Add(r.ToString());
                }
            }
            return(result.DefaultIfEmpty().Aggregate((a, b) => a + " | " + b));
        }
示例#3
0
 public bool HasFlag(PacketHeaderFlags flags)
 {
     return((flags & Flags) != 0);
 }
示例#4
0
 public PacketHeader(PacketHeaderFlags flags)
 {
     this.Size  = (ushort)HeaderSize;
     this.Flags = flags;
 }