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

◆ TryConvertWindowsIdToIanaId() [2/3]

static unsafe bool System.TimeZoneInfo.TryConvertWindowsIdToIanaId ( string windowsId,
string region,
bool allocate,
out string ianaId )
inlinestaticprivate

Definition at line 2308 of file TimeZoneInfo.cs.

2309 {
2311 {
2312 ianaId = null;
2313 return false;
2314 }
2315 if (windowsId.Equals("utc", StringComparison.OrdinalIgnoreCase))
2316 {
2317 ianaId = "Etc/UTC";
2318 return true;
2319 }
2320 foreach (char c in windowsId)
2321 {
2322 if (c == '\\' || c == '\n' || c == '\r')
2323 {
2324 ianaId = null;
2325 return false;
2326 }
2327 }
2328 IntPtr region2 = IntPtr.Zero;
2329 if (region != null && region.Length < 11)
2330 {
2331 byte* ptr = stackalloc byte[(int)(uint)(region.Length + 1)];
2332 int j;
2333 for (j = 0; j < region.Length && region[j] <= '\u007f'; j++)
2334 {
2335 ptr[j] = (((uint)(region[j] - 97) <= 25u) ? ((byte)(region[j] - 97 + 65)) : ((byte)region[j]));
2336 }
2337 if (j >= region.Length)
2338 {
2339 ptr[region.Length] = 0;
2340 region2 = new IntPtr(ptr);
2341 }
2342 }
2343 char* ptr2 = stackalloc char[100];
2345 if (num > 0)
2346 {
2347 ianaId = (allocate ? new string(ptr2, 0, num) : null);
2348 return true;
2349 }
2350 ianaId = null;
2351 return false;
2352 }
static unsafe int WindowsIdToIanaId(string windowsId, IntPtr region, char *ianaId, int ianaIdLength)

References System.Runtime.Serialization.Dictionary, System.Globalization.GlobalizationMode.Invariant, System.Globalization.GlobalizationMode.UseNls, Interop.Globalization.WindowsIdToIanaId(), and System.IntPtr.Zero.