BlinkStickDotNet.BlinkStick.GetInfoBlock C# (CSharp) Метод

GetInfoBlock() публичный Метод

Gets the info block.
public GetInfoBlock ( byte id, byte &data ) : System.Boolean
id byte Identifier.
data byte Data.
Результат System.Boolean
        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

Same methods

BlinkStick::GetInfoBlock ( byte id, string &data ) : System.Boolean