--- /dev/null
+/* Common.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;\r
+using System.Text;\r
+using System.Windows.Forms;\r
+using System.Globalization;\r
+using System.IO;\r
+using System.Drawing;\r
+using System.Diagnostics;\r
+using System.Text.RegularExpressions;\r
+\r
+namespace Handbrake.Functions\r
+{\r
+ class Main\r
+ {\r
+ /// <summary>\r
+ /// Take in a File destination and change it's file extension to a new Extension\r
+ /// </summary>\r
+ /// <param name="destination"></param>\r
+ /// <param name="newExtension"></param>\r
+ /// <returns>String of the new file path and extension</returns>\r
+ public string setExtension(string destination, string newExtension)\r
+ {\r
+ destination.Replace(".mp4", newExtension);\r
+ destination.Replace(".m4v", newExtension);\r
+ destination.Replace(".mkv", newExtension);\r
+ destination.Replace(".avi", newExtension);\r
+ destination.Replace(".ogm", newExtension);\r
+\r
+ return destination;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Calculate the duration of the selected title and chapters\r
+ /// </summary>\r
+ public TimeSpan calculateDuration(string chapter_start, string chapter_end, Parsing.Title selectedTitle)\r
+ {\r
+ TimeSpan Duration = TimeSpan.FromSeconds(0.0);\r
+\r
+ // Get the durations between the 2 chapter points and add them together.\r
+ if (chapter_start != "Auto" && chapter_end != "Auto")\r
+ {\r
+ int start_chapter, end_chapter = 0;\r
+ int.TryParse(chapter_start, out start_chapter);\r
+ int.TryParse(chapter_end, out end_chapter);\r
+\r
+ int position = start_chapter - 1;\r
+\r
+ if (start_chapter <= end_chapter)\r
+ {\r
+ if (end_chapter > selectedTitle.Chapters.Count)\r
+ end_chapter = selectedTitle.Chapters.Count;\r
+\r
+ while (position != end_chapter)\r
+ {\r
+ TimeSpan dur = selectedTitle.Chapters[position].Duration;\r
+ Duration = Duration + dur;\r
+ position++;\r
+ }\r
+ }\r
+ }\r
+ return Duration;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Calculate the non-anamorphic resoltuion of the source\r
+ /// </summary>\r
+ /// <param name="width"></param>\r
+ /// <returns></returns>\r
+ public int cacluateNonAnamorphicHeight(int width, decimal top, decimal bottom, decimal left, decimal right, Parsing.Title selectedTitle)\r
+ {\r
+ float aspect = selectedTitle.AspectRatio;\r
+ int aw;\r
+ int ah;\r
+ if (aspect.ToString() == "1.78")\r
+ {\r
+ aw = 16;\r
+ ah = 9;\r
+ }\r
+ else\r
+ {\r
+ aw = 4;\r
+ ah = 3;\r
+ }\r
+\r
+ double a = width * selectedTitle.Resolution.Width * ah * (selectedTitle.Resolution.Height - (double)top - (double)bottom);\r
+ double b = selectedTitle.Resolution.Height * aw * (selectedTitle.Resolution.Width - (double)left - (double)right);\r
+\r
+ double y = a / b;\r
+\r
+ // If it's not Mod 16, make it mod 16\r
+ if ((y % 16) != 0)\r
+ {\r
+ double mod16 = y % 16;\r
+ if (mod16 >= 8)\r
+ {\r
+ mod16 = 16 - mod16;\r
+ y = y + mod16;\r
+ }\r
+ else\r
+ {\r
+ y = y - mod16;\r
+ }\r
+ }\r
+\r
+ //16 * (421 / 16)\r
+ //double z = ( 16 * (( y + 8 ) / 16 ) );\r
+ int x = int.Parse(y.ToString());\r
+ return x;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Select the longest title in the DVD title dropdown menu on frmMain\r
+ /// </summary>\r
+ public Handbrake.Parsing.Title selectLongestTitle(ComboBox drp_dvdtitle)\r
+ {\r
+ int current_largest = 0;\r
+ Handbrake.Parsing.Title title2Select;\r
+\r
+ // Check if there are titles in the DVD title dropdown menu and make sure, it's not just "Automatic"\r
+ if (drp_dvdtitle.Items[0].ToString() != "Automatic")\r
+ title2Select = (Handbrake.Parsing.Title)drp_dvdtitle.Items[0];\r
+ else\r
+ title2Select = null;\r
+\r
+ // So, If there are titles in the DVD Title dropdown menu, lets select the longest.\r
+ if (title2Select != null)\r
+ {\r
+ foreach (Handbrake.Parsing.Title x in drp_dvdtitle.Items)\r
+ {\r
+ string title = x.ToString();\r
+ if (title != "Automatic")\r
+ {\r
+ string[] y = title.Split(' ');\r
+ string time = y[1].Replace("(", "").Replace(")", "");\r
+ string[] z = time.Split(':');\r
+\r
+ int hours = int.Parse(z[0]) * 60 * 60;\r
+ int minutes = int.Parse(z[1]) * 60;\r
+ int seconds = int.Parse(z[2]);\r
+ int total_sec = hours + minutes + seconds;\r
+\r
+ if (current_largest == 0)\r
+ {\r
+ current_largest = hours + minutes + seconds;\r
+ title2Select = x;\r
+ }\r
+ else\r
+ {\r
+ if (total_sec > current_largest)\r
+ {\r
+ current_largest = total_sec;\r
+ title2Select = x;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return title2Select;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Set's up the DataGridView on the Chapters tab (frmMain)\r
+ /// </summary>\r
+ /// <param name="mainWindow"></param>\r
+ public DataGridView chapterNaming(DataGridView data_chpt, string chapter_start, string chapter_end)\r
+ {\r
+ try\r
+ {\r
+ int i = 0;\r
+ int rowCount = 0;\r
+ int start = 0;\r
+ int finish = 0;\r
+ if (chapter_end != "Auto")\r
+ finish = int.Parse(chapter_end);\r
+\r
+ if (chapter_start != "Auto")\r
+ start = int.Parse(chapter_start);\r
+\r
+ rowCount = finish - (start - 1);\r
+\r
+ while (i < rowCount)\r
+ {\r
+ DataGridViewRow row = new DataGridViewRow();\r
+\r
+ data_chpt.Rows.Insert(i, row);\r
+ data_chpt.Rows[i].Cells[0].Value = (i + 1);\r
+ data_chpt.Rows[i].Cells[1].Value = "Chapter " + (i + 1);\r
+ i++;\r
+ }\r
+ return data_chpt;\r
+ }\r
+ catch (Exception exc)\r
+ {\r
+ MessageBox.Show("chapterNaming() Error has occured: \n" + exc.ToString());\r
+ return null;\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Function which generates the filename and path automatically based on \r
+ /// the Source Name, DVD title and DVD Chapters\r
+ /// </summary>\r
+ /// <param name="mainWindow"></param>\r
+ public string autoName(ComboBox drp_dvdtitle, string chapter_start, string chatper_end, string source, string dest, int format)\r
+ {\r
+\r
+ string AutoNamePath = string.Empty;\r
+\r
+ if (drp_dvdtitle.Text != "Automatic")\r
+ {\r
+ // Todo: This code is a tad messy. Clean it up at some point.\r
+ // Get the Source Name\r
+ string[] sourceName = source.Split('\\');\r
+ source = sourceName[sourceName.Length - 1].Replace(".iso", "").Replace(".mpg", "").Replace(".ts", "").Replace(".ps", "");\r
+\r
+ // Get the Selected Title Number\r
+ string title = drp_dvdtitle.Text;\r
+ string[] titlesplit = title.Split(' ');\r
+ title = titlesplit[0];\r
+\r
+ // Get the Chapter Start and Chapter End Numbers\r
+ string cs = chapter_start;\r
+ string cf = chatper_end;\r
+\r
+ // Just incase the above are set to their default Automatic values, set the varible to ""\r
+ if (title == "Automatic")\r
+ title = "";\r
+ if (cs == "Auto")\r
+ cs = "";\r
+ if (cf == "Auto")\r
+ cf = "";\r
+\r
+ // If both CS and CF are populated, set the dash varible\r
+ string dash = "";\r
+ if (cf != "Auto")\r
+ dash = "-";\r
+\r
+ // Get the destination filename.\r
+ string destination_filename = "";\r
+ if (Properties.Settings.Default.autoNameFormat != "")\r
+ {\r
+ destination_filename = Properties.Settings.Default.autoNameFormat;\r
+ destination_filename = destination_filename.Replace("{source}", source).Replace("{title}", title).Replace("{chapters}", cs + dash + cf);\r
+ }\r
+ else\r
+ destination_filename = source + "_T" + title + "_C" + cs + dash + cf;\r
+\r
+ // If the text box is blank\r
+ if (!dest.Contains("\\"))\r
+ {\r
+ string filePath = "";\r
+ if (Properties.Settings.Default.autoNamePath.Trim() != "")\r
+ {\r
+ if (Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location")\r
+ filePath = Properties.Settings.Default.autoNamePath + "\\";\r
+ }\r
+\r
+ if (format == 0)\r
+ AutoNamePath = filePath + destination_filename + ".mp4";\r
+ else if (format == 1)\r
+ AutoNamePath = filePath + destination_filename + ".m4v";\r
+ else if (format == 2)\r
+ AutoNamePath = filePath + destination_filename + ".mkv";\r
+ else if (format == 3)\r
+ AutoNamePath = filePath + destination_filename + ".avi";\r
+ else if (format == 4)\r
+ AutoNamePath = filePath + destination_filename + ".ogm";\r
+ }\r
+ else // If the text box already has a path and file\r
+ {\r
+ string destination = AutoNamePath;\r
+ string[] destName = dest.Split('\\');\r
+ string[] extension = dest.Split('.');\r
+ string ext = extension[extension.Length - 1];\r
+\r
+ destName[destName.Length - 1] = destination_filename + "." + ext;\r
+\r
+ string fullDest = "";\r
+ foreach (string part in destName)\r
+ {\r
+ if (fullDest != "")\r
+ fullDest = fullDest + "\\" + part;\r
+ else\r
+ fullDest = fullDest + part;\r
+ }\r
+ return fullDest;\r
+ }\r
+ }\r
+ return AutoNamePath;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Checks for updates and returns true if an update is available.\r
+ /// </summary>\r
+ /// <param name="debug">Turns on debug mode. Don't use on program startup</param>\r
+ /// <returns>Boolean True = Update available</returns>\r
+ public Boolean updateCheck(Boolean debug)\r
+ {\r
+ try\r
+ {\r
+ Functions.AppcastReader rssRead = new Functions.AppcastReader();\r
+ rssRead.getInfo(); // Initializes the class.\r
+ string build = rssRead.build();\r
+\r
+ int latest = int.Parse(build);\r
+ int current = Properties.Settings.Default.hb_build;\r
+ int skip = Properties.Settings.Default.skipversion;\r
+\r
+ if (latest == skip)\r
+ return false;\r
+ else\r
+ {\r
+ Boolean update = (latest > current);\r
+ return update;\r
+ }\r
+ }\r
+ catch (Exception exc)\r
+ {\r
+ if (debug == true)\r
+ MessageBox.Show("Unable to check for updates, Please try again later. \n" + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ return false;\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Get's HandBrakes version data from the CLI.\r
+ /// </summary>\r
+ /// <returns>Arraylist of Version Data. 0 = hb_version 1 = hb_build</returns>\r
+ public ArrayList getCliVersionData()\r
+ {\r
+ ArrayList cliVersionData = new ArrayList();\r
+ // 0 = SVN Build / Version\r
+ // 1 = Build Date\r
+\r
+ Process cliProcess = new Process();\r
+ ProcessStartInfo handBrakeCLI = new ProcessStartInfo("HandBrakeCLI.exe", " -u");\r
+ handBrakeCLI.UseShellExecute = false;\r
+ handBrakeCLI.RedirectStandardError = true;\r
+ handBrakeCLI.RedirectStandardOutput = true;\r
+ handBrakeCLI.CreateNoWindow = true;\r
+ cliProcess.StartInfo = handBrakeCLI;\r
+ cliProcess.Start();\r
+\r
+ // Retrieve standard output and report back to parent thread until the process is complete\r
+ String line;\r
+ TextReader stdOutput = cliProcess.StandardError;\r
+\r
+ while (!cliProcess.HasExited)\r
+ {\r
+ line = stdOutput.ReadLine();\r
+ Match m = Regex.Match(line, @"HandBrake [0-9\.]*svn[0-9]*[M]* \([0-9]*\)");\r
+ if (m.Success != false)\r
+ {\r
+ string data = line.Replace("(", "").Replace(")", "").Replace("HandBrake ", "");\r
+ string[] arr = data.Split(' ');\r
+ cliVersionData.Add(arr[0]);\r
+ cliVersionData.Add(arr[1]);\r
+ return cliVersionData;\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Check if the queue recovery file contains records.\r
+ /// If it does, it means the last queue did not complete before HandBrake closed.\r
+ /// So, return a boolean if true. \r
+ /// </summary>\r
+ public Boolean check_queue_recovery()\r
+ {\r
+ try\r
+ {\r
+ string tempPath = Path.Combine(Path.GetTempPath(), "hb_queue_recovery.dat");\r
+ using (StreamReader reader = new StreamReader(tempPath))\r
+ {\r
+ string queue_item = reader.ReadLine();\r
+ if (queue_item == null)\r
+ {\r
+ reader.Close();\r
+ reader.Dispose();\r
+ return false;\r
+ }\r
+ else // There exists an item in the recovery queue file, so try and recovr it.\r
+ {\r
+ reader.Close();\r
+ reader.Dispose();\r
+ return true;\r
+ }\r
+ }\r
+ }\r
+ catch (Exception)\r
+ {\r
+ // Keep quiet about the error.\r
+ return false;\r
+ }\r
+ }\r
+\r
+ }\r
+}
\ No newline at end of file
<Compile Include="frmUpdater.designer.cs">\r
<DependentUpon>frmUpdater.cs</DependentUpon>\r
</Compile>\r
- <Compile Include="Functions\QueryGenerator.cs" />\r
+ <Compile Include="frmMain\PresetLoader.cs" />\r
+ <Compile Include="frmMain\QueryGenerator.cs" />\r
<Compile Include="Functions\SystemInfo.cs" />\r
- <Compile Include="Functions\Common.cs" />\r
+ <Compile Include="Functions\Main.cs" />\r
<Compile Include="Functions\Presets.cs" />\r
<Compile Include="Functions\Queue.cs" />\r
<Compile Include="Functions\AppcastReader.cs" />\r
<Compile Include="Functions\Encode.cs" />\r
<Compile Include="Functions\QueryParser.cs" />\r
- <Compile Include="Functions\x264Panel.cs" />\r
+ <Compile Include="frmMain\x264Panel.cs" />\r
<Compile Include="Parsing\AudioTrack.cs" />\r
<Compile Include="Parsing\Chapter.cs" />\r
<Compile Include="Parsing\DVD.cs" />\r
{\r
public partial class frmAddPreset : Form\r
{\r
- Functions.QueryGenerator queryGen = new Functions.QueryGenerator();\r
private frmMain frmMainWindow;\r
Functions.Presets presetCode;\r
-\r
- public frmAddPreset(frmMain fmw, Functions.Presets presetHandler)\r
+ private string query = "";\r
+ \r
+ public frmAddPreset(frmMain fmw, string query_string, Functions.Presets presetHandler)\r
{\r
InitializeComponent();\r
frmMainWindow = fmw;\r
presetCode = presetHandler;\r
+ this.query = query_string;\r
}\r
\r
private void btn_add_Click(object sender, EventArgs e)\r
{\r
- String query = queryGen.generateTabbedComponentsQuery(frmMainWindow);\r
-\r
if (presetCode.addPreset(txt_preset_name.Text.Trim(), query) == true)\r
{\r
frmMainWindow.loadPresetPanel();\r
System.Windows.Forms.Label Label38;\r
System.Windows.Forms.ContextMenuStrip notifyIconMenu;\r
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));\r
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();\r
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();\r
this.btn_restore = new System.Windows.Forms.ToolStripMenuItem();\r
this.DVD_Save = new System.Windows.Forms.SaveFileDialog();\r
this.File_Save = new System.Windows.Forms.SaveFileDialog();\r
// \r
// number\r
// \r
- dataGridViewCellStyle2.Format = "N0";\r
- dataGridViewCellStyle2.NullValue = null;\r
- this.number.DefaultCellStyle = dataGridViewCellStyle2;\r
+ dataGridViewCellStyle1.Format = "N0";\r
+ dataGridViewCellStyle1.NullValue = null;\r
+ this.number.DefaultCellStyle = dataGridViewCellStyle1;\r
this.number.HeaderText = "Chapter Number";\r
this.number.MaxInputLength = 3;\r
this.number.Name = "number";\r
private System.Windows.Forms.ToolStripMenuItem btn_new_preset;\r
private System.Windows.Forms.ToolStripMenuItem mnu_handbrake_forums;\r
private System.Windows.Forms.ToolStripMenuItem mnu_user_guide;\r
- private System.Windows.Forms.ToolStripMenuItem mnu_dvd_drive;\r
private System.Windows.Forms.ToolStripDropDownButton btn_source;\r
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;\r
private System.Windows.Forms.ToolStripMenuItem btn_dvd_source;\r
internal System.Windows.Forms.Label label8;\r
internal System.Windows.Forms.OpenFileDialog ISO_Open;\r
internal System.Windows.Forms.FolderBrowserDialog DVD_Open;\r
+ internal System.Windows.Forms.ToolStripMenuItem mnu_dvd_drive;\r
\r
}\r
}
\ No newline at end of file
public partial class frmMain : Form\r
{\r
// Declarations *******************************************************\r
- Functions.Common hb_common_func = new Functions.Common();\r
- Functions.x264Panel x264PanelFunctions = new Functions.x264Panel();\r
+ // Objects which may be used by one or more other objects\r
+ Functions.Main hb_common_func = new Functions.Main();\r
Functions.Encode cliObj = new Functions.Encode();\r
Functions.Queue encodeQueue = new Functions.Queue();\r
Functions.Presets presetHandler = new Functions.Presets();\r
- Functions.QueryGenerator queryGen = new Functions.QueryGenerator();\r
Parsing.Title selectedTitle;\r
+\r
+ // Objects belonging to this window only\r
+ PresetLoader presetLoader = new PresetLoader();\r
+ x264Panel x264PanelFunctions = new x264Panel();\r
+ QueryGenerator queryGen = new QueryGenerator();\r
+\r
internal Process hbProc;\r
private Parsing.DVD thisDVD;\r
private frmQueue queueWindow;\r
\r
// Initialize the queue window.\r
queueWindow = new frmQueue(this);\r
-\r
//Create a label that can be updated from the parent thread.\r
Label lblStatus = new Label();\r
lblStatus.Size = new Size(250, 20);\r
else\r
{\r
Functions.QueryParser presetQuery = Functions.QueryParser.Parse(userDefaults);\r
- hb_common_func.presetLoader(this, presetQuery, "User Defaults ");\r
+ presetLoader.presetLoader(this, presetQuery, "User Defaults ");\r
}\r
}\r
private void queueRecovery()\r
}\r
private void btn_new_preset_Click(object sender, EventArgs e)\r
{\r
- Form preset = new frmAddPreset(this, presetHandler);\r
+ Form preset = new frmAddPreset(this, queryGen.GenerateTheQuery(this), presetHandler);\r
preset.ShowDialog();\r
}\r
#endregion\r
}\r
\r
// Run the autoName & chapterNaming functions\r
- hb_common_func.autoName(this);\r
- hb_common_func.chapterNaming(this);\r
+ if (Properties.Settings.Default.autoNaming == "Checked")\r
+ text_destination.Text = hb_common_func.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex);\r
+\r
+ data_chpt.Rows.Clear();\r
+ DataGridView chapterGridView = hb_common_func.chapterNaming(data_chpt, drop_chapterStart.Text, drop_chapterFinish.Text);\r
+ if (chapterGridView != null)\r
+ data_chpt = chapterGridView;\r
}\r
private void drop_chapterStart_SelectedIndexChanged(object sender, EventArgs e)\r
{\r
int c_start, c_end = 1;\r
\r
if (drop_chapterFinish.Text == "Auto" && drop_chapterFinish.Items.Count != 0)\r
- drop_chapterFinish.SelectedIndex = drop_chapterFinish.Items.Count-1;\r
- \r
+ drop_chapterFinish.SelectedIndex = drop_chapterFinish.Items.Count - 1;\r
+\r
int.TryParse(drop_chapterStart.Text, out c_start);\r
int.TryParse(drop_chapterFinish.Text, out c_end);\r
\r
drop_chapterFinish.Text = c_start.ToString();\r
}\r
\r
- calculateDuration();\r
+ lbl_duration.Text = hb_common_func.calculateDuration(drop_chapterStart.Text, drop_chapterFinish.Text, selectedTitle).ToString();\r
\r
// Run the Autonaming function\r
- hb_common_func.autoName(this);\r
+ if (Properties.Settings.Default.autoNaming == "Checked")\r
+ text_destination.Text = hb_common_func.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex);\r
}\r
private void drop_chapterFinish_SelectedIndexChanged(object sender, EventArgs e)\r
{\r
drop_chapterFinish.Text = c_start.ToString();\r
}\r
\r
- calculateDuration();\r
+ lbl_duration.Text = hb_common_func.calculateDuration(drop_chapterStart.Text, drop_chapterFinish.Text, selectedTitle).ToString();\r
\r
// Run the Autonaming function\r
- hb_common_func.autoName(this);\r
+ if (Properties.Settings.Default.autoNaming == "Checked")\r
+ text_destination.Text = hb_common_func.autoName(drp_dvdtitle, drop_chapterStart.Text, drop_chapterFinish.Text, text_source.Text, text_destination.Text, drop_format.SelectedIndex);\r
}\r
\r
//Destination\r
// Output Settings\r
private void drop_format_SelectedIndexChanged(object sender, EventArgs e)\r
{\r
-\r
if (drop_format.SelectedIndex == 0)\r
- setExtension(".mp4");\r
+ text_destination.Text = hb_common_func.setExtension(text_destination.Text, ".mp4");\r
else if (drop_format.SelectedIndex == 1)\r
- setExtension(".m4v");\r
+ text_destination.Text = hb_common_func.setExtension(text_destination.Text, ".m4v");\r
else if (drop_format.SelectedIndex == 2)\r
- setExtension(".mkv");\r
+ text_destination.Text = hb_common_func.setExtension(text_destination.Text, ".mkv");\r
else if (drop_format.SelectedIndex == 3)\r
- setExtension(".avi");\r
+ text_destination.Text = hb_common_func.setExtension(text_destination.Text, ".avi");\r
else if (drop_format.SelectedIndex == 4)\r
- setExtension(".ogm");\r
+ text_destination.Text = hb_common_func.setExtension(text_destination.Text, ".ogm");\r
}\r
\r
//Video Tab\r
{\r
if (drp_anamorphic.Text == "None")\r
{\r
- int height = cacluateNonAnamorphicHeight(width);\r
+ int height = hb_common_func.cacluateNonAnamorphicHeight(width, text_top.Value, text_bottom.Value,text_left.Value, text_right.Value, selectedTitle);\r
text_height.Text = height.ToString();\r
}\r
}\r
text_destination.Text = destination;\r
data_chpt.Rows.Clear();\r
data_chpt.Enabled = true;\r
- hb_common_func.chapterNaming(this);\r
+ DataGridView chapterGridView = hb_common_func.chapterNaming(data_chpt, drop_chapterStart.Text, drop_chapterFinish.Text);\r
+ if (chapterGridView != null)\r
+ data_chpt = chapterGridView;\r
}\r
else\r
{\r
// Presets\r
private void btn_addPreset_Click(object sender, EventArgs e)\r
{\r
- Form preset = new frmAddPreset(this, presetHandler);\r
+ Form preset = new frmAddPreset(this, queryGen.GenerateTheQuery(this), presetHandler);\r
preset.ShowDialog();\r
}\r
private void btn_removePreset_Click(object sender, EventArgs e)\r
Functions.QueryParser presetQuery = Functions.QueryParser.Parse(query);\r
\r
// Now load the preset\r
- hb_common_func.presetLoader(this, presetQuery, presetName);\r
+ presetLoader.presetLoader(this, presetQuery, presetName);\r
\r
// The x264 widgets will need updated, so do this now:\r
x264PanelFunctions.X264_StandardizeOptString(this);\r
#endregion\r
\r
#region Functions\r
- // Replace File extenstion.\r
- public void setExtension(string newExtension)\r
- {\r
- text_destination.Text = text_destination.Text.Replace(".mp4", newExtension);\r
- text_destination.Text = text_destination.Text.Replace(".m4v", newExtension);\r
- text_destination.Text = text_destination.Text.Replace(".mkv", newExtension);\r
- text_destination.Text = text_destination.Text.Replace(".avi", newExtension);\r
- text_destination.Text = text_destination.Text.Replace(".ogm", newExtension);\r
- }\r
-\r
- // DVD Parsing\r
- public void setStreamReader(Parsing.DVD dvd)\r
+ private void loadNormalPreset()\r
{\r
- this.thisDVD = dvd;\r
+ foreach (TreeNode treenode in treeView_presets.Nodes)\r
+ {\r
+ if (treenode.Text.ToString().Equals("Normal"))\r
+ treeView_presets.SelectedNode = treeView_presets.Nodes[treenode.Index];\r
+ }\r
}\r
-\r
- // Chapter Selection Duration calculation\r
- public void calculateDuration()\r
+ #endregion\r
+ \r
+ #region Drive Detection\r
+ // Source Button Drive Detection\r
+ private delegate void ProgressUpdateHandler();\r
+ private void getDriveInfoThread()\r
{\r
- TimeSpan Duration = TimeSpan.FromSeconds(0.0);\r
-\r
- // Get the durations between the 2 chapter points and add them together.\r
- if (drop_chapterStart.Text != "Auto" && drop_chapterFinish.Text != "Auto")\r
+ try\r
{\r
- int start_chapter, end_chapter = 0;\r
- int.TryParse(drop_chapterStart.Text, out start_chapter);\r
- int.TryParse(drop_chapterFinish.Text, out end_chapter);\r
-\r
- int position = start_chapter - 1;\r
-\r
- if (start_chapter <= end_chapter)\r
+ if (this.InvokeRequired)\r
{\r
- if (end_chapter > selectedTitle.Chapters.Count)\r
- end_chapter = selectedTitle.Chapters.Count;\r
+ this.BeginInvoke(new ProgressUpdateHandler(getDriveInfoThread));\r
+ return;\r
+ }\r
\r
- while (position != end_chapter)\r
+ Boolean foundDrive = false;\r
+ DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives();\r
+ foreach (DriveInfo curDrive in theCollectionOfDrives)\r
+ {\r
+ if (curDrive.DriveType == DriveType.CDRom)\r
{\r
- TimeSpan dur = selectedTitle.Chapters[position].Duration;\r
- Duration = Duration + dur;\r
- position++;\r
+ if (curDrive.IsReady)\r
+ {\r
+ if (File.Exists(curDrive.RootDirectory.ToString() + "VIDEO_TS\\VIDEO_TS.IFO"))\r
+ mnu_dvd_drive.Text = curDrive.RootDirectory.ToString() + "VIDEO_TS (" + curDrive.VolumeLabel + ")";\r
+ else\r
+ mnu_dvd_drive.Text = "[No DVD Drive Ready]";\r
+\r
+ foundDrive = true;\r
+\r
+ }\r
}\r
}\r
- }\r
\r
- // Set the Duration\r
- lbl_duration.Text = Duration.ToString();\r
- }\r
- public int cacluateNonAnamorphicHeight(int width)\r
- {\r
- float aspect = selectedTitle.AspectRatio;\r
- int aw;\r
- int ah;\r
- if (aspect.ToString() == "1.78")\r
- {\r
- aw = 16;\r
- ah = 9;\r
- }\r
- else\r
- {\r
- aw = 4;\r
- ah = 3;\r
+ if (foundDrive == false)\r
+ mnu_dvd_drive.Text = "[No DVD Drive Ready]";\r
}\r
-\r
- double a = width * selectedTitle.Resolution.Width * ah * (selectedTitle.Resolution.Height - (double)text_top.Value - (double)text_bottom.Value);\r
- double b = selectedTitle.Resolution.Height * aw * (selectedTitle.Resolution.Width - (double)text_left.Value - (double)text_right.Value);\r
-\r
- double y = a / b;\r
-\r
- // If it's not Mod 16, make it mod 16\r
- if ((y % 16) != 0)\r
+ catch (Exception)\r
{\r
- double mod16 = y % 16;\r
- if (mod16 >= 8)\r
- {\r
- mod16 = 16 - mod16;\r
- y = y + mod16;\r
- }\r
- else\r
- {\r
- y = y - mod16;\r
- }\r
+ mnu_dvd_drive.Text = "[No DVD Drive Ready / Found]";\r
}\r
-\r
- //16 * (421 / 16)\r
- //double z = ( 16 * (( y + 8 ) / 16 ) );\r
- int x = int.Parse(y.ToString());\r
- return x;\r
}\r
+ #endregion\r
\r
- // Audio system functions\r
- private void setAudioByContainer(String path)\r
+ #region Audio Panel Stuff\r
+ public void setAudioByContainer(String path)\r
{\r
string oldval = "";\r
\r
}\r
}\r
}\r
- private void setVideoByContainer(String path)\r
+ public void setVideoByContainer(String path)\r
{\r
string oldval = "";\r
\r
drp_videoEncoder.Text = oldval;\r
}\r
}\r
- private void setBitrateSelections384(ComboBox dropDown)\r
+ public void setBitrateSelections384(ComboBox dropDown)\r
{\r
dropDown.Items.Clear();\r
dropDown.Items.Add("32");\r
dropDown.Items.Add("320");\r
dropDown.Items.Add("384");\r
}\r
- private void setBitrateSelections320(ComboBox dropDown)\r
+ public void setBitrateSelections320(ComboBox dropDown)\r
{\r
dropDown.Items.Clear();\r
dropDown.Items.Add("32");\r
dropDown.Items.Add("256");\r
dropDown.Items.Add("320");\r
}\r
- private void setBitrateSelections160(ComboBox dropDown)\r
+ public void setBitrateSelections160(ComboBox dropDown)\r
{\r
dropDown.Items.Clear();\r
dropDown.Items.Add("32");\r
dropDown.Items.Add("128");\r
dropDown.Items.Add("160");\r
}\r
-\r
- // Preset system functions\r
- private void loadNormalPreset()\r
- {\r
- foreach (TreeNode treenode in treeView_presets.Nodes)\r
- {\r
- if (treenode.Text.ToString().Equals("Normal"))\r
- treeView_presets.SelectedNode = treeView_presets.Nodes[treenode.Index];\r
- }\r
- }\r
- public void loadPresetPanel()\r
- {\r
- presetHandler.loadPresetFiles();\r
-\r
- treeView_presets.Nodes.Clear();\r
- List<string> presetNameList = new List<string>();\r
- TreeNode preset_treeview = new TreeNode(); \r
-\r
- presetNameList = presetHandler.getBuildInPresetNames();\r
- foreach (string preset in presetNameList)\r
- {\r
- preset_treeview = new TreeNode(preset);\r
-\r
- // Now Fill Out List View with Items\r
- treeView_presets.Nodes.Add(preset_treeview);\r
- }\r
-\r
- presetNameList = presetHandler.getUserPresetNames();\r
- foreach (string preset in presetNameList)\r
- {\r
- preset_treeview = new TreeNode(preset);\r
- preset_treeview.ForeColor = Color.Black;\r
-\r
- // Now Fill Out List View with Items\r
- treeView_presets.Nodes.Add(preset_treeview);\r
- }\r
- }\r
-\r
- // Source Button Drive Detection\r
- private delegate void ProgressUpdateHandler();\r
- private void getDriveInfoThread()\r
- {\r
- try\r
- {\r
- if (this.InvokeRequired)\r
- {\r
- this.BeginInvoke(new ProgressUpdateHandler(getDriveInfoThread));\r
- return;\r
- }\r
-\r
- Boolean foundDrive = false;\r
- DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives();\r
- foreach (DriveInfo curDrive in theCollectionOfDrives)\r
- {\r
- if (curDrive.DriveType == DriveType.CDRom)\r
- {\r
- if (curDrive.IsReady)\r
- {\r
- if (File.Exists(curDrive.RootDirectory.ToString() + "VIDEO_TS\\VIDEO_TS.IFO"))\r
- mnu_dvd_drive.Text = curDrive.RootDirectory.ToString() + "VIDEO_TS (" + curDrive.VolumeLabel + ")";\r
- else\r
- mnu_dvd_drive.Text = "[No DVD Drive Ready]";\r
-\r
- foundDrive = true;\r
-\r
- }\r
- }\r
- }\r
-\r
- if (foundDrive == false)\r
- mnu_dvd_drive.Text = "[No DVD Drive Ready]";\r
- }\r
- catch (Exception)\r
- {\r
- mnu_dvd_drive.Text = "[No DVD Drive Ready / Found]";\r
- }\r
- }\r
-\r
#endregion\r
\r
#region Encoding\r
else\r
return true;\r
}\r
+\r
/// <summary>\r
/// Action can be "encode" or "scan"\r
/// Set the last action varible in the main window.\r
{\r
this.lastAction = last;\r
}\r
+\r
+ /// <summary>\r
+ /// DVD parseing. Pass in a parsed DVD.\r
+ /// </summary>\r
+ /// <param name="dvd"></param>\r
+ public void setStreamReader(Parsing.DVD dvd)\r
+ {\r
+ this.thisDVD = dvd;\r
+ }\r
+\r
+\r
+ /// <summary>\r
+ /// Reload the preset panel display\r
+ /// </summary>\r
+ public void loadPresetPanel()\r
+ {\r
+ presetHandler.loadPresetFiles();\r
+\r
+ treeView_presets.Nodes.Clear();\r
+ List<string> presetNameList = new List<string>();\r
+ TreeNode preset_treeview = new TreeNode();\r
+\r
+ presetNameList = presetHandler.getBuildInPresetNames();\r
+ foreach (string preset in presetNameList)\r
+ {\r
+ preset_treeview = new TreeNode(preset);\r
+\r
+ // Now Fill Out List View with Items\r
+ treeView_presets.Nodes.Add(preset_treeview);\r
+ }\r
+\r
+ presetNameList = presetHandler.getUserPresetNames();\r
+ foreach (string preset in presetNameList)\r
+ {\r
+ preset_treeview = new TreeNode(preset);\r
+ preset_treeview.ForeColor = Color.Black;\r
+\r
+ // Now Fill Out List View with Items\r
+ treeView_presets.Nodes.Add(preset_treeview);\r
+ }\r
+ }\r
+\r
#endregion\r
\r
#region Taskbar Tray Icon\r
the list will not be populated with the correct amount of chapters.\r
Note: Do not change any of the chapter numbers!</value>\r
</data>\r
- <metadata name="number.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
- <value>True</value>\r
- </metadata>\r
- <metadata name="name.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">\r
- <value>True</value>\r
- </metadata>\r
<data name="check_Cabac.ToolTip" xml:space="preserve">\r
<value>CABAC, or context adaptive binary arithmetic coding, is used by x264 to reduce the bitrate needed for a given quality by 15%. \r
This makes it very cool and very useful, and it should be left on whenever possible. However, it is incompatible with the iPod 5.5G, and makes the AppleTV struggle. \r
-/* Common.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;\r
+using System;\r
+using System.Collections.Generic;\r
using System.Text;\r
using System.Windows.Forms;\r
-using System.Globalization;\r
-using System.IO;\r
using System.Drawing;\r
-using System.Diagnostics;\r
-using System.Text.RegularExpressions;\r
\r
-namespace Handbrake.Functions\r
+namespace Handbrake\r
{\r
- class Common\r
+ class PresetLoader\r
{\r
-\r
/// <summary>\r
/// This function takes in a Query which has been parsed by QueryParser and\r
/// set's all the GUI widgets correctly.\r
mainWindow.groupBox_output.Text = "Output Settings (Preset: " + name + ")";\r
#endregion\r
}\r
-\r
- /// <summary>\r
- /// Select the longest title in the DVD title dropdown menu on frmMain\r
- /// </summary>\r
- public void selectLongestTitle(frmMain mainWindow)\r
- {\r
- int current_largest = 0;\r
- Handbrake.Parsing.Title title2Select;\r
-\r
- // Check if there are titles in the DVD title dropdown menu and make sure, it's not just "Automatic"\r
- if (mainWindow.drp_dvdtitle.Items[0].ToString() != "Automatic")\r
- title2Select = (Handbrake.Parsing.Title)mainWindow.drp_dvdtitle.Items[0];\r
- else\r
- title2Select = null;\r
-\r
- // So, If there are titles in the DVD Title dropdown menu, lets select the longest.\r
- if (title2Select != null)\r
- {\r
- foreach (Handbrake.Parsing.Title x in mainWindow.drp_dvdtitle.Items)\r
- {\r
- string title = x.ToString();\r
- if (title != "Automatic")\r
- {\r
- string[] y = title.Split(' ');\r
- string time = y[1].Replace("(", "").Replace(")", "");\r
- string[] z = time.Split(':');\r
-\r
- int hours = int.Parse(z[0]) * 60 * 60;\r
- int minutes = int.Parse(z[1]) * 60;\r
- int seconds = int.Parse(z[2]);\r
- int total_sec = hours + minutes + seconds;\r
-\r
- if (current_largest == 0)\r
- {\r
- current_largest = hours + minutes + seconds;\r
- title2Select = x;\r
- }\r
- else\r
- {\r
- if (total_sec > current_largest)\r
- {\r
- current_largest = total_sec;\r
- title2Select = x;\r
- }\r
- }\r
- }\r
- }\r
-\r
- // Now set the longest title in the gui.\r
- mainWindow.drp_dvdtitle.SelectedItem = title2Select;\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Set's up the DataGridView on the Chapters tab (frmMain)\r
- /// </summary>\r
- /// <param name="mainWindow"></param>\r
- public void chapterNaming(frmMain mainWindow)\r
- {\r
- try\r
- {\r
- mainWindow.data_chpt.Rows.Clear();\r
- int i = 0;\r
- int rowCount = 0;\r
- int start = 0;\r
- int finish = 0;\r
- if (mainWindow.drop_chapterFinish.Text != "Auto")\r
- finish = int.Parse(mainWindow.drop_chapterFinish.Text);\r
-\r
- if (mainWindow.drop_chapterStart.Text != "Auto")\r
- start = int.Parse(mainWindow.drop_chapterStart.Text);\r
-\r
- rowCount = finish - (start - 1);\r
-\r
- while (i < rowCount)\r
- {\r
- DataGridViewRow row = new DataGridViewRow();\r
-\r
- mainWindow.data_chpt.Rows.Insert(i, row);\r
- mainWindow.data_chpt.Rows[i].Cells[0].Value = (i + 1);\r
- mainWindow.data_chpt.Rows[i].Cells[1].Value = "Chapter " + (i + 1);\r
- i++;\r
- }\r
- }\r
- catch (Exception exc)\r
- {\r
- MessageBox.Show("chapterNaming() Error has occured: \n" + exc.ToString());\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Function which generates the filename and path automatically based on \r
- /// the Source Name, DVD title and DVD Chapters\r
- /// </summary>\r
- /// <param name="mainWindow"></param>\r
- public void autoName(frmMain mainWindow)\r
- {\r
- if (Properties.Settings.Default.autoNaming == "Checked")\r
- {\r
- if (mainWindow.drp_dvdtitle.Text != "Automatic")\r
- {\r
- // Todo: This code is a tad messy. Clean it up at some point.\r
- // Get the Source Name\r
- string source = mainWindow.text_source.Text;\r
- string[] sourceName = source.Split('\\');\r
- source = sourceName[sourceName.Length - 1].Replace(".iso", "").Replace(".mpg", "").Replace(".ts", "").Replace(".ps", "");\r
-\r
- // Get the Selected Title Number\r
- string title = mainWindow.drp_dvdtitle.Text;\r
- string[] titlesplit = title.Split(' ');\r
- title = titlesplit[0];\r
-\r
- // Get the Chapter Start and Chapter End Numbers\r
- string cs = mainWindow.drop_chapterStart.Text;\r
- string cf = mainWindow.drop_chapterFinish.Text;\r
-\r
- // Just incase the above are set to their default Automatic values, set the varible to ""\r
- if (title == "Automatic")\r
- title = "";\r
- if (cs == "Auto")\r
- cs = "";\r
- if (cf == "Auto")\r
- cf = "";\r
-\r
- // If both CS and CF are populated, set the dash varible\r
- string dash = "";\r
- if (cf != "Auto")\r
- dash = "-";\r
-\r
- // Get the destination filename.\r
- string destination_filename = "";\r
- if (Properties.Settings.Default.autoNameFormat != "")\r
- {\r
- destination_filename = Properties.Settings.Default.autoNameFormat;\r
- destination_filename = destination_filename.Replace("{source}", source).Replace("{title}", title).Replace("{chapters}", cs + dash + cf);\r
- }\r
- else\r
- destination_filename = source + "_T" + title + "_C" + cs + dash + cf;\r
-\r
- // If the text box is blank\r
- if (!mainWindow.text_destination.Text.Contains("\\"))\r
- {\r
- string filePath = "";\r
- if (Properties.Settings.Default.autoNamePath.Trim() != "")\r
- {\r
- if (Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location")\r
- filePath = Properties.Settings.Default.autoNamePath + "\\";\r
- }\r
-\r
- if (mainWindow.drop_format.SelectedIndex == 0)\r
- mainWindow.text_destination.Text = filePath + destination_filename + ".mp4";\r
- else if (mainWindow.drop_format.SelectedIndex == 1)\r
- mainWindow.text_destination.Text = filePath + destination_filename + ".m4v";\r
- else if (mainWindow.drop_format.SelectedIndex == 2)\r
- mainWindow.text_destination.Text = filePath + destination_filename + ".mkv";\r
- else if (mainWindow.drop_format.SelectedIndex == 3)\r
- mainWindow.text_destination.Text = filePath + destination_filename + ".avi";\r
- else if (mainWindow.drop_format.SelectedIndex == 4)\r
- mainWindow.text_destination.Text = filePath + destination_filename + ".ogm";\r
- }\r
- else // If the text box already has a path and file\r
- {\r
- string dest = mainWindow.text_destination.Text;\r
- string[] destName = dest.Split('\\');\r
- string[] extension = dest.Split('.');\r
- string ext = extension[extension.Length - 1];\r
-\r
- destName[destName.Length - 1] = destination_filename + "." + ext;\r
-\r
- string fullDest = "";\r
- foreach (string part in destName)\r
- {\r
- if (fullDest != "")\r
- fullDest = fullDest + "\\" + part;\r
- else\r
- fullDest = fullDest + part;\r
- }\r
-\r
- mainWindow.text_destination.Text = fullDest;\r
- }\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Checks for updates and returns true if an update is available.\r
- /// </summary>\r
- /// <param name="debug">Turns on debug mode. Don't use on program startup</param>\r
- /// <returns>Boolean True = Update available</returns>\r
- public Boolean updateCheck(Boolean debug)\r
- {\r
- try\r
- {\r
- Functions.AppcastReader rssRead = new Functions.AppcastReader();\r
- rssRead.getInfo(); // Initializes the class.\r
- string build = rssRead.build();\r
-\r
- int latest = int.Parse(build);\r
- int current = Properties.Settings.Default.hb_build;\r
- int skip = Properties.Settings.Default.skipversion;\r
-\r
- if (latest == skip)\r
- return false;\r
- else\r
- {\r
- Boolean update = (latest > current);\r
- return update;\r
- }\r
- }\r
- catch (Exception exc)\r
- {\r
- if (debug == true)\r
- MessageBox.Show("Unable to check for updates, Please try again later. \n" + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
- return false;\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Get's HandBrakes version data from the CLI.\r
- /// </summary>\r
- /// <returns>Arraylist of Version Data. 0 = hb_version 1 = hb_build</returns>\r
- public ArrayList getCliVersionData()\r
- {\r
- ArrayList cliVersionData = new ArrayList();\r
- // 0 = SVN Build / Version\r
- // 1 = Build Date\r
-\r
- Process cliProcess = new Process();\r
- ProcessStartInfo handBrakeCLI = new ProcessStartInfo("HandBrakeCLI.exe", " -u");\r
- handBrakeCLI.UseShellExecute = false;\r
- handBrakeCLI.RedirectStandardError = true;\r
- handBrakeCLI.RedirectStandardOutput = true;\r
- handBrakeCLI.CreateNoWindow = true;\r
- cliProcess.StartInfo = handBrakeCLI;\r
- cliProcess.Start();\r
-\r
- // Retrieve standard output and report back to parent thread until the process is complete\r
- String line;\r
- TextReader stdOutput = cliProcess.StandardError;\r
-\r
- while (!cliProcess.HasExited)\r
- {\r
- line = stdOutput.ReadLine();\r
- Match m = Regex.Match(line, @"HandBrake [0-9\.]*svn[0-9]*[M]* \([0-9]*\)");\r
- if (m.Success != false)\r
- {\r
- string data = line.Replace("(", "").Replace(")", "").Replace("HandBrake ", "");\r
- string[] arr = data.Split(' ');\r
- cliVersionData.Add(arr[0]);\r
- cliVersionData.Add(arr[1]);\r
- return cliVersionData;\r
- }\r
- }\r
- return null;\r
- }\r
-\r
- /// <summary>\r
- /// Check if the queue recovery file contains records.\r
- /// If it does, it means the last queue did not complete before HandBrake closed.\r
- /// So, return a boolean if true. \r
- /// </summary>\r
- public Boolean check_queue_recovery()\r
- {\r
- try\r
- {\r
- string tempPath = Path.Combine(Path.GetTempPath(), "hb_queue_recovery.dat");\r
- using (StreamReader reader = new StreamReader(tempPath))\r
- {\r
- string queue_item = reader.ReadLine();\r
- if (queue_item == null)\r
- {\r
- reader.Close();\r
- reader.Dispose();\r
- return false;\r
- }\r
- else // There exists an item in the recovery queue file, so try and recovr it.\r
- {\r
- reader.Close();\r
- reader.Dispose();\r
- return true;\r
- }\r
- }\r
- }\r
- catch (Exception)\r
- {\r
- // Keep quiet about the error.\r
- return false;\r
- }\r
- }\r
-\r
}\r
-}
\ No newline at end of file
+}\r
using System.Globalization;\r
using System.IO;\r
\r
-namespace Handbrake.Functions\r
+namespace Handbrake\r
{\r
class QueryGenerator\r
{\r
using System.Text;\r
using System.Windows.Forms;\r
\r
-namespace Handbrake.Functions\r
+namespace Handbrake\r
{\r
class x264Panel\r
{\r
-\r
/// <summary>\r
/// Reset all components to defaults and clears the x264 rtf box\r
/// </summary>\r
private Parsing.DVD thisDvd;\r
private delegate void UpdateUIHandler();\r
Process hbproc;\r
- Functions.Common hb_common_func = new Functions.Common();\r
+ Functions.Main hb_common_func = new Functions.Main();\r
Functions.Encode process = new Functions.Encode();\r
\r
public frmReadDVD(string inputFile, frmMain parent)\r
MessageBox.Show("frmReadDVD.cs - startScan " + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
}\r
}\r
+\r
private void startProc(object state)\r
{\r
try\r
\r
// Now select the longest title\r
if (thisDvd.Titles.Count != 0)\r
- hb_common_func.selectLongestTitle(mainWindow);\r
+ mainWindow.drp_dvdtitle.SelectedItem = hb_common_func.selectLongestTitle(mainWindow.drp_dvdtitle);\r
\r
this.Close();\r
}\r
this.Close();\r
}\r
}\r
+\r
private void closeWindowAfterError()\r
{\r
try\r