+ sr.Dispose();\r
+\r
+ }\r
+ catch (Exception exc)\r
+ {\r
+ appendText.AppendFormat("\n The Log file could not be read. You may need to restart HandBrake! " + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ _position = 0;\r
+ ClearWindowText();\r
+ }\r
+ return appendText;\r
+ }\r
+ private void AppendWindowText(StringBuilder text)\r
+ {\r
+ try\r
+ {\r
+ if (IsHandleCreated)\r
+ {\r
+ if (rtf_actLog.InvokeRequired)\r
+ {\r
+ IAsyncResult invoked = BeginInvoke(new setTextCallback(AppendWindowText), new object[] { text });\r
+ EndInvoke(invoked);\r
+ }\r
+ else\r
+ rtf_actLog.AppendText(text.ToString());\r
+ }\r
+ } catch(ThreadInterruptedException)\r
+ {\r
+ // Do Nothing\r
+ }\r
+ catch (Exception exc)\r
+ {\r
+ MessageBox.Show("Unless you are having problems, you can probably ignore this error. It would not hurt to report this error!\n\nSetWindowText(): Exception: \n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);\r
+ }\r
+ }\r
+ private void ClearWindowText()\r
+ {\r
+ try\r
+ {\r
+ if (IsHandleCreated)\r
+ {\r
+ if (rtf_actLog.InvokeRequired)\r
+ {\r
+ IAsyncResult invoked = BeginInvoke(new setTextClearCallback(ClearWindowText));\r
+ EndInvoke(invoked);\r
+ }\r
+ else\r
+ rtf_actLog.Clear();\r
+ }\r
+ }\r
+ catch (Exception exc)\r
+ {\r
+ MessageBox.Show("Unless you are having problems, you can probably ignore this error. It would not hurt to report this error!\n\nClearWindowText(): Exception: \n" + exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);\r
+ }\r
+ }\r
+ private void PrintLogHeader()\r
+ {\r
+ try\r
+ {\r
+ if (IsHandleCreated)\r
+ {\r
+ if (rtf_actLog.InvokeRequired)\r
+ {\r
+ IAsyncResult invoked = BeginInvoke(new setTextClearCallback(PrintLogHeader));\r
+ EndInvoke(invoked);\r
+ }\r
+ else\r
+ {\r
+ // Print the log header. This function will be re-implimented later. Do not delete.\r
+ rtf_actLog.AppendText(String.Format("### Windows GUI {1} {0} \n", Properties.Settings.Default.hb_build, Properties.Settings.Default.hb_version));\r
+ rtf_actLog.AppendText(String.Format("### Running: {0} \n###\n", Environment.OSVersion));\r
+ rtf_actLog.AppendText(String.Format("### CPU: {0} \n", getCpuCount()));\r
+ rtf_actLog.AppendText(String.Format("### Ram: {0} MB \n", TotalPhysicalMemory()));\r
+ rtf_actLog.AppendText(String.Format("### Screen: {0}x{1} \n", screenBounds().Bounds.Width, screenBounds().Bounds.Height));\r
+ rtf_actLog.AppendText(String.Format("### Temp Dir: {0} \n", Path.GetTempPath()));\r
+ rtf_actLog.AppendText(String.Format("### Install Dir: {0} \n", Application.StartupPath));\r
+ rtf_actLog.AppendText(String.Format("### Data Dir: {0} \n", Application.UserAppDataPath));\r
+ rtf_actLog.AppendText("#########################################\n\n");\r
+ }\r
+ }\r