/// <summary> /// Initializes a new instance of the <see cref="frmAddPreset"/> class. /// </summary> /// <param name="mainWindow"> /// The Main Window /// </param> /// <param name="presetHandler"> /// The preset handler. /// </param> public frmAddPreset(frmMain mainWindow, PresetService presetHandler) { InitializeComponent(); this.mainWindow = mainWindow; presetCode = presetHandler; cb_usePictureSettings.SelectedIndex = 0; }
public static void Main(string[] args) { InstanceId = Process.GetProcessesByName("HandBrake").Length; // Handle any unhandled exceptions AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException; // Check that HandBrakeCLI is availabl. string failedInstall = "HandBrake is not installed properly. Please reinstall HandBrake. \n\n"; string missingFiles = string.Empty; // Verify HandBrakeCLI.exe exists if (!File.Exists(Path.Combine(Application.StartupPath, "HandBrakeCLI.exe"))) { missingFiles += "\"HandBrakeCLI.exe\" was not found."; } if (missingFiles != string.Empty) { MessageBox.Show( failedInstall + missingFiles, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Attempt to upgrade / keep the users settings between versions if (Settings.Default.UpdateRequired) { Settings.Default.Upgrade(); // Reset some settings Settings.Default.UpdateRequired = false; Settings.Default.CliExeHash = null; Settings.Default.hb_build = 0; Settings.Default.hb_platform = null; Settings.Default.hb_version = null; // Re-detect the CLI version data. Functions.Main.SetCliVersionData(); } // Check were not running on a screen that's going to cause some funnies to happen. 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.\n\n", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string logDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\logs"); if (!Directory.Exists(logDir)) Directory.CreateDirectory(logDir); if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\presets.xml"))) { PresetService x = new PresetService(); x.UpdateBuiltInPresets(string.Empty); } InitializeApplicationServices(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmMain(args)); } }