From 4998375a9e89b675ac14876205b082b94d350a06 Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Mon, 8 Apr 2024 16:41:28 +0200 Subject: [PATCH] Use NaturalSort.Extension instead of Interop --- Directory.Packages.props | 1 + ILSpy/ILSpy.csproj | 1 + ILSpy/TreeNodes/NaturalStringComparer.cs | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 13e1ebab6..578c8be2f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -28,6 +28,7 @@ + diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj index 5e8184796..93feab3a1 100644 --- a/ILSpy/ILSpy.csproj +++ b/ILSpy/ILSpy.csproj @@ -48,6 +48,7 @@ + diff --git a/ILSpy/TreeNodes/NaturalStringComparer.cs b/ILSpy/TreeNodes/NaturalStringComparer.cs index 016b7758f..dd13ec087 100644 --- a/ILSpy/TreeNodes/NaturalStringComparer.cs +++ b/ILSpy/TreeNodes/NaturalStringComparer.cs @@ -16,9 +16,13 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. +using System; +using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; +using NaturalSort.Extension; + namespace ICSharpCode.ILSpy.TreeNodes { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1060:MovePInvokesToNativeMethodsClass")] @@ -27,7 +31,8 @@ namespace ICSharpCode.ILSpy.TreeNodes [DllImport("shlwapi.dll", CharSet = CharSet.Unicode)] static extern int StrCmpLogicalW(string psz1, string psz2); - public static readonly NaturalStringComparer Instance = new NaturalStringComparer(); + // public static readonly NaturalStringComparer Instance = new NaturalStringComparer(); + public static readonly IComparer Instance = StringComparison.OrdinalIgnoreCase.WithNaturalSort(); public int Compare(string x, string y) {