diff options
Diffstat (limited to 'win/CS/HandBrakeWPF/Services')
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs | 198 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Encode/Interfaces/IEncode.cs | 10 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs | 69 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Scan/Interfaces/IScan.cs | 5 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Scan/LibScan.cs | 187 |
5 files changed, 49 insertions, 420 deletions
diff --git a/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs b/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs index 9ae0398ee..801a8c9cc 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/EncodeBase.cs @@ -13,11 +13,10 @@ namespace HandBrakeWPF.Services.Encode using System.Diagnostics; using System.Globalization; using System.IO; - using System.Text; using HandBrake.ApplicationServices.Model; - - using HandBrakeWPF.Utilities; + using HandBrake.ApplicationServices.Services.Logging; + using HandBrake.ApplicationServices.Services.Logging.Interfaces; using EncodeCompletedEventArgs = HandBrakeWPF.Services.Encode.EventArgs.EncodeCompletedEventArgs; using EncodeCompletedStatus = HandBrakeWPF.Services.Encode.Interfaces.EncodeCompletedStatus; @@ -31,38 +30,11 @@ namespace HandBrakeWPF.Services.Encode /// </summary> public class EncodeBase { - #region Private Variables - - /// <summary> - /// A Lock for the filewriter - /// </summary> - private static readonly object FileWriterLock = new object(); - - /// <summary> - /// The Log File Header - /// </summary> - private readonly StringBuilder header; - - /// <summary> - /// The Log Buffer - /// </summary> - private StringBuilder logBuffer; - - /// <summary> - /// The Log file writer - /// </summary> - private StreamWriter fileWriter; - - #endregion - /// <summary> /// Initializes a new instance of the <see cref="EncodeBase"/> class. /// </summary> public EncodeBase() - { - this.logBuffer = new StringBuilder(); - this.header = GeneralUtilities.CreateLogHeader(); - this.LogIndex = 0; + { } #region Events @@ -91,39 +63,6 @@ namespace HandBrakeWPF.Services.Encode /// </summary> public bool IsEncoding { get; protected set; } - /// <summary> - /// Gets ActivityLog. - /// </summary> - public string ActivityLog - { - get - { - string noLog = "There is no log information to display." + Environment.NewLine + Environment.NewLine - + "This window will only display logging information after you have started an encode." + Environment.NewLine - + Environment.NewLine + "You can find previous log files in the log directory or by clicking the 'Open Log Directory' button above."; - - return string.IsNullOrEmpty(this.logBuffer.ToString()) - ? noLog - : this.header + this.logBuffer.ToString(); - } - } - - /// <summary> - /// Gets the log index. - /// </summary> - public int LogIndex { get; private set; } - - /// <summary> - /// Gets LogBuffer. - /// </summary> - public StringBuilder LogBuffer - { - get - { - return this.logBuffer; - } - } - #endregion #region Invoke Events @@ -156,8 +95,6 @@ namespace HandBrakeWPF.Services.Encode { handler(this, e); } - - this.LogIndex = 0; // Reset } /// <summary> @@ -186,6 +123,9 @@ namespace HandBrakeWPF.Services.Encode /// <param name="destination"> /// The Destination File Path /// </param> + /// <param name="isPreview"> + /// The is Preview. + /// </param> /// <param name="configuration"> /// The configuration. /// </param> @@ -193,15 +133,12 @@ namespace HandBrakeWPF.Services.Encode { try { - string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + - "\\HandBrake\\logs"; - - string tempLogFile = Path.Combine(logDir, isPreview ? $"preview_encode_log{GeneralUtilities.ProcessId}.txt" : string.Format("last_encode_log{0}.txt", GeneralUtilities.ProcessId)); - + string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; string encodeDestinationPath = Path.GetDirectoryName(destination); string destinationFile = Path.GetFileName(destination); - string encodeLogFile = destinationFile + " " + - DateTime.Now.ToString(CultureInfo.InvariantCulture).Replace("/", "-").Replace(":", "-") + ".txt"; + string encodeLogFile = destinationFile + " " + DateTime.Now.ToString(CultureInfo.InvariantCulture).Replace("/", "-").Replace(":", "-") + ".txt"; + ILog log = LogService.GetLogger(); + string logContent = log.ActivityLog; // Make sure the log directory exists. if (!Directory.Exists(logDir)) @@ -210,19 +147,18 @@ namespace HandBrakeWPF.Services.Encode } // Copy the Log to HandBrakes log folder in the users applciation data folder. - File.Copy(tempLogFile, Path.Combine(logDir, encodeLogFile)); + this.WriteFile(logContent, Path.Combine(logDir, encodeLogFile)); // Save a copy of the log file in the same location as the enocde. if (configuration.SaveLogWithVideo) { - File.Copy(tempLogFile, Path.Combine(encodeDestinationPath, encodeLogFile)); + this.WriteFile(logContent, Path.Combine(encodeDestinationPath, encodeLogFile)); } // Save a copy of the log file to a user specified location if (Directory.Exists(configuration.SaveLogCopyDirectory) && configuration.SaveLogToCopyDirectory) { - File.Copy( - tempLogFile, Path.Combine(configuration.SaveLogCopyDirectory, encodeLogFile)); + this.WriteFile(logContent, Path.Combine(configuration.SaveLogCopyDirectory, encodeLogFile)); } } catch (Exception exc) @@ -232,116 +168,26 @@ namespace HandBrakeWPF.Services.Encode } /// <summary> - /// Setup the logging. + /// The write file. /// </summary> - protected void SetupLogging(bool isPreviewEncode) - { - this.ShutdownFileWriter(); - string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; - string logFile = Path.Combine(logDir, isPreviewEncode ? $"preview_last_encode_log{GeneralUtilities.ProcessId}.txt" : $"last_encode_log{GeneralUtilities.ProcessId}.txt"); - - try - { - this.logBuffer = new StringBuilder(); - - this.logBuffer.AppendLine(); - - // Clear the current Encode Logs) - if (File.Exists(logFile)) - { - File.Delete(logFile); - } - - lock (FileWriterLock) - { - this.fileWriter = new StreamWriter(logFile) { AutoFlush = true }; - this.fileWriter.WriteLine(this.header); - this.fileWriter.WriteLine(); - } - } - catch (Exception) - { - if (this.fileWriter != null) - { - lock (FileWriterLock) - { - this.fileWriter.Flush(); - this.fileWriter.Close(); - this.fileWriter.Dispose(); - } - } - - throw; - } - } - - /// <summary> - /// The service log message. - /// </summary> - /// <param name="message"> - /// The message. + /// <param name="fileName"> + /// The file name. /// </param> - protected void ServiceLogMessage(string message) - { - this.ProcessLogMessage(string.Format("# {0}", message)); - } - - /// <summary> - /// Process an Incomming Log Message. - /// </summary> - /// <param name="message"> - /// The message. + /// <param name="content"> + /// The content. /// </param> - protected void ProcessLogMessage(string message) - { - if (!string.IsNullOrEmpty(message)) - { - try - { - this.LogIndex = this.LogIndex + 1; - - lock (this.LogBuffer) - { - this.LogBuffer.AppendLine(message); - } - - lock (FileWriterLock) - { - if (this.fileWriter != null && this.fileWriter.BaseStream.CanWrite) - { - this.fileWriter.WriteLine(message); - } - } - } - catch (Exception exc) - { - Debug.WriteLine(exc); // This exception doesn't warrent user interaction, but it should be logged - } - } - } - - /// <summary> - /// Shutdown and Dispose of the File Writer. - /// </summary> - protected void ShutdownFileWriter() + private void WriteFile(string fileName, string content) { try { - lock (FileWriterLock) + using (StreamWriter fileWriter = new StreamWriter(fileName) { AutoFlush = true }) { - if (this.fileWriter != null) - { - this.fileWriter.Flush(); - this.fileWriter.Close(); - this.fileWriter.Dispose(); - } - - this.fileWriter = null; + fileWriter.WriteLineAsync(content); } } catch (Exception exc) { - Debug.WriteLine(exc); // This exception doesn't warrent user interaction, but it should be logged + Debug.WriteLine(exc); } } diff --git a/win/CS/HandBrakeWPF/Services/Encode/Interfaces/IEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/Interfaces/IEncode.cs index 691df1500..b9a5f0aff 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Interfaces/IEncode.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Interfaces/IEncode.cs @@ -65,16 +65,6 @@ namespace HandBrakeWPF.Services.Encode.Interfaces bool IsEncoding { get; } /// <summary> - /// Gets ActivityLog. - /// </summary> - string ActivityLog { get; } - - /// <summary> - /// Gets the log index. The current log row counter. - /// </summary> - int LogIndex { get; } - - /// <summary> /// Gets a value indicating whether is pasued. /// </summary> bool IsPasued { get; } diff --git a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs index 4bf64e5e1..e8b920c57 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs @@ -16,6 +16,9 @@ namespace HandBrakeWPF.Services.Encode using HandBrake.ApplicationServices.Interop.EventArgs; using HandBrake.ApplicationServices.Interop.Interfaces; using HandBrake.ApplicationServices.Model; + using HandBrake.ApplicationServices.Services.Logging; + using HandBrake.ApplicationServices.Services.Logging.Interfaces; + using HandBrake.ApplicationServices.Services.Logging.Model; using HandBrakeWPF.Exceptions; using HandBrakeWPF.Services.Encode.Factories; @@ -30,7 +33,7 @@ namespace HandBrakeWPF.Services.Encode { #region Private Variables - private static readonly object LogLock = new object(); + private ILog log = LogService.GetLogger(); private IHandBrakeInstance instance; private DateTime startTime; private EncodeTask currentTask; @@ -70,8 +73,6 @@ namespace HandBrakeWPF.Services.Encode // Create a new HandBrake instance // Setup the HandBrake Instance - HandBrakeUtils.MessageLogged += this.HandBrakeInstanceMessageLogged; - HandBrakeUtils.ErrorLogged += this.HandBrakeInstanceErrorLogged; this.instance = task.IsPreviewEncode ? HandBrakeInstanceManager.GetPreviewInstance(configuration.Verbosity) : HandBrakeInstanceManager.GetEncodeInstance(configuration.Verbosity); this.instance.EncodeCompleted += this.InstanceEncodeCompleted; @@ -79,11 +80,11 @@ namespace HandBrakeWPF.Services.Encode this.IsEncoding = true; this.isPreviewInstance = task.IsPreviewEncode; - this.SetupLogging(task.IsPreviewEncode); // Verify the Destination Path Exists, and if not, create it. this.VerifyEncodeDestinationPath(task); + this.log.Reset(); // Reset so we have a clean log for the start of the encode. this.ServiceLogMessage("Starting Encode ..."); // Get an EncodeJob object for the Interop Library @@ -97,7 +98,7 @@ namespace HandBrakeWPF.Services.Encode this.IsEncoding = false; this.ServiceLogMessage("Failed to start encoding ..." + Environment.NewLine + exc); - this.InvokeEncodeCompleted(new HandBrakeWPF.Services.Encode.EventArgs.EncodeCompletedEventArgs(false, exc, "Unable to start encoding", task.Source)); + this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "Unable to start encoding", task.Source)); } } @@ -150,40 +151,6 @@ namespace HandBrakeWPF.Services.Encode #region HandBrakeInstance Event Handlers. /// <summary> - /// Log a message - /// </summary> - /// <param name="sender"> - /// The sender. - /// </param> - /// <param name="e"> - /// The MessageLoggedEventArgs. - /// </param> - private void HandBrakeInstanceErrorLogged(object sender, MessageLoggedEventArgs e) - { - lock (LogLock) - { - this.ProcessLogMessage(e.Message); - } - } - - /// <summary> - /// Log a message - /// </summary> - /// <param name="sender"> - /// The sender. - /// </param> - /// <param name="e"> - /// The MessageLoggedEventArgs. - /// </param> - private void HandBrakeInstanceMessageLogged(object sender, MessageLoggedEventArgs e) - { - lock (LogLock) - { - this.ProcessLogMessage(e.Message); - } - } - - /// <summary> /// Encode Progress Event Handler /// </summary> /// <param name="sender"> @@ -194,7 +161,7 @@ namespace HandBrakeWPF.Services.Encode /// </param> private void InstanceEncodeProgress(object sender, EncodeProgressEventArgs e) { - HandBrakeWPF.Services.Encode.EventArgs.EncodeProgressEventArgs args = new HandBrakeWPF.Services.Encode.EventArgs.EncodeProgressEventArgs + EventArgs.EncodeProgressEventArgs args = new EventArgs.EncodeProgressEventArgs { AverageFrameRate = e.AverageFrameRate, CurrentFrameRate = e.CurrentFrameRate, @@ -221,22 +188,24 @@ namespace HandBrakeWPF.Services.Encode { this.IsEncoding = false; this.ServiceLogMessage("Encode Completed ..."); - - // Stop Logging. - HandBrakeUtils.MessageLogged -= this.HandBrakeInstanceMessageLogged; - HandBrakeUtils.ErrorLogged -= this.HandBrakeInstanceErrorLogged; - + // Handling Log Data this.ProcessLogs(this.currentTask.Destination, this.isPreviewInstance, this.currentConfiguration); - // Cleanup - this.ShutdownFileWriter(); - // Raise the Encode Completed EVent. this.InvokeEncodeCompleted( e.Error - ? new HandBrakeWPF.Services.Encode.EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Destination) - : new HandBrakeWPF.Services.Encode.EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Destination)); + ? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Destination) + : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Destination)); + } + + /// <summary> + /// Service Log Message. + /// </summary> + /// <param name="message">Log message content</param> + protected void ServiceLogMessage(string message) + { + this.log.LogMessage(string.Format("# {0}", message), LogMessageType.ScanOrEncode, LogLevel.Info); } #endregion } diff --git a/win/CS/HandBrakeWPF/Services/Scan/Interfaces/IScan.cs b/win/CS/HandBrakeWPF/Services/Scan/Interfaces/IScan.cs index 0af5f30ec..4336574aa 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/Interfaces/IScan.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/Interfaces/IScan.cs @@ -66,11 +66,6 @@ namespace HandBrakeWPF.Services.Scan.Interfaces bool IsScanning { get; } /// <summary> - /// Gets ActivityLog. - /// </summary> - string ActivityLog { get; } - - /// <summary> /// Scan a Source Path. /// Title 0: scan all /// </summary> diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs index 3d9d475a1..d72593cff 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs @@ -12,19 +12,18 @@ namespace HandBrakeWPF.Services.Scan using System; using System.Collections.Generic; using System.Diagnostics; - using System.IO; - using System.Text; using System.Windows.Media.Imaging; using HandBrake.ApplicationServices.Interop; - using HandBrake.ApplicationServices.Interop.EventArgs; using HandBrake.ApplicationServices.Interop.HbLib; using HandBrake.ApplicationServices.Interop.Interfaces; using HandBrake.ApplicationServices.Interop.Json.Scan; using HandBrake.ApplicationServices.Interop.Model; using HandBrake.ApplicationServices.Interop.Model.Preview; using HandBrake.ApplicationServices.Model; - using HandBrake.ApplicationServices.Utilities; + using HandBrake.ApplicationServices.Services.Logging; + using HandBrake.ApplicationServices.Services.Logging.Interfaces; + using HandBrake.ApplicationServices.Services.Logging.Model; using HandBrakeWPF.Properties; using HandBrakeWPF.Services.Encode.Model; @@ -32,7 +31,6 @@ namespace HandBrakeWPF.Services.Scan using HandBrakeWPF.Services.Scan.EventArgs; using HandBrakeWPF.Services.Scan.Interfaces; using HandBrakeWPF.Services.Scan.Model; - using HandBrakeWPF.Utilities; using Chapter = HandBrakeWPF.Services.Scan.Model.Chapter; using ScanProgressEventArgs = HandBrake.ApplicationServices.Interop.EventArgs.ScanProgressEventArgs; @@ -46,54 +44,10 @@ namespace HandBrakeWPF.Services.Scan { #region Private Variables - /// <summary> - /// Lock for the log file - /// </summary> - static readonly object LogLock = new object(); - - /// <summary> - /// Log data from HandBrakeInstance - /// </summary> - private readonly StringBuilder logging; - - /// <summary> - /// The Log File Header - /// </summary> - private readonly StringBuilder header; - - /// <summary> - /// The Current source scan path. - /// </summary> + private readonly ILog log = LogService.GetLogger(); private string currentSourceScanPath; - - /// <summary> - /// The log dir. - /// </summary> - private static string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; - - /// <summary> - /// The dvd info path. - /// </summary> - private string dvdInfoPath = Path.Combine(logDir, string.Format("last_scan_log{0}.txt", GeneralUtilities.ProcessId)); - - /// <summary> - /// The scan log. - /// </summary> - private StreamWriter scanLog; - - /// <summary> - /// LibHB Instance - /// </summary> private IHandBrakeInstance instance; - - /// <summary> - /// The post scan operation. - /// </summary> private Action<bool, Source> postScanOperation; - - /// <summary> - /// Global to handle cancelled scans. - /// </summary> private bool isCancelled = false; #endregion @@ -103,8 +57,6 @@ namespace HandBrakeWPF.Services.Scan /// </summary> public LibScan() { - this.logging = new StringBuilder(); - this.header = GeneralUtilities.CreateLogHeader(); this.IsScanning = false; } @@ -134,21 +86,6 @@ namespace HandBrakeWPF.Services.Scan /// </summary> public bool IsScanning { get; private set; } - /// <summary> - /// Gets ActivityLog. - /// </summary> - public string ActivityLog - { - get - { - string noLog = "There is no log information to display." + Environment.NewLine + Environment.NewLine - + "This window will only display logging information after you have scanned a source." + Environment.NewLine - + Environment.NewLine + "You can find previous log files in the log directory or by clicking the 'Open Log Directory' button above."; - - return string.IsNullOrEmpty(this.logging.ToString()) ? noLog : this.header + this.logging.ToString(); - } - } - #endregion #region Public Methods @@ -176,12 +113,6 @@ namespace HandBrakeWPF.Services.Scan { try { - lock (LogLock) - { - this.scanLog.Close(); - this.scanLog.Dispose(); - this.scanLog = null; - } this.instance.Dispose(); } catch (Exception) @@ -193,33 +124,7 @@ namespace HandBrakeWPF.Services.Scan // Handle the post scan operation. this.postScanOperation = postAction; - // Clear down the logging - this.logging.Clear(); - - try - { - // Make we don't pick up a stale last_scan_log_xyz.txt (and that we have rights to the file) - if (File.Exists(this.dvdInfoPath)) - { - File.Delete(this.dvdInfoPath); - } - } - catch (Exception exc) - { - Debug.WriteLine(exc); - } - - if (!Directory.Exists(Path.GetDirectoryName(this.dvdInfoPath))) - { - Directory.CreateDirectory(Path.GetDirectoryName(this.dvdInfoPath)); - } - - // Create a new scan log. - this.scanLog = new StreamWriter(this.dvdInfoPath); - // Create a new HandBrake Instance. - HandBrakeUtils.MessageLogged += this.HandBrakeInstanceMessageLogged; - HandBrakeUtils.ErrorLogged += this.HandBrakeInstanceErrorLogged; this.instance = HandBrakeInstanceManager.GetScanInstance(configuraiton.Verbosity); this.instance.ScanProgress += this.InstanceScanProgress; this.instance.ScanCompleted += this.InstanceScanCompleted; @@ -238,16 +143,6 @@ namespace HandBrakeWPF.Services.Scan this.ServiceLogMessage("Stopping Scan."); this.IsScanning = false; this.instance.StopScan(); - - lock (LogLock) - { - if (this.scanLog != null) - { - this.scanLog.Close(); - this.scanLog.Dispose(); - this.scanLog = null; - } - } } catch (Exception exc) { @@ -339,8 +234,6 @@ namespace HandBrakeWPF.Services.Scan { try { - this.logging.Clear(); - string source = sourcePath.ToString().EndsWith("\\") ? string.Format("\"{0}\\\\\"", sourcePath.ToString().TrimEnd('\\')) : "\"" + sourcePath + "\""; this.currentSourceScanPath = source; @@ -362,8 +255,7 @@ namespace HandBrakeWPF.Services.Scan this.ServiceLogMessage("Scan Failed ..." + Environment.NewLine + exc); this.Stop(); - if (this.ScanCompleted != null) - this.ScanCompleted(this, new ScanCompletedEventArgs(false, exc, "An Error has occured in ScanService.ScanSource()", null)); + this.ScanCompleted?.Invoke(this, new ScanCompletedEventArgs(false, exc, "An Error has occured in ScanService.ScanSource()", null)); } } @@ -385,22 +277,6 @@ namespace HandBrakeWPF.Services.Scan bool cancelled = this.isCancelled; this.isCancelled = false; - // Write the log file out before we start processing incase we crash. - try - { - if (this.scanLog != null) - { - this.scanLog.Flush(); - } - } - catch (Exception exc) - { - Debug.WriteLine(exc); - } - - HandBrakeUtils.MessageLogged -= this.HandBrakeInstanceMessageLogged; - HandBrakeUtils.ErrorLogged -= this.HandBrakeInstanceErrorLogged; - // TODO -> Might be a better place to fix this. string path = this.currentSourceScanPath; if (this.currentSourceScanPath.Contains("\"")) @@ -449,8 +325,8 @@ namespace HandBrakeWPF.Services.Scan { if (this.ScanStatusChanged != null) { - HandBrakeWPF.Services.Scan.EventArgs.ScanProgressEventArgs eventArgs = - new HandBrakeWPF.Services.Scan.EventArgs.ScanProgressEventArgs + EventArgs.ScanProgressEventArgs eventArgs = + new EventArgs.ScanProgressEventArgs { CurrentTitle = e.CurrentTitle, Titles = e.Titles, @@ -462,34 +338,6 @@ namespace HandBrakeWPF.Services.Scan } /// <summary> - /// Log a message - /// </summary> - /// <param name="sender"> - /// The sender. - /// </param> - /// <param name="e"> - /// The MessageLoggedEventArgs. - /// </param> - private void HandBrakeInstanceErrorLogged(object sender, MessageLoggedEventArgs e) - { - this.LogMessage(e.Message); - } - - /// <summary> - /// Log a message - /// </summary> - /// <param name="sender"> - /// The sender. - /// </param> - /// <param name="e"> - /// The MessageLoggedEventArgs. - /// </param> - private void HandBrakeInstanceMessageLogged(object sender, MessageLoggedEventArgs e) - { - this.LogMessage(e.Message); - } - - /// <summary> /// Convert Interop Title objects to App Services Title object /// </summary> /// <param name="titles"> @@ -587,25 +435,6 @@ namespace HandBrakeWPF.Services.Scan } /// <summary> - /// The log message. - /// </summary> - /// <param name="message"> - /// The message. - /// </param> - private void LogMessage(string message) - { - lock (LogLock) - { - if (this.scanLog != null) - { - this.scanLog.WriteLine(message); - } - - this.logging.AppendLine(message); - } - } - - /// <summary> /// The service log message. /// </summary> /// <param name="message"> @@ -613,7 +442,7 @@ namespace HandBrakeWPF.Services.Scan /// </param> protected void ServiceLogMessage(string message) { - this.LogMessage(string.Format("# {0}", message)); + this.log.LogMessage(string.Format("{0} # {1}{0}", Environment.NewLine, message), LogMessageType.ScanOrEncode, LogLevel.Info); } #endregion } |