{\r
InitializeComponent();\r
\r
- LangMap = Main.mapLanguages();\r
+ LangMap = Main.MapLanguages();\r
foreach (string key in LangMap.Keys)\r
srt_lang.Items.Add(key);\r
\r
\r
Process[] before = Process.GetProcesses(); // Get a list of running processes before starting.\r
hbProcess = Process.Start(cliStart);\r
- processID = Main.getCliProcess(before);\r
+ processID = Main.GetCliProcess(before);\r
currentQuery = query;\r
if (hbProcess != null)\r
processHandle = hbProcess.MainWindowHandle; // Set the process Handle\r
static class Main\r
{\r
// Private Variables\r
- private static readonly XmlSerializer ser = new XmlSerializer(typeof(List<Job>));\r
+ private static readonly XmlSerializer Ser = new XmlSerializer(typeof(List<Job>));\r
\r
/// <summary>\r
/// Calculate the duration of the selected title and chapters\r
/// </summary>\r
- public static TimeSpan calculateDuration(int chapterStart, int chapterEnd, Parsing.Title selectedTitle)\r
+ public static TimeSpan CalculateDuration(int chapterStart, int chapterEnd, Parsing.Title selectedTitle)\r
{\r
TimeSpan duration = TimeSpan.FromSeconds(0.0);\r
chapterStart++; chapterEnd++;\r
/// <summary>\r
/// Select the longest title in the DVD title dropdown menu on frmMain\r
/// </summary>\r
- public static Parsing.Title selectLongestTitle(Parsing.DVD thisDvd)\r
+ public static Parsing.Title SelectLongestTitle(Parsing.DVD thisDvd)\r
{\r
TimeSpan longestDurationFound = TimeSpan.FromSeconds(0.0);\r
Parsing.Title returnTitle = null;\r
/// <summary>\r
/// Set's up the DataGridView on the Chapters tab (frmMain)\r
/// </summary>\r
- public static DataGridView chapterNaming(DataGridView dataChpt, string chapterEnd)\r
+ public static DataGridView ChapterNaming(DataGridView dataChpt, string chapterEnd)\r
{\r
int i = 0, finish = 0;\r
\r
/// <param name="dataChpt"></param>\r
/// <param name="filename"></param>\r
/// <returns></returns>\r
- public static DataGridView importChapterNames(DataGridView dataChpt, string filename)\r
+ public static DataGridView ImportChapterNames(DataGridView dataChpt, string filename)\r
{\r
IDictionary<int, string> chapterMap = new Dictionary<int, string>();\r
try\r
/// Function which generates the filename and path automatically based on \r
/// the Source Name, DVD title and DVD Chapters\r
/// </summary>\r
- public static string autoName(frmMain mainWindow) //ComboBox drpDvdtitle, string chapter_start, string chatper_end, string source, string dest, int format, Boolean chapters)\r
+ public static string AutoName(frmMain mainWindow) //ComboBox drpDvdtitle, string chapter_start, string chatper_end, string source, string dest, int format, Boolean chapters)\r
{\r
string AutoNamePath = string.Empty;\r
if (mainWindow.drp_dvdtitle.Text != "Automatic")\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 static void setCliVersionData()\r
+ public static void SetCliVersionData()\r
{\r
String line;\r
\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 static Boolean checkQueueRecovery()\r
+ public static Boolean CheckQueueRecovery()\r
{\r
try\r
{\r
{\r
using (FileStream strm = new FileStream(tempPath, FileMode.Open, FileAccess.Read))\r
{\r
- List<Job> list = ser.Deserialize(strm) as List<Job>;\r
+ List<Job> list = Ser.Deserialize(strm) as List<Job>;\r
if (list != null)\r
if (list.Count != 0)\r
return true;\r
/// </summary>\r
/// <param name="before">List of processes before the new process was started</param>\r
/// <returns>Int - Process ID</returns>\r
- public static int getCliProcess(Process[] before)\r
+ public static int GetCliProcess(Process[] before)\r
{\r
// This is a bit of a cludge. Maybe someone has a better idea on how to impliment this.\r
// Since we used CMD to start HandBrakeCLI, we don't get the process ID from hbProc.\r
/// <summary>\r
/// Clear all the encode log files.\r
/// </summary>\r
- public static void clearLogs()\r
+ public static void ClearLogs()\r
{\r
string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
if (Directory.Exists(logDir))\r
/// Map languages and their iso639_2 value into a IDictionary\r
/// </summary>\r
/// <returns></returns>\r
- public static IDictionary<string, string> mapLanguages()\r
+ public static IDictionary<string, string> MapLanguages()\r
{\r
IDictionary<string, string> languageMap = new Dictionary<string, string>\r
{\r
#region Subtitles Tab\r
if (mainWindow.Subtitles.lv_subList.Items.Count != 0) // If we have subtitle tracks\r
{\r
- IDictionary<string, string> langMap = Main.mapLanguages();\r
+ IDictionary<string, string> langMap = Main.MapLanguages();\r
\r
// BitMap and CC's\r
string subtitleTracks = String.Empty;\r
this.Label47 = new System.Windows.Forms.Label();\r
this.Label3 = new System.Windows.Forms.Label();\r
this.tab_audio = new System.Windows.Forms.TabPage();\r
+ this.AudioSettings = new Handbrake.Controls.AudioPanel();\r
this.AudioMenuRowHeightHack = new System.Windows.Forms.ImageList(this.components);\r
this.tab_video = new System.Windows.Forms.TabPage();\r
this.lbl_qualityValue = new System.Windows.Forms.Label();\r
this.lbl_SliderValue = new System.Windows.Forms.Label();\r
this.Label46 = new System.Windows.Forms.Label();\r
this.tab_picture = new System.Windows.Forms.TabPage();\r
+ this.PictureSettings = new Handbrake.Controls.PictureSettings();\r
this.Check_ChapterMarkers = new System.Windows.Forms.CheckBox();\r
this.tabs_panel = new System.Windows.Forms.TabControl();\r
this.tab_filters = new System.Windows.Forms.TabPage();\r
+ this.Filters = new Handbrake.Controls.Filters();\r
this.tab_subtitles = new System.Windows.Forms.TabPage();\r
+ this.Subtitles = new Handbrake.Controls.Subtitles();\r
this.tab_chapters = new System.Windows.Forms.TabPage();\r
this.label31 = new System.Windows.Forms.Label();\r
this.tab_advanced = new System.Windows.Forms.TabPage();\r
+ this.x264Panel = new Handbrake.Controls.x264Panel();\r
this.tab_query = new System.Windows.Forms.TabPage();\r
this.btn_clear = new System.Windows.Forms.Button();\r
this.label34 = new System.Windows.Forms.Label();\r
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();\r
this.openPreset = new System.Windows.Forms.OpenFileDialog();\r
this.File_ChapterImport = new System.Windows.Forms.OpenFileDialog();\r
- this.PictureSettings = new Handbrake.Controls.PictureSettings();\r
- this.Filters = new Handbrake.Controls.Filters();\r
- this.AudioSettings = new Handbrake.Controls.AudioPanel();\r
- this.Subtitles = new Handbrake.Controls.Subtitles();\r
- this.x264Panel = new Handbrake.Controls.x264Panel();\r
notifyIconMenu = new System.Windows.Forms.ContextMenuStrip(this.components);\r
notifyIconMenu.SuspendLayout();\r
((System.ComponentModel.ISupportInitialize)(this.slider_videoQuality)).BeginInit();\r
this.tab_audio.Text = "Audio";\r
this.tab_audio.UseVisualStyleBackColor = true;\r
// \r
+ // AudioSettings\r
+ // \r
+ this.AudioSettings.BackColor = System.Drawing.Color.Transparent;\r
+ this.AudioSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+ this.AudioSettings.Location = new System.Drawing.Point(0, 0);\r
+ this.AudioSettings.Name = "AudioSettings";\r
+ this.AudioSettings.Size = new System.Drawing.Size(715, 310);\r
+ this.AudioSettings.TabIndex = 0;\r
+ // \r
// AudioMenuRowHeightHack\r
// \r
this.AudioMenuRowHeightHack.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;\r
this.tab_picture.Text = "Picture";\r
this.tab_picture.UseVisualStyleBackColor = true;\r
// \r
+ // PictureSettings\r
+ // \r
+ this.PictureSettings.BackColor = System.Drawing.Color.Transparent;\r
+ this.PictureSettings.Enabled = false;\r
+ this.PictureSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+ this.PictureSettings.Location = new System.Drawing.Point(0, 0);\r
+ this.PictureSettings.Name = "PictureSettings";\r
+ this.PictureSettings.Size = new System.Drawing.Size(666, 279);\r
+ this.PictureSettings.TabIndex = 0;\r
+ // \r
// Check_ChapterMarkers\r
// \r
this.Check_ChapterMarkers.AutoSize = true;\r
this.tab_filters.Text = "Video Filters";\r
this.tab_filters.UseVisualStyleBackColor = true;\r
// \r
+ // Filters\r
+ // \r
+ this.Filters.BackColor = System.Drawing.Color.Transparent;\r
+ this.Filters.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+ this.Filters.Location = new System.Drawing.Point(0, 0);\r
+ this.Filters.Name = "Filters";\r
+ this.Filters.Size = new System.Drawing.Size(713, 310);\r
+ this.Filters.TabIndex = 0;\r
+ // \r
// tab_subtitles\r
// \r
this.tab_subtitles.Controls.Add(this.Subtitles);\r
this.tab_subtitles.Text = "Subtitles";\r
this.tab_subtitles.UseVisualStyleBackColor = true;\r
// \r
+ // Subtitles\r
+ // \r
+ this.Subtitles.BackColor = System.Drawing.Color.Transparent;\r
+ this.Subtitles.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+ this.Subtitles.Location = new System.Drawing.Point(0, 0);\r
+ this.Subtitles.Name = "Subtitles";\r
+ this.Subtitles.Size = new System.Drawing.Size(722, 310);\r
+ this.Subtitles.TabIndex = 0;\r
+ // \r
// tab_chapters\r
// \r
this.tab_chapters.BackColor = System.Drawing.Color.Transparent;\r
this.tab_advanced.Text = "Advanced";\r
this.tab_advanced.UseVisualStyleBackColor = true;\r
// \r
+ // x264Panel\r
+ // \r
+ this.x264Panel.BackColor = System.Drawing.Color.Transparent;\r
+ this.x264Panel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
+ this.x264Panel.Location = new System.Drawing.Point(0, 0);\r
+ this.x264Panel.Name = "x264Panel";\r
+ this.x264Panel.Size = new System.Drawing.Size(720, 306);\r
+ this.x264Panel.TabIndex = 0;\r
+ this.x264Panel.x264Query = "";\r
+ // \r
// tab_query\r
// \r
this.tab_query.Controls.Add(this.btn_clear);\r
// \r
this.File_ChapterImport.Filter = "CSV Files|*.csv";\r
// \r
- // PictureSettings\r
- // \r
- this.PictureSettings.BackColor = System.Drawing.Color.Transparent;\r
- this.PictureSettings.Enabled = false;\r
- this.PictureSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.PictureSettings.Location = new System.Drawing.Point(0, 0);\r
- this.PictureSettings.Name = "PictureSettings";\r
- this.PictureSettings.Size = new System.Drawing.Size(666, 279);\r
- this.PictureSettings.TabIndex = 0;\r
- // \r
- // Filters\r
- // \r
- this.Filters.BackColor = System.Drawing.Color.Transparent;\r
- this.Filters.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.Filters.Location = new System.Drawing.Point(0, 0);\r
- this.Filters.Name = "Filters";\r
- this.Filters.Size = new System.Drawing.Size(713, 310);\r
- this.Filters.TabIndex = 0;\r
- // \r
- // AudioSettings\r
- // \r
- this.AudioSettings.BackColor = System.Drawing.Color.Transparent;\r
- this.AudioSettings.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.AudioSettings.Location = new System.Drawing.Point(0, 0);\r
- this.AudioSettings.Name = "AudioSettings";\r
- this.AudioSettings.Size = new System.Drawing.Size(715, 310);\r
- this.AudioSettings.TabIndex = 0;\r
- // \r
- // Subtitles\r
- // \r
- this.Subtitles.BackColor = System.Drawing.Color.Transparent;\r
- this.Subtitles.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.Subtitles.Location = new System.Drawing.Point(0, 0);\r
- this.Subtitles.Name = "Subtitles";\r
- this.Subtitles.Size = new System.Drawing.Size(722, 310);\r
- this.Subtitles.TabIndex = 0;\r
- // \r
- // x264Panel\r
- // \r
- this.x264Panel.BackColor = System.Drawing.Color.Transparent;\r
- this.x264Panel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
- this.x264Panel.Location = new System.Drawing.Point(0, 0);\r
- this.x264Panel.Name = "x264Panel";\r
- this.x264Panel.Size = new System.Drawing.Size(720, 306);\r
- this.x264Panel.TabIndex = 0;\r
- this.x264Panel.x264Query = "";\r
- // \r
// frmMain\r
// \r
this.AllowDrop = true;\r
// Update the users config file with the CLI version data.\r
lblStatus.Text = "Setting Version Data ...";\r
Application.DoEvents();\r
- Main.setCliVersionData();\r
+ Main.SetCliVersionData();\r
\r
// Show the form, but leave disabled until preloading is complete then show the main form\r
this.Enabled = false;\r
// Startup Functions \r
private void queueRecovery()\r
{\r
- if (Main.checkQueueRecovery())\r
+ if (Main.CheckQueueRecovery())\r
{\r
DialogResult result = MessageBox.Show("HandBrake has detected unfinished items on the queue from the last time the application was launched. Would you like to recover these?", "Queue Recovery Possible", MessageBoxButtons.YesNo, MessageBoxIcon.Question);\r
\r
if (!string.IsNullOrEmpty(selectedTitle.SourceName))\r
labelSource.Text = labelSource.Text = Path.GetFileName(selectedTitle.SourceName);\r
\r
- // Run the autoName & chapterNaming functions\r
+ // Run the AutoName & ChapterNaming functions\r
if (Properties.Settings.Default.autoNaming)\r
{\r
- string autoPath = Main.autoName(this);\r
+ string autoPath = Main.AutoName(this);\r
if (autoPath != null)\r
text_destination.Text = autoPath;\r
else\r
data_chpt.Rows.Clear();\r
if (selectedTitle.Chapters.Count != 1)\r
{\r
- DataGridView chapterGridView = Main.chapterNaming(data_chpt, drop_chapterFinish.Text);\r
+ DataGridView chapterGridView = Main.ChapterNaming(data_chpt, drop_chapterFinish.Text);\r
if (chapterGridView != null)\r
data_chpt = chapterGridView;\r
}\r
}\r
\r
// Update the Duration\r
- lbl_duration.Text = Main.calculateDuration(drop_chapterStart.SelectedIndex, drop_chapterFinish.SelectedIndex, selectedTitle).ToString();\r
+ lbl_duration.Text = Main.CalculateDuration(drop_chapterStart.SelectedIndex, drop_chapterFinish.SelectedIndex, selectedTitle).ToString();\r
\r
// Run the Autonaming function\r
if (Properties.Settings.Default.autoNaming)\r
- text_destination.Text = Main.autoName(this);\r
+ text_destination.Text = Main.AutoName(this);\r
\r
// Disable chapter markers if only 1 chapter is selected.\r
if (chapterStart == chapterEnd)\r
}\r
}\r
}\r
- private void drop_mode_SelectedIndexChanged(object sender, EventArgs e)\r
+ private void SecondsOrFramesChanged(object sender, EventArgs e)\r
{\r
- if (drop_mode.SelectedIndex == 0) return;\r
+ int start, end;\r
+ int.TryParse(drop_chapterStart.Text, out start);\r
+ int.TryParse(drop_chapterFinish.Text, out end);\r
\r
- if (drop_mode.SelectedIndex != 0)\r
- drop_mode.SelectedIndex = 0;\r
+ int duration = end - start;\r
+ TimeSpan dur = TimeSpan.FromSeconds(duration);\r
+ lbl_duration.Text = dur.ToString();\r
+ }\r
+ private void drop_mode_SelectedIndexChanged(object sender, EventArgs e)\r
+ {\r
+ // Reset\r
+ this.drop_chapterFinish.TextChanged -= new System.EventHandler(this.SecondsOrFramesChanged);\r
+ this.drop_chapterStart.TextChanged -= new System.EventHandler(this.SecondsOrFramesChanged);\r
\r
- MessageBox.Show("This feature is not implemented yet! Switching Back to Chapters Mode.", "",\r
- MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ // Do Work\r
+ switch (drop_mode.SelectedIndex)\r
+ {\r
+ case 0:\r
+ drop_chapterStart.DropDownStyle = ComboBoxStyle.DropDownList;\r
+ drop_chapterFinish.DropDownStyle = ComboBoxStyle.DropDownList;\r
+ if (drop_chapterStart.Items.Count != 0)\r
+ {\r
+ drop_chapterStart.SelectedIndex = 0;\r
+ drop_chapterFinish.SelectedIndex = drop_chapterFinish.Items.Count - 1;\r
+ }\r
+ else\r
+ lbl_duration.Text = "--:--:--";\r
+ return;\r
+ case 1:\r
+ this.drop_chapterStart.TextChanged += new System.EventHandler(this.SecondsOrFramesChanged);\r
+ this.drop_chapterFinish.TextChanged += new System.EventHandler(this.SecondsOrFramesChanged);\r
+ drop_chapterStart.DropDownStyle = ComboBoxStyle.Simple;\r
+ drop_chapterFinish.DropDownStyle = ComboBoxStyle.Simple;\r
+ if (selectedTitle != null)\r
+ {\r
+ drop_chapterStart.Text = "0";\r
+ drop_chapterFinish.Text = selectedTitle.Duration.TotalSeconds.ToString();\r
+ }\r
+ return;\r
+ case 2:\r
+ MessageBox.Show("This feature is not implemented yet! Switching Back to Chapters Mode.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ drop_mode.SelectedIndex = 0;\r
+ return;\r
+ }\r
}\r
\r
//Destination\r
if (File_ChapterImport.ShowDialog() == DialogResult.OK)\r
{\r
String filename = File_ChapterImport.FileName;\r
- DataGridView imported = Main.importChapterNames(data_chpt, filename);\r
+ DataGridView imported = Main.ImportChapterNames(data_chpt, filename);\r
if (imported != null)\r
data_chpt = imported;\r
}\r
private void mnu_resetChapters_Click(object sender, EventArgs e)\r
{\r
data_chpt.Rows.Clear();\r
- DataGridView chapterGridView = Main.chapterNaming(data_chpt, drop_chapterFinish.Text);\r
+ DataGridView chapterGridView = Main.ChapterNaming(data_chpt, drop_chapterFinish.Text);\r
if (chapterGridView != null)\r
{\r
data_chpt = chapterGridView;\r
\r
// Now select the longest title\r
if (thisDVD.Titles.Count != 0)\r
- drp_dvdtitle.SelectedItem = Main.selectLongestTitle(thisDVD);\r
+ drp_dvdtitle.SelectedItem = Main.SelectLongestTitle(thisDVD);\r
\r
// Enable the creation of chapter markers if the file is an image of a dvd.\r
if (sourcePath.ToLower().Contains(".iso") || sourcePath.Contains("VIDEO_TS"))\r
InitializeComponent();\r
mainWindow = mw;\r
\r
- IDictionary<string, string> langList = Main.mapLanguages();\r
+ IDictionary<string, string> langList = Main.MapLanguages();\r
foreach (string item in langList.Keys)\r
drop_preferredLang.Items.Add(item);\r
\r
DialogResult result = MessageBox.Show("Are you sure you wish to clear the log file directory?", "Clear Logs", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);\r
if (result == DialogResult.Yes)\r
{\r
- Main.clearLogs();\r
+ Main.ClearLogs();\r
MessageBox.Show(this, "HandBrake's Log file directory has been cleared!", "Notice", MessageBoxButtons.OK,\r
MessageBoxIcon.Information);\r
}\r