diff options
author | sr55 <[email protected]> | 2008-09-10 11:16:21 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2008-09-10 11:16:21 +0000 |
commit | b9fb350aea3bb37349f24d6b33341b2644407588 (patch) | |
tree | c1010eb31a028d99ff1976af7b05c8c4d9b9236c /win/C#/Functions | |
parent | e57d4d0bf36c3b5d4691134d0fdb8171cb25f843 (diff) |
WinGui:
- New option to allow the user to enter which format they wish the autoName function to use.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1686 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions')
-rw-r--r-- | win/C#/Functions/Common.cs | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/win/C#/Functions/Common.cs b/win/C#/Functions/Common.cs index c9d65192b..96c56a856 100644 --- a/win/C#/Functions/Common.cs +++ b/win/C#/Functions/Common.cs @@ -1113,17 +1113,22 @@ namespace Handbrake.Functions {
if (mainWindow.drp_dvdtitle.Text != "Automatic")
{
+ // Todo: This code is a tad messy. Clean it up at some point.
+ // Get the Source Name
string source = mainWindow.text_source.Text;
string[] sourceName = source.Split('\\');
source = sourceName[sourceName.Length - 1].Replace(".iso", "").Replace(".mpg", "").Replace(".ts", "").Replace(".ps", "");
+ // Get the Selected Title Number
string title = mainWindow.drp_dvdtitle.Text;
string[] titlesplit = title.Split(' ');
title = titlesplit[0];
+ // Get the Chapter Start and Chapter End Numbers
string cs = mainWindow.drop_chapterStart.Text;
string cf = mainWindow.drop_chapterFinish.Text;
+ // Just incase the above are set to their default Automatic values, set the varible to ""
if (title == "Automatic")
title = "";
if (cs == "Auto")
@@ -1131,10 +1136,22 @@ namespace Handbrake.Functions if (cf == "Auto")
cf = "";
+ // If both CS and CF are populated, set the dash varible
string dash = "";
if (cf != "Auto")
dash = "-";
+ // Get the destination filename.
+ string destination_filename = "";
+ if (Properties.Settings.Default.autoNameFormat != "")
+ {
+ destination_filename = Properties.Settings.Default.autoNameFormat;
+ destination_filename = destination_filename.Replace("{source}", source).Replace("{title}", title).Replace("{chapters}", cs + dash + cf);
+ }
+ else
+ destination_filename = source + "_T" + title + "_C" + cs + dash + cf;
+
+ // If the text box is blank
if (!mainWindow.text_destination.Text.Contains("\\"))
{
string filePath = "";
@@ -1143,19 +1160,16 @@ namespace Handbrake.Functions if (Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location")
filePath = Properties.Settings.Default.autoNamePath + "\\";
}
- mainWindow.text_destination.Text = filePath + source + "_T" + title + "_C" + cs + dash + cf + ".mp4";
+ mainWindow.text_destination.Text = filePath + destination_filename + ".mp4";
}
- else
+ else // If the text box already has a path and file
{
string dest = mainWindow.text_destination.Text;
-
string[] destName = dest.Split('\\');
-
-
string[] extension = dest.Split('.');
string ext = extension[extension.Length - 1];
- destName[destName.Length - 1] = source + "_T" + title + "_C" + cs + dash + cf + "." + ext;
+ destName[destName.Length - 1] = destination_filename + "." + ext;
string fullDest = "";
foreach (string part in destName)
|