示例#1
0
文件: Misc.cs 项目: Zymus/mm-rando
        /// <summary>
        /// Convert to bytes.
        /// </summary>
        /// <returns>Bytes</returns>
        public byte[] ToBytes()
        {
            using (var memStream = new MemoryStream())
                using (var writer = new BinaryWriter(memStream))
                {
                    ReadWriteUtils.WriteU32(writer, this.Version);

                    // Version 0
                    writer.Write(this.Hash);
                    writer.Write(ReadWriteUtils.Byteswap32(this.Flags));

                    return(memStream.ToArray());
                }
        }
示例#2
0
        /// <summary>
        /// Convert to bytes.
        /// </summary>
        /// <returns>Bytes</returns>
        public byte[] ToBytes()
        {
            using (var memStream = new MemoryStream())
                using (var writer = new BinaryWriter(memStream))
                {
                    ReadWriteUtils.WriteU32(writer, this.Version);

                    foreach (var color in this.Colors)
                    {
                        writer.Write(color.ToBytesRGB(0));
                    }
                    return(memStream.ToArray());
                }
        }
示例#3
0
        /// <summary>
        /// Convert to bytes.
        /// </summary>
        /// <returns>Bytes</returns>
        public byte[] ToBytes()
        {
            using (var memStream = new MemoryStream())
                using (var writer = new BinaryWriter(memStream))
                {
                    ReadWriteUtils.WriteU32(writer, this.Version);

                    // Version 0
                    writer.Write(this.Items);
                    writer.Write(this.State);
                    writer.Write(this.Display);

                    return(memStream.ToArray());
                }
        }