From 324483418fb3049f992999b1dd8881235f35116b Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 25 Jul 2010 16:20:32 +0000 Subject: WinGui: - Fix some issues with the log window repeating the log header. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3460 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../HandBrake.ApplicationServices/Services/Scan.cs | 22 +++++++++++++--------- win/C#/frmActivityWindow.cs | 1 + 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/win/C#/HandBrake.ApplicationServices/Services/Scan.cs b/win/C#/HandBrake.ApplicationServices/Services/Scan.cs index da8d34f7c..558dbb8a7 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/Scan.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/Scan.cs @@ -94,7 +94,7 @@ namespace HandBrake.ApplicationServices.Services if (logBuffer == null) { - ResetLogReader(); + ResetLogReader(false); ReadLastScanFile(); } @@ -149,12 +149,12 @@ namespace HandBrake.ApplicationServices.Services if (this.ScanStared != null) this.ScanStared(this, new EventArgs()); - ResetLogReader(); + ResetLogReader(true); string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe"); string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; - string dvdInfoPath = Path.Combine(logDir, string.Format("last_scan_log{0}.txt", Init.InstanceId)); + string dvdInfoPath = Path.Combine(logDir, string.Format("last_scan_log{0}.txt", Init.InstanceId == 0 ? string.Empty : Init.InstanceId.ToString())); // Make we don't pick up a stale last_encode_log.txt (and that we have rights to the file) if (File.Exists(dvdInfoPath)) @@ -219,8 +219,8 @@ namespace HandBrake.ApplicationServices.Services // we'll need to make a copy of it. string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; - string logFile = Path.Combine(logDir, string.Format("last_scan_log{0}.txt", Init.InstanceId)); - string logFile2 = Path.Combine(logDir, string.Format("tmp_appReadable_log{0}.txt", Init.InstanceId)); + string logFile = Path.Combine(logDir, string.Format("last_scan_log{0}.txt", Init.InstanceId == 0 ? string.Empty : Init.InstanceId.ToString())); + string logFile2 = Path.Combine(logDir, string.Format("tmp_appReadable_log{0}.txt", Init.InstanceId == 0 ? string.Empty : Init.InstanceId.ToString())); try { @@ -233,7 +233,7 @@ namespace HandBrake.ApplicationServices.Services File.Copy(logFile, logFile2, true); else { - ResetLogReader(); + ResetLogReader(true); return; } @@ -257,7 +257,7 @@ namespace HandBrake.ApplicationServices.Services catch (Exception exc) { Console.WriteLine(exc.ToString()); - ResetLogReader(); + ResetLogReader(true); } } } @@ -265,11 +265,15 @@ namespace HandBrake.ApplicationServices.Services /// /// Reset the Log Reader /// - private void ResetLogReader() + /// + /// The add Header. + /// + private void ResetLogReader(bool addHeader) { logFilePosition = 0; logBuffer = new StringBuilder(); - logBuffer.AppendLine(Logging.CreateCliLogHeader(null)); + if (addHeader) + logBuffer.AppendLine(Logging.CreateCliLogHeader(null)); } /// diff --git a/win/C#/frmActivityWindow.cs b/win/C#/frmActivityWindow.cs index 62799e926..598851f78 100644 --- a/win/C#/frmActivityWindow.cs +++ b/win/C#/frmActivityWindow.cs @@ -199,6 +199,7 @@ namespace Handbrake private void stopWindowRefresh(object sender, EventArgs e) { windowTimer.Dispose(); + Reset(); LogMonitor(null); } -- cgit v1.2.3