From 3b0bd7689579fb8012a3a6c00eae53243c61d8bd Mon Sep 17 00:00:00 2001 From: sr55 Date: Thu, 3 Dec 2020 17:56:04 +0000 Subject: WinGui: Improvements to log handling for multi-instance --- win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs | 4 ++-- .../Services/Queue/Interfaces/IQueueService.cs | 6 ++++++ win/CS/HandBrakeWPF/Services/Queue/QueueService.cs | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) (limited to 'win/CS/HandBrakeWPF/Services') diff --git a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs index 0cfd6e0f3..6754f534e 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs @@ -249,8 +249,6 @@ namespace HandBrakeWPF.Services.Encode this.ServiceLogMessage(completeMessage); - this.logInstanceManager.Deregister(this.GetLogFilename()); - // Handling Log Data string hbLog = this.ProcessLogs(this.currentTask.Destination); long filesize = this.GetFilesize(this.currentTask.Destination); @@ -260,6 +258,8 @@ namespace HandBrakeWPF.Services.Encode e.Error != 0 ? new EventArgs.EncodeCompletedEventArgs(false, null, e.Error.ToString(), this.currentTask.Source, this.currentTask.Destination, hbLog, filesize) : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Source, this.currentTask.Destination, hbLog, filesize)); + + this.logInstanceManager.Deregister(this.GetLogFilename()); } private long GetFilesize(string destination) diff --git a/win/CS/HandBrakeWPF/Services/Queue/Interfaces/IQueueService.cs b/win/CS/HandBrakeWPF/Services/Queue/Interfaces/IQueueService.cs index 2cbca0439..7e50ace75 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/Interfaces/IQueueService.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/Interfaces/IQueueService.cs @@ -152,6 +152,12 @@ namespace HandBrakeWPF.Services.Queue.Interfaces /// void ClearCompleted(); + /// + /// Get the log file paths for jobs still on the queue. (Including completed) + /// + /// List of filepaths + List GetLogFilePaths(); + /// /// Get the first job on the queue for processing. /// This also removes the job from the Queue and sets the LastProcessedJob diff --git a/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs b/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs index c3c65f3c3..089072136 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs @@ -349,6 +349,24 @@ namespace HandBrakeWPF.Services.Queue }); } + public List GetLogFilePaths() + { + List logPaths = new List(); + lock (QueueLock) + { + foreach (QueueTask task in this.Queue) + { + if (!string.IsNullOrEmpty(task.Statistics.CompletedActivityLogPath)) + { + logPaths.Add(task.Statistics.CompletedActivityLogPath); + } + } + } + + return logPaths; + } + + public QueueTask GetNextJobForProcessing() { if (this.queue.Count > 0) -- cgit v1.2.3