|
|
|
@ -18,35 +18,16 @@
@@ -18,35 +18,16 @@
|
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Runtime.InteropServices; |
|
|
|
|
|
|
|
|
|
using NaturalSort.Extension; |
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.ILSpy.TreeNodes |
|
|
|
|
{ |
|
|
|
|
/// <summary>
|
|
|
|
|
/// .NET natural string comparison emulating .Instance behavior of original native-interop variant
|
|
|
|
|
/// .NET natural string comparison
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class NaturalStringComparer |
|
|
|
|
{ |
|
|
|
|
public static readonly IComparer<string> Instance = StringComparison.CurrentCultureIgnoreCase.WithNaturalSort(); |
|
|
|
|
// public static readonly NaturalStringComparer Instance = new NaturalStringComparer();
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if WINDOWS
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Native-Interop natural string comparion using StrCmpLogicalW from shlwapi.dll
|
|
|
|
|
/// </summary>
|
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1060:MovePInvokesToNativeMethodsClass")] |
|
|
|
|
public sealed class NativeNaturalStringComparer : IComparer<string> |
|
|
|
|
{ |
|
|
|
|
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)] |
|
|
|
|
static extern int StrCmpLogicalW(string psz1, string psz2); |
|
|
|
|
|
|
|
|
|
public int Compare(string x, string y) |
|
|
|
|
{ |
|
|
|
|
return StrCmpLogicalW(x, y); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif
|
|
|
|
|
} |
|
|
|
|