OSDN Git Service

CLI: add iso639-2 language code to audio track information display
[handbrake-jp/handbrake-jp-git.git] / win / C# / frmActivityWindow.cs
index d2d1ff1..c308990 100644 (file)
@@ -8,7 +8,8 @@ using System;
 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
@@ -19,14 +20,15 @@ namespace Handbrake
         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
@@ -34,6 +36,7 @@ namespace Handbrake
             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
@@ -65,9 +68,9 @@ namespace Handbrake
             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
@@ -111,7 +114,7 @@ namespace Handbrake
                 updateTextFromThread();\r
                 while (true)\r
                 {\r
-                    if (encodeQueue.isEncoding)\r
+                    if (encodeQueue.IsEncoding || mainWin.isScanning)\r
                         updateTextFromThread();\r
                     else\r
                     {\r
@@ -301,23 +304,7 @@ namespace Handbrake
         #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
@@ -325,8 +312,8 @@ namespace Handbrake
         /// <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