/// <summary>
        /// Read and preprocess header information
        /// </summary>
        private void ReadPreprocess()
        {
            char[] gtag;
            #region Endian Switch
            ushort us_temp = InputStream.ReadUInt16();
            if (us_temp == HeaderEndian)
            {
                SetEndianState(IO.EndianState.Little);
            }
            else if (us_temp == HeaderEndianSwap)
            {
                SetEndianState(IO.EndianState.Big);
            }
            else
            {
                throw new Debug.ExceptionLog("File: Invalid switch! {0:X4}", us_temp);
            }
            #endregion

            #region Version
            us_temp = InputStream.ReadUInt16();
            Debug.Assert.If(us_temp == HeaderVersion,
                            "File: mismatching file version! [{0}, !{1}",
                            HeaderVersion, us_temp);
            #endregion
            #region Signature
            gtag = InputStream.ReadTag();
            Debug.Assert.If(TagGroup.Test(gtag, (char[])IO.TagGroups.BlamLib),
                            "File: invalid signature! [{0} !{1}]",
                            IO.TagGroups.BlamLib.TagToString(), new string(gtag));
            #endregion
            flags.Reset((uint)(InputStream.ReadUInt16() << 16) | flags);

            #region Data Version
            us_temp = InputStream.ReadUInt16();
            Debug.Assert.If(us_temp == data.Attribute.Version,
                            "File: mismatching data version! [{0}, !{1}",
                            data.Attribute.Version, us_temp);
            #endregion
            #region Data Signature
            gtag = InputStream.ReadTag();
            Debug.Assert.If(TagGroup.Test(gtag, (char[])data.GroupTag),
                            "File: invalid data signature! [{0} !{1}]",
                            data.GroupTag.TagToString(), new string(gtag));
            #endregion

            #region Data Directories
            InputStream.ReadInt32();
            InputStream.ReadInt32();
            #endregion
            #region Data
            InputStream.ReadInt32();
            int data_offset = InputStream.ReadInt32();
            #endregion

            Debug.Assert.If(InputStream.Position == HeaderSize,
                            "File: Update header size! [{0}, !{1}]", HeaderSize, InputStream.Position);

            InputStream.Seek(data_offset);
        }
Exemplo n.º 2
0
        public void Parse()
        {
            InputStream.ReadTag();             // Ext tag header
            InputStream.ReadInt32();           // Flags

            InputStream.ReadTag();             // Stubbs
            InputStream.ReadTag();             // Halo1
            InputStream.ReadTag();             // Halo2
            InputStream.ReadTag();             // Halo3

            InputStream.ReadInt16();           // IDs count
            InputStream.ReadInt16();           // Blocks count

            Parse(commands);
        }
Exemplo n.º 3
0
        public Definition Parse()
        {
            Debug.Assert.If(InputStream != null,
                            "Can't parse a definition file when we're not initialized for that mode");

            InputStream.ReadTag();             // Ext
            //groupTag = InputStream.ReadTag();
            engine  = (BlamVersion)InputStream.ReadUInt32();
            version = InputStream.ReadInt16();
            header  = InputStream.ReadInt16();

            this.def = new Definition();
            //this.def.SetOwnerObject(this.def); // we want fields of this definition to point to the definition as their parent
            return(Parse(null));
        }