Example #1
0
        /// <summary>
        /// Serializes the current object into a byte array.
        /// </summary>
        /// <inheritdoc/>
        public byte[] Serialize()
        {
            using var ms = new MemoryStream();
            using (var bw = new BinaryWriter(ms))
            {
                foreach (var entry in _entries)
                {
                    bw.Write(entry.Serialize());
                }
            }

            var encryptedTable = MPQCrypt.EncryptData(ms.ToArray(), TableKey);

            return(encryptedTable);
        }
Example #2
0
        /// <inheritdoc/>
        public byte[] Serialize()
        {
            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter bw = new BinaryWriter(ms))
                {
                    foreach (BlockTableEntry entry in Entries)
                    {
                        bw.Write(entry.Serialize());
                    }
                }

                byte[] encryptedTable = MPQCrypt.EncryptData(ms.ToArray(), TableKey);
                return(encryptedTable);
            }
        }