public void ProcessLoggerMessage(SpoolerMessage message) { var str1 = Base64Convert.Base64Decode(message.Message); if (message.Type == MessageType.LoggingMessage) { lock (general_log) { general_log.Enqueue(message.SerialNumber.ToString() + "::" + str1); log_updated = true; } } else { if (message.Type != MessageType.FullLoggingData) { return; } string[] strArray = str1.Split('\n'); lock (general_log) { general_log.Clear(); foreach (var str2 in strArray) { general_log.Enqueue(message.SerialNumber.ToString() + "::" + str2); } log_updated = true; } } }
public void ProcessSpoolerMessage(SpoolerMessage message) { var asyncCallObject = (AsyncCallObject)null; var flag = false; if (message.Type == MessageType.RawData) { lock (thread_sync) { incoming_data = message.GetRawData(); } } else if (message.Type == MessageType.PluginMessage) { ProcessPluginMessageFromSpooler(message); } else if (message.Type == MessageType.LoggingMessage) { AddMessageToLog(Base64Convert.Base64Decode(message.Message)); lock (log) { log_updated = true; } } else if (message.Type == MessageType.FullLoggingData) { string[] strArray = Base64Convert.Base64Decode(message.Message).Split('\n'); log.Clear(); foreach (var message1 in strArray) { AddMessageToLog(message1); } lock (log) { log_updated = true; } } else if (message.Type == MessageType.BedLocationMustBeCalibrated || message.Type == MessageType.BedOrientationMustBeCalibrated || message.Type == MessageType.CheckGantryClips) { mylockID = Guid.Empty; lockstatus.Value = PrinterLockStatus.Unlocked; lock (waiting_object_lock) { if (waiting_object != null) { asyncCallObject = waiting_object; waiting_object = null; asyncCallObject.callresult = CommandResult.Failed_GantryClipsOrInvalidZ; } } } else if ((message.Type == MessageType.LockConfirmed || message.Type == MessageType.LockResult) && message.SerialNumber == Info.serial_number) { uint num = 0; EventLockTimeOutCallBack callback = null; CommandResult commandResult; if (message.Type == MessageType.LockResult) { var s = message.Message.Substring(0, 8); var str = message.Message.Substring(8); try { num = uint.Parse(s); commandResult = (CommandResult)Enum.Parse(typeof(CommandResult), str); } catch (ArgumentException ex) { commandResult = CommandResult.Failed_Exception; } if (commandResult == CommandResult.Success) { can_check_idle.Value = true; return; } if (commandResult == CommandResult.Pending) { lockstatus.Value = PrinterLockStatus.OurLockPending; return; } if (commandResult == CommandResult.LockForcedOpen) { lockstatus.Value = PrinterLockStatus.Unlocked; } else if (commandResult == CommandResult.LockLost_TimedOut) { lock (timeout_lock_sync) { callback = __LockTimeOutCallBack; __LockTimeOutCallBack = null; } } if (commandResult != CommandResult.CommandInterruptedByM0) { flag = true; } } else { mylockID = Guid.Parse(message.Message); commandResult = CommandResult.Success_LockAcquired; lockstatus.Value = PrinterLockStatus.WeOwnLocked; } lock (waiting_object_lock) { if (waiting_object != null) { if (commandResult == CommandResult.SuccessfullyReceived) { if (waiting_object.callbackType != CallBackType.SuccessfullyReceived) { goto label_59; } } asyncCallObject = waiting_object; waiting_object = null; } } label_59: if (flag) { mylockID = Guid.Empty; lockstatus.Value = PrinterLockStatus.Unlocked; } if (asyncCallObject != null) { if (num != 0U && (int)num != (int)asyncCallObject.callID) { commandResult = CommandResult.Failed_AsyncCallbackError; } asyncCallObject.callresult = commandResult; } if (callback != null) { ThreadPool.QueueUserWorkItem(new WaitCallback(DoTimeoutCallBack), new Printer.TimeoutProperties(callback, (IPrinter)this)); } } if (asyncCallObject != null) { ThreadPool.QueueUserWorkItem(new WaitCallback(DoAsyncCallBack), asyncCallObject); } if (OnProcessSpoolerMessage == null) { return; } OnProcessSpoolerMessage(message); }