private ResourcePage LoadPage(StructureValueCollection values, int index, ThirdGenCacheFileReference[] externalFiles)
        {
            var result = new ResourcePage();

            result.Index             = index;
            result.Salt              = (ushort)values.GetInteger("salt");
            result.Flags             = (byte)values.GetInteger("flags");
            result.CompressionMethod = ((int)values.GetInteger("compression codec index") != -1)
                                ? ResourcePageCompression.Deflate
                                : ResourcePageCompression.None; // FIXME: hax/laziness
            var externalFile = (int)values.GetInteger("shared cache file index");

            result.FilePath         = (externalFile != -1) ? externalFiles[externalFile].Path : null;
            result.Unknown1         = (int)values.GetIntegerOrDefault("unknown 1", 0);
            result.Offset           = (int)values.GetInteger("compressed block offset");
            result.CompressedSize   = (int)values.GetInteger("compressed block size");
            result.UncompressedSize = (int)values.GetInteger("uncompressed block size");
            result.Checksum         = values.GetInteger("checksum");
            result.Hash1            = values.GetRaw("hash 1");
            result.Hash2            = values.GetRaw("hash 2");
            result.Hash3            = values.GetRaw("hash 3");
            result.Unknown2         = (int)values.GetIntegerOrDefault("unknown 2", 0);
            result.Unknown3         = (int)values.GetIntegerOrDefault("unknown 3", 0);
            return(result);
        }
示例#2
0
        private void Load(StructureValueCollection values, FileSegmenter segmenter, FileSegmentGroup localeArea)
        {
            StringCount = (int)values.GetInteger("string count");
            if (StringCount > 0)
            {
                // Index table offset, segment, and pointer
                int localeIndexTableOffset = localeArea.PointerToOffset((uint)values.GetInteger("locale index table offset"));
                LocaleIndexTable         = segmenter.WrapSegment(localeIndexTableOffset, StringCount * 8, 8, SegmentResizeOrigin.End);
                LocaleIndexTableLocation = localeArea.AddSegment(LocaleIndexTable);

                // Data offset, segment, and pointer
                int localeDataOffset = localeArea.PointerToOffset((uint)values.GetInteger("locale data index offset"));
                var localeDataSize   = (int)values.GetInteger("locale table size");
                LocaleData         = segmenter.WrapSegment(localeDataOffset, localeDataSize, _sizeAlign, SegmentResizeOrigin.End);
                LocaleDataLocation = localeArea.AddSegment(LocaleData);

                // Load hashes if they exist
                if (values.HasRaw("index table hash"))
                {
                    IndexTableHash = values.GetRaw("index table hash");
                }
                if (values.HasRaw("string data hash"))
                {
                    StringDataHash = values.GetRaw("string data hash");
                }
            }
        }
示例#3
0
 private void Load(StructureValueCollection values, StringIDSource stringIDs)
 {
     Guid = values.GetRaw("guid");
     Name = stringIDs.GetString(new StringID(values.GetInteger("name stringid")));
 }