Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="unknown">Unknown in header.</param>
        /// <param name="xuid">Xuid in header.</param>
        /// <param name="packetType">PacketType in header.</param>
        /// <param name="content">Package content.</param>
        public PackageChat(int unknown, long xuid, PacketTypesChat packetType, byte[] content)
        {
            HeaderUnk0          = unknown;
            HeaderContentLength = content.Length;
            HeaderXuid          = xuid;
            HeaderPacketType    = packetType;

            Content = content;
        }
Esempio n. 2
0
        /// <summary>
        /// Resolves the chat package.
        /// </summary>
        /// <param name="data">The chat package.</param>
        /// <param name="offset">The offset.</param>
        /// <param name="length">The length.</param>
        private static PackageChat _ResolvePackageChat(byte[] data, int offset, int length)
        {
            using (MemoryStream Stream = new MemoryStream(data, offset, length))
            {
                using (BinaryReader Reader = new BinaryReader(Stream))
                {
                    int             HeaderUnk0         = Reader.ReadInt16();
                    int             HeaderPacketLength = Reader.ReadInt16();
                    long            HeaderXuid         = Reader.ReadInt64();
                    PacketTypesChat HeaderPacketType   = (PacketTypesChat)Reader.ReadByte();
                    byte[]          Content            = Reader.ReadBytes(HeaderPacketLength - headerSize);

                    if (Content.Length == HeaderPacketLength - headerSize)
                    {
                        return(new PackageChat(HeaderUnk0, HeaderXuid, HeaderPacketType, Content));
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }