using System;\r
using System.Collections.Generic;\r
using System.Diagnostics;\r
+ using System.Globalization;\r
using System.IO;\r
using System.Net;\r
+ using System.Text;\r
using System.Text.RegularExpressions;\r
using System.Threading;\r
using System.Windows.Forms;\r
foreach (DataGridViewRow item in dataChpt.Rows)\r
{\r
string name;\r
- chapterMap.TryGetValue((int) item.Cells[0].Value, out name);\r
+ chapterMap.TryGetValue((int)item.Cells[0].Value, out name);\r
item.Cells[1].Value = name ?? "Chapter " + item.Cells[0].Value;\r
}\r
\r
// Get the Source Name \r
string sourceName = mainWindow.SourceName;\r
\r
+ if (Properties.Settings.Default.AutoNameRemoveUnderscore)\r
+ sourceName = sourceName.Replace("_", " ");\r
+\r
+ if (Properties.Settings.Default.AutoNameTitleCase)\r
+ sourceName = TitleCase(sourceName);\r
+\r
// Get the Selected Title Number\r
string[] titlesplit = mainWindow.drp_dvdtitle.Text.Split(' ');\r
string dvdTitle = titlesplit[0].Replace("Automatic", string.Empty);\r
Process cliProcess = new Process();\r
ProcessStartInfo handBrakeCli = new ProcessStartInfo("HandBrakeCLI.exe", " -u -v0")\r
{\r
- UseShellExecute = false, \r
- RedirectStandardError = true, \r
- RedirectStandardOutput = true, \r
+ UseShellExecute = false,\r
+ RedirectStandardError = true,\r
+ RedirectStandardOutput = true,\r
CreateNoWindow = true\r
};\r
cliProcess.StartInfo = handBrakeCli;\r
UpdateCheckInformation info =\r
new UpdateCheckInformation\r
{\r
- NewVersionAvailable = false, \r
+ NewVersionAvailable = false,\r
BuildInformation = null\r
};\r
callback(new UpdateCheckResult(debug, info));\r
UpdateCheckInformation info2 =\r
new UpdateCheckInformation\r
{\r
- NewVersionAvailable = latest > current, \r
+ NewVersionAvailable = latest > current,\r
BuildInformation = reader\r
};\r
callback(new UpdateCheckResult(debug, info2));\r
/// </returns>\r
public static UpdateCheckInformation EndCheckForUpdates(IAsyncResult result)\r
{\r
- UpdateCheckResult checkResult = (UpdateCheckResult) result;\r
+ UpdateCheckResult checkResult = (UpdateCheckResult)result;\r
return checkResult.Result;\r
}\r
\r
drives.Add(new DriveInformation\r
{\r
Id = id,\r
- VolumeLabel = curDrive.VolumeLabel, \r
+ VolumeLabel = curDrive.VolumeLabel,\r
RootDirectory = curDrive.RootDirectory + "VIDEO_TS"\r
});\r
id++;\r
}\r
return drives;\r
}\r
+\r
+ public static string TitleCase(string input)\r
+ {\r
+ string[] tokens = input.Split(' ');\r
+ StringBuilder sb = new StringBuilder(input.Length);\r
+ foreach (string s in tokens)\r
+ {\r
+ sb.Append(s[0].ToString().ToUpper());\r
+ sb.Append(s.Substring(1).ToLower());\r
+ sb.Append(" ");\r
+ }\r
+\r
+ return sb.ToString().Trim();\r
+ }\r
+\r
+\r
}\r
}
\ No newline at end of file
this["showCliForInGuiEncodeStatus"] = value;\r
}\r
}\r
+ \r
+ [global::System.Configuration.UserScopedSettingAttribute()]\r
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
+ public bool AutoNameTitleCase {\r
+ get {\r
+ return ((bool)(this["AutoNameTitleCase"]));\r
+ }\r
+ set {\r
+ this["AutoNameTitleCase"] = value;\r
+ }\r
+ }\r
+ \r
+ [global::System.Configuration.UserScopedSettingAttribute()]\r
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\r
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]\r
+ public bool AutoNameRemoveUnderscore {\r
+ get {\r
+ return ((bool)(this["AutoNameRemoveUnderscore"]));\r
+ }\r
+ set {\r
+ this["AutoNameRemoveUnderscore"] = value;\r
+ }\r
+ }\r
}\r
}\r
<Setting Name="showCliForInGuiEncodeStatus" Type="System.Boolean" Scope="User">\r
<Value Profile="(Default)">True</Value>\r
</Setting>\r
+ <Setting Name="AutoNameTitleCase" Type="System.Boolean" Scope="User">\r
+ <Value Profile="(Default)">False</Value>\r
+ </Setting>\r
+ <Setting Name="AutoNameRemoveUnderscore" Type="System.Boolean" Scope="User">\r
+ <Value Profile="(Default)">False</Value>\r
+ </Setting>\r
</Settings>\r
</SettingsFile>
\ No newline at end of file
<setting name="showCliForInGuiEncodeStatus" serializeAs="String">\r
<value>True</value>\r
</setting>\r
+ <setting name="AutoNameTitleCase" serializeAs="String">\r
+ <value>False</value>\r
+ </setting>\r
+ <setting name="AutoNameRemoveUnderscore" serializeAs="String">\r
+ <value>False</value>\r
+ </setting>\r
</Handbrake.Properties.Settings>\r
</userSettings>\r
<startup />\r
this.drp_completeOption = new System.Windows.Forms.ComboBox();\r
this.tab_options = new System.Windows.Forms.TabControl();\r
this.tab_general = new System.Windows.Forms.TabPage();\r
+ this.check_TitleCase = new System.Windows.Forms.CheckBox();\r
+ this.check_removeUnderscores = new System.Windows.Forms.CheckBox();\r
this.check_growlEncode = new System.Windows.Forms.CheckBox();\r
this.check_GrowlQueue = new System.Windows.Forms.CheckBox();\r
this.check_m4v = new System.Windows.Forms.CheckBox();\r
// \r
// tab_general\r
// \r
+ this.tab_general.Controls.Add(this.check_TitleCase);\r
+ this.tab_general.Controls.Add(this.check_removeUnderscores);\r
this.tab_general.Controls.Add(this.check_growlEncode);\r
this.tab_general.Controls.Add(this.check_GrowlQueue);\r
this.tab_general.Controls.Add(this.check_m4v);\r
this.tab_general.Text = "General";\r
this.tab_general.UseVisualStyleBackColor = true;\r
// \r
+ // check_TitleCase\r
+ // \r
+ this.check_TitleCase.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
+ this.check_TitleCase.AutoSize = true;\r
+ this.check_TitleCase.Location = new System.Drawing.Point(297, 279);\r
+ this.check_TitleCase.Name = "check_TitleCase";\r
+ this.check_TitleCase.Size = new System.Drawing.Size(151, 17);\r
+ this.check_TitleCase.TabIndex = 101;\r
+ this.check_TitleCase.Text = "Change case to Title Case";\r
+ this.ToolTip.SetToolTip(this.check_TitleCase, "For the {source} option:.\r\nChange the source name to Title Case\r\ne.g \"MOVIE NAME\"" +\r
+ " to \"Movie Name\"\r\n");\r
+ this.check_TitleCase.UseVisualStyleBackColor = true;\r
+ this.check_TitleCase.CheckedChanged += new System.EventHandler(this.check_TitleCase_CheckedChanged);\r
+ // \r
+ // check_removeUnderscores\r
+ // \r
+ this.check_removeUnderscores.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
+ this.check_removeUnderscores.AutoSize = true;\r
+ this.check_removeUnderscores.Location = new System.Drawing.Point(108, 279);\r
+ this.check_removeUnderscores.Name = "check_removeUnderscores";\r
+ this.check_removeUnderscores.Size = new System.Drawing.Size(183, 17);\r
+ this.check_removeUnderscores.TabIndex = 100;\r
+ this.check_removeUnderscores.Text = "Remove Underscores from Name";\r
+ this.ToolTip.SetToolTip(this.check_removeUnderscores, "For the {source} option:\r\nRemove any underscores from the source name.\r\n\r\n");\r
+ this.check_removeUnderscores.UseVisualStyleBackColor = true;\r
+ this.check_removeUnderscores.CheckedChanged += new System.EventHandler(this.check_removeUnderscores_CheckedChanged);\r
+ // \r
// check_growlEncode\r
// \r
this.check_growlEncode.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
// \r
this.check_m4v.Anchor = System.Windows.Forms.AnchorStyles.Left;\r
this.check_m4v.AutoSize = true;\r
- this.check_m4v.Location = new System.Drawing.Point(108, 279);\r
+ this.check_m4v.Location = new System.Drawing.Point(108, 303);\r
this.check_m4v.Name = "check_m4v";\r
this.check_m4v.Size = new System.Drawing.Size(319, 17);\r
this.check_m4v.TabIndex = 82;\r
private System.Windows.Forms.Label label33;\r
internal System.Windows.Forms.CheckBox check_clearOldLogs;\r
internal System.Windows.Forms.CheckBox check_showCliForInGUIEncode;\r
+ internal System.Windows.Forms.CheckBox check_TitleCase;\r
+ internal System.Windows.Forms.CheckBox check_removeUnderscores;\r
}\r
}
\ No newline at end of file
if (Properties.Settings.Default.useM4v)\r
check_m4v.CheckState = CheckState.Checked;\r
\r
+ // Remove Underscores\r
+ check_removeUnderscores.Checked = Properties.Settings.Default.AutoNameRemoveUnderscore;\r
+\r
+ // Title case\r
+ check_TitleCase.Checked = Properties.Settings.Default.AutoNameTitleCase;\r
+\r
// #############################\r
// Picture Tab\r
// #############################\r
Properties.Settings.Default.useM4v = check_m4v.Checked;\r
}\r
\r
+ private void check_removeUnderscores_CheckedChanged(object sender, EventArgs e)\r
+ {\r
+ Properties.Settings.Default.AutoNameRemoveUnderscore = check_removeUnderscores.Checked;\r
+ }\r
+\r
+ private void check_TitleCase_CheckedChanged(object sender, EventArgs e)\r
+ {\r
+ Properties.Settings.Default.AutoNameTitleCase = check_TitleCase.Checked;\r
+ }\r
+\r
#endregion\r
\r
#region Picture\r
Properties.Settings.Default.Save(); // Small hack for Vista. Seems to work fine on XP without this\r
this.Close();\r
}\r
+\r
}\r
}
\ No newline at end of file