Added logic for an alphabetical sort if the RO Menu Items begins with numbers and slashes.

This commit is contained in:
Rich 2014-01-22 18:43:15 +00:00
parent fda348ed5e
commit d9b171c061

View File

@ -367,12 +367,13 @@ namespace Volian.Controls.Library
} }
return index; return index;
} }
private static Regex _RegExGetNumber = new Regex(@"^ *[+-]?[.,0-9]+(E[+-]?[0-9]+)?"); private static Regex _RegExGetNumber = new Regex(@"^ *[+-]?[.,0-9/]+(E[+-]?[0-9]+)?");
// Sort by numeric value if possible, Otherwise sort alphabetically.
private bool GreaterValue(string value1, string value2) private bool GreaterValue(string value1, string value2)
{ {
Match match1 = _RegExGetNumber.Match(value1); Match match1 = _RegExGetNumber.Match(value1);
Match match2 = _RegExGetNumber.Match(value2); Match match2 = _RegExGetNumber.Match(value2);
if (match1.Success && match2.Success) // Compare the numeric value if (match1.Success && !match1.Value.Contains("/") && match2.Success && !match2.Value.Contains("/")) // Compare the numeric value
{ {
double dbl1 = double.Parse(match1.ToString()); double dbl1 = double.Parse(match1.ToString());
double dbl2 = double.Parse(match2.ToString()); double dbl2 = double.Parse(match2.ToString());