X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=win%2FC%23%2FProgram.cs;h=282f9f528e99a2ba756b823268533bcd19f3f3b3;hb=b8c7cf18f82ad8552e4a79ab3e93794a2e7759e5;hp=25a4d415df32e1e51ff1bc28274cebe32e82a01a;hpb=d5b6c5851153b6d552a06245a1848755d102dc1c;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/win/C#/Program.cs b/win/C#/Program.cs index 25a4d415..282f9f52 100644 --- a/win/C#/Program.cs +++ b/win/C#/Program.cs @@ -1,23 +1,13 @@ /* Program.cs This file is part of the HandBrake source code. - Homepage: . + Homepage: . It may be used under the terms of the GNU General Public License. */ using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; -using System.Net; using System.IO; -using System.Diagnostics; -using System.Threading; -using System.Runtime.InteropServices; - +using Handbrake.Presets; namespace Handbrake { @@ -29,84 +19,26 @@ namespace Handbrake [STAThread] static void Main() { - - // Development Code Expiry. - // Remember to comment out on public release!!! - if (DateTime.Now > DateTime.Parse("20/1/2008")) { MessageBox.Show("Sorry, This development build of Handbrake has expired."); return; } - - // Check the system meets the system requirements. - Boolean launch = true; - try + Screen scr = Screen.PrimaryScreen; + if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 620)) + MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n" + "Your screen is running at: " + scr.Bounds.Width + "x" + scr.Bounds.Height + " \nScreen resolution is too Low. Must be 1024x620 or greater", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + else { - // Make sure the screen resolution is not below 1024x768 - System.Windows.Forms.Screen scr = System.Windows.Forms.Screen.PrimaryScreen; - if ((scr.Bounds.Width < 1024) || (scr.Bounds.Height < 720)) - { - MessageBox.Show("Your system does not meet the minimum requirements for HandBrake. \n" + "Your screen is running at: " + scr.Bounds.Width.ToString() + "x" + scr.Bounds.Height.ToString() + " \nScreen resolution is too Low. Must be 1024x720 or greater", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - launch = false; - } - - // Make sure the system has enough RAM. 384MB or greater - uint memory = MemoryCheck.CheckMemeory(); - memory = memory / 1024 / 1024; + string logDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\logs"); + if (!Directory.Exists(logDir)) + Directory.CreateDirectory(logDir); - if (memory < 256) + if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\presets.xml"))) { - 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); - launch = false; + PresetsHandler x = new PresetsHandler(); + x.UpdateBuiltInPresets(); } - } - catch (Exception exc) - { - MessageBox.Show("frmMain.cs - systemCheck() " + exc.ToString()); - } - - // Either Launch or Close the Application - if (launch == true) - { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMain()); } - else - { - Application.Exit(); - } } } - class MemoryCheck - { - public struct MEMORYSTATUS - { - public UInt32 dwLength; - public UInt32 dwMemoryLoad; - public UInt32 dwTotalPhys; // Used - public UInt32 dwAvailPhys; - public UInt32 dwTotalPageFile; - public UInt32 dwAvailPageFile; - public UInt32 dwTotalVirtual; - public UInt32 dwAvailVirtual; - // Aditional Varibles left in for future usage (JIC) - } - - [DllImport("kernel32.dll")] - public static extern void GlobalMemoryStatus - ( - ref MEMORYSTATUS lpBuffer - ); - - public static uint CheckMemeory() - { - // Call the native GlobalMemoryStatus method - // with the defined structure. - MEMORYSTATUS memStatus = new MEMORYSTATUS(); - GlobalMemoryStatus(ref memStatus); - - uint MemoryInfo = memStatus.dwTotalPhys; - - return MemoryInfo; - } - } } \ No newline at end of file