public override long GetBytes(int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
{
int maxLen = 0;
byte[] sourceArray = (byte[])this._values[i];
maxLen = sourceArray.Length;
if (dataIndex > 0x7fffffffL)
{
throw ADP.InvalidSourceBufferIndex(maxLen, dataIndex, "dataIndex");
}
int sourceIndex = (int)dataIndex;
if (buffer != null)
{
try
{
if (sourceIndex < maxLen)
{
if ((sourceIndex + length) > maxLen)
{
maxLen -= sourceIndex;
}
else
{
maxLen = length;
}
}
Array.Copy(sourceArray, sourceIndex, buffer, bufferIndex, maxLen);
}
catch (Exception exception)
{
if (ADP.IsCatchableExceptionType(exception))
{
maxLen = sourceArray.Length;
if (length < 0)
{
throw ADP.InvalidDataLength((long)length);
}
if ((bufferIndex < 0) || (bufferIndex >= buffer.Length))
{
throw ADP.InvalidDestinationBufferIndex(length, bufferIndex, "bufferIndex");
}
if ((dataIndex < 0L) || (dataIndex >= maxLen))
{
throw ADP.InvalidSourceBufferIndex(length, dataIndex, "dataIndex");
}
if ((maxLen + bufferIndex) > buffer.Length)
{
throw ADP.InvalidBufferSizeOrIndex(maxLen, bufferIndex);
}
}
throw;
}
}
return((long)maxLen);
}