Esempio n. 1
0
        public Compiler(CompilerSections aSecs, BinMeta?aMeta, bool aOptimize)
        {
            _sectionData  = aSecs;
            _fileMetaData = aMeta ?? new BinMeta
            {
                FileVersion     = new Version("1.0.0.0"),
                CompilerVersion = _compilerVersion,
                Id = Guid.NewGuid(),
            };
            _optimize = aOptimize;

            _ms = new MemoryStream();
            _bw = new BinaryWriter(_ms);
        }
Esempio n. 2
0
        /// <summary>
        /// Deserialize a RawBinaryMeta object from a byte array.
        /// </summary>
        /// <param name="aRaw">
        /// A byte array holding the raw binary data.
        /// </param>
        /// <returns>
        /// A RawBinaryMeta object derived from the byte array.
        /// </returns>
        public static BinMeta Deserialize(byte[] aRaw)
        {
            using var br = new BinaryReader(new MemoryStream(aRaw));
            var res = new BinMeta
            {
                Id = new Guid(br.ReadBytes(16)),

                FileVersion =
                    new Version(br.ReadInt32(),
                                br.ReadInt32(),
                                br.ReadInt32(),
                                br.ReadInt32()),

                CompilerVersion =
                    new Version(br.ReadInt32(),
                                br.ReadInt32(),
                                br.ReadInt32(),
                                br.ReadInt32()),
            };

            br.Close();

            return(res);
        }