summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-06-01 21:28:05 +0000
committersr55 <[email protected]>2013-06-01 21:28:05 +0000
commit0c65f4f74c61edb71ef7fbb03be0e0b3c932d810 (patch)
tree0e6b847b6861f0d03a0a63cb93b4f7844c868997 /win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
parent0b38ee2d844b915314b9731fd2b2ea4906e6439b (diff)
WinGui: Added option to AutoName functionality to remove common punctuation from filenames (Comma, Period and Dash)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5542 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs')
-rw-r--r--win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs30
1 files changed, 16 insertions, 14 deletions
diff --git a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
index 2298eb4ab..407748027 100644
--- a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
+++ b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
@@ -47,7 +47,7 @@ namespace HandBrakeWPF.Helpers
}
string autoNamePath = string.Empty;
- if (task.Title != 0) // TODO check.
+ if (task.Title != 0)
{
// Get the Source Name and remove any invalid characters
string sourceName = Path.GetInvalidFileNameChars().Aggregate(sourceOrLabelName, (current, character) => current.Replace(character.ToString(), string.Empty));
@@ -56,6 +56,13 @@ namespace HandBrakeWPF.Helpers
if (userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore))
sourceName = sourceName.Replace("_", " ");
+ if (userSettingService.GetUserSetting<bool>(UserSettingConstants.RemovePunctuation))
+ {
+ sourceName = sourceName.Replace("-", string.Empty);
+ sourceName = sourceName.Replace(",", string.Empty);
+ sourceName = sourceName.Replace(".", string.Empty);
+ }
+
// Switch to "Title Case"
if (userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameTitleCase))
sourceName = sourceName.ToTitleCase();
@@ -170,21 +177,16 @@ namespace HandBrakeWPF.Helpers
public static bool IsAutonamingEnabled()
{
IUserSettingService userSettingService = IoC.Get<IUserSettingService>();
- // If there is an auto name path, use it...
- if (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim().StartsWith("{source_path}"))
- {
- return true;
- }
- else if (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Contains("{source_folder_name}"))
- {
- return true;
- }
- else
+
+ if (!userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNaming))
{
- return
- Directory.Exists(
- userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim());
+ return false;
}
+
+ // If there is an auto name path, use it...
+ return userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim().StartsWith("{source_path}") ||
+ (userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Contains("{source_folder_name}") ||
+ Directory.Exists(userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim()));
}
}
}