summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs')
-rw-r--r--win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs28
1 files changed, 27 insertions, 1 deletions
diff --git a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
index 3fb62e151..bf39d859a 100644
--- a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
+++ b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
@@ -52,7 +52,7 @@ namespace HandBrakeWPF.Helpers
{
// Get the Source Name and remove any invalid characters
string sourceName = Path.GetInvalidFileNameChars().Aggregate(sourceOrLabelName, (current, character) => current.Replace(character.ToString(), string.Empty));
-
+
// Remove Underscores
if (userSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore))
sourceName = sourceName.Replace("_", " ");
@@ -161,5 +161,31 @@ namespace HandBrakeWPF.Helpers
return autoNamePath;
}
+
+ /// <summary>
+ /// Check if there is a valid autoname path.
+ /// </summary>
+ /// <returns>
+ /// True if there is a valid path
+ /// </returns>
+ 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
+ {
+ return
+ Directory.Exists(
+ userSettingService.GetUserSetting<string>(UserSettingConstants.AutoNamePath).Trim());
+ }
+ }
}
}