Example #1
0
        // Methods
        public override void Read(ExtendedBinaryReader reader)
        {
            // PACx Header
            string sig = reader.ReadSignature(4);

            if (sig != PACxSignature)
            {
                throw new InvalidSignatureException(PACxSignature, sig);
            }

            // Version String
            string verString = reader.ReadSignature(3);

            if (!ushort.TryParse(verString, out Version))
            {
                throw new InvalidSignatureException(PACxSignature + Version, sig + verString);
            }

            reader.IsBigEndian = IsBigEndian =
                (reader.ReadChar() == BigEndianFlag);

            ID       = reader.ReadUInt32();
            FileSize = reader.ReadUInt32();

            RootOffset           = reader.ReadUInt32();
            RootCompressedLength = reader.ReadUInt32();
            RootLength           = reader.ReadUInt32();

            var flags = reader.ReadInt16();

            HasDependencies     = (flags & 0x2) != 0;
            HasCompressedBlocks = (flags & 0x1) != 0;

            ushort uk1 = reader.ReadUInt16();

            if (!HasCompressedBlocks && uk1 != UnknownConstant)
            {
                Console.WriteLine($"WARNING: Unknown1 != 0x108! ({uk1})");
            }
            else if (HasCompressedBlocks && uk1 != UnknownConstant1)
            {
                Console.WriteLine($"WARNING: Unknown1 != 0x208! ({uk1})");
            }

            if ((flags & 0x80) != 0)
            {
                DependencyEntriesLength = reader.ReadUInt32();
                CompressedChunksLength  = reader.ReadUInt32();
                StringTableLength       = reader.ReadUInt32();
                FinalTableLength        = reader.ReadUInt32();

                Length = LengthWithFlags;
            }
            else
            {
                Length = LengthWithoutFlags;
            }

            reader.Offset = Length;
        }
Example #2
0
        // Methods
        public override void Read(ExtendedBinaryReader reader)
        {
            // BINA Header
            string sig = reader.ReadSignature(4);

            if (sig != Signature)
            {
                throw new InvalidSignatureException(Signature, sig);
            }

            // Version String
            string verString = reader.ReadSignature(3);

            if (!ushort.TryParse(verString, out Version))
            {
                Console.WriteLine(
                    "WARNING: BINA header version was invalid! ({0})",
                    verString);
            }

            reader.IsBigEndian = IsBigEndian =
                (reader.ReadChar() == BigEndianFlag);
            FileSize = reader.ReadUInt32();

            ushort nodeCount = reader.ReadUInt16();
            ushort unknown1  = reader.ReadUInt16(); // Always 0? Padding??

            // TODO: Read Nodes Properly
            if (nodeCount < 1)
            {
                return;
            }

            // DATA Header
            string dataSig = reader.ReadSignature();

            if (dataSig != DataSignature)
            {
                throw new InvalidSignatureException(DataSignature, dataSig);
            }

            DataLength        = reader.ReadUInt32();
            StringTableOffset = reader.ReadUInt32();
            StringTableLength = reader.ReadUInt32();
            FinalTableLength  = reader.ReadUInt32();

            // Additional data
            ushort additionalDataLength = reader.ReadUInt16();
            ushort unknown3             = reader.ReadUInt16(); // Padding?

            reader.JumpAhead(additionalDataLength);
            reader.Offset = (uint)reader.BaseStream.Position;
        }
Example #3
0
        // Methods
        public override void Read(ExtendedBinaryReader reader)
        {
            // PACx Header
            string sig = reader.ReadSignature(4);

            if (sig != PACxSignature)
            {
                throw new InvalidSignatureException(PACxSignature, sig);
            }

            // Version String
            string verString = reader.ReadSignature(3);

            if (!ushort.TryParse(verString, out Version))
            {
                Console.WriteLine(
                    "WARNING: PACx header version was invalid! ({0})",
                    verString);
            }

            reader.IsBigEndian = IsBigEndian =
                (reader.ReadChar() == BigEndianFlag);

            ID       = reader.ReadUInt32();
            FileSize = reader.ReadUInt32();

            NodeTreeLength    = reader.ReadUInt32();
            SplitListLength   = reader.ReadUInt32();
            FileEntriesLength = reader.ReadUInt32();
            StringTableLength = reader.ReadUInt32();

            DataLength       = reader.ReadUInt32();
            FinalTableLength = reader.ReadUInt32();
            PacType          = (PACTypes)reader.ReadUInt16();

            ushort uk1 = reader.ReadUInt16();

            if (uk1 != UnknownConstant)
            {
                Console.WriteLine($"WARNING: Unknown1 != 0x108! ({uk1})");
            }

            SplitCount    = reader.ReadUInt32();
            reader.Offset = Length;
        }
Example #4
0
 public override void Deserialize(ExtendedBinaryReader reader, Action <char> valueFixup)
 {
     valueFixup(reader.ReadChar());
 }
Example #5
0
 public override void Read(ExtendedBinaryReader reader, Action <char> synchronizationCallback)
 {
     synchronizationCallback(reader.ReadChar());
 }