diff options
author | sr55 <[email protected]> | 2010-09-17 18:28:54 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2010-09-17 18:28:54 +0000 |
commit | 1362ca5a538b86879bdcf709cb1eadb87a11d099 (patch) | |
tree | 4f2b2e678bc4e3508ce2e8d97c714c6fb41e151d /win/C#/HandBrake.ApplicationServices/Services | |
parent | e385cf30ef27c0e09ae60e39af62ee9bdae977f9 (diff) |
WinGui:
- Another fix to the Encode Log Writer which should hopefully fix the "ObjectDisposedException" some users were seeing.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3538 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/HandBrake.ApplicationServices/Services')
-rw-r--r-- | win/C#/HandBrake.ApplicationServices/Services/Encode.cs | 12 | ||||
-rw-r--r-- | win/C#/HandBrake.ApplicationServices/Services/ErrorService.cs | 45 |
2 files changed, 36 insertions, 21 deletions
diff --git a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs index d922b66e6..42d2822ea 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/Encode.cs @@ -346,7 +346,10 @@ namespace HandBrake.ApplicationServices.Services try
{
if (fileWriter != null)
+ {
fileWriter.Close();
+ fileWriter.Dispose();
+ }
}
catch (Exception exc)
{
@@ -430,7 +433,10 @@ namespace HandBrake.ApplicationServices.Services catch (Exception exc)
{
if (fileWriter != null)
+ {
fileWriter.Close();
+ fileWriter.Dispose();
+ }
errorService.ShowError("Error", exc.ToString());
}
@@ -454,12 +460,14 @@ namespace HandBrake.ApplicationServices.Services try
{
- if (fileWriter != null)
+ if (fileWriter != null && fileWriter.BaseStream.CanWrite)
+ {
fileWriter.WriteLine(e.Data);
+ }
}
catch (Exception exc)
{
- // errorService.ShowError("Unable to write log data...", exc.ToString());
+ // errorService.ShowError("Unable to write log data...", exc.ToString());
}
}
}
diff --git a/win/C#/HandBrake.ApplicationServices/Services/ErrorService.cs b/win/C#/HandBrake.ApplicationServices/Services/ErrorService.cs index a45cd113f..7b75ce893 100644 --- a/win/C#/HandBrake.ApplicationServices/Services/ErrorService.cs +++ b/win/C#/HandBrake.ApplicationServices/Services/ErrorService.cs @@ -28,8 +28,15 @@ namespace HandBrake.ApplicationServices.Services /// </param>
public void ShowError(string shortError, string longError)
{
- Thread newThread = new Thread(new ParameterizedThreadStart(WriteExceptionToFile));
- newThread.Start(shortError + Environment.NewLine + longError);
+ try
+ {
+ Thread newThread = new Thread(new ParameterizedThreadStart(WriteExceptionToFile));
+ newThread.Start(shortError + Environment.NewLine + longError);
+ }
+ catch (Exception)
+ {
+ // Do Nothing
+ }
ExceptionWindow window = new ExceptionWindow();
window.Setup(shortError, longError);
@@ -37,6 +44,20 @@ namespace HandBrake.ApplicationServices.Services }
/// <summary>
+ /// Show a Notice or Warning Message.
+ /// </summary>
+ /// <param name="notice">
+ /// The text to display to the user
+ /// </param>
+ /// <param name="isWarning">
+ /// Is a warning window, show the warning icon instead of the notice
+ /// </param>
+ public void ShowNotice(string notice, bool isWarning)
+ {
+ throw new NotImplementedException();
+ }
+
+ /// <summary>
/// Write Exceptions out to log files
/// </summary>
/// <param name="state">
@@ -44,11 +65,11 @@ namespace HandBrake.ApplicationServices.Services /// </param>
public void WriteExceptionToFile(object state)
{
- string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
- string file = Path.Combine(logDir, string.Format("Exception_{0}.txt", DateTime.Now.Ticks));
-
try
{
+ string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
+ string file = Path.Combine(logDir, string.Format("Exception_{0}.txt", DateTime.Now.Ticks));
+
if (!File.Exists(file))
{
using (StreamWriter streamWriter = new StreamWriter(file))
@@ -64,19 +85,5 @@ namespace HandBrake.ApplicationServices.Services return; // Game over. Stop digging.
}
}
-
- /// <summary>
- /// Show a Notice or Warning Message.
- /// </summary>
- /// <param name="notice">
- /// The text to display to the user
- /// </param>
- /// <param name="isWarning">
- /// Is a warning window, show the warning icon instead of the notice
- /// </param>
- public void ShowNotice(string notice, bool isWarning)
- {
- throw new NotImplementedException();
- }
}
}
|