Example #1
0
        void ReadAll()
        {
            if (!CheckSignature(_input))
            {
                throw new RapFormatException("Attempt to read a rap file with an invalid signature");
            }
            //skip signature since CheckSignature helpfully rewinds
            _input.Seek(4, SeekOrigin.Current);
            //skip reserved bytes
            _input.Seek(6, SeekOrigin.Current);
            //skip first entryType
            _input.Seek(1, SeekOrigin.Current);
            //skip null classname
            BinaryFile.ReadString(_input);
            //skip enum offset
            var enumOffset = BinaryFile.ReadUInt32(_input);

            //now we are at the actual list of classes so start reading

            var c = ReadClassBody("", _input.Position);

            Root = new ConfigFile(c);

            //finally read the enums if present and add them to the Root
            if (enumOffset != 0)
            {
                var enums = ReadEnums(enumOffset);
                if (enums != null)
                {
                    Root.Add(enums);
                }
            }
        }
Example #2
0
        /*
         * Internal function used to read the Header information from a stream
         */

        internal void ReadHeader(Stream sr)
        {
            Path          = BinaryFile.ReadString(sr);
            PackingMethod = BinaryFile.ReadUInt32(sr);
            OriginalSize  = BinaryFile.ReadUInt32(sr);
            Reserved      = BinaryFile.ReadUInt32(sr);
            Timestamp     = BinaryFile.ReadUInt32(sr);
            DataSize      = (int)BinaryFile.ReadUInt32(sr);
        }