diff options
author | sr55 <[email protected]> | 2017-06-26 20:41:20 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2017-06-26 20:42:11 +0100 |
commit | 3a0b7d29770107658ba13e365a8550cd3dc0e40e (patch) | |
tree | 634f97a1b706c523e5f93ba07de3042ca497714a /win | |
parent | f9f999cb52c0373ca53ba21a133a87945af10a3e (diff) |
WinGui: AutoName Sort the InvalidFileNameChars Array before doing a Binary Search on it.
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index c62161264..5d936be0c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -1542,10 +1542,11 @@ namespace HandBrakeWPF.ViewModels /// <returns>True if valid</returns>
private bool IsValidAutonameFormat(string input, bool isSilent)
{
+ char[] invalidchars = Path.GetInvalidFileNameChars();
+ Array.Sort(invalidchars);
foreach (var characterToTest in input)
{
- // we binary search for the character in the invalid set. This should be lightning fast.
- if (Array.BinarySearch(Path.GetInvalidFileNameChars(), characterToTest) >= 0)
+ if (Array.BinarySearch(invalidchars, characterToTest) >= 0)
{
if (!isSilent)
{
|