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 }; }
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)); }
public bool HasFlag(PacketHeaderFlags flags) { return((flags & Flags) != 0); }
public PacketHeader(PacketHeaderFlags flags) { this.Size = (ushort)HeaderSize; this.Flags = flags; }