Пример #1
0
        private async Task <ResourceEntry> readResourceEntry()
        {
            long          beginPos      = buffer.position();
            ResourceEntry resourceEntry = new ResourceEntry();

            // size is always 8(simple), or 16(complex)
            resourceEntry.setSize(await Buffers.readUShort(buffer));
            resourceEntry.setFlags(await Buffers.readUShort(buffer));
            long   keyRef = buffer.getInt();
            string key    = keyStringPool.get((int)keyRef);

            resourceEntry.setKey(key);

            if ((resourceEntry.getFlags() & ResourceEntry.FLAG_COMPLEX) != 0)
            {
                ResourceMapEntry resourceMapEntry = new ResourceMapEntry(resourceEntry);

                // Resource identifier of the parent mapping, or 0 if there is none.
                resourceMapEntry.setParent(Buffers.readUInt(buffer));
                resourceMapEntry.setCount(Buffers.readUInt(buffer));

                buffer.position((int)(beginPos + resourceEntry.getSize()));

                //An individual complex Resource entry comprises an entry immediately followed by one or more fields.
                ResourceTableMap[] resourceTableMaps = new ResourceTableMap[(int)resourceMapEntry.getCount()];
                for (int i = 0; i < resourceMapEntry.getCount(); i++)
                {
                    resourceTableMaps[i] = await readResourceTableMap();
                }

                resourceMapEntry.setResourceTableMaps(resourceTableMaps);
                return(resourceMapEntry);
            }
            else
            {
                buffer.position((int)(beginPos + resourceEntry.getSize()));
                resourceEntry.setValue(await ParseUtils.readResValue(buffer, stringPool));
                return(resourceEntry);
            }
        }
Пример #2
0
 public ResourceMapEntry(ResourceEntry resourceEntry)
 {
     this.setSize(resourceEntry.getSize());
     this.setFlags(resourceEntry.getFlags());
     this.setKey(resourceEntry.getKey());
 }