try\r
{\r
if (fileWriter != null)\r
+ {\r
fileWriter.Close();\r
+ fileWriter.Dispose();\r
+ }\r
}\r
catch (Exception exc)\r
{\r
catch (Exception exc)\r
{\r
if (fileWriter != null)\r
+ {\r
fileWriter.Close();\r
+ fileWriter.Dispose();\r
+ }\r
\r
errorService.ShowError("Error", exc.ToString());\r
}\r
\r
try\r
{\r
- if (fileWriter != null)\r
+ if (fileWriter != null && fileWriter.BaseStream.CanWrite)\r
+ {\r
fileWriter.WriteLine(e.Data);\r
+ } \r
}\r
catch (Exception exc)\r
{\r
- // errorService.ShowError("Unable to write log data...", exc.ToString());\r
+ // errorService.ShowError("Unable to write log data...", exc.ToString());\r
}\r
}\r
}\r
/// </param>\r
public void ShowError(string shortError, string longError)\r
{\r
- Thread newThread = new Thread(new ParameterizedThreadStart(WriteExceptionToFile));\r
- newThread.Start(shortError + Environment.NewLine + longError);\r
+ try\r
+ {\r
+ Thread newThread = new Thread(new ParameterizedThreadStart(WriteExceptionToFile));\r
+ newThread.Start(shortError + Environment.NewLine + longError);\r
+ }\r
+ catch (Exception)\r
+ {\r
+ // Do Nothing\r
+ }\r
\r
ExceptionWindow window = new ExceptionWindow();\r
window.Setup(shortError, longError);\r
}\r
\r
/// <summary>\r
+ /// Show a Notice or Warning Message.\r
+ /// </summary>\r
+ /// <param name="notice">\r
+ /// The text to display to the user\r
+ /// </param>\r
+ /// <param name="isWarning">\r
+ /// Is a warning window, show the warning icon instead of the notice\r
+ /// </param>\r
+ public void ShowNotice(string notice, bool isWarning)\r
+ {\r
+ throw new NotImplementedException();\r
+ }\r
+\r
+ /// <summary>\r
/// Write Exceptions out to log files\r
/// </summary>\r
/// <param name="state">\r
/// </param>\r
public void WriteExceptionToFile(object state)\r
{\r
- string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
- string file = Path.Combine(logDir, string.Format("Exception_{0}.txt", DateTime.Now.Ticks));\r
-\r
try\r
{\r
+ string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
+ string file = Path.Combine(logDir, string.Format("Exception_{0}.txt", DateTime.Now.Ticks));\r
+\r
if (!File.Exists(file))\r
{\r
using (StreamWriter streamWriter = new StreamWriter(file))\r
return; // Game over. Stop digging.\r
}\r
}\r
-\r
- /// <summary>\r
- /// Show a Notice or Warning Message.\r
- /// </summary>\r
- /// <param name="notice">\r
- /// The text to display to the user\r
- /// </param>\r
- /// <param name="isWarning">\r
- /// Is a warning window, show the warning icon instead of the notice\r
- /// </param>\r
- public void ShowNotice(string notice, bool isWarning)\r
- {\r
- throw new NotImplementedException();\r
- }\r
}\r
}\r