Ejemplo n.º 1
0
        private async Task readUpkHeader()
        {
            reader.Seek(0);

            Signature = reader.ReadUInt32();

            if (Signature == Signatures.EncryptedSignature)
            {
                await reader.Decrypt();
            }
            else if (Signature != Signatures.Signature)
            {
                throw new Exception("File is not a properly formatted UPK file.");
            }

            Version  = reader.ReadUInt16();
            Licensee = reader.ReadUInt16();

            Size = reader.ReadInt32();

            await Group.ReadString(reader);

            Flags = reader.ReadUInt32();

            NameTableCount  = reader.ReadInt32();
            NameTableOffset = reader.ReadInt32();

            ExportTableCount  = reader.ReadInt32();
            ExportTableOffset = reader.ReadInt32();

            ImportTableCount  = reader.ReadInt32();
            ImportTableOffset = reader.ReadInt32();

            DependsTableOffset = reader.ReadInt32();

            Guid = await reader.ReadBytes(16);

            GenerationTableCount = reader.ReadInt32();

            GenerationTable = await readGenerationTable();

            EngineVersion = reader.ReadUInt32();
            CookerVersion = reader.ReadUInt32();

            CompressionFlags = reader.ReadUInt32();

            CompressionTableCount = reader.ReadInt32();

            CompressedChunks = await readCompressedChunksTable();

            Unknown1 = reader.ReadUInt32();
            Unknown2 = reader.ReadUInt32();
        }