It may be used under the terms of the GNU General Public License. */\r
\r
using System;\r
-using System.Collections.Generic;\r
using System.Windows.Forms;\r
using System.IO;\r
using System.Threading;\r
-using System.Runtime.InteropServices;\r
+using Handbrake.EncodeQueue;\r
+using Handbrake.Functions;\r
using Microsoft.Win32;\r
\r
\r
delegate void SetTextCallback(string text);\r
String read_file;\r
Thread monitor;\r
- Queue.QueueHandler encodeQueue;\r
+ QueueHandler encodeQueue;\r
int position; // Position in the arraylist reached by the current log output in the rtf box.\r
+ string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
+ private frmMain mainWin;\r
\r
/// <summary>\r
/// This window should be used to display the RAW output of the handbrake CLI which is produced during an encode.\r
/// </summary>\r
- public frmActivityWindow(string file, Queue.QueueHandler eh)\r
+ public frmActivityWindow(string file, QueueHandler eh, frmMain mw)\r
{\r
InitializeComponent();\r
\r
encodeQueue = eh;\r
read_file = file;\r
position = 0;\r
+ mainWin = mw;\r
\r
// When the window closes, we want to abort the monitor thread.\r
this.Disposed += new EventHandler(forceQuit);\r
// Print the Log header in the Rich text box.\r
displayLogHeader();\r
\r
- if (file == "dvdinfo.dat")\r
+ if (file == "last_scan_log.txt")\r
txt_log.Text = "Scan Log";\r
- else if (file == "hb_encode_log.dat")\r
+ else if (file == "last_encode_log.txt")\r
txt_log.Text = "Encode Log";\r
\r
// Start a new thread which will montior and keep the log window up to date if required/\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
- if (encodeQueue.isEncoding && encodeQueue.lastQueueItem.Query != String.Empty)\r
+ if (encodeQueue.IsEncoding && encodeQueue.LastEncode.Query != String.Empty)\r
{\r
- rtf_actLog.AppendText("### CLI Query: " + encodeQueue.lastQueueItem.Query + "\n\n");\r
+ rtf_actLog.AppendText("### CLI Query: " + encodeQueue.LastEncode.Query + "\n\n");\r
rtf_actLog.AppendText("#########################################\n\n");\r
}\r
}\r
{\r
try\r
{\r
- string logFile = Path.Combine(Path.GetTempPath(), file);\r
+ string logFile = Path.Combine(logDir, file);\r
if (File.Exists(logFile))\r
{\r
// Start a new thread to run the autoUpdate process\r
updateTextFromThread();\r
while (true)\r
{\r
- if (encodeQueue.isEncoding)\r
+ if (encodeQueue.IsEncoding || mainWin.isScanning)\r
updateTextFromThread();\r
else\r
{\r
String appendText = String.Empty;\r
try\r
{\r
- // hb_encode_log.dat is the primary log file. Since .NET can't read this file whilst the CLI is outputing to it (Not even in read only mode),\r
+ // last_encode_log.txt is the primary log file. Since .NET can't read this file whilst the CLI is outputing to it (Not even in read only mode),\r
// we'll need to make a copy of it.\r
- string logFile = Path.Combine(Path.GetTempPath(), read_file);\r
- string logFile2 = Path.Combine(Path.GetTempPath(), "hb_encode_log_AppReadable.dat");\r
+ string logFile = Path.Combine(logDir, read_file);\r
+ string logFile2 = Path.Combine(logDir, "tmp_appReadable_log.txt");\r
\r
// Make sure the application readable log file does not already exist. FileCopy fill fail if it does.\r
if (File.Exists(logFile2))\r
else\r
Clipboard.SetDataObject(rtf_actLog.Text, true);\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
+ System.Diagnostics.Process prc = new System.Diagnostics.Process();\r
+ prc.StartInfo.FileName = windir + @"\explorer.exe";\r
+ prc.StartInfo.Arguments = logDir;\r
+ prc.Start();\r
+ }\r
private void btn_copy_Click(object sender, EventArgs e)\r
{\r
if (rtf_actLog.SelectedText != "")\r
monitor.Abort();\r
\r
rtf_actLog.Clear();\r
- read_file = "dvdinfo.dat";\r
+ read_file = "last_scan_log.txt";\r
displayLogHeader();\r
startLogThread(read_file);\r
txt_log.Text = "Scan Log";\r
monitor.Abort();\r
\r
rtf_actLog.Clear();\r
- read_file = "hb_encode_log.dat";\r
+ read_file = "last_encode_log.txt";\r
position = 0;\r
displayLogHeader();\r
startLogThread(read_file);\r
#endregion\r
\r
#region System Information\r
- private struct MEMORYSTATUS // Unused var's are requred here.\r
- {\r
- public UInt32 dwLength;\r
- public UInt32 dwMemoryLoad;\r
- public UInt32 dwTotalPhys; // Used\r
- public UInt32 dwAvailPhys;\r
- public UInt32 dwTotalPageFile;\r
- public UInt32 dwAvailPageFile;\r
- public UInt32 dwTotalVirtual;\r
- public UInt32 dwAvailVirtual;\r
- }\r
-\r
- [DllImport("kernel32.dll")]\r
- private static extern void GlobalMemoryStatus\r
- (\r
- ref MEMORYSTATUS lpBuffer\r
- );\r
+ \r
\r
/// <summary>\r
/// Returns the total physical ram in a system\r
/// <returns></returns>\r
public uint TotalPhysicalMemory()\r
{\r
- MEMORYSTATUS memStatus = new MEMORYSTATUS();\r
- GlobalMemoryStatus(ref memStatus);\r
+ Win32.MEMORYSTATUS memStatus = new Win32.MEMORYSTATUS();\r
+ Win32.GlobalMemoryStatus(ref memStatus);\r
\r
uint MemoryInfo = memStatus.dwTotalPhys;\r
MemoryInfo = MemoryInfo / 1024 / 1024;\r