Example #1
0
        protected ServerRawPacket(ServerRawOpcode opcode, bool encrypted = false)
        {
            this.opcode = opcode;

            flags |= PacketFlag.Raw;
            if (encrypted)
            {
                flags |= PacketFlag.Encrypted;
            }
        }
Example #2
0
        public ServerPacket(ServerRawOpcode opcode, IWritable message)
        {
            using (var stream = new MemoryStream())
                using (var writer = new BinaryWriter(stream))
                {
                    writer.WritePackedUInt32((uint)opcode);
                    message.Write(writer);
                    Data = stream.ToArray();
                }

            Size  = 1 + (uint)Data.Length;
            Flags = PacketFlag.Raw;
        }
 public ServerRawMessageAttribute(ServerRawOpcode opcode)
 {
     Opcode = opcode;
 }
Example #4
0
 /// <summary>
 /// Return <see cref="ServerRawOpcode"/> for supplied <see cref="IWritable"/>.
 /// </summary>
 public static bool GetRawOpcode(IWritable message, out ServerRawOpcode opcode)
 {
     return(rawMessageOpcodes.TryGetValue(message.GetType(), out opcode));
 }