public new ResourceTableEntry Clone() { var copy = new ResourceTableEntry(); CopyTo(copy); return(copy); }
internal new static ResourceTableEntry Load(IBinaryAccessor accessor, long basePosition) { var entry = new ResourceTableEntry(); entry._table = ResourceTable.Load(accessor, basePosition); entry._table._parent = entry; return(entry); }
protected void CopyTo(ResourceTableEntry copy) { if (_table != null) { copy._table = _table.Clone(); copy._table._parent = copy; } base.CopyTo(copy); }
internal static ResourceEntry Load(IBinaryAccessor accessor, long basePosition) { uint nameOrId = accessor.ReadUInt32(); uint dataOrTable = accessor.ReadUInt32(); long origPosition = accessor.Position; accessor.Position = basePosition + (dataOrTable & 0x7fffffff); ResourceEntry entry; if ((dataOrTable & 0x80000000) != 0) { // High bit 1. The lower 31 bits are the address of another resource directory table (the next level down). entry = ResourceTableEntry.Load(accessor, basePosition); } else { // High bit 0. Address of a Resource Data entry (a leaf). entry = ResourceDataEntry.Load(accessor); } accessor.Position = origPosition; if ((nameOrId & 0x80000000) != 0) { // High bit 1. The address of a string that gives the Type, Name, or Language ID entry, depending on level of table. accessor.Position = basePosition + (nameOrId & 0x7fffffff); int length = accessor.ReadUInt16(); entry._name = accessor.ReadString(length, Encoding.Unicode); accessor.Position = origPosition; } else { // High bit 0. A 32-bit integer that identifies the Type, Name, or Language ID entry. entry._id = (int)(nameOrId & 0x7fffffff); } return(entry); }