diff options
author | sr55 <[email protected]> | 2010-09-26 16:10:16 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2010-09-26 16:10:16 +0000 |
commit | 944fe868810ac0438ae97b1ade8c7cff2de05192 (patch) | |
tree | 886d04c858ea026d938b83c8b6fe0ba1e5af262d /win/C#/HandBrake.ApplicationServices/Services | |
parent | 1bca5338bb277f7351c67c890fc8fbc6b4fdbc71 (diff) |
WinGui:
- The scan log will no longer be written to disk if the log is over 100MB. An error message will be thrown.
- The encode will be terminated if the log file grows beyond 100MB and an error message will be thrown.
- Fixed an issue with the exception window not appearing when called from a worker thead.
- Put a limit on the number of exception windows that can appear during a session of HandBrake. (set to 30)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3554 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/HandBrake.ApplicationServices/Services')
-rw-r--r-- | win/C#/HandBrake.ApplicationServices/Services/Encode.cs | 10 | ||||
-rw-r--r-- | win/C#/HandBrake.ApplicationServices/Services/Scan.cs | 32 |
2 files changed, 32 insertions, 10 deletions
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs index 95cc57676..a0340c656 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs @@ -242,7 +242,7 @@ namespace HandBrake.ApplicationServices.Services {
try
{
- if (this.HbProcess != null) this.HbProcess.Kill();
+ if (this.HbProcess != null && !this.HbProcess.HasExited) this.HbProcess.Kill();
}
catch (Exception exc)
{
@@ -464,6 +464,14 @@ namespace HandBrake.ApplicationServices.Services if (fileWriter != null && fileWriter.BaseStream.CanWrite)
{
fileWriter.WriteLine(e.Data);
+
+ // If the logging grows past 100MB, kill the encode and stop.
+ if (fileWriter.BaseStream.Length > 100000000)
+ {
+ this.Stop();
+ errorService.ShowError("The encode has been stopped. The log file has grown to over 100MB which indicates a serious problem has occured with the encode.",
+ "Please check the encode log for an indication of what the problem is.");
+ }
}
}
catch (Exception exc)
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Scan.cs b/win/C#/HandBrake.ApplicationServices/Services/Scan.cs index 45bd37a90..c18fad3d8 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/Scan.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/Scan.cs @@ -28,7 +28,7 @@ namespace HandBrake.ApplicationServices.Services /// <summary>
/// The Error Service
/// </summary>
- private IErrorService errorService;
+ private readonly IErrorService errorService;
/// <summary>
/// A Lock object
@@ -138,7 +138,7 @@ namespace HandBrake.ApplicationServices.Services {
try
{
- if (hbProc != null)
+ if (hbProc != null && !hbProc.HasExited)
hbProc.Kill();
}
catch (Exception ex)
@@ -205,12 +205,21 @@ namespace HandBrake.ApplicationServices.Services this.SouceData = DVD.Parse(this.readData);
// Write the Buffer out to file.
- StreamWriter scanLog = new StreamWriter(dvdInfoPath);
- scanLog.WriteLine(Logging.CreateCliLogHeader(null));
- scanLog.Write(this.readData.Buffer);
- scanLog.Flush();
- scanLog.Close();
- logBuffer.AppendLine(this.readData.Buffer.ToString());
+ using (StreamWriter scanLog = new StreamWriter(dvdInfoPath))
+ {
+ // Only write the log file to disk if it's less than 100MB.
+ if (this.readData.Buffer.Length < 100000000)
+ {
+ scanLog.WriteLine(Logging.CreateCliLogHeader(null));
+ scanLog.Write(this.readData.Buffer);
+ logBuffer.AppendLine(this.readData.Buffer.ToString());
+ }
+ else
+ {
+ throw new Exception(
+ "The Log file has not been written to disk as it has grown above the 100MB limit. This indicates there was a problem during the scan process.");
+ }
+ }
IsScanning = false;
@@ -219,7 +228,12 @@ namespace HandBrake.ApplicationServices.Services }
catch (Exception exc)
{
- errorService.ShowError("frmMain.cs - scanProcess() Error", exc.ToString());
+ this.Stop();
+
+ errorService.ShowError("An error has occured during the scan process.", exc.ToString());
+
+ if (this.ScanCompleted != null)
+ this.ScanCompleted(this, new EventArgs());
}
}
|