예제 #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);
        }
예제 #2
0
파일: BinMeta.cs 프로젝트: sciguyryan/SCSVM
        /// <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);
        }