public static void HWInit(bool setCallback) { if (!(ExtIO._dllHandle == IntPtr.Zero) && !ExtIO._isHWInit && !ExtIO._isHWStarted) { ExtIO.logInfo("HWInit()"); StringBuilder stringBuilder = new StringBuilder(256); StringBuilder stringBuilder2 = new StringBuilder(256); int hwType = 0; try { ExtIO._isHWInit = ExtIO._initHW(stringBuilder, stringBuilder2, ref hwType); } catch (Exception ex) { ExtIO.logInfo("InitHW: " + ex.Message); } ExtIO.logResult("InitHW: "); ExtIO._name = stringBuilder.ToString(); ExtIO._model = stringBuilder2.ToString(); ExtIO._hwType = (HWTypes)hwType; if (!ExtIO._isHWInit) { ExtIO.logInfo("InitHW() returned " + ExtIO._isHWInit + ", "); ExtIO._isHWInit = true; ExtIO.CloseHW(); throw new ApplicationException("InitHW() returned " + ExtIO._isHWInit); } ExtIO.logInfo("InitHW: " + ExtIO._name + ", " + ExtIO._model + ", type=" + hwType.ToString()); if (setCallback) { ExtIO.logInfo("SetCallback: "); try { ExtIO._setCallback(ExtIO._callbackInst); } catch (Exception ex2) { ExtIO.logInfo("SetCallback: " + ex2.Message); } } } }