public Boolean GetInfoBlock (byte id, out byte[] data)
{
if (id == 2 || id == 3) {
data = new byte[33];
data[0] = id;
if (connectedToDriver)
{
int attempt = 0;
while (attempt < 5)
{
attempt++;
try
{
stream.GetFeature(data, 0, data.Length);
break;
}
catch (System.IO.IOException e)
{
if (e.InnerException is System.ComponentModel.Win32Exception)
{
System.ComponentModel.Win32Exception win32Exception = e.InnerException as System.ComponentModel.Win32Exception;
if (win32Exception != null && win32Exception.NativeErrorCode == 0)
return true;
}
if (attempt == 5)
throw;
if (!WaitThread(20))
return false;
}
}
return true;
}
else
{
data = new byte[0];
return false;
}
} else {
throw new Exception("Invalid info block id");
}
}
#endregion