/// <summary> /// Parses the STF PrintJobId <see cref="Guid"/> out of the ePrint job file name. /// </summary> /// <param name="jobFileName"></param> /// <returns>STF PrintJobId <see cref="Guid"/></returns> private static Guid ParsePrintJobId(string jobFileName) { try { return(UniqueFile.ExtractId(jobFileName)); } catch (FormatException) { //TraceFactory.Logger.Error(ex); } return(Guid.Empty); }
/// <summary> /// Initializes a new instance of the <see cref="VirtualPrinterJobLog" /> class. /// </summary> /// <param name="jobInfo">The <see cref="VirtualPrinterJobInfo" />.</param> /// <exception cref="ArgumentNullException"><paramref name="jobInfo" /> is null.</exception> public VirtualPrinterJobLog(VirtualPrinterJobInfo jobInfo) { if (jobInfo == null) { throw new ArgumentNullException(nameof(jobInfo)); } VirtualPrinterJobId = SequentialGuid.NewGuid(); PrintJobClientId = UniqueFile.ExtractId(jobInfo.PjlHeader.JobName); PjlJobName = jobInfo.PjlHeader.JobName; PjlLanguage = jobInfo.PjlHeader.Language; FirstByteReceivedDateTime = jobInfo.FirstByteReceived; LastByteReceivedDateTime = jobInfo.LastByteReceived; BytesReceived = jobInfo.BytesReceived; }
private void LogPrintJob(PrintJobData job) { Guid printJobClientId = Guid.Empty; // If extracting the ID fails, then do not report data on this job try { if (!string.IsNullOrEmpty(job.Document)) { printJobClientId = UniqueFile.ExtractId(job.Document.ToUpperInvariant()); } } catch (FormatException) { TraceFactory.Logger.Warn("Bad document name: " + job.Document); // Do nothing. return; } if (printJobClientId == Guid.Empty) { return; } PrintServerJobLog logger = null; MonitoredQueueInfoCache printQueue = GetQueueInfo(job.PrinterName); if (printQueue != null) { logger = new PrintServerJobLog(printJobClientId, job, printQueue); } else { logger = new PrintServerJobLog(printJobClientId, job); } try { _dataLogger.SubmitAsync(logger); TraceFactory.Logger.Debug("Data posted to data log service."); } catch (Exception ex) { TraceFactory.Logger.Error("Error posting data to the data log service.", ex); } }