Beispiel #1
0
        public void Read(Stream stream)
        {
            using (JpkBinaryReader reader = new JpkBinaryReader(EndianBitConverter.Little, stream))
            {
                uint magic = reader.ReadUInt32();
                if (magic != 1262571594)
                {
                    throw new Exception("This is not a Jpk file!");
                }

                reader.ReadBytes(4); // unk - 0
                int numEntries = reader.ReadInt32();
                this.Alignment = reader.ReadInt32();
                reader.ReadBytes(4); // unk - 0
                int offsetToFileNames = reader.ReadInt32();
                reader.ReadBytes(8); // unk - 0

                for (int i = 0; i < numEntries; i++)
                {
                    reader.Seek(32 + i * 32, SeekOrigin.Begin);
                    JpkEntry entry = new JpkEntry(this);
                    entry.Read(reader);
                    this.Entries.Add(entry);
                }
            }
        }
        public void Read(Stream stream)
        {
            using (JpkBinaryReader reader = new JpkBinaryReader(EndianBitConverter.Little, stream))
            {
                uint magic = reader.ReadUInt32();
                if (magic != 1262571594)
                {
                    throw new Exception("This is not a Jpk file!");
                }

                reader.ReadBytes(4); // unk - 0
                int numEntries = reader.ReadInt32();
                this.Alignment = reader.ReadInt32();
                reader.ReadBytes(4); // unk - 0
                int offsetToFileNames = reader.ReadInt32();
                reader.ReadBytes(8); // unk - 0

                for (int i = 0; i < numEntries; i++)
                {
                    reader.Seek(32 + i * 32, SeekOrigin.Begin);
                    JpkEntry entry = new JpkEntry(this);
                    entry.Read(reader);
                    this.Entries.Add(entry);
                }
            }
        }