private unsafe int GetNamePosition(int index)
{
BCLDebug.Assert(index >=0 && index < _numResources, "Bad index into name position array. index: "+index);
BCLDebug.Assert((_ums == null && _namePositions != null && _namePositionsPtr == null) ||
(_ums != null && _namePositions == null && _namePositionsPtr != null), "Internal state mangled.");
int r;
if (_ums == null)
r = _namePositions[index];
else
r = ReadUnalignedI4(&_namePositionsPtr[index]);
if (r < 0 || r > _dataSectionOffset - _nameSectionOffset) {
BCLDebug.Assert(false, "Corrupt .resources file! NamePosition is outside of the name section!");
throw new FormatException(Environment.GetResourceString("BadImageFormat_ResourcesNameOutOfSection", index, r.ToString("x", CultureInfo.InvariantCulture)));
}
return r;
}