diff --git a/SabreTools.Helper/Tools/Style.cs b/SabreTools.Helper/Tools/Style.cs index c1cc1a33..41db8549 100644 --- a/SabreTools.Helper/Tools/Style.cs +++ b/SabreTools.Helper/Tools/Style.cs @@ -436,107 +436,6 @@ namespace SabreTools.Helper return bytes; } - /// - /// https://psycodedeveloper.wordpress.com/2013/04/12/c-numeric-sorting-revisited/ - /// - public static int CompareNumeric(string s, string other) - { - if ((s == null || s.Replace(" ", string.Empty).Length == 0) - && (other != null && other.Replace(" ", string.Empty).Length > 0)) - { - return -1; - } - if ((s != null && s.Replace(" ", string.Empty).Length > 0) - && (other == null || other.Replace(" ", string.Empty).Length == 0)) - { - return 1; - } - - if (s != null && other != null && - (s = s.Replace(" ", string.Empty)).Length > 0 && - (other = other.Replace(" ", string.Empty)).Length > 0) - { - int sIndex = 0, otherIndex = 0; - - while (sIndex < s.Length) - { - if (otherIndex >= other.Length) - { - return 1; - } - - if (char.IsDigit(s[sIndex])) - { - if (!char.IsDigit(other[otherIndex])) - { - return -1; - } - - // Compare the numbers - StringBuilder sBuilder = new StringBuilder(), otherBuilder = new StringBuilder(); - - while (sIndex < s.Length && char.IsDigit(s[sIndex])) - { - sBuilder.Append(s[sIndex++]); - } - - while (otherIndex < other.Length && char.IsDigit(other[otherIndex])) - { - otherBuilder.Append(other[otherIndex++]); - } - - long sValue = 0L, otherValue = 0L; - - if (!Int64.TryParse(sBuilder.ToString(), out sValue)) - { - sValue = Int64.MaxValue; - } - - if (!Int64.TryParse(otherBuilder.ToString(), out otherValue)) - { - otherValue = Int64.MaxValue; - } - - if (sValue < otherValue) - { - return -1; - } - else if (sValue > otherValue) - { - return 1; - } - } - else if (char.IsDigit(other[otherIndex])) - { - return 1; - } - else - { - int difference = string.Compare(s[sIndex].ToString(), other[otherIndex].ToString(), StringComparison.InvariantCultureIgnoreCase); - - if (difference > 0) - { - return 1; - } - else if (difference < 0) - { - return -1; - } - - sIndex++; - otherIndex++; - } - } - - if (otherIndex < other.Length) - { - return -1; - } - } - - return 0; - } - /// /// http://stackoverflow.com/questions/146134/how-to-remove-illegal-characters-from-path-and-filenames ///