コード例 #1
0
ファイル: MemoryCommand.cs プロジェクト: widdop4ever/Assembly
        public override void Serialize(Stream stream)
        {
            using (var writer = new EndianWriter(stream, Endian.BigEndian))
            {
                var buildNameBytes = System.Text.Encoding.UTF8.GetBytes(BuildName);
                writer.WriteInt32(buildNameBytes.Length);
                writer.WriteBlock(buildNameBytes);

                var cacheNameBytes = System.Text.Encoding.UTF8.GetBytes(CacheName);
                writer.WriteInt32(cacheNameBytes.Length);
                writer.WriteBlock(cacheNameBytes);

                var count = Actions.Count;
                writer.WriteInt32(count);

                foreach (var action in Actions)
                {
                    writer.WriteInt64(action.Position);
                    writer.WriteInt32(action.Buffer.Length);
                    writer.WriteBlock(action.Buffer);
                }
            }
        }