ToString() public method

Returns a T:System.String that represents the current UsbError.
public ToString ( ) : string
return string
Exemplo n.º 1
0
        internal static UsbError Error(ErrorCode errorCode, int ret, string description, object sender)
        {
            string win32Error = String.Empty;

            if (errorCode == ErrorCode.Win32Error && !UsbDevice.IsLinux && ret != 0)
            {
                win32Error = Kernel32.FormatSystemMessage(ret);
            }
            else if (errorCode == ErrorCode.MonoApiError && ret != 0)
            {
                win32Error = ((MonoUsbError)ret) + ":" + MonoUsbApi.StrError((MonoUsbError)ret);
            }
            UsbError err = new UsbError(errorCode, ret, win32Error, description, sender);

            lock (mLastErrorString)
            {
                mLastErrorNumber = (int)err.ErrorCode;
                mLastErrorString = err.ToString();
            }
            UsbDevice.FireUsbError(sender, err);

            return(err);
        }
Exemplo n.º 2
0
        public static UsbError Error(ErrorCode errorCode, int ret, string description, object sender)
        {
            string win32Error = String.Empty;

            if (errorCode == ErrorCode.Win32Error && !UsbDevice.IsLinux && ret != 0)
            {
                win32Error = Kernel32.FormatSystemMessage(ret);
            }
            else if (errorCode == ErrorCode.MonoApiError && ret != 0)
            {
                Debug.Assert(false, "libusb-1.0 error codes should be resolved within LibUsbDotNet.LibUsb");
                // win32Error = ((MonoUsbError) ret) + ":" + MonoUsbApi.StrError((MonoUsbError) ret);
            }
            UsbError err = new UsbError(errorCode, ret, win32Error, description, sender);

            lock (mLastErrorString)
            {
                mLastErrorNumber = (int)err.ErrorCode;
                mLastErrorString = err.ToString();
            }
            UsbDevice.FireUsbError(sender, err);

            return(err);
        }
Exemplo n.º 3
0
        internal static UsbError Error(ErrorCode errorCode, int ret, string description, object sender)
        {
            string win32Error = String.Empty;
            if (errorCode == ErrorCode.Win32Error && !UsbDevice.IsLinux && ret != 0)
            {
                win32Error = Kernel32.FormatSystemMessage(ret);
            }
            else if (errorCode == ErrorCode.MonoApiError && ret != 0)
            {
                win32Error = ((MonoUsbError) ret) + ":" + MonoUsbApi.StrError((MonoUsbError) ret);
            }
            UsbError err = new UsbError(errorCode, ret, win32Error, description, sender);
            lock (mLastErrorString)
            {
                mLastErrorNumber = (int) err.ErrorCode;
                mLastErrorString = err.ToString();
            }
            UsbDevice.FireUsbError(sender, err);

            return err;
        }
Exemplo n.º 4
0
 private void OnUsbError(object sender, UsbError usbError)
 {
     Console.WriteLine(usbError.ToString());
 }
Exemplo n.º 5
0
 private void UsbDevice_UsbErrorEvent(object sender, UsbError e)
 {
     LogLine("usb error: " + e.ToString());
     MessageBox.Show("UsbError: " + e.ToString());
 }
Exemplo n.º 6
0
 private void OnUsbError(object sender, UsbError e)
 {
     SetStatus(e.ToString(), true);
 }