Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ NlsGetSortKey()

unsafe int System.Globalization.CompareInfo.NlsGetSortKey ( ReadOnlySpan< char > source,
Span< byte > destination,
CompareOptions options )
inlineprivate

Definition at line 2109 of file CompareInfo.cs.

2110 {
2111 if (destination.IsEmpty)
2112 {
2113 ThrowHelper.ThrowArgumentException_DestinationTooShort();
2114 }
2115 if (!Environment.IsWindows8OrAbove)
2116 {
2117 source = source.ToString();
2118 }
2119 uint dwMapFlags = 0x400u | (uint)GetNativeCompareFlags(options);
2120 int num = source.Length;
2121 if (num == 0)
2122 {
2123 source = string.Empty;
2124 num = -1;
2125 }
2126 int num3;
2127 fixed (char* lpSrcStr = &MemoryMarshal.GetReference(source))
2128 {
2129 fixed (byte* lpDestStr = &MemoryMarshal.GetReference(destination))
2130 {
2131 if (!Environment.IsWindows8OrAbove)
2132 {
2134 if (num2 > destination.Length)
2135 {
2136 ThrowHelper.ThrowArgumentException_DestinationTooShort();
2137 }
2138 if (num2 <= 0)
2139 {
2140 throw new ArgumentException(SR.Arg_ExternalException);
2141 }
2142 }
2144 }
2145 }
2146 if (num3 <= 0)
2147 {
2148 if (Marshal.GetLastPInvokeError() != 122)
2149 {
2150 throw new ArgumentException(SR.Arg_ExternalException);
2151 }
2152 ThrowHelper.ThrowArgumentException_DestinationTooShort();
2153 }
2154 return num3;
2155 }
static unsafe int LCMapStringEx(string lpLocaleName, uint dwMapFlags, char *lpSrcStr, int cchSrc, void *lpDestStr, int cchDest, void *lpVersionInformation, void *lpReserved, IntPtr sortHandle)
static int GetNativeCompareFlags(CompareOptions options)

References System.Globalization.CompareInfo._sortHandle, System.Globalization.CompareInfo._sortName, System.SR.Arg_ExternalException, System.destination, System.Runtime.Serialization.Dictionary, System.Runtime.InteropServices.Marshal.GetLastPInvokeError(), System.Globalization.CompareInfo.GetNativeCompareFlags(), System.Environment.IsWindows8OrAbove, Interop.Kernel32.LCMapStringEx(), System.options, System.source, System.ThrowHelper.ThrowArgumentException_DestinationTooShort(), and System.IntPtr.Zero.

Referenced by System.Globalization.CompareInfo.GetSortKeyCore().