+ 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
+ lock (rtf_actLog)\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", \r
+ Properties.Settings.Default.hb_build, \r
+ 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", SystemInfo.GetCpuCount));\r
+ rtf_actLog.AppendText(String.Format("### Ram: {0} MB \n", SystemInfo.TotalPhysicalMemory));\r
+ rtf_actLog.AppendText(String.Format("### Screen: {0}x{1} \n", \r
+ SystemInfo.ScreenBounds.Bounds.Width, \r
+ SystemInfo.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
+ }\r
+ }\r
+ catch (Exception)\r
+ {\r
+ return;\r
+ }\r
+ }\r
+\r
+ private void Reset()\r
+ {\r
+ if (WindowTimer != null)\r
+ WindowTimer.Dispose();\r
+ Position = 0;\r
+ ClearWindowText();\r
+ PrintLogHeader();\r
+ WindowTimer = new Timer(new TimerCallback(LogMonitor), null, 1000, 1000);\r
+ }\r
+\r
+ #region Public\r
+\r
+ public string SetLogFile\r
+ {\r
+ get { return string.IsNullOrEmpty(CurrentMode) ? string.Empty : CurrentMode; }\r
+ set { CurrentMode = value; }\r
+ }\r
+\r
+ public void SetScanMode()\r
+ {\r
+ Reset();\r
+ SetLogFile = "last_scan_log.txt";\r
+ this.Text = "Activity Window (Scan Log)";\r
+ }\r
+\r
+ public void SetEncodeMode()\r
+ {\r
+ Reset();\r
+ SetLogFile = "last_encode_log.txt";\r
+ this.Text = "Activity Window (Enocde Log)";\r
+ }\r
+\r
+ #endregion\r
+\r
+ #region User Interface\r
+\r
+ private void mnu_copy_log_Click(object sender, EventArgs e)\r
+ {\r
+ Clipboard.SetDataObject(rtf_actLog.SelectedText != string.Empty ? rtf_actLog.SelectedText : rtf_actLog.Text, true);\r
+ }\r
+\r
+ private void mnu_openLogFolder_Click(object sender, EventArgs e)\r
+ {\r
+ string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
+ string windir = Environment.GetEnvironmentVariable("WINDIR");\r
+ Process prc = new Process\r
+ {\r
+ StartInfo =\r
+ {\r
+ FileName = windir + @"\explorer.exe", \r
+ Arguments = logDir\r
+ }\r
+ };\r
+ prc.Start();\r
+ }\r
+\r