private void DecodeCurrentHexBuffer()
{
long pendingByteCount = hexDecodingBuffer.Length;
if ( pendingByteCount > 0 )
{
byte[] pendingBytes = hexDecodingBuffer.ToArray();
char[] convertedChars = new char[ pendingByteCount ]; // should be enough
int startIndex = 0;
bool completed = false;
while ( !completed && startIndex < pendingBytes.Length )
{
int usedBytes;
int usedChars;
byteToCharDecoder.Convert(
pendingBytes, startIndex, pendingBytes.Length - startIndex,
convertedChars, 0, convertedChars.Length,
true,
out usedBytes,
out usedChars,
out completed );
curText.Append( convertedChars, 0, usedChars );
startIndex += usedChars;
}
hexDecodingBuffer.SetLength( 0 );
}
}