OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Program.cs
index b5af0d7..ae9edec 100644 (file)
@@ -1,3 +1,9 @@
+/*  Program.cs \r
+       \r
+          This file is part of the HandBrake source code.\r
+          Homepage: <http://handbrake.fr>.\r
+          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.Collections.Specialized;\r
@@ -11,6 +17,7 @@ using System.IO;
 using System.Diagnostics;\r
 using System.Threading;\r
 using System.Runtime.InteropServices;\r
+using System.Globalization;\r
 \r
 \r
 namespace Handbrake\r
@@ -23,9 +30,9 @@ namespace Handbrake
         [STAThread]\r
         static void Main()\r
         {\r
-            // 633265950858281250 = 16:52 28-Sep-07  //864000000000 nanoseconds per day\r
-            //long start = DateTime.Now.Ticks;\r
-            //if (start > 633274593039531250) {MessageBox.Show("Sorry, This development build of Handbrake has expired."); return; } // Will Expire Oct 8th\r
+            // Development Code Expiry.\r
+            // Remember to comment out on public release!!!\r
+            //if (DateTime.Now > DateTime.Parse("2008/02/25", new CultureInfo("en-US"))) { MessageBox.Show("Sorry, This development build of Handbrake has expired."); return; } \r
 \r
             // Check the system meets the system requirements.\r
             Boolean launch = true;\r
@@ -40,24 +47,20 @@ namespace Handbrake
                 }\r
 \r
                 // Make sure the system has enough RAM. 384MB or greater\r
-                uint memory = MemoryCheck.CheckMemeory();\r
-                memory = memory / 1024 / 1024;\r
-               \r
-                if (memory < 320)\r
+                Functions.SystemInfo info = new Functions.SystemInfo();\r
+                uint memory = info.TotalPhysicalMemory();\r
+                \r
+                if (memory < 256)\r
                 {\r
-                    MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n Insufficient RAM. 512MB or greater required. You have: " + memory.ToString() + "MB", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                    MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n Insufficient RAM. 384MB or greater required. You have: " + memory.ToString() + "MB", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
                     launch = false;\r
                 }\r
             }\r
             catch (Exception exc)\r
             {\r
-                if (Properties.Settings.Default.GuiDebug == "Checked")\r
-                {\r
-                    MessageBox.Show("frmMain.cs - systemCheck() " + exc.ToString());\r
-                }\r
+                MessageBox.Show("frmMain.cs - systemCheck() " + exc.ToString());\r
             }\r
 \r
-\r
             // Either Launch or Close the Application\r
             if (launch == true)\r
             {\r
@@ -72,37 +75,4 @@ namespace Handbrake
         }\r
     }\r
 \r
-    class MemoryCheck\r
-    {\r
-        public struct MEMORYSTATUS\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
-            // Aditional Varibles left in for future usage (JIC)\r
-        }\r
-\r
-        [DllImport("kernel32.dll")]\r
-        public static extern void GlobalMemoryStatus\r
-        (\r
-            ref MEMORYSTATUS lpBuffer\r
-        );\r
-\r
-        public static uint CheckMemeory()\r
-        {\r
-            // Call the native GlobalMemoryStatus method\r
-            // with the defined structure.\r
-            MEMORYSTATUS memStatus = new MEMORYSTATUS();\r
-            GlobalMemoryStatus(ref memStatus);\r
-\r
-            uint MemoryInfo = memStatus.dwTotalPhys;\r
-\r
-            return MemoryInfo;\r
-        }\r
-    }\r
 }
\ No newline at end of file