private void CalculateObjectRefSize()
{
while (this.objectTableSize + this.topLevelObjectOffset + (this.objectRefCount * this.objectRefSize) > this.maxObjectRefValue)
{
switch (this.objectRefSize)
{
case 1:
this.objectRefSize = 2;
this.maxObjectRefValue = short.MaxValue;
break;
case 2:
this.objectRefSize = 4;
this.maxObjectRefValue = int.MaxValue;
break;
case 4:
this.objectRefSize = 8;
this.maxObjectRefValue = long.MaxValue;
break;
case 8:
break;
default:
throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Failed to calculate the required object reference size with an object table size of {0} and an object reference count of {1}.", this.objectTableSize, this.objectRefCount));
}
}
}