/// <summary> /// Internal callback used to receive the raw data. /// </summary> /// The text data pointed to by a char* is marshaled into a String /// <remarks> /// </remarks> /// <param name="cmdId">Command ID</param> /// <param name="severity">Severity level</param> /// <param name="errorNumber"></param> /// <param name="pData">char* pointer for error message</param> internal void ErrorCallback_Int(uint cmdId, int severity, int errorNumber, IntPtr pData) { lock (ErrorCallback_Int_Sync) { PauseRunCmdTimer(cmdId); try { // no callback set, so ignore if (ErrorReceived == null) { return; } String data = null; if (pData != IntPtr.Zero) { data = MarshalPtrToString(pData); } Delegate[] targetList = ErrorReceived.GetInvocationList(); foreach (ErrorDelegate d in targetList) { try { d(cmdId, severity, errorNumber, data); } catch { // problem with delegate, so remove from the list ErrorReceived -= d; } } } finally { ContinueRunCmdTimer(cmdId); } } }