summaryrefslogtreecommitdiff
path: root/src/mscorlib/corefx
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/corefx')
-rw-r--r--src/mscorlib/corefx/Debug.cs29
-rw-r--r--src/mscorlib/corefx/Interop/Unix/Interop.Errors.cs207
-rw-r--r--src/mscorlib/corefx/Interop/Unix/Interop.IOErrors.cs170
-rw-r--r--src/mscorlib/corefx/Interop/Unix/Interop.Libraries.cs12
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs33
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Casing.cs23
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Collation.cs69
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Idna.cs21
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Locale.cs40
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs19
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs18
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs31
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Utils.cs52
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Close.cs15
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.FLock.cs31
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.FSync.cs15
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.FTruncate.cs15
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Fcntl.cs21
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.GetCwd.cs74
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.GetUnixName.cs21
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.LSeek.cs22
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.MksTemps.cs17
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Open.cs15
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.OpenFlags.cs27
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.PathConf.cs73
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Permissions.cs32
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.PosixFAdvise.cs36
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Read.cs25
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Stat.cs59
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Unlink.cs15
-rw-r--r--src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Write.cs27
-rw-r--r--src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs26
-rw-r--r--src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.NTSTATUS.cs19
-rw-r--r--src/mscorlib/corefx/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs22
-rw-r--r--src/mscorlib/corefx/Interop/Windows/Interop.BOOL.cs21
-rw-r--r--src/mscorlib/corefx/Interop/Windows/Interop.Errors.cs71
-rw-r--r--src/mscorlib/corefx/Interop/Windows/Interop.Libraries.cs15
-rw-r--r--src/mscorlib/corefx/Interop/Windows/NtDll/Interop.ZeroMemory.cs17
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CancelIoEx.cs16
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CloseHandle.cs16
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CreateFile.cs40
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileOperations.cs12
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileTypes.cs16
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs17
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FormatMessage.cs112
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileInformationByHandleEx.cs26
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs15
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFullPathNameW.cs18
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetLongPathNameW.cs18
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempFileNameW.cs16
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempPathW.cs16
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.LockFile.cs20
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs21
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs22
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SECURITY_ATTRIBUTES.cs21
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SafeCreateFile.cs45
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SecurityOptions.cs18
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetEndOfFile.cs15
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetErrorMode.cs14
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFileInformationByHandle.cs39
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs15
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.UnsafeCreateFile.cs25
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs22
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs24
-rw-r--r--src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs22
-rw-r--r--src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysAllocStringLen.cs16
-rw-r--r--src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysStringLen.cs22
-rw-r--r--src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs119
-rw-r--r--src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs50
-rw-r--r--src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeThreadPoolIOHandle.cs28
-rw-r--r--src/mscorlib/corefx/SR.cs818
-rw-r--r--src/mscorlib/corefx/System/Buffers/ArrayPool.cs100
-rw-r--r--src/mscorlib/corefx/System/Buffers/ArrayPoolEventSource.cs78
-rw-r--r--src/mscorlib/corefx/System/Buffers/ConfigurableArrayPool.cs265
-rw-r--r--src/mscorlib/corefx/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs292
-rw-r--r--src/mscorlib/corefx/System/Buffers/Utilities.cs35
-rw-r--r--src/mscorlib/corefx/System/Globalization/Calendar.cs859
-rw-r--r--src/mscorlib/corefx/System/Globalization/CalendarAlgorithmType.cs20
-rw-r--r--src/mscorlib/corefx/System/Globalization/CalendarData.Unix.cs335
-rw-r--r--src/mscorlib/corefx/System/Globalization/CalendarData.Windows.cs469
-rw-r--r--src/mscorlib/corefx/System/Globalization/CalendarData.cs377
-rw-r--r--src/mscorlib/corefx/System/Globalization/CalendarWeekRule.cs18
-rw-r--r--src/mscorlib/corefx/System/Globalization/CalendricalCalculationsHelper.cs412
-rw-r--r--src/mscorlib/corefx/System/Globalization/CharUnicodeInfo.cs391
-rw-r--r--src/mscorlib/corefx/System/Globalization/CharUnicodeInfoData.cs1247
-rw-r--r--src/mscorlib/corefx/System/Globalization/ChineseLunisolarCalendar.cs395
-rw-r--r--src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs397
-rw-r--r--src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs415
-rw-r--r--src/mscorlib/corefx/System/Globalization/CompareInfo.cs1094
-rw-r--r--src/mscorlib/corefx/System/Globalization/CultureData.Unix.cs419
-rw-r--r--src/mscorlib/corefx/System/Globalization/CultureData.Windows.cs672
-rw-r--r--src/mscorlib/corefx/System/Globalization/CultureData.cs2470
-rw-r--r--src/mscorlib/corefx/System/Globalization/CultureInfo.Unix.cs31
-rw-r--r--src/mscorlib/corefx/System/Globalization/CultureInfo.Windows.cs57
-rw-r--r--src/mscorlib/corefx/System/Globalization/CultureInfo.cs1558
-rw-r--r--src/mscorlib/corefx/System/Globalization/CultureNotFoundException.cs122
-rw-r--r--src/mscorlib/corefx/System/Globalization/CultureTypes.cs28
-rw-r--r--src/mscorlib/corefx/System/Globalization/DateTimeFormatInfo.cs3087
-rw-r--r--src/mscorlib/corefx/System/Globalization/DateTimeFormatInfoScanner.cs742
-rw-r--r--src/mscorlib/corefx/System/Globalization/DayLightTime.cs53
-rw-r--r--src/mscorlib/corefx/System/Globalization/DigitShapes.cs18
-rw-r--r--src/mscorlib/corefx/System/Globalization/EastAsianLunisolarCalendar.cs717
-rw-r--r--src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs666
-rw-r--r--src/mscorlib/corefx/System/Globalization/GregorianCalendarHelper.cs668
-rw-r--r--src/mscorlib/corefx/System/Globalization/GregorianCalendarTypes.cs21
-rw-r--r--src/mscorlib/corefx/System/Globalization/HebrewCalendar.cs1129
-rw-r--r--src/mscorlib/corefx/System/Globalization/HebrewNumber.cs458
-rw-r--r--src/mscorlib/corefx/System/Globalization/HijriCalendar.Unix.cs15
-rw-r--r--src/mscorlib/corefx/System/Globalization/HijriCalendar.Win32.cs96
-rw-r--r--src/mscorlib/corefx/System/Globalization/HijriCalendar.WinRT.cs16
-rw-r--r--src/mscorlib/corefx/System/Globalization/HijriCalendar.cs679
-rw-r--r--src/mscorlib/corefx/System/Globalization/IdnMapping.Unix.cs134
-rw-r--r--src/mscorlib/corefx/System/Globalization/IdnMapping.Windows.cs113
-rw-r--r--src/mscorlib/corefx/System/Globalization/IdnMapping.cs152
-rw-r--r--src/mscorlib/corefx/System/Globalization/InternalGlobalizationHelper.cs50
-rw-r--r--src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Unix.cs88
-rw-r--r--src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Win32.cs209
-rw-r--r--src/mscorlib/corefx/System/Globalization/JapaneseCalendar.WinRT.cs62
-rw-r--r--src/mscorlib/corefx/System/Globalization/JapaneseCalendar.cs411
-rw-r--r--src/mscorlib/corefx/System/Globalization/JapaneseLunisolarCalendar.cs311
-rw-r--r--src/mscorlib/corefx/System/Globalization/JulianCalendar.cs444
-rw-r--r--src/mscorlib/corefx/System/Globalization/KoreanCalendar.cs267
-rw-r--r--src/mscorlib/corefx/System/Globalization/KoreanLunisolarCalendar.cs1329
-rw-r--r--src/mscorlib/corefx/System/Globalization/LocaleData.Unix.cs4572
-rw-r--r--src/mscorlib/corefx/System/Globalization/NumberFormatInfo.cs900
-rw-r--r--src/mscorlib/corefx/System/Globalization/PersianCalendar.cs611
-rw-r--r--src/mscorlib/corefx/System/Globalization/RegionInfo.cs421
-rw-r--r--src/mscorlib/corefx/System/Globalization/SortKey.cs208
-rw-r--r--src/mscorlib/corefx/System/Globalization/SortVersion.cs101
-rw-r--r--src/mscorlib/corefx/System/Globalization/StringInfo.cs374
-rw-r--r--src/mscorlib/corefx/System/Globalization/TaiwanCalendar.cs285
-rw-r--r--src/mscorlib/corefx/System/Globalization/TaiwanLunisolarCalendar.cs330
-rw-r--r--src/mscorlib/corefx/System/Globalization/TextElementEnumerator.cs153
-rw-r--r--src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs126
-rw-r--r--src/mscorlib/corefx/System/Globalization/TextInfo.Windows.cs121
-rw-r--r--src/mscorlib/corefx/System/Globalization/TextInfo.cs746
-rw-r--r--src/mscorlib/corefx/System/Globalization/ThaiBuddhistCalendar.cs236
-rw-r--r--src/mscorlib/corefx/System/Globalization/TimeSpanStyles.cs13
-rw-r--r--src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs870
-rw-r--r--src/mscorlib/corefx/System/Globalization/UnicodeCategory.cs70
-rw-r--r--src/mscorlib/corefx/System/HResults.cs236
-rw-r--r--src/mscorlib/corefx/System/IO/Error.cs44
-rw-r--r--src/mscorlib/corefx/System/IO/FileStream.Unix.cs934
-rw-r--r--src/mscorlib/corefx/System/IO/FileStream.Win32.cs1770
-rw-r--r--src/mscorlib/corefx/System/IO/FileStream.cs684
-rw-r--r--src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs221
-rw-r--r--src/mscorlib/corefx/System/IO/Path.Unix.cs216
-rw-r--r--src/mscorlib/corefx/System/IO/Path.Win32.cs36
-rw-r--r--src/mscorlib/corefx/System/IO/Path.Windows.cs155
-rw-r--r--src/mscorlib/corefx/System/IO/Path.cs575
-rw-r--r--src/mscorlib/corefx/System/IO/PathHelper.Windows.cs398
-rw-r--r--src/mscorlib/corefx/System/IO/PathInternal.Unix.cs104
-rw-r--r--src/mscorlib/corefx/System/IO/PathInternal.Windows.StringBuffer.cs93
-rw-r--r--src/mscorlib/corefx/System/IO/PathInternal.Windows.cs442
-rw-r--r--src/mscorlib/corefx/System/IO/PathInternal.cs172
-rw-r--r--src/mscorlib/corefx/System/IO/Win32Marshal.cs109
-rw-r--r--src/mscorlib/corefx/System/Runtime/InteropServices/StringBuffer.cs301
-rw-r--r--src/mscorlib/corefx/System/Security/CryptographicException.cs44
-rw-r--r--src/mscorlib/corefx/System/Security/SafeBSTRHandle.cs81
-rw-r--r--src/mscorlib/corefx/System/Security/SecureString.Unix.cs295
-rw-r--r--src/mscorlib/corefx/System/Security/SecureString.Windows.cs310
-rw-r--r--src/mscorlib/corefx/System/Security/SecureString.cs189
-rw-r--r--src/mscorlib/corefx/System/Threading/ClrThreadPoolBoundHandle.cs319
-rw-r--r--src/mscorlib/corefx/System/Threading/ClrThreadPoolBoundHandleOverlapped.cs52
-rw-r--r--src/mscorlib/corefx/System/Threading/ClrThreadPoolPreAllocatedOverlapped.cs105
-rw-r--r--src/mscorlib/corefx/System/Threading/DeferredDisposableLifetime.cs116
166 files changed, 0 insertions, 45798 deletions
diff --git a/src/mscorlib/corefx/Debug.cs b/src/mscorlib/corefx/Debug.cs
deleted file mode 100644
index 3398c0e31e..0000000000
--- a/src/mscorlib/corefx/Debug.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-
-namespace System
-{
- internal static class Debug
- {
- [Conditional("_DEBUG")]
- static public void Assert(bool condition)
- {
- BCLDebug.Assert(condition);
- }
-
- [Conditional("_DEBUG")]
- static public void Assert(bool condition, string message)
- {
- BCLDebug.Assert(condition, message);
- }
-
- [Conditional("_DEBUG")]
- static public void Fail(string message)
- {
- BCLDebug.Assert(false, message);
- }
- }
-} \ No newline at end of file
diff --git a/src/mscorlib/corefx/Interop/Unix/Interop.Errors.cs b/src/mscorlib/corefx/Interop/Unix/Interop.Errors.cs
deleted file mode 100644
index 4248434db3..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/Interop.Errors.cs
+++ /dev/null
@@ -1,207 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- /// <summary>Common Unix errno error codes.</summary>
- internal enum Error
- {
- // These values were defined in src/Native/System.Native/fxerrno.h
- //
- // They compare against values obtained via Interop.Sys.GetLastError() not Marshal.GetLastWin32Error()
- // which obtains the raw errno that varies between unixes. The strong typing as an enum is meant to
- // prevent confusing the two. Casting to or from int is suspect. Use GetLastErrorInfo() if you need to
- // correlate these to the underlying platform values or obtain the corresponding error message.
- //
-
- SUCCESS = 0,
-
- E2BIG = 0x10001, // Argument list too long.
- EACCES = 0x10002, // Permission denied.
- EADDRINUSE = 0x10003, // Address in use.
- EADDRNOTAVAIL = 0x10004, // Address not available.
- EAFNOSUPPORT = 0x10005, // Address family not supported.
- EAGAIN = 0x10006, // Resource unavailable, try again (same value as EWOULDBLOCK),
- EALREADY = 0x10007, // Connection already in progress.
- EBADF = 0x10008, // Bad file descriptor.
- EBADMSG = 0x10009, // Bad message.
- EBUSY = 0x1000A, // Device or resource busy.
- ECANCELED = 0x1000B, // Operation canceled.
- ECHILD = 0x1000C, // No child processes.
- ECONNABORTED = 0x1000D, // Connection aborted.
- ECONNREFUSED = 0x1000E, // Connection refused.
- ECONNRESET = 0x1000F, // Connection reset.
- EDEADLK = 0x10010, // Resource deadlock would occur.
- EDESTADDRREQ = 0x10011, // Destination address required.
- EDOM = 0x10012, // Mathematics argument out of domain of function.
- EDQUOT = 0x10013, // Reserved.
- EEXIST = 0x10014, // File exists.
- EFAULT = 0x10015, // Bad address.
- EFBIG = 0x10016, // File too large.
- EHOSTUNREACH = 0x10017, // Host is unreachable.
- EIDRM = 0x10018, // Identifier removed.
- EILSEQ = 0x10019, // Illegal byte sequence.
- EINPROGRESS = 0x1001A, // Operation in progress.
- EINTR = 0x1001B, // Interrupted function.
- EINVAL = 0x1001C, // Invalid argument.
- EIO = 0x1001D, // I/O error.
- EISCONN = 0x1001E, // Socket is connected.
- EISDIR = 0x1001F, // Is a directory.
- ELOOP = 0x10020, // Too many levels of symbolic links.
- EMFILE = 0x10021, // File descriptor value too large.
- EMLINK = 0x10022, // Too many links.
- EMSGSIZE = 0x10023, // Message too large.
- EMULTIHOP = 0x10024, // Reserved.
- ENAMETOOLONG = 0x10025, // Filename too long.
- ENETDOWN = 0x10026, // Network is down.
- ENETRESET = 0x10027, // Connection aborted by network.
- ENETUNREACH = 0x10028, // Network unreachable.
- ENFILE = 0x10029, // Too many files open in system.
- ENOBUFS = 0x1002A, // No buffer space available.
- ENODEV = 0x1002C, // No such device.
- ENOENT = 0x1002D, // No such file or directory.
- ENOEXEC = 0x1002E, // Executable file format error.
- ENOLCK = 0x1002F, // No locks available.
- ENOLINK = 0x10030, // Reserved.
- ENOMEM = 0x10031, // Not enough space.
- ENOMSG = 0x10032, // No message of the desired type.
- ENOPROTOOPT = 0x10033, // Protocol not available.
- ENOSPC = 0x10034, // No space left on device.
- ENOSYS = 0x10037, // Function not supported.
- ENOTCONN = 0x10038, // The socket is not connected.
- ENOTDIR = 0x10039, // Not a directory or a symbolic link to a directory.
- ENOTEMPTY = 0x1003A, // Directory not empty.
- ENOTSOCK = 0x1003C, // Not a socket.
- ENOTSUP = 0x1003D, // Not supported (same value as EOPNOTSUP).
- ENOTTY = 0x1003E, // Inappropriate I/O control operation.
- ENXIO = 0x1003F, // No such device or address.
- EOVERFLOW = 0x10040, // Value too large to be stored in data type.
- EPERM = 0x10042, // Operation not permitted.
- EPIPE = 0x10043, // Broken pipe.
- EPROTO = 0x10044, // Protocol error.
- EPROTONOSUPPORT = 0x10045, // Protocol not supported.
- EPROTOTYPE = 0x10046, // Protocol wrong type for socket.
- ERANGE = 0x10047, // Result too large.
- EROFS = 0x10048, // Read-only file system.
- ESPIPE = 0x10049, // Invalid seek.
- ESRCH = 0x1004A, // No such process.
- ESTALE = 0x1004B, // Reserved.
- ETIMEDOUT = 0x1004D, // Connection timed out.
- ETXTBSY = 0x1004E, // Text file busy.
- EXDEV = 0x1004F, // Cross-device link.
- ESOCKTNOSUPPORT = 0x1005E, // Socket type not supported.
- EPFNOSUPPORT = 0x10060, // Protocol family not supported.
- ESHUTDOWN = 0x1006C, // Socket shutdown.
- EHOSTDOWN = 0x10070, // Host is down.
- ENODATA = 0x10071, // No data available.
-
- // POSIX permits these to have the same value and we make them always equal so
- // that CoreFX cannot introduce a dependency on distinguishing between them that
- // would not work on all platforms.
- EOPNOTSUPP = ENOTSUP, // Operation not supported on socket.
- EWOULDBLOCK = EAGAIN, // Operation would block.
- }
-
-
- // Represents a platform-agnostic Error and underlying platform-specific errno
- internal struct ErrorInfo
- {
- private Error _error;
- private int _rawErrno;
-
- internal ErrorInfo(int errno)
- {
- _error = Interop.Sys.ConvertErrorPlatformToPal(errno);
- _rawErrno = errno;
- }
-
- internal ErrorInfo(Error error)
- {
- _error = error;
- _rawErrno = -1;
- }
-
- internal Error Error
- {
- get { return _error; }
- }
-
- internal int RawErrno
- {
- get { return _rawErrno == -1 ? (_rawErrno = Interop.Sys.ConvertErrorPalToPlatform(_error)) : _rawErrno; }
- }
-
- internal string GetErrorMessage()
- {
- return Interop.Sys.StrError(RawErrno);
- }
-
- public override string ToString()
- {
- return string.Format(
- "RawErrno: {0} Error: {1} GetErrorMessage: {2}", // No localization required; text is member names used for debugging purposes
- RawErrno, Error, GetErrorMessage());
- }
- }
-
- internal partial class Sys
- {
- internal static Error GetLastError()
- {
- return ConvertErrorPlatformToPal(Marshal.GetLastWin32Error());
- }
-
- internal static ErrorInfo GetLastErrorInfo()
- {
- return new ErrorInfo(Marshal.GetLastWin32Error());
- }
-
- internal static unsafe string StrError(int platformErrno)
- {
- int maxBufferLength = 1024; // should be long enough for most any UNIX error
- byte* buffer = stackalloc byte[maxBufferLength];
- byte* message = StrErrorR(platformErrno, buffer, maxBufferLength);
-
- if (message == null)
- {
- // This means the buffer was not large enough, but still contains
- // as much of the error message as possible and is guaranteed to
- // be null-terminated. We're not currently resizing/retrying because
- // maxBufferLength is large enough in practice, but we could do
- // so here in the future if necessary.
- message = buffer;
- }
-
- return Marshal.PtrToStringAnsi((IntPtr)message);
- }
-
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ConvertErrorPlatformToPal")]
- internal static extern Error ConvertErrorPlatformToPal(int platformErrno);
-
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ConvertErrorPalToPlatform")]
- internal static extern int ConvertErrorPalToPlatform(Error error);
-
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_StrErrorR")]
- private static unsafe extern byte* StrErrorR(int platformErrno, byte* buffer, int bufferSize);
- }
-}
-
-// NOTE: extension method can't be nested inside Interop class.
-internal static class InteropErrorExtensions
-{
- // Intended usage is e.g. Interop.Error.EFAIL.Info() for brevity
- // vs. new Interop.ErrorInfo(Interop.Error.EFAIL) for synthesizing
- // errors. Errors originated from the system should be obtained
- // via GetLastErrorInfo(), not GetLastError().Info() as that will
- // convert twice, which is not only inefficient but also lossy if
- // we ever encounter a raw errno that no equivalent in the Error
- // enum.
- public static Interop.ErrorInfo Info(this Interop.Error error)
- {
- return new Interop.ErrorInfo(error);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/Interop.IOErrors.cs b/src/mscorlib/corefx/Interop/Unix/Interop.IOErrors.cs
deleted file mode 100644
index e9d6ce61d6..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/Interop.IOErrors.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Runtime.InteropServices;
-using Microsoft.Win32.SafeHandles;
-
-internal static partial class Interop
-{
- private static void ThrowExceptionForIoErrno(ErrorInfo errorInfo, string path, bool isDirectory, Func<ErrorInfo, ErrorInfo> errorRewriter)
- {
- Debug.Assert(errorInfo.Error != Error.SUCCESS);
- Debug.Assert(errorInfo.Error != Error.EINTR, "EINTR errors should be handled by the native shim and never bubble up to managed code");
-
- if (errorRewriter != null)
- {
- errorInfo = errorRewriter(errorInfo);
- }
-
- throw Interop.GetExceptionForIoErrno(errorInfo, path, isDirectory);
- }
-
- internal static void CheckIo(Error error, string path = null, bool isDirectory = false, Func<ErrorInfo, ErrorInfo> errorRewriter = null)
- {
- if (error != Interop.Error.SUCCESS)
- {
- ThrowExceptionForIoErrno(error.Info(), path, isDirectory, errorRewriter);
- }
- }
-
- /// <summary>
- /// Validates the result of system call that returns greater than or equal to 0 on success
- /// and less than 0 on failure, with errno set to the error code.
- /// If the system call failed for any reason, an exception is thrown. Otherwise, the system call succeeded.
- /// </summary>
- /// <param name="result">The result of the system call.</param>
- /// <param name="path">The path with which this error is associated. This may be null.</param>
- /// <param name="isDirectory">true if the <paramref name="path"/> is known to be a directory; otherwise, false.</param>
- /// <param name="errorRewriter">Optional function to change an error code prior to processing it.</param>
- /// <returns>
- /// On success, returns the non-negative result long that was validated.
- /// </returns>
- internal static long CheckIo(long result, string path = null, bool isDirectory = false, Func<ErrorInfo, ErrorInfo> errorRewriter = null)
- {
- if (result < 0)
- {
- ThrowExceptionForIoErrno(Sys.GetLastErrorInfo(), path, isDirectory, errorRewriter);
- }
-
- return result;
- }
-
- /// <summary>
- /// Validates the result of system call that returns greater than or equal to 0 on success
- /// and less than 0 on failure, with errno set to the error code.
- /// If the system call failed for any reason, an exception is thrown. Otherwise, the system call succeeded.
- /// </summary>
- /// <returns>
- /// On success, returns the non-negative result int that was validated.
- /// </returns>
- internal static int CheckIo(int result, string path = null, bool isDirectory = false, Func<ErrorInfo, ErrorInfo> errorRewriter = null)
- {
- CheckIo((long)result, path, isDirectory, errorRewriter);
-
- return result;
- }
-
- /// <summary>
- /// Validates the result of system call that returns greater than or equal to 0 on success
- /// and less than 0 on failure, with errno set to the error code.
- /// If the system call failed for any reason, an exception is thrown. Otherwise, the system call succeeded.
- /// </summary>
- /// <returns>
- /// On success, returns the non-negative result IntPtr that was validated.
- /// </returns>
- internal static IntPtr CheckIo(IntPtr result, string path = null, bool isDirectory = false, Func<ErrorInfo, ErrorInfo> errorRewriter = null)
- {
- CheckIo((long)result, path, isDirectory, errorRewriter);
-
- return result;
- }
-
- /// <summary>
- /// Validates the result of system call that returns greater than or equal to 0 on success
- /// and less than 0 on failure, with errno set to the error code.
- /// If the system call failed for any reason, an exception is thrown. Otherwise, the system call succeeded.
- /// </summary>
- /// <returns>
- /// On success, returns the valid SafeFileHandle that was validated.
- /// </returns>
- internal static TSafeHandle CheckIo<TSafeHandle>(TSafeHandle handle, string path = null, bool isDirectory = false, Func<ErrorInfo, ErrorInfo> errorRewriter = null)
- where TSafeHandle : SafeHandle
- {
- if (handle.IsInvalid)
- {
- ThrowExceptionForIoErrno(Sys.GetLastErrorInfo(), path, isDirectory, errorRewriter);
- }
-
- return handle;
- }
-
- /// <summary>
- /// Gets an Exception to represent the supplied error info.
- /// </summary>
- /// <param name="error">The error info</param>
- /// <param name="path">The path with which this error is associated. This may be null.</param>
- /// <param name="isDirectory">true if the <paramref name="path"/> is known to be a directory; otherwise, false.</param>
- /// <returns></returns>
- internal static Exception GetExceptionForIoErrno(ErrorInfo errorInfo, string path = null, bool isDirectory = false)
- {
- // Translate the errno into a known set of exception types. For cases where multiple errnos map
- // to the same exception type, include an inner exception with the details.
- switch (errorInfo.Error)
- {
- case Error.ENOENT:
- if (isDirectory)
- {
- return !string.IsNullOrEmpty(path) ?
- new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, path)) :
- new DirectoryNotFoundException(SR.IO_PathNotFound_NoPathName);
- }
- else
- {
- return !string.IsNullOrEmpty(path) ?
- new FileNotFoundException(SR.Format(SR.IO_FileNotFound_FileName, path), path) :
- new FileNotFoundException(SR.IO_FileNotFound);
- }
-
- case Error.EACCES:
- case Error.EBADF:
- case Error.EPERM:
- Exception inner = GetIOException(errorInfo);
- return !string.IsNullOrEmpty(path) ?
- new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_IODenied_Path, path), inner) :
- new UnauthorizedAccessException(SR.UnauthorizedAccess_IODenied_NoPathName, inner);
-
- case Error.ENAMETOOLONG:
- return new PathTooLongException(SR.IO_PathTooLong);
-
- case Error.EWOULDBLOCK:
- return !string.IsNullOrEmpty(path) ?
- new IOException(SR.Format(SR.IO_SharingViolation_File, path), errorInfo.RawErrno) :
- new IOException(SR.IO_SharingViolation_NoFileName, errorInfo.RawErrno);
-
- case Error.ECANCELED:
- return new OperationCanceledException();
-
- case Error.EFBIG:
- return new ArgumentOutOfRangeException("value", SR.ArgumentOutOfRange_FileLengthTooBig);
-
- case Error.EEXIST:
- if (!string.IsNullOrEmpty(path))
- {
- return new IOException(SR.Format(SR.IO_FileExists_Name, path), errorInfo.RawErrno);
- }
- goto default;
-
- default:
- return GetIOException(errorInfo);
- }
- }
-
- internal static Exception GetIOException(Interop.ErrorInfo errorInfo)
- {
- return new IOException(errorInfo.GetErrorMessage(), errorInfo.RawErrno);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/Interop.Libraries.cs b/src/mscorlib/corefx/Interop/Unix/Interop.Libraries.cs
deleted file mode 100644
index 1b6d26e40f..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/Interop.Libraries.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-internal static partial class Interop
-{
- private static partial class Libraries
- {
- internal const string GlobalizationInterop = "System.Globalization.Native"; // CoreFX wrappers for ICU
- internal const string SystemNative = "System.Native";
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs b/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs
deleted file mode 100644
index 7b3caeabdd..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Globalization;
-using System.Runtime.InteropServices;
-using System.Text;
-
-internal static partial class Interop
-{
- internal static partial class GlobalizationInterop
- {
- internal delegate void EnumCalendarInfoCallback(
- [MarshalAs(UnmanagedType.LPWStr)] string calendarString,
- IntPtr context);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetCalendars")]
- internal static extern int GetCalendars(string localeName, CalendarId[] calendars, int calendarsCapacity);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetCalendarInfo")]
- internal static extern ResultCode GetCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType calendarDataType, [Out] StringBuilder result, int resultCapacity);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EnumCalendarInfo")]
- internal static extern bool EnumCalendarInfo(EnumCalendarInfoCallback callback, string localeName, CalendarId calendarId, CalendarDataType calendarDataType, IntPtr context);
-
- [DllImport(Libraries.GlobalizationInterop, EntryPoint = "GlobalizationNative_GetLatestJapaneseEra")]
- internal static extern int GetLatestJapaneseEra();
-
- [DllImport(Libraries.GlobalizationInterop, EntryPoint = "GlobalizationNative_GetJapaneseEraStartDate")]
- internal static extern bool GetJapaneseEraStartDate(int era, out int startYear, out int startMonth, out int startDay);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Casing.cs b/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Casing.cs
deleted file mode 100644
index 769506b8f6..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Casing.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-using System.Security;
-using System.Text;
-
-internal static partial class Interop
-{
- internal static partial class GlobalizationInterop
- {
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCase")]
- internal unsafe static extern void ChangeCase(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCaseInvariant")]
- internal unsafe static extern void ChangeCaseInvariant(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCaseTurkish")]
- internal unsafe static extern void ChangeCaseTurkish(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Collation.cs b/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Collation.cs
deleted file mode 100644
index 25585c6dfb..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Collation.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Globalization;
-using System.Runtime.InteropServices;
-using System.Security;
-
-internal static partial class Interop
-{
- internal static partial class GlobalizationInterop
- {
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetSortHandle")]
- internal unsafe static extern ResultCode GetSortHandle(byte[] localeName, out SafeSortHandle sortHandle);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CloseSortHandle")]
- internal unsafe static extern void CloseSortHandle(IntPtr handle);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CompareString")]
- internal unsafe static extern int CompareString(SafeSortHandle sortHandle, char* lpStr1, int cwStr1Len, char* lpStr2, int cwStr2Len, CompareOptions options);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IndexOf")]
- internal unsafe static extern int IndexOf(SafeSortHandle sortHandle, string target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_LastIndexOf")]
- internal unsafe static extern int LastIndexOf(SafeSortHandle sortHandle, string target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IndexOfOrdinalIgnoreCase")]
- internal unsafe static extern int IndexOfOrdinalIgnoreCase(string target, int cwTargetLength, char* pSource, int cwSourceLength, bool findLast);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_StartsWith")]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal unsafe static extern bool StartsWith(SafeSortHandle sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EndsWith")]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal unsafe static extern bool EndsWith(SafeSortHandle sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetSortKey")]
- internal unsafe static extern int GetSortKey(SafeSortHandle sortHandle, string str, int strLength, byte* sortKey, int sortKeyLength, CompareOptions options);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CompareStringOrdinalIgnoreCase")]
- internal unsafe static extern int CompareStringOrdinalIgnoreCase(char* lpStr1, int cwStr1Len, char* lpStr2, int cwStr2Len);
-
- [DllImport(Libraries.GlobalizationInterop, EntryPoint = "GlobalizationNative_GetSortVersion")]
- internal static extern int GetSortVersion();
-
- internal class SafeSortHandle : SafeHandle
- {
- private SafeSortHandle() :
- base(IntPtr.Zero, true)
- {
- }
-
- public override bool IsInvalid
- {
- get { return handle == IntPtr.Zero; }
- }
-
- protected override bool ReleaseHandle()
- {
- CloseSortHandle(handle);
- SetHandle(IntPtr.Zero);
- return true;
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Idna.cs b/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Idna.cs
deleted file mode 100644
index 43c72281ae..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Idna.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- internal static partial class GlobalizationInterop
- {
- internal const int AllowUnassigned = 0x1;
- internal const int UseStd3AsciiRules = 0x2;
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ToAscii")]
- internal static unsafe extern int ToAscii(uint flags, char* src, int srcLen, char* dstBuffer, int dstBufferCapacity);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ToUnicode")]
- internal static unsafe extern int ToUnicode(uint flags, char* src, int srcLen, char* dstBuffer, int dstBufferCapacity);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Locale.cs b/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Locale.cs
deleted file mode 100644
index fcea708ee8..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Locale.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-
-internal static partial class Interop
-{
- internal static partial class GlobalizationInterop
- {
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleName")]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal unsafe static extern bool GetLocaleName(string localeName, [Out] StringBuilder value, int valueLength);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleInfoString")]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal unsafe static extern bool GetLocaleInfoString(string localeName, uint localeStringData, [Out] StringBuilder value, int valueLength);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetDefaultLocaleName")]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal unsafe static extern bool GetDefaultLocaleName([Out] StringBuilder value, int valueLength);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleTimeFormat")]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal unsafe static extern bool GetLocaleTimeFormat(string localeName, bool shortFormat, [Out] StringBuilder value, int valueLength);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleInfoInt")]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal unsafe static extern bool GetLocaleInfoInt(string localeName, uint localeNumberData, ref int value);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleInfoGroupingSizes")]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal unsafe static extern bool GetLocaleInfoGroupingSizes(string localeName, uint localeGroupingData, ref int primaryGroupSize, ref int secondaryGroupSize);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocales")]
- internal unsafe static extern int GetLocales([Out] Char[] value, int valueLength);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs b/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs
deleted file mode 100644
index c4cb9fb851..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-
-internal static partial class Interop
-{
- internal static partial class GlobalizationInterop
- {
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IsNormalized")]
- internal static extern int IsNormalized(NormalizationForm normalizationForm, string src, int srcLen);
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_NormalizeString")]
- internal static extern int NormalizeString(NormalizationForm normalizationForm, string src, int srcLen, [Out] char[] dstBuffer, int dstBufferCapacity);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs b/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs
deleted file mode 100644
index cca6ae4dcb..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-internal static partial class Interop
-{
- internal static partial class GlobalizationInterop
- {
- // needs to be kept in sync with ResultCode in System.Globalization.Native
- internal enum ResultCode
- {
- Success = 0,
- UnknownError = 1,
- InsufficentBuffer = 2,
- OutOfMemory = 3
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs b/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs
deleted file mode 100644
index 26a9fe0579..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.InteropServices;
-using System.Text;
-
-internal static partial class Interop
-{
- internal static partial class GlobalizationInterop
- {
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Ansi, EntryPoint = "GlobalizationNative_ReadLink")] // readlink requires char*
- internal static extern bool ReadLink(string filePath, [Out] StringBuilder result, uint resultCapacity);
-
- // needs to be kept in sync with TimeZoneDisplayNameType in System.Globalization.Native
- internal enum TimeZoneDisplayNameType
- {
- Generic = 0,
- Standard = 1,
- DaylightSavings = 2,
- }
-
- [DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetTimeZoneDisplayName")]
- internal static extern ResultCode GetTimeZoneDisplayName(
- string localeName,
- string timeZoneId,
- TimeZoneDisplayNameType type,
- [Out] StringBuilder result,
- int resultLength);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Utils.cs b/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Utils.cs
deleted file mode 100644
index 33b10c0d74..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Globalization.Native/Interop.Utils.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Text;
-
-internal static partial class Interop
-{
- /// <summary>
- /// Helper for making interop calls that return a string, but we don't know
- /// the correct size of buffer to make. So invoke the interop call with an
- /// increasing buffer until the size is big enough.
- /// </summary>
- internal static bool CallStringMethod<TArg1, TArg2, TArg3>(
- Func<TArg1, TArg2, TArg3, StringBuilder, GlobalizationInterop.ResultCode> interopCall,
- TArg1 arg1,
- TArg2 arg2,
- TArg3 arg3,
- out string result)
- {
- const int initialStringSize = 80;
- const int maxDoubleAttempts = 5;
-
- StringBuilder stringBuilder = StringBuilderCache.Acquire(initialStringSize);
-
- for (int i = 0; i < maxDoubleAttempts; i++)
- {
- GlobalizationInterop.ResultCode resultCode = interopCall(arg1, arg2, arg3, stringBuilder);
-
- if (resultCode == GlobalizationInterop.ResultCode.Success)
- {
- result = StringBuilderCache.GetStringAndRelease(stringBuilder);
- return true;
- }
- else if (resultCode == GlobalizationInterop.ResultCode.InsufficentBuffer)
- {
- // increase the string size and loop
- stringBuilder.EnsureCapacity(stringBuilder.Capacity * 2);
- }
- else
- {
- // if there is an unknown error, don't proceed
- break;
- }
- }
-
- StringBuilderCache.Release(stringBuilder);
- result = null;
- return false;
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Close.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Close.cs
deleted file mode 100644
index 8d192398a0..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Close.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Close", SetLastError = true)]
- internal static extern int Close(IntPtr fd);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.FLock.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.FLock.cs
deleted file mode 100644
index 22934a3e77..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.FLock.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-using Microsoft.Win32.SafeHandles;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- internal enum LockOperations : int
- {
- LOCK_SH = 1, /* shared lock */
- LOCK_EX = 2, /* exclusive lock */
- LOCK_NB = 4, /* don't block when locking*/
- LOCK_UN = 8, /* unlock */
- }
-
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FLock", SetLastError = true)]
- internal static extern int FLock(SafeFileHandle fd, LockOperations operation);
-
- /// <summary>
- /// Exposing this for SafeFileHandle.ReleaseHandle() to call.
- /// Normal callers should use FLock(SafeFileHandle fd).
- /// </summary>
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FLock", SetLastError = true)]
- internal static extern int FLock(IntPtr fd, LockOperations operation);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.FSync.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.FSync.cs
deleted file mode 100644
index e3ab970931..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.FSync.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.InteropServices;
-using Microsoft.Win32.SafeHandles;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FSync", SetLastError = true)]
- internal static extern int FSync(SafeFileHandle fd);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.FTruncate.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.FTruncate.cs
deleted file mode 100644
index 5dad650362..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.FTruncate.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.InteropServices;
-using Microsoft.Win32.SafeHandles;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FTruncate", SetLastError = true)]
- internal static extern int FTruncate(SafeFileHandle fd, long length);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Fcntl.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Fcntl.cs
deleted file mode 100644
index 23b48a4f5d..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Fcntl.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- internal enum LockType : short
- {
- F_WRLCK = 1, // exclusive or write lock
- F_UNLCK = 2 // unlock
- }
-
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LockFileRegion", SetLastError=true)]
- internal static extern int LockFileRegion(SafeHandle fd, long offset, long length, LockType lockType);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.GetCwd.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.GetCwd.cs
deleted file mode 100644
index 724e342342..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.GetCwd.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetCwd", SetLastError = true)]
- private static unsafe extern byte* GetCwd(byte* buffer, int bufferLength);
-
- internal static unsafe string GetCwd()
- {
- const int StackLimit = 256;
-
- // First try to get the path into a buffer on the stack
- byte* stackBuf = stackalloc byte[StackLimit];
- string result = GetCwdHelper(stackBuf, StackLimit);
- if (result != null)
- {
- return result;
- }
-
- // If that was too small, try increasing large buffer sizes
- // until we get one that works or until we hit MaxPath.
- int maxPath = Interop.Sys.MaxPath;
- if (StackLimit < maxPath)
- {
- int bufferSize = StackLimit;
- do
- {
- checked { bufferSize *= 2; }
- var buf = new byte[Math.Min(bufferSize, maxPath)];
- fixed (byte* ptr = buf)
- {
- result = GetCwdHelper(ptr, buf.Length);
- if (result != null)
- {
- return result;
- }
- }
- }
- while (bufferSize < maxPath);
- }
-
- // If we couldn't get the cwd with a MaxPath-sized buffer, something's wrong.
- throw Interop.GetExceptionForIoErrno(new ErrorInfo(Interop.Error.ENAMETOOLONG));
- }
-
- private static unsafe string GetCwdHelper(byte* ptr, int bufferSize)
- {
- // Call the real getcwd
- byte* result = GetCwd(ptr, bufferSize);
-
- // If it returned non-null, the null-terminated path is in the buffer
- if (result != null)
- {
- return Marshal.PtrToStringAnsi((IntPtr)ptr);
- }
-
- // Otherwise, if it failed due to the buffer being too small, return null;
- // for anything else, throw.
- ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
- if (errorInfo.Error == Interop.Error.ERANGE)
- {
- return null;
- }
- throw Interop.GetExceptionForIoErrno(errorInfo);
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.GetUnixName.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.GetUnixName.cs
deleted file mode 100644
index 33664c4d39..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.GetUnixName.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetUnixName")]
- private static extern IntPtr GetUnixNamePrivate();
-
- internal static string GetUnixName()
- {
- IntPtr ptr = GetUnixNamePrivate();
- return Marshal.PtrToStringAnsi(ptr);
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.LSeek.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.LSeek.cs
deleted file mode 100644
index 7f8df7c6bf..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.LSeek.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.InteropServices;
-using Microsoft.Win32.SafeHandles;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- internal enum SeekWhence
- {
- SEEK_SET = 0,
- SEEK_CUR = 1,
- SEEK_END = 2
- }
-
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LSeek", SetLastError = true)]
- internal static extern long LSeek(SafeFileHandle fd, long offset, SeekWhence whence);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.MksTemps.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.MksTemps.cs
deleted file mode 100644
index b8694d9007..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.MksTemps.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_MksTemps", SetLastError = true)]
- internal static extern IntPtr MksTemps(
- byte[] template,
- int suffixlen);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Open.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Open.cs
deleted file mode 100644
index a9a994c78c..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Open.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.InteropServices;
-using Microsoft.Win32.SafeHandles;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Open", SetLastError = true)]
- internal static extern SafeFileHandle Open(string filename, OpenFlags flags, int mode);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.OpenFlags.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.OpenFlags.cs
deleted file mode 100644
index f9e54c3cbc..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.OpenFlags.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- [Flags]
- internal enum OpenFlags
- {
- // Access modes (mutually exclusive)
- O_RDONLY = 0x0000,
- O_WRONLY = 0x0001,
- O_RDWR = 0x0002,
-
- // Flags (combinable)
- O_CLOEXEC = 0x0010,
- O_CREAT = 0x0020,
- O_EXCL = 0x0040,
- O_TRUNC = 0x0080,
- O_SYNC = 0x0100,
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.PathConf.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.PathConf.cs
deleted file mode 100644
index 4a1fcf67d0..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.PathConf.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- internal static int DEFAULT_PC_NAME_MAX = 255;
-
- internal enum PathConfName : int
- {
- PC_LINK_MAX = 1,
- PC_MAX_CANON = 2,
- PC_MAX_INPUT = 3,
- PC_NAME_MAX = 4,
- PC_PATH_MAX = 5,
- PC_PIPE_BUF = 6,
- PC_CHOWN_RESTRICTED = 7,
- PC_NO_TRUNC = 8,
- PC_VDISABLE = 9,
- }
-
- /// <summary>The maximum path length for the system. -1 if it hasn't yet been initialized.</summary>
- private static int s_maxPath = -1;
-
- /// <summary>The maximum name length for the system. -1 if it hasn't yet been initialized.</summary>
- private static int s_maxName = -1;
-
- internal static int MaxPath
- {
- get
- {
- // Benign race condition on cached value
- if (s_maxPath < 0)
- {
- // GetMaximumPath returns a long from PathConf
- // but our callers expect an int so we need to convert.
- long temp = GetMaximumPath();
- if (temp > int.MaxValue)
- s_maxPath = int.MaxValue;
- else
- s_maxPath = Convert.ToInt32(temp);
- }
- return s_maxPath;
- }
- }
-
- internal static int MaxName
- {
- get
- {
- // Benign race condition on cached value
- if (s_maxName < 0)
- {
- int result = PathConf("/", PathConfName.PC_NAME_MAX);
- s_maxName = result >= 0 ? result : DEFAULT_PC_NAME_MAX;
- }
-
- return s_maxName;
- }
- }
-
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PathConf", SetLastError = true)]
- private static extern int PathConf(string path, PathConfName name);
-
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetMaximumPath")]
- private static extern long GetMaximumPath();
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Permissions.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Permissions.cs
deleted file mode 100644
index f1d13787d2..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Permissions.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- [Flags]
- internal enum Permissions
- {
- Mask = S_IRWXU | S_IRWXG | S_IRWXO,
-
- S_IRWXU = S_IRUSR | S_IWUSR | S_IXUSR,
- S_IRUSR = 0x100,
- S_IWUSR = 0x80,
- S_IXUSR = 0x40,
-
- S_IRWXG = S_IRGRP | S_IWGRP | S_IXGRP,
- S_IRGRP = 0x20,
- S_IWGRP = 0x10,
- S_IXGRP = 0x8,
-
- S_IRWXO = S_IROTH | S_IWOTH | S_IXOTH,
- S_IROTH = 0x4,
- S_IWOTH = 0x2,
- S_IXOTH = 0x1,
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.PosixFAdvise.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.PosixFAdvise.cs
deleted file mode 100644
index 69e39b30d2..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.PosixFAdvise.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.InteropServices;
-using Microsoft.Win32.SafeHandles;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- internal enum FileAdvice : int
- {
- POSIX_FADV_NORMAL = 0, /* no special advice, the default value */
- POSIX_FADV_RANDOM = 1, /* random I/O access */
- POSIX_FADV_SEQUENTIAL = 2, /* sequential I/O access */
- POSIX_FADV_WILLNEED = 3, /* will need specified pages */
- POSIX_FADV_DONTNEED = 4, /* don't need the specified pages */
- POSIX_FADV_NOREUSE = 5, /* data will only be acessed once */
- }
-
- /// <summary>
- /// Notifies the OS kernel that the specified file will be accessed in a particular way soon; this allows the kernel to
- /// potentially optimize the access pattern of the file.
- /// </summary>
- /// <param name="fd">The file descriptor of the file</param>
- /// <param name="offset">The start of the region to advise about</param>
- /// <param name="length">The number of bytes of the region (until the end of the file if 0)</param>
- /// <param name="advice">The type of advice to give the kernel about the specified region</param>
- /// <returns>
- /// Returns 0 on success; otherwise, the error code is returned
- /// </returns>
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PosixFAdvise", SetLastError = false /* this is explicitly called out in the man page */)]
- internal static extern int PosixFAdvise(SafeFileHandle fd, long offset, long length, FileAdvice advice);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Read.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Read.cs
deleted file mode 100644
index 812ae348dc..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Read.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.InteropServices;
-using Microsoft.Win32.SafeHandles;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- /// <summary>
- /// Reads a number of bytes from an open file descriptor into a specified buffer.
- /// </summary>
- /// <param name="fd">The open file descriptor to try to read from</param>
- /// <param name="buffer">The buffer to read info into</param>
- /// <param name="count">The size of the buffer</param>
- /// <returns>
- /// Returns the number of bytes read on success; otherwise, -1 is returned
- /// Note - on fail. the position of the stream may change depending on the platform; consult man 2 read for more info
- /// </returns>
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Read", SetLastError = true)]
- internal static unsafe extern int Read(SafeFileHandle fd, byte* buffer, int count);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Stat.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Stat.cs
deleted file mode 100644
index a8bc2ec7d1..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Stat.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-using Microsoft.Win32.SafeHandles;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- // Even though csc will by default use a sequential layout, a CS0649 warning as error
- // is produced for un-assigned fields when no StructLayout is specified.
- //
- // Explicitly saying Sequential disables that warning/error for consumers which only
- // use Stat in debug builds.
- [StructLayout(LayoutKind.Sequential)]
- internal struct FileStatus
- {
- internal FileStatusFlags Flags;
- internal int Mode;
- internal uint Uid;
- internal uint Gid;
- internal long Size;
- internal long ATime;
- internal long MTime;
- internal long CTime;
- internal long BirthTime;
- }
-
- internal static class FileTypes
- {
- internal const int S_IFMT = 0xF000;
- internal const int S_IFIFO = 0x1000;
- internal const int S_IFCHR = 0x2000;
- internal const int S_IFDIR = 0x4000;
- internal const int S_IFREG = 0x8000;
- internal const int S_IFLNK = 0xA000;
- internal const int S_IFSOCK = 0xC000;
- }
-
- [Flags]
- internal enum FileStatusFlags
- {
- None = 0,
- HasBirthTime = 1,
- }
-
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FStat", SetLastError = true)]
- internal static extern int FStat(SafeFileHandle fd, out FileStatus output);
-
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Stat", SetLastError = true)]
- internal static extern int Stat(string path, out FileStatus output);
-
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LStat", SetLastError = true)]
- internal static extern int LStat(string path, out FileStatus output);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Unlink.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Unlink.cs
deleted file mode 100644
index 829210fa7e..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Unlink.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Unlink", SetLastError = true)]
- internal static extern int Unlink(string pathname);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Write.cs b/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Write.cs
deleted file mode 100644
index c14fc26263..0000000000
--- a/src/mscorlib/corefx/Interop/Unix/System.Native/Interop.Write.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.InteropServices;
-using Microsoft.Win32.SafeHandles;
-
-internal static partial class Interop
-{
- internal static partial class Sys
- {
- /// <summary>
- /// Writes the specified buffer to the provided open file descriptor
- /// </summary>
- /// <param name="fd">The file descriptor to try and write to</param>
- /// <param name="buffer">The data to attempt to write</param>
- /// <param name="bufferSize">The amount of data to write, in bytes</param>
- /// <returns>
- /// Returns the number of bytes written on success; otherwise, returns -1 and sets errno
- /// </returns>
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)]
- internal static unsafe extern int Write(SafeFileHandle fd, byte* buffer, int bufferSize);
-
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)]
- internal static unsafe extern int Write(int fd, byte* buffer, int bufferSize);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs b/src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs
deleted file mode 100644
index d2ce4131b0..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class BCrypt
- {
- internal static unsafe NTSTATUS BCryptGenRandom(byte* pbBuffer, int count)
- {
- Debug.Assert(pbBuffer != null);
- Debug.Assert(count >= 0);
-
- return BCryptGenRandom(IntPtr.Zero, pbBuffer, count, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
- }
-
- private const int BCRYPT_USE_SYSTEM_PREFERRED_RNG = 0x00000002;
-
- [DllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)]
- private static unsafe extern NTSTATUS BCryptGenRandom(IntPtr hAlgorithm, byte* pbBuffer, int cbBuffer, int dwFlags);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.NTSTATUS.cs b/src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.NTSTATUS.cs
deleted file mode 100644
index 49d674f399..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/BCrypt/Interop.NTSTATUS.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-
-internal partial class Interop
-{
- internal partial class BCrypt
- {
- internal enum NTSTATUS : uint
- {
- STATUS_SUCCESS = 0x0,
- STATUS_NOT_FOUND = 0xc0000225,
- STATUS_INVALID_PARAMETER = 0xc000000d,
- STATUS_NO_MEMORY = 0xc0000017,
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs b/src/mscorlib/corefx/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs
deleted file mode 100644
index b10cb6a041..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-using System.Security;
-
-internal partial class Interop
-{
- internal partial class Crypt32
- {
- internal const uint CRYPTPROTECTMEMORY_BLOCK_SIZE = 16;
- internal const uint CRYPTPROTECTMEMORY_SAME_PROCESS = 0;
-
- [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern bool CryptProtectMemory(SafeBSTRHandle pData, uint cbData, uint dwFlags);
-
- [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern bool CryptUnprotectMemory(SafeBSTRHandle pData, uint cbData, uint dwFlags);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/Interop.BOOL.cs b/src/mscorlib/corefx/Interop/Windows/Interop.BOOL.cs
deleted file mode 100644
index 9f4dab8935..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/Interop.BOOL.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-internal partial class Interop
-{
- /// <summary>
- /// Blittable version of Windows BOOL type. It is convenient in situations where
- /// manual marshalling is required, or to avoid overhead of regular bool marshalling.
- /// </summary>
- /// <remarks>
- /// Some Windows APIs return arbitrary integer values although the return type is defined
- /// as BOOL. It is best to never compare BOOL to TRUE. Always use bResult != BOOL.FALSE
- /// or bResult == BOOL.FALSE .
- /// </remarks>
- internal enum BOOL : int
- {
- FALSE = 0,
- TRUE = 1,
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/Interop.Errors.cs b/src/mscorlib/corefx/Interop/Windows/Interop.Errors.cs
deleted file mode 100644
index 7eeb18de01..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/Interop.Errors.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-internal partial class Interop
-{
- internal partial class Errors
- {
- internal const int ERROR_SUCCESS = 0x0;
- internal const int ERROR_INVALID_FUNCTION = 0x1;
- internal const int ERROR_FILE_NOT_FOUND = 0x2;
- internal const int ERROR_PATH_NOT_FOUND = 0x3;
- internal const int ERROR_ACCESS_DENIED = 0x5;
- internal const int ERROR_INVALID_HANDLE = 0x6;
- internal const int ERROR_NOT_ENOUGH_MEMORY = 0x8;
- internal const int ERROR_INVALID_DATA = 0xD;
- internal const int ERROR_INVALID_DRIVE = 0xF;
- internal const int ERROR_NO_MORE_FILES = 0x12;
- internal const int ERROR_NOT_READY = 0x15;
- internal const int ERROR_BAD_LENGTH = 0x18;
- internal const int ERROR_SHARING_VIOLATION = 0x20;
- internal const int ERROR_LOCK_VIOLATION = 0x21;
- internal const int ERROR_HANDLE_EOF = 0x26;
- internal const int ERROR_FILE_EXISTS = 0x50;
- internal const int ERROR_INVALID_PARAMETER = 0x57;
- internal const int ERROR_BROKEN_PIPE = 0x6D;
- internal const int ERROR_INSUFFICIENT_BUFFER = 0x7A;
- internal const int ERROR_INVALID_NAME = 0x7B;
- internal const int ERROR_NEGATIVE_SEEK = 0x83;
- internal const int ERROR_DIR_NOT_EMPTY = 0x91;
- internal const int ERROR_BAD_PATHNAME = 0xA1;
- internal const int ERROR_LOCK_FAILED = 0xA7;
- internal const int ERROR_BUSY = 0xAA;
- internal const int ERROR_ALREADY_EXISTS = 0xB7;
- internal const int ERROR_BAD_EXE_FORMAT = 0xC1;
- internal const int ERROR_ENVVAR_NOT_FOUND = 0xCB;
- internal const int ERROR_FILENAME_EXCED_RANGE = 0xCE;
- internal const int ERROR_EXE_MACHINE_TYPE_MISMATCH = 0xD8;
- internal const int ERROR_PIPE_BUSY = 0xE7;
- internal const int ERROR_NO_DATA = 0xE8;
- internal const int ERROR_PIPE_NOT_CONNECTED = 0xE9;
- internal const int ERROR_MORE_DATA = 0xEA;
- internal const int ERROR_NO_MORE_ITEMS = 0x103;
- internal const int ERROR_PARTIAL_COPY = 0x12B;
- internal const int ERROR_ARITHMETIC_OVERFLOW = 0x216;
- internal const int ERROR_PIPE_CONNECTED = 0x217;
- internal const int ERROR_PIPE_LISTENING = 0x218;
- internal const int ERROR_OPERATION_ABORTED = 0x3E3;
- internal const int ERROR_IO_PENDING = 0x3E5;
- internal const int ERROR_NO_TOKEN = 0x3f0;
- internal const int ERROR_DLL_INIT_FAILED = 0x45A;
- internal const int ERROR_NOT_FOUND = 0x490;
- internal const int ERROR_NON_ACCOUNT_SID = 0x4E9;
- internal const int ERROR_NOT_ALL_ASSIGNED = 0x514;
- internal const int ERROR_UNKNOWN_REVISION = 0x519;
- internal const int ERROR_INVALID_OWNER = 0x51B;
- internal const int ERROR_INVALID_PRIMARY_GROUP = 0x51C;
- internal const int ERROR_NO_SUCH_PRIVILEGE = 0x521;
- internal const int ERROR_PRIVILEGE_NOT_HELD = 0x522;
- internal const int ERROR_INVALID_ACL = 0x538;
- internal const int ERROR_INVALID_SECURITY_DESCR = 0x53A;
- internal const int ERROR_INVALID_SID = 0x539;
- internal const int ERROR_BAD_IMPERSONATION_LEVEL = 0x542;
- internal const int ERROR_CANT_OPEN_ANONYMOUS = 0x543;
- internal const int ERROR_NO_SECURITY_ON_OBJECT = 0x546;
- internal const int ERROR_TRUSTED_RELATIONSHIP_FAILURE = 0x6FD;
- internal const int ERROR_RESOURCE_LANG_NOT_FOUND = 0x717;
- internal const int EFail = unchecked((int)0x80004005);
- internal const int E_FILENOTFOUND = unchecked((int)0x80070002);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/Interop.Libraries.cs b/src/mscorlib/corefx/Interop/Windows/Interop.Libraries.cs
deleted file mode 100644
index f19f9dcf52..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/Interop.Libraries.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-internal static partial class Interop
-{
- internal static class Libraries
- {
- internal const string BCrypt = "BCrypt.dll";
- internal const string Crypt32 = "crypt32.dll";
- internal const string Kernel32 = "kernel32.dll";
- internal const string NtDll = "ntdll.dll";
- internal const string OleAut32 = "oleaut32.dll";
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/NtDll/Interop.ZeroMemory.cs b/src/mscorlib/corefx/Interop/Windows/NtDll/Interop.ZeroMemory.cs
deleted file mode 100644
index bd2a64cf14..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/NtDll/Interop.ZeroMemory.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-using System.Security;
-
-internal partial class Interop
-{
- internal partial class NtDll
- {
-
- [DllImport(Libraries.NtDll, CharSet = CharSet.Unicode, EntryPoint = "RtlZeroMemory")]
- internal static extern void ZeroMemory(IntPtr address, UIntPtr length);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CancelIoEx.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CancelIoEx.cs
deleted file mode 100644
index fc99e3052f..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CancelIoEx.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System.Runtime.InteropServices;
-using System.Threading;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe bool CancelIoEx(SafeHandle handle, NativeOverlapped* lpOverlapped);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CloseHandle.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CloseHandle.cs
deleted file mode 100644
index 96ed922a84..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CloseHandle.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool CloseHandle(IntPtr handle);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CreateFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CreateFile.cs
deleted file mode 100644
index 5f6f6115ab..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.CreateFile.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- /// <summary>
- /// WARNING: This method does not implicitly handle long paths. Use CreateFile.
- /// </summary>
- [DllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
- private static extern SafeFileHandle CreateFilePrivate(
- string lpFileName,
- int dwDesiredAccess,
- System.IO.FileShare dwShareMode,
- [In] ref SECURITY_ATTRIBUTES securityAttrs,
- System.IO.FileMode dwCreationDisposition,
- int dwFlagsAndAttributes,
- IntPtr hTemplateFile);
-
- internal static SafeFileHandle CreateFile(
- string lpFileName,
- int dwDesiredAccess,
- System.IO.FileShare dwShareMode,
- [In] ref SECURITY_ATTRIBUTES securityAttrs,
- System.IO.FileMode dwCreationDisposition,
- int dwFlagsAndAttributes,
- IntPtr hTemplateFile)
- {
- lpFileName = PathInternal.EnsureExtendedPrefixOverMaxPath(lpFileName);
- return CreateFilePrivate(lpFileName, dwDesiredAccess, dwShareMode, ref securityAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileOperations.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileOperations.cs
deleted file mode 100644
index 6e3ebb9ae9..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileOperations.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
-
- internal const uint SEM_FAILCRITICALERRORS = 1;
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileTypes.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileTypes.cs
deleted file mode 100644
index 1d306665b1..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FileTypes.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- internal partial class FileTypes
- {
- internal const int FILE_TYPE_DISK = 0x0001;
- internal const int FILE_TYPE_CHAR = 0x0002;
- internal const int FILE_TYPE_PIPE = 0x0003;
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs
deleted file mode 100644
index e10a2279cf..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FlushFileBuffers.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool FlushFileBuffers(SafeHandle hHandle);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FormatMessage.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FormatMessage.cs
deleted file mode 100644
index 94722b6c8b..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.FormatMessage.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Text;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- private const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
- private const int FORMAT_MESSAGE_FROM_HMODULE = 0x00000800;
- private const int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000;
- private const int FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000;
-
-
- private const int ERROR_INSUFFICIENT_BUFFER = 0x7A;
-
- [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "FormatMessageW", SetLastError = true, BestFitMapping = true)]
- private static extern int FormatMessage(
- int dwFlags,
- IntPtr lpSource,
- uint dwMessageId,
- int dwLanguageId,
- [Out] StringBuilder lpBuffer,
- int nSize,
- IntPtr[] arguments);
-
- /// <summary>
- /// Returns a string message for the specified Win32 error code.
- /// </summary>
- internal static string GetMessage(int errorCode)
- {
- return GetMessage(IntPtr.Zero, errorCode);
- }
-
- internal static string GetMessage(IntPtr moduleHandle, int errorCode)
- {
- var sb = new StringBuilder(InitialBufferSize);
- do
- {
- string errorMsg;
- if (TryGetErrorMessage(moduleHandle, errorCode, sb, out errorMsg))
- {
- return errorMsg;
- }
- else
- {
- // increase the capacity of the StringBuilder.
- sb.Capacity *= BufferSizeIncreaseFactor;
- }
- }
- while (sb.Capacity < MaxAllowedBufferSize);
-
- // If you come here then a size as large as 65K is also not sufficient and so we give the generic errorMsg.
- return string.Format("Unknown error (0x{0:x})", errorCode);
- }
-
- private static bool TryGetErrorMessage(IntPtr moduleHandle, int errorCode, StringBuilder sb, out string errorMsg)
- {
- errorMsg = "";
-
- int flags = FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY;
- if (moduleHandle != IntPtr.Zero)
- {
- flags |= FORMAT_MESSAGE_FROM_HMODULE;
- }
-
- int result = FormatMessage(flags, moduleHandle, (uint)errorCode, 0, sb, sb.Capacity, null);
- if (result != 0)
- {
- int i = sb.Length;
- while (i > 0)
- {
- char ch = sb[i - 1];
- if (ch > 32 && ch != '.') break;
- i--;
- }
- errorMsg = sb.ToString(0, i);
- }
- else if (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER)
- {
- return false;
- }
- else
- {
- errorMsg = string.Format("Unknown error (0x{0:x})", errorCode);
- }
-
- return true;
- }
-
- // Windows API FormatMessage lets you format a message string given an errorcode.
- // Unlike other APIs this API does not support a way to query it for the total message size.
- //
- // So the API can only be used in one of these two ways.
- // a. You pass a buffer of appropriate size and get the resource.
- // b. Windows creates a buffer and passes the address back and the onus of releasing the buffer lies on the caller.
- //
- // Since the error code is coming from the user, it is not possible to know the size in advance.
- // Unfortunately we can't use option b. since the buffer can only be freed using LocalFree and it is a private API on onecore.
- // Also, using option b is ugly for the managed code and could cause memory leak in situations where freeing is unsuccessful.
- //
- // As a result we use the following approach.
- // We initially call the API with a buffer size of 256 and then gradually increase the size in case of failure until we reach the maximum allowed limit of 65K.
- private const int InitialBufferSize = 256;
- private const int BufferSizeIncreaseFactor = 4;
- private const int MaxAllowedBufferSize = 65 * 1024;
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileInformationByHandleEx.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileInformationByHandleEx.cs
deleted file mode 100644
index 146c4638ee..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileInformationByHandleEx.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool GetFileInformationByHandleEx(SafeFileHandle hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, out FILE_STANDARD_INFO lpFileInformation, uint dwBufferSize);
-
- internal partial struct FILE_STANDARD_INFO
- {
- internal long AllocationSize;
- internal long EndOfFile;
- internal uint NumberOfLinks;
- internal BOOL DeletePending;
- internal BOOL Directory;
- }
-
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs
deleted file mode 100644
index c07a1683a5..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal extern static int GetFileType(SafeHandle hFile);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFullPathNameW.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFullPathNameW.cs
deleted file mode 100644
index 15dd581113..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetFullPathNameW.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- /// <summary>
- /// WARNING: This method does not implicitly handle long paths. Use GetFullPathName or PathHelper.
- /// </summary>
- [DllImport(Libraries.Kernel32, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
- unsafe internal static extern uint GetFullPathNameW(char* path, uint numBufferChars, char[] buffer, IntPtr mustBeZero);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetLongPathNameW.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetLongPathNameW.cs
deleted file mode 100644
index a58d1013ca..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetLongPathNameW.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-partial class Interop
-{
- partial class Kernel32
- {
- /// <summary>
- /// WARNING: This method does not implicitly handle long paths. Use GetFullPath/PathHelper.
- /// </summary>
- [DllImport(Libraries.Kernel32, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
- internal static extern uint GetLongPathNameW(char[] lpszShortPath, char[] lpszLongPath, uint cchBuffer);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempFileNameW.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempFileNameW.cs
deleted file mode 100644
index d157a29c92..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempFileNameW.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Text;
-using System.Runtime.InteropServices;
-
-partial class Interop
-{
- partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
- internal static extern uint GetTempFileNameW(string tmpPath, string prefix, uint uniqueIdOrZero, [Out]StringBuilder tmpFileName);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempPathW.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempPathW.cs
deleted file mode 100644
index 25ffcd55b0..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.GetTempPathW.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.IO;
-using System.Text;
-using System.Runtime.InteropServices;
-
-partial class Interop
-{
- partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, BestFitMapping = false)]
- internal static extern uint GetTempPathW(int bufferLen, [Out]StringBuilder buffer);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.LockFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.LockFile.cs
deleted file mode 100644
index a21d00f4f6..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.LockFile.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool LockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh);
-
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool UnlockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs
deleted file mode 100644
index 076f7f136f..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int ReadFile(
- SafeHandle handle,
- byte* bytes,
- int numBytesToRead,
- out int numBytesRead,
- IntPtr mustBeZero);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs
deleted file mode 100644
index 3ae65a8806..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System;
-using System.Runtime.InteropServices;
-using System.Threading;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int ReadFile(
- SafeHandle handle,
- byte* bytes,
- int numBytesToRead,
- IntPtr numBytesRead_mustBeZero,
- NativeOverlapped* overlapped);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SECURITY_ATTRIBUTES.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SECURITY_ATTRIBUTES.cs
deleted file mode 100644
index 8d31f8622f..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SECURITY_ATTRIBUTES.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [StructLayout(LayoutKind.Sequential)]
- internal struct SECURITY_ATTRIBUTES
- {
- internal uint nLength;
- internal IntPtr lpSecurityDescriptor;
- internal BOOL bInheritHandle;
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SafeCreateFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SafeCreateFile.cs
deleted file mode 100644
index 4192f569e0..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SafeCreateFile.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-using Microsoft.Win32.SafeHandles;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- internal static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); // WinBase.h
-
- /// <summary>
- /// Does not allow access to non-file devices. This disallows DOS devices like "con:", "com1:",
- /// "lpt1:", etc. Use this to avoid security problems, like allowing a web client asking a server
- /// for "http://server/com1.aspx" and then causing a worker process to hang.
- /// </summary>
- internal static SafeFileHandle SafeCreateFile(
- String lpFileName,
- int dwDesiredAccess,
- System.IO.FileShare dwShareMode,
- ref Interop.Kernel32.SECURITY_ATTRIBUTES securityAttrs,
- FileMode dwCreationDisposition,
- int dwFlagsAndAttributes,
- IntPtr hTemplateFile)
- {
- SafeFileHandle handle = UnsafeCreateFile(lpFileName, dwDesiredAccess, dwShareMode, ref securityAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
-
- if (!handle.IsInvalid)
- {
- int fileType = Interop.Kernel32.GetFileType(handle);
- if (fileType != Interop.Kernel32.FileTypes.FILE_TYPE_DISK)
- {
- handle.Dispose();
- throw new NotSupportedException(SR.NotSupported_FileStreamOnNonFiles);
- }
- }
-
- return handle;
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SecurityOptions.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SecurityOptions.cs
deleted file mode 100644
index 4a4402484f..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SecurityOptions.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- internal partial class SecurityOptions
- {
- internal const int SECURITY_SQOS_PRESENT = 0x00100000;
- internal const int SECURITY_ANONYMOUS = 0 << 16;
- internal const int SECURITY_IDENTIFICATION = 1 << 16;
- internal const int SECURITY_IMPERSONATION = 2 << 16;
- internal const int SECURITY_DELEGATION = 3 << 16;
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetEndOfFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetEndOfFile.cs
deleted file mode 100644
index e5d60041a8..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetEndOfFile.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool SetEndOfFile(SafeFileHandle hFile);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetErrorMode.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetErrorMode.cs
deleted file mode 100644
index caa2ce5bfa..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetErrorMode.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, SetLastError = false, EntryPoint = "SetErrorMode", ExactSpelling = true)]
- internal static extern uint SetErrorMode(uint newMode);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFileInformationByHandle.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFileInformationByHandle.cs
deleted file mode 100644
index e31a453ba9..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFileInformationByHandle.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- internal enum FILE_INFO_BY_HANDLE_CLASS : uint
- {
- FileBasicInfo = 0x0u,
- FileStandardInfo = 0x1u,
- FileNameInfo = 0x2u,
- FileRenameInfo = 0x3u,
- FileDispositionInfo = 0x4u,
- FileAllocationInfo = 0x5u,
- FileEndOfFileInfo = 0x6u,
- FileStreamInfo = 0x7u,
- FileCompressionInfo = 0x8u,
- FileAttributeTagInfo = 0x9u,
- FileIdBothDirectoryInfo = 0xAu,
- FileIdBothDirectoryRestartInfo = 0xBu,
- FileIoPriorityHintInfo = 0xCu,
- FileRemoteProtocolInfo = 0xDu,
- FileFullDirectoryInfo = 0xEu,
- FileFullDirectoryRestartInfo = 0xFu,
- FileStorageInfo = 0x10u,
- FileAlignmentInfo = 0x11u,
- FileIdInfo = 0x12u,
- FileIdExtdDirectoryInfo = 0x13u,
- FileIdExtdDirectoryRestartInfo = 0x14u,
- MaximumFileInfoByHandleClass = 0x15u,
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs
deleted file mode 100644
index c0e5247a52..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.SetFilePointerEx.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool SetFilePointerEx(SafeFileHandle hFile, long liDistanceToMove, out long lpNewFilePointer, uint dwMoveMethod);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.UnsafeCreateFile.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.UnsafeCreateFile.cs
deleted file mode 100644
index 9a5cd2834d..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.UnsafeCreateFile.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using Microsoft.Win32.SafeHandles;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- internal static SafeFileHandle UnsafeCreateFile(
- string lpFileName,
- int dwDesiredAccess,
- FileShare dwShareMode,
- ref Interop.Kernel32.SECURITY_ATTRIBUTES securityAttrs,
- FileMode dwCreationDisposition,
- int dwFlagsAndAttributes,
- IntPtr hTemplateFile)
- {
- return CreateFile(lpFileName, dwDesiredAccess, dwShareMode, ref securityAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
- }
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs
deleted file mode 100644
index 07271cae33..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- [DllImport(Libraries.Kernel32)]
- internal static extern unsafe int WideCharToMultiByte(
- uint CodePage, uint dwFlags,
- char* lpWideCharStr, int cchWideChar,
- byte* lpMultiByteStr, int cbMultiByte,
- IntPtr lpDefaultChar, IntPtr lpUsedDefaultChar);
-
- internal const uint CP_ACP = 0;
- internal const uint WC_NO_BEST_FIT_CHARS = 0x00000400;
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs
deleted file mode 100644
index e7e868e142..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- // Note there are two different WriteFile prototypes - this is to use
- // the type system to force you to not trip across a "feature" in
- // Win32's async IO support. You can't do the following three things
- // simultaneously: overlapped IO, free the memory for the overlapped
- // struct in a callback (or an EndWrite method called by that callback),
- // and pass in an address for the numBytesRead parameter.
-
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, out int numBytesWritten, IntPtr mustBeZero);
-
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs b/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs
deleted file mode 100644
index dc1e97555b..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System;
-using System.Runtime.InteropServices;
-using System.Threading;
-internal partial class Interop
-{
- internal partial class Kernel32
- {
- // Note there are two different WriteFile prototypes - this is to use
- // the type system to force you to not trip across a "feature" in
- // Win32's async IO support. You can't do the following three things
- // simultaneously: overlapped IO, free the memory for the overlapped
- // struct in a callback (or an EndWrite method called by that callback),
- // and pass in an address for the numBytesRead parameter.
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, IntPtr numBytesWritten_mustBeZero, NativeOverlapped* lpOverlapped);
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysAllocStringLen.cs b/src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysAllocStringLen.cs
deleted file mode 100644
index 65da4eaaea..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysAllocStringLen.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-using System.Security;
-
-internal partial class Interop
-{
- internal partial class OleAut32
- {
- [DllImport(Libraries.OleAut32, CharSet = CharSet.Unicode)]
- internal static extern SafeBSTRHandle SysAllocStringLen(IntPtr src, uint len); // BSTR
- }
-}
diff --git a/src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysStringLen.cs b/src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysStringLen.cs
deleted file mode 100644
index 027d8eece9..0000000000
--- a/src/mscorlib/corefx/Interop/Windows/oleaut32/Interop.SysStringLen.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-using System.Security;
-
-internal partial class Interop
-{
- internal partial class OleAut32
- {
- [DllImport(Libraries.OleAut32)]
- internal static extern uint SysStringLen(SafeBSTRHandle bstr);
-
- [DllImport(Libraries.OleAut32)]
- internal static extern uint SysStringLen(IntPtr bstr);
-
- [DllImport(Libraries.OleAut32)]
- internal static extern void SysFreeString(IntPtr bstr);
- }
-}
diff --git a/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs b/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs
deleted file mode 100644
index d13b536204..0000000000
--- a/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-namespace Microsoft.Win32.SafeHandles
-{
- public sealed class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid
- {
- /// <summary>A handle value of -1.</summary>
- private static readonly IntPtr s_invalidHandle = new IntPtr(-1);
-
- private SafeFileHandle() : this(ownsHandle: true)
- {
- }
-
- private SafeFileHandle(bool ownsHandle)
- : base(ownsHandle)
- {
- SetHandle(s_invalidHandle);
- }
-
- public SafeFileHandle(IntPtr preexistingHandle, bool ownsHandle) : this(ownsHandle)
- {
- SetHandle(preexistingHandle);
- }
-
- internal bool? IsAsync { get; set; }
-
- /// <summary>Opens the specified file with the requested flags and mode.</summary>
- /// <param name="path">The path to the file.</param>
- /// <param name="flags">The flags with which to open the file.</param>
- /// <param name="mode">The mode for opening the file.</param>
- /// <returns>A SafeFileHandle for the opened file.</returns>
- internal static SafeFileHandle Open(string path, Interop.Sys.OpenFlags flags, int mode)
- {
- Debug.Assert(path != null);
-
- // If we fail to open the file due to a path not existing, we need to know whether to blame
- // the file itself or its directory. If we're creating the file, then we blame the directory,
- // otherwise we blame the file.
- bool enoentDueToDirectory = (flags & Interop.Sys.OpenFlags.O_CREAT) != 0;
-
- // Open the file.
- SafeFileHandle handle = Interop.CheckIo(
- Interop.Sys.Open(path, flags, mode),
- path,
- isDirectory: enoentDueToDirectory,
- errorRewriter: e => (e.Error == Interop.Error.EISDIR) ? Interop.Error.EACCES.Info() : e);
-
- // Make sure it's not a directory; we do this after opening it once we have a file descriptor
- // to avoid race conditions.
- Interop.Sys.FileStatus status;
- if (Interop.Sys.FStat(handle, out status) != 0)
- {
- handle.Dispose();
- throw Interop.GetExceptionForIoErrno(Interop.Sys.GetLastErrorInfo(), path);
- }
- if ((status.Mode & Interop.Sys.FileTypes.S_IFMT) == Interop.Sys.FileTypes.S_IFDIR)
- {
- handle.Dispose();
- throw Interop.GetExceptionForIoErrno(Interop.Error.EACCES.Info(), path, isDirectory: true);
- }
-
- return handle;
- }
-
- /// <summary>Opens a SafeFileHandle for a file descriptor created by a provided delegate.</summary>
- /// <param name="fdFunc">
- /// The function that creates the file descriptor. Returns the file descriptor on success, or an invalid
- /// file descriptor on error with Marshal.GetLastWin32Error() set to the error code.
- /// </param>
- /// <returns>The created SafeFileHandle.</returns>
- internal static SafeFileHandle Open(Func<SafeFileHandle> fdFunc)
- {
- SafeFileHandle handle = Interop.CheckIo(fdFunc());
-
- Debug.Assert(!handle.IsInvalid, "File descriptor is invalid");
- return handle;
- }
-
- protected override bool ReleaseHandle()
- {
- // When the SafeFileHandle was opened, we likely issued an flock on the created descriptor in order to add
- // an advisory lock. This lock should be removed via closing the file descriptor, but close can be
- // interrupted, and we don't retry closes. As such, we could end up leaving the file locked,
- // which could prevent subsequent usage of the file until this process dies. To avoid that, we proactively
- // try to release the lock before we close the handle. (If it's not locked, there's no behavioral
- // problem trying to unlock it.)
- Interop.Sys.FLock(handle, Interop.Sys.LockOperations.LOCK_UN); // ignore any errors
-
- // Close the descriptor. Although close is documented to potentially fail with EINTR, we never want
- // to retry, as the descriptor could actually have been closed, been subsequently reassigned, and
- // be in use elsewhere in the process. Instead, we simply check whether the call was successful.
- int result = Interop.Sys.Close(handle);
-#if DEBUG
- if (result != 0)
- {
- Debug.Fail(string.Format(
- "Close failed with result {0} and error {1}",
- result, Interop.Sys.GetLastErrorInfo()));
- }
-#endif
- return result == 0;
- }
-
- public override bool IsInvalid
- {
- get
- {
- long h = (long)handle;
- return h < 0 || h > int.MaxValue;
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs b/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs
deleted file mode 100644
index 4eabe8f08c..0000000000
--- a/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Threading;
-using Microsoft.Win32;
-
-namespace Microsoft.Win32.SafeHandles
-{
- public sealed class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid
- {
- private bool? _isAsync;
-
- private SafeFileHandle() : base(true)
- {
- _isAsync = null;
- }
-
- public SafeFileHandle(IntPtr preexistingHandle, bool ownsHandle) : base(ownsHandle)
- {
- SetHandle(preexistingHandle);
-
- _isAsync = null;
- }
-
- internal bool? IsAsync
- {
- get
- {
- return _isAsync;
- }
-
- set
- {
- _isAsync = value;
- }
- }
-
- internal ThreadPoolBoundHandle ThreadPoolBinding { get; set; }
-
- override protected bool ReleaseHandle()
- {
- return Interop.Kernel32.CloseHandle(handle);
- }
- }
-}
-
diff --git a/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeThreadPoolIOHandle.cs b/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeThreadPoolIOHandle.cs
deleted file mode 100644
index 3dbc2bb620..0000000000
--- a/src/mscorlib/corefx/Microsoft/Win32/SafeHandles/SafeThreadPoolIOHandle.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Microsoft.Win32.SafeHandles
-{
- internal class SafeThreadPoolIOHandle : SafeHandle
- {
- private SafeThreadPoolIOHandle()
- : base(IntPtr.Zero, true)
- {
- }
-
- public override bool IsInvalid
- {
- get { return handle == IntPtr.Zero; }
- }
-
- protected override bool ReleaseHandle()
- {
- Interop.mincore.CloseThreadpoolIo(handle);
- return true;
- }
- }
-}
diff --git a/src/mscorlib/corefx/SR.cs b/src/mscorlib/corefx/SR.cs
deleted file mode 100644
index 012bb86a66..0000000000
--- a/src/mscorlib/corefx/SR.cs
+++ /dev/null
@@ -1,818 +0,0 @@
-using System;
-using System.Globalization;
-
-// CoreFX creates SR in the System namespace. While putting the CoreCLR SR adapter in the root
-// may be unconventional, it allows us to keep the shared code identical.
-
-internal static class SR
-{
- public static string Arg_ArrayZeroError
- {
- get { return Environment.GetResourceString("Arg_ArrayZeroError"); }
- }
-
- public static string Arg_ExternalException
- {
- get { return Environment.GetResourceString("Arg_ExternalException"); }
- }
-
- public static string Arg_HexStyleNotSupported
- {
- get { return Environment.GetResourceString("Arg_HexStyleNotSupported"); }
- }
-
- public static string Arg_InvalidHexStyle
- {
- get { return Environment.GetResourceString("Arg_InvalidHexStyle"); }
- }
-
- public static string ArgumentNull_Array
- {
- get { return Environment.GetResourceString("ArgumentNull_Array"); }
- }
-
- public static string ArgumentNull_ArrayValue
- {
- get { return Environment.GetResourceString("ArgumentNull_ArrayValue"); }
- }
-
- public static string ArgumentNull_Obj
- {
- get { return Environment.GetResourceString("ArgumentNull_Obj"); }
- }
-
- public static string ArgumentNull_String
- {
- get { return Environment.GetResourceString("ArgumentNull_String"); }
- }
-
- public static string ArgumentOutOfRange_AddValue
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_AddValue"); }
- }
-
- public static string ArgumentOutOfRange_BadHourMinuteSecond
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_BadHourMinuteSecond"); }
- }
-
- public static string ArgumentOutOfRange_BadYearMonthDay
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_BadYearMonthDay"); }
- }
-
- public static string ArgumentOutOfRange_Bounds_Lower_Upper
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Bounds_Lower_Upper"); }
- }
-
- public static string ArgumentOutOfRange_CalendarRange
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_CalendarRange"); }
- }
-
- public static string ArgumentOutOfRange_Count
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Count"); }
- }
-
- public static string ArgumentOutOfRange_Day
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Day"); }
- }
-
- public static string ArgumentOutOfRange_Enum
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Enum"); }
- }
-
- public static string ArgumentOutOfRange_Era
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Era"); }
- }
-
- public static string ArgumentOutOfRange_Index
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Index"); }
- }
-
- public static string ArgumentOutOfRange_IndexCountBuffer
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"); }
- }
-
- public static string ArgumentOutOfRange_InvalidEraValue
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_InvalidEraValue"); }
- }
-
- public static string ArgumentOutOfRange_Month
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Month"); }
- }
-
- public static string ArgumentOutOfRange_NeedNonNegNum
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"); }
- }
-
- public static string ArgumentOutOfRange_NeedPosNum
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"); }
- }
-
- public static string Arg_ArgumentOutOfRangeException
- {
- get { return Environment.GetResourceString("Arg_ArgumentOutOfRangeException"); }
- }
-
- public static string ArgumentOutOfRange_OffsetLength
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_OffsetLength"); }
- }
-
- public static string ArgumentOutOfRange_Range
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Range"); }
- }
-
- public static string Argument_CompareOptionOrdinal
- {
- get { return Environment.GetResourceString("Argument_CompareOptionOrdinal"); }
- }
-
- public static string Argument_ConflictingDateTimeRoundtripStyles
- {
- get { return Environment.GetResourceString("Argument_ConflictingDateTimeRoundtripStyles"); }
- }
-
- public static string Argument_ConflictingDateTimeStyles
- {
- get { return Environment.GetResourceString("Argument_ConflictingDateTimeStyles"); }
- }
-
- public static string Argument_CultureIetfNotSupported
- {
- get { return Environment.GetResourceString("Argument_CultureIetfNotSupported"); }
- }
-
- public static string Argument_CultureInvalidIdentifier
- {
- get { return Environment.GetResourceString("Argument_CultureInvalidIdentifier"); }
- }
-
- public static string Argument_CultureNotSupported
- {
- get { return Environment.GetResourceString("Argument_CultureNotSupported"); }
- }
-
- public static string Argument_CultureIsNeutral
- {
- get { return Environment.GetResourceString("Argument_CultureIsNeutral"); }
- }
-
- public static string Argument_CustomCultureCannotBePassedByNumber
- {
- get { return Environment.GetResourceString("Argument_CustomCultureCannotBePassedByNumber"); }
- }
-
- public static string Argument_EmptyDecString
- {
- get { return Environment.GetResourceString("Argument_EmptyDecString"); }
- }
-
- public static string Argument_IdnBadLabelSize
- {
- get { return Environment.GetResourceString("Argument_IdnBadLabelSize"); }
- }
-
- public static string Argument_IdnBadPunycode
- {
- get { return Environment.GetResourceString("Argument_IdnBadPunycode"); }
- }
-
- public static string Argument_IdnIllegalName
- {
- get { return Environment.GetResourceString("Argument_IdnIllegalName"); }
- }
-
- public static string Argument_InvalidArrayLength
- {
- get { return Environment.GetResourceString("Argument_InvalidArrayLength"); }
- }
-
- public static string Argument_InvalidCalendar
- {
- get { return Environment.GetResourceString("Argument_InvalidCalendar"); }
- }
-
- public static string Argument_InvalidCharSequence
- {
- get { return Environment.GetResourceString("Argument_InvalidCharSequence"); }
- }
-
- public static string Argument_InvalidCultureName
- {
- get { return Environment.GetResourceString("Argument_InvalidCultureName"); }
- }
-
- public static string Argument_InvalidDateTimeStyles
- {
- get { return Environment.GetResourceString("Argument_InvalidDateTimeStyles"); }
- }
-
- public static string Argument_InvalidDigitSubstitution
- {
- get { return Environment.GetResourceString("Argument_InvalidDigitSubstitution"); }
- }
-
- public static string Argument_InvalidFlag
- {
- get { return Environment.GetResourceString("Argument_InvalidFlag"); }
- }
-
- public static string Argument_InvalidGroupSize
- {
- get { return Environment.GetResourceString("Argument_InvalidGroupSize"); }
- }
-
- public static string Argument_InvalidNativeDigitCount
- {
- get { return Environment.GetResourceString("Argument_InvalidNativeDigitCount"); }
- }
-
- public static string Argument_InvalidNativeDigitValue
- {
- get { return Environment.GetResourceString("Argument_InvalidNativeDigitValue"); }
- }
-
- public static string Argument_InvalidNeutralRegionName
- {
- get { return Environment.GetResourceString("Argument_InvalidNeutralRegionName"); }
- }
-
- public static string Argument_InvalidNumberStyles
- {
- get { return Environment.GetResourceString("Argument_InvalidNumberStyles"); }
- }
-
- public static string Argument_InvalidResourceCultureName
- {
- get { return Environment.GetResourceString("Argument_InvalidResourceCultureName"); }
- }
-
- public static string Argument_NoEra
- {
- get { return Environment.GetResourceString("Argument_NoEra"); }
- }
-
- public static string Argument_NoRegionInvariantCulture
- {
- get { return Environment.GetResourceString("Argument_NoRegionInvariantCulture"); }
- }
-
- public static string Argument_OneOfCulturesNotSupported
- {
- get { return Environment.GetResourceString("Argument_OneOfCulturesNotSupported"); }
- }
-
- public static string Argument_OnlyMscorlib
- {
- get { return Environment.GetResourceString("Argument_OnlyMscorlib"); }
- }
-
- public static string Argument_ResultCalendarRange
- {
- get { return Environment.GetResourceString("Argument_ResultCalendarRange"); }
- }
-
- public static string Format_BadFormatSpecifier
- {
- get { return Environment.GetResourceString("Format_BadFormatSpecifier"); }
- }
-
- public static string InvalidOperation_DateTimeParsing
- {
- get { return Environment.GetResourceString("InvalidOperation_DateTimeParsing"); }
- }
-
- public static string InvalidOperation_EnumEnded
- {
- get { return Environment.GetResourceString("InvalidOperation_EnumEnded"); }
- }
-
- public static string InvalidOperation_EnumNotStarted
- {
- get { return Environment.GetResourceString("InvalidOperation_EnumNotStarted"); }
- }
-
- public static string InvalidOperation_ReadOnly
- {
- get { return Environment.GetResourceString("InvalidOperation_ReadOnly"); }
- }
-
- public static string Overflow_TimeSpanTooLong
- {
- get { return Environment.GetResourceString("Overflow_TimeSpanTooLong"); }
- }
-
- public static string Serialization_MemberOutOfRange
- {
- get { return Environment.GetResourceString("Serialization_MemberOutOfRange"); }
- }
-
- public static string Arg_InvalidHandle
- {
- get { return Environment.GetResourceString("Arg_InvalidHandle"); }
- }
-
- public static string ObjectDisposed_FileClosed
- {
- get { return Environment.GetResourceString("ObjectDisposed_FileClosed"); }
- }
-
- public static string Arg_HandleNotAsync
- {
- get { return Environment.GetResourceString("Arg_HandleNotAsync"); }
- }
-
- public static string ArgumentNull_Path
- {
- get { return Environment.GetResourceString("ArgumentNull_Path"); }
- }
-
- public static string Argument_EmptyPath
- {
- get { return Environment.GetResourceString("Argument_EmptyPath"); }
- }
-
- public static string Argument_InvalidFileModeAndAccessCombo
- {
- get { return Environment.GetResourceString("Argument_InvalidFileMode&AccessCombo"); }
- }
-
- public static string Argument_InvalidAppendMode
- {
- get { return Environment.GetResourceString("Argument_InvalidAppendMode"); }
- }
-
- public static string ArgumentNull_Buffer
- {
- get { return Environment.GetResourceString("ArgumentNull_Buffer"); }
- }
-
- public static string Argument_InvalidOffLen
- {
- get { return Environment.GetResourceString("Argument_InvalidOffLen"); }
- }
-
- public static string IO_UnknownFileName
- {
- get { return Environment.GetResourceString("IO_UnknownFileName"); }
- }
-
- public static string IO_FileStreamHandlePosition
- {
- get { return Environment.GetResourceString("IO.IO_FileStreamHandlePosition"); }
- }
-
- public static string NotSupported_FileStreamOnNonFiles
- {
- get { return Environment.GetResourceString("NotSupported_FileStreamOnNonFiles"); }
- }
-
- public static string IO_BindHandleFailed
- {
- get { return Environment.GetResourceString("IO.IO_BindHandleFailed"); }
- }
-
- public static string Arg_HandleNotSync
- {
- get { return Environment.GetResourceString("Arg_HandleNotSync"); }
- }
-
- public static string IO_SetLengthAppendTruncate
- {
- get { return Environment.GetResourceString("IO.IO_SetLengthAppendTruncate"); }
- }
-
- public static string ArgumentOutOfRange_FileLengthTooBig
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_FileLengthTooBig"); }
- }
-
- public static string Argument_InvalidSeekOrigin
- {
- get { return Environment.GetResourceString("Argument_InvalidSeekOrigin"); }
- }
-
- public static string IO_SeekAppendOverwrite
- {
- get { return Environment.GetResourceString("IO.IO_SeekAppendOverwrite"); }
- }
-
- public static string IO_FileTooLongOrHandleNotSync
- {
- get { return Environment.GetResourceString("IO_FileTooLongOrHandleNotSync"); }
- }
-
- public static string IndexOutOfRange_IORaceCondition
- {
- get { return Environment.GetResourceString("IndexOutOfRange_IORaceCondition"); }
- }
-
- public static string IO_FileNotFound
- {
- get { return Environment.GetResourceString("IO.FileNotFound"); }
- }
-
- public static string IO_FileNotFound_FileName
- {
- get { return Environment.GetResourceString("IO.FileNotFound_FileName"); }
- }
-
- public static string IO_PathNotFound_NoPathName
- {
- get { return Environment.GetResourceString("IO.PathNotFound_NoPathName"); }
- }
-
- public static string IO_PathNotFound_Path
- {
- get { return Environment.GetResourceString("IO.PathNotFound_Path"); }
- }
-
- public static string UnauthorizedAccess_IODenied_NoPathName
- {
- get { return Environment.GetResourceString("UnauthorizedAccess_IODenied_NoPathName"); }
- }
-
- public static string UnauthorizedAccess_IODenied_Path
- {
- get { return Environment.GetResourceString("UnauthorizedAccess_IODenied_Path"); }
- }
-
- public static string IO_AlreadyExists_Name
- {
- get { return Environment.GetResourceString("IO.IO_AlreadyExists_Name"); }
- }
-
- public static string IO_PathTooLong
- {
- get { return Environment.GetResourceString("IO.PathTooLong"); }
- }
-
- public static string IO_SharingViolation_NoFileName
- {
- get { return Environment.GetResourceString("IO.IO_SharingViolation_NoFileName"); }
- }
-
- public static string IO_SharingViolation_File
- {
- get { return Environment.GetResourceString("IO.IO_SharingViolation_File"); }
- }
-
- public static string IO_FileExists_Name
- {
- get { return Environment.GetResourceString("IO.IO_FileExists_Name"); }
- }
-
- public static string NotSupported_UnwritableStream
- {
- get { return Environment.GetResourceString("NotSupported_UnwritableStream"); }
- }
-
- public static string NotSupported_UnreadableStream
- {
- get { return Environment.GetResourceString("NotSupported_UnreadableStream"); }
- }
-
- public static string NotSupported_UnseekableStream
- {
- get { return Environment.GetResourceString("NotSupported_UnseekableStream"); }
- }
-
- public static string IO_EOF_ReadBeyondEOF
- {
- get { return Environment.GetResourceString("IO.EOF_ReadBeyondEOF"); }
- }
-
- public static string Argument_InvalidHandle
- {
- get { return Environment.GetResourceString("Argument_InvalidHandle"); }
- }
-
- public static string Argument_AlreadyBoundOrSyncHandle
- {
- get { return Environment.GetResourceString("Argument_AlreadyBoundOrSyncHandle"); }
- }
-
- public static string Argument_PreAllocatedAlreadyAllocated
- {
- get { return Environment.GetResourceString("Argument_PreAllocatedAlreadyAllocated"); }
- }
-
- public static string Argument_NativeOverlappedAlreadyFree
- {
- get { return Environment.GetResourceString("Argument_NativeOverlappedAlreadyFree"); }
- }
-
- public static string Argument_NativeOverlappedWrongBoundHandle
- {
- get { return Environment.GetResourceString("Argument_NativeOverlappedWrongBoundHandle"); }
- }
-
- public static string InvalidOperation_NativeOverlappedReused
- {
- get { return Environment.GetResourceString("InvalidOperation_NativeOverlappedReused"); }
- }
-
- public static string ArgumentOutOfRange_Length
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Length"); }
- }
-
- public static string ArgumentOutOfRange_IndexString
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_IndexString"); }
- }
-
- public static string ArgumentOutOfRange_Capacity
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Capacity"); }
- }
-
- public static string Arg_CryptographyException
- {
- get { return Environment.GetResourceString("Arg_CryptographyException"); }
- }
-
- public static string ArgumentException_BufferNotFromPool
- {
- get { return Environment.GetResourceString("ArgumentException_BufferNotFromPool"); }
- }
-
- public static string Argument_InvalidPathChars
- {
- get { return Environment.GetResourceString("Argument_InvalidPathChars"); }
- }
-
- public static string Argument_PathFormatNotSupported
- {
- get { return Environment.GetResourceString("Argument_PathFormatNotSupported"); }
- }
-
- public static string Arg_PathIllegal
- {
- get { return Environment.GetResourceString("Arg_PathIllegal"); }
- }
-
- public static string Arg_PathIllegalUNC
- {
- get { return Environment.GetResourceString("Arg_PathIllegalUNC"); }
- }
-
- public static string Arg_InvalidSearchPattern
- {
- get { return Environment.GetResourceString("Arg_InvalidSearchPattern"); }
- }
-
- public static string InvalidOperation_Cryptography
- {
- get { return Environment.GetResourceString("InvalidOperation_Cryptography"); }
- }
-
- public static string Format(string formatString, params object[] args)
- {
- return string.Format(CultureInfo.CurrentCulture, formatString, args);
- }
-
- internal static string ArgumentException_ValueTupleIncorrectType
- {
- get { return Environment.GetResourceString("ArgumentException_ValueTupleIncorrectType"); }
- }
-
- internal static string ArgumentException_ValueTupleLastArgumentNotATuple
- {
- get { return Environment.GetResourceString("ArgumentException_ValueTupleLastArgumentNotATuple"); }
- }
-
- internal static string SpinLock_TryEnter_ArgumentOutOfRange
- {
- get { return Environment.GetResourceString("SpinLock_TryEnter_ArgumentOutOfRange"); }
- }
-
- internal static string SpinLock_TryReliableEnter_ArgumentException
- {
- get { return Environment.GetResourceString("SpinLock_TryReliableEnter_ArgumentException"); }
- }
-
- internal static string SpinLock_TryEnter_LockRecursionException
- {
- get { return Environment.GetResourceString("SpinLock_TryEnter_LockRecursionException"); }
- }
-
- internal static string SpinLock_Exit_SynchronizationLockException
- {
- get { return Environment.GetResourceString("SpinLock_Exit_SynchronizationLockException"); }
- }
-
- internal static string SpinLock_IsHeldByCurrentThread
- {
- get { return Environment.GetResourceString("SpinLock_IsHeldByCurrentThread"); }
- }
-
- internal static string ObjectDisposed_StreamIsClosed
- {
- get { return Environment.GetResourceString("ObjectDisposed_StreamIsClosed"); }
- }
-
- internal static string Arg_SystemException
- {
- get { return Environment.GetResourceString("Arg_SystemException"); }
- }
-
- internal static string Arg_StackOverflowException
- {
- get { return Environment.GetResourceString("Arg_StackOverflowException"); }
- }
-
- internal static string Arg_DataMisalignedException
- {
- get { return Environment.GetResourceString("Arg_DataMisalignedException"); }
- }
-
- internal static string Arg_ExecutionEngineException
- {
- get { return Environment.GetResourceString("Arg_ExecutionEngineException"); }
- }
-
- internal static string Arg_AccessException
- {
- get { return Environment.GetResourceString("Arg_AccessException"); }
- }
-
- internal static string Arg_AccessViolationException
- {
- get { return Environment.GetResourceString("Arg_AccessViolationException"); }
- }
-
- internal static string Arg_ApplicationException
- {
- get { return Environment.GetResourceString("Arg_ApplicationException"); }
- }
-
- internal static string Arg_ArgumentException
- {
- get { return Environment.GetResourceString("Arg_ArgumentException"); }
- }
-
- internal static string Arg_ParamName_Name
- {
- get { return Environment.GetResourceString("Arg_ParamName_Name"); }
- }
-
- internal static string ArgumentNull_Generic
- {
- get { return Environment.GetResourceString("ArgumentNull_Generic"); }
- }
-
- internal static string Arg_ArithmeticException
- {
- get { return Environment.GetResourceString("Arg_ArithmeticException"); }
- }
-
- internal static string Arg_ArrayTypeMismatchException
- {
- get { return Environment.GetResourceString("Arg_ArrayTypeMismatchException"); }
- }
-
- internal static string Arg_DivideByZero
- {
- get { return Environment.GetResourceString("Arg_DivideByZero"); }
- }
-
- internal static string Arg_DuplicateWaitObjectException
- {
- get { return Environment.GetResourceString("Arg_DuplicateWaitObjectException"); }
- }
-
- internal static string Arg_EntryPointNotFoundException
- {
- get { return Environment.GetResourceString("Arg_EntryPointNotFoundException"); }
- }
-
- internal static string Arg_FieldAccessException
- {
- get { return Environment.GetResourceString("Arg_FieldAccessException"); }
- }
-
- internal static string Arg_FormatException
- {
- get { return Environment.GetResourceString("Arg_FormatException"); }
- }
-
- internal static string Arg_IndexOutOfRangeException
- {
- get { return Environment.GetResourceString("Arg_IndexOutOfRangeException"); }
- }
-
- internal static string Arg_InsufficientExecutionStackException
- {
- get { return Environment.GetResourceString("Arg_InsufficientExecutionStackException"); }
- }
-
- internal static string Arg_InvalidCastException
- {
- get { return Environment.GetResourceString("Arg_InvalidCastException"); }
- }
-
- internal static string Arg_InvalidOperationException
- {
- get { return Environment.GetResourceString("Arg_InvalidOperationException"); }
- }
-
- internal static string InvalidProgram_Default
- {
- get { return Environment.GetResourceString("InvalidProgram_Default"); }
- }
-
- internal static string Arg_MethodAccessException
- {
- get { return Environment.GetResourceString("Arg_MethodAccessException"); }
- }
-
- internal static string Arg_MulticastNotSupportedException
- {
- get { return Environment.GetResourceString("Arg_MulticastNotSupportedException"); }
- }
-
- internal static string Arg_NotFiniteNumberException
- {
- get { return Environment.GetResourceString("Arg_NotFiniteNumberException"); }
- }
-
- internal static string Arg_NotImplementedException
- {
- get { return Environment.GetResourceString("Arg_NotImplementedException"); }
- }
-
- internal static string Arg_NotSupportedException
- {
- get { return Environment.GetResourceString("Arg_NotSupportedException"); }
- }
-
- internal static string Arg_NullReferenceException
- {
- get { return Environment.GetResourceString("Arg_NullReferenceException"); }
- }
-
- internal static string ObjectDisposed_Generic
- {
- get { return Environment.GetResourceString("ObjectDisposed_Generic"); }
- }
-
- internal static string ObjectDisposed_ObjectName_Name
- {
- get { return Environment.GetResourceString("ObjectDisposed_ObjectName_Name"); }
- }
-
- internal static string Arg_OverflowException
- {
- get { return Environment.GetResourceString("Arg_OverflowException"); }
- }
-
- internal static string Arg_PlatformNotSupported
- {
- get { return Environment.GetResourceString("Arg_PlatformNotSupported"); }
- }
-
- internal static string Arg_RankException
- {
- get { return Environment.GetResourceString("Arg_RankException"); }
- }
-
- internal static string Arg_TimeoutException
- {
- get { return Environment.GetResourceString("Arg_TimeoutException"); }
- }
-
- internal static string Arg_TypeAccessException
- {
- get { return Environment.GetResourceString("Arg_TypeAccessException"); }
- }
-
- internal static string TypeInitialization_Default
- {
- get { return Environment.GetResourceString("TypeInitialization_Default"); }
- }
-
- internal static string TypeInitialization_Type
- {
- get { return Environment.GetResourceString("TypeInitialization_Type"); }
- }
-
- internal static string Arg_UnauthorizedAccessException
- {
- get { return Environment.GetResourceString("Arg_UnauthorizedAccessException"); }
- }
-}
diff --git a/src/mscorlib/corefx/System/Buffers/ArrayPool.cs b/src/mscorlib/corefx/System/Buffers/ArrayPool.cs
deleted file mode 100644
index 77a07f7fa5..0000000000
--- a/src/mscorlib/corefx/System/Buffers/ArrayPool.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Buffers
-{
- /// <summary>
- /// Provides a resource pool that enables reusing instances of type <see cref="T:T[]"/>.
- /// </summary>
- /// <remarks>
- /// <para>
- /// Renting and returning buffers with an <see cref="ArrayPool{T}"/> can increase performance
- /// in situations where arrays are created and destroyed frequently, resulting in significant
- /// memory pressure on the garbage collector.
- /// </para>
- /// <para>
- /// This class is thread-safe. All members may be used by multiple threads concurrently.
- /// </para>
- /// </remarks>
- public abstract class ArrayPool<T>
- {
- /// <summary>
- /// Retrieves a shared <see cref="ArrayPool{T}"/> instance.
- /// </summary>
- /// <remarks>
- /// The shared pool provides a default implementation of <see cref="ArrayPool{T}"/>
- /// that's intended for general applicability. It maintains arrays of multiple sizes, and
- /// may hand back a larger array than was actually requested, but will never hand back a smaller
- /// array than was requested. Renting a buffer from it with <see cref="Rent"/> will result in an
- /// existing buffer being taken from the pool if an appropriate buffer is available or in a new
- /// buffer being allocated if one is not available.
- /// byte[] and char[] are the most commonly pooled array types. For these we use a special pool type
- /// optimized for very fast access speeds, at the expense of more memory consumption.
- /// The shared pool instance is created lazily on first access.
- /// </remarks>
- public static ArrayPool<T> Shared { get; } =
- typeof(T) == typeof(byte) || typeof(T) == typeof(char) ? new TlsOverPerCoreLockedStacksArrayPool<T>() :
- Create();
-
- /// <summary>
- /// Creates a new <see cref="ArrayPool{T}"/> instance using default configuration options.
- /// </summary>
- /// <returns>A new <see cref="ArrayPool{T}"/> instance.</returns>
- public static ArrayPool<T> Create() => new ConfigurableArrayPool<T>();
-
- /// <summary>
- /// Creates a new <see cref="ArrayPool{T}"/> instance using custom configuration options.
- /// </summary>
- /// <param name="maxArrayLength">The maximum length of array instances that may be stored in the pool.</param>
- /// <param name="maxArraysPerBucket">
- /// The maximum number of array instances that may be stored in each bucket in the pool. The pool
- /// groups arrays of similar lengths into buckets for faster access.
- /// </param>
- /// <returns>A new <see cref="ArrayPool{T}"/> instance with the specified configuration options.</returns>
- /// <remarks>
- /// The created pool will group arrays into buckets, with no more than <paramref name="maxArraysPerBucket"/>
- /// in each bucket and with those arrays not exceeding <paramref name="maxArrayLength"/> in length.
- /// </remarks>
- public static ArrayPool<T> Create(int maxArrayLength, int maxArraysPerBucket) =>
- new ConfigurableArrayPool<T>(maxArrayLength, maxArraysPerBucket);
-
- /// <summary>
- /// Retrieves a buffer that is at least the requested length.
- /// </summary>
- /// <param name="minimumLength">The minimum length of the array needed.</param>
- /// <returns>
- /// An <see cref="T:T[]"/> that is at least <paramref name="minimumLength"/> in length.
- /// </returns>
- /// <remarks>
- /// This buffer is loaned to the caller and should be returned to the same pool via
- /// <see cref="Return"/> so that it may be reused in subsequent usage of <see cref="Rent"/>.
- /// It is not a fatal error to not return a rented buffer, but failure to do so may lead to
- /// decreased application performance, as the pool may need to create a new buffer to replace
- /// the one lost.
- /// </remarks>
- public abstract T[] Rent(int minimumLength);
-
- /// <summary>
- /// Returns to the pool an array that was previously obtained via <see cref="Rent"/> on the same
- /// <see cref="ArrayPool{T}"/> instance.
- /// </summary>
- /// <param name="array">
- /// The buffer previously obtained from <see cref="Rent"/> to return to the pool.
- /// </param>
- /// <param name="clearArray">
- /// If <c>true</c> and if the pool will store the buffer to enable subsequent reuse, <see cref="Return"/>
- /// will clear <paramref name="array"/> of its contents so that a subsequent consumer via <see cref="Rent"/>
- /// will not see the previous consumer's content. If <c>false</c> or if the pool will release the buffer,
- /// the array's contents are left unchanged.
- /// </param>
- /// <remarks>
- /// Once a buffer has been returned to the pool, the caller gives up all ownership of the buffer
- /// and must not use it. The reference returned from a given call to <see cref="Rent"/> must only be
- /// returned via <see cref="Return"/> once. The default <see cref="ArrayPool{T}"/>
- /// may hold onto the returned buffer in order to rent it again, or it may release the returned buffer
- /// if it's determined that the pool already has enough buffers stored.
- /// </remarks>
- public abstract void Return(T[] array, bool clearArray = false);
- }
-}
diff --git a/src/mscorlib/corefx/System/Buffers/ArrayPoolEventSource.cs b/src/mscorlib/corefx/System/Buffers/ArrayPoolEventSource.cs
deleted file mode 100644
index 9482744144..0000000000
--- a/src/mscorlib/corefx/System/Buffers/ArrayPoolEventSource.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics.Tracing;
-
-namespace System.Buffers
-{
- [EventSource(Name = "System.Buffers.ArrayPoolEventSource")]
- internal sealed class ArrayPoolEventSource : EventSource
- {
- internal readonly static ArrayPoolEventSource Log = new ArrayPoolEventSource();
-
- /// <summary>The reason for a BufferAllocated event.</summary>
- internal enum BufferAllocatedReason : int
- {
- /// <summary>The pool is allocating a buffer to be pooled in a bucket.</summary>
- Pooled,
- /// <summary>The requested buffer size was too large to be pooled.</summary>
- OverMaximumSize,
- /// <summary>The pool has already allocated for pooling as many buffers of a particular size as it's allowed.</summary>
- PoolExhausted
- }
-
- /// <summary>
- /// Event for when a buffer is rented. This is invoked once for every successful call to Rent,
- /// regardless of whether a buffer is allocated or a buffer is taken from the pool. In a
- /// perfect situation where all rented buffers are returned, we expect to see the number
- /// of BufferRented events exactly match the number of BuferReturned events, with the number
- /// of BufferAllocated events being less than or equal to those numbers (ideally significantly
- /// less than).
- /// </summary>
- [Event(1, Level = EventLevel.Verbose)]
- internal unsafe void BufferRented(int bufferId, int bufferSize, int poolId, int bucketId)
- {
- EventData* payload = stackalloc EventData[4];
- payload[0].Size = sizeof(int);
- payload[0].DataPointer = ((IntPtr)(&bufferId));
- payload[1].Size = sizeof(int);
- payload[1].DataPointer = ((IntPtr)(&bufferSize));
- payload[2].Size = sizeof(int);
- payload[2].DataPointer = ((IntPtr)(&poolId));
- payload[3].Size = sizeof(int);
- payload[3].DataPointer = ((IntPtr)(&bucketId));
- WriteEventCore(1, 4, payload);
- }
-
- /// <summary>
- /// Event for when a buffer is allocated by the pool. In an ideal situation, the number
- /// of BufferAllocated events is significantly smaller than the number of BufferRented and
- /// BufferReturned events.
- /// </summary>
- [Event(2, Level = EventLevel.Informational)]
- internal unsafe void BufferAllocated(int bufferId, int bufferSize, int poolId, int bucketId, BufferAllocatedReason reason)
- {
- EventData* payload = stackalloc EventData[5];
- payload[0].Size = sizeof(int);
- payload[0].DataPointer = ((IntPtr)(&bufferId));
- payload[1].Size = sizeof(int);
- payload[1].DataPointer = ((IntPtr)(&bufferSize));
- payload[2].Size = sizeof(int);
- payload[2].DataPointer = ((IntPtr)(&poolId));
- payload[3].Size = sizeof(int);
- payload[3].DataPointer = ((IntPtr)(&bucketId));
- payload[4].Size = sizeof(BufferAllocatedReason);
- payload[4].DataPointer = ((IntPtr)(&reason));
- WriteEventCore(2, 5, payload);
- }
-
- /// <summary>
- /// Event raised when a buffer is returned to the pool. This event is raised regardless of whether
- /// the returned buffer is stored or dropped. In an ideal situation, the number of BufferReturned
- /// events exactly matches the number of BufferRented events.
- /// </summary>
- [Event(3, Level = EventLevel.Verbose)]
- internal void BufferReturned(int bufferId, int bufferSize, int poolId) => WriteEvent(3, bufferId, bufferSize, poolId);
- }
-}
diff --git a/src/mscorlib/corefx/System/Buffers/ConfigurableArrayPool.cs b/src/mscorlib/corefx/System/Buffers/ConfigurableArrayPool.cs
deleted file mode 100644
index f7b6034d20..0000000000
--- a/src/mscorlib/corefx/System/Buffers/ConfigurableArrayPool.cs
+++ /dev/null
@@ -1,265 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Threading;
-
-namespace System.Buffers
-{
- internal sealed partial class ConfigurableArrayPool<T> : ArrayPool<T>
- {
- /// <summary>The default maximum length of each array in the pool (2^20).</summary>
- private const int DefaultMaxArrayLength = 1024 * 1024;
- /// <summary>The default maximum number of arrays per bucket that are available for rent.</summary>
- private const int DefaultMaxNumberOfArraysPerBucket = 50;
-
- private readonly Bucket[] _buckets;
-
- internal ConfigurableArrayPool() : this(DefaultMaxArrayLength, DefaultMaxNumberOfArraysPerBucket)
- {
- }
-
- internal ConfigurableArrayPool(int maxArrayLength, int maxArraysPerBucket)
- {
- if (maxArrayLength <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(maxArrayLength));
- }
- if (maxArraysPerBucket <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(maxArraysPerBucket));
- }
-
- // Our bucketing algorithm has a min length of 2^4 and a max length of 2^30.
- // Constrain the actual max used to those values.
- const int MinimumArrayLength = 0x10, MaximumArrayLength = 0x40000000;
- if (maxArrayLength > MaximumArrayLength)
- {
- maxArrayLength = MaximumArrayLength;
- }
- else if (maxArrayLength < MinimumArrayLength)
- {
- maxArrayLength = MinimumArrayLength;
- }
-
- // Create the buckets.
- int poolId = Id;
- int maxBuckets = Utilities.SelectBucketIndex(maxArrayLength);
- var buckets = new Bucket[maxBuckets + 1];
- for (int i = 0; i < buckets.Length; i++)
- {
- buckets[i] = new Bucket(Utilities.GetMaxSizeForBucket(i), maxArraysPerBucket, poolId);
- }
- _buckets = buckets;
- }
-
- /// <summary>Gets an ID for the pool to use with events.</summary>
- private int Id => GetHashCode();
-
- public override T[] Rent(int minimumLength)
- {
- // Arrays can't be smaller than zero. We allow requesting zero-length arrays (even though
- // pooling such an array isn't valuable) as it's a valid length array, and we want the pool
- // to be usable in general instead of using `new`, even for computed lengths.
- if (minimumLength < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(minimumLength));
- }
- else if (minimumLength == 0)
- {
- // No need for events with the empty array. Our pool is effectively infinite
- // and we'll never allocate for rents and never store for returns.
- return Array.Empty<T>();
- }
-
- var log = ArrayPoolEventSource.Log;
- T[] buffer = null;
-
- int index = Utilities.SelectBucketIndex(minimumLength);
- if (index < _buckets.Length)
- {
- // Search for an array starting at the 'index' bucket. If the bucket is empty, bump up to the
- // next higher bucket and try that one, but only try at most a few buckets.
- const int MaxBucketsToTry = 2;
- int i = index;
- do
- {
- // Attempt to rent from the bucket. If we get a buffer from it, return it.
- buffer = _buckets[i].Rent();
- if (buffer != null)
- {
- if (log.IsEnabled())
- {
- log.BufferRented(buffer.GetHashCode(), buffer.Length, Id, _buckets[i].Id);
- }
- return buffer;
- }
- }
- while (++i < _buckets.Length && i != index + MaxBucketsToTry);
-
- // The pool was exhausted for this buffer size. Allocate a new buffer with a size corresponding
- // to the appropriate bucket.
- buffer = new T[_buckets[index]._bufferLength];
- }
- else
- {
- // The request was for a size too large for the pool. Allocate an array of exactly the requested length.
- // When it's returned to the pool, we'll simply throw it away.
- buffer = new T[minimumLength];
- }
-
- if (log.IsEnabled())
- {
- int bufferId = buffer.GetHashCode(), bucketId = -1; // no bucket for an on-demand allocated buffer
- log.BufferRented(bufferId, buffer.Length, Id, bucketId);
- log.BufferAllocated(bufferId, buffer.Length, Id, bucketId, index >= _buckets.Length ?
- ArrayPoolEventSource.BufferAllocatedReason.OverMaximumSize : ArrayPoolEventSource.BufferAllocatedReason.PoolExhausted);
- }
-
- return buffer;
- }
-
- public override void Return(T[] array, bool clearArray = false)
- {
- if (array == null)
- {
- throw new ArgumentNullException(nameof(array));
- }
- else if (array.Length == 0)
- {
- // Ignore empty arrays. When a zero-length array is rented, we return a singleton
- // rather than actually taking a buffer out of the lowest bucket.
- return;
- }
-
- // Determine with what bucket this array length is associated
- int bucket = Utilities.SelectBucketIndex(array.Length);
-
- // If we can tell that the buffer was allocated, drop it. Otherwise, check if we have space in the pool
- if (bucket < _buckets.Length)
- {
- // Clear the array if the user requests
- if (clearArray)
- {
- Array.Clear(array, 0, array.Length);
- }
-
- // Return the buffer to its bucket. In the future, we might consider having Return return false
- // instead of dropping a bucket, in which case we could try to return to a lower-sized bucket,
- // just as how in Rent we allow renting from a higher-sized bucket.
- _buckets[bucket].Return(array);
- }
-
- // Log that the buffer was returned
- var log = ArrayPoolEventSource.Log;
- if (log.IsEnabled())
- {
- log.BufferReturned(array.GetHashCode(), array.Length, Id);
- }
- }
-
- /// <summary>Provides a thread-safe bucket containing buffers that can be Rent'd and Return'd.</summary>
- private sealed class Bucket
- {
- internal readonly int _bufferLength;
- private readonly T[][] _buffers;
- private readonly int _poolId;
-
- private SpinLock _lock; // do not make this readonly; it's a mutable struct
- private int _index;
-
- /// <summary>
- /// Creates the pool with numberOfBuffers arrays where each buffer is of bufferLength length.
- /// </summary>
- internal Bucket(int bufferLength, int numberOfBuffers, int poolId)
- {
- _lock = new SpinLock(Debugger.IsAttached); // only enable thread tracking if debugger is attached; it adds non-trivial overheads to Enter/Exit
- _buffers = new T[numberOfBuffers][];
- _bufferLength = bufferLength;
- _poolId = poolId;
- }
-
- /// <summary>Gets an ID for the bucket to use with events.</summary>
- internal int Id => GetHashCode();
-
- /// <summary>Takes an array from the bucket. If the bucket is empty, returns null.</summary>
- internal T[] Rent()
- {
- T[][] buffers = _buffers;
- T[] buffer = null;
-
- // While holding the lock, grab whatever is at the next available index and
- // update the index. We do as little work as possible while holding the spin
- // lock to minimize contention with other threads. The try/finally is
- // necessary to properly handle thread aborts on platforms which have them.
- bool lockTaken = false, allocateBuffer = false;
- try
- {
- _lock.Enter(ref lockTaken);
-
- if (_index < buffers.Length)
- {
- buffer = buffers[_index];
- buffers[_index++] = null;
- allocateBuffer = buffer == null;
- }
- }
- finally
- {
- if (lockTaken) _lock.Exit(false);
- }
-
- // While we were holding the lock, we grabbed whatever was at the next available index, if
- // there was one. If we tried and if we got back null, that means we hadn't yet allocated
- // for that slot, in which case we should do so now.
- if (allocateBuffer)
- {
- buffer = new T[_bufferLength];
-
- var log = ArrayPoolEventSource.Log;
- if (log.IsEnabled())
- {
- log.BufferAllocated(buffer.GetHashCode(), _bufferLength, _poolId, Id,
- ArrayPoolEventSource.BufferAllocatedReason.Pooled);
- }
- }
-
- return buffer;
- }
-
- /// <summary>
- /// Attempts to return the buffer to the bucket. If successful, the buffer will be stored
- /// in the bucket and true will be returned; otherwise, the buffer won't be stored, and false
- /// will be returned.
- /// </summary>
- internal void Return(T[] array)
- {
- // Check to see if the buffer is the correct size for this bucket
- if (array.Length != _bufferLength)
- {
- throw new ArgumentException(SR.ArgumentException_BufferNotFromPool, nameof(array));
- }
-
- // While holding the spin lock, if there's room available in the bucket,
- // put the buffer into the next available slot. Otherwise, we just drop it.
- // The try/finally is necessary to properly handle thread aborts on platforms
- // which have them.
- bool lockTaken = false;
- try
- {
- _lock.Enter(ref lockTaken);
-
- if (_index != 0)
- {
- _buffers[--_index] = array;
- }
- }
- finally
- {
- if (lockTaken) _lock.Exit(false);
- }
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs b/src/mscorlib/corefx/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs
deleted file mode 100644
index 64c5cebe85..0000000000
--- a/src/mscorlib/corefx/System/Buffers/TlsOverPerCoreLockedStacksArrayPool.cs
+++ /dev/null
@@ -1,292 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32;
-using System.Runtime.CompilerServices;
-using System.Threading;
-
-namespace System.Buffers
-{
- /// <summary>
- /// Provides an ArrayPool implementation meant to be used as the singleton returned from ArrayPool.Shared.
- /// </summary>
- /// <remarks>
- /// The implementation uses a tiered caching scheme, with a small per-thread cache for each array size, followed
- /// by a cache per array size shared by all threads, split into per-core stacks meant to be used by threads
- /// running on that core. Locks are used to protect each per-core stack, because a thread can migrate after
- /// checking its processor number, because multiple threads could interleave on the same core, and because
- /// a thread is allowed to check other core's buckets if its core's bucket is empty/full.
- /// </remarks>
- internal sealed partial class TlsOverPerCoreLockedStacksArrayPool<T> : ArrayPool<T>
- {
- // TODO: #7747: "Investigate optimizing ArrayPool heuristics"
- // - Explore caching in TLS more than one array per size per thread, and moving stale buffers to the global queue.
- // - Explore dumping stale buffers from the global queue, similar to PinnableBufferCache (maybe merging them).
- // - Explore changing the size of each per-core bucket, potentially dynamically or based on other factors like array size.
- // - Explore changing number of buckets and what sizes of arrays are cached.
- // - Investigate whether false sharing is causing any issues, in particular on LockedStack's count and the contents of its array.
- // ...
-
- /// <summary>The number of buckets (array sizes) in the pool, one for each array length, starting from length 16.</summary>
- private const int NumBuckets = 17; // Utilities.SelectBucketIndex(2*1024*1024)
- /// <summary>Maximum number of per-core stacks to use per array size.</summary>
- private const int MaxPerCorePerArraySizeStacks = 64; // selected to avoid needing to worry about processor groups
- /// <summary>The maximum number of buffers to store in a bucket's global queue.</summary>
- private const int MaxBuffersPerArraySizePerCore = 8;
-
- /// <summary>The length of arrays stored in the corresponding indices in <see cref="_buckets"/> and <see cref="t_tlsBuckets"/>.</summary>
- private readonly int[] _bucketArraySizes;
- /// <summary>
- /// An array of per-core array stacks. The slots are lazily initialized to avoid creating
- /// lots of overhead for unused array sizes.
- /// </summary>
- private readonly PerCoreLockedStacks[] _buckets = new PerCoreLockedStacks[NumBuckets];
- /// <summary>A per-thread array of arrays, to cache one array per array size per thread.</summary>
- [ThreadStatic]
- private static T[][] t_tlsBuckets;
-
- /// <summary>Initialize the pool.</summary>
- public TlsOverPerCoreLockedStacksArrayPool()
- {
- var sizes = new int[NumBuckets];
- for (int i = 0; i < sizes.Length; i++)
- {
- sizes[i] = Utilities.GetMaxSizeForBucket(i);
- }
- _bucketArraySizes = sizes;
- }
-
- /// <summary>Allocate a new PerCoreLockedStacks and try to store it into the <see cref="_buckets"/> array.</summary>
- private PerCoreLockedStacks CreatePerCoreLockedStacks(int bucketIndex)
- {
- var inst = new PerCoreLockedStacks();
- return Interlocked.CompareExchange(ref _buckets[bucketIndex], inst, null) ?? inst;
- }
-
- /// <summary>Gets an ID for the pool to use with events.</summary>
- private int Id => GetHashCode();
-
- public override T[] Rent(int minimumLength)
- {
- // Arrays can't be smaller than zero. We allow requesting zero-length arrays (even though
- // pooling such an array isn't valuable) as it's a valid length array, and we want the pool
- // to be usable in general instead of using `new`, even for computed lengths.
- if (minimumLength < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(minimumLength));
- }
- else if (minimumLength == 0)
- {
- // No need to log the empty array. Our pool is effectively infinite
- // and we'll never allocate for rents and never store for returns.
- return Array.Empty<T>();
- }
-
- ArrayPoolEventSource log = ArrayPoolEventSource.Log;
- T[] buffer;
-
- // Get the bucket number for the array length
- int bucketIndex = Utilities.SelectBucketIndex(minimumLength);
-
- // If the array could come from a bucket...
- if (bucketIndex < _buckets.Length)
- {
- // First try to get it from TLS if possible.
- T[][] tlsBuckets = t_tlsBuckets;
- if (tlsBuckets != null)
- {
- buffer = tlsBuckets[bucketIndex];
- if (buffer != null)
- {
- tlsBuckets[bucketIndex] = null;
- if (log.IsEnabled())
- {
- log.BufferRented(buffer.GetHashCode(), buffer.Length, Id, bucketIndex);
- }
- return buffer;
- }
- }
-
- // We couldn't get a buffer from TLS, so try the global stack.
- PerCoreLockedStacks b = _buckets[bucketIndex];
- if (b != null)
- {
- buffer = b.TryPop();
- if (buffer != null)
- {
- if (log.IsEnabled())
- {
- log.BufferRented(buffer.GetHashCode(), buffer.Length, Id, bucketIndex);
- }
- return buffer;
- }
- }
-
- // No buffer available. Allocate a new buffer with a size corresponding to the appropriate bucket.
- buffer = new T[_bucketArraySizes[bucketIndex]];
- }
- else
- {
- // The request was for a size too large for the pool. Allocate an array of exactly the requested length.
- // When it's returned to the pool, we'll simply throw it away.
- buffer = new T[minimumLength];
- }
-
- if (log.IsEnabled())
- {
- int bufferId = buffer.GetHashCode(), bucketId = -1; // no bucket for an on-demand allocated buffer
- log.BufferRented(bufferId, buffer.Length, Id, bucketId);
- log.BufferAllocated(bufferId, buffer.Length, Id, bucketId, bucketIndex >= _buckets.Length ?
- ArrayPoolEventSource.BufferAllocatedReason.OverMaximumSize :
- ArrayPoolEventSource.BufferAllocatedReason.PoolExhausted);
- }
-
- return buffer;
- }
-
- public override void Return(T[] array, bool clearArray = false)
- {
- if (array == null)
- {
- throw new ArgumentNullException(nameof(array));
- }
-
- // Determine with what bucket this array length is associated
- int bucketIndex = Utilities.SelectBucketIndex(array.Length);
-
- // If we can tell that the buffer was allocated (or empty), drop it. Otherwise, check if we have space in the pool.
- if (bucketIndex < _buckets.Length)
- {
- // Clear the array if the user requests.
- if (clearArray)
- {
- Array.Clear(array, 0, array.Length);
- }
-
- // Check to see if the buffer is the correct size for this bucket
- if (array.Length != _bucketArraySizes[bucketIndex])
- {
- throw new ArgumentException(SR.ArgumentException_BufferNotFromPool, nameof(array));
- }
-
- // Write through the TLS bucket. If there weren't any buckets, create them
- // and store this array into it. If there were, store this into it, and
- // if there was a previous one there, push that to the global stack. This
- // helps to keep LIFO access such that the most recently pushed stack will
- // be in TLS and the first to be popped next.
- T[][] tlsBuckets = t_tlsBuckets;
- if (tlsBuckets == null)
- {
- t_tlsBuckets = tlsBuckets = new T[NumBuckets][];
- tlsBuckets[bucketIndex] = array;
- }
- else
- {
- T[] prev = tlsBuckets[bucketIndex];
- tlsBuckets[bucketIndex] = array;
- if (prev != null)
- {
- PerCoreLockedStacks bucket = _buckets[bucketIndex] ?? CreatePerCoreLockedStacks(bucketIndex);
- bucket.TryPush(prev);
- }
- }
- }
-
- // Log that the buffer was returned
- ArrayPoolEventSource log = ArrayPoolEventSource.Log;
- if (log.IsEnabled())
- {
- log.BufferReturned(array.GetHashCode(), array.Length, Id);
- }
- }
-
- /// <summary>
- /// Stores a set of stacks of arrays, with one stack per core.
- /// </summary>
- private sealed class PerCoreLockedStacks
- {
- /// <summary>The stacks.</summary>
- private readonly LockedStack[] _perCoreStacks;
-
- /// <summary>Initializes the stacks.</summary>
- public PerCoreLockedStacks()
- {
- // Create the stacks. We create as many as there are processors, limited by our max.
- var stacks = new LockedStack[Math.Min(Environment.ProcessorCount, MaxPerCorePerArraySizeStacks)];
- for (int i = 0; i < stacks.Length; i++)
- {
- stacks[i] = new LockedStack();
- }
- _perCoreStacks = stacks;
- }
-
- /// <summary>Try to push the array into the stacks. If each is full when it's tested, the array will be dropped.</summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void TryPush(T[] array)
- {
- // Try to push on to the associated stack first. If that fails,
- // round-robin through the other stacks.
- LockedStack[] stacks = _perCoreStacks;
- int index = Environment.CurrentExecutionId % stacks.Length;
- for (int i = 0; i < stacks.Length; i++)
- {
- if (stacks[index].TryPush(array)) return;
- if (++index == stacks.Length) index = 0;
- }
- }
-
- /// <summary>Try to get an array from the stacks. If each is empty when it's tested, null will be returned.</summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public T[] TryPop()
- {
- // Try to pop from the associated stack first. If that fails,
- // round-robin through the other stacks.
- T[] arr;
- LockedStack[] stacks = _perCoreStacks;
- int index = Environment.CurrentExecutionId % stacks.Length;
- for (int i = 0; i < stacks.Length; i++)
- {
- if ((arr = stacks[index].TryPop()) != null) return arr;
- if (++index == stacks.Length) index = 0;
- }
- return null;
- }
- }
-
- /// <summary>Provides a simple stack of arrays, protected by a lock.</summary>
- private sealed class LockedStack
- {
- private readonly T[][] _arrays = new T[MaxBuffersPerArraySizePerCore][];
- private int _count;
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public bool TryPush(T[] array)
- {
- bool enqueued = false;
- Monitor.Enter(this);
- if (_count < MaxBuffersPerArraySizePerCore)
- {
- _arrays[_count++] = array;
- enqueued = true;
- }
- Monitor.Exit(this);
- return enqueued;
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public T[] TryPop()
- {
- T[] arr = null;
- Monitor.Enter(this);
- if (_count > 0)
- {
- arr = _arrays[--_count];
- _arrays[_count] = null;
- }
- Monitor.Exit(this);
- return arr;
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Buffers/Utilities.cs b/src/mscorlib/corefx/System/Buffers/Utilities.cs
deleted file mode 100644
index 823299f5fc..0000000000
--- a/src/mscorlib/corefx/System/Buffers/Utilities.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-
-namespace System.Buffers
-{
- internal static class Utilities
- {
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static int SelectBucketIndex(int bufferSize)
- {
- uint bitsRemaining = ((uint)bufferSize - 1) >> 4;
-
- int poolIndex = 0;
- if (bitsRemaining > 0xFFFF) { bitsRemaining >>= 16; poolIndex = 16; }
- if (bitsRemaining > 0xFF) { bitsRemaining >>= 8; poolIndex += 8; }
- if (bitsRemaining > 0xF) { bitsRemaining >>= 4; poolIndex += 4; }
- if (bitsRemaining > 0x3) { bitsRemaining >>= 2; poolIndex += 2; }
- if (bitsRemaining > 0x1) { bitsRemaining >>= 1; poolIndex += 1; }
-
- return poolIndex + (int)bitsRemaining;
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static int GetMaxSizeForBucket(int binIndex)
- {
- int maxSize = 16 << binIndex;
- Debug.Assert(maxSize >= 0);
- return maxSize;
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/Calendar.cs b/src/mscorlib/corefx/System/Globalization/Calendar.cs
deleted file mode 100644
index 0ff5040c74..0000000000
--- a/src/mscorlib/corefx/System/Globalization/Calendar.cs
+++ /dev/null
@@ -1,859 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
-
-namespace System.Globalization
-{
- // This abstract class represents a calendar. A calendar reckons time in
- // divisions such as weeks, months and years. The number, length and start of
- // the divisions vary in each calendar.
- //
- // Any instant in time can be represented as an n-tuple of numeric values using
- // a particular calendar. For example, the next vernal equinox occurs at (0.0, 0
- // , 46, 8, 20, 3, 1999) in the Gregorian calendar. An implementation of
- // Calendar can map any DateTime value to such an n-tuple and vice versa. The
- // DateTimeFormat class can map between such n-tuples and a textual
- // representation such as "8:46 AM March 20th 1999 AD".
- //
- // Most calendars identify a year which begins the current era. There may be any
- // number of previous eras. The Calendar class identifies the eras as enumerated
- // integers where the current era (CurrentEra) has the value zero.
- //
- // For consistency, the first unit in each interval, e.g. the first month, is
- // assigned the value one.
- // The calculation of hour/minute/second is moved to Calendar from GregorianCalendar,
- // since most of the calendars (or all?) have the same way of calcuating hour/minute/second.
-
- [Serializable]
- public abstract partial class Calendar : ICloneable
- {
- // Number of 100ns (10E-7 second) ticks per time unit
- internal const long TicksPerMillisecond = 10000;
- internal const long TicksPerSecond = TicksPerMillisecond * 1000;
- internal const long TicksPerMinute = TicksPerSecond * 60;
- internal const long TicksPerHour = TicksPerMinute * 60;
- internal const long TicksPerDay = TicksPerHour * 24;
-
- // Number of milliseconds per time unit
- internal const int MillisPerSecond = 1000;
- internal const int MillisPerMinute = MillisPerSecond * 60;
- internal const int MillisPerHour = MillisPerMinute * 60;
- internal const int MillisPerDay = MillisPerHour * 24;
-
- // Number of days in a non-leap year
- internal const int DaysPerYear = 365;
- // Number of days in 4 years
- internal const int DaysPer4Years = DaysPerYear * 4 + 1;
- // Number of days in 100 years
- internal const int DaysPer100Years = DaysPer4Years * 25 - 1;
- // Number of days in 400 years
- internal const int DaysPer400Years = DaysPer100Years * 4 + 1;
-
- // Number of days from 1/1/0001 to 1/1/10000
- internal const int DaysTo10000 = DaysPer400Years * 25 - 366;
-
- internal const long MaxMillis = (long)DaysTo10000 * MillisPerDay;
-
-
- private int _currentEraValue = -1;
-
- [OptionalField(VersionAdded = 2)]
- private bool _isReadOnly = false;
-
-#if INSIDE_CLR
- internal const CalendarId CAL_HEBREW = CalendarId.HEBREW;
- internal const CalendarId CAL_HIJRI = CalendarId.HIJRI;
- internal const CalendarId CAL_JAPAN = CalendarId.JAPAN;
- internal const CalendarId CAL_JULIAN = CalendarId.JULIAN;
- internal const CalendarId CAL_TAIWAN = CalendarId.TAIWAN;
- internal const CalendarId CAL_UMALQURA = CalendarId.UMALQURA;
- internal const CalendarId CAL_PERSIAN = CalendarId.PERSIAN;
-#endif
-
- // The minimum supported DateTime range for the calendar.
-
- public virtual DateTime MinSupportedDateTime
- {
- get
- {
- return (DateTime.MinValue);
- }
- }
-
- // The maximum supported DateTime range for the calendar.
-
- public virtual DateTime MaxSupportedDateTime
- {
- get
- {
- return (DateTime.MaxValue);
- }
- }
-
- public virtual CalendarAlgorithmType AlgorithmType
- {
- get
- {
- return CalendarAlgorithmType.Unknown;
- }
- }
-
- protected Calendar()
- {
- //Do-nothing constructor.
- }
-
- ///
- // This can not be abstract, otherwise no one can create a subclass of Calendar.
- //
- internal virtual CalendarId ID
- {
- get
- {
- return CalendarId.UNINITIALIZED_VALUE;
- }
- }
-
- ///
- // Return the Base calendar ID for calendars that didn't have defined data in calendarData
- //
-
- internal virtual CalendarId BaseCalendarID
- {
- get { return ID; }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // IsReadOnly
- //
- // Detect if the object is readonly.
- //
- ////////////////////////////////////////////////////////////////////////
- public bool IsReadOnly
- {
- get { return (_isReadOnly); }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Clone
- //
- // Is the implementation of ICloneable.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual object Clone()
- {
- object o = MemberwiseClone();
- ((Calendar)o).SetReadOnlyState(false);
- return (o);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ReadOnly
- //
- // Create a cloned readonly instance or return the input one if it is
- // readonly.
- //
- ////////////////////////////////////////////////////////////////////////
- public static Calendar ReadOnly(Calendar calendar)
- {
- if (calendar == null) { throw new ArgumentNullException(nameof(calendar)); }
- Contract.EndContractBlock();
- if (calendar.IsReadOnly) { return (calendar); }
-
- Calendar clonedCalendar = (Calendar)(calendar.MemberwiseClone());
- clonedCalendar.SetReadOnlyState(true);
-
- return (clonedCalendar);
- }
-
- internal void VerifyWritable()
- {
- if (_isReadOnly)
- {
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- }
- }
-
- internal void SetReadOnlyState(bool readOnly)
- {
- _isReadOnly = readOnly;
- }
-
-
- /*=================================CurrentEraValue==========================
- **Action: This is used to convert CurretEra(0) to an appropriate era value.
- **Returns:
- **Arguments:
- **Exceptions:
- **Notes:
- ** The value is from calendar.nlp.
- ============================================================================*/
-
- internal virtual int CurrentEraValue
- {
- get
- {
- // The following code assumes that the current era value can not be -1.
- if (_currentEraValue == -1)
- {
- Debug.Assert(BaseCalendarID != CalendarId.UNINITIALIZED_VALUE, "[Calendar.CurrentEraValue] Expected a real calendar ID");
- _currentEraValue = CalendarData.GetCalendarData(BaseCalendarID).iCurrentEra;
- }
- return (_currentEraValue);
- }
- }
-
- // The current era for a calendar.
-
- public const int CurrentEra = 0;
-
- internal int twoDigitYearMax = -1;
-
- internal static void CheckAddResult(long ticks, DateTime minValue, DateTime maxValue)
- {
- if (ticks < minValue.Ticks || ticks > maxValue.Ticks)
- {
- throw new ArgumentException(
- String.Format(CultureInfo.InvariantCulture, SR.Format(SR.Argument_ResultCalendarRange,
- minValue, maxValue)));
- }
- Contract.EndContractBlock();
- }
-
- internal DateTime Add(DateTime time, double value, int scale)
- {
- // From ECMA CLI spec, Partition III, section 3.27:
- //
- // If overflow occurs converting a floating-point type to an integer, or if the floating-point value
- // being converted to an integer is a NaN, the value returned is unspecified.
- //
- // Based upon this, this method should be performing the comparison against the double
- // before attempting a cast. Otherwise, the result is undefined.
- double tempMillis = (value * scale + (value >= 0 ? 0.5 : -0.5));
- if (!((tempMillis > -(double)MaxMillis) && (tempMillis < (double)MaxMillis)))
- {
- throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_AddValue);
- }
-
- long millis = (long)tempMillis;
- long ticks = time.Ticks + millis * TicksPerMillisecond;
- CheckAddResult(ticks, MinSupportedDateTime, MaxSupportedDateTime);
- return (new DateTime(ticks));
- }
-
- // Returns the DateTime resulting from adding the given number of
- // milliseconds to the specified DateTime. The result is computed by rounding
- // the number of milliseconds given by value to the nearest integer,
- // and adding that interval to the specified DateTime. The value
- // argument is permitted to be negative.
- //
-
- public virtual DateTime AddMilliseconds(DateTime time, double milliseconds)
- {
- return (Add(time, milliseconds, 1));
- }
-
-
- // Returns the DateTime resulting from adding a fractional number of
- // days to the specified DateTime. The result is computed by rounding the
- // fractional number of days given by value to the nearest
- // millisecond, and adding that interval to the specified DateTime. The
- // value argument is permitted to be negative.
- //
-
- public virtual DateTime AddDays(DateTime time, int days)
- {
- return (Add(time, days, MillisPerDay));
- }
-
- // Returns the DateTime resulting from adding a fractional number of
- // hours to the specified DateTime. The result is computed by rounding the
- // fractional number of hours given by value to the nearest
- // millisecond, and adding that interval to the specified DateTime. The
- // value argument is permitted to be negative.
- //
-
- public virtual DateTime AddHours(DateTime time, int hours)
- {
- return (Add(time, hours, MillisPerHour));
- }
-
-
- // Returns the DateTime resulting from adding a fractional number of
- // minutes to the specified DateTime. The result is computed by rounding the
- // fractional number of minutes given by value to the nearest
- // millisecond, and adding that interval to the specified DateTime. The
- // value argument is permitted to be negative.
- //
-
- public virtual DateTime AddMinutes(DateTime time, int minutes)
- {
- return (Add(time, minutes, MillisPerMinute));
- }
-
-
- // Returns the DateTime resulting from adding the given number of
- // months to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year and month parts of the specified DateTime by
- // value months, and, if required, adjusting the day part of the
- // resulting date downwards to the last day of the resulting month in the
- // resulting year. The time-of-day part of the result is the same as the
- // time-of-day part of the specified DateTime.
- //
- // In more precise terms, considering the specified DateTime to be of the
- // form y / m / d + t, where y is the
- // year, m is the month, d is the day, and t is the
- // time-of-day, the result is y1 / m1 / d1 + t,
- // where y1 and m1 are computed by adding value months
- // to y and m, and d1 is the largest value less than
- // or equal to d that denotes a valid day in month m1 of year
- // y1.
- //
-
- public abstract DateTime AddMonths(DateTime time, int months);
-
- // Returns the DateTime resulting from adding a number of
- // seconds to the specified DateTime. The result is computed by rounding the
- // fractional number of seconds given by value to the nearest
- // millisecond, and adding that interval to the specified DateTime. The
- // value argument is permitted to be negative.
- //
-
- public virtual DateTime AddSeconds(DateTime time, int seconds)
- {
- return Add(time, seconds, MillisPerSecond);
- }
-
- // Returns the DateTime resulting from adding a number of
- // weeks to the specified DateTime. The
- // value argument is permitted to be negative.
- //
-
- public virtual DateTime AddWeeks(DateTime time, int weeks)
- {
- return (AddDays(time, weeks * 7));
- }
-
-
- // Returns the DateTime resulting from adding the given number of
- // years to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year part of the specified DateTime by value
- // years. If the month and day of the specified DateTime is 2/29, and if the
- // resulting year is not a leap year, the month and day of the resulting
- // DateTime becomes 2/28. Otherwise, the month, day, and time-of-day
- // parts of the result are the same as those of the specified DateTime.
- //
-
- public abstract DateTime AddYears(DateTime time, int years);
-
- // Returns the day-of-month part of the specified DateTime. The returned
- // value is an integer between 1 and 31.
- //
-
- public abstract int GetDayOfMonth(DateTime time);
-
- // Returns the day-of-week part of the specified DateTime. The returned value
- // is an integer between 0 and 6, where 0 indicates Sunday, 1 indicates
- // Monday, 2 indicates Tuesday, 3 indicates Wednesday, 4 indicates
- // Thursday, 5 indicates Friday, and 6 indicates Saturday.
- //
-
- public abstract DayOfWeek GetDayOfWeek(DateTime time);
-
- // Returns the day-of-year part of the specified DateTime. The returned value
- // is an integer between 1 and 366.
- //
-
- public abstract int GetDayOfYear(DateTime time);
-
- // Returns the number of days in the month given by the year and
- // month arguments.
- //
-
- public virtual int GetDaysInMonth(int year, int month)
- {
- return (GetDaysInMonth(year, month, CurrentEra));
- }
-
- // Returns the number of days in the month given by the year and
- // month arguments for the specified era.
- //
-
- public abstract int GetDaysInMonth(int year, int month, int era);
-
- // Returns the number of days in the year given by the year argument for the current era.
- //
-
- public virtual int GetDaysInYear(int year)
- {
- return (GetDaysInYear(year, CurrentEra));
- }
-
- // Returns the number of days in the year given by the year argument for the current era.
- //
-
- public abstract int GetDaysInYear(int year, int era);
-
- // Returns the era for the specified DateTime value.
-
- public abstract int GetEra(DateTime time);
-
- /*=================================Eras==========================
- **Action: Get the list of era values.
- **Returns: The int array of the era names supported in this calendar.
- ** null if era is not used.
- **Arguments: None.
- **Exceptions: None.
- ============================================================================*/
-
-
- public abstract int[] Eras
- {
- get;
- }
-
-
- // Returns the hour part of the specified DateTime. The returned value is an
- // integer between 0 and 23.
- //
-
- public virtual int GetHour(DateTime time)
- {
- return ((int)((time.Ticks / TicksPerHour) % 24));
- }
-
- // Returns the millisecond part of the specified DateTime. The returned value
- // is an integer between 0 and 999.
- //
-
- public virtual double GetMilliseconds(DateTime time)
- {
- return (double)((time.Ticks / TicksPerMillisecond) % 1000);
- }
-
- // Returns the minute part of the specified DateTime. The returned value is
- // an integer between 0 and 59.
- //
-
- public virtual int GetMinute(DateTime time)
- {
- return ((int)((time.Ticks / TicksPerMinute) % 60));
- }
-
- // Returns the month part of the specified DateTime. The returned value is an
- // integer between 1 and 12.
- //
-
- public abstract int GetMonth(DateTime time);
-
- // Returns the number of months in the specified year in the current era.
-
- public virtual int GetMonthsInYear(int year)
- {
- return (GetMonthsInYear(year, CurrentEra));
- }
-
- // Returns the number of months in the specified year and era.
-
- public abstract int GetMonthsInYear(int year, int era);
-
- // Returns the second part of the specified DateTime. The returned value is
- // an integer between 0 and 59.
- //
-
- public virtual int GetSecond(DateTime time)
- {
- return ((int)((time.Ticks / TicksPerSecond) % 60));
- }
-
- /*=================================GetFirstDayWeekOfYear==========================
- **Action: Get the week of year using the FirstDay rule.
- **Returns: the week of year.
- **Arguments:
- ** time
- ** firstDayOfWeek the first day of week (0=Sunday, 1=Monday, ... 6=Saturday)
- **Notes:
- ** The CalendarWeekRule.FirstDay rule: Week 1 begins on the first day of the year.
- ** Assume f is the specifed firstDayOfWeek,
- ** and n is the day of week for January 1 of the specified year.
- ** Assign offset = n - f;
- ** Case 1: offset = 0
- ** E.g.
- ** f=1
- ** weekday 0 1 2 3 4 5 6 0 1
- ** date 1/1
- ** week# 1 2
- ** then week of year = (GetDayOfYear(time) - 1) / 7 + 1
- **
- ** Case 2: offset < 0
- ** e.g.
- ** n=1 f=3
- ** weekday 0 1 2 3 4 5 6 0
- ** date 1/1
- ** week# 1 2
- ** This means that the first week actually starts 5 days before 1/1.
- ** So week of year = (GetDayOfYear(time) + (7 + offset) - 1) / 7 + 1
- ** Case 3: offset > 0
- ** e.g.
- ** f=0 n=2
- ** weekday 0 1 2 3 4 5 6 0 1 2
- ** date 1/1
- ** week# 1 2
- ** This means that the first week actually starts 2 days before 1/1.
- ** So Week of year = (GetDayOfYear(time) + offset - 1) / 7 + 1
- ============================================================================*/
-
- internal int GetFirstDayWeekOfYear(DateTime time, int firstDayOfWeek)
- {
- int dayOfYear = GetDayOfYear(time) - 1; // Make the day of year to be 0-based, so that 1/1 is day 0.
- // Calculate the day of week for the first day of the year.
- // dayOfWeek - (dayOfYear % 7) is the day of week for the first day of this year. Note that
- // this value can be less than 0. It's fine since we are making it positive again in calculating offset.
- int dayForJan1 = (int)GetDayOfWeek(time) - (dayOfYear % 7);
- int offset = (dayForJan1 - firstDayOfWeek + 14) % 7;
- Debug.Assert(offset >= 0, "Calendar.GetFirstDayWeekOfYear(): offset >= 0");
- return ((dayOfYear + offset) / 7 + 1);
- }
-
- private int GetWeekOfYearFullDays(DateTime time, int firstDayOfWeek, int fullDays)
- {
- int dayForJan1;
- int offset;
- int day;
-
- int dayOfYear = GetDayOfYear(time) - 1; // Make the day of year to be 0-based, so that 1/1 is day 0.
- //
- // Calculate the number of days between the first day of year (1/1) and the first day of the week.
- // This value will be a positive value from 0 ~ 6. We call this value as "offset".
- //
- // If offset is 0, it means that the 1/1 is the start of the first week.
- // Assume the first day of the week is Monday, it will look like this:
- // Sun Mon Tue Wed Thu Fri Sat
- // 12/31 1/1 1/2 1/3 1/4 1/5 1/6
- // +--> First week starts here.
- //
- // If offset is 1, it means that the first day of the week is 1 day ahead of 1/1.
- // Assume the first day of the week is Monday, it will look like this:
- // Sun Mon Tue Wed Thu Fri Sat
- // 1/1 1/2 1/3 1/4 1/5 1/6 1/7
- // +--> First week starts here.
- //
- // If offset is 2, it means that the first day of the week is 2 days ahead of 1/1.
- // Assume the first day of the week is Monday, it will look like this:
- // Sat Sun Mon Tue Wed Thu Fri Sat
- // 1/1 1/2 1/3 1/4 1/5 1/6 1/7 1/8
- // +--> First week starts here.
-
-
-
- // Day of week is 0-based.
- // Get the day of week for 1/1. This can be derived from the day of week of the target day.
- // Note that we can get a negative value. It's ok since we are going to make it a positive value when calculating the offset.
- dayForJan1 = (int)GetDayOfWeek(time) - (dayOfYear % 7);
-
- // Now, calculate the offset. Subtract the first day of week from the dayForJan1. And make it a positive value.
- offset = (firstDayOfWeek - dayForJan1 + 14) % 7;
- if (offset != 0 && offset >= fullDays)
- {
- //
- // If the offset is greater than the value of fullDays, it means that
- // the first week of the year starts on the week where Jan/1 falls on.
- //
- offset -= 7;
- }
- //
- // Calculate the day of year for specified time by taking offset into account.
- //
- day = dayOfYear - offset;
- if (day >= 0)
- {
- //
- // If the day of year value is greater than zero, get the week of year.
- //
- return (day / 7 + 1);
- }
- //
- // Otherwise, the specified time falls on the week of previous year.
- // Call this method again by passing the last day of previous year.
- //
- // the last day of the previous year may "underflow" to no longer be a valid date time for
- // this calendar if we just subtract so we need the subclass to provide us with
- // that information
- if (time <= MinSupportedDateTime.AddDays(dayOfYear))
- {
- return GetWeekOfYearOfMinSupportedDateTime(firstDayOfWeek, fullDays);
- }
- return (GetWeekOfYearFullDays(time.AddDays(-(dayOfYear + 1)), firstDayOfWeek, fullDays));
- }
-
- private int GetWeekOfYearOfMinSupportedDateTime(int firstDayOfWeek, int minimumDaysInFirstWeek)
- {
- int dayOfYear = GetDayOfYear(MinSupportedDateTime) - 1; // Make the day of year to be 0-based, so that 1/1 is day 0.
- int dayOfWeekOfFirstOfYear = (int)GetDayOfWeek(MinSupportedDateTime) - dayOfYear % 7;
-
- // Calculate the offset (how many days from the start of the year to the start of the week)
- int offset = (firstDayOfWeek + 7 - dayOfWeekOfFirstOfYear) % 7;
- if (offset == 0 || offset >= minimumDaysInFirstWeek)
- {
- // First of year falls in the first week of the year
- return 1;
- }
-
- int daysInYearBeforeMinSupportedYear = DaysInYearBeforeMinSupportedYear - 1; // Make the day of year to be 0-based, so that 1/1 is day 0.
- int dayOfWeekOfFirstOfPreviousYear = dayOfWeekOfFirstOfYear - 1 - (daysInYearBeforeMinSupportedYear % 7);
-
- // starting from first day of the year, how many days do you have to go forward
- // before getting to the first day of the week?
- int daysInInitialPartialWeek = (firstDayOfWeek - dayOfWeekOfFirstOfPreviousYear + 14) % 7;
- int day = daysInYearBeforeMinSupportedYear - daysInInitialPartialWeek;
- if (daysInInitialPartialWeek >= minimumDaysInFirstWeek)
- {
- // If the offset is greater than the minimum Days in the first week, it means that
- // First of year is part of the first week of the year even though it is only a partial week
- // add another week
- day += 7;
- }
-
- return (day / 7 + 1);
- }
-
- // it would be nice to make this abstract but we can't since that would break previous implementations
- protected virtual int DaysInYearBeforeMinSupportedYear
- {
- get
- {
- return 365;
- }
- }
-
-
- // Returns the week of year for the specified DateTime. The returned value is an
- // integer between 1 and 53.
- //
-
- public virtual int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
- {
- if ((int)firstDayOfWeek < 0 || (int)firstDayOfWeek > 6)
- {
- throw new ArgumentOutOfRangeException(
- nameof(firstDayOfWeek), SR.Format(SR.ArgumentOutOfRange_Range,
- DayOfWeek.Sunday, DayOfWeek.Saturday));
- }
- Contract.EndContractBlock();
- switch (rule)
- {
- case CalendarWeekRule.FirstDay:
- return (GetFirstDayWeekOfYear(time, (int)firstDayOfWeek));
- case CalendarWeekRule.FirstFullWeek:
- return (GetWeekOfYearFullDays(time, (int)firstDayOfWeek, 7));
- case CalendarWeekRule.FirstFourDayWeek:
- return (GetWeekOfYearFullDays(time, (int)firstDayOfWeek, 4));
- }
- throw new ArgumentOutOfRangeException(
- nameof(rule), SR.Format(SR.ArgumentOutOfRange_Range,
- CalendarWeekRule.FirstDay, CalendarWeekRule.FirstFourDayWeek));
- }
-
- // Returns the year part of the specified DateTime. The returned value is an
- // integer between 1 and 9999.
- //
-
- public abstract int GetYear(DateTime time);
-
- // Checks whether a given day in the current era is a leap day. This method returns true if
- // the date is a leap day, or false if not.
- //
-
- public virtual bool IsLeapDay(int year, int month, int day)
- {
- return (IsLeapDay(year, month, day, CurrentEra));
- }
-
- // Checks whether a given day in the specified era is a leap day. This method returns true if
- // the date is a leap day, or false if not.
- //
-
- public abstract bool IsLeapDay(int year, int month, int day, int era);
-
- // Checks whether a given month in the current era is a leap month. This method returns true if
- // month is a leap month, or false if not.
- //
-
- public virtual bool IsLeapMonth(int year, int month)
- {
- return (IsLeapMonth(year, month, CurrentEra));
- }
-
- // Checks whether a given month in the specified era is a leap month. This method returns true if
- // month is a leap month, or false if not.
- //
-
- public abstract bool IsLeapMonth(int year, int month, int era);
-
- // Returns the leap month in a calendar year of the current era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
-
- public virtual int GetLeapMonth(int year)
- {
- return (GetLeapMonth(year, CurrentEra));
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
-
- public virtual int GetLeapMonth(int year, int era)
- {
- if (!IsLeapYear(year, era))
- return 0;
-
- int monthsCount = GetMonthsInYear(year, era);
- for (int month = 1; month <= monthsCount; month++)
- {
- if (IsLeapMonth(year, month, era))
- return month;
- }
-
- return 0;
- }
-
- // Checks whether a given year in the current era is a leap year. This method returns true if
- // year is a leap year, or false if not.
- //
-
- public virtual bool IsLeapYear(int year)
- {
- return (IsLeapYear(year, CurrentEra));
- }
-
- // Checks whether a given year in the specified era is a leap year. This method returns true if
- // year is a leap year, or false if not.
- //
-
- public abstract bool IsLeapYear(int year, int era);
-
- // Returns the date and time converted to a DateTime value. Throws an exception if the n-tuple is invalid.
- //
-
- public virtual DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond)
- {
- return (ToDateTime(year, month, day, hour, minute, second, millisecond, CurrentEra));
- }
-
- // Returns the date and time converted to a DateTime value. Throws an exception if the n-tuple is invalid.
- //
-
- public abstract DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era);
-
- internal virtual Boolean TryToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era, out DateTime result)
- {
- result = DateTime.MinValue;
- try
- {
- result = ToDateTime(year, month, day, hour, minute, second, millisecond, era);
- return true;
- }
- catch (ArgumentException)
- {
- return false;
- }
- }
-
- internal virtual bool IsValidYear(int year, int era)
- {
- return (year >= GetYear(MinSupportedDateTime) && year <= GetYear(MaxSupportedDateTime));
- }
-
- internal virtual bool IsValidMonth(int year, int month, int era)
- {
- return (IsValidYear(year, era) && month >= 1 && month <= GetMonthsInYear(year, era));
- }
-
- internal virtual bool IsValidDay(int year, int month, int day, int era)
- {
- return (IsValidMonth(year, month, era) && day >= 1 && day <= GetDaysInMonth(year, month, era));
- }
-
-
- // Returns and assigns the maximum value to represent a two digit year. This
- // value is the upper boundary of a 100 year range that allows a two digit year
- // to be properly translated to a four digit year. For example, if 2029 is the
- // upper boundary, then a two digit value of 30 should be interpreted as 1930
- // while a two digit value of 29 should be interpreted as 2029. In this example
- // , the 100 year range would be from 1930-2029. See ToFourDigitYear().
-
- public virtual int TwoDigitYearMax
- {
- get
- {
- return (twoDigitYearMax);
- }
-
- set
- {
- VerifyWritable();
- twoDigitYearMax = value;
- }
- }
-
- // Converts the year value to the appropriate century by using the
- // TwoDigitYearMax property. For example, if the TwoDigitYearMax value is 2029,
- // then a two digit value of 30 will get converted to 1930 while a two digit
- // value of 29 will get converted to 2029.
-
- public virtual int ToFourDigitYear(int year)
- {
- if (year < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedNonNegNum);
- }
- Contract.EndContractBlock();
- if (year < 100)
- {
- return ((TwoDigitYearMax / 100 - (year > TwoDigitYearMax % 100 ? 1 : 0)) * 100 + year);
- }
- // If the year value is above 100, just return the year value. Don't have to do
- // the TwoDigitYearMax comparison.
- return (year);
- }
-
- // Return the tick count corresponding to the given hour, minute, second.
- // Will check the if the parameters are valid.
- internal static long TimeToTicks(int hour, int minute, int second, int millisecond)
- {
- if (hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >= 0 && second < 60)
- {
- if (millisecond < 0 || millisecond >= MillisPerSecond)
- {
- throw new ArgumentOutOfRangeException(
- nameof(millisecond),
- String.Format(
- CultureInfo.InvariantCulture,
- SR.Format(SR.ArgumentOutOfRange_Range, 0, MillisPerSecond - 1)));
- }
- return InternalGloablizationHelper.TimeToTicks(hour, minute, second) + millisecond * TicksPerMillisecond;
- }
- throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadHourMinuteSecond);
- }
-
- internal static int GetSystemTwoDigitYearSetting(CalendarId CalID, int defaultYearValue)
- {
- // Call nativeGetTwoDigitYearMax
- int twoDigitYearMax = CalendarData.GetTwoDigitYearMax(CalID);
- if (twoDigitYearMax < 0)
- {
- twoDigitYearMax = defaultYearValue;
- }
- return (twoDigitYearMax);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CalendarAlgorithmType.cs b/src/mscorlib/corefx/System/Globalization/CalendarAlgorithmType.cs
deleted file mode 100644
index 159b0e6f77..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CalendarAlgorithmType.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-
-namespace System.Globalization
-{
- public enum CalendarAlgorithmType
- {
- Unknown = 0, // This is the default value to return in the Calendar base class.
- SolarCalendar = 1, // Solar-base calendar, such as GregorianCalendar, jaoaneseCalendar, JulianCalendar, etc.
- // Solar calendars are based on the solar year and seasons.
- LunarCalendar = 2, // Lunar-based calendar, such as Hijri and UmAlQuraCalendar.
- // Lunar calendars are based on the path of the moon. The seasons are not accurately represented.
- LunisolarCalendar = 3 // Lunisolar-based calendar which use leap month rule, such as HebrewCalendar and Asian Lunisolar calendars.
- // Lunisolar calendars are based on the cycle of the moon, but consider the seasons as a secondary consideration,
- // so they align with the seasons as well as lunar events.
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CalendarData.Unix.cs b/src/mscorlib/corefx/System/Globalization/CalendarData.Unix.cs
deleted file mode 100644
index 19c81f17b0..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CalendarData.Unix.cs
+++ /dev/null
@@ -1,335 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-using System.Runtime.InteropServices;
-using System.Security;
-using System.Text;
-
-namespace System.Globalization
-{
- // needs to be kept in sync with CalendarDataType in System.Globalization.Native
- internal enum CalendarDataType
- {
- Uninitialized = 0,
- NativeName = 1,
- MonthDay = 2,
- ShortDates = 3,
- LongDates = 4,
- YearMonths = 5,
- DayNames = 6,
- AbbrevDayNames = 7,
- MonthNames = 8,
- AbbrevMonthNames = 9,
- SuperShortDayNames = 10,
- MonthGenitiveNames = 11,
- AbbrevMonthGenitiveNames = 12,
- EraNames = 13,
- AbbrevEraNames = 14,
- }
-
- internal partial class CalendarData
- {
- private bool LoadCalendarDataFromSystem(String localeName, CalendarId calendarId)
- {
- bool result = true;
- result &= GetCalendarInfo(localeName, calendarId, CalendarDataType.NativeName, out this.sNativeName);
- result &= GetCalendarInfo(localeName, calendarId, CalendarDataType.MonthDay, out this.sMonthDay);
- this.sMonthDay = NormalizeDatePattern(this.sMonthDay);
-
- result &= EnumDatePatterns(localeName, calendarId, CalendarDataType.ShortDates, out this.saShortDates);
- result &= EnumDatePatterns(localeName, calendarId, CalendarDataType.LongDates, out this.saLongDates);
- result &= EnumDatePatterns(localeName, calendarId, CalendarDataType.YearMonths, out this.saYearMonths);
- result &= EnumCalendarInfo(localeName, calendarId, CalendarDataType.DayNames, out this.saDayNames);
- result &= EnumCalendarInfo(localeName, calendarId, CalendarDataType.AbbrevDayNames, out this.saAbbrevDayNames);
- result &= EnumCalendarInfo(localeName, calendarId, CalendarDataType.SuperShortDayNames, out this.saSuperShortDayNames);
- result &= EnumMonthNames(localeName, calendarId, CalendarDataType.MonthNames, out this.saMonthNames);
- result &= EnumMonthNames(localeName, calendarId, CalendarDataType.AbbrevMonthNames, out this.saAbbrevMonthNames);
- result &= EnumMonthNames(localeName, calendarId, CalendarDataType.MonthGenitiveNames, out this.saMonthGenitiveNames);
- result &= EnumMonthNames(localeName, calendarId, CalendarDataType.AbbrevMonthGenitiveNames, out this.saAbbrevMonthGenitiveNames);
- result &= EnumEraNames(localeName, calendarId, CalendarDataType.EraNames, out this.saEraNames);
- result &= EnumEraNames(localeName, calendarId, CalendarDataType.AbbrevEraNames, out this.saAbbrevEraNames);
-
- return result;
- }
-
- internal static int GetTwoDigitYearMax(CalendarId calendarId)
- {
- // There is no user override for this value on Linux or in ICU.
- // So just return -1 to use the hard-coded defaults.
- return -1;
- }
-
- // Call native side to figure out which calendars are allowed
- internal static int GetCalendars(string localeName, bool useUserOverride, CalendarId[] calendars)
- {
- // NOTE: there are no 'user overrides' on Linux
- int count = Interop.GlobalizationInterop.GetCalendars(localeName, calendars, calendars.Length);
-
- // ensure there is at least 1 calendar returned
- if (count == 0 && calendars.Length > 0)
- {
- calendars[0] = CalendarId.GREGORIAN;
- count = 1;
- }
-
- return count;
- }
-
- private static bool SystemSupportsTaiwaneseCalendar()
- {
- return true;
- }
-
- // PAL Layer ends here
-
- private static bool GetCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType dataType, out string calendarString)
- {
- return Interop.CallStringMethod(
- (locale, calId, type, stringBuilder) =>
- Interop.GlobalizationInterop.GetCalendarInfo(
- locale,
- calId,
- type,
- stringBuilder,
- stringBuilder.Capacity),
- localeName,
- calendarId,
- dataType,
- out calendarString);
- }
-
- private static bool EnumDatePatterns(string localeName, CalendarId calendarId, CalendarDataType dataType, out string[] datePatterns)
- {
- datePatterns = null;
-
- CallbackContext callbackContext = new CallbackContext();
- callbackContext.DisallowDuplicates = true;
- bool result = EnumCalendarInfo(localeName, calendarId, dataType, callbackContext);
- if (result)
- {
- List<string> datePatternsList = callbackContext.Results;
-
- datePatterns = new string[datePatternsList.Count];
- for (int i = 0; i < datePatternsList.Count; i++)
- {
- datePatterns[i] = NormalizeDatePattern(datePatternsList[i]);
- }
- }
-
- return result;
- }
-
- /// <summary>
- /// The ICU date format characters are not exactly the same as the .NET date format characters.
- /// NormalizeDatePattern will take in an ICU date pattern and return the equivalent .NET date pattern.
- /// </summary>
- /// <remarks>
- /// see Date Field Symbol Table in http://userguide.icu-project.org/formatparse/datetime
- /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
- /// </remarks>
- private static string NormalizeDatePattern(string input)
- {
- StringBuilder destination = StringBuilderCache.Acquire(input.Length);
-
- int index = 0;
- while (index < input.Length)
- {
- switch (input[index])
- {
- case '\'':
- // single quotes escape characters, like 'de' in es-SP
- // so read verbatim until the next single quote
- destination.Append(input[index++]);
- while (index < input.Length)
- {
- char current = input[index++];
- destination.Append(current);
- if (current == '\'')
- {
- break;
- }
- }
- break;
- case 'E':
- case 'e':
- case 'c':
- // 'E' in ICU is the day of the week, which maps to 3 or 4 'd's in .NET
- // 'e' in ICU is the local day of the week, which has no representation in .NET, but
- // maps closest to 3 or 4 'd's in .NET
- // 'c' in ICU is the stand-alone day of the week, which has no representation in .NET, but
- // maps closest to 3 or 4 'd's in .NET
- NormalizeDayOfWeek(input, destination, ref index);
- break;
- case 'L':
- case 'M':
- // 'L' in ICU is the stand-alone name of the month,
- // which maps closest to 'M' in .NET since it doesn't support stand-alone month names in patterns
- // 'M' in both ICU and .NET is the month,
- // but ICU supports 5 'M's, which is the super short month name
- int occurrences = CountOccurrences(input, input[index], ref index);
- if (occurrences > 4)
- {
- // 5 'L's or 'M's in ICU is the super short name, which maps closest to MMM in .NET
- occurrences = 3;
- }
- destination.Append('M', occurrences);
- break;
- case 'G':
- // 'G' in ICU is the era, which maps to 'g' in .NET
- occurrences = CountOccurrences(input, 'G', ref index);
-
- // it doesn't matter how many 'G's, since .NET only supports 'g' or 'gg', and they
- // have the same meaning
- destination.Append('g');
- break;
- case 'y':
- // a single 'y' in ICU is the year with no padding or trimming.
- // a single 'y' in .NET is the year with 1 or 2 digits
- // so convert any single 'y' to 'yyyy'
- occurrences = CountOccurrences(input, 'y', ref index);
- if (occurrences == 1)
- {
- occurrences = 4;
- }
- destination.Append('y', occurrences);
- break;
- default:
- const string unsupportedDateFieldSymbols = "YuUrQqwWDFg";
- Debug.Assert(unsupportedDateFieldSymbols.IndexOf(input[index]) == -1,
- string.Format(CultureInfo.InvariantCulture,
- "Encountered an unexpected date field symbol '{0}' from ICU which has no known corresponding .NET equivalent.",
- input[index]));
-
- destination.Append(input[index++]);
- break;
- }
- }
-
- return StringBuilderCache.GetStringAndRelease(destination);
- }
-
- private static void NormalizeDayOfWeek(string input, StringBuilder destination, ref int index)
- {
- char dayChar = input[index];
- int occurrences = CountOccurrences(input, dayChar, ref index);
- occurrences = Math.Max(occurrences, 3);
- if (occurrences > 4)
- {
- // 5 and 6 E/e/c characters in ICU is the super short names, which maps closest to ddd in .NET
- occurrences = 3;
- }
-
- destination.Append('d', occurrences);
- }
-
- private static int CountOccurrences(string input, char value, ref int index)
- {
- int startIndex = index;
- while (index < input.Length && input[index] == value)
- {
- index++;
- }
-
- return index - startIndex;
- }
-
- private static bool EnumMonthNames(string localeName, CalendarId calendarId, CalendarDataType dataType, out string[] monthNames)
- {
- monthNames = null;
-
- CallbackContext callbackContext = new CallbackContext();
- bool result = EnumCalendarInfo(localeName, calendarId, dataType, callbackContext);
- if (result)
- {
- // the month-name arrays are expected to have 13 elements. If ICU only returns 12, add an
- // extra empty string to fill the array.
- if (callbackContext.Results.Count == 12)
- {
- callbackContext.Results.Add(string.Empty);
- }
-
- monthNames = callbackContext.Results.ToArray();
- }
-
- return result;
- }
-
- private static bool EnumEraNames(string localeName, CalendarId calendarId, CalendarDataType dataType, out string[] eraNames)
- {
- bool result = EnumCalendarInfo(localeName, calendarId, dataType, out eraNames);
-
- // .NET expects that only the Japanese calendars have more than 1 era.
- // So for other calendars, only return the latest era.
- if (calendarId != CalendarId.JAPAN && calendarId != CalendarId.JAPANESELUNISOLAR && eraNames.Length > 0)
- {
- string[] latestEraName = new string[] { eraNames[eraNames.Length - 1] };
- eraNames = latestEraName;
- }
-
- return result;
- }
-
- internal static bool EnumCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType dataType, out string[] calendarData)
- {
- calendarData = null;
-
- CallbackContext callbackContext = new CallbackContext();
- bool result = EnumCalendarInfo(localeName, calendarId, dataType, callbackContext);
- if (result)
- {
- calendarData = callbackContext.Results.ToArray();
- }
-
- return result;
- }
-
- private static bool EnumCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType dataType, CallbackContext callbackContext)
- {
- GCHandle context = GCHandle.Alloc(callbackContext);
- try
- {
- return Interop.GlobalizationInterop.EnumCalendarInfo(EnumCalendarInfoCallback, localeName, calendarId, dataType, (IntPtr)context);
- }
- finally
- {
- context.Free();
- }
- }
-
- private static void EnumCalendarInfoCallback(string calendarString, IntPtr context)
- {
- CallbackContext callbackContext = (CallbackContext)((GCHandle)context).Target;
-
- if (callbackContext.DisallowDuplicates)
- {
- foreach (string existingResult in callbackContext.Results)
- {
- if (string.Equals(calendarString, existingResult, StringComparison.Ordinal))
- {
- // the value is already in the results, so don't add it again
- return;
- }
- }
- }
-
- callbackContext.Results.Add(calendarString);
- }
-
- private class CallbackContext
- {
- private List<string> _results = new List<string>();
-
- public CallbackContext()
- {
- }
-
- public List<string> Results { get { return _results; } }
-
- public bool DisallowDuplicates { get; set; }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CalendarData.Windows.cs b/src/mscorlib/corefx/System/Globalization/CalendarData.Windows.cs
deleted file mode 100644
index bdf3ff1881..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CalendarData.Windows.cs
+++ /dev/null
@@ -1,469 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
-using System.Diagnostics.Contracts;
-using System.Collections.Generic;
-
-namespace System.Globalization
-{
- internal partial class CalendarData
- {
- private bool LoadCalendarDataFromSystem(String localeName, CalendarId calendarId)
- {
- bool ret = true;
-
- uint useOverrides = this.bUseUserOverrides ? 0 : CAL_NOUSEROVERRIDE;
-
- //
- // Windows doesn't support some calendars right now, so remap those.
- //
- switch (calendarId)
- {
- case CalendarId.JAPANESELUNISOLAR: // Data looks like Japanese
- calendarId = CalendarId.JAPAN;
- break;
- case CalendarId.JULIAN: // Data looks like gregorian US
- case CalendarId.CHINESELUNISOLAR: // Algorithmic, so actual data is irrelevent
- case CalendarId.SAKA: // reserved to match Office but not implemented in our code, so data is irrelevent
- case CalendarId.LUNAR_ETO_CHN: // reserved to match Office but not implemented in our code, so data is irrelevent
- case CalendarId.LUNAR_ETO_KOR: // reserved to match Office but not implemented in our code, so data is irrelevent
- case CalendarId.LUNAR_ETO_ROKUYOU: // reserved to match Office but not implemented in our code, so data is irrelevent
- case CalendarId.KOREANLUNISOLAR: // Algorithmic, so actual data is irrelevent
- case CalendarId.TAIWANLUNISOLAR: // Algorithmic, so actual data is irrelevent
- calendarId = CalendarId.GREGORIAN_US;
- break;
- }
-
- //
- // Special handling for some special calendar due to OS limitation.
- // This includes calendar like Taiwan calendar, UmAlQura calendar, etc.
- //
- CheckSpecialCalendar(ref calendarId, ref localeName);
-
- // Numbers
- ret &= CallGetCalendarInfoEx(localeName, calendarId, CAL_ITWODIGITYEARMAX | useOverrides, out this.iTwoDigitYearMax);
-
- // Strings
- ret &= CallGetCalendarInfoEx(localeName, calendarId, CAL_SCALNAME, out this.sNativeName);
- ret &= CallGetCalendarInfoEx(localeName, calendarId, CAL_SMONTHDAY | useOverrides, out this.sMonthDay);
-
- // String Arrays
- // Formats
- ret &= CallEnumCalendarInfo(localeName, calendarId, CAL_SSHORTDATE, LOCALE_SSHORTDATE | useOverrides, out this.saShortDates);
- ret &= CallEnumCalendarInfo(localeName, calendarId, CAL_SLONGDATE, LOCALE_SLONGDATE | useOverrides, out this.saLongDates);
-
- // Get the YearMonth pattern.
- ret &= CallEnumCalendarInfo(localeName, calendarId, CAL_SYEARMONTH, LOCALE_SYEARMONTH, out this.saYearMonths);
-
- // Day & Month Names
- // These are all single calType entries, 1 per day, so we have to make 7 or 13 calls to collect all the names
-
- // Day
- // Note that we're off-by-one since managed starts on sunday and windows starts on monday
- ret &= GetCalendarDayInfo(localeName, calendarId, CAL_SDAYNAME7, out this.saDayNames);
- ret &= GetCalendarDayInfo(localeName, calendarId, CAL_SABBREVDAYNAME7, out this.saAbbrevDayNames);
-
- // Month names
- ret &= GetCalendarMonthInfo(localeName, calendarId, CAL_SMONTHNAME1, out this.saMonthNames);
- ret &= GetCalendarMonthInfo(localeName, calendarId, CAL_SABBREVMONTHNAME1, out this.saAbbrevMonthNames);
-
- //
- // The following LCTYPE are not supported in some platforms. If the call fails,
- // don't return a failure.
- //
- GetCalendarDayInfo(localeName, calendarId, CAL_SSHORTESTDAYNAME7, out this.saSuperShortDayNames);
-
- // Gregorian may have genitive month names
- if (calendarId == CalendarId.GREGORIAN)
- {
- GetCalendarMonthInfo(localeName, calendarId, CAL_SMONTHNAME1 | CAL_RETURN_GENITIVE_NAMES, out this.saMonthGenitiveNames);
- GetCalendarMonthInfo(localeName, calendarId, CAL_SABBREVMONTHNAME1 | CAL_RETURN_GENITIVE_NAMES, out this.saAbbrevMonthGenitiveNames);
- }
-
- // Calendar Parts Names
- // This doesn't get always get localized names for gregorian (not available in windows < 7)
- // so: eg: coreclr on win < 7 won't get these
- CallEnumCalendarInfo(localeName, calendarId, CAL_SERASTRING, 0, out this.saEraNames);
- CallEnumCalendarInfo(localeName, calendarId, CAL_SABBREVERASTRING, 0, out this.saAbbrevEraNames);
-
- //
- // Calendar Era Info
- // Note that calendar era data (offsets, etc) is hard coded for each calendar since this
- // data is implementation specific and not dynamic (except perhaps Japanese)
- //
-
- // Clean up the escaping of the formats
- this.saShortDates = CultureData.ReescapeWin32Strings(this.saShortDates);
- this.saLongDates = CultureData.ReescapeWin32Strings(this.saLongDates);
- this.saYearMonths = CultureData.ReescapeWin32Strings(this.saYearMonths);
- this.sMonthDay = CultureData.ReescapeWin32String(this.sMonthDay);
-
- return ret;
- }
-
- // Get native two digit year max
- internal static int GetTwoDigitYearMax(CalendarId calendarId)
- {
- int twoDigitYearMax = -1;
-
- if (!CallGetCalendarInfoEx(null, calendarId, (uint)CAL_ITWODIGITYEARMAX, out twoDigitYearMax))
- {
- twoDigitYearMax = -1;
- }
-
- return twoDigitYearMax;
- }
-
- // Call native side to figure out which calendars are allowed
- internal static int GetCalendars(String localeName, bool useUserOverride, CalendarId[] calendars)
- {
- EnumCalendarsData data = new EnumCalendarsData();
- data.userOverride = 0;
- data.calendars = new LowLevelList<int>();
-
- // First call GetLocaleInfo if necessary
- if (useUserOverride)
- {
- // They want user overrides, see if the user calendar matches the input calendar
- int userCalendar = Interop.mincore.GetLocaleInfoExInt(localeName, LOCALE_ICALENDARTYPE);
-
- // If we got a default, then use it as the first calendar
- if (userCalendar != 0)
- {
- data.userOverride = userCalendar;
- data.calendars.Add(userCalendar);
- }
- }
-
- GCHandle contextHandle = GCHandle.Alloc(data);
- try
- {
- // Now call the enumeration API. Work is done by our callback function
- IntPtr callback = AddrofIntrinsics.AddrOf<Func<IntPtr, uint, IntPtr, IntPtr, Interop.BOOL>>(EnumCalendarsCallback);
- Interop.mincore.EnumCalendarInfoExEx(callback, localeName, ENUM_ALL_CALENDARS, null, CAL_ICALINTVALUE, (IntPtr)contextHandle);
- }
- finally
- {
- contextHandle.Free();
- }
-
- // Copy to the output array
- for (int i = 0; i < Math.Min(calendars.Length, data.calendars.Count); i++)
- calendars[i] = (CalendarId)data.calendars[i];
-
- // Now we have a list of data, return the count
- return data.calendars.Count;
- }
-
- private static bool SystemSupportsTaiwaneseCalendar()
- {
- string data;
- // Taiwanese calendar get listed as one of the optional zh-TW calendars only when having zh-TW UI
- return CallGetCalendarInfoEx("zh-TW", CalendarId.TAIWAN, CAL_SCALNAME, out data);
- }
-
- // PAL Layer ends here
-
- private const uint CAL_RETURN_NUMBER = 0x20000000;
- private const uint CAL_RETURN_GENITIVE_NAMES = 0x10000000;
- private const uint CAL_NOUSEROVERRIDE = 0x80000000;
- private const uint CAL_SCALNAME = 0x00000002;
- private const uint CAL_SMONTHDAY = 0x00000038;
- private const uint CAL_SSHORTDATE = 0x00000005;
- private const uint CAL_SLONGDATE = 0x00000006;
- private const uint CAL_SYEARMONTH = 0x0000002f;
- private const uint CAL_SDAYNAME7 = 0x0000000d;
- private const uint CAL_SABBREVDAYNAME7 = 0x00000014;
- private const uint CAL_SMONTHNAME1 = 0x00000015;
- private const uint CAL_SABBREVMONTHNAME1 = 0x00000022;
- private const uint CAL_SSHORTESTDAYNAME7 = 0x00000037;
- private const uint CAL_SERASTRING = 0x00000004;
- private const uint CAL_SABBREVERASTRING = 0x00000039;
- private const uint CAL_ICALINTVALUE = 0x00000001;
- private const uint CAL_ITWODIGITYEARMAX = 0x00000030;
-
- private const uint ENUM_ALL_CALENDARS = 0xffffffff;
-
- private const uint LOCALE_SSHORTDATE = 0x0000001F;
- private const uint LOCALE_SLONGDATE = 0x00000020;
- private const uint LOCALE_SYEARMONTH = 0x00001006;
- private const uint LOCALE_ICALENDARTYPE = 0x00001009;
-
- ////////////////////////////////////////////////////////////////////////
- //
- // For calendars like Gregorain US/Taiwan/UmAlQura, they are not available
- // in all OS or all localized versions of OS.
- // If OS does not support these calendars, we will fallback by using the
- // appropriate fallback calendar and locale combination to retrieve data from OS.
- //
- // Parameters:
- // __deref_inout pCalendarInt:
- // Pointer to the calendar ID. This will be updated to new fallback calendar ID if needed.
- // __in_out pLocaleNameStackBuffer
- // Pointer to the StackSString object which holds the locale name to be checked.
- // This will be updated to new fallback locale name if needed.
- //
- ////////////////////////////////////////////////////////////////////////
- private static void CheckSpecialCalendar(ref CalendarId calendar, ref string localeName)
- {
- string data;
-
- // Gregorian-US isn't always available in the OS, however it is the same for all locales
- switch (calendar)
- {
- case CalendarId.GREGORIAN_US:
- // See if this works
- if (!CallGetCalendarInfoEx(localeName, calendar, CAL_SCALNAME, out data))
- {
- // Failed, set it to a locale (fa-IR) that's alway has Gregorian US available in the OS
- localeName = "fa-IR";
- }
- // See if that works
- if (!CallGetCalendarInfoEx(localeName, calendar, CAL_SCALNAME, out data))
- {
- // Failed again, just use en-US with the gregorian calendar
- localeName = "en-US";
- calendar = CalendarId.GREGORIAN;
- }
- break;
- case CalendarId.TAIWAN:
- // Taiwan calendar data is not always in all language version of OS due to Geopolical reasons.
- // It is only available in zh-TW localized versions of Windows.
- // Let's check if OS supports it. If not, fallback to Greogrian localized for Taiwan calendar.
- if (!SystemSupportsTaiwaneseCalendar())
- {
- calendar = CalendarId.GREGORIAN;
- }
- break;
- }
- }
-
- private static bool CallGetCalendarInfoEx(string localeName, CalendarId calendar, uint calType, out int data)
- {
- return (Interop.mincore.GetCalendarInfoEx(localeName, (uint)calendar, IntPtr.Zero, calType | CAL_RETURN_NUMBER, IntPtr.Zero, 0, out data) != 0);
- }
-
- private static unsafe bool CallGetCalendarInfoEx(string localeName, CalendarId calendar, uint calType, out string data)
- {
- const int BUFFER_LENGTH = 80;
-
- // The maximum size for values returned from GetCalendarInfoEx is 80 characters.
- char* buffer = stackalloc char[BUFFER_LENGTH];
-
- int ret = Interop.mincore.GetCalendarInfoEx(localeName, (uint)calendar, IntPtr.Zero, calType, (IntPtr)buffer, BUFFER_LENGTH, IntPtr.Zero);
- if (ret > 0)
- {
- if (buffer[ret - 1] == '\0')
- {
- ret--; // don't include the null termination in the string
- }
- data = new string(buffer, 0, ret);
- return true;
- }
- data = "";
- return false;
- }
-
- // Context for EnumCalendarInfoExEx callback.
- private class EnumData
- {
- public string userOverride;
- public LowLevelList<string> strings;
- }
-
- // EnumCalendarInfoExEx callback itself.
- [NativeCallable(CallingConvention = CallingConvention.StdCall)]
- private static unsafe Interop.BOOL EnumCalendarInfoCallback(IntPtr lpCalendarInfoString, uint calendar, IntPtr pReserved, IntPtr lParam)
- {
- EnumData context = (EnumData)((GCHandle)lParam).Target;
- try
- {
- string calendarInfo = new string((char*)lpCalendarInfoString);
-
- // If we had a user override, check to make sure this differs
- if (context.userOverride != calendarInfo)
- context.strings.Add(calendarInfo);
-
- return Interop.BOOL.TRUE;
- }
- catch (Exception)
- {
- return Interop.BOOL.FALSE;
- }
- }
-
- private static unsafe bool CallEnumCalendarInfo(string localeName, CalendarId calendar, uint calType, uint lcType, out string[] data)
- {
- EnumData context = new EnumData();
- context.userOverride = null;
- context.strings = new LowLevelList<string>();
-
- // First call GetLocaleInfo if necessary
- if (((lcType != 0) && ((lcType & CAL_NOUSEROVERRIDE) == 0)) &&
- // Get user locale, see if it matches localeName.
- // Note that they should match exactly, including letter case
- GetUserDefaultLocaleName() == localeName)
- {
- // They want user overrides, see if the user calendar matches the input calendar
- CalendarId userCalendar = (CalendarId)Interop.mincore.GetLocaleInfoExInt(localeName, LOCALE_ICALENDARTYPE);
-
- // If the calendars were the same, see if the locales were the same
- if (userCalendar == calendar)
- {
- // They matched, get the user override since locale & calendar match
- string res = Interop.mincore.GetLocaleInfoEx(localeName, lcType);
-
- // if it succeeded remember the override for the later callers
- if (res != "")
- {
- // Remember this was the override (so we can look for duplicates later in the enum function)
- context.userOverride = res;
-
- // Add to the result strings.
- context.strings.Add(res);
- }
- }
- }
-
- GCHandle contextHandle = GCHandle.Alloc(context);
- try
- {
- // Now call the enumeration API. Work is done by our callback function
- IntPtr callback = AddrofIntrinsics.AddrOf<Func<IntPtr, uint, IntPtr, IntPtr, Interop.BOOL>>(EnumCalendarInfoCallback);
- Interop.mincore.EnumCalendarInfoExEx(callback, localeName, (uint)calendar, null, calType, (IntPtr)contextHandle);
- }
- finally
- {
- contextHandle.Free();
- }
-
- // Now we have a list of data, fail if we didn't find anything.
- if (context.strings.Count == 0)
- {
- data = null;
- return false;
- }
-
- string[] output = context.strings.ToArray();
-
- if (calType == CAL_SABBREVERASTRING || calType == CAL_SERASTRING)
- {
- // Eras are enumerated backwards. (oldest era name first, but
- // Japanese calendar has newest era first in array, and is only
- // calendar with multiple eras)
- Array.Reverse(output, 0, output.Length);
- }
-
- data = output;
-
- return true;
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Get the native day names
- //
- // NOTE: There's a disparity between .Net & windows day orders, the input day should
- // start with Sunday
- //
- // Parameters:
- // OUT pOutputStrings The output string[] value.
- //
- ////////////////////////////////////////////////////////////////////////
- private static bool GetCalendarDayInfo(string localeName, CalendarId calendar, uint calType, out string[] outputStrings)
- {
- bool result = true;
-
- //
- // We'll need a new array of 7 items
- //
- string[] results = new string[7];
-
- // Get each one of them
- for (int i = 0; i < 7; i++, calType++)
- {
- result &= CallGetCalendarInfoEx(localeName, calendar, calType, out results[i]);
-
- // On the first iteration we need to go from CAL_SDAYNAME7 to CAL_SDAYNAME1, so subtract 7 before the ++ happens
- // This is because the framework starts on sunday and windows starts on monday when counting days
- if (i == 0)
- calType -= 7;
- }
-
- outputStrings = results;
-
- return result;
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Get the native month names
- //
- // Parameters:
- // OUT pOutputStrings The output string[] value.
- //
- ////////////////////////////////////////////////////////////////////////
- private static bool GetCalendarMonthInfo(string localeName, CalendarId calendar, uint calType, out string[] outputStrings)
- {
- //
- // We'll need a new array of 13 items
- //
- string[] results = new string[13];
-
- // Get each one of them
- for (int i = 0; i < 13; i++, calType++)
- {
- if (!CallGetCalendarInfoEx(localeName, calendar, calType, out results[i]))
- results[i] = "";
- }
-
- outputStrings = results;
-
- return true;
- }
-
- //
- // struct to help our calendar data enumaration callback
- //
- private class EnumCalendarsData
- {
- public int userOverride; // user override value (if found)
- public LowLevelList<int> calendars; // list of calendars found so far
- }
-
- [NativeCallable(CallingConvention = CallingConvention.StdCall)]
- private static Interop.BOOL EnumCalendarsCallback(IntPtr lpCalendarInfoString, uint calendar, IntPtr reserved, IntPtr lParam)
- {
- EnumCalendarsData context = (EnumCalendarsData)((GCHandle)lParam).Target;
- try
- {
- // If we had a user override, check to make sure this differs
- if (context.userOverride != calendar)
- context.calendars.Add((int)calendar);
-
- return Interop.BOOL.TRUE;
- }
- catch (Exception)
- {
- return Interop.BOOL.FALSE;
- }
- }
-
- private static unsafe String GetUserDefaultLocaleName()
- {
- const int LOCALE_NAME_MAX_LENGTH = 85;
- const uint LOCALE_SNAME = 0x0000005c;
- const string LOCALE_NAME_USER_DEFAULT = null;
-
- int result;
- char* localeName = stackalloc char[LOCALE_NAME_MAX_LENGTH];
- result = Interop.mincore.GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, localeName, LOCALE_NAME_MAX_LENGTH);
-
- return result <= 0 ? "" : new String(localeName, 0, result - 1); // exclude the null termination
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CalendarData.cs b/src/mscorlib/corefx/System/Globalization/CalendarData.cs
deleted file mode 100644
index d22bd67ac1..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CalendarData.cs
+++ /dev/null
@@ -1,377 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-
-namespace System.Globalization
-{
- // List of calendar data
- // Note the we cache overrides.
- // Note that localized names (resource names) aren't available from here.
- //
- // NOTE: Calendars depend on the locale name that creates it. Only a few
- // properties are available without locales using CalendarData.GetCalendar(CalendarData)
-
- internal partial class CalendarData
- {
- // Max calendars
- internal const int MAX_CALENDARS = 23;
-
- // Identity
- internal String sNativeName; // Calendar Name for the locale
-
- // Formats
- internal String[] saShortDates; // Short Data format, default first
- internal String[] saYearMonths; // Year/Month Data format, default first
- internal String[] saLongDates; // Long Data format, default first
- internal String sMonthDay; // Month/Day format
-
- // Calendar Parts Names
- internal String[] saEraNames; // Names of Eras
- internal String[] saAbbrevEraNames; // Abbreviated Era Names
- internal String[] saAbbrevEnglishEraNames; // Abbreviated Era Names in English
- internal String[] saDayNames; // Day Names, null to use locale data, starts on Sunday
- internal String[] saAbbrevDayNames; // Abbrev Day Names, null to use locale data, starts on Sunday
- internal String[] saSuperShortDayNames; // Super short Day of week names
- internal String[] saMonthNames; // Month Names (13)
- internal String[] saAbbrevMonthNames; // Abbrev Month Names (13)
- internal String[] saMonthGenitiveNames; // Genitive Month Names (13)
- internal String[] saAbbrevMonthGenitiveNames; // Genitive Abbrev Month Names (13)
- internal String[] saLeapYearMonthNames; // Multiple strings for the month names in a leap year.
-
- // Integers at end to make marshaller happier
- internal int iTwoDigitYearMax = 2029; // Max 2 digit year (for Y2K bug data entry)
- internal int iCurrentEra = 0; // current era # (usually 1)
-
- // Use overrides?
- internal bool bUseUserOverrides; // True if we want user overrides.
-
- // Static invariant for the invariant locale
- internal static CalendarData Invariant;
-
- // Private constructor
- private CalendarData() { }
-
- // Invariant constructor
- static CalendarData()
- {
- // Set our default/gregorian US calendar data
- // Calendar IDs are 1-based, arrays are 0 based.
- CalendarData invariant = new CalendarData();
-
- // Set default data for calendar
- // Note that we don't load resources since this IS NOT supposed to change (by definition)
- invariant.sNativeName = "Gregorian Calendar"; // Calendar Name
-
- // Year
- invariant.iTwoDigitYearMax = 2029; // Max 2 digit year (for Y2K bug data entry)
- invariant.iCurrentEra = 1; // Current era #
-
- // Formats
- invariant.saShortDates = new String[] { "MM/dd/yyyy", "yyyy-MM-dd" }; // short date format
- invariant.saLongDates = new String[] { "dddd, dd MMMM yyyy" }; // long date format
- invariant.saYearMonths = new String[] { "yyyy MMMM" }; // year month format
- invariant.sMonthDay = "MMMM dd"; // Month day pattern
-
- // Calendar Parts Names
- invariant.saEraNames = new String[] { "A.D." }; // Era names
- invariant.saAbbrevEraNames = new String[] { "AD" }; // Abbreviated Era names
- invariant.saAbbrevEnglishEraNames = new String[] { "AD" }; // Abbreviated era names in English
- invariant.saDayNames = new String[] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };// day names
- invariant.saAbbrevDayNames = new String[] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; // abbreviated day names
- invariant.saSuperShortDayNames = new String[] { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" }; // The super short day names
- invariant.saMonthNames = new String[] { "January", "February", "March", "April", "May", "June",
- "July", "August", "September", "October", "November", "December", String.Empty}; // month names
- invariant.saAbbrevMonthNames = new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", String.Empty}; // abbreviated month names
- invariant.saMonthGenitiveNames = invariant.saMonthNames; // Genitive month names (same as month names for invariant)
- invariant.saAbbrevMonthGenitiveNames = invariant.saAbbrevMonthNames; // Abbreviated genitive month names (same as abbrev month names for invariant)
- invariant.saLeapYearMonthNames = invariant.saMonthNames; // leap year month names are unused in Gregorian English (invariant)
-
- invariant.bUseUserOverrides = false;
-
- // Calendar was built, go ahead and assign it...
- Invariant = invariant;
- }
-
- //
- // Get a bunch of data for a calendar
- //
- internal CalendarData(String localeName, CalendarId calendarId, bool bUseUserOverrides)
- {
- this.bUseUserOverrides = bUseUserOverrides;
-
- if (!LoadCalendarDataFromSystem(localeName, calendarId))
- {
- Debug.Assert(false, "[CalendarData] LoadCalendarDataFromSystem call isn't expected to fail for calendar " + calendarId + " locale " + localeName);
-
- // Something failed, try invariant for missing parts
- // This is really not good, but we don't want the callers to crash.
- if (this.sNativeName == null) this.sNativeName = String.Empty; // Calendar Name for the locale.
-
- // Formats
- if (this.saShortDates == null) this.saShortDates = Invariant.saShortDates; // Short Data format, default first
- if (this.saYearMonths == null) this.saYearMonths = Invariant.saYearMonths; // Year/Month Data format, default first
- if (this.saLongDates == null) this.saLongDates = Invariant.saLongDates; // Long Data format, default first
- if (this.sMonthDay == null) this.sMonthDay = Invariant.sMonthDay; // Month/Day format
-
- // Calendar Parts Names
- if (this.saEraNames == null) this.saEraNames = Invariant.saEraNames; // Names of Eras
- if (this.saAbbrevEraNames == null) this.saAbbrevEraNames = Invariant.saAbbrevEraNames; // Abbreviated Era Names
- if (this.saAbbrevEnglishEraNames == null) this.saAbbrevEnglishEraNames = Invariant.saAbbrevEnglishEraNames; // Abbreviated Era Names in English
- if (this.saDayNames == null) this.saDayNames = Invariant.saDayNames; // Day Names, null to use locale data, starts on Sunday
- if (this.saAbbrevDayNames == null) this.saAbbrevDayNames = Invariant.saAbbrevDayNames; // Abbrev Day Names, null to use locale data, starts on Sunday
- if (this.saSuperShortDayNames == null) this.saSuperShortDayNames = Invariant.saSuperShortDayNames; // Super short Day of week names
- if (this.saMonthNames == null) this.saMonthNames = Invariant.saMonthNames; // Month Names (13)
- if (this.saAbbrevMonthNames == null) this.saAbbrevMonthNames = Invariant.saAbbrevMonthNames; // Abbrev Month Names (13)
- // Genitive and Leap names can follow the fallback below
- }
-
- if (calendarId == CalendarId.TAIWAN)
- {
- if (SystemSupportsTaiwaneseCalendar())
- {
- // We got the month/day names from the OS (same as gregorian), but the native name is wrong
- this.sNativeName = "\x4e2d\x83ef\x6c11\x570b\x66c6";
- }
- else
- {
- this.sNativeName = String.Empty;
- }
- }
-
- // Check for null genitive names (in case unmanaged side skips it for non-gregorian calendars, etc)
- if (this.saMonthGenitiveNames == null || this.saMonthGenitiveNames.Length == 0 || String.IsNullOrEmpty(this.saMonthGenitiveNames[0]))
- this.saMonthGenitiveNames = this.saMonthNames; // Genitive month names (same as month names for invariant)
- if (this.saAbbrevMonthGenitiveNames == null || this.saAbbrevMonthGenitiveNames.Length == 0 || String.IsNullOrEmpty(this.saAbbrevMonthGenitiveNames[0]))
- this.saAbbrevMonthGenitiveNames = this.saAbbrevMonthNames; // Abbreviated genitive month names (same as abbrev month names for invariant)
- if (this.saLeapYearMonthNames == null || this.saLeapYearMonthNames.Length == 0 || String.IsNullOrEmpty(this.saLeapYearMonthNames[0]))
- this.saLeapYearMonthNames = this.saMonthNames;
-
- InitializeEraNames(localeName, calendarId);
-
- InitializeAbbreviatedEraNames(localeName, calendarId);
-
- // Abbreviated English Era Names are only used for the Japanese calendar.
- if (calendarId == CalendarId.JAPAN)
- {
- this.saAbbrevEnglishEraNames = JapaneseCalendar.EnglishEraNames();
- }
- else
- {
- // For all others just use the an empty string (doesn't matter we'll never ask for it for other calendars)
- this.saAbbrevEnglishEraNames = new String[] { "" };
- }
-
- // Japanese is the only thing with > 1 era. Its current era # is how many ever
- // eras are in the array. (And the others all have 1 string in the array)
- this.iCurrentEra = this.saEraNames.Length;
- }
-
- private void InitializeEraNames(string localeName, CalendarId calendarId)
- {
- // Note that the saEraNames only include "A.D." We don't have localized names for other calendars available from windows
- switch (calendarId)
- {
- // For Localized Gregorian we really expect the data from the OS.
- case CalendarId.GREGORIAN:
- // Fallback for CoreCLR < Win7 or culture.dll missing
- if (this.saEraNames == null || this.saEraNames.Length == 0 || String.IsNullOrEmpty(this.saEraNames[0]))
- {
- this.saEraNames = new String[] { "A.D." };
- }
- break;
-
- // The rest of the calendars have constant data, so we'll just use that
- case CalendarId.GREGORIAN_US:
- case CalendarId.JULIAN:
- this.saEraNames = new String[] { "A.D." };
- break;
- case CalendarId.HEBREW:
- this.saEraNames = new String[] { "C.E." };
- break;
- case CalendarId.HIJRI:
- case CalendarId.UMALQURA:
- if (localeName == "dv-MV")
- {
- // Special case for Divehi
- this.saEraNames = new String[] { "\x0780\x07a8\x0796\x07b0\x0783\x07a9" };
- }
- else
- {
- this.saEraNames = new String[] { "\x0628\x0639\x062F \x0627\x0644\x0647\x062C\x0631\x0629" };
- }
- break;
- case CalendarId.GREGORIAN_ARABIC:
- case CalendarId.GREGORIAN_XLIT_ENGLISH:
- case CalendarId.GREGORIAN_XLIT_FRENCH:
- // These are all the same:
- this.saEraNames = new String[] { "\x0645" };
- break;
-
- case CalendarId.GREGORIAN_ME_FRENCH:
- this.saEraNames = new String[] { "ap. J.-C." };
- break;
-
- case CalendarId.TAIWAN:
- if (SystemSupportsTaiwaneseCalendar())
- {
- this.saEraNames = new String[] { "\x4e2d\x83ef\x6c11\x570b" };
- }
- else
- {
- this.saEraNames = new String[] { String.Empty };
- }
- break;
-
- case CalendarId.KOREA:
- this.saEraNames = new String[] { "\xb2e8\xae30" };
- break;
-
- case CalendarId.THAI:
- this.saEraNames = new String[] { "\x0e1e\x002e\x0e28\x002e" };
- break;
-
- case CalendarId.JAPAN:
- case CalendarId.JAPANESELUNISOLAR:
- this.saEraNames = JapaneseCalendar.EraNames();
- break;
-
- case CalendarId.PERSIAN:
- if (this.saEraNames == null || this.saEraNames.Length == 0 || String.IsNullOrEmpty(this.saEraNames[0]))
- {
- this.saEraNames = new String[] { "\x0647\x002e\x0634" };
- }
- break;
-
- default:
- // Most calendars are just "A.D."
- this.saEraNames = Invariant.saEraNames;
- break;
- }
- }
-
- private void InitializeAbbreviatedEraNames(string localeName, CalendarId calendarId)
- {
- // Note that the saAbbrevEraNames only include "AD" We don't have localized names for other calendars available from windows
- switch (calendarId)
- {
- // For Localized Gregorian we really expect the data from the OS.
- case CalendarId.GREGORIAN:
- // Fallback for CoreCLR < Win7 or culture.dll missing
- if (this.saAbbrevEraNames == null || this.saAbbrevEraNames.Length == 0 || String.IsNullOrEmpty(this.saAbbrevEraNames[0]))
- {
- this.saAbbrevEraNames = new String[] { "AD" };
- }
- break;
-
- // The rest of the calendars have constant data, so we'll just use that
- case CalendarId.GREGORIAN_US:
- case CalendarId.JULIAN:
- this.saAbbrevEraNames = new String[] { "AD" };
- break;
- case CalendarId.JAPAN:
- case CalendarId.JAPANESELUNISOLAR:
- this.saAbbrevEraNames = JapaneseCalendar.AbbrevEraNames();
- break;
- case CalendarId.HIJRI:
- case CalendarId.UMALQURA:
- if (localeName == "dv-MV")
- {
- // Special case for Divehi
- this.saAbbrevEraNames = new String[] { "\x0780\x002e" };
- }
- else
- {
- this.saAbbrevEraNames = new String[] { "\x0647\x0640" };
- }
- break;
- case CalendarId.TAIWAN:
- // Get era name and abbreviate it
- this.saAbbrevEraNames = new String[1];
- if (this.saEraNames[0].Length == 4)
- {
- this.saAbbrevEraNames[0] = this.saEraNames[0].Substring(2, 2);
- }
- else
- {
- this.saAbbrevEraNames[0] = this.saEraNames[0];
- }
- break;
-
- case CalendarId.PERSIAN:
- if (this.saAbbrevEraNames == null || this.saAbbrevEraNames.Length == 0 || String.IsNullOrEmpty(this.saAbbrevEraNames[0]))
- {
- this.saAbbrevEraNames = this.saEraNames;
- }
- break;
-
- default:
- // Most calendars just use the full name
- this.saAbbrevEraNames = this.saEraNames;
- break;
- }
- }
-
- internal static CalendarData GetCalendarData(CalendarId calendarId)
- {
- //
- // Get a calendar.
- // Unfortunately we depend on the locale in the OS, so we need a locale
- // no matter what. So just get the appropriate calendar from the
- // appropriate locale here
- //
-
- // Get a culture name
- // TODO: Note that this doesn't handle the new calendars (lunisolar, etc)
- String culture = CalendarIdToCultureName(calendarId);
-
- // Return our calendar
- return CultureInfo.GetCultureInfo(culture).m_cultureData.GetCalendar(calendarId);
- }
-
- private static String CalendarIdToCultureName(CalendarId calendarId)
- {
- switch (calendarId)
- {
- case CalendarId.GREGORIAN_US:
- return "fa-IR"; // "fa-IR" Iran
-
- case CalendarId.JAPAN:
- return "ja-JP"; // "ja-JP" Japan
-
- case CalendarId.TAIWAN:
- return "zh-TW"; // zh-TW Taiwan
-
- case CalendarId.KOREA:
- return "ko-KR"; // "ko-KR" Korea
-
- case CalendarId.HIJRI:
- case CalendarId.GREGORIAN_ARABIC:
- case CalendarId.UMALQURA:
- return "ar-SA"; // "ar-SA" Saudi Arabia
-
- case CalendarId.THAI:
- return "th-TH"; // "th-TH" Thailand
-
- case CalendarId.HEBREW:
- return "he-IL"; // "he-IL" Israel
-
- case CalendarId.GREGORIAN_ME_FRENCH:
- return "ar-DZ"; // "ar-DZ" Algeria
-
- case CalendarId.GREGORIAN_XLIT_ENGLISH:
- case CalendarId.GREGORIAN_XLIT_FRENCH:
- return "ar-IQ"; // "ar-IQ"; Iraq
-
- default:
- // Default to gregorian en-US
- break;
- }
-
- return "en-US";
- }
- }
-}
-
diff --git a/src/mscorlib/corefx/System/Globalization/CalendarWeekRule.cs b/src/mscorlib/corefx/System/Globalization/CalendarWeekRule.cs
deleted file mode 100644
index 4013ce7237..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CalendarWeekRule.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-
-namespace System.Globalization
-{
- [Serializable]
- public enum CalendarWeekRule
- {
- FirstDay = 0, // Week 1 begins on the first day of the year
-
- FirstFullWeek = 1, // Week 1 begins on first FirstDayOfWeek not before the first day of the year
-
- FirstFourDayWeek = 2 // Week 1 begins on first FirstDayOfWeek such that FirstDayOfWeek+3 is not before the first day of the year
- };
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CalendricalCalculationsHelper.cs b/src/mscorlib/corefx/System/Globalization/CalendricalCalculationsHelper.cs
deleted file mode 100644
index 7de75d6aee..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CalendricalCalculationsHelper.cs
+++ /dev/null
@@ -1,412 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-
-namespace System.Globalization
-{
- internal class CalendricalCalculationsHelper
- {
- private const double FullCircleOfArc = 360.0; // 360.0;
- private const int HalfCircleOfArc = 180;
- private const double TwelveHours = 0.5; // half a day
- private const double Noon2000Jan01 = 730120.5;
- internal const double MeanTropicalYearInDays = 365.242189;
- private const double MeanSpeedOfSun = MeanTropicalYearInDays / FullCircleOfArc;
- private const double LongitudeSpring = 0.0;
- private const double TwoDegreesAfterSpring = 2.0;
- private const int SecondsPerDay = 24 * 60 * 60; // 24 hours * 60 minutes * 60 seconds
-
- private const int DaysInUniformLengthCentury = 36525;
- private const int SecondsPerMinute = 60;
- private const int MinutesPerDegree = 60;
-
- private static readonly long s_startOf1810 = GetNumberOfDays(new DateTime(1810, 1, 1));
- private static readonly long s_startOf1900Century = GetNumberOfDays(new DateTime(1900, 1, 1));
-
- private static readonly double[] s_coefficients1900to1987 = new double[] { -0.00002, 0.000297, 0.025184, -0.181133, 0.553040, -0.861938, 0.677066, -0.212591 };
- private static readonly double[] s_coefficients1800to1899 = new double[] { -0.000009, 0.003844, 0.083563, 0.865736, 4.867575, 15.845535, 31.332267, 38.291999, 28.316289, 11.636204, 2.043794 };
- private static readonly double[] s_coefficients1700to1799 = new double[] { 8.118780842, -0.005092142, 0.003336121, -0.0000266484 };
- private static readonly double[] s_coefficients1620to1699 = new double[] { 196.58333, -4.0675, 0.0219167 };
- private static readonly double[] s_lambdaCoefficients = new double[] { 280.46645, 36000.76983, 0.0003032 };
- private static readonly double[] s_anomalyCoefficients = new double[] { 357.52910, 35999.05030, -0.0001559, -0.00000048 };
- private static readonly double[] s_eccentricityCoefficients = new double[] { 0.016708617, -0.000042037, -0.0000001236 };
- private static readonly double[] s_coefficients = new double[] { Angle(23, 26, 21.448), Angle(0, 0, -46.8150), Angle(0, 0, -0.00059), Angle(0, 0, 0.001813) };
- private static readonly double[] s_coefficientsA = new double[] { 124.90, -1934.134, 0.002063 };
- private static readonly double[] s_coefficientsB = new double[] { 201.11, 72001.5377, 0.00057 };
-
- private static double RadiansFromDegrees(double degree)
- {
- return degree * Math.PI / 180;
- }
-
- private static double SinOfDegree(double degree)
- {
- return Math.Sin(RadiansFromDegrees(degree));
- }
-
- private static double CosOfDegree(double degree)
- {
- return Math.Cos(RadiansFromDegrees(degree));
- }
- private static double TanOfDegree(double degree)
- {
- return Math.Tan(RadiansFromDegrees(degree));
- }
-
- public static double Angle(int degrees, int minutes, double seconds)
- {
- return ((seconds / SecondsPerMinute + minutes) / MinutesPerDegree) + degrees;
- }
-
- private static double Obliquity(double julianCenturies)
- {
- return PolynomialSum(s_coefficients, julianCenturies);
- }
-
- internal static long GetNumberOfDays(DateTime date)
- {
- return date.Ticks / GregorianCalendar.TicksPerDay;
- }
-
- private static int GetGregorianYear(double numberOfDays)
- {
- return new DateTime(Math.Min((long)(Math.Floor(numberOfDays) * GregorianCalendar.TicksPerDay), DateTime.MaxValue.Ticks)).Year;
- }
-
- private enum CorrectionAlgorithm
- {
- Default,
- Year1988to2019,
- Year1900to1987,
- Year1800to1899,
- Year1700to1799,
- Year1620to1699
- }
-
- private struct EphemerisCorrectionAlgorithmMap
- {
- public EphemerisCorrectionAlgorithmMap(int year, CorrectionAlgorithm algorithm)
- {
- _lowestYear = year;
- _algorithm = algorithm;
- }
-
- internal int _lowestYear;
- internal CorrectionAlgorithm _algorithm;
- };
-
- private static readonly EphemerisCorrectionAlgorithmMap[] s_ephemerisCorrectionTable = new EphemerisCorrectionAlgorithmMap[]
- {
- // lowest year that starts algorithm, algorithm to use
- new EphemerisCorrectionAlgorithmMap(2020, CorrectionAlgorithm.Default),
- new EphemerisCorrectionAlgorithmMap(1988, CorrectionAlgorithm.Year1988to2019),
- new EphemerisCorrectionAlgorithmMap(1900, CorrectionAlgorithm.Year1900to1987),
- new EphemerisCorrectionAlgorithmMap(1800, CorrectionAlgorithm.Year1800to1899),
- new EphemerisCorrectionAlgorithmMap(1700, CorrectionAlgorithm.Year1700to1799),
- new EphemerisCorrectionAlgorithmMap(1620, CorrectionAlgorithm.Year1620to1699),
- new EphemerisCorrectionAlgorithmMap(int.MinValue, CorrectionAlgorithm.Default) // default must be last
- };
-
- private static double Reminder(double divisor, double dividend)
- {
- double whole = Math.Floor(divisor / dividend);
- return divisor - (dividend * whole);
- }
-
- private static double NormalizeLongitude(double longitude)
- {
- longitude = Reminder(longitude, FullCircleOfArc);
- if (longitude < 0)
- {
- longitude += FullCircleOfArc;
- }
- return longitude;
- }
-
- public static double AsDayFraction(double longitude)
- {
- return longitude / FullCircleOfArc;
- }
-
- private static double PolynomialSum(double[] coefficients, double indeterminate)
- {
- double sum = coefficients[0];
- double indeterminateRaised = 1;
- for (int i = 1; i < coefficients.Length; i++)
- {
- indeterminateRaised *= indeterminate;
- sum += (coefficients[i] * indeterminateRaised);
- }
-
- return sum;
- }
-
- private static double CenturiesFrom1900(int gregorianYear)
- {
- long july1stOfYear = GetNumberOfDays(new DateTime(gregorianYear, 7, 1));
- return (double)(july1stOfYear - s_startOf1900Century) / DaysInUniformLengthCentury;
- }
-
- // the following formulas defines a polynomial function which gives us the amount that the earth is slowing down for specific year ranges
- private static double DefaultEphemerisCorrection(int gregorianYear)
- {
- Debug.Assert(gregorianYear < 1620 || 2020 <= gregorianYear);
- long january1stOfYear = GetNumberOfDays(new DateTime(gregorianYear, 1, 1));
- double daysSinceStartOf1810 = january1stOfYear - s_startOf1810;
- double x = TwelveHours + daysSinceStartOf1810;
- return ((Math.Pow(x, 2) / 41048480) - 15) / SecondsPerDay;
- }
-
- private static double EphemerisCorrection1988to2019(int gregorianYear)
- {
- Debug.Assert(1988 <= gregorianYear && gregorianYear <= 2019);
- return (double)(gregorianYear - 1933) / SecondsPerDay;
- }
-
- private static double EphemerisCorrection1900to1987(int gregorianYear)
- {
- Debug.Assert(1900 <= gregorianYear && gregorianYear <= 1987);
- double centuriesFrom1900 = CenturiesFrom1900(gregorianYear);
- return PolynomialSum(s_coefficients1900to1987, centuriesFrom1900);
- }
-
- private static double EphemerisCorrection1800to1899(int gregorianYear)
- {
- Debug.Assert(1800 <= gregorianYear && gregorianYear <= 1899);
- double centuriesFrom1900 = CenturiesFrom1900(gregorianYear);
- return PolynomialSum(s_coefficients1800to1899, centuriesFrom1900);
- }
-
- private static double EphemerisCorrection1700to1799(int gregorianYear)
- {
- Debug.Assert(1700 <= gregorianYear && gregorianYear <= 1799);
- double yearsSince1700 = gregorianYear - 1700;
- return PolynomialSum(s_coefficients1700to1799, yearsSince1700) / SecondsPerDay;
- }
-
- private static double EphemerisCorrection1620to1699(int gregorianYear)
- {
- Debug.Assert(1620 <= gregorianYear && gregorianYear <= 1699);
- double yearsSince1600 = gregorianYear - 1600;
- return PolynomialSum(s_coefficients1620to1699, yearsSince1600) / SecondsPerDay;
- }
-
- // ephemeris-correction: correction to account for the slowing down of the rotation of the earth
- private static double EphemerisCorrection(double time)
- {
- int year = GetGregorianYear(time);
- foreach (EphemerisCorrectionAlgorithmMap map in s_ephemerisCorrectionTable)
- {
- if (map._lowestYear <= year)
- {
- switch (map._algorithm)
- {
- case CorrectionAlgorithm.Default: return DefaultEphemerisCorrection(year);
- case CorrectionAlgorithm.Year1988to2019: return EphemerisCorrection1988to2019(year);
- case CorrectionAlgorithm.Year1900to1987: return EphemerisCorrection1900to1987(year);
- case CorrectionAlgorithm.Year1800to1899: return EphemerisCorrection1800to1899(year);
- case CorrectionAlgorithm.Year1700to1799: return EphemerisCorrection1700to1799(year);
- case CorrectionAlgorithm.Year1620to1699: return EphemerisCorrection1620to1699(year);
- }
-
- break; // break the loop and assert eventually
- }
- }
-
- Debug.Assert(false, "Not expected to come here");
- return DefaultEphemerisCorrection(year);
- }
-
- public static double JulianCenturies(double moment)
- {
- double dynamicalMoment = moment + EphemerisCorrection(moment);
- return (dynamicalMoment - Noon2000Jan01) / DaysInUniformLengthCentury;
- }
-
- private static bool IsNegative(double value)
- {
- return Math.Sign(value) == -1;
- }
-
- private static double CopySign(double value, double sign)
- {
- return (IsNegative(value) == IsNegative(sign)) ? value : -value;
- }
-
- // equation-of-time; approximate the difference between apparent solar time and mean solar time
- // formal definition is EOT = GHA - GMHA
- // GHA is the Greenwich Hour Angle of the apparent (actual) Sun
- // GMHA is the Greenwich Mean Hour Angle of the mean (fictitious) Sun
- // http://www.esrl.noaa.gov/gmd/grad/solcalc/
- // http://en.wikipedia.org/wiki/Equation_of_time
- private static double EquationOfTime(double time)
- {
- double julianCenturies = JulianCenturies(time);
- double lambda = PolynomialSum(s_lambdaCoefficients, julianCenturies);
- double anomaly = PolynomialSum(s_anomalyCoefficients, julianCenturies);
- double eccentricity = PolynomialSum(s_eccentricityCoefficients, julianCenturies);
-
- double epsilon = Obliquity(julianCenturies);
- double tanHalfEpsilon = TanOfDegree(epsilon / 2);
- double y = tanHalfEpsilon * tanHalfEpsilon;
-
- double dividend = ((y * SinOfDegree(2 * lambda))
- - (2 * eccentricity * SinOfDegree(anomaly))
- + (4 * eccentricity * y * SinOfDegree(anomaly) * CosOfDegree(2 * lambda))
- - (0.5 * Math.Pow(y, 2) * SinOfDegree(4 * lambda))
- - (1.25 * Math.Pow(eccentricity, 2) * SinOfDegree(2 * anomaly)));
- double divisor = 2 * Math.PI;
- double equation = dividend / divisor;
-
- // approximation of equation of time is not valid for dates that are many millennia in the past or future
- // thus limited to a half day
- return CopySign(Math.Min(Math.Abs(equation), TwelveHours), equation);
- }
-
- private static double AsLocalTime(double apparentMidday, double longitude)
- {
- // slightly inaccurate since equation of time takes mean time not apparent time as its argument, but the difference is negligible
- double universalTime = apparentMidday - AsDayFraction(longitude);
- return apparentMidday - EquationOfTime(universalTime);
- }
-
- // midday
- public static double Midday(double date, double longitude)
- {
- return AsLocalTime(date + TwelveHours, longitude) - AsDayFraction(longitude);
- }
-
- private static double InitLongitude(double longitude)
- {
- return NormalizeLongitude(longitude + HalfCircleOfArc) - HalfCircleOfArc;
- }
-
- // midday-in-tehran
- public static double MiddayAtPersianObservationSite(double date)
- {
- return Midday(date, InitLongitude(52.5)); // 52.5 degrees east - longitude of UTC+3:30 which defines Iranian Standard Time
- }
-
- private static double PeriodicTerm(double julianCenturies, int x, double y, double z)
- {
- return x * SinOfDegree(y + z * julianCenturies);
- }
-
- private static double SumLongSequenceOfPeriodicTerms(double julianCenturies)
- {
- double sum = 0.0;
- sum += PeriodicTerm(julianCenturies, 403406, 270.54861, 0.9287892);
- sum += PeriodicTerm(julianCenturies, 195207, 340.19128, 35999.1376958);
- sum += PeriodicTerm(julianCenturies, 119433, 63.91854, 35999.4089666);
- sum += PeriodicTerm(julianCenturies, 112392, 331.2622, 35998.7287385);
- sum += PeriodicTerm(julianCenturies, 3891, 317.843, 71998.20261);
- sum += PeriodicTerm(julianCenturies, 2819, 86.631, 71998.4403);
- sum += PeriodicTerm(julianCenturies, 1721, 240.052, 36000.35726);
- sum += PeriodicTerm(julianCenturies, 660, 310.26, 71997.4812);
- sum += PeriodicTerm(julianCenturies, 350, 247.23, 32964.4678);
- sum += PeriodicTerm(julianCenturies, 334, 260.87, -19.441);
- sum += PeriodicTerm(julianCenturies, 314, 297.82, 445267.1117);
- sum += PeriodicTerm(julianCenturies, 268, 343.14, 45036.884);
- sum += PeriodicTerm(julianCenturies, 242, 166.79, 3.1008);
- sum += PeriodicTerm(julianCenturies, 234, 81.53, 22518.4434);
- sum += PeriodicTerm(julianCenturies, 158, 3.5, -19.9739);
- sum += PeriodicTerm(julianCenturies, 132, 132.75, 65928.9345);
- sum += PeriodicTerm(julianCenturies, 129, 182.95, 9038.0293);
- sum += PeriodicTerm(julianCenturies, 114, 162.03, 3034.7684);
- sum += PeriodicTerm(julianCenturies, 99, 29.8, 33718.148);
- sum += PeriodicTerm(julianCenturies, 93, 266.4, 3034.448);
- sum += PeriodicTerm(julianCenturies, 86, 249.2, -2280.773);
- sum += PeriodicTerm(julianCenturies, 78, 157.6, 29929.992);
- sum += PeriodicTerm(julianCenturies, 72, 257.8, 31556.493);
- sum += PeriodicTerm(julianCenturies, 68, 185.1, 149.588);
- sum += PeriodicTerm(julianCenturies, 64, 69.9, 9037.75);
- sum += PeriodicTerm(julianCenturies, 46, 8.0, 107997.405);
- sum += PeriodicTerm(julianCenturies, 38, 197.1, -4444.176);
- sum += PeriodicTerm(julianCenturies, 37, 250.4, 151.771);
- sum += PeriodicTerm(julianCenturies, 32, 65.3, 67555.316);
- sum += PeriodicTerm(julianCenturies, 29, 162.7, 31556.08);
- sum += PeriodicTerm(julianCenturies, 28, 341.5, -4561.54);
- sum += PeriodicTerm(julianCenturies, 27, 291.6, 107996.706);
- sum += PeriodicTerm(julianCenturies, 27, 98.5, 1221.655);
- sum += PeriodicTerm(julianCenturies, 25, 146.7, 62894.167);
- sum += PeriodicTerm(julianCenturies, 24, 110.0, 31437.369);
- sum += PeriodicTerm(julianCenturies, 21, 5.2, 14578.298);
- sum += PeriodicTerm(julianCenturies, 21, 342.6, -31931.757);
- sum += PeriodicTerm(julianCenturies, 20, 230.9, 34777.243);
- sum += PeriodicTerm(julianCenturies, 18, 256.1, 1221.999);
- sum += PeriodicTerm(julianCenturies, 17, 45.3, 62894.511);
- sum += PeriodicTerm(julianCenturies, 14, 242.9, -4442.039);
- sum += PeriodicTerm(julianCenturies, 13, 115.2, 107997.909);
- sum += PeriodicTerm(julianCenturies, 13, 151.8, 119.066);
- sum += PeriodicTerm(julianCenturies, 13, 285.3, 16859.071);
- sum += PeriodicTerm(julianCenturies, 12, 53.3, -4.578);
- sum += PeriodicTerm(julianCenturies, 10, 126.6, 26895.292);
- sum += PeriodicTerm(julianCenturies, 10, 205.7, -39.127);
- sum += PeriodicTerm(julianCenturies, 10, 85.9, 12297.536);
- sum += PeriodicTerm(julianCenturies, 10, 146.1, 90073.778);
- return sum;
- }
-
- private static double Aberration(double julianCenturies)
- {
- return (0.0000974 * CosOfDegree(177.63 + (35999.01848 * julianCenturies))) - 0.005575;
- }
-
- private static double Nutation(double julianCenturies)
- {
- double a = PolynomialSum(s_coefficientsA, julianCenturies);
- double b = PolynomialSum(s_coefficientsB, julianCenturies);
- return (-0.004778 * SinOfDegree(a)) - (0.0003667 * SinOfDegree(b));
- }
-
- public static double Compute(double time)
- {
- double julianCenturies = JulianCenturies(time);
- double lambda = 282.7771834
- + (36000.76953744 * julianCenturies)
- + (0.000005729577951308232 * SumLongSequenceOfPeriodicTerms(julianCenturies));
-
- double longitude = lambda + Aberration(julianCenturies) + Nutation(julianCenturies);
- return InitLongitude(longitude);
- }
-
- public static double AsSeason(double longitude)
- {
- return (longitude < 0) ? (longitude + FullCircleOfArc) : longitude;
- }
-
- private static double EstimatePrior(double longitude, double time)
- {
- double timeSunLastAtLongitude = time - (MeanSpeedOfSun * AsSeason(InitLongitude(Compute(time) - longitude)));
- double longitudeErrorDelta = InitLongitude(Compute(timeSunLastAtLongitude) - longitude);
- return Math.Min(time, timeSunLastAtLongitude - (MeanSpeedOfSun * longitudeErrorDelta));
- }
-
- // persian-new-year-on-or-before
- // number of days is the absolute date. The absolute date is the number of days from January 1st, 1 A.D.
- // 1/1/0001 is absolute date 1.
- internal static long PersianNewYearOnOrBefore(long numberOfDays)
- {
- double date = (double)numberOfDays;
-
- double approx = EstimatePrior(LongitudeSpring, MiddayAtPersianObservationSite(date));
- long lowerBoundNewYearDay = (long)Math.Floor(approx) - 1;
- long upperBoundNewYearDay = lowerBoundNewYearDay + 3; // estimate is generally within a day of the actual occurrance (at the limits, the error expands, since the calculations rely on the mean tropical year which changes...)
- long day = lowerBoundNewYearDay;
- for (; day != upperBoundNewYearDay; ++day)
- {
- double midday = MiddayAtPersianObservationSite((double)day);
- double l = Compute(midday);
- if ((LongitudeSpring <= l) && (l <= TwoDegreesAfterSpring))
- {
- break;
- }
- }
- Debug.Assert(day != upperBoundNewYearDay);
-
- return day - 1;
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CharUnicodeInfo.cs b/src/mscorlib/corefx/System/Globalization/CharUnicodeInfo.cs
deleted file mode 100644
index 38ce441a78..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CharUnicodeInfo.cs
+++ /dev/null
@@ -1,391 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////
-//
-//
-// Purpose: This class implements a set of methods for retrieving
-// character type information. Character type information is
-// independent of culture and region.
-//
-//
-////////////////////////////////////////////////////////////////////////////
-
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- public static partial class CharUnicodeInfo
- {
- //--------------------------------------------------------------------//
- // Internal Information //
- //--------------------------------------------------------------------//
-
- //
- // Native methods to access the Unicode category data tables in charinfo.nlp.
- //
- internal const char HIGH_SURROGATE_START = '\ud800';
- internal const char HIGH_SURROGATE_END = '\udbff';
- internal const char LOW_SURROGATE_START = '\udc00';
- internal const char LOW_SURROGATE_END = '\udfff';
-
- internal const int UNICODE_CATEGORY_OFFSET = 0;
- internal const int BIDI_CATEGORY_OFFSET = 1;
-
-
-
- // The starting codepoint for Unicode plane 1. Plane 1 contains 0x010000 ~ 0x01ffff.
- internal const int UNICODE_PLANE01_START = 0x10000;
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Actions:
- // Convert the BMP character or surrogate pointed by index to a UTF32 value.
- // This is similar to Char.ConvertToUTF32, but the difference is that
- // it does not throw exceptions when invalid surrogate characters are passed in.
- //
- // WARNING: since it doesn't throw an exception it CAN return a value
- // in the surrogate range D800-DFFF, which are not legal unicode values.
- //
- ////////////////////////////////////////////////////////////////////////
-
- internal static int InternalConvertToUtf32(String s, int index)
- {
- Debug.Assert(s != null, "s != null");
- Debug.Assert(index >= 0 && index < s.Length, "index < s.Length");
- if (index < s.Length - 1)
- {
- int temp1 = (int)s[index] - HIGH_SURROGATE_START;
- if (temp1 >= 0 && temp1 <= 0x3ff)
- {
- int temp2 = (int)s[index + 1] - LOW_SURROGATE_START;
- if (temp2 >= 0 && temp2 <= 0x3ff)
- {
- // Convert the surrogate to UTF32 and get the result.
- return ((temp1 * 0x400) + temp2 + UNICODE_PLANE01_START);
- }
- }
- }
- return ((int)s[index]);
- }
- ////////////////////////////////////////////////////////////////////////
- //
- // Convert a character or a surrogate pair starting at index of string s
- // to UTF32 value.
- //
- // Parameters:
- // s The string
- // index The starting index. It can point to a BMP character or
- // a surrogate pair.
- // len The length of the string.
- // charLength [out] If the index points to a BMP char, charLength
- // will be 1. If the index points to a surrogate pair,
- // charLength will be 2.
- //
- // WARNING: since it doesn't throw an exception it CAN return a value
- // in the surrogate range D800-DFFF, which are not legal unicode values.
- //
- // Returns:
- // The UTF32 value
- //
- ////////////////////////////////////////////////////////////////////////
-
- internal static int InternalConvertToUtf32(String s, int index, out int charLength)
- {
- Debug.Assert(s != null, "s != null");
- Debug.Assert(s.Length > 0, "s.Length > 0");
- Debug.Assert(index >= 0 && index < s.Length, "index >= 0 && index < s.Length");
- charLength = 1;
- if (index < s.Length - 1)
- {
- int temp1 = (int)s[index] - HIGH_SURROGATE_START;
- if (temp1 >= 0 && temp1 <= 0x3ff)
- {
- int temp2 = (int)s[index + 1] - LOW_SURROGATE_START;
- if (temp2 >= 0 && temp2 <= 0x3ff)
- {
- // Convert the surrogate to UTF32 and get the result.
- charLength++;
- return ((temp1 * 0x400) + temp2 + UNICODE_PLANE01_START);
- }
- }
- }
- return ((int)s[index]);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // IsWhiteSpace
- //
- // Determines if the given character is a white space character.
- //
- ////////////////////////////////////////////////////////////////////////
-
- internal static bool IsWhiteSpace(String s, int index)
- {
- Debug.Assert(s != null, "s!=null");
- Debug.Assert(index >= 0 && index < s.Length, "index >= 0 && index < s.Length");
-
- UnicodeCategory uc = GetUnicodeCategory(s, index);
- // In Unicode 3.0, U+2028 is the only character which is under the category "LineSeparator".
- // And U+2029 is th eonly character which is under the category "ParagraphSeparator".
- switch (uc)
- {
- case (UnicodeCategory.SpaceSeparator):
- case (UnicodeCategory.LineSeparator):
- case (UnicodeCategory.ParagraphSeparator):
- return (true);
- }
- return (false);
- }
-
-
- internal static bool IsWhiteSpace(char c)
- {
- UnicodeCategory uc = GetUnicodeCategory(c);
- // In Unicode 3.0, U+2028 is the only character which is under the category "LineSeparator".
- // And U+2029 is th eonly character which is under the category "ParagraphSeparator".
- switch (uc)
- {
- case (UnicodeCategory.SpaceSeparator):
- case (UnicodeCategory.LineSeparator):
- case (UnicodeCategory.ParagraphSeparator):
- return (true);
- }
-
- return (false);
- }
-
-
- //
- // This is called by the public char and string, index versions
- //
- // Note that for ch in the range D800-DFFF we just treat it as any other non-numeric character
- //
- internal static unsafe double InternalGetNumericValue(int ch)
- {
- Debug.Assert(ch >= 0 && ch <= 0x10ffff, "ch is not in valid Unicode range.");
- // Get the level 2 item from the highest 12 bit (8 - 19) of ch.
- ushort index = s_pNumericLevel1Index[ch >> 8];
- // Get the level 2 WORD offset from the 4 - 7 bit of ch. This provides the base offset of the level 3 table.
- // The offset is referred to an float item in m_pNumericFloatData.
- // Note that & has the lower precedence than addition, so don't forget the parathesis.
- index = s_pNumericLevel1Index[index + ((ch >> 4) & 0x000f)];
-
- fixed (ushort* pUshortPtr = &(s_pNumericLevel1Index[index]))
- {
- byte* pBytePtr = (byte*)pUshortPtr;
- fixed (byte* pByteNum = s_pNumericValues)
- {
- double* pDouble = (double*)pByteNum;
- return pDouble[pBytePtr[(ch & 0x000f)]];
- }
- }
- }
-
- internal static unsafe ushort InternalGetDigitValues(int ch)
- {
- Debug.Assert(ch >= 0 && ch <= 0x10ffff, "ch is not in valid Unicode range.");
- // Get the level 2 item from the highest 12 bit (8 - 19) of ch.
- ushort index = s_pNumericLevel1Index[ch >> 8];
- // Get the level 2 WORD offset from the 4 - 7 bit of ch. This provides the base offset of the level 3 table.
- // Note that & has the lower precedence than addition, so don't forget the parathesis.
- index = s_pNumericLevel1Index[index + ((ch >> 4) & 0x000f)];
-
- fixed (ushort* pUshortPtr = &(s_pNumericLevel1Index[index]))
- {
- byte* pBytePtr = (byte*)pUshortPtr;
- return s_pDigitValues[pBytePtr[(ch & 0x000f)]];
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- //Returns the numeric value associated with the character c. If the character is a fraction,
- // the return value will not be an integer. If the character does not have a numeric value, the return value is -1.
- //
- //Returns:
- // the numeric value for the specified Unicode character. If the character does not have a numeric value, the return value is -1.
- //Arguments:
- // ch a Unicode character
- //Exceptions:
- // ArgumentNullException
- // ArgumentOutOfRangeException
- //
- ////////////////////////////////////////////////////////////////////////
-
-
- public static double GetNumericValue(char ch)
- {
- return (InternalGetNumericValue(ch));
- }
-
-
- public static double GetNumericValue(String s, int index)
- {
- if (s == null)
- {
- throw new ArgumentNullException(nameof(s));
- }
- if (index < 0 || index >= s.Length)
- {
- throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
- }
- Contract.EndContractBlock();
- return (InternalGetNumericValue(InternalConvertToUtf32(s, index)));
- }
-
- public static int GetDecimalDigitValue(char ch)
- {
- return (sbyte)(InternalGetDigitValues(ch) >> 8);
- }
-
- public static int GetDecimalDigitValue(String s, int index)
- {
- if (s == null)
- {
- throw new ArgumentNullException(nameof(s));
- }
-
- if (index < 0 || index >= s.Length)
- {
- throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
- }
- Contract.EndContractBlock();
-
- return (sbyte)(InternalGetDigitValues(InternalConvertToUtf32(s, index)) >> 8);
- }
-
- public static int GetDigitValue(char ch)
- {
- return (sbyte)(InternalGetDigitValues(ch) & 0x00FF);
- }
-
- public static int GetDigitValue(String s, int index)
- {
- if (s == null)
- {
- throw new ArgumentNullException(nameof(s));
- }
-
- if (index < 0 || index >= s.Length)
- {
- throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
- }
-
- Contract.EndContractBlock();
- return (sbyte)(InternalGetDigitValues(InternalConvertToUtf32(s, index)) & 0x00FF);
- }
-
- public static UnicodeCategory GetUnicodeCategory(char ch)
- {
- return (InternalGetUnicodeCategory(ch));
- }
-
- public static UnicodeCategory GetUnicodeCategory(String s, int index)
- {
- if (s == null)
- throw new ArgumentNullException(nameof(s));
- if (((uint)index) >= ((uint)s.Length))
- {
- throw new ArgumentOutOfRangeException(nameof(index));
- }
- Contract.EndContractBlock();
- return InternalGetUnicodeCategory(s, index);
- }
-
- internal static unsafe UnicodeCategory InternalGetUnicodeCategory(int ch)
- {
- return ((UnicodeCategory)InternalGetCategoryValue(ch, UNICODE_CATEGORY_OFFSET));
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- //Action: Returns the Unicode Category property for the character c.
- //Returns:
- // an value in UnicodeCategory enum
- //Arguments:
- // ch a Unicode character
- //Exceptions:
- // None
- //
- //Note that this API will return values for D800-DF00 surrogate halves.
- //
- ////////////////////////////////////////////////////////////////////////
-
- internal static unsafe byte InternalGetCategoryValue(int ch, int offset)
- {
- Debug.Assert(ch >= 0 && ch <= 0x10ffff, "ch is not in valid Unicode range.");
- // Get the level 2 item from the highest 12 bit (8 - 19) of ch.
- ushort index = s_pCategoryLevel1Index[ch >> 8];
- // Get the level 2 WORD offset from the 4 - 7 bit of ch. This provides the base offset of the level 3 table.
- // Note that & has the lower precedence than addition, so don't forget the parathesis.
- index = s_pCategoryLevel1Index[index + ((ch >> 4) & 0x000f)];
-
- fixed (ushort* pUshortPtr = &(s_pCategoryLevel1Index[index]))
- {
- byte* pBytePtr = (byte*)pUshortPtr;
- // Get the result from the 0 -3 bit of ch.
- byte valueIndex = pBytePtr[(ch & 0x000f)];
- byte uc = s_pCategoriesValue[valueIndex * 2 + offset];
- //
- // Make sure that OtherNotAssigned is the last category in UnicodeCategory.
- // If that changes, change the following assertion as well.
- //
- //Debug.Assert(uc >= 0 && uc <= UnicodeCategory.OtherNotAssigned, "Table returns incorrect Unicode category");
- return (uc);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- //Action: Returns the Unicode Category property for the character c.
- //Returns:
- // an value in UnicodeCategory enum
- //Arguments:
- // value a Unicode String
- // index Index for the specified string.
- //Exceptions:
- // None
- //
- ////////////////////////////////////////////////////////////////////////
-
- internal static UnicodeCategory InternalGetUnicodeCategory(String value, int index)
- {
- Debug.Assert(value != null, "value can not be null");
- Debug.Assert(index < value.Length, "index < value.Length");
-
- return (InternalGetUnicodeCategory(InternalConvertToUtf32(value, index)));
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Get the Unicode category of the character starting at index. If the character is in BMP, charLength will return 1.
- // If the character is a valid surrogate pair, charLength will return 2.
- //
- ////////////////////////////////////////////////////////////////////////
-
- internal static UnicodeCategory InternalGetUnicodeCategory(String str, int index, out int charLength)
- {
- Debug.Assert(str != null, "str can not be null");
- Debug.Assert(str.Length > 0, "str.Length > 0"); ;
- Debug.Assert(index >= 0 && index < str.Length, "index >= 0 && index < str.Length");
-
- return (InternalGetUnicodeCategory(InternalConvertToUtf32(str, index, out charLength)));
- }
-
- internal static bool IsCombiningCategory(UnicodeCategory uc)
- {
- Debug.Assert(uc >= 0, "uc >= 0");
- return (
- uc == UnicodeCategory.NonSpacingMark ||
- uc == UnicodeCategory.SpacingCombiningMark ||
- uc == UnicodeCategory.EnclosingMark
- );
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CharUnicodeInfoData.cs b/src/mscorlib/corefx/System/Globalization/CharUnicodeInfoData.cs
deleted file mode 100644
index b1bef8146e..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CharUnicodeInfoData.cs
+++ /dev/null
@@ -1,1247 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-
-namespace System.Globalization
-{
- public static partial class CharUnicodeInfo
- {
- // THE FOLLOWING DATA IS AUTO GENERATED BY GenUnicodeProp.pl SCRIPT UNDER THE TOOLS FOLDER
- // PLEASE DON'T MODIFY BY HAND
-
-
- // 12:4:4 index table of the Unicode cateogry data.
- private static ushort[] s_pCategoryLevel1Index = new ushort[]
- {
- 0x1100, 0x1110, 0x1120, 0x1130, 0x1140, 0x1150, 0x1160, 0x1170, 0x1180, 0x1190, 0x11a0, 0x11b0, 0x11c0, 0x11d0, 0x11e0, 0x11f0,
- 0x1200, 0x1210, 0x1220, 0x1230, 0x1240, 0x1210, 0x1250, 0x1260, 0x1270, 0x1280, 0x1290, 0x12a0, 0x12b0, 0x12c0, 0x12d0, 0x12e0,
- 0x12f0, 0x1300, 0x1310, 0x1320, 0x1330, 0x1340, 0x1350, 0x1360, 0x1370, 0x1380, 0x1390, 0x13a0, 0x13b0, 0x13c0, 0x13d0, 0x13e0,
- 0x13f0, 0x1400, 0x1410, 0x1420, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1430, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1440,
- 0x1450, 0x1210, 0x1210, 0x1210, 0x1460, 0x1210, 0x1470, 0x1480, 0x1490, 0x14a0, 0x14b0, 0x14c0, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x14d0, 0x14e0, 0x14e0, 0x14e0, 0x14e0, 0x14e0, 0x14e0, 0x14e0, 0x14e0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x1210, 0x1500, 0x1510, 0x1520, 0x1530, 0x1540, 0x1550,
- 0x1560, 0x1570, 0x1580, 0x1590, 0x15a0, 0x15b0, 0x1210, 0x15c0, 0x15d0, 0x15e0, 0x15f0, 0x1600, 0x1610, 0x1620, 0x1630, 0x1620,
- 0x1640, 0x1650, 0x1660, 0x1670, 0x1680, 0x1690, 0x16a0, 0x16b0, 0x16c0, 0x1620, 0x16d0, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1210, 0x1210, 0x1210, 0x16e0, 0x16f0, 0x1700, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1710, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1210, 0x1210, 0x1720, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1210, 0x1210, 0x1730, 0x1740, 0x1620, 0x1620, 0x1620, 0x1750,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1760, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1770, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1780, 0x1790, 0x17a0, 0x17b0, 0x17c0, 0x17d0, 0x17e0, 0x17f0, 0x1370, 0x1370, 0x1800, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1810, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1820, 0x1620,
- 0x1830, 0x1840, 0x1850, 0x1860, 0x1870, 0x1880, 0x1890, 0x18a0, 0x18b0, 0x18c0, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x18d0, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x18e0, 0x18f0, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210,
- 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1900, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1210, 0x1210, 0x1910, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1920, 0x1930, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620, 0x1620,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x1940,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0,
- 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x14f0, 0x1940,
- 0x1950, 0x1958, 0x1960, 0x1968, 0x1970, 0x1978, 0x1980, 0x1988, 0x1990, 0x1998, 0x19a0, 0x19a8, 0x19b0, 0x19b8, 0x19c0, 0x19c8,
- 0x19d0, 0x19d0, 0x19d0, 0x19d8, 0x19e0, 0x19d0, 0x19d0, 0x19e8, 0x19f0, 0x19f8, 0x1a00, 0x1a08, 0x1a10, 0x1a18, 0x19d0, 0x1a20,
- 0x19d0, 0x19d0, 0x19d0, 0x1a28, 0x1a30, 0x19c0, 0x19c0, 0x19c0, 0x19c0, 0x1a38, 0x19c0, 0x1a40, 0x1a48, 0x1a50, 0x1a58, 0x1a60,
- 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a70, 0x1a78, 0x1a80, 0x1a88, 0x19c0, 0x1a90, 0x1a98, 0x19d0, 0x1aa0,
- 0x19b0, 0x19b0, 0x19b0, 0x19c0, 0x19c0, 0x19c0, 0x19d0, 0x19d0, 0x1aa8, 0x19d0, 0x19d0, 0x19d0, 0x1ab0, 0x19d0, 0x19d0, 0x19d0,
- 0x19d0, 0x19d0, 0x19d0, 0x1ab8, 0x19b0, 0x1ac0, 0x1ac8, 0x19c0, 0x1ad0, 0x1ad8, 0x1a68, 0x1ae0, 0x1ae8, 0x1af0, 0x1af8, 0x1b00,
- 0x1b08, 0x1b10, 0x1b18, 0x1b18, 0x1b20, 0x1a68, 0x1b28, 0x1b30, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b38, 0x1b40, 0x1b48,
- 0x1b50, 0x1b58, 0x1b18, 0x1a68, 0x1b60, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b68, 0x1b70, 0x1b78, 0x1af0, 0x1b80, 0x1b88,
- 0x1af0, 0x1b90, 0x1b98, 0x1ba0, 0x1af0, 0x1ba8, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1b18, 0x1bb8, 0x1bb0, 0x1bb0, 0x1bc0, 0x1a68,
- 0x1bc8, 0x1bd0, 0x1bd0, 0x1bd8, 0x1be0, 0x1be8, 0x1bf0, 0x1bf8, 0x1c00, 0x1c08, 0x1c10, 0x1c18, 0x1c20, 0x1c28, 0x1c30, 0x1c38,
- 0x1c40, 0x1c08, 0x1c10, 0x1c48, 0x1c50, 0x1c58, 0x1c60, 0x1c68, 0x1c70, 0x1c78, 0x1c10, 0x1c80, 0x1c88, 0x1c90, 0x1c30, 0x1c98,
- 0x1ca0, 0x1c08, 0x1c10, 0x1ca8, 0x1cb0, 0x1cb8, 0x1c30, 0x1cc0, 0x1cc8, 0x1cd0, 0x1cd8, 0x1ce0, 0x1ce8, 0x1cf0, 0x1c60, 0x1cf8,
- 0x1d00, 0x1d08, 0x1c10, 0x1d10, 0x1d18, 0x1d20, 0x1c30, 0x1d28, 0x1d30, 0x1d08, 0x1c10, 0x1d38, 0x1d40, 0x1d48, 0x1c30, 0x1d50,
- 0x1d30, 0x1d08, 0x1bd0, 0x1d58, 0x1d60, 0x1d68, 0x1c30, 0x1d70, 0x1d78, 0x1d80, 0x1bd0, 0x1d88, 0x1d90, 0x1d98, 0x1c60, 0x1da0,
- 0x1da8, 0x1bd0, 0x1bd0, 0x1db0, 0x1db8, 0x1dc0, 0x1bb0, 0x1bb0, 0x1dc8, 0x1dd0, 0x1dd8, 0x1de0, 0x1de8, 0x1df0, 0x1bb0, 0x1bb0,
- 0x1df8, 0x1e00, 0x1e08, 0x1e10, 0x1e18, 0x1bd0, 0x1e20, 0x1e28, 0x1e30, 0x1e38, 0x1a68, 0x1e40, 0x1e48, 0x1e50, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x1bd0, 0x1e58, 0x1e60, 0x1e68, 0x1e70, 0x1e78, 0x1e80, 0x1e88, 0x1e90, 0x19b0, 0x19b0, 0x1e98, 0x1bd0, 0x1bd0, 0x1ea0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1ea8, 0x1eb0, 0x1bd0, 0x1bd0, 0x1ea8, 0x1bd0, 0x1bd0, 0x1eb8, 0x1ec0, 0x1ec8, 0x1bd0, 0x1bd0,
- 0x1bd0, 0x1ec0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1ed0, 0x1ed8, 0x1ee0, 0x1bd0, 0x1ee8, 0x19b0, 0x19b0, 0x19b0, 0x19b0, 0x19b0, 0x1ef0,
- 0x1ef8, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1f00, 0x1bd0, 0x1f08, 0x1f10, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1f18, 0x1f20,
- 0x1f28, 0x1f30, 0x1bd0, 0x1f38, 0x1bd0, 0x1f40, 0x1f28, 0x1f48, 0x1bd0, 0x1bd0, 0x1bd0, 0x1f50, 0x1f58, 0x1f60, 0x1f68, 0x1f70,
- 0x1f78, 0x1f68, 0x1bd0, 0x1bd0, 0x1f80, 0x1bd0, 0x1bd0, 0x1f88, 0x1bd0, 0x1bd0, 0x1f90, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1f98,
- 0x1bd0, 0x1fa0, 0x1fa8, 0x1fb0, 0x1fb8, 0x1bd0, 0x1fc0, 0x1fc8, 0x1bd0, 0x1bd0, 0x1fd0, 0x1bd0, 0x1fd8, 0x1fe0, 0x1fe8, 0x1fe8,
- 0x1bd0, 0x1ff0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1ff8, 0x2000, 0x2008, 0x1f68, 0x1f68, 0x2010, 0x2018, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x2020, 0x1bd0, 0x1bd0, 0x2028, 0x2030, 0x1e68, 0x2038, 0x2040, 0x2048, 0x1bd0, 0x2050, 0x2058, 0x1bd0, 0x1bd0, 0x2060, 0x2068,
- 0x1bd0, 0x1bd0, 0x2070, 0x2078, 0x2080, 0x2058, 0x1bd0, 0x2088, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x2090, 0x2098, 0x20a0, 0x20a8,
- 0x19c0, 0x19c0, 0x20b0, 0x20b8, 0x20b8, 0x20b8, 0x20c0, 0x20c8, 0x19c0, 0x20d0, 0x20b8, 0x20b8, 0x1a68, 0x1a68, 0x1a68, 0x20d8,
- 0x19d0, 0x19d0, 0x19d0, 0x19d0, 0x19d0, 0x19d0, 0x19d0, 0x19d0, 0x19d0, 0x20e0, 0x19d0, 0x19d0, 0x19d0, 0x19d0, 0x19d0, 0x19d0,
- 0x20e8, 0x20f0, 0x20e8, 0x20e8, 0x20f0, 0x20f8, 0x20e8, 0x2100, 0x2108, 0x2108, 0x2108, 0x2110, 0x2118, 0x2120, 0x2128, 0x2130,
- 0x2138, 0x2140, 0x2148, 0x2150, 0x2158, 0x2160, 0x2168, 0x2170, 0x2178, 0x2180, 0x2188, 0x2190, 0x1bb0, 0x2198, 0x21a0, 0x21a8,
- 0x21b0, 0x21b8, 0x21c0, 0x21c8, 0x21d0, 0x21d8, 0x21e0, 0x21e0, 0x21e8, 0x21f0, 0x21f8, 0x1fe8, 0x2200, 0x2208, 0x1fe8, 0x2210,
- 0x2218, 0x2220, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218,
- 0x2228, 0x1fe8, 0x2230, 0x2238, 0x2240, 0x2240, 0x2240, 0x2248, 0x1fe8, 0x2250, 0x2218, 0x2258, 0x1fe8, 0x2260, 0x2268, 0x2270,
- 0x1fe8, 0x1fe8, 0x2278, 0x1bb0, 0x2270, 0x1bb0, 0x21d8, 0x21d8, 0x2280, 0x2288, 0x2240, 0x2240, 0x2240, 0x2240, 0x2290, 0x21d8,
- 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x2298, 0x22a0, 0x1fe8, 0x1fe8, 0x22a8,
- 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x22b0, 0x1fe8, 0x1fe8, 0x1fe8, 0x22b8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8,
- 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x22c0, 0x22c8, 0x21d8, 0x22d0, 0x1fe8, 0x1fe8, 0x22d8, 0x2218, 0x22e0, 0x2218,
- 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240,
- 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x22e8, 0x22f0, 0x2218, 0x2218, 0x2218, 0x22f8, 0x2218, 0x2300,
- 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218, 0x2218,
- 0x1fe8, 0x1fe8, 0x1fe8, 0x2218, 0x2308, 0x1fe8, 0x1fe8, 0x2310, 0x1fe8, 0x2318, 0x1fe8, 0x2320, 0x2328, 0x2330, 0x2338, 0x1bb0,
- 0x19b0, 0x19b0, 0x2340, 0x19c0, 0x19c0, 0x2348, 0x2350, 0x2358, 0x19d0, 0x19d0, 0x19d0, 0x19d0, 0x19d0, 0x19d0, 0x2360, 0x2368,
- 0x19c0, 0x19c0, 0x2370, 0x1bd0, 0x1bd0, 0x1bd0, 0x2378, 0x2380, 0x1bd0, 0x2388, 0x2390, 0x2390, 0x2390, 0x2390, 0x1a68, 0x1a68,
- 0x2398, 0x23a0, 0x23a8, 0x23b0, 0x23b8, 0x1bb0, 0x1bb0, 0x1bb0, 0x1fe8, 0x23c0, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x23c8,
- 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x23d0, 0x1bb0, 0x23d8,
- 0x23e0, 0x23e8, 0x23f0, 0x23f8, 0x1da8, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x2400, 0x1ef8, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x2408,
- 0x2410, 0x1bd0, 0x1fc0, 0x1da8, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1fa0, 0x2418, 0x1bd0, 0x2420, 0x1fe8, 0x1fe8, 0x23c8, 0x1bd0,
- 0x2240, 0x2428, 0x2430, 0x2240, 0x2438, 0x2440, 0x2240, 0x2448, 0x2430, 0x2240, 0x2240, 0x2450, 0x2458, 0x2240, 0x2240, 0x2460,
- 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2468, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2470, 0x2240, 0x2478,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1f98, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1f98, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x2480, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1e20, 0x1fe8, 0x1fe8, 0x1fe8, 0x2278, 0x1bd0, 0x1bd0, 0x2088,
- 0x2488, 0x1bd0, 0x2490, 0x1bb0, 0x19d0, 0x19d0, 0x2498, 0x24a0, 0x19d0, 0x24a8, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x24b0, 0x24b8,
- 0x1a60, 0x24c0, 0x24c8, 0x24d0, 0x19d0, 0x19d0, 0x19d0, 0x24d8, 0x24e0, 0x24e8, 0x24f0, 0x24f8, 0x1bb0, 0x1bb0, 0x1bb0, 0x2500,
- 0x2508, 0x1bd0, 0x2510, 0x2518, 0x1bd0, 0x1bd0, 0x1bd0, 0x2520, 0x2528, 0x1bd0, 0x1bd0, 0x2530, 0x2538, 0x1f68, 0x1a68, 0x2540,
- 0x2058, 0x1bd0, 0x2548, 0x1bd0, 0x2550, 0x2558, 0x1bd0, 0x1e20, 0x1bc8, 0x1bd0, 0x1bd0, 0x2560, 0x2568, 0x2570, 0x2578, 0x2580,
- 0x1bd0, 0x1bd0, 0x2588, 0x2590, 0x2598, 0x25a0, 0x1bd0, 0x25a8, 0x1bd0, 0x1bd0, 0x1bd0, 0x25b0, 0x25b8, 0x25c0, 0x25c8, 0x25d0,
- 0x25d8, 0x25e0, 0x2390, 0x19c0, 0x19c0, 0x25e8, 0x25f0, 0x19c0, 0x19c0, 0x19c0, 0x19c0, 0x19c0, 0x1bd0, 0x1bd0, 0x25f8, 0x1f68,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x2600, 0x1bd0, 0x2608, 0x1bd0, 0x1bd0, 0x1fd0,
- 0x2610, 0x2610, 0x2610, 0x2610, 0x2610, 0x2610, 0x2610, 0x2610, 0x2610, 0x2610, 0x2610, 0x2610, 0x2610, 0x2610, 0x2610, 0x2610,
- 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1fc0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1fd8, 0x1bb0, 0x1bb0,
- 0x2620, 0x2628, 0x2630, 0x2638, 0x2640, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x2648, 0x2650, 0x2658, 0x1b18, 0x1b18,
- 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18,
- 0x1b18, 0x1b18, 0x1b18, 0x2660, 0x1bb0, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x2668, 0x1b18, 0x1b18, 0x2670, 0x1bb0, 0x1bb0, 0x2678,
- 0x1a68, 0x2680, 0x1a68, 0x2688, 0x2690, 0x2698, 0x26a0, 0x26a8, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x1b18, 0x26b0,
- 0x26b8, 0x1968, 0x1970, 0x1978, 0x1980, 0x26c0, 0x26c8, 0x26d0, 0x1bd0, 0x26d8, 0x1bd0, 0x1fa0, 0x26e0, 0x26e8, 0x26f0, 0x26f8,
- 0x2700, 0x1bd0, 0x1ec8, 0x2708, 0x1fc0, 0x1fc0, 0x1bb0, 0x1bb0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x2420,
- 0x2710, 0x2718, 0x2718, 0x2720, 0x2728, 0x2728, 0x2728, 0x2730, 0x2738, 0x23d8, 0x2740, 0x1bb0, 0x1bb0, 0x2240, 0x2240, 0x2748,
- 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bd0, 0x1e20, 0x1bd0, 0x1bd0, 0x1bd0, 0x1c90, 0x2750, 0x2758,
- 0x1bd0, 0x1bd0, 0x2760, 0x1bd0, 0x2768, 0x1bd0, 0x1bd0, 0x2770, 0x1bd0, 0x2778, 0x1bd0, 0x1bd0, 0x2780, 0x2788, 0x1bb0, 0x1bb0,
- 0x19b0, 0x19b0, 0x2790, 0x19c0, 0x19c0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1fc0, 0x1f68, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x1bd0, 0x1f88, 0x1bd0, 0x1bd0, 0x1bd0, 0x2798, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x2388, 0x1bd0, 0x1f98, 0x1f88, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x27a0, 0x1af0, 0x1af0, 0x27a8, 0x1af0, 0x27b0, 0x1af0, 0x27b8, 0x1af0, 0x27c0, 0x27c8, 0x1bb0, 0x1bb0, 0x1bb0, 0x1af0, 0x27d0,
- 0x1af0, 0x27d8, 0x1af0, 0x27e0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1af0, 0x1af0, 0x1af0, 0x27e8, 0x27f0, 0x27f8, 0x27f0, 0x27f0,
- 0x2800, 0x2808, 0x1af0, 0x2810, 0x2818, 0x2820, 0x1af0, 0x2828, 0x1af0, 0x2830, 0x1bb0, 0x1bb0, 0x2838, 0x1af0, 0x2840, 0x2848,
- 0x1af0, 0x1af0, 0x1af0, 0x2850, 0x1af0, 0x2858, 0x1af0, 0x2860, 0x1af0, 0x2868, 0x2870, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1af0, 0x1af0, 0x1af0, 0x1af0, 0x2878, 0x1bb0, 0x1bb0, 0x1bb0, 0x2880, 0x2880, 0x2880, 0x2888, 0x2890, 0x2890, 0x2890, 0x2898,
- 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x28a0, 0x28a8, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x28b0, 0x1bd0, 0x1bd0, 0x28b8, 0x28c0, 0x28c8, 0x28d0, 0x28d8, 0x2048, 0x1bd0, 0x1bd0, 0x28e0, 0x28e8, 0x1bd0, 0x28f0, 0x1f68,
- 0x28f8, 0x1bd0, 0x2900, 0x2908, 0x2910, 0x1bd0, 0x1bd0, 0x2918, 0x2048, 0x1bd0, 0x1bd0, 0x2920, 0x2928, 0x2930, 0x2938, 0x2940,
- 0x1bd0, 0x1c78, 0x2948, 0x2950, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x2958, 0x2960, 0x2968, 0x1bd0, 0x1bd0, 0x2970, 0x2978, 0x1f68,
- 0x2980, 0x1c08, 0x1c10, 0x1c80, 0x2988, 0x2990, 0x2998, 0x29a0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bd0, 0x1bd0, 0x1bd0, 0x29a8, 0x29b0, 0x1f68, 0x1bb0, 0x1bb0,
- 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bd0, 0x1bd0, 0x29b8, 0x29c0, 0x29c8, 0x29d0, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x29d8, 0x29e0, 0x1f68, 0x1bb0, 0x1bb0, 0x1bd0, 0x1bd0, 0x29e8, 0x29f0, 0x1f68, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x29f8, 0x2a00, 0x2a08, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x19b0, 0x19b0, 0x19c0, 0x19c0, 0x1e08, 0x2a10,
- 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bd0, 0x1bd0, 0x1bd0, 0x28f0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1fd8, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x21e0, 0x21e0, 0x21e0, 0x21e0, 0x21e0, 0x21e0, 0x2a18, 0x2a20, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x2600, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x1bd0, 0x1fa0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x2388, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x28f0, 0x1bd0, 0x1fa0, 0x2570, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bd0, 0x1fc0, 0x2a28,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x2a30, 0x2a38, 0x2a40, 0x2a48, 0x2a50, 0x1bd0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1fc8, 0x2a58, 0x2a60, 0x2a68, 0x28d8, 0x2a70, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x2a78, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x2420, 0x1e20, 0x28f0, 0x2a80, 0x2a88, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2240, 0x2a90,
- 0x2240, 0x2240, 0x2a98, 0x2240, 0x2240, 0x2240, 0x2aa0, 0x2aa8, 0x2ab0, 0x2240, 0x2ab8, 0x2240, 0x2240, 0x2240, 0x2ac0, 0x1bb0,
- 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x2ac8, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x2278, 0x2718, 0x2ad0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x19b0, 0x2ad8, 0x19c0, 0x2ae0, 0x2ae8, 0x2af0, 0x20e8, 0x19b0, 0x2af8, 0x2b00, 0x2b08, 0x2b10, 0x2b18, 0x19b0, 0x2ad8, 0x19c0,
- 0x2b20, 0x2b28, 0x19c0, 0x2b30, 0x2b38, 0x2b40, 0x2b48, 0x19b0, 0x2b50, 0x19c0, 0x19b0, 0x2ad8, 0x19c0, 0x2ae0, 0x2ae8, 0x19c0,
- 0x20e8, 0x19b0, 0x2af8, 0x2b48, 0x19b0, 0x2b50, 0x19c0, 0x19b0, 0x2ad8, 0x19c0, 0x2b58, 0x19b0, 0x2b60, 0x2b68, 0x2b70, 0x2b78,
- 0x19c0, 0x2b80, 0x19b0, 0x2b88, 0x2b90, 0x2b98, 0x2ba0, 0x19c0, 0x2ba8, 0x19b0, 0x2bb0, 0x19c0, 0x2bb8, 0x2bc0, 0x2bc0, 0x2bc0,
- 0x1a68, 0x1a68, 0x1a68, 0x2bc8, 0x1a68, 0x1a68, 0x2bd0, 0x2bd8, 0x2be0, 0x2be8, 0x1ad8, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1af0, 0x1af0, 0x1af0, 0x1af0, 0x1af0, 0x1af0, 0x1af0, 0x1af0, 0x1af0, 0x1af0, 0x1af0, 0x1af0, 0x2bf0, 0x2bf8, 0x1bb0, 0x1bb0,
- 0x2c00, 0x1b18, 0x2c08, 0x2c10, 0x2c18, 0x2c20, 0x2c28, 0x2c30, 0x2c38, 0x2c40, 0x2c48, 0x2c40, 0x1bb0, 0x1bb0, 0x1bb0, 0x2c50,
- 0x1fe8, 0x1fe8, 0x23d8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x23c8, 0x2c58, 0x2c60, 0x2c60, 0x2c60, 0x1fe8, 0x23d0,
- 0x2c68, 0x2240, 0x2460, 0x2240, 0x2240, 0x2240, 0x2c70, 0x2240, 0x2240, 0x2c78, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x2c80, 0x2240,
- 0x2c88, 0x2240, 0x2240, 0x2c78, 0x2ac0, 0x2c90, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x2c98,
- 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8,
- 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x23c0, 0x1fe8, 0x1fe8, 0x2ca0, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8,
- 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x2740, 0x2ca8, 0x23c8,
- 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x23c8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x1fe8, 0x2cb0, 0x1bb0, 0x1bb0,
- 0x23d8, 0x1fe8, 0x1fe8, 0x1fe8, 0x2cb8, 0x1ee8, 0x1fe8, 0x1fe8, 0x2cb8, 0x1fe8, 0x2cc0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bb0, 0x2cc8, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x2cb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x2740, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x2388, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1fc8, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0,
- 0x1bd0, 0x1fc0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0,
- 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x1bd0, 0x2a78, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1bd0, 0x1fc0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x2cd0, 0x1bb0, 0x2cd8, 0x2cd8, 0x2cd8, 0x2cd8, 0x2cd8, 0x2cd8, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0, 0x1bb0,
- 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1a68, 0x1bb0,
- 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2618, 0x2ce0,
- 0x0101, 0x0101, 0x0101, 0x0101, 0x0201, 0x0203, 0x0304, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0303, 0x0203,
- 0x0605, 0x0706, 0x0708, 0x0606, 0x0a09, 0x0b06, 0x0d0c, 0x0c0c, 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e, 0x060c, 0x0f0f, 0x060f,
- 0x1006, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0910, 0x0a06, 0x1211,
- 0x1311, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x0913, 0x0a0f, 0x010f,
- 0x0101, 0x0101, 0x0301, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101, 0x0101,
- 0x0614, 0x0808, 0x0808, 0x0615, 0x1511, 0x1716, 0x180f, 0x1115, 0x1a19, 0x1b1b, 0x1311, 0x0606, 0x1b11, 0x1c16, 0x1d1d, 0x061d,
- 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0f10, 0x1010, 0x1010, 0x1010, 0x1310,
- 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x0f13, 0x1313, 0x1313, 0x1313, 0x1313,
- 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1013, 0x1013, 0x1013, 0x1013,
- 0x1013, 0x1013, 0x1013, 0x1013, 0x1313, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1010, 0x1013, 0x1013, 0x1313,
- 0x1013, 0x1310, 0x1310, 0x1010, 0x1013, 0x1010, 0x1313, 0x1010, 0x1010, 0x1013, 0x1310, 0x1010, 0x1310, 0x1313, 0x1010, 0x1013,
- 0x1310, 0x1310, 0x1310, 0x1010, 0x1013, 0x1313, 0x1310, 0x1010, 0x1013, 0x1010, 0x1013, 0x1013, 0x1310, 0x1613, 0x1310, 0x1313,
- 0x1616, 0x1616, 0x1e10, 0x1013, 0x131e, 0x1e10, 0x1013, 0x1013, 0x1013, 0x1013, 0x1013, 0x1013, 0x1013, 0x1013, 0x1313, 0x1310,
- 0x1013, 0x131e, 0x1310, 0x1010, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1313, 0x1313, 0x1313, 0x1010, 0x1013, 0x1310,
- 0x1013, 0x1013, 0x1010, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1313, 0x1313, 0x1316, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313,
- 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x201f, 0x1f20, 0x1f1f, 0x1f1f, 0x1f1f, 0x1111, 0x1111, 0x2020, 0x2020, 0x2020, 0x2020, 0x2020,
- 0x1f1f, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1f1f, 0x1f1f, 0x111f, 0x1111, 0x1111, 0x1111, 0x1120, 0x111f,
- 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121,
- 0x1310, 0x1310, 0x1120, 0x1310, 0x0000, 0x131f, 0x1313, 0x1006, 0x0000, 0x0000, 0x1111, 0x0610, 0x1010, 0x0010, 0x0010, 0x1010,
- 0x1013, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1000, 0x1010, 0x1010, 0x1010, 0x1010, 0x1313, 0x1313,
- 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1013, 0x1313, 0x1010, 0x1310, 0x1313, 0x1310, 0x1310, 0x1310, 0x1310,
- 0x1313, 0x1313, 0x1310, 0x100f, 0x1013, 0x1310, 0x1013, 0x1010, 0x1310, 0x2122, 0x2121, 0x2121, 0x2323, 0x1310, 0x1310, 0x1310,
- 0x1010, 0x1013, 0x1013, 0x1013, 0x1013, 0x1013, 0x1013, 0x1313, 0x1000, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010,
- 0x1010, 0x1010, 0x1010, 0x0010, 0x1f00, 0x2424, 0x2424, 0x2424, 0x1300, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313,
- 0x1313, 0x1313, 0x1313, 0x1313, 0x2400, 0x0025, 0x1500, 0x0815, 0x2100, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121,
- 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2126, 0x2127, 0x2721, 0x2121, 0x2127, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x0028, 0x0000, 0x0000,
- 0x2828, 0x2728, 0x0027, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2929, 0x2929, 0x2929, 0x0f0f, 0x072a, 0x2b07, 0x2c0c, 0x1515,
- 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2c21, 0x002d, 0x2c2c, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e,
- 0x2e2f, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x212e, 0x2121, 0x2121, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x3107, 0x2c31, 0x2e2e,
- 0x2e21, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2c, 0x2121, 0x2121, 0x2121, 0x2921, 0x2115,
- 0x2121, 0x2121, 0x2f21, 0x212f, 0x1521, 0x2121, 0x2121, 0x2e2e, 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e, 0x2e2e, 0x322e, 0x2e32,
- 0x2c2c, 0x2c2c, 0x2c2c, 0x2c2c, 0x2c2c, 0x2c2c, 0x2c2c, 0x2d00, 0x212e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e,
- 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x0021, 0x2e00, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121,
- 0x2e21, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3333, 0x3333, 0x3333, 0x3333, 0x3333, 0x2828, 0x2828, 0x2828,
- 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2128, 0x2121, 0x2121, 0x2121, 0x2121, 0x3434, 0x0615, 0x0606, 0x0034, 0x0000, 0x0000,
- 0x2828, 0x2828, 0x2828, 0x2121, 0x2121, 0x2134, 0x2121, 0x2121, 0x2121, 0x2121, 0x2134, 0x2121, 0x2134, 0x2121, 0x2121, 0x0000,
- 0x2727, 0x2727, 0x2727, 0x2727, 0x2727, 0x2727, 0x2727, 0x0027, 0x2828, 0x2828, 0x2828, 0x2828, 0x2128, 0x2121, 0x0000, 0x0027,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2e2e, 0x2e2e, 0x002e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x2100, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x3521, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x3521, 0x1621, 0x3535,
- 0x2135, 0x2121, 0x2121, 0x2121, 0x3521, 0x3535, 0x2135, 0x3535, 0x2116, 0x2121, 0x2121, 0x2121, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x2121, 0x2424, 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x1f24, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x2116, 0x3535, 0x1600, 0x1616, 0x1616, 0x1616, 0x0016, 0x1600, 0x0016, 0x1600, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x0016, 0x1616, 0x1616, 0x1616, 0x0016, 0x0016, 0x0000, 0x1616, 0x1616, 0x0000, 0x1621, 0x3535,
- 0x2135, 0x2121, 0x0021, 0x3500, 0x0035, 0x3500, 0x2135, 0x0016, 0x0000, 0x0000, 0x0000, 0x3500, 0x0000, 0x0000, 0x1616, 0x1600,
- 0x1616, 0x2121, 0x0000, 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x1616, 0x0808, 0x3737, 0x3737, 0x3737, 0x0822, 0x0000, 0x0000,
- 0x2100, 0x3521, 0x1600, 0x1616, 0x1616, 0x0016, 0x0000, 0x1600, 0x0016, 0x1616, 0x1600, 0x0016, 0x1616, 0x0000, 0x0021, 0x3535,
- 0x2135, 0x0021, 0x0000, 0x2100, 0x0021, 0x2100, 0x2121, 0x0000, 0x2100, 0x0000, 0x0000, 0x0000, 0x1600, 0x1616, 0x0016, 0x0016,
- 0x0000, 0x0000, 0x0000, 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x2121, 0x1616, 0x2116, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x2100, 0x3521, 0x1600, 0x1616, 0x1616, 0x1616, 0x1616, 0x1600, 0x1616, 0x1600, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x0016, 0x1616, 0x1600, 0x1616, 0x1616, 0x0000, 0x1621, 0x3535, 0x2135, 0x2121, 0x2121, 0x2100, 0x3521, 0x3500, 0x2135, 0x0000,
- 0x0016, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0824, 0x0000, 0x0000, 0x0000, 0x1600, 0x0000, 0x0000, 0x0000,
- 0x2100, 0x3535, 0x1600, 0x1616, 0x1616, 0x1616, 0x0016, 0x1600, 0x0016, 0x1616, 0x1600, 0x1616, 0x1616, 0x0000, 0x1621, 0x2135,
- 0x2135, 0x2121, 0x0021, 0x3500, 0x0035, 0x3500, 0x2135, 0x0000, 0x0000, 0x0000, 0x0000, 0x3521, 0x0000, 0x0000, 0x1616, 0x1600,
- 0x1622, 0x3737, 0x3737, 0x3737, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1621, 0x1600, 0x1616, 0x1616, 0x0016, 0x0000, 0x1616,
- 0x0016, 0x1616, 0x1616, 0x0000, 0x1600, 0x0016, 0x0016, 0x1616, 0x0000, 0x1600, 0x0016, 0x0000, 0x1616, 0x0016, 0x0000, 0x1616,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0000, 0x0000, 0x3535, 0x3521, 0x0035, 0x0000, 0x3535, 0x0035, 0x3535, 0x2135, 0x0000,
- 0x0016, 0x0000, 0x0000, 0x3500, 0x0000, 0x0000, 0x0000, 0x0000, 0x3737, 0x1537, 0x1515, 0x1515, 0x0815, 0x0015, 0x0000, 0x0000,
- 0x3521, 0x3535, 0x1600, 0x1616, 0x1616, 0x1616, 0x0016, 0x1616, 0x0016, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0000, 0x1600, 0x2121, 0x3521, 0x3535, 0x0035, 0x2121, 0x0021, 0x2121, 0x2121, 0x0000,
- 0x0000, 0x0000, 0x2100, 0x0021, 0x1616, 0x0016, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1d1d, 0x1d1d, 0x1d1d, 0x221d,
- 0x2100, 0x3535, 0x1600, 0x1616, 0x1616, 0x1616, 0x0016, 0x1616, 0x1616, 0x1616, 0x1600, 0x1616, 0x1616, 0x0000, 0x1621, 0x3835,
- 0x3535, 0x3535, 0x0035, 0x3538, 0x0035, 0x3535, 0x2121, 0x0000, 0x0000, 0x0000, 0x3500, 0x0035, 0x0000, 0x0000, 0x0000, 0x0016,
- 0x1600, 0x0016, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0016, 0x1600, 0x3535,
- 0x2135, 0x2121, 0x0021, 0x3535, 0x0035, 0x3535, 0x2135, 0x0016, 0x0000, 0x0000, 0x0000, 0x3500, 0x0000, 0x0000, 0x0000, 0x1600,
- 0x3737, 0x3737, 0x3737, 0x0000, 0x2200, 0x1616, 0x1616, 0x1616, 0x0000, 0x3535, 0x1600, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x1616, 0x1616, 0x0016, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x1600, 0x1616, 0x1616, 0x1616, 0x1616, 0x1600, 0x0000,
- 0x1616, 0x1616, 0x1616, 0x0016, 0x0000, 0x0021, 0x0000, 0x3500, 0x3535, 0x2121, 0x0021, 0x0021, 0x3535, 0x3535, 0x3535, 0x3535,
- 0x0000, 0x3535, 0x0024, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1600, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x2116, 0x1616, 0x2121, 0x2121, 0x2121, 0x0021, 0x0000, 0x0800, 0x1616, 0x1616, 0x1616, 0x211f, 0x2121, 0x2121, 0x2121, 0x2421,
- 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x2424, 0x0000, 0x0000, 0x1600, 0x0016, 0x0016, 0x1600, 0x0016, 0x0016, 0x1600, 0x0000,
- 0x0000, 0x0000, 0x1616, 0x1616, 0x1600, 0x1616, 0x1616, 0x1616, 0x1600, 0x1616, 0x1600, 0x1600, 0x0000, 0x1616, 0x1600, 0x1616,
- 0x2116, 0x1616, 0x2121, 0x2121, 0x2121, 0x2100, 0x1621, 0x0000, 0x1616, 0x1616, 0x0016, 0x001f, 0x2121, 0x2121, 0x2121, 0x0000,
- 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x0000, 0x1616, 0x1616, 0x2216, 0x2222, 0x2424, 0x2424, 0x2424, 0x2424, 0x2424, 0x2424,
- 0x2424, 0x2224, 0x2224, 0x2222, 0x2121, 0x2222, 0x2222, 0x2222, 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x3737, 0x3737, 0x3737,
- 0x3737, 0x3737, 0x2122, 0x2122, 0x2122, 0x0a09, 0x0a09, 0x3535, 0x1616, 0x1616, 0x1616, 0x1616, 0x1600, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0016, 0x0000, 0x2100, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x3521,
- 0x2121, 0x2121, 0x2421, 0x2121, 0x1616, 0x1616, 0x2116, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2100, 0x2121, 0x2121, 0x2121,
- 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x0021, 0x2222, 0x2222, 0x2222, 0x2222, 0x2221, 0x2222, 0x2222, 0x0022, 0x2222,
- 0x2424, 0x2424, 0x2224, 0x2222, 0x2422, 0x0024, 0x0000, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x3516, 0x2135, 0x2121,
- 0x3521, 0x2121, 0x2121, 0x2121, 0x2135, 0x3521, 0x2135, 0x1621, 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x2424, 0x2424, 0x2424,
- 0x1616, 0x1616, 0x1616, 0x3535, 0x2121, 0x1616, 0x1616, 0x2121, 0x1621, 0x3535, 0x1635, 0x3516, 0x3535, 0x3535, 0x3535, 0x1616,
- 0x2116, 0x2121, 0x1621, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x3521, 0x2135, 0x3521, 0x3535, 0x3535, 0x2135, 0x3516,
- 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x3535, 0x2135, 0x2222, 0x1010, 0x1010, 0x1010, 0x1000, 0x0000, 0x0000, 0x1000, 0x0000,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x2416, 0x161f, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0016, 0x1616, 0x1616, 0x0000,
- 0x1616, 0x1616, 0x1616, 0x0016, 0x0016, 0x1616, 0x1616, 0x0000, 0x0016, 0x1616, 0x1616, 0x0000, 0x1616, 0x1616, 0x1616, 0x0016,
- 0x0016, 0x1616, 0x1616, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0016, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0016, 0x2100, 0x2121, 0x2424, 0x2424, 0x2424, 0x2424, 0x3724, 0x3737, 0x3737, 0x3737,
- 0x3737, 0x3737, 0x3737, 0x3737, 0x3737, 0x3737, 0x0037, 0x0000, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0000, 0x0000, 0x0000,
- 0x1010, 0x1010, 0x1010, 0x0000, 0x1313, 0x1313, 0x1313, 0x0000, 0x1625, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x2416, 0x1624, 0x1605, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0916, 0x000a, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x2416, 0x2424, 0x3939,
- 0x1639, 0x1616, 0x1616, 0x1616, 0x0016, 0x0000, 0x0000, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0016, 0x1616,
- 0x1616, 0x2121, 0x0021, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1616, 0x2121, 0x2421, 0x0024, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1616, 0x2121, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0016, 0x2121, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1616, 0x1616, 0x2121, 0x2135, 0x2121, 0x2121, 0x2121, 0x3535, 0x3535, 0x3535, 0x3535, 0x3521, 0x2135, 0x2121, 0x2121, 0x2121,
- 0x2121, 0x2121, 0x2424, 0x1f24, 0x2424, 0x0824, 0x2116, 0x0000, 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x0000, 0x0000, 0x0000,
- 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x0000, 0x0000, 0x0000, 0x0606, 0x0606, 0x0606, 0x0625, 0x0606, 0x2106, 0x2121, 0x0018,
- 0x1616, 0x1f16, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x2116, 0x0016, 0x0000, 0x0000, 0x1616, 0x1616, 0x1616, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0016, 0x2121, 0x3521, 0x3535, 0x2135, 0x3521, 0x3535, 0x0000, 0x0000,
- 0x3535, 0x3521, 0x3535, 0x3535, 0x2135, 0x2121, 0x0000, 0x0000, 0x0015, 0x0000, 0x0606, 0x3636, 0x3636, 0x3636, 0x3636, 0x3636,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0000, 0x1616, 0x1616, 0x0016, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0000, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0000, 0x0000, 0x0000,
- 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x0037, 0x0000, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515,
- 0x1616, 0x1616, 0x1616, 0x2116, 0x3521, 0x2135, 0x0000, 0x2424, 0x1616, 0x1616, 0x3516, 0x3521, 0x2121, 0x2121, 0x2121, 0x0021,
- 0x3521, 0x3521, 0x2135, 0x2121, 0x2121, 0x2121, 0x3521, 0x3535, 0x3535, 0x2135, 0x2121, 0x2121, 0x2121, 0x2121, 0x0021, 0x2100,
- 0x2424, 0x2424, 0x2424, 0x1f24, 0x2424, 0x2424, 0x2424, 0x0000, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x0023,
- 0x2121, 0x2121, 0x1635, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x3521, 0x2121, 0x2121, 0x3521, 0x3521, 0x3535,
- 0x3535, 0x3521, 0x1635, 0x1616, 0x1616, 0x1616, 0x0000, 0x0000, 0x2224, 0x2222, 0x2222, 0x2222, 0x2222, 0x2122, 0x2121, 0x2121,
- 0x2121, 0x2121, 0x2222, 0x2222, 0x2222, 0x2222, 0x0022, 0x0000, 0x2121, 0x1635, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x3516, 0x2121, 0x2121, 0x3535, 0x2121, 0x2135, 0x2121, 0x1616, 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x1616, 0x1616, 0x3521, 0x2121, 0x3535, 0x2135, 0x2135, 0x2121, 0x3535, 0x0000, 0x0000, 0x0000, 0x0000, 0x2424, 0x2424,
- 0x1616, 0x1616, 0x3535, 0x3535, 0x3535, 0x3535, 0x2121, 0x2121, 0x2121, 0x2121, 0x3535, 0x2121, 0x0000, 0x2400, 0x2424, 0x2424,
- 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x0000, 0x1600, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1f1f, 0x1f1f, 0x1f1f, 0x2424,
- 0x2424, 0x2424, 0x2424, 0x2424, 0x0000, 0x0000, 0x0000, 0x0000, 0x2121, 0x2421, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121,
- 0x3521, 0x2121, 0x2121, 0x2121, 0x1621, 0x1616, 0x2116, 0x1616, 0x1616, 0x3535, 0x1621, 0x0016, 0x2121, 0x0000, 0x0000, 0x0000,
- 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f,
- 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x131f, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x131f, 0x1313, 0x1313, 0x1313,
- 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1f13, 0x1f1f, 0x1f1f, 0x2121, 0x2121, 0x2121, 0x0000, 0x0000, 0x0000, 0x2121, 0x2121,
- 0x1310, 0x1310, 0x1310, 0x1313, 0x1313, 0x1313, 0x1313, 0x1310, 0x1313, 0x1313, 0x1313, 0x1313, 0x1010, 0x1010, 0x1010, 0x1010,
- 0x1313, 0x1313, 0x1313, 0x0000, 0x1010, 0x1010, 0x1010, 0x0000, 0x1313, 0x1313, 0x1313, 0x1313, 0x1000, 0x1000, 0x1000, 0x1000,
- 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x0000, 0x1313, 0x1313, 0x1313, 0x1313, 0x1e1e, 0x1e1e, 0x1e1e, 0x1e1e,
- 0x1313, 0x1313, 0x0013, 0x1313, 0x1010, 0x1010, 0x111e, 0x1113, 0x1111, 0x1313, 0x0013, 0x1313, 0x1010, 0x1010, 0x111e, 0x1111,
- 0x1313, 0x1313, 0x0000, 0x1313, 0x1010, 0x1010, 0x1100, 0x1111, 0x1313, 0x1313, 0x1313, 0x1313, 0x1010, 0x1010, 0x1110, 0x1111,
- 0x0000, 0x1313, 0x0013, 0x1313, 0x1010, 0x1010, 0x111e, 0x0011, 0x0505, 0x0505, 0x0505, 0x0505, 0x0505, 0x1805, 0x1818, 0x3b3a,
- 0x2525, 0x2525, 0x2525, 0x0606, 0x1c17, 0x1709, 0x1c17, 0x1709, 0x0606, 0x0606, 0x0606, 0x0606, 0x3d3c, 0x3f3e, 0x4140, 0x1442,
- 0x0707, 0x0707, 0x0607, 0x0606, 0x1706, 0x061c, 0x0606, 0x1206, 0x0612, 0x0606, 0x0943, 0x060a, 0x0606, 0x0606, 0x0606, 0x0606,
- 0x0606, 0x060f, 0x0612, 0x0606, 0x0606, 0x0606, 0x0606, 0x0506, 0x1818, 0x1818, 0x0018, 0x4544, 0x4746, 0x1818, 0x1818, 0x1818,
- 0x1f1b, 0x0000, 0x1b1b, 0x1b1b, 0x1b1b, 0x0b0b, 0x090f, 0x1f0a, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x0b0b, 0x090f, 0x000a,
- 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x001f, 0x0000, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808,
- 0x0808, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808, 0x0808, 0x0008, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2321, 0x2323,
- 0x2123, 0x2323, 0x2123, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x0021, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1515, 0x1510, 0x1515, 0x1015, 0x1515, 0x1013, 0x1010, 0x1313, 0x1010, 0x1310, 0x1015, 0x1515, 0x100f, 0x1010, 0x1010, 0x1515,
- 0x1515, 0x1515, 0x1510, 0x1510, 0x1510, 0x1010, 0x1010, 0x1319, 0x1010, 0x1010, 0x1613, 0x1616, 0x1316, 0x1515, 0x1313, 0x1010,
- 0x0f0f, 0x0f0f, 0x100f, 0x1313, 0x1313, 0x0f15, 0x1515, 0x2213, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d,
- 0x3939, 0x3939, 0x3939, 0x3939, 0x3939, 0x3939, 0x3939, 0x3939, 0x3939, 0x1039, 0x3913, 0x3939, 0x1d39, 0x1515, 0x0000, 0x0000,
- 0x0f0f, 0x0f0f, 0x150f, 0x1515, 0x1515, 0x0f0f, 0x1515, 0x1515, 0x150f, 0x0f15, 0x1515, 0x150f, 0x1515, 0x1515, 0x1515, 0x150f,
- 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0f0f, 0x1515, 0x150f, 0x150f, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515,
- 0x1515, 0x1515, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
- 0x0f0f, 0x1a0b, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x1515, 0x1515, 0x1515, 0x1515, 0x0a09, 0x0a09, 0x1515, 0x1515,
- 0x0f0f, 0x1515, 0x1515, 0x1515, 0x0915, 0x150a, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222,
- 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x1522, 0x150f, 0x1515,
- 0x1515, 0x1515, 0x2215, 0x1515, 0x1515, 0x0f15, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515,
- 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0f0f, 0x0f0f, 0x0f0f, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515,
- 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0015, 0x0000, 0x0000, 0x1515, 0x1515, 0x1515, 0x0015, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x2222, 0x2222,
- 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x1d1d, 0x1d1d, 0x1d1d, 0x1515, 0x1515, 0x1515, 0x0f15, 0x1515, 0x1515, 0x1515, 0x1515,
- 0x0f15, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
- 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0f15, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1522, 0x1515,
- 0x1515, 0x1515, 0x1515, 0x1515, 0x0a09, 0x0a09, 0x0a09, 0x0a09, 0x0a09, 0x0a09, 0x0a09, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d,
- 0x1d1d, 0x1d1d, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0f0f, 0x0f0f, 0x090f, 0x0f0a, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
- 0x0f0f, 0x0f0f, 0x0f0f, 0x0a09, 0x0a09, 0x0a09, 0x0a09, 0x0a09, 0x0f0f, 0x090f, 0x090a, 0x090a, 0x090a, 0x090a, 0x090a, 0x090a,
- 0x090a, 0x090a, 0x090a, 0x090a, 0x0f0a, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0a09, 0x0a09, 0x0f0f, 0x0f0f,
- 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0a09, 0x0f0f, 0x0f0f, 0x0f0f, 0x150f, 0x0f15, 0x0f0f, 0x0f0f, 0x150f, 0x1515,
- 0x1515, 0x1515, 0x0000, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0000, 0x1515, 0x1515, 0x1515, 0x1515,
- 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0000, 0x1500, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0015, 0x1515, 0x1515, 0x1515,
- 0x1515, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1515, 0x1515,
- 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0010, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x0013,
- 0x1310, 0x1010, 0x1310, 0x1013, 0x1013, 0x1013, 0x1013, 0x1010, 0x1310, 0x1310, 0x1013, 0x1313, 0x1313, 0x1313, 0x1f1f, 0x1010,
- 0x1310, 0x1310, 0x1513, 0x1515, 0x1515, 0x1015, 0x1013, 0x2113, 0x2121, 0x1310, 0x0000, 0x0000, 0x0600, 0x0606, 0x1d06, 0x0606,
- 0x1313, 0x1313, 0x1313, 0x1300, 0x0000, 0x0000, 0x1300, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x0000, 0x0000, 0x0000, 0x1f00,
- 0x0024, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2100, 0x1616, 0x1616, 0x1616, 0x0016, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1616, 0x1616, 0x1616, 0x0016, 0x1616, 0x1616, 0x1616, 0x0016, 0x0606, 0x1c17, 0x1c17, 0x0606, 0x1706, 0x061c, 0x1c17, 0x0606,
- 0x0606, 0x0606, 0x0606, 0x2506, 0x0606, 0x0625, 0x1c17, 0x0606, 0x1c17, 0x0a09, 0x0a09, 0x0a09, 0x0a09, 0x0606, 0x0606, 0x2006,
- 0x0606, 0x0606, 0x0606, 0x0606, 0x0606, 0x2525, 0x0606, 0x0606, 0x0625, 0x0009, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1500, 0x1515, 0x1515, 0x1515, 0x1515, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1515, 0x1515, 0x1515, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0000, 0x0000,
- 0x0605, 0x0606, 0x1f15, 0x3916, 0x0a09, 0x0a09, 0x0a09, 0x0a09, 0x0a09, 0x1515, 0x0a09, 0x0a09, 0x0a09, 0x0a09, 0x0925, 0x0a0a,
- 0x3915, 0x3939, 0x3939, 0x3939, 0x3939, 0x2121, 0x2121, 0x3535, 0x1f25, 0x1f1f, 0x1f1f, 0x1515, 0x3939, 0x1f39, 0x0616, 0x1515,
- 0x1616, 0x1616, 0x1616, 0x0016, 0x2100, 0x1121, 0x1f11, 0x161f, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0616, 0x1f1f, 0x161f,
- 0x0000, 0x0000, 0x1600, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x2222, 0x3737, 0x3737, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0016, 0x0000, 0x0000, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x1522, 0x0015,
- 0x3737, 0x3737, 0x3737, 0x3737, 0x3737, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x3737, 0x3737, 0x3737, 0x3737,
- 0x1d15, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x1515, 0x2215,
- 0x1d22, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x1515, 0x1515,
- 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x0022, 0x2222, 0x2222, 0x2222, 0x1522, 0x1515, 0x2215, 0x2222, 0x2222,
- 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x1515, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x1522,
- 0x1616, 0x1616, 0x1f16, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x061f, 0x0606,
- 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x1616, 0x0000, 0x0000, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x2116,
- 0x2323, 0x0623, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2006, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1f1f, 0x2121,
- 0x1616, 0x1616, 0x1616, 0x3939, 0x3939, 0x3939, 0x3939, 0x3939, 0x2121, 0x2424, 0x2424, 0x2424, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1111, 0x1111, 0x1111, 0x2011, 0x2020, 0x2020, 0x2020, 0x2020, 0x1111, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310,
- 0x1313, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x131f, 0x1313, 0x1313, 0x1313, 0x1013, 0x1013, 0x1013, 0x1310,
- 0x1310, 0x1310, 0x1310, 0x1310, 0x4820, 0x1048, 0x1013, 0x1613, 0x1310, 0x1310, 0x1313, 0x1310, 0x1310, 0x1310, 0x1310, 0x1310,
- 0x1310, 0x1310, 0x1310, 0x1310, 0x1310, 0x1010, 0x1010, 0x0000, 0x1010, 0x1010, 0x1310, 0x1310, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x1600, 0x1f1f, 0x1613, 0x1616, 0x1616, 0x1616, 0x1621, 0x1616, 0x1621, 0x1616, 0x2116, 0x1616, 0x1616,
- 0x1616, 0x3516, 0x2135, 0x3521, 0x1515, 0x1515, 0x0000, 0x0000, 0x3737, 0x3737, 0x3737, 0x2222, 0x1908, 0x0000, 0x0000, 0x0000,
- 0x1616, 0x1616, 0x0606, 0x0606, 0x0000, 0x0000, 0x0000, 0x0000, 0x3535, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x1616, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x0021, 0x0000, 0x0000, 0x0000, 0x0000, 0x2424,
- 0x2121, 0x1616, 0x1616, 0x1616, 0x2424, 0x1624, 0x1624, 0x0000, 0x1616, 0x1616, 0x1616, 0x2121, 0x2121, 0x2121, 0x2121, 0x2424,
- 0x1616, 0x1616, 0x1616, 0x2116, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x3535, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2400,
- 0x1616, 0x2116, 0x3535, 0x2121, 0x2121, 0x3535, 0x3521, 0x3535, 0x2435, 0x2424, 0x2424, 0x2424, 0x2424, 0x2424, 0x2424, 0x1f00,
- 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x0000, 0x0000, 0x2424, 0x1616, 0x1616, 0x2116, 0x161f, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x1616, 0x1616, 0x0016, 0x1616, 0x1616, 0x1616, 0x1616, 0x2116, 0x2121, 0x2121, 0x3521,
- 0x2135, 0x3521, 0x2135, 0x0021, 0x0000, 0x0000, 0x0000, 0x0000, 0x1616, 0x2116, 0x1616, 0x1616, 0x1616, 0x1616, 0x3521, 0x0000,
- 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x0000, 0x2424, 0x2424, 0x161f, 0x1616, 0x1616, 0x2216, 0x2222, 0x3516, 0x3521, 0x1616,
- 0x1621, 0x2121, 0x1621, 0x2116, 0x1621, 0x1616, 0x1616, 0x2121, 0x2116, 0x0016, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1600, 0x1f16, 0x2424, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x3516, 0x2121, 0x3535,
- 0x2424, 0x1f16, 0x351f, 0x0021, 0x0000, 0x0000, 0x0000, 0x0000, 0x1600, 0x1616, 0x1616, 0x0016, 0x1600, 0x1616, 0x1616, 0x0016,
- 0x1600, 0x1616, 0x1616, 0x0016, 0x0000, 0x0000, 0x0000, 0x0000, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x4813, 0x1f1f, 0x1f1f,
- 0x1313, 0x1313, 0x1313, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1616, 0x3516, 0x2135, 0x3535, 0x3521, 0x2435, 0x2135, 0x0000,
- 0x1616, 0x1616, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1616, 0x1616, 0x1616, 0x0016, 0x0000, 0x1600, 0x1616, 0x1616,
- 0x4949, 0x4949, 0x4949, 0x4949, 0x4949, 0x4949, 0x4949, 0x4949, 0x4a4a, 0x4a4a, 0x4a4a, 0x4a4a, 0x4a4a, 0x4a4a, 0x4a4a, 0x4a4a,
- 0x1313, 0x1313, 0x1313, 0x0013, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1300, 0x1313, 0x1313, 0x0000, 0x0000, 0x2800, 0x2821,
- 0x2828, 0x2828, 0x2828, 0x2828, 0x0b28, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x0028, 0x2828, 0x2828, 0x0028, 0x0028,
- 0x2828, 0x2800, 0x0028, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2e2e, 0x4b4b, 0x4b4b, 0x4b4b, 0x4b4b, 0x4b4b, 0x4b4b, 0x4b4b,
- 0x4b4b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2e00, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e,
- 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x090a, 0x0000, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e,
- 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x0000, 0x0000, 0x0000, 0x0000, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x152b, 0x0000,
- 0x0606, 0x0606, 0x0606, 0x0906, 0x060a, 0x0000, 0x0000, 0x0000, 0x2506, 0x1225, 0x0912, 0x090a, 0x090a, 0x090a, 0x090a, 0x090a,
- 0x090a, 0x090a, 0x060a, 0x0906, 0x060a, 0x0606, 0x1206, 0x1212, 0x060c, 0x000c, 0x0c06, 0x0606, 0x0925, 0x090a, 0x090a, 0x070a,
- 0x0606, 0x0d0b, 0x0f0f, 0x000f, 0x0806, 0x0607, 0x0000, 0x0000, 0x2e2e, 0x2e2e, 0x002e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e,
- 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x002e, 0x1800, 0x0600, 0x0706, 0x0708, 0x0606, 0x0a09, 0x0b06, 0x0d0c, 0x0c0c,
- 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x0913, 0x0a0f, 0x090f, 0x060a, 0x0a09, 0x0606, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x161f, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1f1f,
- 0x0000, 0x1616, 0x1616, 0x1616, 0x0000, 0x1616, 0x1616, 0x1616, 0x0000, 0x1616, 0x1616, 0x1616, 0x0000, 0x1616, 0x0016, 0x0000,
- 0x0808, 0x110f, 0x0815, 0x0008, 0x0f15, 0x0f0f, 0x150f, 0x0015, 0x0000, 0x0000, 0x0000, 0x0000, 0x4c00, 0x4c4c, 0x1515, 0x0000,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1600, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0016, 0x1616, 0x1600,
- 0x0624, 0x0024, 0x0000, 0x3700, 0x3737, 0x3737, 0x3737, 0x3737, 0x3737, 0x3737, 0x3737, 0x3737, 0x3737, 0x3737, 0x3737, 0x3737,
- 0x3737, 0x3737, 0x0000, 0x2200, 0x2222, 0x2222, 0x2222, 0x2222, 0x4d4d, 0x4d4d, 0x4d4d, 0x4d4d, 0x4d4d, 0x4d4d, 0x4d4d, 0x4d4d,
- 0x4d4d, 0x4d4d, 0x1d4d, 0x1d1d, 0x151d, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1d1d, 0x0015, 0x0000,
- 0x0015, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2122, 0x0000,
- 0x1b21, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x0000, 0x0000,
- 0x3737, 0x3737, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3916, 0x1616, 0x1616, 0x1616, 0x1616, 0x0039, 0x0000, 0x0000,
- 0x1616, 0x1616, 0x1616, 0x2121, 0x2121, 0x0021, 0x0000, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x2400,
- 0x1616, 0x1616, 0x0000, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x3924, 0x3939, 0x3939, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1010, 0x1010, 0x1010, 0x1010, 0x1313, 0x1313, 0x1313, 0x1313, 0x1616, 0x1616, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2400,
- 0x2828, 0x2828, 0x2828, 0x0000, 0x0028, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2800, 0x0028, 0x0000, 0x0028, 0x2800,
- 0x2828, 0x2828, 0x2828, 0x2700, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e, 0x2828, 0x2828, 0x2828, 0x4f28, 0x4e4f, 0x4e4e, 0x4e4e, 0x4e4e,
- 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x0028, 0x0000, 0x0000, 0x0000, 0x4e00, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e,
- 0x2828, 0x0028, 0x2828, 0x0000, 0x0000, 0x4e00, 0x4e4e, 0x4e4e, 0x2828, 0x2828, 0x2828, 0x4e4e, 0x4e4e, 0x4e4e, 0x0000, 0x0600,
- 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x0000, 0x0000, 0x2700, 0x2828, 0x2828, 0x2828, 0x2828, 0x0000, 0x0000, 0x4e4e, 0x2828,
- 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e, 0x0000, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e,
- 0x2128, 0x2121, 0x2100, 0x0021, 0x0000, 0x0000, 0x2121, 0x2121, 0x2828, 0x2828, 0x2800, 0x2828, 0x2800, 0x2828, 0x2828, 0x2828,
- 0x2828, 0x2828, 0x0000, 0x0000, 0x2121, 0x0021, 0x0000, 0x2100, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x2727, 0x2727, 0x2727, 0x2727, 0x0027, 0x0000, 0x0000, 0x0000, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x4e28, 0x274e,
- 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x2828, 0x4e28, 0x4e4e, 0x2828, 0x2828, 0x2828, 0x2828, 0x284f, 0x2828, 0x2828, 0x2828,
- 0x2828, 0x2828, 0x2128, 0x0021, 0x0000, 0x4e00, 0x4e4e, 0x4e4e, 0x2727, 0x2727, 0x2727, 0x0027, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x2828, 0x2828, 0x2828, 0x0000, 0x0600, 0x0606, 0x0606, 0x0606, 0x2828, 0x2828, 0x2828, 0x0000, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e,
- 0x2828, 0x0028, 0x0000, 0x0000, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e, 0x2828, 0x0000, 0x0000, 0x0000, 0x2700, 0x2727, 0x0027, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x4e00, 0x4e4e, 0x4e4e, 0x4e4e, 0x2828, 0x2828, 0x2828, 0x2828, 0x0028, 0x0000, 0x0000, 0x0000,
- 0x5050, 0x5050, 0x5050, 0x5050, 0x5050, 0x5050, 0x5050, 0x5050, 0x5050, 0x0050, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x5151, 0x5151, 0x5151, 0x5151, 0x5151, 0x5151, 0x5151, 0x5151, 0x5151, 0x0051, 0x0000, 0x0000, 0x0000, 0x4e4e, 0x4e4e, 0x4e4e,
- 0x5252, 0x5252, 0x5252, 0x5252, 0x5252, 0x5252, 0x5252, 0x5252, 0x5252, 0x5252, 0x5252, 0x5252, 0x5252, 0x5252, 0x5252, 0x0052,
- 0x2135, 0x1635, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x2121, 0x2121, 0x2121, 0x2121,
- 0x2121, 0x2121, 0x2121, 0x2421, 0x2424, 0x2424, 0x2424, 0x0000, 0x0000, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d, 0x1d1d,
- 0x1d1d, 0x1d1d, 0x1d1d, 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2100,
- 0x3535, 0x2135, 0x2121, 0x3521, 0x2135, 0x2421, 0x3a24, 0x2424, 0x2424, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x0016, 0x0000, 0x0000, 0x0000, 0x2121, 0x1621, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x1616, 0x1616, 0x2116, 0x2121, 0x2121, 0x2135, 0x2121, 0x2121, 0x2121, 0x0021, 0x3636, 0x3636, 0x3636, 0x3636, 0x3636,
- 0x2424, 0x2424, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1616, 0x2116, 0x2424, 0x0016, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1616, 0x3516, 0x3535, 0x2121, 0x2121, 0x2121, 0x2121, 0x3521, 0x1635, 0x1616, 0x2416, 0x2424, 0x2424, 0x2121, 0x2421, 0x0000,
- 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x2416, 0x2416, 0x2424, 0x3700, 0x3737, 0x3737, 0x3737, 0x3737, 0x3737, 0x3737, 0x3737,
- 0x3737, 0x3737, 0x0037, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x3535, 0x2135,
- 0x2121, 0x3535, 0x3521, 0x2121, 0x2424, 0x2424, 0x2424, 0x0000, 0x1616, 0x1616, 0x1616, 0x0016, 0x0016, 0x1616, 0x1616, 0x1600,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1600, 0x1616, 0x1616, 0x1616, 0x1616, 0x2416, 0x0000, 0x0000, 0x0000,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x2116, 0x3535, 0x2135, 0x2121, 0x2121, 0x2121, 0x0021, 0x0000, 0x0000,
- 0x2121, 0x3535, 0x1600, 0x1616, 0x1616, 0x1616, 0x0016, 0x1600, 0x3521, 0x3535, 0x0035, 0x3500, 0x0035, 0x3500, 0x3535, 0x0000,
- 0x0016, 0x0000, 0x0000, 0x3500, 0x0000, 0x0000, 0x1600, 0x1616, 0x1616, 0x3535, 0x0000, 0x2121, 0x2121, 0x2121, 0x0021, 0x0000,
- 0x2121, 0x2121, 0x0021, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3535, 0x2135, 0x2121, 0x2121, 0x3521, 0x3521, 0x3535, 0x2135,
- 0x3521, 0x2121, 0x1616, 0x1624, 0x0000, 0x0000, 0x0000, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x3516,
- 0x3535, 0x2121, 0x2121, 0x0000, 0x3535, 0x3535, 0x2121, 0x2135, 0x2421, 0x2424, 0x2424, 0x2424, 0x2424, 0x2424, 0x2424, 0x2424,
- 0x2424, 0x2424, 0x2424, 0x2424, 0x1616, 0x1616, 0x2121, 0x0000, 0x3535, 0x2135, 0x2121, 0x2121, 0x2121, 0x3521, 0x2135, 0x2135,
- 0x2421, 0x2424, 0x0016, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x2116, 0x2135, 0x3535,
- 0x2121, 0x2121, 0x2121, 0x2135, 0x0000, 0x0000, 0x0000, 0x0000, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0000, 0x2100, 0x2121,
- 0x3535, 0x2121, 0x2121, 0x2135, 0x2121, 0x2121, 0x0000, 0x0000, 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x3737, 0x2424, 0x2224,
- 0x3737, 0x0037, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1600, 0x3939, 0x3939, 0x3939, 0x3939, 0x3939, 0x3939, 0x3939, 0x0039,
- 0x2424, 0x2424, 0x0024, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2121, 0x2121, 0x2421, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x2121, 0x2121, 0x2121, 0x2421, 0x2424, 0x2424, 0x2222, 0x2222, 0x1f1f, 0x1f1f, 0x2224, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x3636, 0x3636, 0x3636, 0x3636, 0x3636, 0x3700, 0x3737, 0x3737, 0x3737, 0x1600, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x1616,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x0000, 0x0000, 0x1600, 0x1616, 0x3516, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535,
- 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x3535, 0x0035,
- 0x2121, 0x1f21, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1f1f, 0x1616, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1616, 0x1616, 0x1616, 0x1616, 0x1616, 0x0000, 0x2122, 0x2421, 0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x2222, 0x2222, 0x2222, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2222, 0x2222, 0x2222, 0x0022, 0x2200, 0x2222, 0x2222, 0x2222,
- 0x2222, 0x2222, 0x3522, 0x2135, 0x2121, 0x2222, 0x3522, 0x3535, 0x3535, 0x1835, 0x1818, 0x1818, 0x1818, 0x2118, 0x2121, 0x2121,
- 0x2121, 0x2221, 0x2122, 0x2121, 0x2121, 0x2121, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2121, 0x2121, 0x2222,
- 0x2222, 0x2222, 0x2222, 0x2222, 0x0022, 0x0000, 0x0000, 0x0000, 0x1515, 0x2121, 0x1521, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x3737, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1313, 0x1313, 0x1313,
- 0x1313, 0x1313, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1313,
- 0x1313, 0x1313, 0x0013, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1010, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313,
- 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x0010, 0x1010, 0x0000, 0x0010, 0x1000, 0x0010, 0x1000, 0x1010, 0x0010, 0x1010,
- 0x1010, 0x1010, 0x1010, 0x1313, 0x1313, 0x1300, 0x1300, 0x1313, 0x1313, 0x1313, 0x1300, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313,
- 0x1313, 0x1313, 0x1010, 0x1000, 0x1010, 0x0010, 0x1000, 0x1010, 0x1010, 0x1010, 0x0010, 0x1010, 0x1010, 0x1010, 0x0010, 0x1313,
- 0x1313, 0x1313, 0x1313, 0x1313, 0x1010, 0x1000, 0x1010, 0x0010, 0x1010, 0x1010, 0x0010, 0x0010, 0x0000, 0x1010, 0x1010, 0x1010,
- 0x0010, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1010, 0x1010,
- 0x1010, 0x1010, 0x1010, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x0000, 0x1010, 0x1010, 0x1010, 0x1010,
- 0x5310, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x0f13, 0x1313, 0x1313,
- 0x1313, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x5310, 0x1313, 0x1313,
- 0x1313, 0x1313, 0x0f13, 0x1313, 0x1313, 0x1313, 0x1010, 0x1010, 0x1010, 0x1010, 0x5310, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313,
- 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x1313, 0x0f13, 0x1313, 0x1313, 0x1313, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010,
- 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x5310, 0x1313, 0x1313, 0x1313, 0x1313, 0x0f13, 0x1313, 0x1313, 0x1313,
- 0x1010, 0x1010, 0x1010, 0x1010, 0x5310, 0x1313, 0x1313, 0x1313, 0x1313, 0x0f13, 0x1313, 0x1313, 0x1313, 0x1310, 0x0000, 0x0e0e,
- 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e, 0x0e0e, 0x2121, 0x2121, 0x2121, 0x2221, 0x2222, 0x2122, 0x2121, 0x2121,
- 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2121, 0x2221, 0x2222, 0x2222, 0x2222, 0x2122, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222,
- 0x2222, 0x2222, 0x2221, 0x2422, 0x2424, 0x2424, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2100, 0x2121, 0x2121,
- 0x2828, 0x2828, 0x0028, 0x4e00, 0x4e4e, 0x4e4e, 0x4e4e, 0x4e4e, 0x2121, 0x2121, 0x2121, 0x0021, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x2e2e, 0x2e2e, 0x2e00, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e00, 0x002e, 0x002e, 0x2e00, 0x2e00, 0x2e2e, 0x2e2e, 0x2e2e,
- 0x2e2e, 0x002e, 0x2e2e, 0x2e2e, 0x2e00, 0x2e00, 0x0000, 0x0000, 0x0000, 0x002e, 0x0000, 0x2e00, 0x2e00, 0x2e00, 0x2e00, 0x2e2e,
- 0x2e00, 0x002e, 0x002e, 0x2e00, 0x2e00, 0x2e00, 0x2e00, 0x2e00, 0x2e00, 0x002e, 0x002e, 0x2e00, 0x2e2e, 0x002e, 0x2e2e, 0x2e2e,
- 0x2e2e, 0x002e, 0x2e2e, 0x2e2e, 0x2e00, 0x2e2e, 0x002e, 0x002e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e00, 0x2e2e, 0x2e2e,
- 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x2e2e, 0x0000, 0x0000, 0x2e00, 0x2e2e, 0x2e00, 0x2e2e, 0x2e2e, 0x2e00, 0x2e2e, 0x2e2e,
- 0x0f0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0015,
- 0x1500, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1b1b, 0x1d1b, 0x001d, 0x0000,
- 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x1515, 0x0000, 0x0000, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x0022, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x2222, 0x0022, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x2222, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1115, 0x1111, 0x1111,
- 0x1515, 0x1515, 0x1500, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0015, 0x0000,
- 0x1515, 0x1515, 0x0015, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1515, 0x1515, 0x1515, 0x1515, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x1515, 0x0000, 0x1515, 0x1515, 0x1515, 0x1515, 0x0015, 0x0000, 0x0000, 0x0000,
- 0x1800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818,
- 0x4a4a, 0x4a4a, 0x4a4a, 0x4a4a, 0x4a4a, 0x4a4a, 0x4a4a, 0x0000, 0xeeee, 0xeeee
- };
-
- private static byte[] s_pCategoriesValue = new byte[]
- {
- 0x1d, 0x00, 0x0e, 0x0e, 0x0e, 0x10, 0x0e, 0x0f, 0x0e, 0x11, 0x0b, 0x11, 0x18, 0x12, 0x18, 0x0a,
- 0x1a, 0x0a, 0x14, 0x12, 0x15, 0x12, 0x19, 0x09, 0x18, 0x0c, 0x13, 0x09, 0x08, 0x08, 0x19, 0x12,
- 0x00, 0x00, 0x1b, 0x12, 0x12, 0x12, 0x01, 0x00, 0x0b, 0x0c, 0x1c, 0x12, 0x04, 0x00, 0x16, 0x12,
- 0x0f, 0x0e, 0x1c, 0x0a, 0x19, 0x0a, 0x0a, 0x08, 0x17, 0x12, 0x0a, 0x12, 0x02, 0x00, 0x03, 0x00,
- 0x03, 0x12, 0x05, 0x0d, 0x1c, 0x00, 0x07, 0x0d, 0x18, 0x00, 0x13, 0x12, 0x13, 0x03, 0x18, 0x03,
- 0x04, 0x03, 0x0f, 0x0b, 0x19, 0x04, 0x1a, 0x04, 0x18, 0x04, 0x0f, 0x04, 0x04, 0x04, 0x03, 0x04,
- 0x08, 0x0b, 0x18, 0x0b, 0x1c, 0x04, 0x08, 0x03, 0x03, 0x03, 0x06, 0x00, 0x08, 0x00, 0x0a, 0x00,
- 0x05, 0x00, 0x09, 0x00, 0x0f, 0x00, 0x0f, 0x03, 0x0c, 0x11, 0x0d, 0x0f, 0x0f, 0x01, 0x0f, 0x05,
- 0x0f, 0x07, 0x0f, 0x02, 0x0f, 0x06, 0x19, 0x0c, 0x0f, 0x13, 0x0f, 0x14, 0x0f, 0x15, 0x0f, 0x16,
- 0x1b, 0x00, 0x10, 0x00, 0x11, 0x00, 0x1b, 0x04, 0x0f, 0x12, 0x09, 0x12, 0x0a, 0x03, 0x1c, 0x03,
- 0x00, 0x03, 0x01, 0x03, 0x0a, 0x0b, 0x19, 0x00
- };
- // 12:4:4 index table of the Unicode numeric data.
- private static ushort[] s_pNumericLevel1Index = new ushort[]
- {
- 0x1100, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1120, 0x1130, 0x1110, 0x1140, 0x1150, 0x1160, 0x1170, 0x1180, 0x1190, 0x11a0,
- 0x11b0, 0x1110, 0x1110, 0x11c0, 0x1110, 0x1110, 0x11d0, 0x11e0, 0x11f0, 0x1200, 0x1210, 0x1220, 0x1230, 0x1110, 0x1110, 0x1110,
- 0x1240, 0x1250, 0x1110, 0x1110, 0x1260, 0x1110, 0x1110, 0x1270, 0x1110, 0x1110, 0x1110, 0x1110, 0x1280, 0x1110, 0x1110, 0x1110,
- 0x1290, 0x12a0, 0x12b0, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x12c0, 0x1110, 0x12d0, 0x12e0, 0x12f0, 0x1300, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1310, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x11f0,
- 0x1110, 0x1320, 0x1330, 0x1340, 0x1350, 0x1110, 0x1110, 0x1110, 0x1360, 0x1370, 0x1380, 0x1390, 0x13a0, 0x1110, 0x13b0, 0x1110,
- 0x13c0, 0x13d0, 0x1300, 0x1110, 0x13e0, 0x1110, 0x13f0, 0x1400, 0x1410, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1420, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1430, 0x1440, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1450, 0x1110, 0x1110, 0x1110, 0x1460, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1470, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1480, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1490, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110, 0x1110,
- 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14b0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14b8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14b8, 0x14c0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14b8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14b8, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14b8, 0x14c8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14b8, 0x14d0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14b8, 0x14d8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14b8, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14b8, 0x14e0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14b8, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14e8, 0x14f0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14f8, 0x1500, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1508, 0x1510,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x1518,
- 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14b8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1520, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1528, 0x1530, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1538, 0x1540, 0x1540, 0x1548, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1550, 0x1558, 0x1560, 0x1568, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1570, 0x1578,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1580, 0x1588, 0x1590, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1598,
- 0x15a0, 0x14a0, 0x15a8, 0x15b0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x15b8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x15c0, 0x14a0, 0x15c8, 0x15d0, 0x14a0, 0x14a0, 0x15c0, 0x14a0, 0x14a0, 0x15d8, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x15e0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x15e8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0,
- 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a8,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x15f0, 0x15f8, 0x14a0, 0x14a0, 0x14a0, 0x1600, 0x14a0, 0x1608, 0x14a0, 0x1610,
- 0x1618, 0x1620, 0x1628, 0x1630, 0x1638, 0x1640, 0x1648, 0x1650, 0x1658, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1660, 0x1668,
- 0x14a0, 0x14a0, 0x1670, 0x14a0, 0x1678, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1680, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1688, 0x14a0, 0x1690, 0x14a0, 0x14a0, 0x1698, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x16a0,
- 0x14a0, 0x16a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x16b0, 0x16b8, 0x16c0, 0x16c8, 0x16d0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x16d8, 0x14a0, 0x14a0, 0x16e0, 0x14a0, 0x16e8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x16a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x16f0, 0x14a0, 0x16f0, 0x14a0, 0x14a0, 0x16f8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1700,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1708, 0x1710, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1718, 0x1720, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8,
- 0x14a0, 0x14a0, 0x14a0, 0x14b8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x1660, 0x1728,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x1730, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1738, 0x1740,
- 0x1748, 0x1750, 0x1758, 0x1760, 0x1768, 0x1770, 0x1778, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1780, 0x1788, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x16b8, 0x1790, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1798, 0x17a0, 0x17a8, 0x17b0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x1618, 0x14a0, 0x14a0, 0x14a0,
- 0x17b8, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x17c0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0, 0x14a0,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0201, 0x0403, 0x0605, 0x0807, 0x0a09, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0c0b, 0x0000, 0x0000, 0x0d00, 0x0000, 0x0f0e, 0x0010, 0x0000, 0x0000, 0x0000, 0x0201, 0x0403, 0x0605, 0x0807, 0x0a09,
- 0x0000, 0x0000, 0x1211, 0x0e13, 0x1410, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0e, 0x1110, 0x1312, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1615, 0x0017, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1918, 0x1b1a, 0x1a19, 0x001b,
- 0x1615, 0x0e17, 0x100f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0201, 0x0403, 0x0605, 0x0807, 0x0a09, 0x1c0f, 0x1e1d, 0x201f,
- 0x2221, 0x2423, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0d00, 0x0c0b, 0x2625, 0x2827,
- 0x2a29, 0x2b15, 0x2d2c, 0x2f2e, 0x3130, 0x1632, 0x0033, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3534,
- 0x0036, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1918, 0x1b1a, 0x3837, 0x3a39, 0x3c3b, 0x0000, 0x0000, 0x0000,
- 0x0201, 0x0403, 0x0605, 0x0807, 0x0a09, 0x000d, 0x0000, 0x0000, 0x003d, 0x0000, 0x2625, 0x2827, 0x2a29, 0x0000, 0x0000, 0x0000,
- 0x0d3d, 0x0c0b, 0x2625, 0x2827, 0x2a29, 0x0000, 0x0000, 0x0000, 0x3f3e, 0x4140, 0x4342, 0x4544, 0x4746, 0x1248, 0x4a49, 0x194b,
- 0x1a19, 0x371b, 0x3938, 0x3b3a, 0x153c, 0x4d4c, 0x162e, 0x174e, 0x4f17, 0x0033, 0x3900, 0x502e, 0x1851, 0x0000, 0x0000, 0x0000,
- 0x0b0d, 0x250c, 0x2726, 0x2928, 0x152a, 0x4d4c, 0x5352, 0x1454, 0x3534, 0x2b36, 0x0b0d, 0x250c, 0x2726, 0x2928, 0x152a, 0x4d4c,
- 0x5352, 0x1454, 0x3534, 0x2b36, 0x0b0d, 0x250c, 0x2726, 0x2928, 0x152a, 0x4d4c, 0x5352, 0x1454, 0x3534, 0x2b36, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4c3d, 0x524d, 0x5453, 0x3414, 0x3635, 0x0d2b, 0x0c0b, 0x2625, 0x2827, 0x2a29, 0x3d15,
- 0x0000, 0x0000, 0x0000, 0x0b0d, 0x250c, 0x2726, 0x2928, 0x152a, 0x0b0d, 0x250c, 0x2726, 0x2928, 0x152a, 0x0b0d, 0x250c, 0x2726,
- 0x2928, 0x152a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f00, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x1800, 0x0000, 0x0000, 0x0000, 0x0000, 0x1900, 0x1b1a, 0x3837, 0x3a39, 0x3c3b, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x2b15, 0x002c, 0x0000, 0x0000, 0x0000, 0x1a19, 0x371b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x1a19, 0x371b, 0x3938, 0x3b3a, 0x153c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2b15, 0x2d2c, 0x2f2e, 0x3130,
- 0x5500, 0x5756, 0x5958, 0x5b5a, 0x5d5c, 0x5e2c, 0x605f, 0x6261, 0x6300, 0x6564, 0x2d66, 0x6867, 0x6a69, 0x6c6b, 0x6e6d, 0x2e6f,
- 0x0000, 0x0000, 0x0000, 0x1a19, 0x371b, 0x3938, 0x3b3a, 0x183c, 0x0f0e, 0x1110, 0x1312, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1b00, 0x0000, 0x0000, 0x0000, 0x1500, 0x0000, 0x0000, 0x001a, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0018, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3900, 0x3900, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1500, 0x0000, 0x0000, 0x0000, 0x0000, 0x1900, 0x1b1a, 0x3837, 0x3a39, 0x3c3b,
- 0x2b15, 0x2d2c, 0x2f2e, 0x3130, 0x1632, 0x7170, 0x4e72, 0x7473, 0x7675, 0x7717, 0x7978, 0x7a4f, 0x7c7b, 0x337d, 0x7f7e, 0x5080,
- 0x8281, 0x8483, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0e, 0x3819, 0x4e2e, 0x504f, 0x1538, 0x162e, 0x174e, 0x384f,
- 0x2e15, 0x4e16, 0x3317, 0x1550, 0x1919, 0x1a19, 0x1a1a, 0x381a, 0x1515, 0x1515, 0x2c15, 0x2e2e, 0x2e2e, 0x7116, 0x4e4e, 0x4e4e,
- 0x174e, 0x384f, 0x0f2e, 0x420f, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0e18, 0x0000, 0x0000,
- 0x1900, 0x1b1a, 0x3837, 0x3a39, 0x3c3b, 0x2b15, 0x2d2c, 0x2f2e, 0x3130, 0x1632, 0x7170, 0x4e72, 0x7473, 0x7675, 0x0000, 0x0000,
- 0x3819, 0x2e15, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0076, 0x0000, 0x0000,
- 0x1900, 0x151a, 0x162b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1a19, 0x151b, 0x162b, 0x3317,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x1900, 0x1b1a, 0x3837, 0x2b15, 0x0000, 0x0000, 0x0000, 0x1900, 0x1b1a, 0x3737, 0x1538, 0x162b,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1900, 0x1538, 0x162b, 0x0000, 0x0000, 0x0000, 0x1519, 0x162b, 0x1b1a, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f85, 0x0000, 0x1a19, 0x371b, 0x3938, 0x3b3a, 0x153c, 0x2c2b, 0x2e2d, 0x302f,
- 0x0000, 0x7016, 0x7271, 0x734e, 0x7574, 0x1776, 0x7877, 0x4f79, 0x7b7a, 0x7d7c, 0x7e33, 0x807f, 0x8150, 0x8382, 0x5184, 0x8786,
- 0x8988, 0x8b8a, 0x8d8c, 0x8f8e, 0x9190, 0x9392, 0x9594, 0x9796, 0x0b0d, 0x250c, 0x2b15, 0x1716, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1900, 0x002e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1900, 0x2b15,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x1a19, 0x371b, 0x2b15, 0x1716, 0x0000, 0x0000, 0x0000, 0x0000, 0x1900, 0x1b1a, 0x1537, 0x162b,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3819, 0x2e15, 0x1716, 0x0b0d, 0x250c, 0x2726, 0x2928, 0x152a, 0x2c2b, 0x2e2d, 0x302f,
- 0x3231, 0x7016, 0x7271, 0x734e, 0x7574, 0x0f76, 0x410e, 0x0042, 0x0000, 0x0b0d, 0x250c, 0x2726, 0x2928, 0x152a, 0x2c2b, 0x2e2d,
- 0x302f, 0x3231, 0x1716, 0x0201, 0x0403, 0x0605, 0x0807, 0x0a09, 0x3130, 0x1632, 0x0017, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0201, 0x0403, 0x0605, 0x0807, 0x0a09, 0x2b15, 0x0000, 0x0000, 0x0201, 0x0403, 0x0605, 0x0807, 0x0a09, 0x2b15, 0x2d2c, 0x2f2e,
- 0x3130, 0x0032, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1b1a, 0x3837, 0x3a39, 0x3c3b, 0x371b, 0x3938, 0x3b3a, 0x373c,
- 0x3938, 0x3b3a, 0x193c, 0x1b1a, 0x3837, 0x3a39, 0x3c3b, 0x1a19, 0x371b, 0x1a38, 0x1b1b, 0x3837, 0x3a39, 0x3c3b, 0x1a19, 0x1b1b,
- 0x3837, 0x9998, 0x1a19, 0x1b1b, 0x3837, 0x1b1b, 0x3737, 0x3737, 0x3a39, 0x3a3a, 0x3b3b, 0x3c3c, 0x3c3c, 0x1b1a, 0x3837, 0x1939,
- 0x1b1a, 0x3737, 0x3838, 0x1b1a, 0x1a19, 0x4241, 0x4148, 0x1242, 0x470e, 0x0e0e, 0x410f, 0x2d42, 0x372e, 0x3938, 0x3b3a, 0x003c,
- 0x0201, 0x0403, 0x0605, 0x0807, 0x0a09, 0x1500, 0x3316, 0x9b9a, 0x9d9c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x3231, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0201,
- 0x0403, 0x0605, 0x0807, 0x0a09, 0x0201, 0x0403, 0x0605, 0x0807, 0x0a09, 0x0201, 0x0403, 0x0605, 0x0807, 0x0a09, 0x0201, 0x0403,
- 0x0605, 0x0807, 0x0a09, 0x0201, 0x0403, 0x0605, 0x0807, 0x0a09, 0x3d3d, 0x0b0d, 0x250c, 0x2726, 0x2928, 0x182a, 0x0018, 0x0000,
- 0x003c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xeeee, 0xeeee, 0xeeee, 0xeeee
- };
- // Every item contains the value for numeric value.
- private static byte[] s_pNumericValues = new byte[]
- {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x8f, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x51, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x56, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xc3, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x92, 0x24, 0x49, 0x92, 0x24, 0x49, 0xc2, 0x3f, 0x1c, 0xc7, 0x71, 0x1c, 0xc7, 0x71, 0xbc, 0x3f,
- 0x9a, 0x99, 0x99, 0x99, 0x99, 0x99, 0xb9, 0x3f, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xd5, 0x3f,
- 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xe5, 0x3f, 0x9a, 0x99, 0x99, 0x99, 0x99, 0x99, 0xc9, 0x3f,
- 0x9a, 0x99, 0x99, 0x99, 0x99, 0x99, 0xd9, 0x3f, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0xe3, 0x3f,
- 0x9a, 0x99, 0x99, 0x99, 0x99, 0x99, 0xe9, 0x3f, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xc5, 0x3f,
- 0xab, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xea, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x7f, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xb3, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0xe8, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0xf8, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x41, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x42, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x43, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x44, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x45, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x46, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x47, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x48, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x72, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x82, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x85, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x8c, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x9f, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xa7, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xaf, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xb7, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0xbb, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xbf, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0xc1, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xd3, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0xdd, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xe3, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0xed, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xf1, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xf3, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xf5, 0x40, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xed, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x41, 0x00, 0x00, 0x00, 0x00, 0x80, 0x4f, 0x12, 0x41,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x18, 0x41, 0x00, 0x00, 0x00, 0x00, 0x80, 0x84, 0x1e, 0x41,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x4f, 0x22, 0x41, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x5c, 0x25, 0x41,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x28, 0x41, 0x00, 0x00, 0x00, 0x00, 0x40, 0x77, 0x2b, 0x41,
- 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xb5, 0x3f, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xc5, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x3f, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xd5, 0x3f,
- 0xab, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xda, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f,
- 0xab, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xe2, 0x3f, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xe5, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x3f, 0xab, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xea, 0x3f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x0a, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x1a, 0x41,
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x84, 0x2e, 0x41, 0x00, 0x00, 0x00, 0x00, 0x84, 0xd7, 0x97, 0x41,
- 0x00, 0x00, 0x00, 0x20, 0x5f, 0xa0, 0x02, 0x42, 0x00, 0x00, 0x00, 0xa2, 0x94, 0x1a, 0x6d, 0x42
- };
-
- private static ushort[] s_pDigitValues = new ushort []
- {
- 0xffff, 0x0000, 0x0101, 0x0202, 0x0303, 0x0404, 0x0505, 0x0606,
- 0x0707, 0x0808, 0x0909, 0xff02, 0xff03, 0xff01, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xff04, 0xff05, 0xff06,
- 0xff07, 0xff08, 0xff09, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xff00, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
- 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000
- };
-
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/ChineseLunisolarCalendar.cs b/src/mscorlib/corefx/System/Globalization/ChineseLunisolarCalendar.cs
deleted file mode 100644
index 5002555384..0000000000
--- a/src/mscorlib/corefx/System/Globalization/ChineseLunisolarCalendar.cs
+++ /dev/null
@@ -1,395 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about ChineseLunisolarCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
- /*
- ** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 1901/02/19 2101/01/28
- ** ChineseLunisolar 1901/01/01 2100/12/29
- */
- [Serializable]
- public class ChineseLunisolarCalendar : EastAsianLunisolarCalendar
- {
- //
- // The era value for the current era.
- //
-
- public const int ChineseEra = 1;
-
- internal const int MIN_LUNISOLAR_YEAR = 1901;
- internal const int MAX_LUNISOLAR_YEAR = 2100;
-
- internal const int MIN_GREGORIAN_YEAR = 1901;
- internal const int MIN_GREGORIAN_MONTH = 2;
- internal const int MIN_GREGORIAN_DAY = 19;
-
- internal const int MAX_GREGORIAN_YEAR = 2101;
- internal const int MAX_GREGORIAN_MONTH = 1;
- internal const int MAX_GREGORIAN_DAY = 28;
-
- internal static DateTime minDate = new DateTime(MIN_GREGORIAN_YEAR, MIN_GREGORIAN_MONTH, MIN_GREGORIAN_DAY);
- internal static DateTime maxDate = new DateTime((new DateTime(MAX_GREGORIAN_YEAR, MAX_GREGORIAN_MONTH, MAX_GREGORIAN_DAY, 23, 59, 59, 999)).Ticks + 9999);
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (minDate);
- }
- }
-
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (maxDate);
- }
- }
-
- protected override int DaysInYearBeforeMinSupportedYear
- {
- get
- {
- // 1900: 1-29 2-30 3-29 4-29 5-30 6-29 7-30 8-30 Leap8-29 9-30 10-30 11-29 12-30 from Calendrical Tabulations
- return 384;
- }
- }
-
-
- private static readonly int[,] s_yinfo =
- {
- /*Y LM Lmon Lday DaysPerMonth D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 #Days
- 1901 */
- { 0 , 2 , 19 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1902 */{ 0 , 2 , 8 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1903 */{ 5 , 1 , 29 , 21096 },/* 29 30 29 30 29 29 30 29 29 30 30 29 30 383
-1904 */{ 0 , 2 , 16 , 53856 },/* 30 30 29 30 29 29 30 29 29 30 30 29 0 354
-1905 */{ 0 , 2 , 4 , 55632 },/* 30 30 29 30 30 29 29 30 29 30 29 30 0 355
-1906 */{ 4 , 1 , 25 , 27304 },/* 29 30 30 29 30 29 30 29 30 29 30 29 30 384
-1907 */{ 0 , 2 , 13 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1908 */{ 0 , 2 , 2 , 39632 },/* 30 29 29 30 30 29 30 29 30 30 29 30 0 355
-1909 */{ 2 , 1 , 22 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-1910 */{ 0 , 2 , 10 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1911 */{ 6 , 1 , 30 , 42200 },/* 30 29 30 29 29 30 29 29 30 30 29 30 30 384
-1912 */{ 0 , 2 , 18 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1913 */{ 0 , 2 , 6 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-1914 */{ 5 , 1 , 26 , 54568 },/* 30 30 29 30 29 30 29 30 29 29 30 29 30 384
-1915 */{ 0 , 2 , 14 , 46400 },/* 30 29 30 30 29 30 29 30 29 30 29 29 0 354
-1916 */{ 0 , 2 , 3 , 54944 },/* 30 30 29 30 29 30 30 29 30 29 30 29 0 355
-1917 */{ 2 , 1 , 23 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 29 384
-1918 */{ 0 , 2 , 11 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1919 */{ 7 , 2 , 1 , 18872 },/* 29 30 29 29 30 29 29 30 30 29 30 30 30 384
-1920 */{ 0 , 2 , 20 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1921 */{ 0 , 2 , 8 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1922 */{ 5 , 1 , 28 , 45656 },/* 30 29 30 30 29 29 30 29 29 30 29 30 30 384
-1923 */{ 0 , 2 , 16 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 0 354
-1924 */{ 0 , 2 , 5 , 27968 },/* 29 30 30 29 30 30 29 30 29 30 29 29 0 354
-1925 */{ 4 , 1 , 24 , 44456 },/* 30 29 30 29 30 30 29 30 30 29 30 29 30 385
-1926 */{ 0 , 2 , 13 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1927 */{ 0 , 2 , 2 , 38256 },/* 30 29 29 30 29 30 29 30 29 30 30 30 0 355
-1928 */{ 2 , 1 , 23 , 18808 },/* 29 30 29 29 30 29 29 30 29 30 30 30 30 384
-1929 */{ 0 , 2 , 10 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1930 */{ 6 , 1 , 30 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 29 383
-1931 */{ 0 , 2 , 17 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1932 */{ 0 , 2 , 6 , 59984 },/* 30 30 30 29 30 29 30 29 29 30 29 30 0 355
-1933 */{ 5 , 1 , 26 , 27976 },/* 29 30 30 29 30 30 29 30 29 30 29 29 30 384
-1934 */{ 0 , 2 , 14 , 23248 },/* 29 30 29 30 30 29 30 29 30 30 29 30 0 355
-1935 */{ 0 , 2 , 4 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1936 */{ 3 , 1 , 24 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 29 384
-1937 */{ 0 , 2 , 11 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1938 */{ 7 , 1 , 31 , 51560 },/* 30 30 29 29 30 29 29 30 29 30 30 29 30 384
-1939 */{ 0 , 2 , 19 , 51536 },/* 30 30 29 29 30 29 29 30 29 30 29 30 0 354
-1940 */{ 0 , 2 , 8 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1941 */{ 6 , 1 , 27 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 29 384
-1942 */{ 0 , 2 , 15 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1943 */{ 0 , 2 , 5 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1944 */{ 4 , 1 , 25 , 43736 },/* 30 29 30 29 30 29 30 29 30 30 29 30 30 385
-1945 */{ 0 , 2 , 13 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-1946 */{ 0 , 2 , 2 , 37584 },/* 30 29 29 30 29 29 30 29 30 30 29 30 0 354
-1947 */{ 2 , 1 , 22 , 51544 },/* 30 30 29 29 30 29 29 30 29 30 29 30 30 384
-1948 */{ 0 , 2 , 10 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1949 */{ 7 , 1 , 29 , 46248 },/* 30 29 30 30 29 30 29 29 30 29 30 29 30 384
-1950 */{ 0 , 2 , 17 , 27808 },/* 29 30 30 29 30 30 29 29 30 29 30 29 0 354
-1951 */{ 0 , 2 , 6 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1952 */{ 5 , 1 , 27 , 21928 },/* 29 30 29 30 29 30 29 30 30 29 30 29 30 384
-1953 */{ 0 , 2 , 14 , 19872 },/* 29 30 29 29 30 30 29 30 30 29 30 29 0 354
-1954 */{ 0 , 2 , 3 , 42416 },/* 30 29 30 29 29 30 29 30 30 29 30 30 0 355
-1955 */{ 3 , 1 , 24 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-1956 */{ 0 , 2 , 12 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1957 */{ 8 , 1 , 31 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 29 383
-1958 */{ 0 , 2 , 18 , 59728 },/* 30 30 30 29 30 29 29 30 29 30 29 30 0 355
-1959 */{ 0 , 2 , 8 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1960 */{ 6 , 1 , 28 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 29 384
-1961 */{ 0 , 2 , 15 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1962 */{ 0 , 2 , 5 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-1963 */{ 4 , 1 , 25 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-1964 */{ 0 , 2 , 13 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1965 */{ 0 , 2 , 2 , 21088 },/* 29 30 29 30 29 29 30 29 29 30 30 29 0 353
-1966 */{ 3 , 1 , 21 , 59696 },/* 30 30 30 29 30 29 29 30 29 29 30 30 29 384
-1967 */{ 0 , 2 , 9 , 55632 },/* 30 30 29 30 30 29 29 30 29 30 29 30 0 355
-1968 */{ 7 , 1 , 30 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-1969 */{ 0 , 2 , 17 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1970 */{ 0 , 2 , 6 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-1971 */{ 5 , 1 , 27 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-1972 */{ 0 , 2 , 15 , 19152 },/* 29 30 29 29 30 29 30 29 30 30 29 30 0 354
-1973 */{ 0 , 2 , 3 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1974 */{ 4 , 1 , 23 , 53864 },/* 30 30 29 30 29 29 30 29 29 30 30 29 30 384
-1975 */{ 0 , 2 , 11 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-1976 */{ 8 , 1 , 31 , 54568 },/* 30 30 29 30 29 30 29 30 29 29 30 29 30 384
-1977 */{ 0 , 2 , 18 , 46400 },/* 30 29 30 30 29 30 29 30 29 30 29 29 0 354
-1978 */{ 0 , 2 , 7 , 46752 },/* 30 29 30 30 29 30 30 29 30 29 30 29 0 355
-1979 */{ 6 , 1 , 28 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 29 384
-1980 */{ 0 , 2 , 16 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1981 */{ 0 , 2 , 5 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1982 */{ 4 , 1 , 25 , 42168 },/* 30 29 30 29 29 30 29 29 30 29 30 30 30 384
-1983 */{ 0 , 2 , 13 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1984 */{ 10 , 2 , 2 , 45656 },/* 30 29 30 30 29 29 30 29 29 30 29 30 30 384
-1985 */{ 0 , 2 , 20 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 0 354
-1986 */{ 0 , 2 , 9 , 27968 },/* 29 30 30 29 30 30 29 30 29 30 29 29 0 354
-1987 */{ 6 , 1 , 29 , 44448 },/* 30 29 30 29 30 30 29 30 30 29 30 29 29 384
-1988 */{ 0 , 2 , 17 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-1989 */{ 0 , 2 , 6 , 38256 },/* 30 29 29 30 29 30 29 30 29 30 30 30 0 355
-1990 */{ 5 , 1 , 27 , 18808 },/* 29 30 29 29 30 29 29 30 29 30 30 30 30 384
-1991 */{ 0 , 2 , 15 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1992 */{ 0 , 2 , 4 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-1993 */{ 3 , 1 , 23 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 29 383
-1994 */{ 0 , 2 , 10 , 59984 },/* 30 30 30 29 30 29 30 29 29 30 29 30 0 355
-1995 */{ 8 , 1 , 31 , 27432 },/* 29 30 30 29 30 29 30 30 29 29 30 29 30 384
-1996 */{ 0 , 2 , 19 , 23232 },/* 29 30 29 30 30 29 30 29 30 30 29 29 0 354
-1997 */{ 0 , 2 , 7 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-1998 */{ 5 , 1 , 28 , 37736 },/* 30 29 29 30 29 29 30 30 29 30 30 29 30 384
-1999 */{ 0 , 2 , 16 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-2000 */{ 0 , 2 , 5 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-2001 */{ 4 , 1 , 24 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-2002 */{ 0 , 2 , 12 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-2003 */{ 0 , 2 , 1 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 0 355
-2004 */{ 2 , 1 , 22 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-2005 */{ 0 , 2 , 9 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-2006 */{ 7 , 1 , 29 , 43736 },/* 30 29 30 29 30 29 30 29 30 30 29 30 30 385
-2007 */{ 0 , 2 , 18 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-2008 */{ 0 , 2 , 7 , 37584 },/* 30 29 29 30 29 29 30 29 30 30 29 30 0 354
-2009 */{ 5 , 1 , 26 , 51544 },/* 30 30 29 29 30 29 29 30 29 30 29 30 30 384
-2010 */{ 0 , 2 , 14 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-2011 */{ 0 , 2 , 3 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-2012 */{ 4 , 1 , 23 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-2013 */{ 0 , 2 , 10 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-2014 */{ 9 , 1 , 31 , 21928 },/* 29 30 29 30 29 30 29 30 30 29 30 29 30 384
-2015 */{ 0 , 2 , 19 , 19360 },/* 29 30 29 29 30 29 30 30 30 29 30 29 0 354
-2016 */{ 0 , 2 , 8 , 42416 },/* 30 29 30 29 29 30 29 30 30 29 30 30 0 355
-2017 */{ 6 , 1 , 28 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-2018 */{ 0 , 2 , 16 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-2019 */{ 0 , 2 , 5 , 43312 },/* 30 29 30 29 30 29 29 30 29 29 30 30 0 354
-2020 */{ 4 , 1 , 25 , 29864 },/* 29 30 30 30 29 30 29 29 30 29 30 29 30 384
-2021 */{ 0 , 2 , 12 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-2022 */{ 0 , 2 , 1 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-2023 */{ 2 , 1 , 22 , 19880 },/* 29 30 29 29 30 30 29 30 30 29 30 29 30 384
-2024 */{ 0 , 2 , 10 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-2025 */{ 6 , 1 , 29 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-2026 */{ 0 , 2 , 17 , 42208 },/* 30 29 30 29 29 30 29 29 30 30 30 29 0 354
-2027 */{ 0 , 2 , 6 , 53856 },/* 30 30 29 30 29 29 30 29 29 30 30 29 0 354
-2028 */{ 5 , 1 , 26 , 59696 },/* 30 30 30 29 30 29 29 30 29 29 30 30 29 384
-2029 */{ 0 , 2 , 13 , 54576 },/* 30 30 29 30 29 30 29 30 29 29 30 30 0 355
-2030 */{ 0 , 2 , 3 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-2031 */{ 3 , 1 , 23 , 27472 },/* 29 30 30 29 30 29 30 30 29 30 29 30 29 384
-2032 */{ 0 , 2 , 11 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-2033 */{ 11 , 1 , 31 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-2034 */{ 0 , 2 , 19 , 19152 },/* 29 30 29 29 30 29 30 29 30 30 29 30 0 354
-2035 */{ 0 , 2 , 8 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-2036 */{ 6 , 1 , 28 , 53848 },/* 30 30 29 30 29 29 30 29 29 30 29 30 30 384
-2037 */{ 0 , 2 , 15 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-2038 */{ 0 , 2 , 4 , 54560 },/* 30 30 29 30 29 30 29 30 29 29 30 29 0 354
-2039 */{ 5 , 1 , 24 , 55968 },/* 30 30 29 30 30 29 30 29 30 29 30 29 29 384
-2040 */{ 0 , 2 , 12 , 46496 },/* 30 29 30 30 29 30 29 30 30 29 30 29 0 355
-2041 */{ 0 , 2 , 1 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-2042 */{ 2 , 1 , 22 , 19160 },/* 29 30 29 29 30 29 30 29 30 30 29 30 30 384
-2043 */{ 0 , 2 , 10 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-2044 */{ 7 , 1 , 30 , 42168 },/* 30 29 30 29 29 30 29 29 30 29 30 30 30 384
-2045 */{ 0 , 2 , 17 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-2046 */{ 0 , 2 , 6 , 43600 },/* 30 29 30 29 30 29 30 29 29 30 29 30 0 354
-2047 */{ 5 , 1 , 26 , 46376 },/* 30 29 30 30 29 30 29 30 29 29 30 29 30 384
-2048 */{ 0 , 2 , 14 , 27936 },/* 29 30 30 29 30 30 29 30 29 29 30 29 0 354
-2049 */{ 0 , 2 , 2 , 44448 },/* 30 29 30 29 30 30 29 30 30 29 30 29 0 355
-2050 */{ 3 , 1 , 23 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 29 384
-2051 */{ 0 , 2 , 11 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 0 355
-2052 */{ 8 , 2 , 1 , 18808 },/* 29 30 29 29 30 29 29 30 29 30 30 30 30 384
-2053 */{ 0 , 2 , 19 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-2054 */{ 0 , 2 , 8 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-2055 */{ 6 , 1 , 28 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 29 383
-2056 */{ 0 , 2 , 15 , 59984 },/* 30 30 30 29 30 29 30 29 29 30 29 30 0 355
-2057 */{ 0 , 2 , 4 , 27424 },/* 29 30 30 29 30 29 30 30 29 29 30 29 0 354
-2058 */{ 4 , 1 , 24 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 29 384
-2059 */{ 0 , 2 , 12 , 43744 },/* 30 29 30 29 30 29 30 29 30 30 30 29 0 355
-2060 */{ 0 , 2 , 2 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-2061 */{ 3 , 1 , 21 , 51568 },/* 30 30 29 29 30 29 29 30 29 30 30 30 29 384
-2062 */{ 0 , 2 , 9 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-2063 */{ 7 , 1 , 29 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-2064 */{ 0 , 2 , 17 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-2065 */{ 0 , 2 , 5 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 0 355
-2066 */{ 5 , 1 , 26 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-2067 */{ 0 , 2 , 14 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-2068 */{ 0 , 2 , 3 , 42704 },/* 30 29 30 29 29 30 30 29 30 30 29 30 0 355
-2069 */{ 4 , 1 , 23 , 21224 },/* 29 30 29 30 29 29 30 29 30 30 30 29 30 384
-2070 */{ 0 , 2 , 11 , 21200 },/* 29 30 29 30 29 29 30 29 30 30 29 30 0 354
-2071 */{ 8 , 1 , 31 , 43352 },/* 30 29 30 29 30 29 29 30 29 30 29 30 30 384
-2072 */{ 0 , 2 , 19 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-2073 */{ 0 , 2 , 7 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-2074 */{ 6 , 1 , 27 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-2075 */{ 0 , 2 , 15 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-2076 */{ 0 , 2 , 5 , 21920 },/* 29 30 29 30 29 30 29 30 30 29 30 29 0 354
-2077 */{ 4 , 1 , 24 , 42448 },/* 30 29 30 29 29 30 29 30 30 30 29 30 29 384
-2078 */{ 0 , 2 , 12 , 42416 },/* 30 29 30 29 29 30 29 30 30 29 30 30 0 355
-2079 */{ 0 , 2 , 2 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-2080 */{ 3 , 1 , 22 , 43320 },/* 30 29 30 29 30 29 29 30 29 29 30 30 30 384
-2081 */{ 0 , 2 , 9 , 26928 },/* 29 30 30 29 30 29 29 30 29 29 30 30 0 354
-2082 */{ 7 , 1 , 29 , 29336 },/* 29 30 30 30 29 29 30 29 30 29 29 30 30 384
-2083 */{ 0 , 2 , 17 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-2084 */{ 0 , 2 , 6 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-2085 */{ 5 , 1 , 26 , 19880 },/* 29 30 29 29 30 30 29 30 30 29 30 29 30 384
-2086 */{ 0 , 2 , 14 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-2087 */{ 0 , 2 , 3 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-2088 */{ 4 , 1 , 24 , 21104 },/* 29 30 29 30 29 29 30 29 29 30 30 30 29 383
-2089 */{ 0 , 2 , 10 , 53856 },/* 30 30 29 30 29 29 30 29 29 30 30 29 0 354
-2090 */{ 8 , 1 , 30 , 59696 },/* 30 30 30 29 30 29 29 30 29 29 30 30 29 384
-2091 */{ 0 , 2 , 18 , 54560 },/* 30 30 29 30 29 30 29 30 29 29 30 29 0 354
-2092 */{ 0 , 2 , 7 , 55968 },/* 30 30 29 30 30 29 30 29 30 29 30 29 0 355
-2093 */{ 6 , 1 , 27 , 27472 },/* 29 30 30 29 30 29 30 30 29 30 29 30 29 384
-2094 */{ 0 , 2 , 15 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-2095 */{ 0 , 2 , 5 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-2096 */{ 4 , 1 , 25 , 42216 },/* 30 29 30 29 29 30 29 29 30 30 30 29 30 384
-2097 */{ 0 , 2 , 12 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-2098 */{ 0 , 2 , 1 , 53584 },/* 30 30 29 30 29 29 29 30 29 30 29 30 0 354
-2099 */{ 2 , 1 , 21 , 55592 },/* 30 30 29 30 30 29 29 30 29 29 30 29 30 384
-2100 */{ 0 , 2 , 9 , 54560 },/* 30 30 29 30 29 30 29 30 29 29 30 29 0 354
- */};
-
-
- internal override int MinCalendarYear
- {
- get
- {
- return (MIN_LUNISOLAR_YEAR);
- }
- }
-
- internal override int MaxCalendarYear
- {
- get
- {
- return (MAX_LUNISOLAR_YEAR);
- }
- }
-
- internal override DateTime MinDate
- {
- get
- {
- return (minDate);
- }
- }
-
- internal override DateTime MaxDate
- {
- get
- {
- return (maxDate);
- }
- }
-
- internal override EraInfo[] CalEraInfo
- {
- get
- {
- return (null);
- }
- }
-
- internal override int GetYearInfo(int lunarYear, int index)
- {
- if ((lunarYear < MIN_LUNISOLAR_YEAR) || (lunarYear > MAX_LUNISOLAR_YEAR))
- {
- throw new ArgumentOutOfRangeException(
- "year",
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range, MIN_LUNISOLAR_YEAR, MAX_LUNISOLAR_YEAR));
- }
- Contract.EndContractBlock();
-
- return s_yinfo[lunarYear - MIN_LUNISOLAR_YEAR, index];
- }
-
- internal override int GetYear(int year, DateTime time)
- {
- return year;
- }
-
- internal override int GetGregorianYear(int year, int era)
- {
- if (era != CurrentEra && era != ChineseEra)
- {
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
-
- if (year < MIN_LUNISOLAR_YEAR || year > MAX_LUNISOLAR_YEAR)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range, MIN_LUNISOLAR_YEAR, MAX_LUNISOLAR_YEAR));
- }
- Contract.EndContractBlock();
-
- return year;
- }
-
- public ChineseLunisolarCalendar()
- {
- }
-
- public override int GetEra(DateTime time)
- {
- CheckTicksRange(time.Ticks);
- return (ChineseEra);
- }
-
- internal override CalendarId ID
- {
- get
- {
- return (CalendarId.CHINESELUNISOLAR);
- }
- }
-
- internal override CalendarId BaseCalendarID
- {
- get
- {
- //Use CAL_GREGORIAN just to get CurrentEraValue as 1 since we do not have data under the ID CAL_ChineseLunisolar yet
- return (CalendarId.GREGORIAN);
- }
- }
-
-
- public override int[] Eras
- {
- get
- {
- return (new int[] { ChineseEra });
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs b/src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs
deleted file mode 100644
index 21c3c9f7e4..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CompareInfo.Unix.cs
+++ /dev/null
@@ -1,397 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Security;
-
-namespace System.Globalization
-{
- public partial class CompareInfo
- {
- [NonSerialized]
- private Interop.GlobalizationInterop.SafeSortHandle _sortHandle;
-
- [NonSerialized]
- private bool _isAsciiEqualityOrdinal;
-
- internal CompareInfo(CultureInfo culture)
- {
- _name = culture.m_name;
- InitSort(culture);
- }
-
- private void InitSort(CultureInfo culture)
- {
- _sortName = culture.SortName;
- Interop.GlobalizationInterop.ResultCode resultCode = Interop.GlobalizationInterop.GetSortHandle(GetNullTerminatedUtf8String(_sortName), out _sortHandle);
- if (resultCode != Interop.GlobalizationInterop.ResultCode.Success)
- {
- _sortHandle.Dispose();
-
- if (resultCode == Interop.GlobalizationInterop.ResultCode.OutOfMemory)
- throw new OutOfMemoryException();
-
- throw new ExternalException(SR.Arg_ExternalException);
- }
- _isAsciiEqualityOrdinal = (_sortName == "en-US" || _sortName == "");
- }
-
- internal static unsafe int IndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
- {
- Debug.Assert(source != null);
- Debug.Assert(value != null);
-
- if (value.Length == 0)
- {
- return startIndex;
- }
-
- if (count < value.Length)
- {
- return -1;
- }
-
- if (ignoreCase)
- {
- fixed (char* pSource = source)
- {
- int index = Interop.GlobalizationInterop.IndexOfOrdinalIgnoreCase(value, value.Length, pSource + startIndex, count, findLast: false);
- return index != -1 ?
- startIndex + index :
- -1;
- }
- }
-
- int endIndex = startIndex + (count - value.Length);
- for (int i = startIndex; i <= endIndex; i++)
- {
- int valueIndex, sourceIndex;
-
- for (valueIndex = 0, sourceIndex = i;
- valueIndex < value.Length && source[sourceIndex] == value[valueIndex];
- valueIndex++, sourceIndex++) ;
-
- if (valueIndex == value.Length)
- {
- return i;
- }
- }
-
- return -1;
- }
-
- internal static unsafe int LastIndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
- {
- Debug.Assert(source != null);
- Debug.Assert(value != null);
-
- if (value.Length == 0)
- {
- return startIndex;
- }
-
- if (count < value.Length)
- {
- return -1;
- }
-
- // startIndex is the index into source where we start search backwards from.
- // leftStartIndex is the index into source of the start of the string that is
- // count characters away from startIndex.
- int leftStartIndex = startIndex - count + 1;
-
- if (ignoreCase)
- {
- fixed (char* pSource = source)
- {
- int lastIndex = Interop.GlobalizationInterop.IndexOfOrdinalIgnoreCase(value, value.Length, pSource + leftStartIndex, count, findLast: true);
- return lastIndex != -1 ?
- leftStartIndex + lastIndex :
- -1;
- }
- }
-
- for (int i = startIndex - value.Length + 1; i >= leftStartIndex; i--)
- {
- int valueIndex, sourceIndex;
-
- for (valueIndex = 0, sourceIndex = i;
- valueIndex < value.Length && source[sourceIndex] == value[valueIndex];
- valueIndex++, sourceIndex++) ;
-
- if (valueIndex == value.Length) {
- return i;
- }
- }
-
- return -1;
- }
-
- private int GetHashCodeOfStringCore(string source, CompareOptions options)
- {
- Debug.Assert(source != null);
- Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
-
- return GetHashCodeOfStringCore(source, options, forceRandomizedHashing: false, additionalEntropy: 0);
- }
-
- private static unsafe int CompareStringOrdinalIgnoreCase(char* string1, int count1, char* string2, int count2)
- {
- return Interop.GlobalizationInterop.CompareStringOrdinalIgnoreCase(string1, count1, string2, count2);
- }
-
- private unsafe int CompareString(string string1, int offset1, int length1, string string2, int offset2, int length2, CompareOptions options)
- {
- Debug.Assert(string1 != null);
- Debug.Assert(string2 != null);
- Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
-
- fixed (char* pString1 = string1)
- {
- fixed (char* pString2 = string2)
- {
- return Interop.GlobalizationInterop.CompareString(_sortHandle, pString1 + offset1, length1, pString2 + offset2, length2, options);
- }
- }
- }
-
- private unsafe int IndexOfCore(string source, string target, int startIndex, int count, CompareOptions options)
- {
- Debug.Assert(!string.IsNullOrEmpty(source));
- Debug.Assert(target != null);
- Debug.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
-
- if (target.Length == 0)
- {
- return startIndex;
- }
-
- if (options == CompareOptions.Ordinal)
- {
- return IndexOfOrdinal(source, target, startIndex, count, ignoreCase: false);
- }
-
- if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && target.IsFastSort())
- {
- return IndexOf(source, target, startIndex, count, GetOrdinalCompareOptions(options));
- }
-
- fixed (char* pSource = source)
- {
- int index = Interop.GlobalizationInterop.IndexOf(_sortHandle, target, target.Length, pSource + startIndex, count, options);
-
- return index != -1 ? index + startIndex : -1;
- }
- }
-
- private unsafe int LastIndexOfCore(string source, string target, int startIndex, int count, CompareOptions options)
- {
- Debug.Assert(!string.IsNullOrEmpty(source));
- Debug.Assert(target != null);
- Debug.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
-
- if (target.Length == 0)
- {
- return startIndex;
- }
-
- if (options == CompareOptions.Ordinal)
- {
- return LastIndexOfOrdinal(source, target, startIndex, count, ignoreCase: false);
- }
-
- if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && target.IsFastSort())
- {
- return LastIndexOf(source, target, startIndex, count, GetOrdinalCompareOptions(options));
- }
-
- // startIndex is the index into source where we start search backwards from. leftStartIndex is the index into source
- // of the start of the string that is count characters away from startIndex.
- int leftStartIndex = (startIndex - count + 1);
-
- fixed (char* pSource = source)
- {
- int lastIndex = Interop.GlobalizationInterop.LastIndexOf(_sortHandle, target, target.Length, pSource + (startIndex - count + 1), count, options);
-
- return lastIndex != -1 ? lastIndex + leftStartIndex : -1;
- }
- }
-
- private bool StartsWith(string source, string prefix, CompareOptions options)
- {
- Debug.Assert(!string.IsNullOrEmpty(source));
- Debug.Assert(!string.IsNullOrEmpty(prefix));
- Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
-
- if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && prefix.IsFastSort())
- {
- return IsPrefix(source, prefix, GetOrdinalCompareOptions(options));
- }
-
- return Interop.GlobalizationInterop.StartsWith(_sortHandle, prefix, prefix.Length, source, source.Length, options);
- }
-
- private bool EndsWith(string source, string suffix, CompareOptions options)
- {
- Debug.Assert(!string.IsNullOrEmpty(source));
- Debug.Assert(!string.IsNullOrEmpty(suffix));
- Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
-
- if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && suffix.IsFastSort())
- {
- return IsSuffix(source, suffix, GetOrdinalCompareOptions(options));
- }
-
- return Interop.GlobalizationInterop.EndsWith(_sortHandle, suffix, suffix.Length, source, source.Length, options);
- }
-
- private unsafe SortKey CreateSortKey(String source, CompareOptions options)
- {
- if (source==null) { throw new ArgumentNullException(nameof(source)); }
- Contract.EndContractBlock();
-
- if ((options & ValidSortkeyCtorMaskOffFlags) != 0)
- {
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag"), nameof(options));
- }
-
- byte [] keyData;
- if (source.Length == 0)
- {
- keyData = EmptyArray<Byte>.Value;
- }
- else
- {
- int sortKeyLength = Interop.GlobalizationInterop.GetSortKey(_sortHandle, source, source.Length, null, 0, options);
- keyData = new byte[sortKeyLength];
-
- fixed (byte* pSortKey = keyData)
- {
- Interop.GlobalizationInterop.GetSortKey(_sortHandle, source, source.Length, pSortKey, sortKeyLength, options);
- }
- }
-
- return new SortKey(Name, source, options, keyData);
- }
-
- private unsafe static bool IsSortable(char *text, int length)
- {
- int index = 0;
- UnicodeCategory uc;
-
- while (index < length)
- {
- if (Char.IsHighSurrogate(text[index]))
- {
- if (index == length - 1 || !Char.IsLowSurrogate(text[index+1]))
- return false; // unpaired surrogate
-
- uc = CharUnicodeInfo.InternalGetUnicodeCategory(Char.ConvertToUtf32(text[index], text[index+1]));
- if (uc == UnicodeCategory.PrivateUse || uc == UnicodeCategory.OtherNotAssigned)
- return false;
-
- index += 2;
- continue;
- }
-
- if (Char.IsLowSurrogate(text[index]))
- {
- return false; // unpaired surrogate
- }
-
- uc = CharUnicodeInfo.GetUnicodeCategory(text[index]);
- if (uc == UnicodeCategory.PrivateUse || uc == UnicodeCategory.OtherNotAssigned)
- {
- return false;
- }
-
- index++;
- }
-
- return true;
- }
-
- // -----------------------------
- // ---- PAL layer ends here ----
- // -----------------------------
-
- internal unsafe int GetHashCodeOfStringCore(string source, CompareOptions options, bool forceRandomizedHashing, long additionalEntropy)
- {
- Debug.Assert(source != null);
- Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
-
- if (source.Length == 0)
- {
- return 0;
- }
-
- int sortKeyLength = Interop.GlobalizationInterop.GetSortKey(_sortHandle, source, source.Length, null, 0, options);
-
- // As an optimization, for small sort keys we allocate the buffer on the stack.
- if (sortKeyLength <= 256)
- {
- byte* pSortKey = stackalloc byte[sortKeyLength];
- Interop.GlobalizationInterop.GetSortKey(_sortHandle, source, source.Length, pSortKey, sortKeyLength, options);
- return InternalHashSortKey(pSortKey, sortKeyLength, false, additionalEntropy);
- }
-
- byte[] sortKey = new byte[sortKeyLength];
-
- fixed(byte* pSortKey = sortKey)
- {
- Interop.GlobalizationInterop.GetSortKey(_sortHandle, source, source.Length, pSortKey, sortKeyLength, options);
- return InternalHashSortKey(pSortKey, sortKeyLength, false, additionalEntropy);
- }
- }
-
- [DllImport(JitHelpers.QCall)]
- [SuppressUnmanagedCodeSecurity]
- private static unsafe extern int InternalHashSortKey(byte* sortKey, int sortKeyLength, [MarshalAs(UnmanagedType.Bool)] bool forceRandomizedHashing, long additionalEntropy);
-
- private static CompareOptions GetOrdinalCompareOptions(CompareOptions options)
- {
- if ((options & CompareOptions.IgnoreCase) == CompareOptions.IgnoreCase)
- {
- return CompareOptions.OrdinalIgnoreCase;
- }
- else
- {
- return CompareOptions.Ordinal;
- }
- }
-
- private static bool CanUseAsciiOrdinalForOptions(CompareOptions options)
- {
- // Unlike the other Ignore options, IgnoreSymbols impacts ASCII characters (e.g. ').
- return (options & CompareOptions.IgnoreSymbols) == 0;
- }
-
- private static byte[] GetNullTerminatedUtf8String(string s)
- {
- int byteLen = System.Text.Encoding.UTF8.GetByteCount(s);
-
- // Allocate an extra byte (which defaults to 0) as the null terminator.
- byte[] buffer = new byte[byteLen + 1];
-
- int bytesWritten = System.Text.Encoding.UTF8.GetBytes(s, 0, s.Length, buffer, 0);
-
- Debug.Assert(bytesWritten == byteLen);
-
- return buffer;
- }
-
- private SortVersion GetSortVersion()
- {
- int sortVersion = Interop.GlobalizationInterop.GetSortVersion();
- return new SortVersion(sortVersion, LCID, new Guid(sortVersion, 0, 0, 0, 0, 0, 0,
- (byte) (LCID >> 24),
- (byte) ((LCID & 0x00FF0000) >> 16),
- (byte) ((LCID & 0x0000FF00) >> 8),
- (byte) (LCID & 0xFF)));
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs b/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs
deleted file mode 100644
index d4936522dd..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CompareInfo.Windows.cs
+++ /dev/null
@@ -1,415 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- public partial class CompareInfo
- {
- internal unsafe CompareInfo(CultureInfo culture)
- {
- _name = culture._name;
- InitSort(culture);
- }
-
- private void InitSort(CultureInfo culture)
- {
- _sortName = culture.SortName;
-
- const uint LCMAP_SORTHANDLE = 0x20000000;
-
- _name = culture._name;
- _sortName = culture.SortName;
-
- IntPtr handle;
- int ret = Interop.mincore.LCMapStringEx(_sortName, LCMAP_SORTHANDLE, null, 0, &handle, IntPtr.Size, null, null, IntPtr.Zero);
- _sortHandle = ret > 0 ? handle : IntPtr.Zero;
- }
-
- private static unsafe int FindStringOrdinal(
- uint dwFindStringOrdinalFlags,
- string stringSource,
- int offset,
- int cchSource,
- string value,
- int cchValue,
- bool bIgnoreCase)
- {
- fixed (char* pSource = stringSource)
- fixed (char* pValue = value)
- {
- int ret = Interop.mincore.FindStringOrdinal(
- dwFindStringOrdinalFlags,
- pSource + offset,
- cchSource,
- pValue,
- cchValue,
- bIgnoreCase ? 1 : 0);
- return ret < 0 ? ret : ret + offset;
- }
- }
-
- internal static int IndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
- {
- Debug.Assert(source != null);
- Debug.Assert(value != null);
-
- return FindStringOrdinal(FIND_FROMSTART, source, startIndex, count, value, value.Length, ignoreCase);
- }
-
- internal static int LastIndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
- {
- Debug.Assert(source != null);
- Debug.Assert(value != null);
-
- return FindStringOrdinal(FIND_FROMEND, source, startIndex - count + 1, count, value, value.Length, ignoreCase);
- }
-
- private unsafe int GetHashCodeOfStringCore(string source, CompareOptions options)
- {
- Debug.Assert(source != null);
- Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
-
- if (source.Length == 0)
- {
- return 0;
- }
-
- int tmpHash = 0;
-
- fixed (char* pSource = source)
- {
- if (Interop.mincore.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _sortName,
- LCMAP_HASH | (uint)GetNativeCompareFlags(options),
- pSource, source.Length,
- &tmpHash, sizeof(int),
- null, null, _sortHandle) == 0)
- {
- Environment.FailFast("LCMapStringEx failed!");
- }
- }
-
- return tmpHash;
- }
-
- private static unsafe int CompareStringOrdinalIgnoreCase(char* string1, int count1, char* string2, int count2)
- {
- // Use the OS to compare and then convert the result to expected value by subtracting 2
- return Interop.mincore.CompareStringOrdinal(string1, count1, string2, count2, true) - 2;
- }
-
- private unsafe int CompareString(string string1, int offset1, int length1, string string2, int offset2, int length2, CompareOptions options)
- {
- Debug.Assert(string1 != null);
- Debug.Assert(string2 != null);
- Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
-
- string localeName = _sortHandle != IntPtr.Zero ? null : _sortName;
-
- fixed (char* pLocaleName = localeName)
- fixed (char* pString1 = string1)
- fixed (char* pString2 = string2)
- {
- int result = Interop.mincore.CompareStringEx(
- pLocaleName,
- (uint)GetNativeCompareFlags(options),
- pString1 + offset1,
- length1,
- pString2 + offset2,
- length2,
- null,
- null,
- _sortHandle);
-
- if (result == 0)
- {
- Environment.FailFast("CompareStringEx failed");
- }
-
- // Map CompareStringEx return value to -1, 0, 1.
- return result - 2;
- }
- }
-
- private unsafe int FindString(
- uint dwFindNLSStringFlags,
- string lpStringSource,
- int startSource,
- int cchSource,
- string lpStringValue,
- int startValue,
- int cchValue)
- {
- string localeName = _sortHandle != IntPtr.Zero ? null : _sortName;
-
- fixed (char* pLocaleName = localeName)
- fixed (char* pSource = lpStringSource)
- fixed (char* pValue = lpStringValue)
- {
- char* pS = pSource + startSource;
- char* pV = pValue + startValue;
-
- return Interop.mincore.FindNLSStringEx(
- pLocaleName,
- dwFindNLSStringFlags,
- pS,
- cchSource,
- pV,
- cchValue,
- null,
- null,
- null,
- _sortHandle);
- }
- }
-
- private int IndexOfCore(string source, string target, int startIndex, int count, CompareOptions options)
- {
- Debug.Assert(!string.IsNullOrEmpty(source));
- Debug.Assert(target != null);
- Debug.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
-
- // TODO: Consider moving this up to the relevent APIs we need to ensure this behavior for
- // and add a precondition that target is not empty.
- if (target.Length == 0)
- return startIndex; // keep Whidbey compatibility
-
- if ((options & CompareOptions.Ordinal) != 0)
- {
- return FastIndexOfString(source, target, startIndex, count, target.Length, findLastIndex: false);
- }
- else
- {
- int retValue = FindString(FIND_FROMSTART | (uint)GetNativeCompareFlags(options),
- source,
- startIndex,
- count,
- target,
- 0,
- target.Length);
- if (retValue >= 0)
- {
- return retValue + startIndex;
- }
- }
-
- return -1;
- }
-
- private int LastIndexOfCore(string source, string target, int startIndex, int count, CompareOptions options)
- {
- Debug.Assert(!string.IsNullOrEmpty(source));
- Debug.Assert(target != null);
- Debug.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
-
- // TODO: Consider moving this up to the relevent APIs we need to ensure this behavior for
- // and add a precondition that target is not empty.
- if (target.Length == 0)
- return startIndex; // keep Whidbey compatibility
-
- if ((options & CompareOptions.Ordinal) != 0)
- {
- return FastIndexOfString(source, target, startIndex, count, target.Length, findLastIndex: true);
- }
- else
- {
- int retValue = FindString(FIND_FROMEND | (uint)GetNativeCompareFlags(options),
- source,
- startIndex - count + 1,
- count,
- target,
- 0,
- target.Length);
-
- if (retValue >= 0)
- {
- return retValue + startIndex - (count - 1);
- }
- }
-
- return -1;
- }
-
- private bool StartsWith(string source, string prefix, CompareOptions options)
- {
- Debug.Assert(!string.IsNullOrEmpty(source));
- Debug.Assert(!string.IsNullOrEmpty(prefix));
- Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
-
- return FindString(FIND_STARTSWITH | (uint)GetNativeCompareFlags(options),
- source,
- 0,
- source.Length,
- prefix,
- 0,
- prefix.Length) >= 0;
- }
-
- private bool EndsWith(string source, string suffix, CompareOptions options)
- {
- Debug.Assert(!string.IsNullOrEmpty(source));
- Debug.Assert(!string.IsNullOrEmpty(suffix));
- Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
-
- return FindString(FIND_ENDSWITH | (uint)GetNativeCompareFlags(options),
- source,
- 0,
- source.Length,
- suffix,
- 0,
- suffix.Length) >= 0;
- }
-
- // PAL ends here
- [NonSerialized]
- private readonly IntPtr _sortHandle;
-
- private const uint LCMAP_HASH = 0x00040000;
-
- private const int FIND_STARTSWITH = 0x00100000;
- private const int FIND_ENDSWITH = 0x00200000;
- private const int FIND_FROMSTART = 0x00400000;
- private const int FIND_FROMEND = 0x00800000;
-
- // TODO: Instead of this method could we just have upstack code call IndexOfOrdinal with ignoreCase = false?
- private static unsafe int FastIndexOfString(string source, string target, int startIndex, int sourceCount, int targetCount, bool findLastIndex)
- {
- int retValue = -1;
-
- int sourceStartIndex = findLastIndex ? startIndex - sourceCount + 1 : startIndex;
-
- fixed (char* pSource = source, spTarget = target)
- {
- char* spSubSource = pSource + sourceStartIndex;
-
- if (findLastIndex)
- {
- int startPattern = (sourceCount - 1) - targetCount + 1;
- if (startPattern < 0)
- return -1;
-
- char patternChar0 = spTarget[0];
- for (int ctrSrc = startPattern; ctrSrc >= 0; ctrSrc--)
- {
- if (spSubSource[ctrSrc] != patternChar0)
- continue;
-
- int ctrPat;
- for (ctrPat = 1; ctrPat < targetCount; ctrPat++)
- {
- if (spSubSource[ctrSrc + ctrPat] != spTarget[ctrPat])
- break;
- }
- if (ctrPat == targetCount)
- {
- retValue = ctrSrc;
- break;
- }
- }
-
- if (retValue >= 0)
- {
- retValue += startIndex - sourceCount + 1;
- }
- }
- else
- {
- int endPattern = (sourceCount - 1) - targetCount + 1;
- if (endPattern < 0)
- return -1;
-
- char patternChar0 = spTarget[0];
- for (int ctrSrc = 0; ctrSrc <= endPattern; ctrSrc++)
- {
- if (spSubSource[ctrSrc] != patternChar0)
- continue;
- int ctrPat;
- for (ctrPat = 1; ctrPat < targetCount; ctrPat++)
- {
- if (spSubSource[ctrSrc + ctrPat] != spTarget[ctrPat])
- break;
- }
- if (ctrPat == targetCount)
- {
- retValue = ctrSrc;
- break;
- }
- }
-
- if (retValue >= 0)
- {
- retValue += startIndex;
- }
- }
- }
-
- return retValue;
- }
-
- private unsafe SortKey CreateSortKey(String source, CompareOptions options)
- {
- if (source == null) { throw new ArgumentNullException(nameof(source)); }
- Contract.EndContractBlock();
-
- if ((options & ValidSortkeyCtorMaskOffFlags) != 0)
- {
- throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
- }
-
- throw new NotImplementedException();
- }
-
- private static unsafe bool IsSortable(char* text, int length)
- {
- // CompareInfo c = CultureInfo.InvariantCulture.CompareInfo;
- // return (InternalIsSortable(c.m_dataHandle, c.m_handleOrigin, c.m_sortName, text, text.Length));
- throw new NotImplementedException();
- }
-
- private const int COMPARE_OPTIONS_ORDINAL = 0x40000000; // Ordinal
- private const int NORM_IGNORECASE = 0x00000001; // Ignores case. (use LINGUISTIC_IGNORECASE instead)
- private const int NORM_IGNOREKANATYPE = 0x00010000; // Does not differentiate between Hiragana and Katakana characters. Corresponding Hiragana and Katakana will compare as equal.
- private const int NORM_IGNORENONSPACE = 0x00000002; // Ignores nonspacing. This flag also removes Japanese accent characters. (use LINGUISTIC_IGNOREDIACRITIC instead)
- private const int NORM_IGNORESYMBOLS = 0x00000004; // Ignores symbols.
- private const int NORM_IGNOREWIDTH = 0x00020000; // Does not differentiate between a single-byte character and the same character as a double-byte character.
- private const int NORM_LINGUISTIC_CASING = 0x08000000; // use linguistic rules for casing
- private const int SORT_STRINGSORT = 0x00001000; // Treats punctuation the same as symbols.
-
- private static int GetNativeCompareFlags(CompareOptions options)
- {
- // Use "linguistic casing" by default (load the culture's casing exception tables)
- int nativeCompareFlags = NORM_LINGUISTIC_CASING;
-
- if ((options & CompareOptions.IgnoreCase) != 0) { nativeCompareFlags |= NORM_IGNORECASE; }
- if ((options & CompareOptions.IgnoreKanaType) != 0) { nativeCompareFlags |= NORM_IGNOREKANATYPE; }
- if ((options & CompareOptions.IgnoreNonSpace) != 0) { nativeCompareFlags |= NORM_IGNORENONSPACE; }
- if ((options & CompareOptions.IgnoreSymbols) != 0) { nativeCompareFlags |= NORM_IGNORESYMBOLS; }
- if ((options & CompareOptions.IgnoreWidth) != 0) { nativeCompareFlags |= NORM_IGNOREWIDTH; }
- if ((options & CompareOptions.StringSort) != 0) { nativeCompareFlags |= SORT_STRINGSORT; }
-
- // TODO: Can we try for GetNativeCompareFlags to never
- // take Ordinal or OrdinalIgnoreCase. This value is not part of Win32, we just handle it special
- // in some places.
- // Suffix & Prefix shouldn't use this, make sure to turn off the NORM_LINGUISTIC_CASING flag
- if (options == CompareOptions.Ordinal) { nativeCompareFlags = COMPARE_OPTIONS_ORDINAL; }
-
- Debug.Assert(((options & ~(CompareOptions.IgnoreCase |
- CompareOptions.IgnoreKanaType |
- CompareOptions.IgnoreNonSpace |
- CompareOptions.IgnoreSymbols |
- CompareOptions.IgnoreWidth |
- CompareOptions.StringSort)) == 0) ||
- (options == CompareOptions.Ordinal), "[CompareInfo.GetNativeCompareFlags]Expected all flags to be handled");
-
- return nativeCompareFlags;
- }
-
- private SortVersion GetSortVersion()
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CompareInfo.cs b/src/mscorlib/corefx/System/Globalization/CompareInfo.cs
deleted file mode 100644
index 64dbfe84f7..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CompareInfo.cs
+++ /dev/null
@@ -1,1094 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-// Purpose: This class implements a set of methods for comparing
-// strings.
-//
-//
-////////////////////////////////////////////////////////////////////////////
-
-using System.Reflection;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
-
-namespace System.Globalization
-{
- [Flags]
- [Serializable]
- public enum CompareOptions
- {
- None = 0x00000000,
- IgnoreCase = 0x00000001,
- IgnoreNonSpace = 0x00000002,
- IgnoreSymbols = 0x00000004,
- IgnoreKanaType = 0x00000008, // ignore kanatype
- IgnoreWidth = 0x00000010, // ignore width
- OrdinalIgnoreCase = 0x10000000, // This flag can not be used with other flags.
- StringSort = 0x20000000, // use string sort method
- Ordinal = 0x40000000, // This flag can not be used with other flags.
- }
-
- [Serializable]
- public partial class CompareInfo : IDeserializationCallback
- {
- // Mask used to check if IndexOf()/LastIndexOf()/IsPrefix()/IsPostfix() has the right flags.
- private const CompareOptions ValidIndexMaskOffFlags =
- ~(CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreNonSpace |
- CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType);
-
- // Mask used to check if Compare() has the right flags.
- private const CompareOptions ValidCompareMaskOffFlags =
- ~(CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreNonSpace |
- CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType | CompareOptions.StringSort);
-
- // Mask used to check if GetHashCodeOfString() has the right flags.
- private const CompareOptions ValidHashCodeOfStringMaskOffFlags =
- ~(CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreNonSpace |
- CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType);
-
- // Mask used to check if we have the right flags.
- private const CompareOptions ValidSortkeyCtorMaskOffFlags =
- ~(CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreNonSpace |
- CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType | CompareOptions.StringSort);
-
- //
- // CompareInfos have an interesting identity. They are attached to the locale that created them,
- // ie: en-US would have an en-US sort. For haw-US (custom), then we serialize it as haw-US.
- // The interesting part is that since haw-US doesn't have its own sort, it has to point at another
- // locale, which is what SCOMPAREINFO does.
-
- [OptionalField(VersionAdded = 2)]
- private String _name; // The name used to construct this CompareInfo
- [NonSerialized]
- private String _sortName; // The name that defines our behavior
-
- [OptionalField(VersionAdded = 3)]
- private SortVersion _sortVersion;
-
- /*=================================GetCompareInfo==========================
- **Action: Get the CompareInfo constructed from the data table in the specified assembly for the specified culture.
- ** Warning: The assembly versioning mechanism is dead!
- **Returns: The CompareInfo for the specified culture.
- **Arguments:
- ** culture the ID of the culture
- ** assembly the assembly which contains the sorting table.
- **Exceptions:
- ** ArugmentNullException when the assembly is null
- ** ArgumentException if culture is invalid.
- ============================================================================*/
- // Assembly constructor should be deprecated, we don't act on the assembly information any more
- public static CompareInfo GetCompareInfo(int culture, Assembly assembly)
- {
- // Parameter checking.
- if (assembly == null)
- {
- throw new ArgumentNullException(nameof(assembly));
- }
- if (assembly != typeof(Object).Module.Assembly)
- {
- throw new ArgumentException(SR.Argument_OnlyMscorlib);
- }
- Contract.EndContractBlock();
-
- return GetCompareInfo(culture);
- }
-
- /*=================================GetCompareInfo==========================
- **Action: Get the CompareInfo constructed from the data table in the specified assembly for the specified culture.
- ** The purpose of this method is to provide version for CompareInfo tables.
- **Returns: The CompareInfo for the specified culture.
- **Arguments:
- ** name the name of the culture
- ** assembly the assembly which contains the sorting table.
- **Exceptions:
- ** ArugmentNullException when the assembly is null
- ** ArgumentException if name is invalid.
- ============================================================================*/
- // Assembly constructor should be deprecated, we don't act on the assembly information any more
- public static CompareInfo GetCompareInfo(String name, Assembly assembly)
- {
- if (name == null || assembly == null)
- {
- throw new ArgumentNullException(name == null ? nameof(name) : nameof(assembly));
- }
- Contract.EndContractBlock();
-
- if (assembly != typeof(Object).Module.Assembly)
- {
- throw new ArgumentException(SR.Argument_OnlyMscorlib);
- }
-
- return GetCompareInfo(name);
- }
-
- /*=================================GetCompareInfo==========================
- **Action: Get the CompareInfo for the specified culture.
- ** This method is provided for ease of integration with NLS-based software.
- **Returns: The CompareInfo for the specified culture.
- **Arguments:
- ** culture the ID of the culture.
- **Exceptions:
- ** ArgumentException if culture is invalid.
- ============================================================================*/
- // People really shouldn't be calling LCID versions, no custom support
- public static CompareInfo GetCompareInfo(int culture)
- {
- if (CultureData.IsCustomCultureId(culture))
- {
- // Customized culture cannot be created by the LCID.
- throw new ArgumentException(SR.Argument_CustomCultureCannotBePassedByNumber, nameof(culture));
- }
-
- return CultureInfo.GetCultureInfo(culture).CompareInfo;
- }
-
- /*=================================GetCompareInfo==========================
- **Action: Get the CompareInfo for the specified culture.
- **Returns: The CompareInfo for the specified culture.
- **Arguments:
- ** name the name of the culture.
- **Exceptions:
- ** ArgumentException if name is invalid.
- ============================================================================*/
-
- public static CompareInfo GetCompareInfo(String name)
- {
- if (name == null)
- {
- throw new ArgumentNullException(nameof(name));
- }
- Contract.EndContractBlock();
-
- return CultureInfo.GetCultureInfo(name).CompareInfo;
- }
-
- public static unsafe bool IsSortable(char ch)
- {
- char *pChar = &ch;
- return IsSortable(pChar, 1);
- }
-
- public static unsafe bool IsSortable(string text)
- {
- if (text == null)
- {
- // A null param is invalid here.
- throw new ArgumentNullException(nameof(text));
- }
-
- if (0 == text.Length)
- {
- // A zero length string is not invalid, but it is also not sortable.
- return (false);
- }
-
- fixed (char *pChar = text)
- {
- return IsSortable(pChar, text.Length);
- }
- }
-
-
- [OnDeserializing]
- private void OnDeserializing(StreamingContext ctx)
- {
- _name = null;
- }
-
- void IDeserializationCallback.OnDeserialization(Object sender)
- {
- OnDeserialized();
- }
-
- [OnDeserialized]
- private void OnDeserialized(StreamingContext ctx)
- {
- OnDeserialized();
- }
-
- private void OnDeserialized()
- {
- if (_name != null)
- {
- InitSort(CultureInfo.GetCultureInfo(_name));
- }
- }
-
- [OnSerializing]
- private void OnSerializing(StreamingContext ctx) { }
-
- ///////////////////////////----- Name -----/////////////////////////////////
- //
- // Returns the name of the culture (well actually, of the sort).
- // Very important for providing a non-LCID way of identifying
- // what the sort is.
- //
- // Note that this name isn't dereferenced in case the CompareInfo is a different locale
- // which is consistent with the behaviors of earlier versions. (so if you ask for a sort
- // and the locale's changed behavior, then you'll get changed behavior, which is like
- // what happens for a version update)
- //
- ////////////////////////////////////////////////////////////////////////
-
- public virtual String Name
- {
- get
- {
- Debug.Assert(_name != null, "CompareInfo.Name Expected _name to be set");
- if (_name == "zh-CHT" || _name == "zh-CHS")
- {
- return _name;
- }
-
- return _sortName;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Compare
- //
- // Compares the two strings with the given options. Returns 0 if the
- // two strings are equal, a number less than 0 if string1 is less
- // than string2, and a number greater than 0 if string1 is greater
- // than string2.
- //
- ////////////////////////////////////////////////////////////////////////
-
- public virtual int Compare(String string1, String string2)
- {
- return (Compare(string1, string2, CompareOptions.None));
- }
-
- public unsafe virtual int Compare(String string1, String string2, CompareOptions options)
- {
- if (options == CompareOptions.OrdinalIgnoreCase)
- {
- return String.Compare(string1, string2, StringComparison.OrdinalIgnoreCase);
- }
-
- // Verify the options before we do any real comparison.
- if ((options & CompareOptions.Ordinal) != 0)
- {
- if (options != CompareOptions.Ordinal)
- {
- throw new ArgumentException(SR.Argument_CompareOptionOrdinal, nameof(options));
- }
- return String.CompareOrdinal(string1, string2);
- }
-
- if ((options & ValidCompareMaskOffFlags) != 0)
- {
- throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
- }
-
- //Our paradigm is that null sorts less than any other string and
- //that two nulls sort as equal.
- if (string1 == null)
- {
- if (string2 == null)
- {
- return (0); // Equal
- }
- return (-1); // null < non-null
- }
- if (string2 == null)
- {
- return (1); // non-null > null
- }
-
- return CompareString(string1, 0, string1.Length, string2, 0, string2.Length, options);
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Compare
- //
- // Compares the specified regions of the two strings with the given
- // options.
- // Returns 0 if the two strings are equal, a number less than 0 if
- // string1 is less than string2, and a number greater than 0 if
- // string1 is greater than string2.
- //
- ////////////////////////////////////////////////////////////////////////
-
-
- public unsafe virtual int Compare(String string1, int offset1, int length1, String string2, int offset2, int length2)
- {
- return Compare(string1, offset1, length1, string2, offset2, length2, 0);
- }
-
-
- public unsafe virtual int Compare(String string1, int offset1, String string2, int offset2, CompareOptions options)
- {
- return Compare(string1, offset1, string1 == null ? 0 : string1.Length - offset1,
- string2, offset2, string2 == null ? 0 : string2.Length - offset2, options);
- }
-
-
- public unsafe virtual int Compare(String string1, int offset1, String string2, int offset2)
- {
- return Compare(string1, offset1, string2, offset2, 0);
- }
-
-
- public unsafe virtual int Compare(String string1, int offset1, int length1, String string2, int offset2, int length2, CompareOptions options)
- {
- if (options == CompareOptions.OrdinalIgnoreCase)
- {
- int result = String.Compare(string1, offset1, string2, offset2, length1 < length2 ? length1 : length2, StringComparison.OrdinalIgnoreCase);
- if ((length1 != length2) && result == 0)
- return (length1 > length2 ? 1 : -1);
- return (result);
- }
-
- // Verify inputs
- if (length1 < 0 || length2 < 0)
- {
- throw new ArgumentOutOfRangeException((length1 < 0) ? nameof(length1) : nameof(length2), SR.ArgumentOutOfRange_NeedPosNum);
- }
- if (offset1 < 0 || offset2 < 0)
- {
- throw new ArgumentOutOfRangeException((offset1 < 0) ? nameof(offset1) : nameof(offset2), SR.ArgumentOutOfRange_NeedPosNum);
- }
- if (offset1 > (string1 == null ? 0 : string1.Length) - length1)
- {
- throw new ArgumentOutOfRangeException(nameof(string1), SR.ArgumentOutOfRange_OffsetLength);
- }
- if (offset2 > (string2 == null ? 0 : string2.Length) - length2)
- {
- throw new ArgumentOutOfRangeException(nameof(string2), SR.ArgumentOutOfRange_OffsetLength);
- }
- if ((options & CompareOptions.Ordinal) != 0)
- {
- if (options != CompareOptions.Ordinal)
- {
- throw new ArgumentException(SR.Argument_CompareOptionOrdinal,
- nameof(options));
- }
- }
- else if ((options & ValidCompareMaskOffFlags) != 0)
- {
- throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
- }
-
- //
- // Check for the null case.
- //
- if (string1 == null)
- {
- if (string2 == null)
- {
- return (0);
- }
- return (-1);
- }
- if (string2 == null)
- {
- return (1);
- }
-
- if (options == CompareOptions.Ordinal)
- {
- return CompareOrdinal(string1, offset1, length1,
- string2, offset2, length2);
- }
- return CompareString(string1, offset1, length1,
- string2, offset2, length2,
- options);
- }
-
- private static int CompareOrdinal(string string1, int offset1, int length1, string string2, int offset2, int length2)
- {
- int result = String.CompareOrdinal(string1, offset1, string2, offset2,
- (length1 < length2 ? length1 : length2));
- if ((length1 != length2) && result == 0)
- {
- return (length1 > length2 ? 1 : -1);
- }
- return (result);
- }
-
- //
- // CompareOrdinalIgnoreCase compare two string oridnally with ignoring the case.
- // it assumes the strings are Ascii string till we hit non Ascii character in strA or strB and then we continue the comparison by
- // calling the OS.
- //
- internal static unsafe int CompareOrdinalIgnoreCase(string strA, int indexA, int lengthA, string strB, int indexB, int lengthB)
- {
- Debug.Assert(indexA + lengthA <= strA.Length);
- Debug.Assert(indexB + lengthB <= strB.Length);
-
- int length = Math.Min(lengthA, lengthB);
- int range = length;
-
- fixed (char* ap = strA) fixed (char* bp = strB)
- {
- char* a = ap + indexA;
- char* b = bp + indexB;
-
- while (length != 0 && (*a <= 0x80) && (*b <= 0x80))
- {
- int charA = *a;
- int charB = *b;
-
- if (charA == charB)
- {
- a++; b++;
- length--;
- continue;
- }
-
- // uppercase both chars - notice that we need just one compare per char
- if ((uint)(charA - 'a') <= (uint)('z' - 'a')) charA -= 0x20;
- if ((uint)(charB - 'a') <= (uint)('z' - 'a')) charB -= 0x20;
-
- //Return the (case-insensitive) difference between them.
- if (charA != charB)
- return charA - charB;
-
- // Next char
- a++; b++;
- length--;
- }
-
- if (length == 0)
- return lengthA - lengthB;
-
- range -= length;
-
- return CompareStringOrdinalIgnoreCase(a, lengthA - range, b, lengthB - range);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // IsPrefix
- //
- // Determines whether prefix is a prefix of string. If prefix equals
- // String.Empty, true is returned.
- //
- ////////////////////////////////////////////////////////////////////////
- public unsafe virtual bool IsPrefix(String source, String prefix, CompareOptions options)
- {
- if (source == null || prefix == null)
- {
- throw new ArgumentNullException((source == null ? nameof(source) : nameof(prefix)),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
-
- if (prefix.Length == 0)
- {
- return (true);
- }
-
- if (source.Length == 0)
- {
- return false;
- }
-
- if (options == CompareOptions.OrdinalIgnoreCase)
- {
- return source.StartsWith(prefix, StringComparison.OrdinalIgnoreCase);
- }
-
- if (options == CompareOptions.Ordinal)
- {
- return source.StartsWith(prefix, StringComparison.Ordinal);
- }
-
- if ((options & ValidIndexMaskOffFlags) != 0)
- {
- throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
- }
-
- return StartsWith(source, prefix, options);
- }
-
- public virtual bool IsPrefix(String source, String prefix)
- {
- return (IsPrefix(source, prefix, 0));
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // IsSuffix
- //
- // Determines whether suffix is a suffix of string. If suffix equals
- // String.Empty, true is returned.
- //
- ////////////////////////////////////////////////////////////////////////
- public unsafe virtual bool IsSuffix(String source, String suffix, CompareOptions options)
- {
- if (source == null || suffix == null)
- {
- throw new ArgumentNullException((source == null ? nameof(source) : nameof(suffix)),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
-
- if (suffix.Length == 0)
- {
- return (true);
- }
-
- if (source.Length == 0)
- {
- return false;
- }
-
- if (options == CompareOptions.OrdinalIgnoreCase)
- {
- return source.EndsWith(suffix, StringComparison.OrdinalIgnoreCase);
- }
-
- if (options == CompareOptions.Ordinal)
- {
- return source.EndsWith(suffix, StringComparison.Ordinal);
- }
-
- if ((options & ValidIndexMaskOffFlags) != 0)
- {
- throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
- }
-
- return EndsWith(source, suffix, options);
- }
-
-
- public virtual bool IsSuffix(String source, String suffix)
- {
- return (IsSuffix(source, suffix, 0));
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // IndexOf
- //
- // Returns the first index where value is found in string. The
- // search starts from startIndex and ends at endIndex. Returns -1 if
- // the specified value is not found. If value equals String.Empty,
- // startIndex is returned. Throws IndexOutOfRange if startIndex or
- // endIndex is less than zero or greater than the length of string.
- // Throws ArgumentException if value is null.
- //
- ////////////////////////////////////////////////////////////////////////
-
-
- public unsafe virtual int IndexOf(String source, char value)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- return IndexOf(source, value, 0, source.Length, CompareOptions.None);
- }
-
-
- public unsafe virtual int IndexOf(String source, String value)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- return IndexOf(source, value, 0, source.Length, CompareOptions.None);
- }
-
-
- public unsafe virtual int IndexOf(String source, char value, CompareOptions options)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- return IndexOf(source, value, 0, source.Length, options);
- }
-
-
- public unsafe virtual int IndexOf(String source, String value, CompareOptions options)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- return IndexOf(source, value, 0, source.Length, options);
- }
-
- public unsafe virtual int IndexOf(String source, char value, int startIndex)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- return IndexOf(source, value, startIndex, source.Length - startIndex, CompareOptions.None);
- }
-
- public unsafe virtual int IndexOf(String source, String value, int startIndex)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- return IndexOf(source, value, startIndex, source.Length - startIndex, CompareOptions.None);
- }
-
- public unsafe virtual int IndexOf(String source, char value, int startIndex, CompareOptions options)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- return IndexOf(source, value, startIndex, source.Length - startIndex, options);
- }
-
-
- public unsafe virtual int IndexOf(String source, String value, int startIndex, CompareOptions options)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- return IndexOf(source, value, startIndex, source.Length - startIndex, options);
- }
-
-
- public unsafe virtual int IndexOf(String source, char value, int startIndex, int count)
- {
- return IndexOf(source, value, startIndex, count, CompareOptions.None);
- }
-
-
- public unsafe virtual int IndexOf(String source, String value, int startIndex, int count)
- {
- return IndexOf(source, value, startIndex, count, CompareOptions.None);
- }
-
- public unsafe virtual int IndexOf(String source, char value, int startIndex, int count, CompareOptions options)
- {
- // Validate inputs
- if (source == null)
- throw new ArgumentNullException(nameof(source));
-
- if (startIndex < 0 || startIndex > source.Length)
- throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
-
- if (count < 0 || startIndex > source.Length - count)
- throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
- Contract.EndContractBlock();
-
- if (options == CompareOptions.OrdinalIgnoreCase)
- {
- return source.IndexOf(value.ToString(), startIndex, count, StringComparison.OrdinalIgnoreCase);
- }
-
- // Validate CompareOptions
- // Ordinal can't be selected with other flags
- if ((options & ValidIndexMaskOffFlags) != 0 && (options != CompareOptions.Ordinal))
- throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
-
- return IndexOfCore(source, new string(value, 1), startIndex, count, options);
- }
-
-
- public unsafe virtual int IndexOf(String source, String value, int startIndex, int count, CompareOptions options)
- {
- // Validate inputs
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (value == null)
- throw new ArgumentNullException(nameof(value));
-
- if (startIndex > source.Length)
- {
- throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
- }
- Contract.EndContractBlock();
-
- // In Everett we used to return -1 for empty string even if startIndex is negative number so we keeping same behavior here.
- // We return 0 if both source and value are empty strings for Everett compatibility too.
- if (source.Length == 0)
- {
- if (value.Length == 0)
- {
- return 0;
- }
- return -1;
- }
-
- if (startIndex < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
- }
-
- if (count < 0 || startIndex > source.Length - count)
- throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
-
- if (options == CompareOptions.OrdinalIgnoreCase)
- {
- return IndexOfOrdinal(source, value, startIndex, count, ignoreCase: true);
- }
-
- // Validate CompareOptions
- // Ordinal can't be selected with other flags
- if ((options & ValidIndexMaskOffFlags) != 0 && (options != CompareOptions.Ordinal))
- throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
-
- return IndexOfCore(source, value, startIndex, count, options);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // LastIndexOf
- //
- // Returns the last index where value is found in string. The
- // search starts from startIndex and ends at endIndex. Returns -1 if
- // the specified value is not found. If value equals String.Empty,
- // endIndex is returned. Throws IndexOutOfRange if startIndex or
- // endIndex is less than zero or greater than the length of string.
- // Throws ArgumentException if value is null.
- //
- ////////////////////////////////////////////////////////////////////////
-
-
- public unsafe virtual int LastIndexOf(String source, char value)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- // Can't start at negative index, so make sure we check for the length == 0 case.
- return LastIndexOf(source, value, source.Length - 1,
- source.Length, CompareOptions.None);
- }
-
-
- public virtual int LastIndexOf(String source, String value)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- // Can't start at negative index, so make sure we check for the length == 0 case.
- return LastIndexOf(source, value, source.Length - 1,
- source.Length, CompareOptions.None);
- }
-
-
- public virtual int LastIndexOf(String source, char value, CompareOptions options)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- // Can't start at negative index, so make sure we check for the length == 0 case.
- return LastIndexOf(source, value, source.Length - 1,
- source.Length, options);
- }
-
- public unsafe virtual int LastIndexOf(String source, String value, CompareOptions options)
- {
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- // Can't start at negative index, so make sure we check for the length == 0 case.
- return LastIndexOf(source, value, source.Length - 1,
- source.Length, options);
- }
-
- public unsafe virtual int LastIndexOf(String source, char value, int startIndex)
- {
- return LastIndexOf(source, value, startIndex, startIndex + 1, CompareOptions.None);
- }
-
-
- public unsafe virtual int LastIndexOf(String source, String value, int startIndex)
- {
- return LastIndexOf(source, value, startIndex, startIndex + 1, CompareOptions.None);
- }
-
- public unsafe virtual int LastIndexOf(String source, char value, int startIndex, CompareOptions options)
- {
- return LastIndexOf(source, value, startIndex, startIndex + 1, options);
- }
-
-
- public unsafe virtual int LastIndexOf(String source, String value, int startIndex, CompareOptions options)
- {
- return LastIndexOf(source, value, startIndex, startIndex + 1, options);
- }
-
-
- public unsafe virtual int LastIndexOf(String source, char value, int startIndex, int count)
- {
- return LastIndexOf(source, value, startIndex, count, CompareOptions.None);
- }
-
-
- public unsafe virtual int LastIndexOf(String source, String value, int startIndex, int count)
- {
- return LastIndexOf(source, value, startIndex, count, CompareOptions.None);
- }
-
-
- public unsafe virtual int LastIndexOf(String source, char value, int startIndex, int count, CompareOptions options)
- {
- // Verify Arguments
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- Contract.EndContractBlock();
-
- // Validate CompareOptions
- // Ordinal can't be selected with other flags
- if ((options & ValidIndexMaskOffFlags) != 0 &&
- (options != CompareOptions.Ordinal) &&
- (options != CompareOptions.OrdinalIgnoreCase))
- throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
-
- // Special case for 0 length input strings
- if (source.Length == 0 && (startIndex == -1 || startIndex == 0))
- return -1;
-
- // Make sure we're not out of range
- if (startIndex < 0 || startIndex > source.Length)
- throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
-
- // Make sure that we allow startIndex == source.Length
- if (startIndex == source.Length)
- {
- startIndex--;
- if (count > 0)
- count--;
- }
-
- // 2nd have of this also catches when startIndex == MAXINT, so MAXINT - 0 + 1 == -1, which is < 0.
- if (count < 0 || startIndex - count + 1 < 0)
- throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
-
- if (options == CompareOptions.OrdinalIgnoreCase)
- {
- return source.LastIndexOf(value.ToString(), startIndex, count, StringComparison.OrdinalIgnoreCase);
- }
-
- return LastIndexOfCore(source, value.ToString(), startIndex, count, options);
- }
-
-
- public unsafe virtual int LastIndexOf(String source, String value, int startIndex, int count, CompareOptions options)
- {
- // Verify Arguments
- if (source == null)
- throw new ArgumentNullException(nameof(source));
- if (value == null)
- throw new ArgumentNullException(nameof(value));
- Contract.EndContractBlock();
-
- // Validate CompareOptions
- // Ordinal can't be selected with other flags
- if ((options & ValidIndexMaskOffFlags) != 0 &&
- (options != CompareOptions.Ordinal) &&
- (options != CompareOptions.OrdinalIgnoreCase))
- throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
-
- // Special case for 0 length input strings
- if (source.Length == 0 && (startIndex == -1 || startIndex == 0))
- return (value.Length == 0) ? 0 : -1;
-
- // Make sure we're not out of range
- if (startIndex < 0 || startIndex > source.Length)
- throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
-
- // Make sure that we allow startIndex == source.Length
- if (startIndex == source.Length)
- {
- startIndex--;
- if (count > 0)
- count--;
-
- // If we are looking for nothing, just return 0
- if (value.Length == 0 && count >= 0 && startIndex - count + 1 >= 0)
- return startIndex;
- }
-
- // 2nd half of this also catches when startIndex == MAXINT, so MAXINT - 0 + 1 == -1, which is < 0.
- if (count < 0 || startIndex - count + 1 < 0)
- throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
-
- if (options == CompareOptions.OrdinalIgnoreCase)
- {
- return LastIndexOfOrdinal(source, value, startIndex, count, ignoreCase: true);
- }
-
- return LastIndexOfCore(source, value, startIndex, count, options);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetSortKey
- //
- // Gets the SortKey for the given string with the given options.
- //
- ////////////////////////////////////////////////////////////////////////
- public unsafe virtual SortKey GetSortKey(String source, CompareOptions options)
- {
- return CreateSortKey(source, options);
- }
-
-
- public unsafe virtual SortKey GetSortKey(String source)
- {
- return CreateSortKey(source, CompareOptions.None);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Equals
- //
- // Implements Object.Equals(). Returns a boolean indicating whether
- // or not object refers to the same CompareInfo as the current
- // instance.
- //
- ////////////////////////////////////////////////////////////////////////
-
-
- public override bool Equals(Object value)
- {
- CompareInfo that = value as CompareInfo;
-
- if (that != null)
- {
- return this.Name == that.Name;
- }
-
- return (false);
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetHashCode
- //
- // Implements Object.GetHashCode(). Returns the hash code for the
- // CompareInfo. The hash code is guaranteed to be the same for
- // CompareInfo A and B where A.Equals(B) is true.
- //
- ////////////////////////////////////////////////////////////////////////
-
-
- public override int GetHashCode()
- {
- return (this.Name.GetHashCode());
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetHashCodeOfString
- //
- // This internal method allows a method that allows the equivalent of creating a Sortkey for a
- // string from CompareInfo, and generate a hashcode value from it. It is not very convenient
- // to use this method as is and it creates an unnecessary Sortkey object that will be GC'ed.
- //
- // The hash code is guaranteed to be the same for string A and B where A.Equals(B) is true and both
- // the CompareInfo and the CompareOptions are the same. If two different CompareInfo objects
- // treat the string the same way, this implementation will treat them differently (the same way that
- // Sortkey does at the moment).
- //
- // This method will never be made public itself, but public consumers of it could be created, e.g.:
- //
- // string.GetHashCode(CultureInfo)
- // string.GetHashCode(CompareInfo)
- // string.GetHashCode(CultureInfo, CompareOptions)
- // string.GetHashCode(CompareInfo, CompareOptions)
- // etc.
- //
- // (the methods above that take a CultureInfo would use CultureInfo.CompareInfo)
- //
- ////////////////////////////////////////////////////////////////////////
- internal int GetHashCodeOfString(string source, CompareOptions options)
- {
- //
- // Parameter validation
- //
- if (null == source)
- {
- throw new ArgumentNullException(nameof(source));
- }
-
- if ((options & ValidHashCodeOfStringMaskOffFlags) != 0)
- {
- throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
- }
- Contract.EndContractBlock();
-
- return GetHashCodeOfStringCore(source, options);
- }
-
- public virtual int GetHashCode(string source, CompareOptions options)
- {
- if (source == null)
- {
- throw new ArgumentNullException(nameof(source));
- }
-
- if (options == CompareOptions.Ordinal)
- {
- return source.GetHashCode();
- }
-
- if (options == CompareOptions.OrdinalIgnoreCase)
- {
- return TextInfo.GetHashCodeOrdinalIgnoreCase(source);
- }
-
- //
- // GetHashCodeOfString does more parameters validation. basically will throw when
- // having Ordinal, OrdinalIgnoreCase and StringSort
- //
-
- return GetHashCodeOfString(source, options);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ToString
- //
- // Implements Object.ToString(). Returns a string describing the
- // CompareInfo.
- //
- ////////////////////////////////////////////////////////////////////////
- public override String ToString()
- {
- return ("CompareInfo - " + this.Name);
- }
-
- public SortVersion Version
- {
- get
- {
- if (_sortVersion == null)
- {
- _sortVersion = GetSortVersion();
- }
-
- return _sortVersion;
- }
- }
-
- public int LCID
- {
- get
- {
- return CultureInfo.GetCultureInfo(Name).LCID;
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CultureData.Unix.cs b/src/mscorlib/corefx/System/Globalization/CultureData.Unix.cs
deleted file mode 100644
index ba96189458..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CultureData.Unix.cs
+++ /dev/null
@@ -1,419 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-using System.Runtime.InteropServices;
-using System.Security;
-using System.Text;
-
-namespace System.Globalization
-{
- internal partial class CultureData
- {
- // ICU constants
- const int ICU_ULOC_KEYWORD_AND_VALUES_CAPACITY = 100; // max size of keyword or value
- const int ICU_ULOC_FULLNAME_CAPACITY = 157; // max size of locale name
- const string ICU_COLLATION_KEYWORD = "@collation=";
-
-
- /// <summary>
- /// This method uses the sRealName field (which is initialized by the constructor before this is called) to
- /// initialize the rest of the state of CultureData based on the underlying OS globalization library.
- /// </summary>
- private unsafe bool InitCultureData()
- {
- Debug.Assert(_sRealName != null);
-
- string alternateSortName = string.Empty;
- string realNameBuffer = _sRealName;
-
- // Basic validation
- if (realNameBuffer.Contains("@"))
- {
- return false; // don't allow ICU variants to come in directly
- }
-
- // Replace _ (alternate sort) with @collation= for ICU
- int index = realNameBuffer.IndexOf('_');
- if (index > 0)
- {
- if (index >= (realNameBuffer.Length - 1) // must have characters after _
- || realNameBuffer.Substring(index + 1).Contains("_")) // only one _ allowed
- {
- return false; // fail
- }
- alternateSortName = realNameBuffer.Substring(index + 1);
- realNameBuffer = realNameBuffer.Substring(0, index) + ICU_COLLATION_KEYWORD + alternateSortName;
- }
-
- // Get the locale name from ICU
- if (!GetLocaleName(realNameBuffer, out _sWindowsName))
- {
- return false; // fail
- }
-
- // Replace the ICU collation keyword with an _
- index = _sWindowsName.IndexOf(ICU_COLLATION_KEYWORD, StringComparison.Ordinal);
- if (index >= 0)
- {
- _sName = _sWindowsName.Substring(0, index) + "_" + alternateSortName;
- }
- else
- {
- _sName = _sWindowsName;
- }
- _sRealName = _sName;
-
- _iLanguage = this.ILANGUAGE;
- if (_iLanguage == 0)
- {
- _iLanguage = CultureInfo.LOCALE_CUSTOM_UNSPECIFIED;
- }
-
- _bNeutral = (this.SISO3166CTRYNAME.Length == 0);
-
- _sSpecificCulture = _bNeutral ? LocaleData.GetSpecificCultureName(_sRealName) : _sRealName;
-
- // Remove the sort from sName unless custom culture
- if (index>0 && !_bNeutral && !IsCustomCultureId(_iLanguage))
- {
- _sName = _sWindowsName.Substring(0, index);
- }
- return true;
- }
-
- internal static bool GetLocaleName(string localeName, out string windowsName)
- {
- // Get the locale name from ICU
- StringBuilder sb = StringBuilderCache.Acquire(ICU_ULOC_FULLNAME_CAPACITY);
- if (!Interop.GlobalizationInterop.GetLocaleName(localeName, sb, sb.Capacity))
- {
- StringBuilderCache.Release(sb);
- windowsName = null;
- return false; // fail
- }
-
- // Success - use the locale name returned which may be different than realNameBuffer (casing)
- windowsName = StringBuilderCache.GetStringAndRelease(sb); // the name passed to subsequent ICU calls
- return true;
- }
-
- internal static bool GetDefaultLocaleName(out string windowsName)
- {
- // Get the default (system) locale name from ICU
- StringBuilder sb = StringBuilderCache.Acquire(ICU_ULOC_FULLNAME_CAPACITY);
- if (!Interop.GlobalizationInterop.GetDefaultLocaleName(sb, sb.Capacity))
- {
- StringBuilderCache.Release(sb);
- windowsName = null;
- return false; // fail
- }
-
- // Success - use the locale name returned which may be different than realNameBuffer (casing)
- windowsName = StringBuilderCache.GetStringAndRelease(sb); // the name passed to subsequent ICU calls
- return true;
- }
-
- private string GetLocaleInfo(LocaleStringData type)
- {
- Debug.Assert(_sWindowsName != null, "[CultureData.GetLocaleInfo] Expected _sWindowsName to be populated already");
- return GetLocaleInfo(_sWindowsName, type);
- }
-
- // For LOCALE_SPARENT we need the option of using the "real" name (forcing neutral names) instead of the
- // "windows" name, which can be specific for downlevel (< windows 7) os's.
- private string GetLocaleInfo(string localeName, LocaleStringData type)
- {
- Debug.Assert(localeName != null, "[CultureData.GetLocaleInfo] Expected localeName to be not be null");
-
- switch (type)
- {
- case LocaleStringData.NegativeInfinitySymbol:
- // not an equivalent in ICU; prefix the PositiveInfinitySymbol with NegativeSign
- return GetLocaleInfo(localeName, LocaleStringData.NegativeSign) +
- GetLocaleInfo(localeName, LocaleStringData.PositiveInfinitySymbol);
- }
-
- StringBuilder sb = StringBuilderCache.Acquire(ICU_ULOC_KEYWORD_AND_VALUES_CAPACITY);
-
- bool result = Interop.GlobalizationInterop.GetLocaleInfoString(localeName, (uint)type, sb, sb.Capacity);
- if (!result)
- {
- // Failed, just use empty string
- StringBuilderCache.Release(sb);
- Debug.Assert(false, "[CultureData.GetLocaleInfo(LocaleStringData)] Failed");
- return String.Empty;
- }
- return StringBuilderCache.GetStringAndRelease(sb);
- }
-
- private int GetLocaleInfo(LocaleNumberData type)
- {
- Debug.Assert(_sWindowsName != null, "[CultureData.GetLocaleInfo(LocaleNumberData)] Expected _sWindowsName to be populated already");
-
- switch (type)
- {
- case LocaleNumberData.CalendarType:
- // returning 0 will cause the first supported calendar to be returned, which is the preferred calendar
- return 0;
- }
-
-
- int value = 0;
- bool result = Interop.GlobalizationInterop.GetLocaleInfoInt(_sWindowsName, (uint)type, ref value);
- if (!result)
- {
- // Failed, just use 0
- Debug.Assert(false, "[CultureData.GetLocaleInfo(LocaleNumberData)] failed");
- }
-
- return value;
- }
-
- private int[] GetLocaleInfo(LocaleGroupingData type)
- {
- Debug.Assert(_sWindowsName != null, "[CultureData.GetLocaleInfo(LocaleGroupingData)] Expected _sWindowsName to be populated already");
-
- int primaryGroupingSize = 0;
- int secondaryGroupingSize = 0;
- bool result = Interop.GlobalizationInterop.GetLocaleInfoGroupingSizes(_sWindowsName, (uint)type, ref primaryGroupingSize, ref secondaryGroupingSize);
- if (!result)
- {
- Debug.Assert(false, "[CultureData.GetLocaleInfo(LocaleGroupingData type)] failed");
- }
-
- if (secondaryGroupingSize == 0)
- {
- return new int[] { primaryGroupingSize };
- }
-
- return new int[] { primaryGroupingSize, secondaryGroupingSize };
- }
-
- private string GetTimeFormatString()
- {
- return GetTimeFormatString(false);
- }
-
- private string GetTimeFormatString(bool shortFormat)
- {
- Debug.Assert(_sWindowsName != null, "[CultureData.GetTimeFormatString(bool shortFormat)] Expected _sWindowsName to be populated already");
-
- StringBuilder sb = StringBuilderCache.Acquire(ICU_ULOC_KEYWORD_AND_VALUES_CAPACITY);
-
- bool result = Interop.GlobalizationInterop.GetLocaleTimeFormat(_sWindowsName, shortFormat, sb, sb.Capacity);
- if (!result)
- {
- // Failed, just use empty string
- StringBuilderCache.Release(sb);
- Debug.Assert(false, "[CultureData.GetTimeFormatString(bool shortFormat)] Failed");
- return String.Empty;
- }
-
- return ConvertIcuTimeFormatString(StringBuilderCache.GetStringAndRelease(sb));
- }
-
- private int GetFirstDayOfWeek()
- {
- return this.GetLocaleInfo(LocaleNumberData.FirstDayOfWeek);
- }
-
- private String[] GetTimeFormats()
- {
- string format = GetTimeFormatString(false);
- return new string[] { format };
- }
-
- private String[] GetShortTimeFormats()
- {
- string format = GetTimeFormatString(true);
- return new string[] { format };
- }
-
- private static CultureData GetCultureDataFromRegionName(String regionName)
- {
- // no support to lookup by region name, other than the hard-coded list in CultureData
- return null;
- }
-
- private static string GetLanguageDisplayName(string cultureName)
- {
- return new CultureInfo(cultureName).m_cultureData.GetLocaleInfo(cultureName, LocaleStringData.LocalizedDisplayName);
- }
-
- private static string GetRegionDisplayName(string isoCountryCode)
- {
- // use the fallback which is to return NativeName
- return null;
- }
-
- private static CultureInfo GetUserDefaultCulture()
- {
- return CultureInfo.GetUserDefaultCulture();
- }
-
- private static string ConvertIcuTimeFormatString(string icuFormatString)
- {
- StringBuilder sb = StringBuilderCache.Acquire(ICU_ULOC_FULLNAME_CAPACITY);
- bool amPmAdded = false;
-
- for (int i = 0; i < icuFormatString.Length; i++)
- {
- switch(icuFormatString[i])
- {
- case ':':
- case '.':
- case 'H':
- case 'h':
- case 'm':
- case 's':
- sb.Append(icuFormatString[i]);
- break;
-
- case ' ':
- case '\u00A0':
- // Convert nonbreaking spaces into regular spaces
- sb.Append(' ');
- break;
-
- case 'a': // AM/PM
- if (!amPmAdded)
- {
- amPmAdded = true;
- sb.Append("tt");
- }
- break;
-
- }
- }
-
- return StringBuilderCache.GetStringAndRelease(sb);
- }
-
- private static string LCIDToLocaleName(int culture)
- {
- return LocaleData.LCIDToLocaleName(culture);
- }
-
- private static int LocaleNameToLCID(string cultureName)
- {
- int lcid = LocaleData.GetLocaleDataNumericPart(cultureName, LocaleDataParts.Lcid);
- return lcid == -1 ? CultureInfo.LOCALE_CUSTOM_UNSPECIFIED : lcid;
- }
-
- private static int GetAnsiCodePage(string cultureName)
- {
- int ansiCodePage = LocaleData.GetLocaleDataNumericPart(cultureName, LocaleDataParts.AnsiCodePage);
- return ansiCodePage == -1 ? CultureData.Invariant.IDEFAULTANSICODEPAGE : ansiCodePage;
- }
-
- private static int GetOemCodePage(string cultureName)
- {
- int oemCodePage = LocaleData.GetLocaleDataNumericPart(cultureName, LocaleDataParts.OemCodePage);
- return oemCodePage == -1 ? CultureData.Invariant.IDEFAULTOEMCODEPAGE : oemCodePage;
- }
-
- private static int GetMacCodePage(string cultureName)
- {
- int macCodePage = LocaleData.GetLocaleDataNumericPart(cultureName, LocaleDataParts.MacCodePage);
- return macCodePage == -1 ? CultureData.Invariant.IDEFAULTMACCODEPAGE : macCodePage;
- }
-
- private static int GetEbcdicCodePage(string cultureName)
- {
- int ebcdicCodePage = LocaleData.GetLocaleDataNumericPart(cultureName, LocaleDataParts.EbcdicCodePage);
- return ebcdicCodePage == -1 ? CultureData.Invariant.IDEFAULTEBCDICCODEPAGE : ebcdicCodePage;
- }
-
- private static int GetGeoId(string cultureName)
- {
- int geoId = LocaleData.GetLocaleDataNumericPart(cultureName, LocaleDataParts.GeoId);
- return geoId == -1 ? CultureData.Invariant.IGEOID : geoId;
- }
-
- private static int GetDigitSubstitution(string cultureName)
- {
- int digitSubstitution = LocaleData.GetLocaleDataNumericPart(cultureName, LocaleDataParts.DigitSubstitution);
- return digitSubstitution == -1 ? (int) DigitShapes.None : digitSubstitution;
- }
-
- private static string GetThreeLetterWindowsLanguageName(string cultureName)
- {
- string langName = LocaleData.GetThreeLetterWindowsLangageName(cultureName);
- return langName == null ? "ZZZ" /* default lang name */ : langName;
- }
-
- private static CultureInfo[] EnumCultures(CultureTypes types)
- {
- if ((types & (CultureTypes.NeutralCultures | CultureTypes.SpecificCultures)) == 0)
- {
- return Array.Empty<CultureInfo>();
- }
-
- int bufferLength = Interop.GlobalizationInterop.GetLocales(null, 0);
- if (bufferLength <= 0)
- {
- return Array.Empty<CultureInfo>();
- }
-
- Char [] chars = new Char[bufferLength];
-
- bufferLength = Interop.GlobalizationInterop.GetLocales(chars, bufferLength);
- if (bufferLength <= 0)
- {
- return Array.Empty<CultureInfo>();
- }
-
- bool enumNeutrals = (types & CultureTypes.NeutralCultures) != 0;
- bool enumSpecificss = (types & CultureTypes.SpecificCultures) != 0;
-
- List<CultureInfo> list = new List<CultureInfo>();
- if (enumNeutrals)
- {
- list.Add(CultureInfo.InvariantCulture);
- }
-
- int index = 0;
- while (index < bufferLength)
- {
- int length = (int) chars[index++];
- if (index + length <= bufferLength)
- {
- CultureInfo ci = CultureInfo.GetCultureInfo(new String(chars, index, length));
- if ((enumNeutrals && ci.IsNeutralCulture) || (enumSpecificss && !ci.IsNeutralCulture))
- {
- list.Add(ci);
- }
- }
-
- index += length;
- }
-
- return list.ToArray();
- }
-
- private static string GetConsoleFallbackName(string cultureName)
- {
- return LocaleData.GetConsoleUICulture(cultureName);
- }
-
- internal bool IsFramework // not applicable on Linux based systems
- {
- get { return false; }
- }
-
- internal bool IsWin32Installed // not applicable on Linux based systems
- {
- get { return false; }
- }
-
- internal bool IsReplacementCulture // not applicable on Linux based systems
- {
- get { return false; }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CultureData.Windows.cs b/src/mscorlib/corefx/System/Globalization/CultureData.Windows.cs
deleted file mode 100644
index 0c264e5f8b..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CultureData.Windows.cs
+++ /dev/null
@@ -1,672 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using System.Text;
-
-#if ENABLE_WINRT
-using Internal.Runtime.Augments;
-#endif
-
-namespace System.Globalization
-{
- internal partial class CultureData
- {
- private const uint LOCALE_NOUSEROVERRIDE = 0x80000000;
- private const uint LOCALE_RETURN_NUMBER = 0x20000000;
- private const uint LOCALE_SISO3166CTRYNAME = 0x0000005A;
-
- private const uint TIME_NOSECONDS = 0x00000002;
-
- /// <summary>
- /// Check with the OS to see if this is a valid culture.
- /// If so we populate a limited number of fields. If its not valid we return false.
- ///
- /// The fields we populate:
- ///
- /// sWindowsName -- The name that windows thinks this culture is, ie:
- /// en-US if you pass in en-US
- /// de-DE_phoneb if you pass in de-DE_phoneb
- /// fj-FJ if you pass in fj (neutral, on a pre-Windows 7 machine)
- /// fj if you pass in fj (neutral, post-Windows 7 machine)
- ///
- /// sRealName -- The name you used to construct the culture, in pretty form
- /// en-US if you pass in EN-us
- /// en if you pass in en
- /// de-DE_phoneb if you pass in de-DE_phoneb
- ///
- /// sSpecificCulture -- The specific culture for this culture
- /// en-US for en-US
- /// en-US for en
- /// de-DE_phoneb for alt sort
- /// fj-FJ for fj (neutral)
- ///
- /// sName -- The IETF name of this culture (ie: no sort info, could be neutral)
- /// en-US if you pass in en-US
- /// en if you pass in en
- /// de-DE if you pass in de-DE_phoneb
- ///
- /// bNeutral -- TRUE if it is a neutral locale
- ///
- /// For a neutral we just populate the neutral name, but we leave the windows name pointing to the
- /// windows locale that's going to provide data for us.
- /// </summary>
- private unsafe bool InitCultureData()
- {
- const int LOCALE_NAME_MAX_LENGTH = 85;
-
- const uint LOCALE_ILANGUAGE = 0x00000001;
- const uint LOCALE_INEUTRAL = 0x00000071;
- const uint LOCALE_SNAME = 0x0000005c;
-
- int result;
- string realNameBuffer = _sRealName;
- char* pBuffer = stackalloc char[LOCALE_NAME_MAX_LENGTH];
-
- result = Interop.mincore.GetLocaleInfoEx(realNameBuffer, LOCALE_SNAME, pBuffer, LOCALE_NAME_MAX_LENGTH);
-
- // Did it fail?
- if (result == 0)
- {
- return false;
- }
-
- // It worked, note that the name is the locale name, so use that (even for neutrals)
- // We need to clean up our "real" name, which should look like the windows name right now
- // so overwrite the input with the cleaned up name
- _sRealName = new String(pBuffer, 0, result - 1);
- realNameBuffer = _sRealName;
-
- // Check for neutrality, don't expect to fail
- // (buffer has our name in it, so we don't have to do the gc. stuff)
-
- result = Interop.mincore.GetLocaleInfoEx(realNameBuffer, LOCALE_INEUTRAL | LOCALE_RETURN_NUMBER, pBuffer, sizeof(int) / sizeof(char));
- if (result == 0)
- {
- return false;
- }
-
- // Remember our neutrality
- _bNeutral = *((uint*)pBuffer) != 0;
-
- // Note: Parents will be set dynamically
-
- // Start by assuming the windows name'll be the same as the specific name since windows knows
- // about specifics on all versions. Only for downlevel Neutral locales does this have to change.
- _sWindowsName = realNameBuffer;
-
- // Neutrals and non-neutrals are slightly different
- if (_bNeutral)
- {
- // Neutral Locale
-
- // IETF name looks like neutral name
- _sName = realNameBuffer;
-
- // Specific locale name is whatever ResolveLocaleName (win7+) returns.
- // (Buffer has our name in it, and we can recycle that because windows resolves it before writing to the buffer)
- result = Interop.mincore.ResolveLocaleName(realNameBuffer, pBuffer, LOCALE_NAME_MAX_LENGTH);
-
- // 0 is failure, 1 is invariant (""), which we expect
- if (result < 1)
- {
- return false;
- }
- // We found a locale name, so use it.
- // In vista this should look like a sort name (de-DE_phoneb) or a specific culture (en-US) and be in the "pretty" form
- _sSpecificCulture = new String(pBuffer, 0, result - 1);
- }
- else
- {
- // Specific Locale
-
- // Specific culture's the same as the locale name since we know its not neutral
- // On mac we'll use this as well, even for neutrals. There's no obvious specific
- // culture to use and this isn't exposed, but behaviorally this is correct on mac.
- // Note that specifics include the sort name (de-DE_phoneb)
- _sSpecificCulture = realNameBuffer;
-
- _sName = realNameBuffer;
-
- // We need the IETF name (sname)
- // If we aren't an alt sort locale then this is the same as the windows name.
- // If we are an alt sort locale then this is the same as the part before the _ in the windows name
- // This is for like de-DE_phoneb and es-ES_tradnl that hsouldn't have the _ part
-
- result = Interop.mincore.GetLocaleInfoEx(realNameBuffer, LOCALE_ILANGUAGE | LOCALE_RETURN_NUMBER, pBuffer, sizeof(int) / sizeof(char));
- if (result == 0)
- {
- return false;
- }
-
- _iLanguage = *((int*)pBuffer);
-
- if (!IsCustomCultureId(_iLanguage))
- {
- // not custom locale
- int index = realNameBuffer.IndexOf('_');
- if (index > 0 && index < realNameBuffer.Length)
- {
- _sName = realNameBuffer.Substring(0, index);
- }
- }
- }
-
- // It succeeded.
- return true;
- }
-
- private string GetLocaleInfo(LocaleStringData type)
- {
- Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfo] Expected _sWindowsName to be populated by already");
- return GetLocaleInfo(_sWindowsName, type);
- }
-
- // For LOCALE_SPARENT we need the option of using the "real" name (forcing neutral names) instead of the
- // "windows" name, which can be specific for downlevel (< windows 7) os's.
- private string GetLocaleInfo(string localeName, LocaleStringData type)
- {
- uint lctype = (uint)type;
-
- return GetLocaleInfoFromLCType(localeName, lctype, UseUserOverride);
- }
-
- private int GetLocaleInfo(LocaleNumberData type)
- {
- uint lctype = (uint)type;
-
- // Fix lctype if we don't want overrides
- if (!UseUserOverride)
- {
- lctype |= LOCALE_NOUSEROVERRIDE;
- }
-
- // Ask OS for data, note that we presume it returns success, so we have to know that
- // sWindowsName is valid before calling.
- Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sWindowsName to be populated by already");
- int result = Interop.mincore.GetLocaleInfoExInt(_sWindowsName, lctype);
-
- return result;
- }
-
- private int[] GetLocaleInfo(LocaleGroupingData type)
- {
- return ConvertWin32GroupString(GetLocaleInfoFromLCType(_sWindowsName, (uint)type, UseUserOverride));
- }
-
- private string GetTimeFormatString()
- {
- const uint LOCALE_STIMEFORMAT = 0x00001003;
-
- return ReescapeWin32String(GetLocaleInfoFromLCType(_sWindowsName, LOCALE_STIMEFORMAT, UseUserOverride));
- }
-
- private int GetFirstDayOfWeek()
- {
- Debug.Assert(_sWindowsName != null, "[CultureData.DoGetLocaleInfoInt] Expected _sWindowsName to be populated by already");
-
- const uint LOCALE_IFIRSTDAYOFWEEK = 0x0000100C;
-
- int result = Interop.mincore.GetLocaleInfoExInt(_sWindowsName, LOCALE_IFIRSTDAYOFWEEK | (!UseUserOverride ? LOCALE_NOUSEROVERRIDE : 0));
-
- // Win32 and .NET disagree on the numbering for days of the week, so we have to convert.
- return ConvertFirstDayOfWeekMonToSun(result);
- }
-
- private String[] GetTimeFormats()
- {
- // Note that this gets overrides for us all the time
- Debug.Assert(_sWindowsName != null, "[CultureData.DoEnumTimeFormats] Expected _sWindowsName to be populated by already");
- String[] result = ReescapeWin32Strings(nativeEnumTimeFormats(_sWindowsName, 0, UseUserOverride));
-
- return result;
- }
-
- private String[] GetShortTimeFormats()
- {
- // Note that this gets overrides for us all the time
- Debug.Assert(_sWindowsName != null, "[CultureData.DoEnumShortTimeFormats] Expected _sWindowsName to be populated by already");
- String[] result = ReescapeWin32Strings(nativeEnumTimeFormats(_sWindowsName, TIME_NOSECONDS, UseUserOverride));
-
- return result;
- }
-
- // Enumerate all system cultures and then try to find out which culture has
- // region name match the requested region name
- private static CultureData GetCultureDataFromRegionName(String regionName)
- {
- Debug.Assert(regionName != null);
-
- const uint LOCALE_SUPPLEMENTAL = 0x00000002;
- const uint LOCALE_SPECIFICDATA = 0x00000020;
-
- EnumLocaleData context = new EnumLocaleData();
- context.cultureName = null;
- context.regionName = regionName;
-
- GCHandle contextHandle = GCHandle.Alloc(context);
- try
- {
- IntPtr callback = AddrofIntrinsics.AddrOf<Func<IntPtr, uint, IntPtr, Interop.BOOL>>(EnumSystemLocalesProc);
- Interop.mincore.EnumSystemLocalesEx(callback, LOCALE_SPECIFICDATA | LOCALE_SUPPLEMENTAL, (IntPtr)contextHandle, IntPtr.Zero);
- }
- finally
- {
- contextHandle.Free();
- }
-
- if (context.cultureName != null)
- {
- // we got a matched culture
- return GetCultureData(context.cultureName, true);
- }
-
- return null;
- }
-
- private string GetLanguageDisplayName(string cultureName)
- {
-#if ENABLE_WINRT
- return WinRTInterop.Callbacks.GetLanguageDisplayName(cultureName);
-#else
- // Usually the UI culture shouldn't be different than what we got from WinRT except
- // if DefaultThreadCurrentUICulture was set
- CultureInfo ci;
-
- if (CultureInfo.DefaultThreadCurrentUICulture != null &&
- ((ci = GetUserDefaultCulture()) != null) &&
- !CultureInfo.DefaultThreadCurrentUICulture.Name.Equals(ci.Name))
- {
- return SNATIVEDISPLAYNAME;
- }
- else
- {
- return GetLocaleInfo(cultureName, LocaleStringData.LocalizedDisplayName);
- }
-#endif // ENABLE_WINRT
- }
-
- private string GetRegionDisplayName(string isoCountryCode)
- {
-#if ENABLE_WINRT
- return WinRTInterop.Callbacks.GetRegionDisplayName(isoCountryCode);
-#else
- // Usually the UI culture shouldn't be different than what we got from WinRT except
- // if DefaultThreadCurrentUICulture was set
- CultureInfo ci;
-
- if (CultureInfo.DefaultThreadCurrentUICulture != null &&
- ((ci = GetUserDefaultCulture()) != null) &&
- !CultureInfo.DefaultThreadCurrentUICulture.Name.Equals(ci.Name))
- {
- return SNATIVECOUNTRY;
- }
- else
- {
- return GetLocaleInfo(LocaleStringData.LocalizedCountryName);
- }
-#endif // ENABLE_WINRT
- }
-
- private static CultureInfo GetUserDefaultCulture()
- {
-#if ENABLE_WINRT
- return (CultureInfo)WinRTInterop.Callbacks.GetUserDefaultCulture();
-#else
- return CultureInfo.GetUserDefaultCulture();
-#endif // ENABLE_WINRT
- }
-
- // PAL methods end here.
-
- private static string GetLocaleInfoFromLCType(string localeName, uint lctype, bool useUserOveride)
- {
- Debug.Assert(localeName != null, "[CultureData.GetLocaleInfoFromLCType] Expected localeName to be not be null");
-
- // Fix lctype if we don't want overrides
- if (!useUserOveride)
- {
- lctype |= LOCALE_NOUSEROVERRIDE;
- }
-
- // Ask OS for data
- string result = Interop.mincore.GetLocaleInfoEx(localeName, lctype);
- if (result == null)
- {
- // Failed, just use empty string
- result = String.Empty;
- }
-
- return result;
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Reescape a Win32 style quote string as a NLS+ style quoted string
- //
- // This is also the escaping style used by custom culture data files
- //
- // NLS+ uses \ to escape the next character, whether in a quoted string or
- // not, so we always have to change \ to \\.
- //
- // NLS+ uses \' to escape a quote inside a quoted string so we have to change
- // '' to \' (if inside a quoted string)
- //
- // We don't build the stringbuilder unless we find something to change
- ////////////////////////////////////////////////////////////////////////////
- internal static String ReescapeWin32String(String str)
- {
- // If we don't have data, then don't try anything
- if (str == null)
- return null;
-
- StringBuilder result = null;
-
- bool inQuote = false;
- for (int i = 0; i < str.Length; i++)
- {
- // Look for quote
- if (str[i] == '\'')
- {
- // Already in quote?
- if (inQuote)
- {
- // See another single quote. Is this '' of 'fred''s' or '''', or is it an ending quote?
- if (i + 1 < str.Length && str[i + 1] == '\'')
- {
- // Found another ', so we have ''. Need to add \' instead.
- // 1st make sure we have our stringbuilder
- if (result == null)
- result = new StringBuilder(str, 0, i, str.Length * 2);
-
- // Append a \' and keep going (so we don't turn off quote mode)
- result.Append("\\'");
- i++;
- continue;
- }
-
- // Turning off quote mode, fall through to add it
- inQuote = false;
- }
- else
- {
- // Found beginning quote, fall through to add it
- inQuote = true;
- }
- }
- // Is there a single \ character?
- else if (str[i] == '\\')
- {
- // Found a \, need to change it to \\
- // 1st make sure we have our stringbuilder
- if (result == null)
- result = new StringBuilder(str, 0, i, str.Length * 2);
-
- // Append our \\ to the string & continue
- result.Append("\\\\");
- continue;
- }
-
- // If we have a builder we need to add our character
- if (result != null)
- result.Append(str[i]);
- }
-
- // Unchanged string? , just return input string
- if (result == null)
- return str;
-
- // String changed, need to use the builder
- return result.ToString();
- }
-
- internal static String[] ReescapeWin32Strings(String[] array)
- {
- if (array != null)
- {
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = ReescapeWin32String(array[i]);
- }
- }
-
- return array;
- }
-
- // If we get a group from windows, then its in 3;0 format with the 0 backwards
- // of how NLS+ uses it (ie: if the string has a 0, then the int[] shouldn't and vice versa)
- // EXCEPT in the case where the list only contains 0 in which NLS and NLS+ have the same meaning.
- private static int[] ConvertWin32GroupString(String win32Str)
- {
- // None of these cases make any sense
- if (win32Str == null || win32Str.Length == 0)
- {
- return (new int[] { 3 });
- }
-
- if (win32Str[0] == '0')
- {
- return (new int[] { 0 });
- }
-
- // Since its in n;n;n;n;n format, we can always get the length quickly
- int[] values;
- if (win32Str[win32Str.Length - 1] == '0')
- {
- // Trailing 0 gets dropped. 1;0 -> 1
- values = new int[(win32Str.Length / 2)];
- }
- else
- {
- // Need extra space for trailing zero 1 -> 1;0
- values = new int[(win32Str.Length / 2) + 2];
- values[values.Length - 1] = 0;
- }
-
- int i;
- int j;
- for (i = 0, j = 0; i < win32Str.Length && j < values.Length; i += 2, j++)
- {
- // Note that this # shouldn't ever be zero, 'cause 0 is only at end
- // But we'll test because its registry that could be anything
- if (win32Str[i] < '1' || win32Str[i] > '9')
- return new int[] { 3 };
-
- values[j] = (int)(win32Str[i] - '0');
- }
-
- return (values);
- }
-
- private static int ConvertFirstDayOfWeekMonToSun(int iTemp)
- {
- // Convert Mon-Sun to Sun-Sat format
- iTemp++;
- if (iTemp > 6)
- {
- // Wrap Sunday and convert invalid data to Sunday
- iTemp = 0;
- }
- return iTemp;
- }
-
-
- // Context for EnumCalendarInfoExEx callback.
- private class EnumLocaleData
- {
- public string regionName;
- public string cultureName;
- }
-
- // EnumSystemLocaleEx callback.
- [NativeCallable(CallingConvention = CallingConvention.StdCall)]
- private static unsafe Interop.BOOL EnumSystemLocalesProc(IntPtr lpLocaleString, uint flags, IntPtr contextHandle)
- {
- EnumLocaleData context = (EnumLocaleData)((GCHandle)contextHandle).Target;
- try
- {
- string cultureName = new string((char*)lpLocaleString);
- string regionName = Interop.mincore.GetLocaleInfoEx(cultureName, LOCALE_SISO3166CTRYNAME);
- if (regionName != null && regionName.Equals(context.regionName, StringComparison.OrdinalIgnoreCase))
- {
- context.cultureName = cultureName;
- return Interop.BOOL.FALSE; // we found a match, then stop the enumeration
- }
-
- return Interop.BOOL.TRUE;
- }
- catch (Exception)
- {
- return Interop.BOOL.FALSE;
- }
- }
-
- // Context for EnumTimeFormatsEx callback.
- private class EnumData
- {
- public LowLevelList<string> strings;
- }
-
- // EnumTimeFormatsEx callback itself.
- [NativeCallable(CallingConvention = CallingConvention.StdCall)]
- private static unsafe Interop.BOOL EnumTimeCallback(IntPtr lpTimeFormatString, IntPtr lParam)
- {
- EnumData context = (EnumData)((GCHandle)lParam).Target;
-
- try
- {
- context.strings.Add(new string((char*)lpTimeFormatString));
- return Interop.BOOL.TRUE;
- }
- catch (Exception)
- {
- return Interop.BOOL.FALSE;
- }
- }
-
- private static unsafe String[] nativeEnumTimeFormats(String localeName, uint dwFlags, bool useUserOverride)
- {
- const uint LOCALE_SSHORTTIME = 0x00000079;
- const uint LOCALE_STIMEFORMAT = 0x00001003;
-
- EnumData data = new EnumData();
- data.strings = new LowLevelList<string>();
-
- GCHandle dataHandle = GCHandle.Alloc(data);
- try
- {
- // Now call the enumeration API. Work is done by our callback function
- IntPtr callback = AddrofIntrinsics.AddrOf<Func<IntPtr, IntPtr, Interop.BOOL>>(EnumTimeCallback);
- Interop.mincore.EnumTimeFormatsEx(callback, localeName, (uint)dwFlags, (IntPtr)dataHandle);
- }
- finally
- {
- dataHandle.Free();
- }
-
- if (data.strings.Count > 0)
- {
- // Now we need to allocate our stringarray and populate it
- string[] results = data.strings.ToArray();
-
- if (!useUserOverride && data.strings.Count > 1)
- {
- // Since there is no "NoUserOverride" aware EnumTimeFormatsEx, we always get an override
- // The override is the first entry if it is overriden.
- // We can check if we have overrides by checking the GetLocaleInfo with no override
- // If we do have an override, we don't know if it is a user defined override or if the
- // user has just selected one of the predefined formats so we can't just remove it
- // but we can move it down.
- uint lcType = (dwFlags == TIME_NOSECONDS) ? LOCALE_SSHORTTIME : LOCALE_STIMEFORMAT;
- string timeFormatNoUserOverride = GetLocaleInfoFromLCType(localeName, lcType, useUserOverride);
- if (timeFormatNoUserOverride != "")
- {
- string firstTimeFormat = results[0];
- if (timeFormatNoUserOverride != firstTimeFormat)
- {
- results[0] = results[1];
- results[1] = firstTimeFormat;
- }
- }
- }
-
- return results;
- }
-
- return null;
- }
-
- private int LocaleNameToLCID(string cultureName)
- {
- return GetLocaleInfo(LocaleNumberData.LanguageId);
- }
-
- private static string LCIDToLocaleName(int culture)
- {
- throw new NotImplementedException();
- }
-
- private int GetAnsiCodePage(string cultureName)
- {
- return GetLocaleInfo(LocaleNumberData.AnsiCodePage);
- }
-
- private int GetOemCodePage(string cultureName)
- {
- return GetLocaleInfo(LocaleNumberData.OemCodePage);
- }
-
- private int GetMacCodePage(string cultureName)
- {
- return GetLocaleInfo(LocaleNumberData.MacCodePage);
- }
-
- private int GetEbcdicCodePage(string cultureName)
- {
- return GetLocaleInfo(LocaleNumberData.EbcdicCodePage);
- }
-
- private int GetGeoId(string cultureName)
- {
- return GetLocaleInfo(LocaleNumberData.GeoId);
- }
-
- private int GetDigitSubstitution(string cultureName)
- {
- return GetLocaleInfo(LocaleNumberData.DigitSubstitution);
- }
-
- private string GetThreeLetterWindowsLanguageName(string cultureName)
- {
- return GetLocaleInfo(cultureName, LocaleStringData.AbbreviatedWindowsLanguageName);
- }
-
- private static CultureInfo[] EnumCultures(CultureTypes types)
- {
- throw new NotImplementedException();
- }
-
- private string GetConsoleFallbackName(string cultureName)
- {
- return GetLocaleInfo(cultureName, LocaleStringData.ConsoleFallbackName);
- }
-
- internal bool IsFramework
- {
- get { throw new NotImplementedException(); }
- }
-
- internal bool IsWin32Installed
- {
- get { throw new NotImplementedException(); }
- }
-
- internal bool IsReplacementCulture
- {
- get { throw new NotImplementedException(); }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CultureData.cs b/src/mscorlib/corefx/System/Globalization/CultureData.cs
deleted file mode 100644
index c15a77cf45..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CultureData.cs
+++ /dev/null
@@ -1,2470 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using System.Threading;
-
-namespace System.Globalization
-{
-
-#if INSIDE_CLR
- using StringStringDictionary = Dictionary<string, string>;
- using StringCultureDataDictionary = Dictionary<string, CultureData>;
- using LcidToCultureNameDictionary = Dictionary<int, string>;
- using Lock = Object;
-#else
- using StringStringDictionary = LowLevelDictionary<string, string>;
- using StringCultureDataDictionary = LowLevelDictionary<string, CultureData>;
- using LcidToCultureNameDictionary = LowLevelDictionary<int, string>;
-#endif
-
- //
- // List of culture data
- // Note the we cache overrides.
- // Note that localized names (resource names) aren't available from here.
- //
-
- //
- // Our names are a tad confusing.
- //
- // sWindowsName -- The name that windows thinks this culture is, ie:
- // en-US if you pass in en-US
- // de-DE_phoneb if you pass in de-DE_phoneb
- // fj-FJ if you pass in fj (neutral, on a pre-Windows 7 machine)
- // fj if you pass in fj (neutral, post-Windows 7 machine)
- //
- // sRealName -- The name you used to construct the culture, in pretty form
- // en-US if you pass in EN-us
- // en if you pass in en
- // de-DE_phoneb if you pass in de-DE_phoneb
- //
- // sSpecificCulture -- The specific culture for this culture
- // en-US for en-US
- // en-US for en
- // de-DE_phoneb for alt sort
- // fj-FJ for fj (neutral)
- //
- // sName -- The IETF name of this culture (ie: no sort info, could be neutral)
- // en-US if you pass in en-US
- // en if you pass in en
- // de-DE if you pass in de-DE_phoneb
- //
- internal partial class CultureData
- {
- private const int undef = -1;
-
- // Override flag
- private String _sRealName; // Name you passed in (ie: en-US, en, or de-DE_phoneb)
- private String _sWindowsName; // Name OS thinks the object is (ie: de-DE_phoneb, or en-US (even if en was passed in))
-
- // Identity
- private String _sName; // locale name (ie: en-us, NO sort info, but could be neutral)
- private String _sParent; // Parent name (which may be a custom locale/culture)
- private String _sLocalizedDisplayName; // Localized pretty name for this locale
- private String _sEnglishDisplayName; // English pretty name for this locale
- private String _sNativeDisplayName; // Native pretty name for this locale
- private String _sSpecificCulture; // The culture name to be used in CultureInfo.CreateSpecificCulture(), en-US form if neutral, sort name if sort
-
- // Language
- private String _sISO639Language; // ISO 639 Language Name
- private String _sISO639Language2; // ISO 639 Language Name
- private String _sLocalizedLanguage; // Localized name for this language
- private String _sEnglishLanguage; // English name for this language
- private String _sNativeLanguage; // Native name of this language
- private String _sAbbrevLang; // abbreviated language name (Windows Language Name) ex: ENU
- private string _sConsoleFallbackName; // The culture name for the console fallback UI culture
- private int _iInputLanguageHandle=undef;// input language handle
-
- // Region
- private String _sRegionName; // (RegionInfo)
- private String _sLocalizedCountry; // localized country name
- private String _sEnglishCountry; // english country name (RegionInfo)
- private String _sNativeCountry; // native country name
- private String _sISO3166CountryName; // ISO 3166 (RegionInfo), ie: US
- private String _sISO3166CountryName2; // 3 char ISO 3166 country name 2 2(RegionInfo) ex: USA (ISO)
- private int _iGeoId = undef; // GeoId
-
- // Numbers
- private String _sPositiveSign; // (user can override) positive sign
- private String _sNegativeSign; // (user can override) negative sign
- // (nfi populates these 5, don't have to be = undef)
- private int _iDigits; // (user can override) number of fractional digits
- private int _iNegativeNumber; // (user can override) negative number format
- private int[] _waGrouping; // (user can override) grouping of digits
- private String _sDecimalSeparator; // (user can override) decimal separator
- private String _sThousandSeparator; // (user can override) thousands separator
- private String _sNaN; // Not a Number
- private String _sPositiveInfinity; // + Infinity
- private String _sNegativeInfinity; // - Infinity
-
- // Percent
- private int _iNegativePercent = undef; // Negative Percent (0-3)
- private int _iPositivePercent = undef; // Positive Percent (0-11)
- private String _sPercent; // Percent (%) symbol
- private String _sPerMille; // PerMille symbol
-
- // Currency
- private String _sCurrency; // (user can override) local monetary symbol
- private String _sIntlMonetarySymbol; // international monetary symbol (RegionInfo)
- private String _sEnglishCurrency; // English name for this currency
- private String _sNativeCurrency; // Native name for this currency
- // (nfi populates these 4, don't have to be = undef)
- private int _iCurrencyDigits; // (user can override) # local monetary fractional digits
- private int _iCurrency; // (user can override) positive currency format
- private int _iNegativeCurrency; // (user can override) negative currency format
- private int[] _waMonetaryGrouping; // (user can override) monetary grouping of digits
- private String _sMonetaryDecimal; // (user can override) monetary decimal separator
- private String _sMonetaryThousand; // (user can override) monetary thousands separator
-
- // Misc
- private int _iMeasure = undef; // (user can override) system of measurement 0=metric, 1=US (RegionInfo)
- private String _sListSeparator; // (user can override) list separator
-
- // Time
- private String _sAM1159; // (user can override) AM designator
- private String _sPM2359; // (user can override) PM designator
- private String _sTimeSeparator;
- private volatile String[] _saLongTimes; // (user can override) time format
- private volatile String[] _saShortTimes; // short time format
- private volatile String[] _saDurationFormats; // time duration format
-
- // Calendar specific data
- private int _iFirstDayOfWeek = undef; // (user can override) first day of week (gregorian really)
- private int _iFirstWeekOfYear = undef; // (user can override) first week of year (gregorian really)
- private volatile CalendarId[] _waCalendars; // all available calendar type(s). The first one is the default calendar
-
- // Store for specific data about each calendar
- private CalendarData[] _calendars; // Store for specific calendar data
-
- // Text information
- private int _iReadingLayout = undef; // Reading layout data
- // 0 - Left to right (eg en-US)
- // 1 - Right to left (eg arabic locales)
- // 2 - Vertical top to bottom with columns to the left and also left to right (ja-JP locales)
- // 3 - Vertical top to bottom with columns proceeding to the right
-
- // CoreCLR depends on this even though its not exposed publicly.
-
- private int _iDefaultAnsiCodePage = undef; // default ansi code page ID (ACP)
- private int _iDefaultOemCodePage = undef; // default oem code page ID (OCP or OEM)
- private int _iDefaultMacCodePage = undef; // default macintosh code page
- private int _iDefaultEbcdicCodePage = undef; // default EBCDIC code page
-
- private int _iLanguage; // locale ID (0409) - NO sort information
- private bool _bUseOverrides; // use user overrides?
- private bool _bNeutral; // Flags for the culture (ie: neutral or not right now)
-
-
- // Region Name to Culture Name mapping table
- // (In future would be nice to be in registry or something)
-
- //Using a property so we avoid creating the dictionary untill we need it
- private static StringStringDictionary RegionNames
- {
- get
- {
- if (s_RegionNames == null)
- {
- StringStringDictionary regionNames = new StringStringDictionary(211 /* prime */);
-
- regionNames.Add("029", "en-029");
- regionNames.Add("AE", "ar-AE");
- regionNames.Add("AF", "prs-AF");
- regionNames.Add("AL", "sq-AL");
- regionNames.Add("AM", "hy-AM");
- regionNames.Add("AR", "es-AR");
- regionNames.Add("AT", "de-AT");
- regionNames.Add("AU", "en-AU");
- regionNames.Add("AZ", "az-Cyrl-AZ");
- regionNames.Add("BA", "bs-Latn-BA");
- regionNames.Add("BD", "bn-BD");
- regionNames.Add("BE", "nl-BE");
- regionNames.Add("BG", "bg-BG");
- regionNames.Add("BH", "ar-BH");
- regionNames.Add("BN", "ms-BN");
- regionNames.Add("BO", "es-BO");
- regionNames.Add("BR", "pt-BR");
- regionNames.Add("BY", "be-BY");
- regionNames.Add("BZ", "en-BZ");
- regionNames.Add("CA", "en-CA");
- regionNames.Add("CH", "it-CH");
- regionNames.Add("CL", "es-CL");
- regionNames.Add("CN", "zh-CN");
- regionNames.Add("CO", "es-CO");
- regionNames.Add("CR", "es-CR");
- regionNames.Add("CS", "sr-Cyrl-CS");
- regionNames.Add("CZ", "cs-CZ");
- regionNames.Add("DE", "de-DE");
- regionNames.Add("DK", "da-DK");
- regionNames.Add("DO", "es-DO");
- regionNames.Add("DZ", "ar-DZ");
- regionNames.Add("EC", "es-EC");
- regionNames.Add("EE", "et-EE");
- regionNames.Add("EG", "ar-EG");
- regionNames.Add("ES", "es-ES");
- regionNames.Add("ET", "am-ET");
- regionNames.Add("FI", "fi-FI");
- regionNames.Add("FO", "fo-FO");
- regionNames.Add("FR", "fr-FR");
- regionNames.Add("GB", "en-GB");
- regionNames.Add("GE", "ka-GE");
- regionNames.Add("GL", "kl-GL");
- regionNames.Add("GR", "el-GR");
- regionNames.Add("GT", "es-GT");
- regionNames.Add("HK", "zh-HK");
- regionNames.Add("HN", "es-HN");
- regionNames.Add("HR", "hr-HR");
- regionNames.Add("HU", "hu-HU");
- regionNames.Add("ID", "id-ID");
- regionNames.Add("IE", "en-IE");
- regionNames.Add("IL", "he-IL");
- regionNames.Add("IN", "hi-IN");
- regionNames.Add("IQ", "ar-IQ");
- regionNames.Add("IR", "fa-IR");
- regionNames.Add("IS", "is-IS");
- regionNames.Add("IT", "it-IT");
- regionNames.Add("IV", "");
- regionNames.Add("JM", "en-JM");
- regionNames.Add("JO", "ar-JO");
- regionNames.Add("JP", "ja-JP");
- regionNames.Add("KE", "sw-KE");
- regionNames.Add("KG", "ky-KG");
- regionNames.Add("KH", "km-KH");
- regionNames.Add("KR", "ko-KR");
- regionNames.Add("KW", "ar-KW");
- regionNames.Add("KZ", "kk-KZ");
- regionNames.Add("LA", "lo-LA");
- regionNames.Add("LB", "ar-LB");
- regionNames.Add("LI", "de-LI");
- regionNames.Add("LK", "si-LK");
- regionNames.Add("LT", "lt-LT");
- regionNames.Add("LU", "lb-LU");
- regionNames.Add("LV", "lv-LV");
- regionNames.Add("LY", "ar-LY");
- regionNames.Add("MA", "ar-MA");
- regionNames.Add("MC", "fr-MC");
- regionNames.Add("ME", "sr-Latn-ME");
- regionNames.Add("MK", "mk-MK");
- regionNames.Add("MN", "mn-MN");
- regionNames.Add("MO", "zh-MO");
- regionNames.Add("MT", "mt-MT");
- regionNames.Add("MV", "dv-MV");
- regionNames.Add("MX", "es-MX");
- regionNames.Add("MY", "ms-MY");
- regionNames.Add("NG", "ig-NG");
- regionNames.Add("NI", "es-NI");
- regionNames.Add("NL", "nl-NL");
- regionNames.Add("NO", "nn-NO");
- regionNames.Add("NP", "ne-NP");
- regionNames.Add("NZ", "en-NZ");
- regionNames.Add("OM", "ar-OM");
- regionNames.Add("PA", "es-PA");
- regionNames.Add("PE", "es-PE");
- regionNames.Add("PH", "en-PH");
- regionNames.Add("PK", "ur-PK");
- regionNames.Add("PL", "pl-PL");
- regionNames.Add("PR", "es-PR");
- regionNames.Add("PT", "pt-PT");
- regionNames.Add("PY", "es-PY");
- regionNames.Add("QA", "ar-QA");
- regionNames.Add("RO", "ro-RO");
- regionNames.Add("RS", "sr-Latn-RS");
- regionNames.Add("RU", "ru-RU");
- regionNames.Add("RW", "rw-RW");
- regionNames.Add("SA", "ar-SA");
- regionNames.Add("SE", "sv-SE");
- regionNames.Add("SG", "zh-SG");
- regionNames.Add("SI", "sl-SI");
- regionNames.Add("SK", "sk-SK");
- regionNames.Add("SN", "wo-SN");
- regionNames.Add("SV", "es-SV");
- regionNames.Add("SY", "ar-SY");
- regionNames.Add("TH", "th-TH");
- regionNames.Add("TJ", "tg-Cyrl-TJ");
- regionNames.Add("TM", "tk-TM");
- regionNames.Add("TN", "ar-TN");
- regionNames.Add("TR", "tr-TR");
- regionNames.Add("TT", "en-TT");
- regionNames.Add("TW", "zh-TW");
- regionNames.Add("UA", "uk-UA");
- regionNames.Add("US", "en-US");
- regionNames.Add("UY", "es-UY");
- regionNames.Add("UZ", "uz-Cyrl-UZ");
- regionNames.Add("VE", "es-VE");
- regionNames.Add("VN", "vi-VN");
- regionNames.Add("YE", "ar-YE");
- regionNames.Add("ZA", "af-ZA");
- regionNames.Add("ZW", "en-ZW");
-
- s_RegionNames = regionNames;
- }
-
- return s_RegionNames;
- }
- }
-
- // Cache of regions we've already looked up
- private static volatile StringCultureDataDictionary s_cachedRegions;
- private static volatile StringStringDictionary s_RegionNames;
-
- internal static CultureData GetCultureDataForRegion(String cultureName, bool useUserOverride)
- {
- // First do a shortcut for Invariant
- if (String.IsNullOrEmpty(cultureName))
- {
- return CultureData.Invariant;
- }
-
- //
- // First check if GetCultureData() can find it (ie: its a real culture)
- //
- CultureData retVal = GetCultureData(cultureName, useUserOverride);
- if (retVal != null && (retVal.IsNeutralCulture == false)) return retVal;
-
- //
- // Not a specific culture, perhaps it's region-only name
- // (Remember this isn't a core clr path where that's not supported)
- //
-
- // If it was neutral remember that so that RegionInfo() can throw the right exception
- CultureData neutral = retVal;
-
- // Try the hash table next
- String hashName = AnsiToLower(useUserOverride ? cultureName : cultureName + '*');
- StringCultureDataDictionary tempHashTable = s_cachedRegions;
- if (tempHashTable == null)
- {
- // No table yet, make a new one
- tempHashTable = new StringCultureDataDictionary();
- }
- else
- {
- // Check the hash table
- lock (s_lock)
- {
- tempHashTable.TryGetValue(hashName, out retVal);
- }
- if (retVal != null)
- {
- return retVal;
- }
- }
-
- //
- // Not found in the hash table, look it up the hard way
- //
-
- // If not a valid mapping from the registry we'll have to try the hard coded table
- if (retVal == null || (retVal.IsNeutralCulture == true))
- {
- // Not a valid mapping, try the hard coded table
- string name;
- if (RegionNames.TryGetValue(cultureName, out name))
- {
- // Make sure we can get culture data for it
- retVal = GetCultureData(name, useUserOverride);
- }
- }
-
- // If not found in the hard coded table we'll have to find a culture that works for us
- if (retVal == null || (retVal.IsNeutralCulture == true))
- {
- retVal = GetCultureDataFromRegionName(cultureName);
- }
-
- // If we found one we can use, then cache it for next time
- if (retVal != null && (retVal.IsNeutralCulture == false))
- {
- // first add it to the cache
- lock (s_lock)
- {
- tempHashTable[hashName] = retVal;
- }
-
- // Copy the hashtable to the corresponding member variables. This will potentially overwrite
- // new tables simultaneously created by a new thread, but maximizes thread safety.
- s_cachedRegions = tempHashTable;
- }
- else
- {
- // Unable to find a matching culture/region, return null or neutral
- // (regionInfo throws a more specific exception on neutrals)
- retVal = neutral;
- }
-
- // Return the found culture to use, null, or the neutral culture.
- return retVal;
- }
-
- // Clear our internal caches
- internal static void ClearCachedData()
- {
- s_cachedCultures = null;
- s_cachedRegions = null;
- }
-
- internal static CultureInfo[] GetCultures(CultureTypes types)
- {
- // Disable warning 618: System.Globalization.CultureTypes.FrameworkCultures' is obsolete
-#pragma warning disable 618
- // Validate flags
- if ((int)types <= 0 || ((int)types & (int)~(CultureTypes.NeutralCultures | CultureTypes.SpecificCultures |
- CultureTypes.InstalledWin32Cultures | CultureTypes.UserCustomCulture |
- CultureTypes.ReplacementCultures | CultureTypes.WindowsOnlyCultures |
- CultureTypes.FrameworkCultures)) != 0)
- {
- throw new ArgumentOutOfRangeException(nameof(types),
- SR.Format(SR.ArgumentOutOfRange_Range, CultureTypes.NeutralCultures, CultureTypes.FrameworkCultures));
- }
-
- // We have deprecated CultureTypes.FrameworkCultures.
- // When this enum is used, we will enumerate Whidbey framework cultures (for compatibility).
- //
-
- // We have deprecated CultureTypes.WindowsOnlyCultures.
- // When this enum is used, we will return an empty array for this enum.
- if ((types & CultureTypes.WindowsOnlyCultures) != 0)
- {
- // Remove the enum as it is an no-op.
- types &= (~CultureTypes.WindowsOnlyCultures);
- }
-
-#pragma warning restore 618
- return EnumCultures(types);
- }
-
- /////////////////////////////////////////////////////////////////////////
- // Build our invariant information
- //
- // We need an invariant instance, which we build hard-coded
- /////////////////////////////////////////////////////////////////////////
- internal static CultureData Invariant
- {
- get
- {
- if (s_Invariant == null)
- {
- // Make a new culturedata
- CultureData invariant = new CultureData();
-
- // Basics
- // Note that we override the resources since this IS NOT supposed to change (by definition)
- invariant._bUseOverrides = false;
- invariant._sRealName = ""; // Name you passed in (ie: en-US, en, or de-DE_phoneb)
- invariant._sWindowsName = ""; // Name OS thinks the object is (ie: de-DE_phoneb, or en-US (even if en was passed in))
-
- // Identity
- invariant._sName = ""; // locale name (ie: en-us)
- invariant._sParent = ""; // Parent name (which may be a custom locale/culture)
- invariant._bNeutral = false; // Flags for the culture (ie: neutral or not right now)
- invariant._sEnglishDisplayName = "Invariant Language (Invariant Country)"; // English pretty name for this locale
- invariant._sNativeDisplayName = "Invariant Language (Invariant Country)"; // Native pretty name for this locale
- invariant._sSpecificCulture = ""; // The culture name to be used in CultureInfo.CreateSpecificCulture()
-
- // Language
- invariant._sISO639Language = "iv"; // ISO 639 Language Name
- invariant._sISO639Language2 = "ivl"; // 3 char ISO 639 lang name 2
- invariant._sLocalizedLanguage = "Invariant Language"; // Display name for this Language
- invariant._sEnglishLanguage = "Invariant Language"; // English name for this language
- invariant._sNativeLanguage = "Invariant Language"; // Native name of this language
- invariant._sAbbrevLang = "IVL"; // abbreviated language name (Windows Language Name)
- invariant._sConsoleFallbackName = ""; // The culture name for the console fallback UI culture
- invariant._iInputLanguageHandle = 0x07F; // input language handle
-
- // Region
- invariant._sRegionName = "IV"; // (RegionInfo)
- invariant._sEnglishCountry = "Invariant Country"; // english country name (RegionInfo)
- invariant._sNativeCountry = "Invariant Country"; // native country name (Windows Only)
- invariant._sISO3166CountryName = "IV"; // (RegionInfo), ie: US
- invariant._sISO3166CountryName2 = "ivc"; // 3 char ISO 3166 country name 2 2(RegionInfo)
- invariant._iGeoId = 244; // GeoId (Windows Only)
-
- // Numbers
- invariant._sPositiveSign = "+"; // positive sign
- invariant._sNegativeSign = "-"; // negative sign
- invariant._iDigits = 2; // number of fractional digits
- invariant._iNegativeNumber = 1; // negative number format
- invariant._waGrouping = new int[] { 3 }; // grouping of digits
- invariant._sDecimalSeparator = "."; // decimal separator
- invariant._sThousandSeparator = ","; // thousands separator
- invariant._sNaN = "NaN"; // Not a Number
- invariant._sPositiveInfinity = "Infinity"; // + Infinity
- invariant._sNegativeInfinity = "-Infinity"; // - Infinity
-
- // Percent
- invariant._iNegativePercent = 0; // Negative Percent (0-3)
- invariant._iPositivePercent = 0; // Positive Percent (0-11)
- invariant._sPercent = "%"; // Percent (%) symbol
- invariant._sPerMille = "\x2030"; // PerMille symbol
-
- // Currency
- invariant._sCurrency = "\x00a4"; // local monetary symbol: for international monetary symbol
- invariant._sIntlMonetarySymbol = "XDR"; // international monetary symbol (RegionInfo)
- invariant._sEnglishCurrency = "International Monetary Fund"; // English name for this currency (Windows Only)
- invariant._sNativeCurrency = "International Monetary Fund"; // Native name for this currency (Windows Only)
- invariant._iCurrencyDigits = 2; // # local monetary fractional digits
- invariant._iCurrency = 0; // positive currency format
- invariant._iNegativeCurrency = 0; // negative currency format
- invariant._waMonetaryGrouping = new int[] { 3 }; // monetary grouping of digits
- invariant._sMonetaryDecimal = "."; // monetary decimal separator
- invariant._sMonetaryThousand = ","; // monetary thousands separator
-
- // Misc
- invariant._iMeasure = 0; // system of measurement 0=metric, 1=US (RegionInfo)
- invariant._sListSeparator = ","; // list separator
-
- // Time
- invariant._sAM1159 = "AM"; // AM designator
- invariant._sPM2359 = "PM"; // PM designator
- invariant._saLongTimes = new String[] { "HH:mm:ss" }; // time format
- invariant._saShortTimes = new String[] { "HH:mm", "hh:mm tt", "H:mm", "h:mm tt" }; // short time format
- invariant._saDurationFormats = new String[] { "HH:mm:ss" }; // time duration format
-
-
- // Calendar specific data
- invariant._iFirstDayOfWeek = 0; // first day of week
- invariant._iFirstWeekOfYear = 0; // first week of year
- invariant._waCalendars = new CalendarId[] { CalendarId.GREGORIAN }; // all available calendar type(s). The first one is the default calendar
-
- // Store for specific data about each calendar
- invariant._calendars = new CalendarData[CalendarData.MAX_CALENDARS];
- invariant._calendars[0] = CalendarData.Invariant;
-
- // Text information
- invariant._iReadingLayout = 0;
-
- // These are desktop only, not coreclr
-
- invariant._iLanguage = CultureInfo.LOCALE_INVARIANT; // locale ID (0409) - NO sort information
- invariant._iDefaultAnsiCodePage = 1252; // default ansi code page ID (ACP)
- invariant._iDefaultOemCodePage = 437; // default oem code page ID (OCP or OEM)
- invariant._iDefaultMacCodePage = 10000; // default macintosh code page
- invariant._iDefaultEbcdicCodePage = 037; // default EBCDIC code page
- // Remember it
- s_Invariant = invariant;
- }
- return s_Invariant;
- }
- }
- private volatile static CultureData s_Invariant;
-
- ///////////////
- // Constructors //
- ///////////////
- // Cache of cultures we've already looked up
- private static volatile StringCultureDataDictionary s_cachedCultures;
- private static readonly Lock s_lock = new Lock();
-
- internal static CultureData GetCultureData(String cultureName, bool useUserOverride)
- {
- // First do a shortcut for Invariant
- if (String.IsNullOrEmpty(cultureName))
- {
- return CultureData.Invariant;
- }
-
- // Try the hash table first
- String hashName = AnsiToLower(useUserOverride ? cultureName : cultureName + '*');
- StringCultureDataDictionary tempHashTable = s_cachedCultures;
- if (tempHashTable == null)
- {
- // No table yet, make a new one
- tempHashTable = new StringCultureDataDictionary();
- }
- else
- {
- // Check the hash table
- bool ret;
- CultureData retVal;
- lock (s_lock)
- {
- ret = tempHashTable.TryGetValue(hashName, out retVal);
- }
- if (ret && retVal != null)
- {
- return retVal;
- }
- }
-
- // Not found in the hash table, need to see if we can build one that works for us
- CultureData culture = CreateCultureData(cultureName, useUserOverride);
- if (culture == null)
- {
- return null;
- }
-
- // Found one, add it to the cache
- lock (s_lock)
- {
- tempHashTable[hashName] = culture;
- }
-
- // Copy the hashtable to the corresponding member variables. This will potentially overwrite
- // new tables simultaneously created by a new thread, but maximizes thread safety.
- s_cachedCultures = tempHashTable;
-
- return culture;
- }
-
- private static CultureData CreateCultureData(string cultureName, bool useUserOverride)
- {
- CultureData culture = new CultureData();
- culture._bUseOverrides = useUserOverride;
- culture._sRealName = cultureName;
-
- // Ask native code if that one's real
- if (culture.InitCultureData() == false)
- {
- if (culture.InitCompatibilityCultureData() == false)
- {
- return null;
- }
- }
-
- return culture;
- }
-
- private bool InitCompatibilityCultureData()
- {
- // for compatibility handle the deprecated ids: zh-chs, zh-cht
- string cultureName = _sRealName;
-
- string fallbackCultureName;
- string realCultureName;
- switch (AnsiToLower(cultureName))
- {
- case "zh-chs":
- fallbackCultureName = "zh-Hans";
- realCultureName = "zh-CHS";
- break;
- case "zh-cht":
- fallbackCultureName = "zh-Hant";
- realCultureName = "zh-CHT";
- break;
- default:
- return false;
- }
-
- _sRealName = fallbackCultureName;
- if (InitCultureData() == false)
- {
- return false;
- }
- // fixup our data
- _sName = realCultureName; // the name that goes back to the user
- _sParent = fallbackCultureName;
-
- return true;
- }
-
- // We'd rather people use the named version since this doesn't allow custom locales
- internal static CultureData GetCultureData(int culture, bool bUseUserOverride)
- {
- string localeName = null;
- CultureData retVal = null;
-
- if (culture == CultureInfo.LOCALE_INVARIANT)
- return Invariant;
-
- // Convert the lcid to a name, then use that
- // Note that this'll return neutral names (unlike Vista native API)
- localeName = LCIDToLocaleName(culture);
-
- if (!String.IsNullOrEmpty(localeName))
- {
- // Valid name, use it
- retVal = GetCultureData(localeName, bUseUserOverride);
- }
-
- // If not successful, throw
- if (retVal == null)
- throw new CultureNotFoundException(nameof(culture), culture, SR.Argument_CultureNotSupported);
-
- // Return the one we found
- return retVal;
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // All the accessors
- //
- // Accessors for our data object items
- //
- ////////////////////////////////////////////////////////////////////////
-
- ///////////
- // Identity //
- ///////////
-
- // The real name used to construct the locale (ie: de-DE_phoneb)
- internal String CultureName
- {
- get
- {
- Debug.Assert(_sRealName != null, "[CultureData.CultureName] Expected _sRealName to be populated by already");
- // since windows doesn't know about zh-CHS and zh-CHT,
- // we leave sRealName == zh-Hanx but we still need to
- // pretend that it was zh-CHX.
- switch (_sName)
- {
- case "zh-CHS":
- case "zh-CHT":
- return _sName;
- }
- return _sRealName;
- }
- }
-
- // Are overrides enabled?
- internal bool UseUserOverride
- {
- get
- {
- return _bUseOverrides;
- }
- }
-
- // locale name (ie: de-DE, NO sort information)
- internal String SNAME
- {
- get
- {
- if (_sName == null)
- {
- _sName = String.Empty;
- }
- return _sName;
- }
- }
-
- // Parent name (which may be a custom locale/culture)
- internal String SPARENT
- {
- get
- {
- if (_sParent == null)
- {
- // Ask using the real name, so that we get parents of neutrals
- _sParent = GetLocaleInfo(_sRealName, LocaleStringData.ParentName);
- }
- return _sParent;
- }
- }
-
- // Localized pretty name for this locale (ie: Inglis (estados Unitos))
- internal String SLOCALIZEDDISPLAYNAME
- {
- get
- {
- if (_sLocalizedDisplayName == null)
- {
- if (this.IsSupplementalCustomCulture)
- {
- if (this.IsNeutralCulture)
- {
- _sLocalizedDisplayName = this.SNATIVELANGUAGE;
- }
- else
- {
- _sLocalizedDisplayName = this.SNATIVEDISPLAYNAME;
- }
- }
- else
- {
- try
- {
- const string ZH_CHT = "zh-CHT";
- const string ZH_CHS = "zh-CHS";
-
- if (SNAME.Equals(ZH_CHT, StringComparison.OrdinalIgnoreCase))
- {
- _sLocalizedDisplayName = GetLanguageDisplayName("zh-Hant");
- }
- else if (SNAME.Equals(ZH_CHS, StringComparison.OrdinalIgnoreCase))
- {
- _sLocalizedDisplayName = GetLanguageDisplayName("zh-Hans");
- }
- else
- {
- _sLocalizedDisplayName = GetLanguageDisplayName(SNAME);
- }
- }
- catch (Exception)
- {
- // do nothing
- }
- }
- // If it hasn't been found (Windows 8 and up), fallback to the system
- if (String.IsNullOrEmpty(_sLocalizedDisplayName))
- {
- // If its neutral use the language name
- if (this.IsNeutralCulture)
- {
- _sLocalizedDisplayName = this.SLOCALIZEDLANGUAGE;
- }
- else
- {
- // Usually the UI culture shouldn't be different than what we got from WinRT except
- // if DefaultThreadCurrentUICulture was set
- CultureInfo ci;
-
- if (CultureInfo.DefaultThreadCurrentUICulture != null &&
- ((ci = GetUserDefaultCulture()) != null) &&
- !CultureInfo.DefaultThreadCurrentUICulture.Name.Equals(ci.Name))
- {
- _sLocalizedDisplayName = this.SNATIVEDISPLAYNAME;
- }
- else
- {
- _sLocalizedDisplayName = GetLocaleInfo(LocaleStringData.LocalizedDisplayName);
- }
- }
- }
- }
-
- return _sLocalizedDisplayName;
- }
- }
-
- // English pretty name for this locale (ie: English (United States))
- internal String SENGDISPLAYNAME
- {
- get
- {
- if (_sEnglishDisplayName == null)
- {
- // If its neutral use the language name
- if (this.IsNeutralCulture)
- {
- _sEnglishDisplayName = this.SENGLISHLANGUAGE;
- // differentiate the legacy display names
- switch (_sName)
- {
- case "zh-CHS":
- case "zh-CHT":
- _sEnglishDisplayName += " Legacy";
- break;
- }
- }
- else
- {
- _sEnglishDisplayName = GetLocaleInfo(LocaleStringData.EnglishDisplayName);
-
- // if it isn't found build one:
- if (String.IsNullOrEmpty(_sEnglishDisplayName))
- {
- // Our existing names mostly look like:
- // "English" + "United States" -> "English (United States)"
- // "Azeri (Latin)" + "Azerbaijan" -> "Azeri (Latin, Azerbaijan)"
- if (this.SENGLISHLANGUAGE[this.SENGLISHLANGUAGE.Length - 1] == ')')
- {
- // "Azeri (Latin)" + "Azerbaijan" -> "Azeri (Latin, Azerbaijan)"
- _sEnglishDisplayName =
- this.SENGLISHLANGUAGE.Substring(0, _sEnglishLanguage.Length - 1) +
- ", " + this.SENGCOUNTRY + ")";
- }
- else
- {
- // "English" + "United States" -> "English (United States)"
- _sEnglishDisplayName = this.SENGLISHLANGUAGE + " (" + this.SENGCOUNTRY + ")";
- }
- }
- }
- }
- return _sEnglishDisplayName;
- }
- }
-
- // Native pretty name for this locale (ie: Deutsch (Deutschland))
- internal String SNATIVEDISPLAYNAME
- {
- get
- {
- if (_sNativeDisplayName == null)
- {
- // If its neutral use the language name
- if (this.IsNeutralCulture)
- {
- _sNativeDisplayName = this.SNATIVELANGUAGE;
- // differentiate the legacy display names
- switch (_sName)
- {
- case "zh-CHS":
- _sNativeDisplayName += " \u65E7\u7248";
- break;
- case "zh-CHT":
- _sNativeDisplayName += " \u820A\u7248";
- break;
- }
- }
- else
- {
- _sNativeDisplayName = GetLocaleInfo(LocaleStringData.NativeDisplayName);
-
- // if it isn't found build one:
- if (String.IsNullOrEmpty(_sNativeDisplayName))
- {
- // These should primarily be "Deutsch (Deutschland)" type names
- _sNativeDisplayName = this.SNATIVELANGUAGE + " (" + this.SNATIVECOUNTRY + ")";
- }
- }
- }
- return _sNativeDisplayName;
- }
- }
-
- // The culture name to be used in CultureInfo.CreateSpecificCulture()
- internal string SSPECIFICCULTURE
- {
- get
- {
- // This got populated during the culture initialization
- Debug.Assert(_sSpecificCulture != null, "[CultureData.SSPECIFICCULTURE] Expected this.sSpecificCulture to be populated by culture data initialization already");
- return _sSpecificCulture;
- }
- }
-
- /////////////
- // Language //
- /////////////
-
- // iso 639 language name, ie: en
- internal String SISO639LANGNAME
- {
- get
- {
- if (_sISO639Language == null)
- {
- _sISO639Language = GetLocaleInfo(LocaleStringData.Iso639LanguageTwoLetterName);
- }
- return _sISO639Language;
- }
- }
-
- // iso 639 language name, ie: eng
- internal string SISO639LANGNAME2
- {
- get
- {
- if (_sISO639Language2 == null)
- {
- _sISO639Language2 = GetLocaleInfo(LocaleStringData.Iso639LanguageThreeLetterName);
- }
- return _sISO639Language2;
- }
- }
-
- // abbreviated windows language name (ie: enu) (non-standard, avoid this)
- internal string SABBREVLANGNAME
- {
- get
- {
- if (_sAbbrevLang == null)
- {
- _sAbbrevLang = GetThreeLetterWindowsLanguageName(_sRealName);
- }
- return _sAbbrevLang;
- }
- }
-
- // Localized name for this language (Windows Only) ie: Inglis
- // This is only valid for Windows 8 and higher neutrals:
- internal String SLOCALIZEDLANGUAGE
- {
- get
- {
- if (_sLocalizedLanguage == null)
- {
- // Usually the UI culture shouldn't be different than what we got from WinRT except
- // if DefaultThreadCurrentUICulture was set
- CultureInfo ci;
-
- if (CultureInfo.DefaultThreadCurrentUICulture != null &&
- ((ci = GetUserDefaultCulture()) != null) &&
- !CultureInfo.DefaultThreadCurrentUICulture.Name.Equals(ci.Name))
- {
- _sLocalizedLanguage = SNATIVELANGUAGE;
- }
- else
- {
- _sLocalizedLanguage = GetLocaleInfo(LocaleStringData.LocalizedLanguageName);
- }
- }
-
- return _sLocalizedLanguage;
- }
- }
-
- // English name for this language (Windows Only) ie: German
- internal String SENGLISHLANGUAGE
- {
- get
- {
- if (_sEnglishLanguage == null)
- {
- _sEnglishLanguage = GetLocaleInfo(LocaleStringData.EnglishLanguageName);
- }
- return _sEnglishLanguage;
- }
- }
-
- // Native name of this language (Windows Only) ie: Deutsch
- internal String SNATIVELANGUAGE
- {
- get
- {
- if (_sNativeLanguage == null)
- {
- _sNativeLanguage = GetLocaleInfo(LocaleStringData.NativeLanguageName);
- }
- return _sNativeLanguage;
- }
- }
-
- ///////////
- // Region //
- ///////////
-
- // region name (eg US)
- internal String SREGIONNAME
- {
- get
- {
- if (_sRegionName == null)
- {
- _sRegionName = GetLocaleInfo(LocaleStringData.Iso3166CountryName);
- }
- return _sRegionName;
- }
- }
-
- internal int IGEOID
- {
- get
- {
- if (_iGeoId == undef)
- {
- _iGeoId = GetGeoId(_sRealName);
- }
- return _iGeoId;
- }
- }
-
- // localized name for the country
- internal string SLOCALIZEDCOUNTRY
- {
- get
- {
- if (_sLocalizedCountry == null)
- {
- try
- {
- _sLocalizedCountry = GetRegionDisplayName(SISO3166CTRYNAME);
- }
- catch (Exception)
- {
- // do nothing. we'll fallback
- }
-
- if (_sLocalizedCountry == null)
- {
- _sLocalizedCountry = SNATIVECOUNTRY;
- }
- }
- return _sLocalizedCountry;
- }
- }
-
- // english country name (RegionInfo) ie: Germany
- internal String SENGCOUNTRY
- {
- get
- {
- if (_sEnglishCountry == null)
- {
- _sEnglishCountry = GetLocaleInfo(LocaleStringData.EnglishCountryName);
- }
- return _sEnglishCountry;
- }
- }
-
- // native country name (RegionInfo) ie: Deutschland
- internal String SNATIVECOUNTRY
- {
- get
- {
- if (_sNativeCountry == null)
- {
- _sNativeCountry = GetLocaleInfo(LocaleStringData.NativeCountryName);
- }
- return _sNativeCountry;
- }
- }
-
- // ISO 3166 Country Name
- internal String SISO3166CTRYNAME
- {
- get
- {
- if (_sISO3166CountryName == null)
- {
- _sISO3166CountryName = GetLocaleInfo(LocaleStringData.Iso3166CountryName);
- }
- return _sISO3166CountryName;
- }
- }
-
- // 3 letter ISO 3166 country code
- internal String SISO3166CTRYNAME2
- {
- get
- {
- if (_sISO3166CountryName2 == null)
- {
- _sISO3166CountryName2 = GetLocaleInfo(LocaleStringData.Iso3166CountryName2);
- }
- return _sISO3166CountryName2;
- }
- }
-
- internal int IINPUTLANGUAGEHANDLE
- {
- get
- {
- if (_iInputLanguageHandle == undef)
- {
- if (IsSupplementalCustomCulture)
- {
- _iInputLanguageHandle = 0x0409;
- }
- else
- {
- // Input Language is same as LCID for built-in cultures
- _iInputLanguageHandle = this.ILANGUAGE;
- }
- }
- return _iInputLanguageHandle;
- }
- }
-
- // Console fallback name (ie: locale to use for console apps for unicode-only locales)
- internal string SCONSOLEFALLBACKNAME
- {
- get
- {
- if (_sConsoleFallbackName == null)
- {
- _sConsoleFallbackName = GetConsoleFallbackName(_sRealName);
- }
- return _sConsoleFallbackName;
- }
- }
-
- // (user can override) grouping of digits
- internal int[] WAGROUPING
- {
- get
- {
- if (_waGrouping == null)
- {
- _waGrouping = GetLocaleInfo(LocaleGroupingData.Digit);
- }
- return _waGrouping;
- }
- }
-
-
- // internal String sDecimalSeparator ; // (user can override) decimal separator
- // internal String sThousandSeparator ; // (user can override) thousands separator
-
- // Not a Number
- internal String SNAN
- {
- get
- {
- if (_sNaN == null)
- {
- _sNaN = GetLocaleInfo(LocaleStringData.NaNSymbol);
- }
- return _sNaN;
- }
- }
-
- // + Infinity
- internal String SPOSINFINITY
- {
- get
- {
- if (_sPositiveInfinity == null)
- {
- _sPositiveInfinity = GetLocaleInfo(LocaleStringData.PositiveInfinitySymbol);
- }
- return _sPositiveInfinity;
- }
- }
-
- // - Infinity
- internal String SNEGINFINITY
- {
- get
- {
- if (_sNegativeInfinity == null)
- {
- _sNegativeInfinity = GetLocaleInfo(LocaleStringData.NegativeInfinitySymbol);
- }
- return _sNegativeInfinity;
- }
- }
-
-
- ////////////
- // Percent //
- ///////////
-
- // Negative Percent (0-3)
- internal int INEGATIVEPERCENT
- {
- get
- {
- if (_iNegativePercent == undef)
- {
- // Note that <= Windows Vista this is synthesized by native code
- _iNegativePercent = GetLocaleInfo(LocaleNumberData.NegativePercentFormat);
- }
- return _iNegativePercent;
- }
- }
-
- // Positive Percent (0-11)
- internal int IPOSITIVEPERCENT
- {
- get
- {
- if (_iPositivePercent == undef)
- {
- // Note that <= Windows Vista this is synthesized by native code
- _iPositivePercent = GetLocaleInfo(LocaleNumberData.PositivePercentFormat);
- }
- return _iPositivePercent;
- }
- }
-
- // Percent (%) symbol
- internal String SPERCENT
- {
- get
- {
- if (_sPercent == null)
- {
- _sPercent = GetLocaleInfo(LocaleStringData.PercentSymbol);
- }
- return _sPercent;
- }
- }
-
- // PerMille symbol
- internal String SPERMILLE
- {
- get
- {
- if (_sPerMille == null)
- {
- _sPerMille = GetLocaleInfo(LocaleStringData.PerMilleSymbol);
- }
- return _sPerMille;
- }
- }
-
- /////////////
- // Currency //
- /////////////
-
- // (user can override) local monetary symbol, eg: $
- internal String SCURRENCY
- {
- get
- {
- if (_sCurrency == null)
- {
- _sCurrency = GetLocaleInfo(LocaleStringData.MonetarySymbol);
- }
- return _sCurrency;
- }
- }
-
- // international monetary symbol (RegionInfo), eg: USD
- internal String SINTLSYMBOL
- {
- get
- {
- if (_sIntlMonetarySymbol == null)
- {
- _sIntlMonetarySymbol = GetLocaleInfo(LocaleStringData.Iso4217MonetarySymbol);
- }
- return _sIntlMonetarySymbol;
- }
- }
-
- // English name for this currency (RegionInfo), eg: US Dollar
- internal String SENGLISHCURRENCY
- {
- get
- {
- if (_sEnglishCurrency == null)
- {
- _sEnglishCurrency = GetLocaleInfo(LocaleStringData.CurrencyEnglishName);
- }
- return _sEnglishCurrency;
- }
- }
-
- // Native name for this currency (RegionInfo), eg: Schweiz Frank
- internal String SNATIVECURRENCY
- {
- get
- {
- if (_sNativeCurrency == null)
- {
- _sNativeCurrency = GetLocaleInfo(LocaleStringData.CurrencyNativeName);
- }
- return _sNativeCurrency;
- }
- }
-
- // internal int iCurrencyDigits ; // (user can override) # local monetary fractional digits
- // internal int iCurrency ; // (user can override) positive currency format
- // internal int iNegativeCurrency ; // (user can override) negative currency format
-
- // (user can override) monetary grouping of digits
- internal int[] WAMONGROUPING
- {
- get
- {
- if (_waMonetaryGrouping == null)
- {
- _waMonetaryGrouping = GetLocaleInfo(LocaleGroupingData.Monetary);
- }
- return _waMonetaryGrouping;
- }
- }
-
- // (user can override) system of measurement 0=metric, 1=US (RegionInfo)
- internal int IMEASURE
- {
- get
- {
- if (_iMeasure == undef)
- {
- _iMeasure = GetLocaleInfo(LocaleNumberData.MeasurementSystem);
- }
- return _iMeasure;
- }
- }
-
- // (user can override) list Separator
- internal String SLIST
- {
- get
- {
- if (_sListSeparator == null)
- {
- _sListSeparator = GetLocaleInfo(LocaleStringData.ListSeparator);
- }
- return _sListSeparator;
- }
- }
-
-
- ////////////////////////////
- // Calendar/Time (Gregorian) //
- ////////////////////////////
-
- // (user can override) AM designator
- internal String SAM1159
- {
- get
- {
- if (_sAM1159 == null)
- {
- _sAM1159 = GetLocaleInfo(LocaleStringData.AMDesignator);
- }
- return _sAM1159;
- }
- }
-
- // (user can override) PM designator
- internal String SPM2359
- {
- get
- {
- if (_sPM2359 == null)
- {
- _sPM2359 = GetLocaleInfo(LocaleStringData.PMDesignator);
- }
- return _sPM2359;
- }
- }
-
- // (user can override) time format
- internal String[] LongTimes
- {
- get
- {
- if (_saLongTimes == null)
- {
- String[] longTimes = GetTimeFormats();
- if (longTimes == null || longTimes.Length == 0)
- {
- _saLongTimes = Invariant._saLongTimes;
- }
- else
- {
- _saLongTimes = longTimes;
- }
- }
- return _saLongTimes;
- }
- }
-
- // short time format
- // Short times (derived from long times format)
- // TODO: NLS Arrowhead - On Windows 7 we should have short times so this isn't necessary
- internal String[] ShortTimes
- {
- get
- {
- if (_saShortTimes == null)
- {
- // Try to get the short times from the OS/culture.dll
- String[] shortTimes = null;
- shortTimes = GetShortTimeFormats();
-
- if (shortTimes == null || shortTimes.Length == 0)
- {
- //
- // If we couldn't find short times, then compute them from long times
- // (eg: CORECLR on < Win7 OS & fallback for missing culture.dll)
- //
- shortTimes = DeriveShortTimesFromLong();
- }
-
- /* The above logic doesn't make sense on Mac, since the OS can provide us a "short time pattern".
- * currently this is the 4th element in the array returned by LongTimes. We'll add this to our array
- * if it doesn't exist.
- */
- shortTimes = AdjustShortTimesForMac(shortTimes);
-
- // Found short times, use them
- _saShortTimes = shortTimes;
- }
- return _saShortTimes;
- }
- }
-
- private string[] AdjustShortTimesForMac(string[] shortTimes)
- {
- return shortTimes;
- }
-
- private string[] DeriveShortTimesFromLong()
- {
- // Our logic is to look for h,H,m,s,t. If we find an s, then we check the string
- // between it and the previous marker, if any. If its a short, unescaped separator,
- // then we don't retain that part.
- // We then check after the ss and remove anything before the next h,H,m,t...
- string[] shortTimes = new string[LongTimes.Length];
-
- for (int i = 0; i < LongTimes.Length; i++)
- {
- shortTimes[i] = StripSecondsFromPattern(LongTimes[i]);
- }
- return shortTimes;
- }
-
- private static string StripSecondsFromPattern(string time)
- {
- bool bEscape = false;
- int iLastToken = -1;
-
- // Find the seconds
- for (int j = 0; j < time.Length; j++)
- {
- // Change escape mode?
- if (time[j] == '\'')
- {
- // Continue
- bEscape = !bEscape;
- continue;
- }
-
- // See if there was a single \
- if (time[j] == '\\')
- {
- // Skip next char
- j++;
- continue;
- }
-
- if (bEscape)
- {
- continue;
- }
-
- switch (time[j])
- {
- // Check for seconds
- case 's':
- // Found seconds, see if there was something unescaped and short between
- // the last marker and the seconds. Windows says separator can be a
- // maximum of three characters (without null)
- // If 1st or last characters were ', then ignore it
- if ((j - iLastToken) <= 4 && (j - iLastToken) > 1 &&
- (time[iLastToken + 1] != '\'') &&
- (time[j - 1] != '\''))
- {
- // There was something there we want to remember
- if (iLastToken >= 0)
- {
- j = iLastToken + 1;
- }
- }
-
- bool containsSpace;
- int endIndex = GetIndexOfNextTokenAfterSeconds(time, j, out containsSpace);
-
- string sep;
-
- if (containsSpace)
- {
- sep = " ";
- }
- else
- {
- sep = "";
- }
-
- time = time.Substring(0, j) + sep + time.Substring(endIndex);
- break;
- case 'm':
- case 'H':
- case 'h':
- iLastToken = j;
- break;
- }
- }
- return time;
- }
-
- private static int GetIndexOfNextTokenAfterSeconds(string time, int index, out bool containsSpace)
- {
- bool bEscape = false;
- containsSpace = false;
- for (; index < time.Length; index++)
- {
- switch (time[index])
- {
- case '\'':
- bEscape = !bEscape;
- continue;
- case '\\':
- index++;
- if (time[index] == ' ')
- {
- containsSpace = true;
- }
- continue;
- case ' ':
- containsSpace = true;
- break;
- case 't':
- case 'm':
- case 'H':
- case 'h':
- if (bEscape)
- {
- continue;
- }
- return index;
- }
- }
- containsSpace = false;
- return index;
- }
-
- // (user can override) first day of week
- internal int IFIRSTDAYOFWEEK
- {
- get
- {
- if (_iFirstDayOfWeek == undef)
- {
- _iFirstDayOfWeek = GetFirstDayOfWeek();
- }
- return _iFirstDayOfWeek;
- }
- }
-
- // (user can override) first week of year
- internal int IFIRSTWEEKOFYEAR
- {
- get
- {
- if (_iFirstWeekOfYear == undef)
- {
- _iFirstWeekOfYear = GetLocaleInfo(LocaleNumberData.FirstWeekOfYear);
- }
- return _iFirstWeekOfYear;
- }
- }
-
- // (user can override default only) short date format
- internal String[] ShortDates(CalendarId calendarId)
- {
- return GetCalendar(calendarId).saShortDates;
- }
-
- // (user can override default only) long date format
- internal String[] LongDates(CalendarId calendarId)
- {
- return GetCalendar(calendarId).saLongDates;
- }
-
- // (user can override) date year/month format.
- internal String[] YearMonths(CalendarId calendarId)
- {
- return GetCalendar(calendarId).saYearMonths;
- }
-
- // day names
- internal string[] DayNames(CalendarId calendarId)
- {
- return GetCalendar(calendarId).saDayNames;
- }
-
- // abbreviated day names
- internal string[] AbbreviatedDayNames(CalendarId calendarId)
- {
- // Get abbreviated day names for this calendar from the OS if necessary
- return GetCalendar(calendarId).saAbbrevDayNames;
- }
-
- // The super short day names
- internal string[] SuperShortDayNames(CalendarId calendarId)
- {
- return GetCalendar(calendarId).saSuperShortDayNames;
- }
-
- // month names
- internal string[] MonthNames(CalendarId calendarId)
- {
- return GetCalendar(calendarId).saMonthNames;
- }
-
- // Genitive month names
- internal string[] GenitiveMonthNames(CalendarId calendarId)
- {
- return GetCalendar(calendarId).saMonthGenitiveNames;
- }
-
- // month names
- internal string[] AbbreviatedMonthNames(CalendarId calendarId)
- {
- return GetCalendar(calendarId).saAbbrevMonthNames;
- }
-
- // Genitive month names
- internal string[] AbbreviatedGenitiveMonthNames(CalendarId calendarId)
- {
- return GetCalendar(calendarId).saAbbrevMonthGenitiveNames;
- }
-
- // Leap year month names
- // Note: This only applies to Hebrew, and it basically adds a "1" to the 6th month name
- // the non-leap names skip the 7th name in the normal month name array
- internal string[] LeapYearMonthNames(CalendarId calendarId)
- {
- return GetCalendar(calendarId).saLeapYearMonthNames;
- }
-
- // month/day format (single string, no override)
- internal String MonthDay(CalendarId calendarId)
- {
- return GetCalendar(calendarId).sMonthDay;
- }
-
-
-
- /////////////
- // Calendars //
- /////////////
-
- // all available calendar type(s), The first one is the default calendar.
- internal CalendarId[] CalendarIds
- {
- get
- {
- if (_waCalendars == null)
- {
- // We pass in an array of ints, and native side fills it up with count calendars.
- // We then have to copy that list to a new array of the right size.
- // Default calendar should be first
- CalendarId[] calendars = new CalendarId[23];
- Debug.Assert(_sWindowsName != null, "[CultureData.CalendarIds] Expected _sWindowsName to be populated by already");
- int count = CalendarData.GetCalendars(_sWindowsName, _bUseOverrides, calendars);
-
- // See if we had a calendar to add.
- if (count == 0)
- {
- // Failed for some reason, just grab Gregorian from Invariant
- _waCalendars = Invariant._waCalendars;
- }
- else
- {
- // The OS may not return calendar 4 for zh-TW, but we've always allowed it.
- // TODO: Is this hack necessary long-term?
- if (_sWindowsName == "zh-TW")
- {
- bool found = false;
-
- // Do we need to insert calendar 4?
- for (int i = 0; i < count; i++)
- {
- // Stop if we found calendar four
- if (calendars[i] == CalendarId.TAIWAN)
- {
- found = true;
- break;
- }
- }
-
- // If not found then insert it
- if (!found)
- {
- // Insert it as the 2nd calendar
- count++;
- // Copy them from the 2nd position to the end, -1 for skipping 1st, -1 for one being added.
- Array.Copy(calendars, 1, calendars, 2, 23 - 1 - 1);
- calendars[1] = CalendarId.TAIWAN;
- }
- }
-
- // It worked, remember the list
- CalendarId[] temp = new CalendarId[count];
- Array.Copy(calendars, temp, count);
-
- // Want 1st calendar to be default
- // Prior to Vista the enumeration didn't have default calendar first
- if (temp.Length > 1)
- {
- CalendarId i = (CalendarId)GetLocaleInfo(LocaleNumberData.CalendarType);
- if (temp[1] == i)
- {
- temp[1] = temp[0];
- temp[0] = i;
- }
- }
-
- _waCalendars = temp;
- }
- }
-
- return _waCalendars;
- }
- }
-
- // Native calendar names. index of optional calendar - 1, empty if no optional calendar at that number
- internal string CalendarName(CalendarId calendarId)
- {
- // Get the calendar
- return GetCalendar(calendarId).sNativeName;
- }
-
- internal CalendarData GetCalendar(CalendarId calendarId)
- {
- Debug.Assert(calendarId > 0 && calendarId <= CalendarId.LAST_CALENDAR,
- "[CultureData.GetCalendar] Expect calendarId to be in a valid range");
-
- // arrays are 0 based, calendarIds are 1 based
- int calendarIndex = (int)calendarId - 1;
-
- // Have to have calendars
- if (_calendars == null)
- {
- _calendars = new CalendarData[CalendarData.MAX_CALENDARS];
- }
-
- // we need the following local variable to avoid returning null
- // when another thread creates a new array of CalendarData (above)
- // right after we insert the newly created CalendarData (below)
- CalendarData calendarData = _calendars[calendarIndex];
- // Make sure that calendar has data
- if (calendarData == null)
- {
- Debug.Assert(_sWindowsName != null, "[CultureData.GetCalendar] Expected _sWindowsName to be populated by already");
- calendarData = new CalendarData(_sWindowsName, calendarId, this.UseUserOverride);
- _calendars[calendarIndex] = calendarData;
- }
-
- return calendarData;
- }
-
- ///////////////////
- // Text Information //
- ///////////////////
-
- // IsRightToLeft
- internal bool IsRightToLeft
- {
- get
- {
- // Returns one of the following 4 reading layout values:
- // 0 - Left to right (eg en-US)
- // 1 - Right to left (eg arabic locales)
- // 2 - Vertical top to bottom with columns to the left and also left to right (ja-JP locales)
- // 3 - Vertical top to bottom with columns proceeding to the right
- return (this.IREADINGLAYOUT == 1);
- }
- }
-
- // IREADINGLAYOUT
- // Returns one of the following 4 reading layout values:
- // 0 - Left to right (eg en-US)
- // 1 - Right to left (eg arabic locales)
- // 2 - Vertical top to bottom with columns to the left and also left to right (ja-JP locales)
- // 3 - Vertical top to bottom with columns proceeding to the right
- //
- // If exposed as a public API, we'd have an enum with those 4 values
- private int IREADINGLAYOUT
- {
- get
- {
- if (_iReadingLayout == undef)
- {
- Debug.Assert(_sRealName != null, "[CultureData.IsRightToLeft] Expected _sRealName to be populated by already");
- _iReadingLayout = GetLocaleInfo(LocaleNumberData.ReadingLayout);
- }
-
- return (_iReadingLayout);
- }
- }
-
- // The TextInfo name never includes that alternate sort and is always specific
- // For customs, it uses the SortLocale (since the textinfo is not exposed in Win7)
- // en -> en-US
- // en-US -> en-US
- // fj (custom neutral) -> en-US (assuming that en-US is the sort locale for fj)
- // fj_FJ (custom specific) -> en-US (assuming that en-US is the sort locale for fj-FJ)
- // es-ES_tradnl -> es-ES
- internal String STEXTINFO // Text info name to use for text information
- {
- get
- {
- // Note: Custom cultures might point at another culture's textinfo, however windows knows how
- // to redirect it to the desired textinfo culture, so this is OK.
- Debug.Assert(_sRealName != null, "[CultureData.STEXTINFO] Expected _sRealName to be populated by already");
- return (_sRealName);
- }
- }
-
- // Compare info name (including sorting key) to use if custom
- internal String SCOMPAREINFO
- {
- get
- {
- Debug.Assert(_sRealName != null, "[CultureData.SCOMPAREINFO] Expected _sRealName to be populated by already");
- return (_sRealName);
- }
- }
-
- internal bool IsSupplementalCustomCulture
- {
- get
- {
- return IsCustomCultureId(this.ILANGUAGE);
- }
- }
-
- internal int IDEFAULTANSICODEPAGE // default ansi code page ID (ACP)
- {
- get
- {
- if (_iDefaultAnsiCodePage == undef)
- {
- _iDefaultAnsiCodePage = GetAnsiCodePage(_sRealName);
- }
- return _iDefaultAnsiCodePage;
- }
- }
-
- internal int IDEFAULTOEMCODEPAGE // default oem code page ID (OCP or OEM)
- {
- get
- {
- if (_iDefaultOemCodePage == undef)
- {
- _iDefaultOemCodePage = GetOemCodePage(_sRealName);
- }
- return _iDefaultOemCodePage;
- }
- }
-
- internal int IDEFAULTMACCODEPAGE // default macintosh code page
- {
- get
- {
- if (_iDefaultMacCodePage == undef)
- {
- _iDefaultMacCodePage = GetMacCodePage(_sRealName);
- }
- return _iDefaultMacCodePage;
- }
- }
-
- internal int IDEFAULTEBCDICCODEPAGE // default EBCDIC code page
- {
- get
- {
- if (_iDefaultEbcdicCodePage == undef)
- {
- _iDefaultEbcdicCodePage = GetEbcdicCodePage(_sRealName);
- }
- return _iDefaultEbcdicCodePage;
- }
- }
-
- internal int ILANGUAGE
- {
- get
- {
- if (_iLanguage == 0)
- {
- Debug.Assert(_sRealName != null, "[CultureData.ILANGUAGE] Expected this.sRealName to be populated by COMNlsInfo::nativeInitCultureData already");
- _iLanguage = LocaleNameToLCID(_sRealName);
- }
- return _iLanguage;
- }
- }
-
- internal bool IsNeutralCulture
- {
- get
- {
- // InitCultureData told us if we're neutral or not
- return _bNeutral;
- }
- }
-
- internal bool IsInvariantCulture
- {
- get
- {
- return String.IsNullOrEmpty(this.SNAME);
- }
- }
-
- // Get an instance of our default calendar
- internal Calendar DefaultCalendar
- {
- get
- {
- CalendarId defaultCalId = (CalendarId)GetLocaleInfo(LocaleNumberData.CalendarType);
-
- if (defaultCalId == 0)
- {
- defaultCalId = this.CalendarIds[0];
- }
-
- return CultureInfo.GetCalendarInstance(defaultCalId);
- }
- }
-
- // All of our era names
- internal String[] EraNames(CalendarId calendarId)
- {
- Debug.Assert(calendarId > 0, "[CultureData.saEraNames] Expected Calendar.ID > 0");
-
- return this.GetCalendar(calendarId).saEraNames;
- }
-
- internal String[] AbbrevEraNames(CalendarId calendarId)
- {
- Debug.Assert(calendarId > 0, "[CultureData.saAbbrevEraNames] Expected Calendar.ID > 0");
-
- return this.GetCalendar(calendarId).saAbbrevEraNames;
- }
-
- internal String[] AbbreviatedEnglishEraNames(CalendarId calendarId)
- {
- Debug.Assert(calendarId > 0, "[CultureData.saAbbrevEraNames] Expected Calendar.ID > 0");
-
- return this.GetCalendar(calendarId).saAbbrevEnglishEraNames;
- }
-
- //// String array DEFAULTS
- //// Note: GetDTFIOverrideValues does the user overrides for these, so we don't have to.
-
-
- // Time separator (derived from time format)
- internal String TimeSeparator
- {
- get
- {
- if (_sTimeSeparator == null)
- {
- string longTimeFormat = GetTimeFormatString();
- if (String.IsNullOrEmpty(longTimeFormat))
- {
- longTimeFormat = LongTimes[0];
- }
-
- // Compute STIME from time format
- _sTimeSeparator = GetTimeSeparator(longTimeFormat);
- }
- return _sTimeSeparator;
- }
- }
-
- // Date separator (derived from short date format)
- internal String DateSeparator(CalendarId calendarId)
- {
- return GetDateSeparator(ShortDates(calendarId)[0]);
- }
-
- //////////////////////////////////////
- // Helper Functions to get derived properties //
- //////////////////////////////////////
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Unescape a NLS style quote string
- //
- // This removes single quotes:
- // 'fred' -> fred
- // 'fred -> fred
- // fred' -> fred
- // fred's -> freds
- //
- // This removes the first \ of escaped characters:
- // fred\'s -> fred's
- // a\\b -> a\b
- // a\b -> ab
- //
- // We don't build the stringbuilder unless we find a ' or a \. If we find a ' or a \, we
- // always build a stringbuilder because we need to remove the ' or \.
- //
- ////////////////////////////////////////////////////////////////////////////
- private static String UnescapeNlsString(String str, int start, int end)
- {
- Debug.Assert(str != null);
- Debug.Assert(start >= 0);
- Debug.Assert(end >= 0);
- StringBuilder result = null;
-
- for (int i = start; i < str.Length && i <= end; i++)
- {
- switch (str[i])
- {
- case '\'':
- if (result == null)
- {
- result = new StringBuilder(str, start, i - start, str.Length);
- }
- break;
- case '\\':
- if (result == null)
- {
- result = new StringBuilder(str, start, i - start, str.Length);
- }
- ++i;
- if (i < str.Length)
- {
- result.Append(str[i]);
- }
- break;
- default:
- if (result != null)
- {
- result.Append(str[i]);
- }
- break;
- }
- }
-
- if (result == null)
- return (str.Substring(start, end - start + 1));
-
- return (result.ToString());
- }
-
- private static String GetTimeSeparator(String format)
- {
- // Time format separator (ie: : in 12:39:00)
- //
- // We calculate this from the provided time format
- //
-
- //
- // Find the time separator so that we can pretend we know STIME.
- //
- return GetSeparator(format, "Hhms");
- }
-
- private static String GetDateSeparator(String format)
- {
- // Date format separator (ie: / in 9/1/03)
- //
- // We calculate this from the provided short date
- //
-
- //
- // Find the date separator so that we can pretend we know SDATE.
- //
- return GetSeparator(format, "dyM");
- }
-
- private static string GetSeparator(string format, string timeParts)
- {
- int index = IndexOfTimePart(format, 0, timeParts);
-
- if (index != -1)
- {
- // Found a time part, find out when it changes
- char cTimePart = format[index];
-
- do
- {
- index++;
- } while (index < format.Length && format[index] == cTimePart);
-
- int separatorStart = index;
-
- // Now we need to find the end of the separator
- if (separatorStart < format.Length)
- {
- int separatorEnd = IndexOfTimePart(format, separatorStart, timeParts);
- if (separatorEnd != -1)
- {
- // From [separatorStart, count) is our string, except we need to unescape
- return UnescapeNlsString(format, separatorStart, separatorEnd - 1);
- }
- }
- }
-
- return String.Empty;
- }
-
- private static int IndexOfTimePart(string format, int startIndex, string timeParts)
- {
- Debug.Assert(startIndex >= 0, "startIndex cannot be negative");
- Debug.Assert(timeParts.IndexOfAny(new char[] { '\'', '\\' }) == -1, "timeParts cannot include quote characters");
- bool inQuote = false;
- for (int i = startIndex; i < format.Length; ++i)
- {
- // See if we have a time Part
- if (!inQuote && timeParts.IndexOf(format[i]) != -1)
- {
- return i;
- }
- switch (format[i])
- {
- case '\\':
- if (i + 1 < format.Length)
- {
- ++i;
- switch (format[i])
- {
- case '\'':
- case '\\':
- break;
- default:
- --i; //backup since we will move over this next
- break;
- }
- }
- break;
- case '\'':
- inQuote = !inQuote;
- break;
- }
- }
-
- return -1;
- }
-
- internal static bool IsCustomCultureId(int cultureId)
- {
- return (cultureId == CultureInfo.LOCALE_CUSTOM_DEFAULT || cultureId == CultureInfo.LOCALE_CUSTOM_UNSPECIFIED);
- }
-
- internal void GetNFIValues(NumberFormatInfo nfi)
- {
- if (this.IsInvariantCulture)
- {
- // FUTURE: NumberFormatInfo already has default values for many of these fields. Can we not do this?
- nfi.positiveSign = _sPositiveSign;
- nfi.negativeSign = _sNegativeSign;
-
- nfi.numberGroupSeparator = _sThousandSeparator;
- nfi.numberDecimalSeparator = _sDecimalSeparator;
- nfi.numberDecimalDigits = _iDigits;
- nfi.numberNegativePattern = _iNegativeNumber;
-
- nfi.currencySymbol = _sCurrency;
- nfi.currencyGroupSeparator = _sMonetaryThousand;
- nfi.currencyDecimalSeparator = _sMonetaryDecimal;
- nfi.currencyDecimalDigits = _iCurrencyDigits;
- nfi.currencyNegativePattern = _iNegativeCurrency;
- nfi.currencyPositivePattern = _iCurrency;
- }
- else
- {
- Debug.Assert(_sWindowsName != null, "[CultureData.GetNFIValues] Expected _sWindowsName to be populated by already");
- // String values
- nfi.positiveSign = GetLocaleInfo(LocaleStringData.PositiveSign);
- nfi.negativeSign = GetLocaleInfo(LocaleStringData.NegativeSign);
-
- nfi.numberDecimalSeparator = GetLocaleInfo(LocaleStringData.DecimalSeparator);
- nfi.numberGroupSeparator = GetLocaleInfo(LocaleStringData.ThousandSeparator);
- nfi.currencyGroupSeparator = GetLocaleInfo(LocaleStringData.MonetaryThousandSeparator);
- nfi.currencyDecimalSeparator = GetLocaleInfo(LocaleStringData.MonetaryDecimalSeparator);
- nfi.currencySymbol = GetLocaleInfo(LocaleStringData.MonetarySymbol);
-
- // Numeric values
- nfi.numberDecimalDigits = GetLocaleInfo(LocaleNumberData.FractionalDigitsCount);
- nfi.currencyDecimalDigits = GetLocaleInfo(LocaleNumberData.MonetaryFractionalDigitsCount);
- nfi.currencyPositivePattern = GetLocaleInfo(LocaleNumberData.PositiveMonetaryNumberFormat);
- nfi.currencyNegativePattern = GetLocaleInfo(LocaleNumberData.NegativeMonetaryNumberFormat);
- nfi.numberNegativePattern = GetLocaleInfo(LocaleNumberData.NegativeNumberFormat);
-
- // LOCALE_SNATIVEDIGITS (array of 10 single character strings).
- string digits = GetLocaleInfo(LocaleStringData.Digits);
- nfi.nativeDigits = new string[10];
- for (int i = 0; i < nfi.nativeDigits.Length; i++)
- {
- nfi.nativeDigits[i] = new string(digits[i], 1);
- }
-
- nfi.digitSubstitution = GetDigitSubstitution(_sRealName);
- }
-
- //
- // Gather additional data
- //
- nfi.numberGroupSizes = this.WAGROUPING;
- nfi.currencyGroupSizes = this.WAMONGROUPING;
-
- // prefer the cached value since these do not have user overrides
- nfi.percentNegativePattern = this.INEGATIVEPERCENT;
- nfi.percentPositivePattern = this.IPOSITIVEPERCENT;
- nfi.percentSymbol = this.SPERCENT;
- nfi.perMilleSymbol = this.SPERMILLE;
-
- nfi.negativeInfinitySymbol = this.SNEGINFINITY;
- nfi.positiveInfinitySymbol = this.SPOSINFINITY;
- nfi.nanSymbol = this.SNAN;
-
- //
- // We don't have percent values, so use the number values
- //
- nfi.percentDecimalDigits = nfi.numberDecimalDigits;
- nfi.percentDecimalSeparator = nfi.numberDecimalSeparator;
- nfi.percentGroupSizes = nfi.numberGroupSizes;
- nfi.percentGroupSeparator = nfi.numberGroupSeparator;
-
- //
- // Clean up a few odd values
- //
-
- // Windows usually returns an empty positive sign, but we like it to be "+"
- if (nfi.positiveSign == null || nfi.positiveSign.Length == 0) nfi.positiveSign = "+";
-
- //Special case for Italian. The currency decimal separator in the control panel is the empty string. When the user
- //specifies C4 as the currency format, this results in the number apparently getting multiplied by 10000 because the
- //decimal point doesn't show up. We'll just hack this here because our default currency format will never use nfi.
- if (nfi.currencyDecimalSeparator == null || nfi.currencyDecimalSeparator.Length == 0)
- {
- nfi.currencyDecimalSeparator = nfi.numberDecimalSeparator;
- }
- }
-
- // Helper
- // This is ONLY used for caching names and shouldn't be used for anything else
- internal static string AnsiToLower(string testString)
- {
- int index = 0;
-
- while (index<testString.Length && (testString[index]<'A' || testString[index]>'Z' ))
- {
- index++;
- }
- if (index >= testString.Length)
- {
- return testString; // we didn't really change the string
- }
-
- StringBuilder sb = new StringBuilder(testString.Length);
- for (int i=0; i<index; i++)
- {
- sb.Append(testString[i]);
- }
-
- sb.Append((char) (testString[index] -'A' + 'a'));
-
- for (int ich = index+1; ich < testString.Length; ich++)
- {
- char ch = testString[ich];
- sb.Append(ch <= 'Z' && ch >= 'A' ? (char)(ch - 'A' + 'a') : ch);
- }
-
- return (sb.ToString());
- }
-
- /// <remarks>
- /// The numeric values of the enum members match their Win32 counterparts. The CultureData Win32 PAL implementation
- /// takes a dependency on this fact, in order to prevent having to construct a mapping from internal values to LCTypes.
- /// </remarks>
- private enum LocaleStringData : uint
- {
- /// <summary>localized name of locale, eg "German (Germany)" in UI language (coresponds to LOCALE_SLOCALIZEDDISPLAYNAME)</summary>
- LocalizedDisplayName = 0x00000002,
- /// <summary>Display name (language + country usually) in English, eg "German (Germany)" (coresponds to LOCALE_SENGLISHDISPLAYNAME)</summary>
- EnglishDisplayName = 0x00000072,
- /// <summary>Display name in native locale language, eg "Deutsch (Deutschland) (coresponds to LOCALE_SNATIVEDISPLAYNAME)</summary>
- NativeDisplayName = 0x00000073,
- /// <summary>Language Display Name for a language, eg "German" in UI language (coresponds to LOCALE_SLOCALIZEDLANGUAGENAME)</summary>
- LocalizedLanguageName = 0x0000006f,
- /// <summary>English name of language, eg "German" (coresponds to LOCALE_SENGLISHLANGUAGENAME)</summary>
- EnglishLanguageName = 0x00001001,
- /// <summary>native name of language, eg "Deutsch" (coresponds to LOCALE_SNATIVELANGUAGENAME)</summary>
- NativeLanguageName = 0x00000004,
- /// <summary>localized name of country, eg "Germany" in UI language (coresponds to LOCALE_SLOCALIZEDCOUNTRYNAME)</summary>
- LocalizedCountryName = 0x00000006,
- /// <summary>English name of country, eg "Germany" (coresponds to LOCALE_SENGLISHCOUNTRYNAME)</summary>
- EnglishCountryName = 0x00001002,
- /// <summary>native name of country, eg "Deutschland" (coresponds to LOCALE_SNATIVECOUNTRYNAME)</summary>
- NativeCountryName = 0x00000008,
- /// <summary>abbreviated language name (coresponds to LOCALE_SABBREVLANGNAME)</summary>
- AbbreviatedWindowsLanguageName = 0x00000003,
- /// <summary>list item separator (coresponds to LOCALE_SLIST)</summary>
- ListSeparator = 0x0000000C,
- /// <summary>decimal separator (coresponds to LOCALE_SDECIMAL)</summary>
- DecimalSeparator = 0x0000000E,
- /// <summary>thousand separator (coresponds to LOCALE_STHOUSAND)</summary>
- ThousandSeparator = 0x0000000F,
- /// <summary>digit grouping (coresponds to LOCALE_SGROUPING)</summary>
- Digits = 0x00000013,
- /// <summary>local monetary symbol (coresponds to LOCALE_SCURRENCY)</summary>
- MonetarySymbol = 0x00000014,
- /// <summary>English currency name (coresponds to LOCALE_SENGCURRNAME)</summary>
- CurrencyEnglishName = 0x00001007,
- /// <summary>Native currency name (coresponds to LOCALE_SNATIVECURRNAME)</summary>
- CurrencyNativeName = 0x00001008,
- /// <summary>uintl monetary symbol (coresponds to LOCALE_SINTLSYMBOL)</summary>
- Iso4217MonetarySymbol = 0x00000015,
- /// <summary>monetary decimal separator (coresponds to LOCALE_SMONDECIMALSEP)</summary>
- MonetaryDecimalSeparator = 0x00000016,
- /// <summary>monetary thousand separator (coresponds to LOCALE_SMONTHOUSANDSEP)</summary>
- MonetaryThousandSeparator = 0x00000017,
- /// <summary>AM designator (coresponds to LOCALE_S1159)</summary>
- AMDesignator = 0x00000028,
- /// <summary>PM designator (coresponds to LOCALE_S2359)</summary>
- PMDesignator = 0x00000029,
- /// <summary>positive sign (coresponds to LOCALE_SPOSITIVESIGN)</summary>
- PositiveSign = 0x00000050,
- /// <summary>negative sign (coresponds to LOCALE_SNEGATIVESIGN)</summary>
- NegativeSign = 0x00000051,
- /// <summary>ISO abbreviated language name (coresponds to LOCALE_SISO639LANGNAME)</summary>
- Iso639LanguageTwoLetterName = 0x00000059,
- /// <summary>ISO abbreviated country name (coresponds to LOCALE_SISO639LANGNAME2)</summary>
- Iso639LanguageThreeLetterName = 0x00000067,
- /// <summary>ISO abbreviated language name (coresponds to LOCALE_SISO639LANGNAME)</summary>
- Iso639LanguageName = 0x00000059,
- /// <summary>ISO abbreviated country name (coresponds to LOCALE_SISO3166CTRYNAME)</summary>
- Iso3166CountryName = 0x0000005A,
- /// <summary>3 letter ISO country code (coresponds to LOCALE_SISO3166CTRYNAME2)</summary>
- Iso3166CountryName2 = 0x00000068, // 3 character ISO country name
- /// <summary>Not a Number (coresponds to LOCALE_SNAN)</summary>
- NaNSymbol = 0x00000069,
- /// <summary>+ Infinity (coresponds to LOCALE_SPOSINFINITY)</summary>
- PositiveInfinitySymbol = 0x0000006a,
- /// <summary>- Infinity (coresponds to LOCALE_SNEGINFINITY)</summary>
- NegativeInfinitySymbol = 0x0000006b,
- /// <summary>Fallback name for resources (coresponds to LOCALE_SPARENT)</summary>
- ParentName = 0x0000006d,
- /// <summary>Fallback name for within the console (coresponds to LOCALE_SCONSOLEFALLBACKNAME)</summary>
- ConsoleFallbackName = 0x0000006e,
- /// <summary>Returns the percent symbol (coresponds to LOCALE_SPERCENT)</summary>
- PercentSymbol = 0x00000076,
- /// <summary>Returns the permille (U+2030) symbol (coresponds to LOCALE_SPERMILLE)</summary>
- PerMilleSymbol = 0x00000077
- }
-
- /// <remarks>
- /// The numeric values of the enum members match their Win32 counterparts. The CultureData Win32 PAL implementation
- /// takes a dependency on this fact, in order to prevent having to construct a mapping from internal values to LCTypes.
- /// </remarks>
- private enum LocaleGroupingData : uint
- {
- /// <summary>digit grouping (coresponds to LOCALE_SGROUPING)</summary>
- Digit = 0x00000010,
- /// <summary>monetary grouping (coresponds to LOCALE_SMONGROUPING)</summary>
- Monetary = 0x00000018,
- }
-
- /// <remarks>
- /// The numeric values of the enum members match their Win32 counterparts. The CultureData Win32 PAL implementation
- /// takes a dependency on this fact, in order to prevent having to construct a mapping from internal values to LCTypes.
- /// </remarks>
- private enum LocaleNumberData : uint
- {
- /// <summary>language id (coresponds to LOCALE_ILANGUAGE)</summary>
- LanguageId = 0x00000001,
- /// <summary>geographical location id, (coresponds to LOCALE_IGEOID)</summary>
- GeoId = 0x00000008,
- /// <summary>0 = context, 1 = none, 2 = national (coresponds to LOCALE_IDIGITSUBSTITUTION)</summary>
- DigitSubstitution = 0x00001014,
- /// <summary>0 = metric, 1 = US (coresponds to LOCALE_IMEASURE)</summary>
- MeasurementSystem = 0x0000000D,
- /// <summary>number of fractional digits (coresponds to LOCALE_IDIGITS)</summary>
- FractionalDigitsCount = 0x00000011,
- /// <summary>negative number mode (coresponds to LOCALE_INEGNUMBER)</summary>
- NegativeNumberFormat = 0x00001010,
- /// <summary># local monetary digits (coresponds to LOCALE_ICURRDIGITS)</summary>
- MonetaryFractionalDigitsCount = 0x00000019,
- /// <summary>positive currency mode (coresponds to LOCALE_ICURRENCY)</summary>
- PositiveMonetaryNumberFormat = 0x0000001B,
- /// <summary>negative currency mode (coresponds to LOCALE_INEGCURR)</summary>
- NegativeMonetaryNumberFormat = 0x0000001C,
- /// <summary>type of calendar specifier (coresponds to LOCALE_ICALENDARTYPE)</summary>
- CalendarType = 0x00001009,
- /// <summary>first day of week specifier (coresponds to LOCALE_IFIRSTDAYOFWEEK)</summary>
- FirstDayOfWeek = 0x0000100C,
- /// <summary>first week of year specifier (coresponds to LOCALE_IFIRSTWEEKOFYEAR)</summary>
- FirstWeekOfYear = 0x0000100D,
- /// <summary>
- /// Returns one of the following 4 reading layout values:
- /// 0 - Left to right (eg en-US)
- /// 1 - Right to left (eg arabic locales)
- /// 2 - Vertical top to bottom with columns to the left and also left to right (ja-JP locales)
- /// 3 - Vertical top to bottom with columns proceeding to the right
- /// (coresponds to LOCALE_IREADINGLAYOUT)
- /// </summary>
- ReadingLayout = 0x00000070,
- /// <summary>Returns 0-11 for the negative percent format (coresponds to LOCALE_INEGATIVEPERCENT)</summary>
- NegativePercentFormat = 0x00000074,
- /// <summary>Returns 0-3 for the positive percent format (coresponds to LOCALE_IPOSITIVEPERCENT)</summary>
- PositivePercentFormat = 0x00000075,
- /// <summary>default ansi code page (coresponds to LOCALE_IDEFAULTCODEPAGE)</summary>
- OemCodePage = 0x0000000B,
- /// <summary>default ansi code page (coresponds to LOCALE_IDEFAULTANSICODEPAGE)</summary>
- AnsiCodePage = 0x00001004,
- /// <summary>default mac code page (coresponds to LOCALE_IDEFAULTMACCODEPAGE)</summary>
- MacCodePage = 0x00001011,
- /// <summary>default ebcdic code page (coresponds to LOCALE_IDEFAULTEBCDICCODEPAGE)</summary>
- EbcdicCodePage = 0x00001012,
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CultureInfo.Unix.cs b/src/mscorlib/corefx/System/Globalization/CultureInfo.Unix.cs
deleted file mode 100644
index 6911688b08..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CultureInfo.Unix.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Globalization
-{
- public partial class CultureInfo : IFormatProvider
- {
- private static CultureInfo GetUserDefaultCultureCacheOverride()
- {
- return null; // ICU doesn't provide a user override
- }
-
- internal static CultureInfo GetUserDefaultCulture()
- {
- CultureInfo cultureInfo = null;
- string localeName;
- if (CultureData.GetDefaultLocaleName(out localeName))
- {
- cultureInfo = GetCultureByName(localeName, true);
- cultureInfo.m_isReadOnly = true;
- }
- else
- {
- cultureInfo = CultureInfo.InvariantCulture;
- }
-
- return cultureInfo;
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CultureInfo.Windows.cs b/src/mscorlib/corefx/System/Globalization/CultureInfo.Windows.cs
deleted file mode 100644
index c019eb2ceb..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CultureInfo.Windows.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#if ENABLE_WINRT
-using Internal.Runtime.Augments;
-#endif
-
-namespace System.Globalization
-{
- public partial class CultureInfo : IFormatProvider
- {
- /// <summary>
- /// Gets the default user culture from WinRT, if available.
- /// </summary>
- /// <remarks>
- /// This method may return null, if there is no default user culture or if WinRT isn't available.
- /// </remarks>
- private static CultureInfo GetUserDefaultCultureCacheOverride()
- {
-#if ENABLE_WINRT
- WinRTInteropCallbacks callbacks = WinRTInterop.UnsafeCallbacks;
- if (callbacks != null && callbacks.IsAppxModel())
- {
- return (CultureInfo)callbacks.GetUserDefaultCulture();
- }
-#endif
-
- return null;
- }
-
- internal static CultureInfo GetUserDefaultCulture()
- {
- const uint LOCALE_SNAME = 0x0000005c;
- const string LOCALE_NAME_USER_DEFAULT = null;
- const string LOCALE_NAME_SYSTEM_DEFAULT = "!x-sys-default-locale";
-
- string strDefault = Interop.mincore.GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME);
- if (strDefault == null)
- {
- strDefault = Interop.mincore.GetLocaleInfoEx(LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_SNAME);
-
- if (strDefault == null)
- {
- // If system default doesn't work, use invariant
- return CultureInfo.InvariantCulture;
- }
- }
-
- CultureInfo temp = GetCultureByName(strDefault, true);
-
- temp._isReadOnly = true;
-
- return temp;
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CultureInfo.cs b/src/mscorlib/corefx/System/Globalization/CultureInfo.cs
deleted file mode 100644
index da084d17f9..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CultureInfo.cs
+++ /dev/null
@@ -1,1558 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////
-//
-//
-//
-// Purpose: This class represents the software preferences of a particular
-// culture or community. It includes information such as the
-// language, writing system, and a calendar used by the culture
-// as well as methods for common operations such as printing
-// dates and sorting strings.
-//
-//
-//
-// !!!! NOTE WHEN CHANGING THIS CLASS !!!!
-//
-// If adding or removing members to this class, please update CultureInfoBaseObject
-// in ndp/clr/src/vm/object.h. Note, the "actual" layout of the class may be
-// different than the order in which members are declared. For instance, all
-// reference types will come first in the class before value types (like ints, bools, etc)
-// regardless of the order in which they are declared. The best way to see the
-// actual order of the class is to do a !dumpobj on an instance of the managed
-// object inside of the debugger.
-//
-////////////////////////////////////////////////////////////////////////////
-
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
-using System.Threading;
-
-namespace System.Globalization
-{
-
-#if INSIDE_CLR
- using StringCultureInfoDictionary = Dictionary<string, CultureInfo>;
- using StringLcidDictionary = Dictionary<int, CultureInfo>;
-
- using Lock = Object;
-#else
- using StringCultureInfoDictionary = LowLevelDictionary<string, CultureInfo>;
- using StringLcidDictionary = LowLevelDictionary<int, CultureInfo>;
-#endif
-
- [Serializable]
- public partial class CultureInfo : IFormatProvider, ICloneable
- {
- //--------------------------------------------------------------------//
- // Internal Information //
- //--------------------------------------------------------------------//
-
- //--------------------------------------------------------------------//
- // Data members to be serialized:
- //--------------------------------------------------------------------//
-
- // We use an RFC4646 type string to construct CultureInfo.
- // This string is stored in m_name and is authoritative.
- // We use the m_cultureData to get the data for our object
-
- private bool m_isReadOnly;
- private CompareInfo compareInfo;
- private TextInfo textInfo;
- internal NumberFormatInfo numInfo;
- internal DateTimeFormatInfo dateTimeInfo;
- private Calendar calendar;
- //
- // The CultureData instance that we are going to read data from.
- // For supported culture, this will be the CultureData instance that read data from mscorlib assembly.
- // For customized culture, this will be the CultureData instance that read data from user customized culture binary file.
- //
- [NonSerialized]
- internal CultureData m_cultureData;
-
- [NonSerialized]
- internal bool m_isInherited;
-
- [NonSerialized]
- private CultureInfo m_consoleFallbackCulture;
-
- // Names are confusing. Here are 3 names we have:
- //
- // new CultureInfo() m_name m_nonSortName m_sortName
- // en-US en-US en-US en-US
- // de-de_phoneb de-DE_phoneb de-DE de-DE_phoneb
- // fj-fj (custom) fj-FJ fj-FJ en-US (if specified sort is en-US)
- // en en
- //
- // Note that in Silverlight we ask the OS for the text and sort behavior, so the
- // textinfo and compareinfo names are the same as the name
-
- // Note that the name used to be serialized for Everett; it is now serialized
- // because alernate sorts can have alternate names.
- // This has a de-DE, de-DE_phoneb or fj-FJ style name
- internal string m_name;
-
- // This will hold the non sorting name to be returned from CultureInfo.Name property.
- // This has a de-DE style name even for de-DE_phoneb type cultures
- [NonSerialized]
- private string m_nonSortName;
-
- // This will hold the sorting name to be returned from CultureInfo.SortName property.
- // This might be completely unrelated to the culture name if a custom culture. Ie en-US for fj-FJ.
- // Otherwise its the sort name, ie: de-DE or de-DE_phoneb
- [NonSerialized]
- private string m_sortName;
-
- //--------------------------------------------------------------------//
- //
- // Static data members
- //
- //--------------------------------------------------------------------//
-
- //Get the current user default culture. This one is almost always used, so we create it by default.
- private static volatile CultureInfo s_userDefaultCulture;
-
- //
- // All of the following will be created on demand.
- //
-
- // WARNING: We allow diagnostic tools to directly inspect these three members (s_InvariantCultureInfo, s_DefaultThreadCurrentUICulture and s_DefaultThreadCurrentCulture)
- // See https://github.com/dotnet/corert/blob/master/Documentation/design-docs/diagnostics/diagnostics-tools-contract.md for more details.
- // Please do not change the type, the name, or the semantic usage of this member without understanding the implication for tools.
- // Get in touch with the diagnostics team if you have questions.
-
- //The Invariant culture;
- private static volatile CultureInfo s_InvariantCultureInfo;
-
- //These are defaults that we use if a thread has not opted into having an explicit culture
- private static volatile CultureInfo s_DefaultThreadCurrentUICulture;
- private static volatile CultureInfo s_DefaultThreadCurrentCulture;
-
- [ThreadStatic]
- private static volatile CultureInfo s_currentThreadCulture;
- [ThreadStatic]
- private static volatile CultureInfo s_currentThreadUICulture;
-
- private static readonly Lock m_lock = new Lock();
- private static volatile StringCultureInfoDictionary s_NameCachedCultures;
- private static volatile StringLcidDictionary s_LcidCachedCultures;
-
- //The parent culture.
- [NonSerialized]
- private CultureInfo m_parent;
-
- // LOCALE constants of interest to us internally and privately for LCID functions
- // (ie: avoid using these and use names if possible)
- internal const int LOCALE_NEUTRAL = 0x0000;
- private const int LOCALE_USER_DEFAULT = 0x0400;
- private const int LOCALE_SYSTEM_DEFAULT = 0x0800;
- internal const int LOCALE_CUSTOM_UNSPECIFIED = 0x1000;
- internal const int LOCALE_CUSTOM_DEFAULT = 0x0c00;
- internal const int LOCALE_INVARIANT = 0x007F;
-
- static AsyncLocal<CultureInfo> s_asyncLocalCurrentCulture;
- static AsyncLocal<CultureInfo> s_asyncLocalCurrentUICulture;
-
- static void AsyncLocalSetCurrentCulture(AsyncLocalValueChangedArgs<CultureInfo> args)
- {
- s_currentThreadCulture = args.CurrentValue;
- }
-
- static void AsyncLocalSetCurrentUICulture(AsyncLocalValueChangedArgs<CultureInfo> args)
- {
- s_currentThreadUICulture = args.CurrentValue;
- }
-
- //
- // The CultureData instance that reads the data provided by our CultureData class.
- //
- // Using a field initializer rather than a static constructor so that the whole class can be lazy
- // init.
- private static readonly bool init = Init();
- private static bool Init()
- {
- if (s_InvariantCultureInfo == null)
- {
- CultureInfo temp = new CultureInfo("", false);
- temp.m_isReadOnly = true;
- s_InvariantCultureInfo = temp;
- }
-
- s_userDefaultCulture = GetUserDefaultCulture();
- return true;
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // CultureInfo Constructors
- //
- ////////////////////////////////////////////////////////////////////////
-
-
- public CultureInfo(String name)
- : this(name, true)
- {
- }
-
-
- public CultureInfo(String name, bool useUserOverride)
- {
- if (name == null)
- {
- throw new ArgumentNullException(nameof(name),
- SR.ArgumentNull_String);
- }
-
- InitializeFromName(name, useUserOverride);
- }
-
- public CultureInfo(int culture) : this(culture, true)
- {
- }
-
- public CultureInfo(int culture, bool useUserOverride)
- {
- // We don't check for other invalid LCIDS here...
- if (culture < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(culture), SR.ArgumentOutOfRange_NeedPosNum);
- }
- Contract.EndContractBlock();
-
- InitializeFromCultureId(culture, useUserOverride);
- }
-
- private void InitializeFromCultureId(int culture, bool useUserOverride)
- {
- switch (culture)
- {
- case LOCALE_CUSTOM_DEFAULT:
- case LOCALE_SYSTEM_DEFAULT:
- case LOCALE_NEUTRAL:
- case LOCALE_USER_DEFAULT:
- case LOCALE_CUSTOM_UNSPECIFIED:
- // Can't support unknown custom cultures and we do not support neutral or
- // non-custom user locales.
- throw new CultureNotFoundException(nameof(culture), culture, SR.Argument_CultureNotSupported);
-
- default:
- // Now see if this LCID is supported in the system default CultureData table.
- m_cultureData = CultureData.GetCultureData(culture, useUserOverride);
- break;
- }
- m_isInherited = (this.GetType() != typeof(System.Globalization.CultureInfo));
- m_name = m_cultureData.CultureName;
- }
-
- private void InitializeFromName(string name, bool useUserOverride)
- {
- // Get our data providing record
- this.m_cultureData = CultureData.GetCultureData(name, useUserOverride);
-
- if (this.m_cultureData == null)
- {
- throw new CultureNotFoundException(nameof(name), name, SR.Argument_CultureNotSupported);
- }
-
- this.m_name = this.m_cultureData.CultureName;
- this.m_isInherited = (this.GetType() != typeof(System.Globalization.CultureInfo));
- }
-
- // Constructor called by SQL Server's special munged culture - creates a culture with
- // a TextInfo and CompareInfo that come from a supplied alternate source. This object
- // is ALWAYS read-only.
- // Note that we really cannot use an LCID version of this override as the cached
- // name we create for it has to include both names, and the logic for this is in
- // the GetCultureInfo override *only*.
- internal CultureInfo(String cultureName, String textAndCompareCultureName)
- {
- if (cultureName == null)
- {
- throw new ArgumentNullException(nameof(cultureName),SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
-
- m_cultureData = CultureData.GetCultureData(cultureName, false);
- if (m_cultureData == null)
- throw new CultureNotFoundException(nameof(cultureName), cultureName, SR.Argument_CultureNotSupported);
-
- m_name = m_cultureData.CultureName;
-
- CultureInfo altCulture = GetCultureInfo(textAndCompareCultureName);
- compareInfo = altCulture.CompareInfo;
- textInfo = altCulture.TextInfo;
- }
-
- // We do this to try to return the system UI language and the default user languages
- // This method will fallback if this fails (like Invariant)
- //
- // TODO: It would appear that this is only ever called with userOveride = true
- // and this method only has one caller. Can we fold it into the caller?
- private static CultureInfo GetCultureByName(String name, bool userOverride)
- {
- CultureInfo ci = null;
- // Try to get our culture
- try
- {
- ci = userOverride ? new CultureInfo(name) : CultureInfo.GetCultureInfo(name);
- }
- catch (ArgumentException)
- {
- }
-
- if (ci == null)
- {
- ci = InvariantCulture;
- }
-
- return ci;
- }
-
- //
- // Return a specific culture. A tad irrelevent now since we always return valid data
- // for neutral locales.
- //
- // Note that there's interesting behavior that tries to find a smaller name, ala RFC4647,
- // if we can't find a bigger name. That doesn't help with things like "zh" though, so
- // the approach is of questionable value
- //
- public static CultureInfo CreateSpecificCulture(String name)
- {
- Contract.Ensures(Contract.Result<CultureInfo>() != null);
-
- CultureInfo culture;
-
- try
- {
- culture = new CultureInfo(name);
- }
- catch (ArgumentException)
- {
- // When CultureInfo throws this exception, it may be because someone passed the form
- // like "az-az" because it came out of an http accept lang. We should try a little
- // parsing to perhaps fall back to "az" here and use *it* to create the neutral.
-
- int idx;
-
- culture = null;
- for (idx = 0; idx < name.Length; idx++)
- {
- if ('-' == name[idx])
- {
- try
- {
- culture = new CultureInfo(name.Substring(0, idx));
- break;
- }
- catch (ArgumentException)
- {
- // throw the original exception so the name in the string will be right
- throw;
- }
- }
- }
-
- if (culture == null)
- {
- // nothing to save here; throw the original exception
- throw;
- }
- }
-
- // In the most common case, they've given us a specific culture, so we'll just return that.
- if (!(culture.IsNeutralCulture))
- {
- return culture;
- }
-
- return (new CultureInfo(culture.m_cultureData.SSPECIFICCULTURE));
- }
-
- // //
- // // Return a specific culture. A tad irrelevent now since we always return valid data
- // // for neutral locales.
- // //
- // // Note that there's interesting behavior that tries to find a smaller name, ala RFC4647,
- // // if we can't find a bigger name. That doesn't help with things like "zh" though, so
- // // the approach is of questionable value
- // //
-
- internal static bool VerifyCultureName(String cultureName, bool throwException)
- {
- // This function is used by ResourceManager.GetResourceFileName().
- // ResourceManager searches for resource using CultureInfo.Name,
- // so we should check against CultureInfo.Name.
-
- for (int i = 0; i < cultureName.Length; i++)
- {
- char c = cultureName[i];
- // TODO: Names can only be RFC4646 names (ie: a-zA-Z0-9) while this allows any unicode letter/digit
- if (Char.IsLetterOrDigit(c) || c == '-' || c == '_')
- {
- continue;
- }
- if (throwException)
- {
- throw new ArgumentException(SR.Format(SR.Argument_InvalidResourceCultureName, cultureName));
- }
- return false;
- }
- return true;
- }
-
- internal static bool VerifyCultureName(CultureInfo culture, bool throwException)
- {
- //If we have an instance of one of our CultureInfos, the user can't have changed the
- //name and we know that all names are valid in files.
- if (!culture.m_isInherited)
- {
- return true;
- }
-
- return VerifyCultureName(culture.Name, throwException);
- }
-
- // We need to store the override from the culture data record.
- private bool m_useUserOverride;
-
- [OnSerializing]
- private void OnSerializing(StreamingContext ctx)
- {
- m_name = m_cultureData.CultureName;
- m_useUserOverride = m_cultureData.UseUserOverride;
- }
-
- [OnDeserialized]
- private void OnDeserialized(StreamingContext ctx)
- {
- Debug.Assert(m_name != null, "[CultureInfo.OnDeserialized] m_name != null");
- InitializeFromName(m_name, m_useUserOverride);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // CurrentCulture
- //
- // This instance provides methods based on the current user settings.
- // These settings are volatile and may change over the lifetime of the
- // thread.
- //
- ////////////////////////////////////////////////////////////////////////
-
- //
- // We use the following order to return CurrentCulture and CurrentUICulture
- // o Use WinRT to return the current user profile language
- // o use current thread culture if the user already set one using CurrentCulture/CurrentUICulture
- // o use thread culture if the user already set one using DefaultThreadCurrentCulture
- // or DefaultThreadCurrentUICulture
- // o Use NLS default user culture
- // o Use NLS default system culture
- // o Use Invariant culture
- //
- public static CultureInfo CurrentCulture
- {
- get
- {
- CultureInfo ci = GetUserDefaultCultureCacheOverride();
- if (ci != null)
- {
- return ci;
- }
-
- if (s_currentThreadCulture != null)
- {
- return s_currentThreadCulture;
- }
-
- ci = s_DefaultThreadCurrentCulture;
- if (ci != null)
- {
- return ci;
- }
-
- // if s_userDefaultCulture == null means CultureInfo statics didn't get initialized yet. this can happen if there early static
- // method get executed which eventually hit the cultureInfo code while CultureInfo statics didn’t get chance to initialize
- if (s_userDefaultCulture == null)
- {
- Init();
- }
-
- Debug.Assert(s_userDefaultCulture != null);
- return s_userDefaultCulture;
- }
-
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- if (s_asyncLocalCurrentCulture == null)
- {
- Interlocked.CompareExchange(ref s_asyncLocalCurrentCulture, new AsyncLocal<CultureInfo>(AsyncLocalSetCurrentCulture), null);
- }
- // this one will set s_currentThreadCulture too
- s_asyncLocalCurrentCulture.Value = value;
- }
- }
-
- public static CultureInfo CurrentUICulture
- {
- get
- {
- CultureInfo ci = GetUserDefaultCultureCacheOverride();
- if (ci != null)
- {
- return ci;
- }
-
- if (s_currentThreadUICulture != null)
- {
- return s_currentThreadUICulture;
- }
-
- ci = s_DefaultThreadCurrentUICulture;
- if (ci != null)
- {
- return ci;
- }
-
- // if s_userDefaultCulture == null means CultureInfo statics didn't get initialized yet. this can happen if there early static
- // method get executed which eventually hit the cultureInfo code while CultureInfo statics didn’t get chance to initialize
- if (s_userDefaultCulture == null)
- {
- Init();
- }
-
- Debug.Assert(s_userDefaultCulture != null);
- return s_userDefaultCulture;
- }
-
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- CultureInfo.VerifyCultureName(value, true);
-
- if (s_asyncLocalCurrentUICulture == null)
- {
- Interlocked.CompareExchange(ref s_asyncLocalCurrentUICulture, new AsyncLocal<CultureInfo>(AsyncLocalSetCurrentUICulture), null);
- }
-
- // this one will set s_currentThreadUICulture too
- s_asyncLocalCurrentUICulture.Value = value;
- }
- }
-
- public static CultureInfo InstalledUICulture
- {
- get
- {
- Contract.Ensures(Contract.Result<CultureInfo>() != null);
- if (s_userDefaultCulture == null)
- {
- Init();
- }
- Debug.Assert(s_userDefaultCulture != null, "[CultureInfo.InstalledUICulture] s_userDefaultCulture != null");
- return s_userDefaultCulture;
- }
- }
-
- public static CultureInfo DefaultThreadCurrentCulture
- {
- get { return s_DefaultThreadCurrentCulture; }
- set
- {
- // If you add pre-conditions to this method, check to see if you also need to
- // add them to Thread.CurrentCulture.set.
-
- s_DefaultThreadCurrentCulture = value;
- }
- }
-
- public static CultureInfo DefaultThreadCurrentUICulture
- {
- get { return s_DefaultThreadCurrentUICulture; }
- set
- {
- //If they're trying to use a Culture with a name that we can't use in resource lookup,
- //don't even let them set it on the thread.
-
- // If you add more pre-conditions to this method, check to see if you also need to
- // add them to Thread.CurrentUICulture.set.
-
- if (value != null)
- {
- CultureInfo.VerifyCultureName(value, true);
- }
-
- s_DefaultThreadCurrentUICulture = value;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // InvariantCulture
- //
- // This instance provides methods, for example for casing and sorting,
- // that are independent of the system and current user settings. It
- // should be used only by processes such as some system services that
- // require such invariant results (eg. file systems). In general,
- // the results are not linguistically correct and do not match any
- // culture info.
- //
- ////////////////////////////////////////////////////////////////////////
-
-
- public static CultureInfo InvariantCulture
- {
- get
- {
- return (s_InvariantCultureInfo);
- }
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Parent
- //
- // Return the parent CultureInfo for the current instance.
- //
- ////////////////////////////////////////////////////////////////////////
-
- public virtual CultureInfo Parent
- {
- get
- {
- if (null == m_parent)
- {
- try
- {
- string parentName = this.m_cultureData.SPARENT;
-
- if (String.IsNullOrEmpty(parentName))
- {
- m_parent = InvariantCulture;
- }
- else
- {
- m_parent = new CultureInfo(parentName, this.m_cultureData.UseUserOverride);
- }
- }
- catch (ArgumentException)
- {
- // For whatever reason our IPARENT or SPARENT wasn't correct, so use invariant
- // We can't allow ourselves to fail. In case of custom cultures the parent of the
- // current custom culture isn't installed.
- m_parent = InvariantCulture;
- }
- }
- return m_parent;
- }
- }
-
- public virtual int LCID
- {
- get
- {
- return (this.m_cultureData.ILANGUAGE);
- }
- }
-
- public virtual int KeyboardLayoutId
- {
- get
- {
- return m_cultureData.IINPUTLANGUAGEHANDLE;
- }
- }
-
- public static CultureInfo[] GetCultures(CultureTypes types)
- {
- Contract.Ensures(Contract.Result<CultureInfo[]>() != null);
- // internally we treat UserCustomCultures as Supplementals but v2
- // treats as Supplementals and Replacements
- if((types & CultureTypes.UserCustomCulture) == CultureTypes.UserCustomCulture)
- {
- types |= CultureTypes.ReplacementCultures;
- }
- return (CultureData.GetCultures(types));
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Name
- //
- // Returns the full name of the CultureInfo. The name is in format like
- // "en-US" This version does NOT include sort information in the name.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String Name
- {
- get
- {
- // We return non sorting name here.
- if (this.m_nonSortName == null)
- {
- this.m_nonSortName = this.m_cultureData.SNAME;
- if (this.m_nonSortName == null)
- {
- this.m_nonSortName = String.Empty;
- }
- }
- return this.m_nonSortName;
- }
- }
-
- // This one has the sort information (ie: de-DE_phoneb)
- internal String SortName
- {
- get
- {
- if (this.m_sortName == null)
- {
- this.m_sortName = this.m_cultureData.SCOMPAREINFO;
- }
-
- return this.m_sortName;
- }
- }
-
- public string IetfLanguageTag
- {
- get
- {
- Contract.Ensures(Contract.Result<string>() != null);
-
- // special case the compatibility cultures
- switch (this.Name)
- {
- case "zh-CHT":
- return "zh-Hant";
- case "zh-CHS":
- return "zh-Hans";
- default:
- return this.Name;
- }
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // DisplayName
- //
- // Returns the full name of the CultureInfo in the localized language.
- // For example, if the localized language of the runtime is Spanish and the CultureInfo is
- // US English, "Ingles (Estados Unidos)" will be returned.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String DisplayName
- {
- get
- {
- Contract.Ensures(Contract.Result<String>() != null);
- Debug.Assert(m_name != null, "[CultureInfo.DisplayName] Always expect m_name to be set");
-
- return m_cultureData.SLOCALIZEDDISPLAYNAME;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetNativeName
- //
- // Returns the full name of the CultureInfo in the native language.
- // For example, if the CultureInfo is US English, "English
- // (United States)" will be returned.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String NativeName
- {
- get
- {
- Contract.Ensures(Contract.Result<String>() != null);
- return (this.m_cultureData.SNATIVEDISPLAYNAME);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetEnglishName
- //
- // Returns the full name of the CultureInfo in English.
- // For example, if the CultureInfo is US English, "English
- // (United States)" will be returned.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String EnglishName
- {
- get
- {
- Contract.Ensures(Contract.Result<String>() != null);
- return (this.m_cultureData.SENGDISPLAYNAME);
- }
- }
-
- // ie: en
- public virtual String TwoLetterISOLanguageName
- {
- get
- {
- Contract.Ensures(Contract.Result<String>() != null);
- return (this.m_cultureData.SISO639LANGNAME);
- }
- }
-
- // ie: eng
- public virtual String ThreeLetterISOLanguageName
- {
- get
- {
- Contract.Ensures(Contract.Result<String>() != null);
- return m_cultureData.SISO639LANGNAME2;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ThreeLetterWindowsLanguageName
- //
- // Returns the 3 letter windows language name for the current instance. eg: "ENU"
- // The ISO names are much preferred
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String ThreeLetterWindowsLanguageName
- {
- get
- {
- Contract.Ensures(Contract.Result<String>() != null);
- return m_cultureData.SABBREVLANGNAME;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // CompareInfo Read-Only Property
- //
- // Gets the CompareInfo for this culture.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual CompareInfo CompareInfo
- {
- get
- {
- if (this.compareInfo == null)
- {
- // Since CompareInfo's don't have any overrideable properties, get the CompareInfo from
- // the Non-Overridden CultureInfo so that we only create one CompareInfo per culture
- CompareInfo temp = UseUserOverride
- ? GetCultureInfo(this.m_name).CompareInfo
- : new CompareInfo(this);
- if (OkayToCacheClassWithCompatibilityBehavior)
- {
- this.compareInfo = temp;
- }
- else
- {
- return temp;
- }
- }
- return (compareInfo);
- }
- }
-
- private static bool OkayToCacheClassWithCompatibilityBehavior
- {
- get
- {
- return true;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // TextInfo
- //
- // Gets the TextInfo for this culture.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual TextInfo TextInfo
- {
- get
- {
- if (textInfo == null)
- {
- // Make a new textInfo
- TextInfo tempTextInfo = new TextInfo(this.m_cultureData);
- tempTextInfo.SetReadOnlyState(m_isReadOnly);
-
- if (OkayToCacheClassWithCompatibilityBehavior)
- {
- textInfo = tempTextInfo;
- }
- else
- {
- return tempTextInfo;
- }
- }
- return (textInfo);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Equals
- //
- // Implements Object.Equals(). Returns a boolean indicating whether
- // or not object refers to the same CultureInfo as the current instance.
- //
- ////////////////////////////////////////////////////////////////////////
-
-
- public override bool Equals(Object value)
- {
- if (Object.ReferenceEquals(this, value))
- return true;
-
- CultureInfo that = value as CultureInfo;
-
- if (that != null)
- {
- // using CompareInfo to verify the data passed through the constructor
- // CultureInfo(String cultureName, String textAndCompareCultureName)
-
- return (this.Name.Equals(that.Name) && this.CompareInfo.Equals(that.CompareInfo));
- }
-
- return (false);
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetHashCode
- //
- // Implements Object.GetHashCode(). Returns the hash code for the
- // CultureInfo. The hash code is guaranteed to be the same for CultureInfo A
- // and B where A.Equals(B) is true.
- //
- ////////////////////////////////////////////////////////////////////////
-
- public override int GetHashCode()
- {
- return (this.Name.GetHashCode() + this.CompareInfo.GetHashCode());
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ToString
- //
- // Implements Object.ToString(). Returns the name of the CultureInfo,
- // eg. "de-DE_phoneb", "en-US", or "fj-FJ".
- //
- ////////////////////////////////////////////////////////////////////////
-
-
- public override String ToString()
- {
- return m_name;
- }
-
-
- public virtual Object GetFormat(Type formatType)
- {
- if (formatType == typeof(NumberFormatInfo))
- return (NumberFormat);
- if (formatType == typeof(DateTimeFormatInfo))
- return (DateTimeFormat);
- return (null);
- }
-
- public virtual bool IsNeutralCulture
- {
- get
- {
- return this.m_cultureData.IsNeutralCulture;
- }
- }
-
- public CultureTypes CultureTypes
- {
- get
- {
- CultureTypes types = 0;
-
- if (m_cultureData.IsNeutralCulture)
- types |= CultureTypes.NeutralCultures;
- else
- types |= CultureTypes.SpecificCultures;
-
- types |= m_cultureData.IsWin32Installed ? CultureTypes.InstalledWin32Cultures : 0;
-
-// Disable warning 618: System.Globalization.CultureTypes.FrameworkCultures' is obsolete
-#pragma warning disable 618
- types |= m_cultureData.IsFramework ? CultureTypes.FrameworkCultures : 0;
-
-#pragma warning restore 618
- types |= m_cultureData.IsSupplementalCustomCulture ? CultureTypes.UserCustomCulture : 0;
- types |= m_cultureData.IsReplacementCulture ? CultureTypes.ReplacementCultures | CultureTypes.UserCustomCulture : 0;
-
- return types;
- }
- }
-
- public virtual NumberFormatInfo NumberFormat
- {
- get
- {
- if (numInfo == null)
- {
- NumberFormatInfo temp = new NumberFormatInfo(this.m_cultureData);
- temp.isReadOnly = m_isReadOnly;
- Interlocked.CompareExchange(ref numInfo, temp, null);
- }
- return (numInfo);
- }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value), SR.ArgumentNull_Obj);
- }
- VerifyWritable();
- numInfo = value;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetDateTimeFormatInfo
- //
- // Create a DateTimeFormatInfo, and fill in the properties according to
- // the CultureID.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual DateTimeFormatInfo DateTimeFormat
- {
- get
- {
- if (dateTimeInfo == null)
- {
- // Change the calendar of DTFI to the specified calendar of this CultureInfo.
- DateTimeFormatInfo temp = new DateTimeFormatInfo(this.m_cultureData, this.Calendar);
- temp._isReadOnly = m_isReadOnly;
- Interlocked.CompareExchange(ref dateTimeInfo, temp, null);
- }
- return (dateTimeInfo);
- }
-
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value), SR.ArgumentNull_Obj);
- }
- VerifyWritable();
- dateTimeInfo = value;
- }
- }
-
- public void ClearCachedData()
- {
- s_userDefaultCulture = null;
-
- RegionInfo.s_currentRegionInfo = null;
- #pragma warning disable 0618 // disable the obsolete warning
- TimeZone.ResetTimeZone();
- #pragma warning restore 0618
- TimeZoneInfo.ClearCachedData();
- s_LcidCachedCultures = null;
- s_NameCachedCultures = null;
-
- CultureData.ClearCachedData();
- }
-
- /*=================================GetCalendarInstance==========================
- **Action: Map a Win32 CALID to an instance of supported calendar.
- **Returns: An instance of calendar.
- **Arguments: calType The Win32 CALID
- **Exceptions:
- ** Shouldn't throw exception since the calType value is from our data table or from Win32 registry.
- ** If we are in trouble (like getting a weird value from Win32 registry), just return the GregorianCalendar.
- ============================================================================*/
- internal static Calendar GetCalendarInstance(CalendarId calType)
- {
- if (calType == CalendarId.GREGORIAN)
- {
- return (new GregorianCalendar());
- }
- return GetCalendarInstanceRare(calType);
- }
-
- //This function exists as a shortcut to prevent us from loading all of the non-gregorian
- //calendars unless they're required.
- internal static Calendar GetCalendarInstanceRare(CalendarId calType)
- {
- Debug.Assert(calType != CalendarId.GREGORIAN, "calType!=CalendarId.GREGORIAN");
-
- switch (calType)
- {
- case CalendarId.GREGORIAN_US: // Gregorian (U.S.) calendar
- case CalendarId.GREGORIAN_ME_FRENCH: // Gregorian Middle East French calendar
- case CalendarId.GREGORIAN_ARABIC: // Gregorian Arabic calendar
- case CalendarId.GREGORIAN_XLIT_ENGLISH: // Gregorian Transliterated English calendar
- case CalendarId.GREGORIAN_XLIT_FRENCH: // Gregorian Transliterated French calendar
- return (new GregorianCalendar((GregorianCalendarTypes)calType));
- case CalendarId.TAIWAN: // Taiwan Era calendar
- return (new TaiwanCalendar());
- case CalendarId.JAPAN: // Japanese Emperor Era calendar
- return (new JapaneseCalendar());
- case CalendarId.KOREA: // Korean Tangun Era calendar
- return (new KoreanCalendar());
- case CalendarId.THAI: // Thai calendar
- return (new ThaiBuddhistCalendar());
- case CalendarId.HIJRI: // Hijri (Arabic Lunar) calendar
- return (new HijriCalendar());
- case CalendarId.HEBREW: // Hebrew (Lunar) calendar
- return (new HebrewCalendar());
- case CalendarId.UMALQURA:
- return (new UmAlQuraCalendar());
- case CalendarId.PERSIAN:
- return (new PersianCalendar());
- }
- return (new GregorianCalendar());
- }
-
- /*=================================Calendar==========================
- **Action: Return/set the default calendar used by this culture.
- ** This value can be overridden by regional option if this is a current culture.
- **Returns:
- **Arguments:
- **Exceptions:
- ** ArgumentNull_Obj if the set value is null.
- ============================================================================*/
- public virtual Calendar Calendar
- {
- get
- {
- if (calendar == null)
- {
- Debug.Assert(this.m_cultureData.CalendarIds.Length > 0, "this.m_cultureData.CalendarIds.Length > 0");
- // Get the default calendar for this culture. Note that the value can be
- // from registry if this is a user default culture.
- Calendar newObj = this.m_cultureData.DefaultCalendar;
-
- System.Threading.Interlocked.MemoryBarrier();
- newObj.SetReadOnlyState(m_isReadOnly);
- calendar = newObj;
- }
- return (calendar);
- }
- }
-
- /*=================================OptionCalendars==========================
- **Action: Return an array of the optional calendar for this culture.
- **Returns: an array of Calendar.
- **Arguments:
- **Exceptions:
- ============================================================================*/
-
-
- public virtual Calendar[] OptionalCalendars
- {
- get
- {
- Contract.Ensures(Contract.Result<Calendar[]>() != null);
-
- //
- // This property always returns a new copy of the calendar array.
- //
- CalendarId[] calID = this.m_cultureData.CalendarIds;
- Calendar[] cals = new Calendar[calID.Length];
- for (int i = 0; i < cals.Length; i++)
- {
- cals[i] = GetCalendarInstance(calID[i]);
- }
- return (cals);
- }
- }
-
- public bool UseUserOverride
- {
- get
- {
- return m_cultureData.UseUserOverride;
- }
- }
-
- public CultureInfo GetConsoleFallbackUICulture()
- {
- Contract.Ensures(Contract.Result<CultureInfo>() != null);
-
- CultureInfo temp = m_consoleFallbackCulture;
- if (temp == null)
- {
- temp = CreateSpecificCulture(m_cultureData.SCONSOLEFALLBACKNAME);
- temp.m_isReadOnly = true;
- m_consoleFallbackCulture = temp;
- }
- return (temp);
- }
-
- public virtual Object Clone()
- {
- CultureInfo ci = (CultureInfo)MemberwiseClone();
- ci.m_isReadOnly = false;
-
- //If this is exactly our type, we can make certain optimizations so that we don't allocate NumberFormatInfo or DTFI unless
- //they've already been allocated. If this is a derived type, we'll take a more generic codepath.
- if (!m_isInherited)
- {
- if (this.dateTimeInfo != null)
- {
- ci.dateTimeInfo = (DateTimeFormatInfo)this.dateTimeInfo.Clone();
- }
- if (this.numInfo != null)
- {
- ci.numInfo = (NumberFormatInfo)this.numInfo.Clone();
- }
- }
- else
- {
- ci.DateTimeFormat = (DateTimeFormatInfo)this.DateTimeFormat.Clone();
- ci.NumberFormat = (NumberFormatInfo)this.NumberFormat.Clone();
- }
-
- if (textInfo != null)
- {
- ci.textInfo = (TextInfo)textInfo.Clone();
- }
-
- if (calendar != null)
- {
- ci.calendar = (Calendar)calendar.Clone();
- }
-
- return (ci);
- }
-
- public static CultureInfo ReadOnly(CultureInfo ci)
- {
- if (ci == null)
- {
- throw new ArgumentNullException(nameof(ci));
- }
- Contract.Ensures(Contract.Result<CultureInfo>() != null);
- Contract.EndContractBlock();
-
- if (ci.IsReadOnly)
- {
- return (ci);
- }
- CultureInfo newInfo = (CultureInfo)(ci.MemberwiseClone());
-
- if (!ci.IsNeutralCulture)
- {
- //If this is exactly our type, we can make certain optimizations so that we don't allocate NumberFormatInfo or DTFI unless
- //they've already been allocated. If this is a derived type, we'll take a more generic codepath.
- if (!ci.m_isInherited)
- {
- if (ci.dateTimeInfo != null)
- {
- newInfo.dateTimeInfo = DateTimeFormatInfo.ReadOnly(ci.dateTimeInfo);
- }
- if (ci.numInfo != null)
- {
- newInfo.numInfo = NumberFormatInfo.ReadOnly(ci.numInfo);
- }
- }
- else
- {
- newInfo.DateTimeFormat = DateTimeFormatInfo.ReadOnly(ci.DateTimeFormat);
- newInfo.NumberFormat = NumberFormatInfo.ReadOnly(ci.NumberFormat);
- }
- }
-
- if (ci.textInfo != null)
- {
- newInfo.textInfo = TextInfo.ReadOnly(ci.textInfo);
- }
-
- if (ci.calendar != null)
- {
- newInfo.calendar = Calendar.ReadOnly(ci.calendar);
- }
-
- // Don't set the read-only flag too early.
- // We should set the read-only flag here. Otherwise, info.DateTimeFormat will not be able to set.
- newInfo.m_isReadOnly = true;
-
- return (newInfo);
- }
-
-
- public bool IsReadOnly
- {
- get
- {
- return (m_isReadOnly);
- }
- }
-
- private void VerifyWritable()
- {
- if (m_isReadOnly)
- {
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- }
- }
-
- // For resource lookup, we consider a culture the invariant culture by name equality.
- // We perform this check frequently during resource lookup, so adding a property for
- // improved readability.
- internal bool HasInvariantCultureName
- {
- get { return Name == CultureInfo.InvariantCulture.Name; }
- }
-
- // Helper function both both overloads of GetCachedReadOnlyCulture. If lcid is 0, we use the name.
- // If lcid is -1, use the altName and create one of those special SQL cultures.
- internal static CultureInfo GetCultureInfoHelper(int lcid, string name, string altName)
- {
- // retval is our return value.
- CultureInfo retval;
-
- // Temporary hashtable for the names.
- StringCultureInfoDictionary tempNameHT = s_NameCachedCultures;
-
- if (name != null)
- {
- name = CultureData.AnsiToLower(name);
- }
-
- if (altName != null)
- {
- altName = CultureData.AnsiToLower(altName);
- }
-
- // We expect the same result for both hashtables, but will test individually for added safety.
- if (tempNameHT == null)
- {
- tempNameHT = new StringCultureInfoDictionary();
- }
- else
- {
- // If we are called by name, check if the object exists in the hashtable. If so, return it.
- if (lcid == -1 || lcid == 0)
- {
- bool ret;
- lock (m_lock)
- {
- ret = tempNameHT.TryGetValue(lcid == 0 ? name : name + '\xfffd' + altName, out retval);
- }
-
- if (ret && retval != null)
- {
- return retval;
- }
- }
- }
-
- // Next, the Lcid table.
- StringLcidDictionary tempLcidHT = s_LcidCachedCultures;
-
- if (tempLcidHT == null)
- {
- // Case insensitive is not an issue here, save the constructor call.
- tempLcidHT = new StringLcidDictionary();
- }
- else
- {
- // If we were called by Lcid, check if the object exists in the table. If so, return it.
- if (lcid > 0)
- {
- bool ret;
- lock (m_lock)
- {
- ret = tempLcidHT.TryGetValue(lcid, out retval);
- }
- if (ret && retval != null)
- {
- return retval;
- }
- }
- }
-
- // We now have two temporary hashtables and the desired object was not found.
- // We'll construct it. We catch any exceptions from the constructor call and return null.
- try
- {
- switch (lcid)
- {
- case -1:
- // call the private constructor
- retval = new CultureInfo(name, altName);
- break;
-
- case 0:
- retval = new CultureInfo(name, false);
- break;
-
- default:
- retval = new CultureInfo(lcid, false);
- break;
- }
- }
- catch (ArgumentException)
- {
- return null;
- }
-
- // Set it to read-only
- retval.m_isReadOnly = true;
-
- if (lcid == -1)
- {
- lock (m_lock)
- {
- // This new culture will be added only to the name hash table.
- tempNameHT[name + '\xfffd' + altName] = retval;
- }
- // when lcid == -1 then TextInfo object is already get created and we need to set it as read only.
- retval.TextInfo.SetReadOnlyState(true);
- }
- else if (lcid == 0)
- {
- // Remember our name (as constructed). Do NOT use alternate sort name versions because
- // we have internal state representing the sort. (So someone would get the wrong cached version)
- string newName = CultureData.AnsiToLower(retval.m_name);
-
- // We add this new culture info object to both tables.
- lock (m_lock)
- {
- tempNameHT[newName] = retval;
- }
- }
- else
- {
- lock (m_lock)
- {
- tempLcidHT[lcid] = retval;
- }
- }
-
- // Copy the two hashtables to the corresponding member variables. This will potentially overwrite
- // new tables simultaneously created by a new thread, but maximizes thread safety.
- if (-1 != lcid)
- {
- // Only when we modify the lcid hash table, is there a need to overwrite.
- s_LcidCachedCultures = tempLcidHT;
- }
-
- s_NameCachedCultures = tempNameHT;
-
- // Finally, return our new CultureInfo object.
- return retval;
- }
-
- // Gets a cached copy of the specified culture from an internal hashtable (or creates it
- // if not found). (LCID version)... use named version
- public static CultureInfo GetCultureInfo(int culture)
- {
- // Must check for -1 now since the helper function uses the value to signal
- // the altCulture code path for SQL Server.
- // Also check for zero as this would fail trying to add as a key to the hash.
- if (culture <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(culture), SR.ArgumentOutOfRange_NeedPosNum);
- }
- Contract.Ensures(Contract.Result<CultureInfo>() != null);
- Contract.EndContractBlock();
- CultureInfo retval = GetCultureInfoHelper(culture, null, null);
- if (null == retval)
- {
- throw new CultureNotFoundException(nameof(culture), culture, SR.Argument_CultureNotSupported);
- }
- return retval;
- }
-
- // Gets a cached copy of the specified culture from an internal hashtable (or creates it
- // if not found). (Named version)
- public static CultureInfo GetCultureInfo(string name)
- {
- // Make sure we have a valid, non-zero length string as name
- if (name == null)
- {
- throw new ArgumentNullException(nameof(name));
- }
-
- CultureInfo retval = GetCultureInfoHelper(0, name, null);
- if (retval == null)
- {
- throw new CultureNotFoundException(
- nameof(name), name, SR.Argument_CultureNotSupported);
- }
- return retval;
- }
-
- // Gets a cached copy of the specified culture from an internal hashtable (or creates it
- // if not found).
- public static CultureInfo GetCultureInfo(string name, string altName)
- {
- // Make sure we have a valid, non-zero length string as name
- if (name == null)
- {
- throw new ArgumentNullException(nameof(name));
- }
-
- if (altName == null)
- {
- throw new ArgumentNullException(nameof(altName));
- }
-
- Contract.Ensures(Contract.Result<CultureInfo>() != null);
- Contract.EndContractBlock();
-
- CultureInfo retval = GetCultureInfoHelper(-1, name, altName);
- if (retval == null)
- {
- throw new CultureNotFoundException("name or altName",
- SR.Format(SR.Argument_OneOfCulturesNotSupported, name, altName));
- }
- return retval;
- }
-
- // This function is deprecated, we don't like it
- public static CultureInfo GetCultureInfoByIetfLanguageTag(string name)
- {
- Contract.Ensures(Contract.Result<CultureInfo>() != null);
-
- // Disallow old zh-CHT/zh-CHS names
- if (name == "zh-CHT" || name == "zh-CHS")
- {
- throw new CultureNotFoundException(nameof(name), SR.Format(SR.Argument_CultureIetfNotSupported, name));
- }
-
- CultureInfo ci = GetCultureInfo(name);
-
- // Disallow alt sorts and es-es_TS
- if (ci.LCID > 0xffff || ci.LCID == 0x040a)
- {
- throw new CultureNotFoundException(nameof(name), SR.Format(SR.Argument_CultureIetfNotSupported, name));
- }
-
- return ci;
- }
- }
-}
-
diff --git a/src/mscorlib/corefx/System/Globalization/CultureNotFoundException.cs b/src/mscorlib/corefx/System/Globalization/CultureNotFoundException.cs
deleted file mode 100644
index d296ad88e5..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CultureNotFoundException.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.Serialization;
-using System.Threading;
-
-namespace System.Globalization
-{
- [Serializable]
- public class CultureNotFoundException : ArgumentException, ISerializable
- {
- private string _invalidCultureName; // unrecognized culture name
- private int? _invalidCultureId; // unrecognized culture Lcid
-
- public CultureNotFoundException()
- : base(DefaultMessage)
- {
- }
-
- public CultureNotFoundException(String message)
- : base(message)
- {
- }
-
- public CultureNotFoundException(String paramName, String message)
- : base(message, paramName)
- {
- }
-
- public CultureNotFoundException(String message, Exception innerException)
- : base(message, innerException)
- {
- }
-
- public CultureNotFoundException(String paramName, string invalidCultureName, String message)
- : base(message, paramName)
- {
- _invalidCultureName = invalidCultureName;
- }
-
- public CultureNotFoundException(String message, string invalidCultureName, Exception innerException)
- : base(message, innerException)
- {
- _invalidCultureName = invalidCultureName;
- }
-
- public CultureNotFoundException(string message, int invalidCultureId, Exception innerException)
- : base(message, innerException)
- {
- _invalidCultureId = invalidCultureId;
- }
-
- public CultureNotFoundException(string paramName, int invalidCultureId, string message)
- : base(message, paramName)
- {
- _invalidCultureId = invalidCultureId;
- }
-
- protected CultureNotFoundException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- _invalidCultureId = (int?)info.GetValue("InvalidCultureId", typeof(int?));
- _invalidCultureName = (string)info.GetValue("InvalidCultureName", typeof(string));
- }
-
- public override void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- base.GetObjectData(info, context);
- info.AddValue("InvalidCultureId", _invalidCultureId, typeof(int?));
- info.AddValue("InvalidCultureName", _invalidCultureName, typeof(string));
- }
-
- public virtual Nullable<int> InvalidCultureId
- {
- get { return _invalidCultureId; }
- }
-
- public virtual string InvalidCultureName
- {
- get { return _invalidCultureName; }
- }
-
- private static String DefaultMessage
- {
- get
- {
- return SR.Argument_CultureNotSupported;
- }
- }
-
- private String FormatedInvalidCultureId
- {
- get
- {
- return InvalidCultureId != null ?
- String.Format(CultureInfo.InvariantCulture, "{0} (0x{0:x4})", (int)InvalidCultureId) :
- InvalidCultureName;
- }
- }
-
- public override String Message
- {
- get
- {
- String s = base.Message;
- if (_invalidCultureId != null || _invalidCultureName != null)
- {
- String valueMessage = SR.Format(SR.Argument_CultureInvalidIdentifier, FormatedInvalidCultureId);
- if (s == null)
- {
- return valueMessage;
- }
-
- return s + Environment.NewLine + valueMessage;
- }
- return s;
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/CultureTypes.cs b/src/mscorlib/corefx/System/Globalization/CultureTypes.cs
deleted file mode 100644
index 35ddff6086..0000000000
--- a/src/mscorlib/corefx/System/Globalization/CultureTypes.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-// The enumeration constants used in CultureInfo.GetCultures().
-// On Linux platforms, the only enum values used there is NeutralCultures and SpecificCultures
-// the rest are obsolete or not valid on Linux
-
-namespace System.Globalization
-{
- [Serializable]
- [Flags]
- public enum CultureTypes
- {
- NeutralCultures = 0x0001, // Neutral cultures are cultures like "en", "de", "zh", etc, for enumeration this includes ALL neutrals regardless of other flags
- SpecificCultures = 0x0002, // Non-netural cultuers. Examples are "en-us", "zh-tw", etc., for enumeration this includes ALL specifics regardless of other flags
- InstalledWin32Cultures = 0x0004, // Win32 installed cultures in the system and exists in the framework too., this is effectively all cultures
-
- AllCultures = NeutralCultures | SpecificCultures | InstalledWin32Cultures,
-
- UserCustomCulture = 0x0008, // User defined custom culture
- ReplacementCultures = 0x0010, // User defined replacement custom culture.
- [Obsolete("This value has been deprecated. Please use other values in CultureTypes.")]
- WindowsOnlyCultures = 0x0020, // this will always return empty list.
- [Obsolete("This value has been deprecated. Please use other values in CultureTypes.")]
- FrameworkCultures = 0x0040, // will return only the v2 cultures marked as Framework culture.
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/DateTimeFormatInfo.cs b/src/mscorlib/corefx/System/Globalization/DateTimeFormatInfo.cs
deleted file mode 100644
index b79ce90424..0000000000
--- a/src/mscorlib/corefx/System/Globalization/DateTimeFormatInfo.cs
+++ /dev/null
@@ -1,3087 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
-
-namespace System.Globalization
-{
- //
- // Flags used to indicate different styles of month names.
- // This is an internal flag used by internalGetMonthName().
- // Use flag here in case that we need to provide a combination of these styles
- // (such as month name of a leap year in genitive form. Not likely for now,
- // but would like to keep the option open).
- //
-
- [Flags]
- internal enum MonthNameStyles
- {
- Regular = 0x00000000,
- Genitive = 0x00000001,
- LeapYear = 0x00000002,
- }
-
- //
- // Flags used to indicate special rule used in parsing/formatting
- // for a specific DateTimeFormatInfo instance.
- // This is an internal flag.
- //
- // This flag is different from MonthNameStyles because this flag
- // can be expanded to accomodate parsing behaviors like CJK month names
- // or alternative month names, etc.
-
- [Flags]
- internal enum DateTimeFormatFlags
- {
- None = 0x00000000,
- UseGenitiveMonth = 0x00000001,
- UseLeapYearMonth = 0x00000002,
- UseSpacesInMonthNames = 0x00000004, // Has spaces or non-breaking space in the month names.
- UseHebrewRule = 0x00000008, // Format/Parse using the Hebrew calendar rule.
- UseSpacesInDayNames = 0x00000010, // Has spaces or non-breaking space in the day names.
- UseDigitPrefixInTokens = 0x00000020, // Has token starting with numbers.
-
- NotInitialized = -1,
- }
-
-
- [Serializable]
- public sealed class DateTimeFormatInfo : IFormatProvider, ICloneable
- {
- // cache for the invariant culture.
- // invariantInfo is constant irrespective of your current culture.
- private static volatile DateTimeFormatInfo s_invariantInfo;
-
- // an index which points to a record in Culture Data Table.
- [NonSerialized]
- private CultureData _cultureData;
-
- // The culture name used to create this DTFI.
-
- [OptionalField(VersionAdded = 2)]
- private String _name = null;
-
- // The language name of the culture used to create this DTFI.
- [NonSerialized]
- private String _langName = null;
-
- // CompareInfo usually used by the parser.
- [NonSerialized]
- private CompareInfo _compareInfo = null;
-
- // Culture matches current DTFI. mainly used for string comparisons during parsing.
- [NonSerialized]
- private CultureInfo _cultureInfo = null;
-
- //
- // Caches for various properties.
- //
-
- private String amDesignator = null;
- private String pmDesignator = null;
-
- private String dateSeparator = null; // derived from short date (whidbey expects, arrowhead doesn't)
-
- private String generalShortTimePattern = null; // short date + short time (whidbey expects, arrowhead doesn't)
-
- private String generalLongTimePattern = null; // short date + long time (whidbey expects, arrowhead doesn't)
-
- private String timeSeparator = null; // derived from long time (whidbey expects, arrowhead doesn't)
- private String monthDayPattern = null;
- // added in .NET Framework Release {2.0SP1/3.0SP1/3.5RTM}
- private String dateTimeOffsetPattern = null;
-
- //
- // The following are constant values.
- //
- private const String rfc1123Pattern = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
-
- // The sortable pattern is based on ISO 8601.
- private const String sortableDateTimePattern = "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
- private const String universalSortableDateTimePattern = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
-
- //
- // The following are affected by calendar settings.
- //
- private Calendar calendar = null;
-
- private int firstDayOfWeek = -1;
- private int calendarWeekRule = -1;
-
-
- private String fullDateTimePattern = null; // long date + long time (whidbey expects, arrowhead doesn't)
-
- private String[] abbreviatedDayNames = null;
-
-
- private String[] m_superShortDayNames = null;
-
- private String[] dayNames = null;
- private String[] abbreviatedMonthNames = null;
- private String[] monthNames = null;
- // Cache the genitive month names that we retrieve from the data table.
-
- private String[] genitiveMonthNames = null;
-
- // Cache the abbreviated genitive month names that we retrieve from the data table.
-
- private String[] m_genitiveAbbreviatedMonthNames = null;
-
- // Cache the month names of a leap year that we retrieve from the data table.
-
- private String[] leapYearMonthNames = null;
-
- // For our "patterns" arrays we have 2 variables, a string and a string[]
- //
- // The string[] contains the list of patterns, EXCEPT the default may not be included.
- // The string contains the default pattern.
- // When we initially construct our string[], we set the string to string[0]
-
- // The "default" Date/time patterns
- private String longDatePattern = null;
- private String shortDatePattern = null;
- private String yearMonthPattern = null;
- private String longTimePattern = null;
- private String shortTimePattern = null;
-
- [OptionalField(VersionAdded = 3)]
- private String[] allYearMonthPatterns = null;
-
- private String[] allShortDatePatterns = null;
- private String[] allLongDatePatterns = null;
- private String[] allShortTimePatterns = null;
- private String[] allLongTimePatterns = null;
-
- // Cache the era names for this DateTimeFormatInfo instance.
- private String[] m_eraNames = null;
- private String[] m_abbrevEraNames = null;
- private String[] m_abbrevEnglishEraNames = null;
-
- private CalendarId[] optionalCalendars = null;
-
- private const int DEFAULT_ALL_DATETIMES_SIZE = 132;
-
- // CultureInfo updates this
- internal bool _isReadOnly = false;
-
- // This flag gives hints about if formatting/parsing should perform special code path for things like
- // genitive form or leap year month names.
-
- private DateTimeFormatFlags formatFlags = DateTimeFormatFlags.NotInitialized;
-
- private String CultureName
- {
- get
- {
- if (_name == null)
- {
- _name = _cultureData.CultureName;
- }
- return (_name);
- }
- }
-
- private CultureInfo Culture
- {
- get
- {
- if (_cultureInfo == null)
- {
- _cultureInfo = CultureInfo.GetCultureInfo(this.CultureName);
- }
- return _cultureInfo;
- }
- }
-
- // TODO: This ignores other cultures that might want to do something similar
- private String LanguageName
- {
- get
- {
- if (_langName == null)
- {
- _langName = _cultureData.SISO639LANGNAME;
- }
- return (_langName);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Create an array of string which contains the abbreviated day names.
- //
- ////////////////////////////////////////////////////////////////////////////
-
- private String[] internalGetAbbreviatedDayOfWeekNames()
- {
- if (this.abbreviatedDayNames == null)
- {
- // Get the abbreviated day names for our current calendar
- this.abbreviatedDayNames = _cultureData.AbbreviatedDayNames(Calendar.ID);
- Debug.Assert(this.abbreviatedDayNames.Length == 7, "[DateTimeFormatInfo.GetAbbreviatedDayOfWeekNames] Expected 7 day names in a week");
- }
- return (this.abbreviatedDayNames);
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Action: Returns the string array of the one-letter day of week names.
- // Returns:
- // an array of one-letter day of week names
- // Arguments:
- // None
- // Exceptions:
- // None
- //
- ////////////////////////////////////////////////////////////////////////
-
- private String[] internalGetSuperShortDayNames()
- {
- if (this.m_superShortDayNames == null)
- {
- // Get the super short day names for our current calendar
- this.m_superShortDayNames = _cultureData.SuperShortDayNames(Calendar.ID);
- Debug.Assert(this.m_superShortDayNames.Length == 7, "[DateTimeFormatInfo.internalGetSuperShortDayNames] Expected 7 day names in a week");
- }
- return (this.m_superShortDayNames);
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Create an array of string which contains the day names.
- //
- ////////////////////////////////////////////////////////////////////////////
-
- private String[] internalGetDayOfWeekNames()
- {
- if (this.dayNames == null)
- {
- // Get the day names for our current calendar
- this.dayNames = _cultureData.DayNames(Calendar.ID);
- Debug.Assert(this.dayNames.Length == 7, "[DateTimeFormatInfo.GetDayOfWeekNames] Expected 7 day names in a week");
- }
- return (this.dayNames);
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Create an array of string which contains the abbreviated month names.
- //
- ////////////////////////////////////////////////////////////////////////////
-
- private String[] internalGetAbbreviatedMonthNames()
- {
- if (this.abbreviatedMonthNames == null)
- {
- // Get the month names for our current calendar
- this.abbreviatedMonthNames = _cultureData.AbbreviatedMonthNames(Calendar.ID);
- Debug.Assert(this.abbreviatedMonthNames.Length == 12 || this.abbreviatedMonthNames.Length == 13,
- "[DateTimeFormatInfo.GetAbbreviatedMonthNames] Expected 12 or 13 month names in a year");
- }
- return (this.abbreviatedMonthNames);
- }
-
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Create an array of string which contains the month names.
- //
- ////////////////////////////////////////////////////////////////////////////
-
- private String[] internalGetMonthNames()
- {
- if (this.monthNames == null)
- {
- // Get the month names for our current calendar
- this.monthNames = _cultureData.MonthNames(Calendar.ID);
- Debug.Assert(this.monthNames.Length == 12 || this.monthNames.Length == 13,
- "[DateTimeFormatInfo.GetMonthNames] Expected 12 or 13 month names in a year");
- }
-
- return (this.monthNames);
- }
-
-
- //
- // Invariant DateTimeFormatInfo doesn't have user-overriden values
- // Default calendar is gregorian
- public DateTimeFormatInfo()
- : this(CultureInfo.InvariantCulture.m_cultureData,
- GregorianCalendar.GetDefaultInstance())
- {
- }
-
- internal DateTimeFormatInfo(CultureData cultureData, Calendar cal)
- {
- Debug.Assert(cultureData != null);
- Debug.Assert(cal != null);
-
- // Remember our culture
- _cultureData = cultureData;
-
- this.Calendar = cal;
- }
-
- private void InitializeOverridableProperties(CultureData cultureData, CalendarId calendarId)
- {
- Debug.Assert(cultureData != null);
- Debug.Assert(calendarId != CalendarId.UNINITIALIZED_VALUE, "[DateTimeFormatInfo.Populate] Expected initalized calendarId");
-
- if (this.firstDayOfWeek == -1) { this.firstDayOfWeek = cultureData.IFIRSTDAYOFWEEK; }
- if (this.calendarWeekRule == -1) { this.calendarWeekRule = cultureData.IFIRSTWEEKOFYEAR; }
-
- if (this.amDesignator == null) { this.amDesignator = cultureData.SAM1159; }
- if (this.pmDesignator == null) { this.pmDesignator = cultureData.SPM2359; }
- if (this.timeSeparator == null) { this.timeSeparator = cultureData.TimeSeparator; }
- if (this.dateSeparator == null) { this.dateSeparator = cultureData.DateSeparator(calendarId); }
-
- this.allLongTimePatterns = _cultureData.LongTimes;
- Debug.Assert(this.allLongTimePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some long time patterns");
-
- this.allShortTimePatterns = _cultureData.ShortTimes;
- Debug.Assert(this.allShortTimePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some short time patterns");
-
- this.allLongDatePatterns = cultureData.LongDates(calendarId);
- Debug.Assert(this.allLongDatePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some long date patterns");
-
- this.allShortDatePatterns = cultureData.ShortDates(calendarId);
- Debug.Assert(this.allShortDatePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some short date patterns");
-
- this.allYearMonthPatterns = cultureData.YearMonths(calendarId);
- Debug.Assert(this.allYearMonthPatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some year month patterns");
- }
-
- [OptionalField(VersionAdded = 1)]
- private bool _useUserOverride;
-
- // This was synthesized by Whidbey so we knew what words might appear in the middle of a date string
- // Now we always synthesize so its not helpful
-
- internal String[] m_dateWords = null;
-
- [OnSerializing]
- private void OnSerializing(StreamingContext ctx)
- {
- _name = this.CultureName; // make sure the _name is initialized.
- _useUserOverride = _cultureData.UseUserOverride;
-
- // Important to initialize these fields otherwise we may run into exception when deserializing on Whidbey
- // because Whidbey try to initialize some of these fields using calendar data which could be null values
- // and then we get exceptions. So we call the accessors to force the caches to get loaded.
- Object o;
- o = this.LongTimePattern;
- o = this.LongDatePattern;
- o = this.ShortTimePattern;
- o = this.ShortDatePattern;
- o = this.YearMonthPattern;
- o = this.AllLongTimePatterns;
- o = this.AllLongDatePatterns;
- o = this.AllShortTimePatterns;
- o = this.AllShortDatePatterns;
- o = this.AllYearMonthPatterns;
- }
-
- [OnDeserialized]
- private void OnDeserialized(StreamingContext ctx)
- {
- if (_name != null)
- {
- _cultureData = CultureData.GetCultureData(_name, _useUserOverride);
- if (_cultureData == null)
- {
- throw new CultureNotFoundException("_name", _name, SR.Argument_CultureNotSupported);
- }
- }
-
- if (calendar == null)
- {
- calendar = (Calendar)GregorianCalendar.GetDefaultInstance().Clone();
- calendar.SetReadOnlyState(_isReadOnly);
- }
-
- InitializeOverridableProperties(_cultureData, calendar.ID);
-
- //
- // turn off read only state till we finish initializing all fields and then store read only state after we are done.
- //
- bool isReadOnly = _isReadOnly;
- _isReadOnly = false;
-
- // If we deserialized defaults ala Whidbey, make sure they're still defaults
- // Whidbey's arrays could get a bit mixed up.
- if (longDatePattern != null) this.LongDatePattern = longDatePattern;
- if (shortDatePattern != null) this.ShortDatePattern = shortDatePattern;
- if (yearMonthPattern != null) this.YearMonthPattern = yearMonthPattern;
- if (longTimePattern != null) this.LongTimePattern = longTimePattern;
- if (shortTimePattern != null) this.ShortTimePattern = shortTimePattern;
-
- _isReadOnly = isReadOnly;
- }
-
- // Returns a default DateTimeFormatInfo that will be universally
- // supported and constant irrespective of the current culture.
- // Used by FromString methods.
- //
-
- public static DateTimeFormatInfo InvariantInfo
- {
- get
- {
- Contract.Ensures(Contract.Result<DateTimeFormatInfo>() != null);
- if (s_invariantInfo == null)
- {
- DateTimeFormatInfo info = new DateTimeFormatInfo();
- info.Calendar.SetReadOnlyState(true);
- info._isReadOnly = true;
- s_invariantInfo = info;
- }
- return (s_invariantInfo);
- }
- }
-
- // Returns the current culture's DateTimeFormatInfo. Used by Parse methods.
- //
-
- public static DateTimeFormatInfo CurrentInfo
- {
- get
- {
- Contract.Ensures(Contract.Result<DateTimeFormatInfo>() != null);
- System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.CurrentCulture;
- if (!culture.m_isInherited)
- {
- DateTimeFormatInfo info = culture.dateTimeInfo;
- if (info != null)
- {
- return info;
- }
- }
- return (DateTimeFormatInfo)culture.GetFormat(typeof(DateTimeFormatInfo));
- }
- }
-
-
- public static DateTimeFormatInfo GetInstance(IFormatProvider provider)
- {
- // Fast case for a regular CultureInfo
- DateTimeFormatInfo info;
- CultureInfo cultureProvider = provider as CultureInfo;
- if (cultureProvider != null && !cultureProvider.m_isInherited)
- {
- return cultureProvider.DateTimeFormat;
- }
- // Fast case for a DTFI;
- info = provider as DateTimeFormatInfo;
- if (info != null)
- {
- return info;
- }
- // Wasn't cultureInfo or DTFI, do it the slower way
- if (provider != null)
- {
- info = provider.GetFormat(typeof(DateTimeFormatInfo)) as DateTimeFormatInfo;
- if (info != null)
- {
- return info;
- }
- }
- // Couldn't get anything, just use currentInfo as fallback
- return CurrentInfo;
- }
-
-
- public Object GetFormat(Type formatType)
- {
- return (formatType == typeof(DateTimeFormatInfo) ? this : null);
- }
-
-
- public Object Clone()
- {
- DateTimeFormatInfo n = (DateTimeFormatInfo)MemberwiseClone();
- // We can use the data member calendar in the setter, instead of the property Calendar,
- // since the cloned copy should have the same state as the original copy.
- n.calendar = (Calendar)this.Calendar.Clone();
- n._isReadOnly = false;
- return n;
- }
-
-
- public String AMDesignator
- {
- get
- {
- if (this.amDesignator == null)
- {
- this.amDesignator = _cultureData.SAM1159;
- }
- Debug.Assert(this.amDesignator != null, "DateTimeFormatInfo.AMDesignator, amDesignator != null");
- return (this.amDesignator);
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- ClearTokenHashTable();
- amDesignator = value;
- }
- }
-
-
- public Calendar Calendar
- {
- get
- {
- Contract.Ensures(Contract.Result<Calendar>() != null);
-
- Debug.Assert(this.calendar != null, "DateTimeFormatInfo.Calendar: calendar != null");
- return (this.calendar);
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value), SR.ArgumentNull_Obj);
- }
- Contract.EndContractBlock();
- if (value == calendar)
- {
- return;
- }
-
- for (int i = 0; i < this.OptionalCalendars.Length; i++)
- {
- if (this.OptionalCalendars[i] == value.ID)
- {
- // We can use this one, so do so.
-
- // Clean related properties if we already had a calendar set
- if (calendar != null)
- {
- // clean related properties which are affected by the calendar setting,
- // so that they will be refreshed when they are accessed next time.
- //
-
- // These properites are in the order as appearing in calendar.xml.
- m_eraNames = null;
- m_abbrevEraNames = null;
- m_abbrevEnglishEraNames = null;
-
- monthDayPattern = null;
-
- dayNames = null;
- abbreviatedDayNames = null;
- m_superShortDayNames = null;
- monthNames = null;
- abbreviatedMonthNames = null;
- genitiveMonthNames = null;
- m_genitiveAbbreviatedMonthNames = null;
- leapYearMonthNames = null;
- formatFlags = DateTimeFormatFlags.NotInitialized;
-
- allShortDatePatterns = null;
- allLongDatePatterns = null;
- allYearMonthPatterns = null;
- dateTimeOffsetPattern = null;
-
- // The defaults need reset as well:
- longDatePattern = null;
- shortDatePattern = null;
- yearMonthPattern = null;
-
- // These properies are not in the OS data, but they are dependent on the values like shortDatePattern.
- fullDateTimePattern = null; // Long date + long time
- generalShortTimePattern = null; // short date + short time
- generalLongTimePattern = null; // short date + long time
-
- // Derived item that changes
- dateSeparator = null;
-
- // We don't need to do these because they are not changed by changing calendar
- // amDesignator
- // pmDesignator
- // timeSeparator
- // longTimePattern
- // firstDayOfWeek
- // calendarWeekRule
-
- // remember to reload tokens
- ClearTokenHashTable();
- }
-
- // Remember the new calendar
- calendar = value;
- InitializeOverridableProperties(_cultureData, calendar.ID);
-
- // We succeeded, return
- return;
- }
- }
-
- // The assigned calendar is not a valid calendar for this culture, throw
- throw new ArgumentOutOfRangeException(nameof(value), SR.Argument_InvalidCalendar);
- }
- }
-
- private CalendarId[] OptionalCalendars
- {
- get
- {
- if (this.optionalCalendars == null)
- {
- this.optionalCalendars = _cultureData.CalendarIds;
- }
- return (this.optionalCalendars);
- }
- }
-
- /*=================================GetEra==========================
- **Action: Get the era value by parsing the name of the era.
- **Returns: The era value for the specified era name.
- ** -1 if the name of the era is not valid or not supported.
- **Arguments: eraName the name of the era.
- **Exceptions: None.
- ============================================================================*/
-
-
- public int GetEra(String eraName)
- {
- if (eraName == null)
- {
- throw new ArgumentNullException(nameof(eraName),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
-
- // The Era Name and Abbreviated Era Name
- // for Taiwan Calendar on non-Taiwan SKU returns empty string (which
- // would be matched below) but we don't want the empty string to give
- // us an Era number
- // confer 85900 DTFI.GetEra("") should fail on all cultures
- if (eraName.Length == 0)
- {
- return (-1);
- }
-
- // The following is based on the assumption that the era value is starting from 1, and has a
- // serial values.
- // If that ever changes, the code has to be changed.
-
- // The calls to String.Compare should use the current culture for the string comparisons, but the
- // invariant culture when comparing against the english names.
- for (int i = 0; i < EraNames.Length; i++)
- {
- // Compare the era name in a case-insensitive way for the appropriate culture.
- if (m_eraNames[i].Length > 0)
- {
- if (this.Culture.CompareInfo.Compare(eraName, m_eraNames[i], CompareOptions.IgnoreCase) == 0)
- {
- return (i + 1);
- }
- }
- }
- for (int i = 0; i < AbbreviatedEraNames.Length; i++)
- {
- // Compare the abbreviated era name in a case-insensitive way for the appropriate culture.
- if (this.Culture.CompareInfo.Compare(eraName, m_abbrevEraNames[i], CompareOptions.IgnoreCase) == 0)
- {
- return (i + 1);
- }
- }
- for (int i = 0; i < AbbreviatedEnglishEraNames.Length; i++)
- {
- // this comparison should use the InvariantCulture. The English name could have linguistically
- // interesting characters.
- if (CultureInfo.InvariantCulture.CompareInfo.Compare(eraName, m_abbrevEnglishEraNames[i], CompareOptions.IgnoreCase) == 0)
- {
- return (i + 1);
- }
- }
- return (-1);
- }
-
-
- internal String[] EraNames
- {
- get
- {
- if (this.m_eraNames == null)
- {
- this.m_eraNames = _cultureData.EraNames(Calendar.ID); ;
- }
- return (this.m_eraNames);
- }
- }
-
- /*=================================GetEraName==========================
- **Action: Get the name of the era for the specified era value.
- **Returns: The name of the specified era.
- **Arguments:
- ** era the era value.
- **Exceptions:
- ** ArguementException if the era valie is invalid.
- ============================================================================*/
-
- // Era names are 1 indexed
- public String GetEraName(int era)
- {
- if (era == Calendar.CurrentEra)
- {
- era = Calendar.CurrentEraValue;
- }
-
- // The following is based on the assumption that the era value is starting from 1, and has a
- // serial values.
- // If that ever changes, the code has to be changed.
- if ((--era) < EraNames.Length && (era >= 0))
- {
- return (m_eraNames[era]);
- }
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
-
- internal String[] AbbreviatedEraNames
- {
- get
- {
- if (this.m_abbrevEraNames == null)
- {
- this.m_abbrevEraNames = _cultureData.AbbrevEraNames(Calendar.ID);
- }
- return (this.m_abbrevEraNames);
- }
- }
-
- // Era names are 1 indexed
- public String GetAbbreviatedEraName(int era)
- {
- if (AbbreviatedEraNames.Length == 0)
- {
- // If abbreviation era name is not used in this culture,
- // return the full era name.
- return (GetEraName(era));
- }
- if (era == Calendar.CurrentEra)
- {
- era = Calendar.CurrentEraValue;
- }
- if ((--era) < m_abbrevEraNames.Length && (era >= 0))
- {
- return (m_abbrevEraNames[era]);
- }
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
-
- internal String[] AbbreviatedEnglishEraNames
- {
- get
- {
- if (this.m_abbrevEnglishEraNames == null)
- {
- Debug.Assert(Calendar.ID > 0, "[DateTimeFormatInfo.AbbreviatedEnglishEraNames] Expected Calendar.ID > 0");
- this.m_abbrevEnglishEraNames = _cultureData.AbbreviatedEnglishEraNames(Calendar.ID);
- }
- return (this.m_abbrevEnglishEraNames);
- }
- }
-
- // Note that cultureData derives this from the short date format (unless someone's set this previously)
- // Note that this property is quite undesirable.
- public string DateSeparator
- {
- get
- {
- if (dateSeparator == null)
- {
- dateSeparator = _cultureData.DateSeparator(Calendar.ID);
- }
- Debug.Assert(this.dateSeparator != null, "DateTimeFormatInfo.DateSeparator, dateSeparator != null");
- return dateSeparator;
- }
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
-
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value), SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- ClearTokenHashTable();
- dateSeparator = value;
- }
- }
-
- public DayOfWeek FirstDayOfWeek
- {
- get
- {
- if (this.firstDayOfWeek == -1)
- {
- this.firstDayOfWeek = _cultureData.IFIRSTDAYOFWEEK;
- }
- Debug.Assert(this.firstDayOfWeek != -1, "DateTimeFormatInfo.FirstDayOfWeek, firstDayOfWeek != -1");
-
- return ((DayOfWeek)this.firstDayOfWeek);
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value >= DayOfWeek.Sunday && value <= DayOfWeek.Saturday)
- {
- firstDayOfWeek = (int)value;
- }
- else
- {
- throw new ArgumentOutOfRangeException(
- nameof(value), SR.Format(SR.ArgumentOutOfRange_Range,
- DayOfWeek.Sunday, DayOfWeek.Saturday));
- }
- }
- }
-
- public CalendarWeekRule CalendarWeekRule
- {
- get
- {
- if (this.calendarWeekRule == -1)
- {
- this.calendarWeekRule = _cultureData.IFIRSTWEEKOFYEAR;
- }
- Debug.Assert(this.calendarWeekRule != -1, "DateTimeFormatInfo.CalendarWeekRule, calendarWeekRule != -1");
- return ((CalendarWeekRule)this.calendarWeekRule);
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value >= CalendarWeekRule.FirstDay && value <= CalendarWeekRule.FirstFourDayWeek)
- {
- calendarWeekRule = (int)value;
- }
- else
- {
- throw new ArgumentOutOfRangeException(
- nameof(value), SR.Format(SR.ArgumentOutOfRange_Range,
- CalendarWeekRule.FirstDay, CalendarWeekRule.FirstFourDayWeek));
- }
- }
- }
-
- public String FullDateTimePattern
- {
- get
- {
- if (fullDateTimePattern == null)
- {
- fullDateTimePattern = LongDatePattern + " " + LongTimePattern;
- }
- return (fullDateTimePattern);
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- fullDateTimePattern = value;
- }
- }
-
-
- // For our "patterns" arrays we have 2 variables, a string and a string[]
- //
- // The string[] contains the list of patterns, EXCEPT the default may not be included.
- // The string contains the default pattern.
- // When we initially construct our string[], we set the string to string[0]
- public String LongDatePattern
- {
- get
- {
- // Initialize our long date pattern from the 1st array value if not set
- if (this.longDatePattern == null)
- {
- // Initialize our data
- this.longDatePattern = this.UnclonedLongDatePatterns[0];
- }
-
- return this.longDatePattern;
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
-
- // Remember the new string
- this.longDatePattern = value;
-
- // Clear the token hash table
- ClearTokenHashTable();
-
- // Clean up cached values that will be affected by this property.
- this.fullDateTimePattern = null;
- }
- }
-
- // For our "patterns" arrays we have 2 variables, a string and a string[]
- //
- // The string[] contains the list of patterns, EXCEPT the default may not be included.
- // The string contains the default pattern.
- // When we initially construct our string[], we set the string to string[0]
- public String LongTimePattern
- {
- get
- {
- // Initialize our long time pattern from the 1st array value if not set
- if (this.longTimePattern == null)
- {
- // Initialize our data
- this.longTimePattern = this.UnclonedLongTimePatterns[0];
- }
-
- return this.longTimePattern;
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
-
- // Remember the new string
- this.longTimePattern = value;
-
- // Clear the token hash table
- ClearTokenHashTable();
-
- // Clean up cached values that will be affected by this property.
- this.fullDateTimePattern = null; // Full date = long date + long Time
- this.generalLongTimePattern = null; // General long date = short date + long Time
- this.dateTimeOffsetPattern = null;
- }
- }
-
-
- // Note: just to be confusing there's only 1 month day pattern, not a whole list
- public String MonthDayPattern
- {
- get
- {
- if (this.monthDayPattern == null)
- {
- Debug.Assert(Calendar.ID > 0, "[DateTimeFormatInfo.MonthDayPattern] Expected calID > 0");
- this.monthDayPattern = _cultureData.MonthDay(Calendar.ID);
- }
- Debug.Assert(this.monthDayPattern != null, "DateTimeFormatInfo.MonthDayPattern, monthDayPattern != null");
- return (this.monthDayPattern);
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
-
- this.monthDayPattern = value;
- }
- }
-
-
- public String PMDesignator
- {
- get
- {
- if (this.pmDesignator == null)
- {
- this.pmDesignator = _cultureData.SPM2359;
- }
- Debug.Assert(this.pmDesignator != null, "DateTimeFormatInfo.PMDesignator, pmDesignator != null");
- return (this.pmDesignator);
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- ClearTokenHashTable();
-
- pmDesignator = value;
- }
- }
-
-
- public String RFC1123Pattern
- {
- get
- {
- return (rfc1123Pattern);
- }
- }
-
- // For our "patterns" arrays we have 2 variables, a string and a string[]
- //
- // The string[] contains the list of patterns, EXCEPT the default may not be included.
- // The string contains the default pattern.
- // When we initially construct our string[], we set the string to string[0]
- public String ShortDatePattern
- {
- get
- {
- // Initialize our short date pattern from the 1st array value if not set
- if (this.shortDatePattern == null)
- {
- // Initialize our data
- this.shortDatePattern = this.UnclonedShortDatePatterns[0];
- }
-
- return this.shortDatePattern;
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_String);
- Contract.EndContractBlock();
-
- // Remember the new string
- this.shortDatePattern = value;
-
- // Clear the token hash table, note that even short dates could require this
- ClearTokenHashTable();
-
- // Clean up cached values that will be affected by this property.
- generalLongTimePattern = null; // General long time = short date + long time
- generalShortTimePattern = null; // General short time = short date + short Time
- dateTimeOffsetPattern = null;
- }
- }
-
-
- // For our "patterns" arrays we have 2 variables, a string and a string[]
- //
- // The string[] contains the list of patterns, EXCEPT the default may not be included.
- // The string contains the default pattern.
- // When we initially construct our string[], we set the string to string[0]
- public String ShortTimePattern
- {
- get
- {
- // Initialize our short time pattern from the 1st array value if not set
- if (this.shortTimePattern == null)
- {
- // Initialize our data
- this.shortTimePattern = this.UnclonedShortTimePatterns[0];
- }
- return this.shortTimePattern;
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
-
- // Remember the new string
- this.shortTimePattern = value;
-
- // Clear the token hash table, note that even short times could require this
- ClearTokenHashTable();
-
- // Clean up cached values that will be affected by this property.
- generalShortTimePattern = null; // General short date = short date + short time.
- }
- }
-
-
- public String SortableDateTimePattern
- {
- get
- {
- return (sortableDateTimePattern);
- }
- }
-
- /*=================================GeneralShortTimePattern=====================
- **Property: Return the pattern for 'g' general format: shortDate + short time
- **Note: This is used by DateTimeFormat.cs to get the pattern for 'g'
- ** We put this internal property here so that we can avoid doing the
- ** concatation every time somebody asks for the general format.
- ==============================================================================*/
-
- internal String GeneralShortTimePattern
- {
- get
- {
- if (generalShortTimePattern == null)
- {
- generalShortTimePattern = ShortDatePattern + " " + ShortTimePattern;
- }
- return (generalShortTimePattern);
- }
- }
-
- /*=================================GeneralLongTimePattern=====================
- **Property: Return the pattern for 'g' general format: shortDate + Long time
- **Note: This is used by DateTimeFormat.cs to get the pattern for 'g'
- ** We put this internal property here so that we can avoid doing the
- ** concatation every time somebody asks for the general format.
- ==============================================================================*/
-
- internal String GeneralLongTimePattern
- {
- get
- {
- if (generalLongTimePattern == null)
- {
- generalLongTimePattern = ShortDatePattern + " " + LongTimePattern;
- }
- return (generalLongTimePattern);
- }
- }
-
- /*=================================DateTimeOffsetPattern==========================
- **Property: Return the default pattern DateTimeOffset : shortDate + long time + time zone offset
- **Note: This is used by DateTimeFormat.cs to get the pattern for short Date + long time + time zone offset
- ** We put this internal property here so that we can avoid doing the
- ** concatation every time somebody uses this form
- ==============================================================================*/
-
- /*=================================DateTimeOffsetPattern==========================
- **Property: Return the default pattern DateTimeOffset : shortDate + long time + time zone offset
- **Note: This is used by DateTimeFormat.cs to get the pattern for short Date + long time + time zone offset
- ** We put this internal property here so that we can avoid doing the
- ** concatation every time somebody uses this form
- ==============================================================================*/
-
- internal String DateTimeOffsetPattern
- {
- get
- {
- if (dateTimeOffsetPattern == null)
- {
- string dateTimePattern = ShortDatePattern + " " + LongTimePattern;
-
- /* LongTimePattern might contain a "z" as part of the format string in which case we don't want to append a time zone offset */
-
- bool foundZ = false;
- bool inQuote = false;
- char quote = '\'';
- for (int i = 0; !foundZ && i < LongTimePattern.Length; i++)
- {
- switch (LongTimePattern[i])
- {
- case 'z':
- /* if we aren't in a quote, we've found a z */
- foundZ = !inQuote;
- /* we'll fall out of the loop now because the test includes !foundZ */
- break;
- case '\'':
- case '\"':
- if (inQuote && (quote == LongTimePattern[i]))
- {
- /* we were in a quote and found a matching exit quote, so we are outside a quote now */
- inQuote = false;
- }
- else if (!inQuote)
- {
- quote = LongTimePattern[i];
- inQuote = true;
- }
- else
- {
- /* we were in a quote and saw the other type of quote character, so we are still in a quote */
- }
- break;
- case '%':
- case '\\':
- i++; /* skip next character that is escaped by this backslash */
- break;
- default:
- break;
- }
- }
-
- if (!foundZ)
- {
- dateTimePattern = dateTimePattern + " zzz";
- }
-
- dateTimeOffsetPattern = dateTimePattern;
- }
- return (dateTimeOffsetPattern);
- }
- }
-
- // Note that cultureData derives this from the long time format (unless someone's set this previously)
- // Note that this property is quite undesirable.
- public string TimeSeparator
- {
- get
- {
- if (timeSeparator == null)
- {
- timeSeparator = _cultureData.TimeSeparator;
- }
- Debug.Assert(this.timeSeparator != null, "DateTimeFormatInfo.TimeSeparator, timeSeparator != null");
- return (timeSeparator);
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
-
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value), SR.ArgumentNull_String);
- }
-
- Contract.EndContractBlock();
- ClearTokenHashTable();
-
- timeSeparator = value;
- }
- }
-
- public String UniversalSortableDateTimePattern
- {
- get
- {
- return (universalSortableDateTimePattern);
- }
- }
-
- // For our "patterns" arrays we have 2 variables, a string and a string[]
- //
- // The string[] contains the list of patterns, EXCEPT the default may not be included.
- // The string contains the default pattern.
- // When we initially construct our string[], we set the string to string[0]
- public String YearMonthPattern
- {
- get
- {
- // Initialize our year/month pattern from the 1st array value if not set
- if (this.yearMonthPattern == null)
- {
- // Initialize our data
- this.yearMonthPattern = this.UnclonedYearMonthPatterns[0];
- }
- return this.yearMonthPattern;
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
-
- // Remember the new string
- this.yearMonthPattern = value;
-
- // Clear the token hash table, note that even short times could require this
- ClearTokenHashTable();
- }
- }
-
- //
- // Check if a string array contains a null value, and throw ArgumentNullException with parameter name "value"
- //
- private static void CheckNullValue(String[] values, int length)
- {
- Debug.Assert(values != null, "value != null");
- Debug.Assert(values.Length >= length);
- for (int i = 0; i < length; i++)
- {
- if (values[i] == null)
- {
- throw new ArgumentNullException("value",
- SR.ArgumentNull_ArrayValue);
- }
- }
- }
-
-
- public String[] AbbreviatedDayNames
- {
- get
- {
- return ((String[])internalGetAbbreviatedDayOfWeekNames().Clone());
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_Array);
- }
- if (value.Length != 7)
- {
- throw new ArgumentException(SR.Format(SR.Argument_InvalidArrayLength, 7), nameof(value));
- }
- Contract.EndContractBlock();
- CheckNullValue(value, value.Length);
- ClearTokenHashTable();
-
- abbreviatedDayNames = value;
- }
- }
-
- // Returns the string array of the one-letter day of week names.
- public String[] ShortestDayNames
- {
- get
- {
- return ((String[])internalGetSuperShortDayNames().Clone());
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_Array);
- }
- if (value.Length != 7)
- {
- throw new ArgumentException(SR.Format(SR.Argument_InvalidArrayLength, 7), nameof(value));
- }
- Contract.EndContractBlock();
- CheckNullValue(value, value.Length);
- this.m_superShortDayNames = value;
- }
- }
-
-
- public String[] DayNames
- {
- get
- {
- return ((String[])internalGetDayOfWeekNames().Clone());
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_Array);
- }
- if (value.Length != 7)
- {
- throw new ArgumentException(SR.Format(SR.Argument_InvalidArrayLength, 7), nameof(value));
- }
- Contract.EndContractBlock();
- CheckNullValue(value, value.Length);
- ClearTokenHashTable();
-
- dayNames = value;
- }
- }
-
-
- public String[] AbbreviatedMonthNames
- {
- get
- {
- return ((String[])internalGetAbbreviatedMonthNames().Clone());
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_Array);
- }
- if (value.Length != 13)
- {
- throw new ArgumentException(SR.Format(SR.Argument_InvalidArrayLength, 13), nameof(value));
- }
- Contract.EndContractBlock();
- CheckNullValue(value, value.Length - 1);
- ClearTokenHashTable();
- abbreviatedMonthNames = value;
- }
- }
-
-
- public String[] MonthNames
- {
- get
- {
- return ((String[])internalGetMonthNames().Clone());
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_Array);
- }
- if (value.Length != 13)
- {
- throw new ArgumentException(SR.Format(SR.Argument_InvalidArrayLength, 13), nameof(value));
- }
- Contract.EndContractBlock();
- CheckNullValue(value, value.Length - 1);
- monthNames = value;
- ClearTokenHashTable();
- }
- }
-
- // Whitespaces that we allow in the month names.
- // U+00a0 is non-breaking space.
- private static readonly char[] s_monthSpaces = { ' ', '\u00a0' };
-
- internal bool HasSpacesInMonthNames
- {
- get
- {
- return (FormatFlags & DateTimeFormatFlags.UseSpacesInMonthNames) != 0;
- }
- }
-
- internal bool HasSpacesInDayNames
- {
- get
- {
- return (FormatFlags & DateTimeFormatFlags.UseSpacesInDayNames) != 0;
- }
- }
-
-
- //
- // internalGetMonthName
- //
- // Actions: Return the month name using the specified MonthNameStyles in either abbreviated form
- // or full form.
- // Arguments:
- // month
- // style To indicate a form like regular/genitive/month name in a leap year.
- // abbreviated When true, return abbreviated form. Otherwise, return a full form.
- // Exceptions:
- // ArgumentOutOfRangeException When month name is invalid.
- //
- internal String internalGetMonthName(int month, MonthNameStyles style, bool abbreviated)
- {
- //
- // Right now, style is mutual exclusive, but I make the style to be flag so that
- // maybe we can combine flag if there is such a need.
- //
- String[] monthNamesArray = null;
- switch (style)
- {
- case MonthNameStyles.Genitive:
- monthNamesArray = internalGetGenitiveMonthNames(abbreviated);
- break;
- case MonthNameStyles.LeapYear:
- monthNamesArray = internalGetLeapYearMonthNames(/*abbreviated*/);
- break;
- default:
- monthNamesArray = (abbreviated ? internalGetAbbreviatedMonthNames() : internalGetMonthNames());
- break;
- }
- // The month range is from 1 ~ this.m_monthNames.Length
- // (actually is 13 right now for all cases)
- if ((month < 1) || (month > monthNamesArray.Length))
- {
- throw new ArgumentOutOfRangeException(
- nameof(month), SR.Format(SR.ArgumentOutOfRange_Range,
- 1, monthNamesArray.Length));
- }
- return (monthNamesArray[month - 1]);
- }
-
- //
- // internalGetGenitiveMonthNames
- //
- // Action: Retrieve the array which contains the month names in genitive form.
- // If this culture does not use the gentive form, the normal month name is returned.
- // Arguments:
- // abbreviated When true, return abbreviated form. Otherwise, return a full form.
- //
- private String[] internalGetGenitiveMonthNames(bool abbreviated)
- {
- if (abbreviated)
- {
- if (this.m_genitiveAbbreviatedMonthNames == null)
- {
- this.m_genitiveAbbreviatedMonthNames = _cultureData.AbbreviatedGenitiveMonthNames(this.Calendar.ID);
- Debug.Assert(this.m_genitiveAbbreviatedMonthNames.Length == 13,
- "[DateTimeFormatInfo.GetGenitiveMonthNames] Expected 13 abbreviated genitive month names in a year");
- }
- return (this.m_genitiveAbbreviatedMonthNames);
- }
-
- if (this.genitiveMonthNames == null)
- {
- this.genitiveMonthNames = _cultureData.GenitiveMonthNames(this.Calendar.ID);
- Debug.Assert(this.genitiveMonthNames.Length == 13,
- "[DateTimeFormatInfo.GetGenitiveMonthNames] Expected 13 genitive month names in a year");
- }
- return (this.genitiveMonthNames);
- }
-
- //
- // internalGetLeapYearMonthNames
- //
- // Actions: Retrieve the month names used in a leap year.
- // If this culture does not have different month names in a leap year, the normal month name is returned.
- // Agruments: None. (can use abbreviated later if needed)
- //
- internal String[] internalGetLeapYearMonthNames(/*bool abbreviated*/)
- {
- if (this.leapYearMonthNames == null)
- {
- Debug.Assert(Calendar.ID > 0, "[DateTimeFormatInfo.internalGetLeapYearMonthNames] Expected Calendar.ID > 0");
- this.leapYearMonthNames = _cultureData.LeapYearMonthNames(Calendar.ID);
- Debug.Assert(this.leapYearMonthNames.Length == 13,
- "[DateTimeFormatInfo.internalGetLeapYearMonthNames] Expepcted 13 leap year month names");
- }
- return (leapYearMonthNames);
- }
-
-
- public String GetAbbreviatedDayName(DayOfWeek dayofweek)
- {
- if ((int)dayofweek < 0 || (int)dayofweek > 6)
- {
- throw new ArgumentOutOfRangeException(
- nameof(dayofweek), SR.Format(SR.ArgumentOutOfRange_Range,
- DayOfWeek.Sunday, DayOfWeek.Saturday));
- }
- Contract.EndContractBlock();
- //
- // Don't call the public property AbbreviatedDayNames here since a clone is needed in that
- // property, so it will be slower. Instead, use GetAbbreviatedDayOfWeekNames() directly.
- //
- return (internalGetAbbreviatedDayOfWeekNames()[(int)dayofweek]);
- }
-
- // Returns the super short day of week names for the specified day of week.
- public string GetShortestDayName(DayOfWeek dayOfWeek)
- {
- if ((int)dayOfWeek < 0 || (int)dayOfWeek > 6)
- {
- throw new ArgumentOutOfRangeException(
- nameof(dayOfWeek), SR.Format(SR.ArgumentOutOfRange_Range,
- DayOfWeek.Sunday, DayOfWeek.Saturday));
- }
- Contract.EndContractBlock();
- //
- // Don't call the public property SuperShortDayNames here since a clone is needed in that
- // property, so it will be slower. Instead, use internalGetSuperShortDayNames() directly.
- //
- return (internalGetSuperShortDayNames()[(int)dayOfWeek]);
- }
-
- // Get all possible combination of inputs
- private static String[] GetCombinedPatterns(String[] patterns1, String[] patterns2, String connectString)
- {
- Debug.Assert(patterns1 != null);
- Debug.Assert(patterns2 != null);
-
- // Get array size
- String[] result = new String[patterns1.Length * patterns2.Length];
-
- // Counter of actual results
- int k = 0;
- for (int i = 0; i < patterns1.Length; i++)
- {
- for (int j = 0; j < patterns2.Length; j++)
- {
- // Can't combine if null or empty
- result[k++] = patterns1[i] + connectString + patterns2[j];
- }
- }
-
- // Return the combinations
- return (result);
- }
-
- public string[] GetAllDateTimePatterns()
- {
- List<String> results = new List<String>(DEFAULT_ALL_DATETIMES_SIZE);
-
- for (int i = 0; i < DateTimeFormat.allStandardFormats.Length; i++)
- {
- String[] strings = GetAllDateTimePatterns(DateTimeFormat.allStandardFormats[i]);
- for (int j = 0; j < strings.Length; j++)
- {
- results.Add(strings[j]);
- }
- }
- return results.ToArray();
- }
-
- public string[] GetAllDateTimePatterns(char format)
- {
- Contract.Ensures(Contract.Result<String[]>() != null);
- String[] result = null;
-
- switch (format)
- {
- case 'd':
- result = this.AllShortDatePatterns;
- break;
- case 'D':
- result = this.AllLongDatePatterns;
- break;
- case 'f':
- result = GetCombinedPatterns(AllLongDatePatterns, AllShortTimePatterns, " ");
- break;
- case 'F':
- case 'U':
- result = GetCombinedPatterns(AllLongDatePatterns, AllLongTimePatterns, " ");
- break;
- case 'g':
- result = GetCombinedPatterns(AllShortDatePatterns, AllShortTimePatterns, " ");
- break;
- case 'G':
- result = GetCombinedPatterns(AllShortDatePatterns, AllLongTimePatterns, " ");
- break;
- case 'm':
- case 'M':
- result = new String[] { MonthDayPattern };
- break;
- case 'o':
- case 'O':
- result = new String[] { RoundtripFormat };
- break;
- case 'r':
- case 'R':
- result = new String[] { rfc1123Pattern };
- break;
- case 's':
- result = new String[] { sortableDateTimePattern };
- break;
- case 't':
- result = this.AllShortTimePatterns;
- break;
- case 'T':
- result = this.AllLongTimePatterns;
- break;
- case 'u':
- result = new String[] { UniversalSortableDateTimePattern };
- break;
- case 'y':
- case 'Y':
- result = this.AllYearMonthPatterns;
- break;
- default:
- throw new ArgumentException(SR.Format_BadFormatSpecifier, nameof(format));
- }
- return (result);
- }
-
-
- public String GetDayName(DayOfWeek dayofweek)
- {
- if ((int)dayofweek < 0 || (int)dayofweek > 6)
- {
- throw new ArgumentOutOfRangeException(
- nameof(dayofweek), SR.Format(SR.ArgumentOutOfRange_Range,
- DayOfWeek.Sunday, DayOfWeek.Saturday));
- }
- Contract.EndContractBlock();
-
- // Use the internal one so that we don't clone the array unnecessarily
- return (internalGetDayOfWeekNames()[(int)dayofweek]);
- }
-
-
-
- public String GetAbbreviatedMonthName(int month)
- {
- if (month < 1 || month > 13)
- {
- throw new ArgumentOutOfRangeException(
- nameof(month), SR.Format(SR.ArgumentOutOfRange_Range,
- 1, 13));
- }
- Contract.EndContractBlock();
- // Use the internal one so we don't clone the array unnecessarily
- return (internalGetAbbreviatedMonthNames()[month - 1]);
- }
-
-
- public String GetMonthName(int month)
- {
- if (month < 1 || month > 13)
- {
- throw new ArgumentOutOfRangeException(
- nameof(month), SR.Format(SR.ArgumentOutOfRange_Range,
- 1, 13));
- }
- Contract.EndContractBlock();
- // Use the internal one so we don't clone the array unnecessarily
- return (internalGetMonthNames()[month - 1]);
- }
-
- // For our "patterns" arrays we have 2 variables, a string and a string[]
- //
- // The string[] contains the list of patterns, EXCEPT the default may not be included.
- // The string contains the default pattern.
- // When we initially construct our string[], we set the string to string[0]
- //
- // The resulting [] can get returned to the calling app, so clone it.
- private static string[] GetMergedPatterns(string[] patterns, string defaultPattern)
- {
- Debug.Assert(patterns != null && patterns.Length > 0,
- "[DateTimeFormatInfo.GetMergedPatterns]Expected array of at least one pattern");
- Debug.Assert(defaultPattern != null,
- "[DateTimeFormatInfo.GetMergedPatterns]Expected non null default string");
-
- // If the default happens to be the first in the list just return (a cloned) copy
- if (defaultPattern == patterns[0])
- {
- return (string[])patterns.Clone();
- }
-
- // We either need a bigger list, or the pattern from the list.
- int i;
- for (i = 0; i < patterns.Length; i++)
- {
- // Stop if we found it
- if (defaultPattern == patterns[i])
- break;
- }
-
- // Either way we're going to need a new array
- string[] newPatterns;
-
- // Did we find it
- if (i < patterns.Length)
- {
- // Found it, output will be same size
- newPatterns = (string[])patterns.Clone();
-
- // Have to move [0] item to [i] so we can re-write default at [0]
- // (remember defaultPattern == [i] so this is OK)
- newPatterns[i] = newPatterns[0];
- }
- else
- {
- // Not found, make room for it
- newPatterns = new String[patterns.Length + 1];
-
- // Copy existing array
- Array.Copy(patterns, 0, newPatterns, 1, patterns.Length);
- }
-
- // Remember the default
- newPatterns[0] = defaultPattern;
-
- // Return the reconstructed list
- return newPatterns;
- }
-
- // Needed by DateTimeFormatInfo and DateTimeFormat
- internal const String RoundtripFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK";
- internal const String RoundtripDateTimeUnfixed = "yyyy'-'MM'-'ddTHH':'mm':'ss zzz";
-
- // Default string isn't necessarily in our string array, so get the
- // merged patterns of both
- private String[] AllYearMonthPatterns
- {
- get
- {
- return GetMergedPatterns(this.UnclonedYearMonthPatterns, this.YearMonthPattern);
- }
- }
-
- private String[] AllShortDatePatterns
- {
- get
- {
- return GetMergedPatterns(this.UnclonedShortDatePatterns, this.ShortDatePattern);
- }
- }
-
- private String[] AllShortTimePatterns
- {
- get
- {
- return GetMergedPatterns(this.UnclonedShortTimePatterns, this.ShortTimePattern);
- }
- }
-
- private String[] AllLongDatePatterns
- {
- get
- {
- return GetMergedPatterns(this.UnclonedLongDatePatterns, this.LongDatePattern);
- }
- }
-
- private String[] AllLongTimePatterns
- {
- get
- {
- return GetMergedPatterns(this.UnclonedLongTimePatterns, this.LongTimePattern);
- }
- }
-
- // NOTE: Clone this string array if you want to return it to user. Otherwise, you are returning a writable cache copy.
- // This won't include default, call AllYearMonthPatterns
- private String[] UnclonedYearMonthPatterns
- {
- get
- {
- if (this.allYearMonthPatterns == null)
- {
- Debug.Assert(Calendar.ID > 0, "[DateTimeFormatInfo.UnclonedYearMonthPatterns] Expected Calendar.ID > 0");
- this.allYearMonthPatterns = _cultureData.YearMonths(this.Calendar.ID);
- Debug.Assert(this.allYearMonthPatterns.Length > 0,
- "[DateTimeFormatInfo.UnclonedYearMonthPatterns] Expected some year month patterns");
- }
-
- return this.allYearMonthPatterns;
- }
- }
-
-
- // NOTE: Clone this string array if you want to return it to user. Otherwise, you are returning a writable cache copy.
- // This won't include default, call AllShortDatePatterns
- private String[] UnclonedShortDatePatterns
- {
- get
- {
- if (allShortDatePatterns == null)
- {
- Debug.Assert(Calendar.ID > 0, "[DateTimeFormatInfo.UnclonedShortDatePatterns] Expected Calendar.ID > 0");
- this.allShortDatePatterns = _cultureData.ShortDates(this.Calendar.ID);
- Debug.Assert(this.allShortDatePatterns.Length > 0,
- "[DateTimeFormatInfo.UnclonedShortDatePatterns] Expected some short date patterns");
- }
-
- return this.allShortDatePatterns;
- }
- }
-
- // NOTE: Clone this string array if you want to return it to user. Otherwise, you are returning a writable cache copy.
- // This won't include default, call AllLongDatePatterns
- private String[] UnclonedLongDatePatterns
- {
- get
- {
- if (allLongDatePatterns == null)
- {
- Debug.Assert(Calendar.ID > 0, "[DateTimeFormatInfo.UnclonedLongDatePatterns] Expected Calendar.ID > 0");
- this.allLongDatePatterns = _cultureData.LongDates(this.Calendar.ID);
- Debug.Assert(this.allLongDatePatterns.Length > 0,
- "[DateTimeFormatInfo.UnclonedLongDatePatterns] Expected some long date patterns");
- }
-
- return this.allLongDatePatterns;
- }
- }
-
- // NOTE: Clone this string array if you want to return it to user. Otherwise, you are returning a writable cache copy.
- // This won't include default, call AllShortTimePatterns
- private String[] UnclonedShortTimePatterns
- {
- get
- {
- if (this.allShortTimePatterns == null)
- {
- this.allShortTimePatterns = _cultureData.ShortTimes;
- Debug.Assert(this.allShortTimePatterns.Length > 0,
- "[DateTimeFormatInfo.UnclonedShortTimePatterns] Expected some short time patterns");
- }
-
- return this.allShortTimePatterns;
- }
- }
-
- // NOTE: Clone this string array if you want to return it to user. Otherwise, you are returning a writable cache copy.
- // This won't include default, call AllLongTimePatterns
- private String[] UnclonedLongTimePatterns
- {
- get
- {
- if (this.allLongTimePatterns == null)
- {
- this.allLongTimePatterns = _cultureData.LongTimes;
- Debug.Assert(this.allLongTimePatterns.Length > 0,
- "[DateTimeFormatInfo.UnclonedLongTimePatterns] Expected some long time patterns");
- }
-
- return this.allLongTimePatterns;
- }
- }
-
- public static DateTimeFormatInfo ReadOnly(DateTimeFormatInfo dtfi)
- {
- if (dtfi == null)
- {
- throw new ArgumentNullException(nameof(dtfi),
- SR.ArgumentNull_Obj);
- }
- Contract.EndContractBlock();
- if (dtfi.IsReadOnly)
- {
- return (dtfi);
- }
- DateTimeFormatInfo newInfo = (DateTimeFormatInfo)(dtfi.MemberwiseClone());
- // We can use the data member calendar in the setter, instead of the property Calendar,
- // since the cloned copy should have the same state as the original copy.
- newInfo.calendar = Calendar.ReadOnly(dtfi.Calendar);
- newInfo._isReadOnly = true;
- return (newInfo);
- }
-
- public bool IsReadOnly
- {
- get
- {
- return (_isReadOnly);
- }
- }
-
- // Return the native name for the calendar in DTFI.Calendar. The native name is referred to
- // the culture used to create the DTFI. E.g. in the following example, the native language is Japanese.
- // DateTimeFormatInfo dtfi = new CultureInfo("ja-JP", false).DateTimeFormat.Calendar = new JapaneseCalendar();
- // String nativeName = dtfi.NativeCalendarName; // Get the Japanese name for the Japanese calendar.
- // DateTimeFormatInfo dtfi = new CultureInfo("ja-JP", false).DateTimeFormat.Calendar = new GregorianCalendar(GregorianCalendarTypes.Localized);
- // String nativeName = dtfi.NativeCalendarName; // Get the Japanese name for the Gregorian calendar.
- public string NativeCalendarName
- {
- get
- {
- return _cultureData.CalendarName(Calendar.ID);
- }
- }
-
- //
- // Used by custom cultures and others to set the list of available formats. Note that none of them are
- // explicitly used unless someone calls GetAllDateTimePatterns and subsequently uses one of the items
- // from the list.
- //
- // Most of the format characters that can be used in GetAllDateTimePatterns are
- // not really needed since they are one of the following:
- //
- // r/R/s/u locale-independent constants -- cannot be changed!
- // m/M/y/Y fields with a single string in them -- that can be set through props directly
- // f/F/g/G/U derived fields based on combinations of various of the below formats
- //
- // NOTE: No special validation is done here beyond what is done when the actual respective fields
- // are used (what would be the point of disallowing here what we allow in the appropriate property?)
- //
- // WARNING: If more validation is ever done in one place, it should be done in the other.
- //
- public void SetAllDateTimePatterns(String[] patterns, char format)
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
-
- if (patterns == null)
- {
- throw new ArgumentNullException(nameof(patterns), SR.ArgumentNull_Array);
- }
-
- if (patterns.Length == 0)
- {
- throw new ArgumentException(SR.Arg_ArrayZeroError, nameof(patterns));
- }
-
- Contract.EndContractBlock();
-
- for (int i=0; i<patterns.Length; i++)
- {
- if (patterns[i] == null)
- {
- throw new ArgumentNullException("patterns[" + i + "]", SR.ArgumentNull_ArrayValue);
- }
- }
-
- // Remember the patterns, and use the 1st as default
- switch (format)
- {
- case 'd':
- allShortDatePatterns = patterns;
- shortDatePattern = allShortDatePatterns[0];
- break;
-
- case 'D':
- allLongDatePatterns = patterns;
- longDatePattern = allLongDatePatterns[0];
- break;
-
- case 't':
- allShortTimePatterns = patterns;
- shortTimePattern = allShortTimePatterns[0];
- break;
-
- case 'T':
- allLongTimePatterns = patterns;
- longTimePattern = allLongTimePatterns[0];
- break;
-
- case 'y':
- case 'Y':
- allYearMonthPatterns = patterns;
- yearMonthPattern = allYearMonthPatterns[0];
- break;
-
- default:
- throw new ArgumentException(SR.Format_BadFormatSpecifier, nameof(format));
- }
-
- // Clear the token hash table, note that even short dates could require this
- ClearTokenHashTable();
- }
-
- public String[] AbbreviatedMonthGenitiveNames
- {
- get
- {
- return ((String[])internalGetGenitiveMonthNames(true).Clone());
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_Array);
- }
- if (value.Length != 13)
- {
- throw new ArgumentException(SR.Format(SR.Argument_InvalidArrayLength, 13), nameof(value));
- }
- Contract.EndContractBlock();
- CheckNullValue(value, value.Length - 1);
- ClearTokenHashTable();
- this.m_genitiveAbbreviatedMonthNames = value;
- }
- }
-
- public String[] MonthGenitiveNames
- {
- get
- {
- return ((String[])internalGetGenitiveMonthNames(false).Clone());
- }
-
- set
- {
- if (IsReadOnly)
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value),
- SR.ArgumentNull_Array);
- }
- if (value.Length != 13)
- {
- throw new ArgumentException(SR.Format(SR.Argument_InvalidArrayLength, 13), nameof(value));
- }
- Contract.EndContractBlock();
- CheckNullValue(value, value.Length - 1);
- genitiveMonthNames = value;
- ClearTokenHashTable();
- }
- }
-
- //
- // Positive TimeSpan Pattern
- //
- [NonSerialized]
- private string _fullTimeSpanPositivePattern;
- internal String FullTimeSpanPositivePattern
- {
- get
- {
- if (_fullTimeSpanPositivePattern == null)
- {
- CultureData cultureDataWithoutUserOverrides;
- if (_cultureData.UseUserOverride)
- cultureDataWithoutUserOverrides = CultureData.GetCultureData(_cultureData.CultureName, false);
- else
- cultureDataWithoutUserOverrides = _cultureData;
- String decimalSeparator = new NumberFormatInfo(cultureDataWithoutUserOverrides).NumberDecimalSeparator;
-
- _fullTimeSpanPositivePattern = "d':'h':'mm':'ss'" + decimalSeparator + "'FFFFFFF";
- }
- return _fullTimeSpanPositivePattern;
- }
- }
-
- //
- // Negative TimeSpan Pattern
- //
- [NonSerialized]
- private string _fullTimeSpanNegativePattern;
- internal String FullTimeSpanNegativePattern
- {
- get
- {
- if (_fullTimeSpanNegativePattern == null)
- _fullTimeSpanNegativePattern = "'-'" + FullTimeSpanPositivePattern;
- return _fullTimeSpanNegativePattern;
- }
- }
-
- //
- // Get suitable CompareInfo from current DTFI object.
- //
- internal CompareInfo CompareInfo
- {
- get
- {
- if (_compareInfo == null)
- {
- // We use the regular GetCompareInfo here to make sure the created CompareInfo object is stored in the
- // CompareInfo cache. otherwise we would just create CompareInfo using _cultureData.
- _compareInfo = CompareInfo.GetCompareInfo(_cultureData.SCOMPAREINFO);
- }
-
- return _compareInfo;
- }
- }
-
-
- internal const DateTimeStyles InvalidDateTimeStyles = ~(DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite
- | DateTimeStyles.AllowInnerWhite | DateTimeStyles.NoCurrentDateDefault
- | DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeLocal
- | DateTimeStyles.AssumeUniversal | DateTimeStyles.RoundtripKind);
-
- internal static void ValidateStyles(DateTimeStyles style, String parameterName)
- {
- if ((style & InvalidDateTimeStyles) != 0)
- {
- throw new ArgumentException(SR.Argument_InvalidDateTimeStyles, parameterName);
- }
- if (((style & (DateTimeStyles.AssumeLocal)) != 0) && ((style & (DateTimeStyles.AssumeUniversal)) != 0))
- {
- throw new ArgumentException(SR.Argument_ConflictingDateTimeStyles, parameterName);
- }
- Contract.EndContractBlock();
- if (((style & DateTimeStyles.RoundtripKind) != 0)
- && ((style & (DateTimeStyles.AssumeLocal | DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal)) != 0))
- {
- throw new ArgumentException(SR.Argument_ConflictingDateTimeRoundtripStyles, parameterName);
- }
- }
-
- //
- // Actions: Return the internal flag used in formatting and parsing.
- // The flag can be used to indicate things like if genitive forms is used in this DTFi, or if leap year gets different month names.
- //
- internal DateTimeFormatFlags FormatFlags
- {
- get
- {
- if (formatFlags == DateTimeFormatFlags.NotInitialized)
- {
- // Build the format flags from the data in this DTFI
- formatFlags = DateTimeFormatFlags.None;
- formatFlags |= (DateTimeFormatFlags)DateTimeFormatInfoScanner.GetFormatFlagGenitiveMonth(
- MonthNames, internalGetGenitiveMonthNames(false), AbbreviatedMonthNames, internalGetGenitiveMonthNames(true));
- formatFlags |= (DateTimeFormatFlags)DateTimeFormatInfoScanner.GetFormatFlagUseSpaceInMonthNames(
- MonthNames, internalGetGenitiveMonthNames(false), AbbreviatedMonthNames, internalGetGenitiveMonthNames(true));
- formatFlags |= (DateTimeFormatFlags)DateTimeFormatInfoScanner.GetFormatFlagUseSpaceInDayNames(DayNames, AbbreviatedDayNames);
- formatFlags |= (DateTimeFormatFlags)DateTimeFormatInfoScanner.GetFormatFlagUseHebrewCalendar((int)Calendar.ID);
- }
- return (formatFlags);
- }
- }
-
- internal Boolean HasForceTwoDigitYears
- {
- get
- {
- switch (calendar.ID)
- {
- // Handle Japanese and Taiwan cases.
- // If is y/yy, do not get (year % 100). "y" will print
- // year without leading zero. "yy" will print year with two-digit in leading zero.
- // If pattern is yyy/yyyy/..., print year value with two-digit in leading zero.
- // So year 5 is "05", and year 125 is "125".
- // The reason for not doing (year % 100) is for Taiwan calendar.
- // If year 125, then output 125 and not 25.
- // Note: OS uses "yyyy" for Taiwan calendar by default.
- case (CalendarId.JAPAN):
- case (CalendarId.TAIWAN):
- return true;
- }
- return false;
- }
- }
-
- // Returns whether the YearMonthAdjustment function has any fix-up work to do for this culture/calendar.
- internal Boolean HasYearMonthAdjustment
- {
- get
- {
- return ((FormatFlags & DateTimeFormatFlags.UseHebrewRule) != 0);
- }
- }
-
- // This is a callback that the parser can make back into the DTFI to let it fiddle with special
- // cases associated with that culture or calendar. Currently this only has special cases for
- // the Hebrew calendar, but this could be extended to other cultures.
- //
- // The return value is whether the year and month are actually valid for this calendar.
- internal Boolean YearMonthAdjustment(ref int year, ref int month, Boolean parsedMonthName)
- {
- if ((FormatFlags & DateTimeFormatFlags.UseHebrewRule) != 0)
- {
- // Special rules to fix up the Hebrew year/month
-
- // When formatting, we only format up to the hundred digit of the Hebrew year, although Hebrew year is now over 5000.
- // E.g. if the year is 5763, we only format as 763.
- if (year < 1000)
- {
- year += 5000;
- }
-
- // Because we need to calculate leap year, we should fall out now for an invalid year.
- if (year < Calendar.GetYear(Calendar.MinSupportedDateTime) || year > Calendar.GetYear(Calendar.MaxSupportedDateTime))
- {
- return false;
- }
-
- // To handle leap months, the set of month names in the symbol table does not always correspond to the numbers.
- // For non-leap years, month 7 (Adar Bet) is not present, so we need to make using this month invalid and
- // shuffle the other months down.
- if (parsedMonthName)
- {
- if (!Calendar.IsLeapYear(year))
- {
- if (month >= 8)
- {
- month--;
- }
- else if (month == 7)
- {
- return false;
- }
- }
- }
- }
- return true;
- }
-
- //
- // DateTimeFormatInfo tokenizer. This is used by DateTime.Parse() to break input string into tokens.
- //
- [NonSerialized]
- private TokenHashValue[] _dtfiTokenHash;
-
- private const int TOKEN_HASH_SIZE = 199;
- private const int SECOND_PRIME = 197;
- private const String dateSeparatorOrTimeZoneOffset = "-";
- private const String invariantDateSeparator = "/";
- private const String invariantTimeSeparator = ":";
-
- //
- // Common Ignorable Symbols
- //
- internal const String IgnorablePeriod = ".";
- internal const String IgnorableComma = ",";
-
- //
- // Year/Month/Day suffixes
- //
- internal const String CJKYearSuff = "\u5e74";
- internal const String CJKMonthSuff = "\u6708";
- internal const String CJKDaySuff = "\u65e5";
-
- internal const String KoreanYearSuff = "\ub144";
- internal const String KoreanMonthSuff = "\uc6d4";
- internal const String KoreanDaySuff = "\uc77c";
-
- internal const String KoreanHourSuff = "\uc2dc";
- internal const String KoreanMinuteSuff = "\ubd84";
- internal const String KoreanSecondSuff = "\ucd08";
-
- internal const String CJKHourSuff = "\u6642";
- internal const String ChineseHourSuff = "\u65f6";
-
- internal const String CJKMinuteSuff = "\u5206";
- internal const String CJKSecondSuff = "\u79d2";
-
- internal const String LocalTimeMark = "T";
-
- internal const String GMTName = "GMT";
- internal const String ZuluName = "Z";
-
- internal const String KoreanLangName = "ko";
- internal const String JapaneseLangName = "ja";
- internal const String EnglishLangName = "en";
-
- private static volatile DateTimeFormatInfo s_jajpDTFI;
- private static volatile DateTimeFormatInfo s_zhtwDTFI;
-
- //
- // Create a Japanese DTFI which uses JapaneseCalendar. This is used to parse
- // date string with Japanese era name correctly even when the supplied DTFI
- // does not use Japanese calendar.
- // The created instance is stored in global s_jajpDTFI.
- //
- internal static DateTimeFormatInfo GetJapaneseCalendarDTFI()
- {
- DateTimeFormatInfo temp = s_jajpDTFI;
- if (temp == null)
- {
- temp = new CultureInfo("ja-JP", false).DateTimeFormat;
- temp.Calendar = JapaneseCalendar.GetDefaultInstance();
- s_jajpDTFI = temp;
- }
- return (temp);
- }
-
- // Create a Taiwan DTFI which uses TaiwanCalendar. This is used to parse
- // date string with era name correctly even when the supplied DTFI
- // does not use Taiwan calendar.
- // The created instance is stored in global s_zhtwDTFI.
- internal static DateTimeFormatInfo GetTaiwanCalendarDTFI()
- {
- DateTimeFormatInfo temp = s_zhtwDTFI;
- if (temp == null)
- {
- temp = new CultureInfo("zh-TW", false).DateTimeFormat;
- temp.Calendar = TaiwanCalendar.GetDefaultInstance();
- s_zhtwDTFI = temp;
- }
- return (temp);
- }
-
-
- // DTFI properties should call this when the setter are called.
- private void ClearTokenHashTable()
- {
- _dtfiTokenHash = null;
- formatFlags = DateTimeFormatFlags.NotInitialized;
- }
-
- internal TokenHashValue[] CreateTokenHashTable()
- {
- TokenHashValue[] temp = _dtfiTokenHash;
- if (temp == null)
- {
- temp = new TokenHashValue[TOKEN_HASH_SIZE];
-
- bool koreanLanguage = LanguageName.Equals(KoreanLangName);
-
- string sep = this.TimeSeparator.Trim();
- if (IgnorableComma != sep) InsertHash(temp, IgnorableComma, TokenType.IgnorableSymbol, 0);
- if (IgnorablePeriod != sep) InsertHash(temp, IgnorablePeriod, TokenType.IgnorableSymbol, 0);
-
- if (KoreanHourSuff != sep && CJKHourSuff != sep && ChineseHourSuff != sep)
- {
- //
- // On the Macintosh, the default TimeSeparator is identical to the KoreanHourSuff, CJKHourSuff, or ChineseHourSuff for some cultures like
- // ja-JP and ko-KR. In these cases having the same symbol inserted into the hash table with multiple TokenTypes causes undesirable
- // DateTime.Parse behavior. For instance, the DateTimeFormatInfo.Tokenize() method might return SEP_DateOrOffset for KoreanHourSuff
- // instead of SEP_HourSuff.
- //
- InsertHash(temp, this.TimeSeparator, TokenType.SEP_Time, 0);
- }
-
- InsertHash(temp, this.AMDesignator, TokenType.SEP_Am | TokenType.Am, 0);
- InsertHash(temp, this.PMDesignator, TokenType.SEP_Pm | TokenType.Pm, 1);
-
- // TODO: This ignores similar custom cultures
- if (LanguageName.Equals("sq"))
- {
- // Albanian allows time formats like "12:00.PD"
- InsertHash(temp, IgnorablePeriod + this.AMDesignator, TokenType.SEP_Am | TokenType.Am, 0);
- InsertHash(temp, IgnorablePeriod + this.PMDesignator, TokenType.SEP_Pm | TokenType.Pm, 1);
- }
-
- // CJK suffix
- InsertHash(temp, CJKYearSuff, TokenType.SEP_YearSuff, 0);
- InsertHash(temp, KoreanYearSuff, TokenType.SEP_YearSuff, 0);
- InsertHash(temp, CJKMonthSuff, TokenType.SEP_MonthSuff, 0);
- InsertHash(temp, KoreanMonthSuff, TokenType.SEP_MonthSuff, 0);
- InsertHash(temp, CJKDaySuff, TokenType.SEP_DaySuff, 0);
- InsertHash(temp, KoreanDaySuff, TokenType.SEP_DaySuff, 0);
-
- InsertHash(temp, CJKHourSuff, TokenType.SEP_HourSuff, 0);
- InsertHash(temp, ChineseHourSuff, TokenType.SEP_HourSuff, 0);
- InsertHash(temp, CJKMinuteSuff, TokenType.SEP_MinuteSuff, 0);
- InsertHash(temp, CJKSecondSuff, TokenType.SEP_SecondSuff, 0);
-
- // TODO: This ignores other custom cultures that might want to do something similar
- if (koreanLanguage)
- {
- // Korean suffix
- InsertHash(temp, KoreanHourSuff, TokenType.SEP_HourSuff, 0);
- InsertHash(temp, KoreanMinuteSuff, TokenType.SEP_MinuteSuff, 0);
- InsertHash(temp, KoreanSecondSuff, TokenType.SEP_SecondSuff, 0);
- }
-
- if (LanguageName.Equals("ky"))
- {
- // For some cultures, the date separator works more like a comma, being allowed before or after any date part
- InsertHash(temp, dateSeparatorOrTimeZoneOffset, TokenType.IgnorableSymbol, 0);
- }
- else
- {
- InsertHash(temp, dateSeparatorOrTimeZoneOffset, TokenType.SEP_DateOrOffset, 0);
- }
-
- String[] dateWords = null;
- DateTimeFormatInfoScanner scanner = null;
-
- // We need to rescan the date words since we're always synthetic
- scanner = new DateTimeFormatInfoScanner();
- m_dateWords = dateWords = scanner.GetDateWordsOfDTFI(this);
- // Ensure the formatflags is initialized.
- DateTimeFormatFlags flag = FormatFlags;
-
- // For some cultures, the date separator works more like a comma, being allowed before or after any date part.
- // In these cultures, we do not use normal date separator since we disallow date separator after a date terminal state.
- // This is determined in DateTimeFormatInfoScanner. Use this flag to determine if we should treat date separator as ignorable symbol.
- bool useDateSepAsIgnorableSymbol = false;
-
- String monthPostfix = null;
- if (dateWords != null)
- {
- // There are DateWords. It could be a real date word (such as "de"), or a monthPostfix.
- // The monthPostfix starts with '\xfffe' (MonthPostfixChar), followed by the real monthPostfix.
- for (int i = 0; i < dateWords.Length; i++)
- {
- switch (dateWords[i][0])
- {
- // This is a month postfix
- case DateTimeFormatInfoScanner.MonthPostfixChar:
- // Get the real month postfix.
- monthPostfix = dateWords[i].Substring(1);
- // Add the month name + postfix into the token.
- AddMonthNames(temp, monthPostfix);
- break;
- case DateTimeFormatInfoScanner.IgnorableSymbolChar:
- String symbol = dateWords[i].Substring(1);
- InsertHash(temp, symbol, TokenType.IgnorableSymbol, 0);
- if (this.DateSeparator.Trim(null).Equals(symbol))
- {
- // The date separator is the same as the ignorable symbol.
- useDateSepAsIgnorableSymbol = true;
- }
- break;
- default:
- InsertHash(temp, dateWords[i], TokenType.DateWordToken, 0);
- // TODO: This ignores similar custom cultures
- if (LanguageName.Equals("eu"))
- {
- // Basque has date words with leading dots
- InsertHash(temp, IgnorablePeriod + dateWords[i], TokenType.DateWordToken, 0);
- }
- break;
- }
- }
- }
-
- if (!useDateSepAsIgnorableSymbol)
- {
- // Use the normal date separator.
- InsertHash(temp, this.DateSeparator, TokenType.SEP_Date, 0);
- }
- // Add the regular month names.
- AddMonthNames(temp, null);
-
- // Add the abbreviated month names.
- for (int i = 1; i <= 13; i++)
- {
- InsertHash(temp, GetAbbreviatedMonthName(i), TokenType.MonthToken, i);
- }
-
-
- if ((FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != 0)
- {
- for (int i = 1; i <= 13; i++)
- {
- String str;
- str = internalGetMonthName(i, MonthNameStyles.Genitive, false);
- InsertHash(temp, str, TokenType.MonthToken, i);
- }
- }
-
- if ((FormatFlags & DateTimeFormatFlags.UseLeapYearMonth) != 0)
- {
- for (int i = 1; i <= 13; i++)
- {
- String str;
- str = internalGetMonthName(i, MonthNameStyles.LeapYear, false);
- InsertHash(temp, str, TokenType.MonthToken, i);
- }
- }
-
- for (int i = 0; i < 7; i++)
- {
- //String str = GetDayOfWeekNames()[i];
- // We have to call public methods here to work with inherited DTFI.
- String str = GetDayName((DayOfWeek)i);
- InsertHash(temp, str, TokenType.DayOfWeekToken, i);
-
- str = GetAbbreviatedDayName((DayOfWeek)i);
- InsertHash(temp, str, TokenType.DayOfWeekToken, i);
- }
-
- int[] eras = calendar.Eras;
- for (int i = 1; i <= eras.Length; i++)
- {
- InsertHash(temp, GetEraName(i), TokenType.EraToken, i);
- InsertHash(temp, GetAbbreviatedEraName(i), TokenType.EraToken, i);
- }
-
- // TODO: This ignores other cultures that might want to do something similar
- if (LanguageName.Equals(JapaneseLangName))
- {
- // Japanese allows day of week forms like: "(Tue)"
- for (int i = 0; i < 7; i++)
- {
- String specialDayOfWeek = "(" + GetAbbreviatedDayName((DayOfWeek)i) + ")";
- InsertHash(temp, specialDayOfWeek, TokenType.DayOfWeekToken, i);
- }
- if (this.Calendar.GetType() != typeof(JapaneseCalendar))
- {
- // Special case for Japanese. If this is a Japanese DTFI, and the calendar is not Japanese calendar,
- // we will check Japanese Era name as well when the calendar is Gregorian.
- DateTimeFormatInfo jaDtfi = GetJapaneseCalendarDTFI();
- for (int i = 1; i <= jaDtfi.Calendar.Eras.Length; i++)
- {
- InsertHash(temp, jaDtfi.GetEraName(i), TokenType.JapaneseEraToken, i);
- InsertHash(temp, jaDtfi.GetAbbreviatedEraName(i), TokenType.JapaneseEraToken, i);
- // m_abbrevEnglishEraNames[0] contains the name for era 1, so the token value is i+1.
- InsertHash(temp, jaDtfi.AbbreviatedEnglishEraNames[i - 1], TokenType.JapaneseEraToken, i);
- }
- }
- }
- // TODO: This prohibits similar custom cultures, but we hard coded the name
- else if (CultureName.Equals("zh-TW"))
- {
- DateTimeFormatInfo twDtfi = GetTaiwanCalendarDTFI();
- for (int i = 1; i <= twDtfi.Calendar.Eras.Length; i++)
- {
- if (twDtfi.GetEraName(i).Length > 0)
- {
- InsertHash(temp, twDtfi.GetEraName(i), TokenType.TEraToken, i);
- }
- }
- }
-
- InsertHash(temp, InvariantInfo.AMDesignator, TokenType.SEP_Am | TokenType.Am, 0);
- InsertHash(temp, InvariantInfo.PMDesignator, TokenType.SEP_Pm | TokenType.Pm, 1);
-
- // Add invariant month names and day names.
- for (int i = 1; i <= 12; i++)
- {
- String str;
- // We have to call public methods here to work with inherited DTFI.
- // Insert the month name first, so that they are at the front of abbrevaited
- // month names.
- str = InvariantInfo.GetMonthName(i);
- InsertHash(temp, str, TokenType.MonthToken, i);
- str = InvariantInfo.GetAbbreviatedMonthName(i);
- InsertHash(temp, str, TokenType.MonthToken, i);
- }
-
- for (int i = 0; i < 7; i++)
- {
- // We have to call public methods here to work with inherited DTFI.
- String str = InvariantInfo.GetDayName((DayOfWeek)i);
- InsertHash(temp, str, TokenType.DayOfWeekToken, i);
-
- str = InvariantInfo.GetAbbreviatedDayName((DayOfWeek)i);
- InsertHash(temp, str, TokenType.DayOfWeekToken, i);
- }
-
- for (int i = 0; i < AbbreviatedEnglishEraNames.Length; i++)
- {
- // m_abbrevEnglishEraNames[0] contains the name for era 1, so the token value is i+1.
- InsertHash(temp, AbbreviatedEnglishEraNames[i], TokenType.EraToken, i + 1);
- }
-
- InsertHash(temp, LocalTimeMark, TokenType.SEP_LocalTimeMark, 0);
- InsertHash(temp, GMTName, TokenType.TimeZoneToken, 0);
- InsertHash(temp, ZuluName, TokenType.TimeZoneToken, 0);
-
- InsertHash(temp, invariantDateSeparator, TokenType.SEP_Date, 0);
- InsertHash(temp, invariantTimeSeparator, TokenType.SEP_Time, 0);
-
- _dtfiTokenHash = temp;
- }
- return (temp);
- }
-
- private void AddMonthNames(TokenHashValue[] temp, String monthPostfix)
- {
- for (int i = 1; i <= 13; i++)
- {
- String str;
- //str = internalGetMonthName(i, MonthNameStyles.Regular, false);
- // We have to call public methods here to work with inherited DTFI.
- // Insert the month name first, so that they are at the front of abbrevaited
- // month names.
- str = GetMonthName(i);
- if (str.Length > 0)
- {
- if (monthPostfix != null)
- {
- // Insert the month name with the postfix first, so it can be matched first.
- InsertHash(temp, str + monthPostfix, TokenType.MonthToken, i);
- }
- else
- {
- InsertHash(temp, str, TokenType.MonthToken, i);
- }
- }
- str = GetAbbreviatedMonthName(i);
- InsertHash(temp, str, TokenType.MonthToken, i);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Actions:
- // Try to parse the current word to see if it is a Hebrew number.
- // Tokens will be updated accordingly.
- // This is called by the Lexer of DateTime.Parse().
- //
- // Unlike most of the functions in this class, the return value indicates
- // whether or not it started to parse. The badFormat parameter indicates
- // if parsing began, but the format was bad.
- //
- ////////////////////////////////////////////////////////////////////////
-
- private static bool TryParseHebrewNumber(
-#if INSIDE_CLR
- ref __DTString str,
-#else
- ref FormatProvider.__DTString str,
-#endif
- out Boolean badFormat,
- out int number)
- {
- number = -1;
- badFormat = false;
-
- int i = str.Index;
- if (!HebrewNumber.IsDigit(str.Value[i]))
- {
- // If the current character is not a Hebrew digit, just return false.
- // There is no chance that we can parse a valid Hebrew number from here.
- return (false);
- }
- // The current character is a Hebrew digit. Try to parse this word as a Hebrew number.
- HebrewNumberParsingContext context = new HebrewNumberParsingContext(0);
- HebrewNumberParsingState state;
-
- do
- {
- state = HebrewNumber.ParseByChar(str.Value[i++], ref context);
- switch (state)
- {
- case HebrewNumberParsingState.InvalidHebrewNumber: // Not a valid Hebrew number.
- case HebrewNumberParsingState.NotHebrewDigit: // The current character is not a Hebrew digit character.
- // Break out so that we don't continue to try parse this as a Hebrew number.
- return (false);
- }
- } while (i < str.Value.Length && (state != HebrewNumberParsingState.FoundEndOfHebrewNumber));
-
- // When we are here, we are either at the end of the string, or we find a valid Hebrew number.
- Debug.Assert(state == HebrewNumberParsingState.ContinueParsing || state == HebrewNumberParsingState.FoundEndOfHebrewNumber,
- "Invalid returned state from HebrewNumber.ParseByChar()");
-
- if (state != HebrewNumberParsingState.FoundEndOfHebrewNumber)
- {
- // We reach end of the string but we can't find a terminal state in parsing Hebrew number.
- return (false);
- }
-
- // We have found a valid Hebrew number. Update the index.
- str.Advance(i - str.Index);
-
- // Get the final Hebrew number value from the HebrewNumberParsingContext.
- number = context.result;
-
- return (true);
- }
-
- private static bool IsHebrewChar(char ch)
- {
- return (ch >= '\x0590' && ch <= '\x05ff');
- }
-
- internal bool Tokenize(TokenType TokenMask, out TokenType tokenType, out int tokenValue,
-#if INSIDE_CLR
- ref __DTString str)
-#else
- ref FormatProvider.__DTString str)
-#endif
-
- {
- tokenType = TokenType.UnknownToken;
- tokenValue = 0;
-
- TokenHashValue value;
- Debug.Assert(str.Index < str.Value.Length, "DateTimeFormatInfo.Tokenize(): start < value.Length");
-
- char ch = str.m_current;
- bool isLetter = Char.IsLetter(ch);
- if (isLetter)
- {
- ch = this.Culture.TextInfo.ToLower(ch);
- if (IsHebrewChar(ch) && TokenMask == TokenType.RegularTokenMask)
- {
- bool badFormat;
- if (TryParseHebrewNumber(ref str, out badFormat, out tokenValue))
- {
- if (badFormat)
- {
- tokenType = TokenType.UnknownToken;
- return (false);
- }
- // This is a Hebrew number.
- // Do nothing here. TryParseHebrewNumber() will update token accordingly.
- tokenType = TokenType.HebrewNumber;
- return (true);
- }
- }
- }
-
-
- int hashcode = ch % TOKEN_HASH_SIZE;
- int hashProbe = 1 + ch % SECOND_PRIME;
- int remaining = str.len - str.Index;
- int i = 0;
-
- TokenHashValue[] hashTable = _dtfiTokenHash;
- if (hashTable == null)
- {
- hashTable = CreateTokenHashTable();
- }
- do
- {
- value = hashTable[hashcode];
- if (value == null)
- {
- // Not found.
- break;
- }
- // Check this value has the right category (regular token or separator token) that we are looking for.
- if (((int)value.tokenType & (int)TokenMask) > 0 && value.tokenString.Length <= remaining)
- {
- bool compareStrings = true;
- if (isLetter)
- {
- // If this token starts with a letter, make sure that we won't allow partial match. So you can't tokenize "MarchWed" separately.
- // Also an optimization to avoid string comparison
- int nextCharIndex = str.Index + value.tokenString.Length;
- if (nextCharIndex > str.len)
- {
- compareStrings = false;
- }
- else if (nextCharIndex < str.len)
- {
- // Check word boundary. The next character should NOT be a letter.
- char nextCh = str.Value[nextCharIndex];
- compareStrings = !(Char.IsLetter(nextCh));
- }
- }
- if (compareStrings && CompareStringIgnoreCaseOptimized(str.Value, str.Index, value.tokenString.Length, value.tokenString, 0, value.tokenString.Length))
- {
- tokenType = value.tokenType & TokenMask;
- tokenValue = value.tokenValue;
- str.Advance(value.tokenString.Length);
- return (true);
- }
- else if ((value.tokenType == TokenType.MonthToken && HasSpacesInMonthNames) ||
- (value.tokenType == TokenType.DayOfWeekToken && HasSpacesInDayNames))
- {
- // For month or day token, we will match the names which have spaces.
- int matchStrLen = 0;
- if (str.MatchSpecifiedWords(value.tokenString, true, ref matchStrLen))
- {
- tokenType = value.tokenType & TokenMask;
- tokenValue = value.tokenValue;
- str.Advance(matchStrLen);
- return (true);
- }
- }
- }
- i++;
- hashcode += hashProbe;
- if (hashcode >= TOKEN_HASH_SIZE) hashcode -= TOKEN_HASH_SIZE;
- } while (i < TOKEN_HASH_SIZE);
-
- return (false);
- }
-
- private void InsertAtCurrentHashNode(TokenHashValue[] hashTable, String str, char ch, TokenType tokenType, int tokenValue, int pos, int hashcode, int hashProbe)
- {
- // Remember the current slot.
- TokenHashValue previousNode = hashTable[hashcode];
-
- //// Console.WriteLine(" Insert Key: {0} in {1}", str, slotToInsert);
- // Insert the new node into the current slot.
- hashTable[hashcode] = new TokenHashValue(str, tokenType, tokenValue); ;
-
- while (++pos < TOKEN_HASH_SIZE)
- {
- hashcode += hashProbe;
- if (hashcode >= TOKEN_HASH_SIZE) hashcode -= TOKEN_HASH_SIZE;
- // Remember this slot
- TokenHashValue temp = hashTable[hashcode];
-
- if (temp != null && this.Culture.TextInfo.ToLower(temp.tokenString[0]) != ch)
- {
- continue;
- }
- // Put the previous slot into this slot.
- hashTable[hashcode] = previousNode;
- //// Console.WriteLine(" Move {0} to slot {1}", previousNode.tokenString, hashcode);
- if (temp == null)
- {
- // Done
- return;
- }
- previousNode = temp;
- };
- Debug.Assert(false, "The hashtable is full. This should not happen.");
- }
-
- private void InsertHash(TokenHashValue[] hashTable, String str, TokenType tokenType, int tokenValue)
- {
- // The month of the 13th month is allowed to be null, so make sure that we ignore null value here.
- if (str == null || str.Length == 0)
- {
- return;
- }
- TokenHashValue value;
- int i = 0;
- // If there is whitespace characters in the beginning and end of the string, trim them since whitespaces are skipped by
- // DateTime.Parse().
- if (Char.IsWhiteSpace(str[0]) || Char.IsWhiteSpace(str[str.Length - 1]))
- {
- str = str.Trim(null); // Trim white space characters.
- // Could have space for separators
- if (str.Length == 0)
- return;
- }
- char ch = this.Culture.TextInfo.ToLower(str[0]);
- int hashcode = ch % TOKEN_HASH_SIZE;
- int hashProbe = 1 + ch % SECOND_PRIME;
- do
- {
- value = hashTable[hashcode];
- if (value == null)
- {
- //// Console.WriteLine(" Put Key: {0} in {1}", str, hashcode);
- hashTable[hashcode] = new TokenHashValue(str, tokenType, tokenValue);
- return;
- }
- else
- {
- // Collision happens. Find another slot.
- if (str.Length >= value.tokenString.Length)
- {
- // If there are two tokens with the same prefix, we have to make sure that the longer token should be at the front of
- // the shorter ones.
- if (this.CompareStringIgnoreCaseOptimized(str, 0, value.tokenString.Length, value.tokenString, 0, value.tokenString.Length))
- {
- if (str.Length > value.tokenString.Length)
- {
- // The str to be inserted has the same prefix as the current token, and str is longer.
- // Insert str into this node, and shift every node behind it.
- InsertAtCurrentHashNode(hashTable, str, ch, tokenType, tokenValue, i, hashcode, hashProbe);
- return;
- }
- else
- {
- // Same token. If they have different types (regular token vs separator token). Add them.
- // If we have the same regular token or separator token in the hash already, do NOT update the hash.
- // Therefore, the order of inserting token is significant here regarding what tokenType will be kept in the hash.
-
-
- //
- // Check the current value of RegularToken (stored in the lower 8-bit of tokenType) , and insert the tokenType into the hash ONLY when we don't have a RegularToken yet.
- // Also check the current value of SeparatorToken (stored in the upper 8-bit of token), and insert the tokenType into the hash ONLY when we don't have the SeparatorToken yet.
- //
-
- int nTokenType = (int)tokenType;
- int nCurrentTokenTypeInHash = (int)value.tokenType;
-
- //
- // The folowing is the fix for the issue of throwing FormatException when "mar" is passed in string of the short date format dd/MMM/yyyy for es-MX
- //
-
- if (((nCurrentTokenTypeInHash & (int)TokenType.RegularTokenMask) == 0) && ((nTokenType & (int)TokenType.RegularTokenMask) != 0) ||
- ((nCurrentTokenTypeInHash & (int)TokenType.SeparatorTokenMask) == 0) && ((nTokenType & (int)TokenType.SeparatorTokenMask) != 0))
- {
- value.tokenType |= tokenType;
- if (tokenValue != 0)
- {
- value.tokenValue = tokenValue;
- }
- }
- // The token to be inserted is already in the table. Skip it.
- return;
- }
- }
- }
- }
- //// Console.WriteLine(" COLLISION. Old Key: {0}, New Key: {1}", hashTable[hashcode].tokenString, str);
- i++;
- hashcode += hashProbe;
- if (hashcode >= TOKEN_HASH_SIZE) hashcode -= TOKEN_HASH_SIZE;
- } while (i < TOKEN_HASH_SIZE);
- Debug.Assert(false, "The hashtable is full. This should not happen.");
- }
-
- private bool CompareStringIgnoreCaseOptimized(string string1, int offset1, int length1, string string2, int offset2, int length2)
- {
- // Optimize for one character cases which are common due to date and time separators (/ and :)
- if (length1 == 1 && length2 == 1 && string1[offset1] == string2[offset2])
- {
- return true;
- }
-
- return (this.Culture.CompareInfo.Compare(string1, offset1, length1, string2, offset2, length2, CompareOptions.IgnoreCase) == 0);
- }
-
- // class DateTimeFormatInfo
-
- internal class TokenHashValue
- {
- internal String tokenString;
- internal TokenType tokenType;
- internal int tokenValue;
-
- internal TokenHashValue(String tokenString, TokenType tokenType, int tokenValue)
- {
- this.tokenString = tokenString;
- this.tokenType = tokenType;
- this.tokenValue = tokenValue;
- }
- }
- }
-
-#if !INSIDE_CLR
- //
- // The type of token that will be returned by DateTimeFormatInfo.Tokenize().
- //
- internal enum TokenType
- {
- // The valid token should start from 1.
-
- // Regular tokens. The range is from 0x00 ~ 0xff.
- NumberToken = 1, // The number. E.g. "12"
- YearNumberToken = 2, // The number which is considered as year number, which has 3 or more digits. E.g. "2003"
- Am = 3, // AM timemark. E.g. "AM"
- Pm = 4, // PM timemark. E.g. "PM"
- MonthToken = 5, // A word (or words) that represents a month name. E.g. "March"
- EndOfString = 6, // End of string
- DayOfWeekToken = 7, // A word (or words) that represents a day of week name. E.g. "Monday" or "Mon"
- TimeZoneToken = 8, // A word that represents a timezone name. E.g. "GMT"
- EraToken = 9, // A word that represents a era name. E.g. "A.D."
- DateWordToken = 10, // A word that can appear in a DateTime string, but serves no parsing semantics. E.g. "de" in Spanish culture.
- UnknownToken = 11, // An unknown word, which signals an error in parsing.
- HebrewNumber = 12, // A number that is composed of Hebrew text. Hebrew calendar uses Hebrew digits for year values, month values, and day values.
- JapaneseEraToken = 13, // Era name for JapaneseCalendar
- TEraToken = 14, // Era name for TaiwanCalendar
- IgnorableSymbol = 15, // A separator like "," that is equivalent to whitespace
-
-
- // Separator tokens.
- SEP_Unk = 0x100, // Unknown separator.
- SEP_End = 0x200, // The end of the parsing string.
- SEP_Space = 0x300, // Whitespace (including comma).
- SEP_Am = 0x400, // AM timemark. E.g. "AM"
- SEP_Pm = 0x500, // PM timemark. E.g. "PM"
- SEP_Date = 0x600, // date separator. E.g. "/"
- SEP_Time = 0x700, // time separator. E.g. ":"
- SEP_YearSuff = 0x800, // Chinese/Japanese/Korean year suffix.
- SEP_MonthSuff = 0x900, // Chinese/Japanese/Korean month suffix.
- SEP_DaySuff = 0xa00, // Chinese/Japanese/Korean day suffix.
- SEP_HourSuff = 0xb00, // Chinese/Japanese/Korean hour suffix.
- SEP_MinuteSuff = 0xc00, // Chinese/Japanese/Korean minute suffix.
- SEP_SecondSuff = 0xd00, // Chinese/Japanese/Korean second suffix.
- SEP_LocalTimeMark = 0xe00, // 'T', used in ISO 8601 format.
- SEP_DateOrOffset = 0xf00, // '-' which could be a date separator or start of a time zone offset
-
- RegularTokenMask = 0x00ff,
- SeparatorTokenMask = 0xff00,
- }
-#endif
-
-}
diff --git a/src/mscorlib/corefx/System/Globalization/DateTimeFormatInfoScanner.cs b/src/mscorlib/corefx/System/Globalization/DateTimeFormatInfoScanner.cs
deleted file mode 100644
index 9cbc19f385..0000000000
--- a/src/mscorlib/corefx/System/Globalization/DateTimeFormatInfoScanner.cs
+++ /dev/null
@@ -1,742 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////
-//
-// DateTimeFormatInfoScanner
-//
-// Scan a specified DateTimeFormatInfo to search for data used in DateTime.Parse()
-//
-// The data includes:
-//
-// DateWords: such as "de" used in es-ES (Spanish) LongDatePattern.
-// Postfix: such as "ta" used in fi-FI after the month name.
-//
-// This class is shared among mscorlib.dll and sysglobl.dll.
-// Use conditional CULTURE_AND_REGIONINFO_BUILDER_ONLY to differentiate between
-// methods for mscorlib.dll and sysglobl.dll.
-//
-////////////////////////////////////////////////////////////////////////////
-
-using System;
-using System.Globalization;
-using System.Collections;
-using System.Collections.Generic;
-using System.Text;
-
-namespace System.Globalization
-{
-
-#if INSIDE_CLR
- using StringStringDictionary = Dictionary<string, string>;
- using StringList = List<string>;
-#else
- using StringStringDictionary = LowLevelDictionary<string, string>;
- using StringList = LowLevelList<string>;
-#endif
-
- //
- // from LocaleEx.txt header
- //
- //; IFORMATFLAGS
- //; Parsing/formatting flags.
- internal enum FORMATFLAGS
- {
- None = 0x00000000,
- UseGenitiveMonth = 0x00000001,
- UseLeapYearMonth = 0x00000002,
- UseSpacesInMonthNames = 0x00000004,
- UseHebrewParsing = 0x00000008,
- UseSpacesInDayNames = 0x00000010, // Has spaces or non-breaking space in the day names.
- UseDigitPrefixInTokens = 0x00000020, // Has token starting with numbers.
- }
-
- internal enum CalendarId : ushort
- {
- UNINITIALIZED_VALUE = 0,
- GREGORIAN = 1, // Gregorian (localized) calendar
- GREGORIAN_US = 2, // Gregorian (U.S.) calendar
- JAPAN = 3, // Japanese Emperor Era calendar
- /* SSS_WARNINGS_OFF */
- TAIWAN = 4, // Taiwan Era calendar /* SSS_WARNINGS_ON */
- KOREA = 5, // Korean Tangun Era calendar
- HIJRI = 6, // Hijri (Arabic Lunar) calendar
- THAI = 7, // Thai calendar
- HEBREW = 8, // Hebrew (Lunar) calendar
- GREGORIAN_ME_FRENCH = 9, // Gregorian Middle East French calendar
- GREGORIAN_ARABIC = 10, // Gregorian Arabic calendar
- GREGORIAN_XLIT_ENGLISH = 11, // Gregorian Transliterated English calendar
- GREGORIAN_XLIT_FRENCH = 12,
- // Note that all calendars after this point are MANAGED ONLY for now.
- JULIAN = 13,
- JAPANESELUNISOLAR = 14,
- CHINESELUNISOLAR = 15,
- SAKA = 16, // reserved to match Office but not implemented in our code
- LUNAR_ETO_CHN = 17, // reserved to match Office but not implemented in our code
- LUNAR_ETO_KOR = 18, // reserved to match Office but not implemented in our code
- LUNAR_ETO_ROKUYOU = 19, // reserved to match Office but not implemented in our code
- KOREANLUNISOLAR = 20,
- TAIWANLUNISOLAR = 21,
- PERSIAN = 22,
- UMALQURA = 23,
- LAST_CALENDAR = 23 // Last calendar ID
- }
-
- internal class DateTimeFormatInfoScanner
- {
- // Special prefix-like flag char in DateWord array.
-
- // Use char in PUA area since we won't be using them in real data.
- // The char used to tell a read date word or a month postfix. A month postfix
- // is "ta" in the long date pattern like "d. MMMM'ta 'yyyy" for fi-FI.
- // In this case, it will be stored as "\xfffeta" in the date word array.
- internal const char MonthPostfixChar = '\xe000';
-
- // Add ignorable symbol in a DateWord array.
-
- // hu-HU has:
- // shrot date pattern: yyyy. MM. dd.;yyyy-MM-dd;yy-MM-dd
- // long date pattern: yyyy. MMMM d.
- // Here, "." is the date separator (derived from short date pattern). However,
- // "." also appear at the end of long date pattern. In this case, we just
- // "." as ignorable symbol so that the DateTime.Parse() state machine will not
- // treat the additional date separator at the end of y,m,d pattern as an error
- // condition.
- internal const char IgnorableSymbolChar = '\xe001';
-
- // Known CJK suffix
- internal const String CJKYearSuff = "\u5e74";
- internal const String CJKMonthSuff = "\u6708";
- internal const String CJKDaySuff = "\u65e5";
-
- internal const String KoreanYearSuff = "\ub144";
- internal const String KoreanMonthSuff = "\uc6d4";
- internal const String KoreanDaySuff = "\uc77c";
-
- internal const String KoreanHourSuff = "\uc2dc";
- internal const String KoreanMinuteSuff = "\ubd84";
- internal const String KoreanSecondSuff = "\ucd08";
-
- internal const String CJKHourSuff = "\u6642";
- internal const String ChineseHourSuff = "\u65f6";
-
- internal const String CJKMinuteSuff = "\u5206";
- internal const String CJKSecondSuff = "\u79d2";
-
- // The collection fo date words & postfix.
- internal StringList m_dateWords = new StringList();
- // Hashtable for the known words.
- private static volatile StringStringDictionary s_knownWords;
-
- static StringStringDictionary KnownWords
- {
- get
- {
- if (s_knownWords == null)
- {
- StringStringDictionary temp = new StringStringDictionary();
- // Add known words into the hash table.
-
- // Skip these special symbols.
- temp.Add("/", String.Empty);
- temp.Add("-", String.Empty);
- temp.Add(".", String.Empty);
- // Skip known CJK suffixes.
- temp.Add(CJKYearSuff, String.Empty);
- temp.Add(CJKMonthSuff, String.Empty);
- temp.Add(CJKDaySuff, String.Empty);
- temp.Add(KoreanYearSuff, String.Empty);
- temp.Add(KoreanMonthSuff, String.Empty);
- temp.Add(KoreanDaySuff, String.Empty);
- temp.Add(KoreanHourSuff, String.Empty);
- temp.Add(KoreanMinuteSuff, String.Empty);
- temp.Add(KoreanSecondSuff, String.Empty);
- temp.Add(CJKHourSuff, String.Empty);
- temp.Add(ChineseHourSuff, String.Empty);
- temp.Add(CJKMinuteSuff, String.Empty);
- temp.Add(CJKSecondSuff, String.Empty);
-
- s_knownWords = temp;
- }
- return (s_knownWords);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Parameters:
- // pattern: The pattern to be scanned.
- // currentIndex: the current index to start the scan.
- //
- // Returns:
- // Return the index with the first character that is a letter, which will
- // be the start of a date word.
- // Note that the index can be pattern.Length if we reach the end of the string.
- //
- ////////////////////////////////////////////////////////////////////////////
- internal static int SkipWhiteSpacesAndNonLetter(String pattern, int currentIndex)
- {
- while (currentIndex < pattern.Length)
- {
- char ch = pattern[currentIndex];
- if (ch == '\\')
- {
- // Escaped character. Look ahead one character.
- currentIndex++;
- if (currentIndex < pattern.Length)
- {
- ch = pattern[currentIndex];
- if (ch == '\'')
- {
- // Skip the leading single quote. We will
- // stop at the first letter.
- continue;
- }
- // Fall thru to check if this is a letter.
- }
- else
- {
- // End of string
- break;
- }
- }
- if (Char.IsLetter(ch) || ch == '\'' || ch == '.')
- {
- break;
- }
- // Skip the current char since it is not a letter.
- currentIndex++;
- }
- return (currentIndex);
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // A helper to add the found date word or month postfix into ArrayList for date words.
- //
- // Parameters:
- // formatPostfix: What kind of postfix this is.
- // Possible values:
- // null: This is a regular date word
- // "MMMM": month postfix
- // word: The date word or postfix to be added.
- //
- ////////////////////////////////////////////////////////////////////////////
- internal void AddDateWordOrPostfix(String formatPostfix, String str)
- {
- if (str.Length > 0)
- {
- // Some cultures use . like an abbreviation
- if (str.Equals("."))
- {
- AddIgnorableSymbols(".");
- return;
- }
- String words;
- if (KnownWords.TryGetValue(str, out words) == false)
- {
- if (m_dateWords == null)
- {
- m_dateWords = new StringList();
- }
- if (formatPostfix == "MMMM")
- {
- // Add the word into the ArrayList as "\xfffe" + real month postfix.
- String temp = MonthPostfixChar + str;
- if (!m_dateWords.Contains(temp))
- {
- m_dateWords.Add(temp);
- }
- }
- else
- {
- if (!m_dateWords.Contains(str))
- {
- m_dateWords.Add(str);
- }
- if (str[str.Length - 1] == '.')
- {
- // Old version ignore the trialing dot in the date words. Support this as well.
- String strWithoutDot = str.Substring(0, str.Length - 1);
- if (!m_dateWords.Contains(strWithoutDot))
- {
- m_dateWords.Add(strWithoutDot);
- }
- }
- }
- }
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Scan the pattern from the specified index and add the date word/postfix
- // when appropriate.
- //
- // Parameters:
- // pattern: The pattern to be scanned.
- // index: The starting index to be scanned.
- // formatPostfix: The kind of postfix to be scanned.
- // Possible values:
- // null: This is a regular date word
- // "MMMM": month postfix
- //
- //
- ////////////////////////////////////////////////////////////////////////////
- internal int AddDateWords(String pattern, int index, String formatPostfix)
- {
- // Skip any whitespaces so we will start from a letter.
- int newIndex = SkipWhiteSpacesAndNonLetter(pattern, index);
- if (newIndex != index && formatPostfix != null)
- {
- // There are whitespaces. This will not be a postfix.
- formatPostfix = null;
- }
- index = newIndex;
-
- // This is the first char added into dateWord.
- // Skip all non-letter character. We will add the first letter into DateWord.
- StringBuilder dateWord = new StringBuilder();
- // We assume that date words should start with a letter.
- // Skip anything until we see a letter.
-
- while (index < pattern.Length)
- {
- char ch = pattern[index];
- if (ch == '\'')
- {
- // We have seen the end of quote. Add the word if we do not see it before,
- // and break the while loop.
- AddDateWordOrPostfix(formatPostfix, dateWord.ToString());
- index++;
- break;
- }
- else if (ch == '\\')
- {
- //
- // Escaped character. Look ahead one character
- //
-
- // Skip escaped backslash.
- index++;
- if (index < pattern.Length)
- {
- dateWord.Append(pattern[index]);
- index++;
- }
- }
- else if (Char.IsWhiteSpace(ch))
- {
- // Found a whitespace. We have to add the current date word/postfix.
- AddDateWordOrPostfix(formatPostfix, dateWord.ToString());
- if (formatPostfix != null)
- {
- // Done with postfix. The rest will be regular date word.
- formatPostfix = null;
- }
- // Reset the dateWord.
- dateWord.Length = 0;
- index++;
- }
- else
- {
- dateWord.Append(ch);
- index++;
- }
- }
- return (index);
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // A simple helper to find the repeat count for a specified char.
- //
- ////////////////////////////////////////////////////////////////////////////
- internal static int ScanRepeatChar(String pattern, char ch, int index, out int count)
- {
- count = 1;
- while (++index < pattern.Length && pattern[index] == ch)
- {
- count++;
- }
- // Return the updated position.
- return (index);
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Add the text that is a date separator but is treated like ignroable symbol.
- // E.g.
- // hu-HU has:
- // shrot date pattern: yyyy. MM. dd.;yyyy-MM-dd;yy-MM-dd
- // long date pattern: yyyy. MMMM d.
- // Here, "." is the date separator (derived from short date pattern). However,
- // "." also appear at the end of long date pattern. In this case, we just
- // "." as ignorable symbol so that the DateTime.Parse() state machine will not
- // treat the additional date separator at the end of y,m,d pattern as an error
- // condition.
- //
- ////////////////////////////////////////////////////////////////////////////
-
- internal void AddIgnorableSymbols(String text)
- {
- if (m_dateWords == null)
- {
- // Create the date word array.
- m_dateWords = new StringList();
- }
- // Add the ignorable symbol into the ArrayList.
- String temp = IgnorableSymbolChar + text;
- if (!m_dateWords.Contains(temp))
- {
- m_dateWords.Add(temp);
- }
- }
-
-
- //
- // Flag used to trace the date patterns (yy/yyyyy/M/MM/MMM/MMM/d/dd) that we have seen.
- //
- private enum FoundDatePattern
- {
- None = 0x0000,
- FoundYearPatternFlag = 0x0001,
- FoundMonthPatternFlag = 0x0002,
- FoundDayPatternFlag = 0x0004,
- FoundYMDPatternFlag = 0x0007, // FoundYearPatternFlag | FoundMonthPatternFlag | FoundDayPatternFlag;
- }
-
- // Check if we have found all of the year/month/day pattern.
- private FoundDatePattern _ymdFlags = FoundDatePattern.None;
-
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Given a date format pattern, scan for date word or postfix.
- //
- // A date word should be always put in a single quoted string. And it will
- // start from a letter, so whitespace and symbols will be ignored before
- // the first letter.
- //
- // Examples of date word:
- // 'de' in es-SP: dddd, dd' de 'MMMM' de 'yyyy
- // "\x0443." in bg-BG: dd.M.yyyy '\x0433.'
- //
- // Example of postfix:
- // month postfix:
- // "ta" in fi-FI: d. MMMM'ta 'yyyy
- // Currently, only month postfix is supported.
- //
- // Usage:
- // Always call this with Framework-style pattern, instead of Windows style pattern.
- // Windows style pattern uses '' for single quote, while .NET uses \'
- //
- ////////////////////////////////////////////////////////////////////////////
- internal void ScanDateWord(String pattern)
- {
- // Check if we have found all of the year/month/day pattern.
- _ymdFlags = FoundDatePattern.None;
-
- int i = 0;
- while (i < pattern.Length)
- {
- char ch = pattern[i];
- int chCount;
-
- switch (ch)
- {
- case '\'':
- // Find a beginning quote. Search until the end quote.
- i = AddDateWords(pattern, i + 1, null);
- break;
- case 'M':
- i = ScanRepeatChar(pattern, 'M', i, out chCount);
- if (chCount >= 4)
- {
- if (i < pattern.Length && pattern[i] == '\'')
- {
- i = AddDateWords(pattern, i + 1, "MMMM");
- }
- }
- _ymdFlags |= FoundDatePattern.FoundMonthPatternFlag;
- break;
- case 'y':
- i = ScanRepeatChar(pattern, 'y', i, out chCount);
- _ymdFlags |= FoundDatePattern.FoundYearPatternFlag;
- break;
- case 'd':
- i = ScanRepeatChar(pattern, 'd', i, out chCount);
- if (chCount <= 2)
- {
- // Only count "d" & "dd".
- // ddd, dddd are day names. Do not count them.
- _ymdFlags |= FoundDatePattern.FoundDayPatternFlag;
- }
- break;
- case '\\':
- // Found a escaped char not in a quoted string. Skip the current backslash
- // and its next character.
- i += 2;
- break;
- case '.':
- if (_ymdFlags == FoundDatePattern.FoundYMDPatternFlag)
- {
- // If we find a dot immediately after the we have seen all of the y, m, d pattern.
- // treat it as a ignroable symbol. Check for comments in AddIgnorableSymbols for
- // more details.
- AddIgnorableSymbols(".");
- _ymdFlags = FoundDatePattern.None;
- }
- i++;
- break;
- default:
- if (_ymdFlags == FoundDatePattern.FoundYMDPatternFlag && !Char.IsWhiteSpace(ch))
- {
- // We are not seeing "." after YMD. Clear the flag.
- _ymdFlags = FoundDatePattern.None;
- }
- // We are not in quote. Skip the current character.
- i++;
- break;
- }
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Given a DTFI, get all of the date words from date patterns and time patterns.
- //
- ////////////////////////////////////////////////////////////////////////////
-
- internal String[] GetDateWordsOfDTFI(DateTimeFormatInfo dtfi)
- {
- // Enumarate all LongDatePatterns, and get the DateWords and scan for month postfix.
- String[] datePatterns = dtfi.GetAllDateTimePatterns('D');
- int i;
-
- // Scan the long date patterns
- for (i = 0; i < datePatterns.Length; i++)
- {
- ScanDateWord(datePatterns[i]);
- }
-
- // Scan the short date patterns
- datePatterns = dtfi.GetAllDateTimePatterns('d');
- for (i = 0; i < datePatterns.Length; i++)
- {
- ScanDateWord(datePatterns[i]);
- }
- // Scan the YearMonth patterns.
- datePatterns = dtfi.GetAllDateTimePatterns('y');
- for (i = 0; i < datePatterns.Length; i++)
- {
- ScanDateWord(datePatterns[i]);
- }
-
- // Scan the month/day pattern
- ScanDateWord(dtfi.MonthDayPattern);
-
- // Scan the long time patterns.
- datePatterns = dtfi.GetAllDateTimePatterns('T');
- for (i = 0; i < datePatterns.Length; i++)
- {
- ScanDateWord(datePatterns[i]);
- }
-
- // Scan the short time patterns.
- datePatterns = dtfi.GetAllDateTimePatterns('t');
- for (i = 0; i < datePatterns.Length; i++)
- {
- ScanDateWord(datePatterns[i]);
- }
-
- String[] result = null;
- if (m_dateWords != null && m_dateWords.Count > 0)
- {
- result = new String[m_dateWords.Count];
- for (i = 0; i < m_dateWords.Count; i++)
- {
- result[i] = m_dateWords[i];
- }
- }
- return (result);
- }
-
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Scan the month names to see if genitive month names are used, and return
- // the format flag.
- //
- ////////////////////////////////////////////////////////////////////////////
- internal static FORMATFLAGS GetFormatFlagGenitiveMonth(String[] monthNames, String[] genitveMonthNames, String[] abbrevMonthNames, String[] genetiveAbbrevMonthNames)
- {
- // If we have different names in regular and genitive month names, use genitive month flag.
- return ((!EqualStringArrays(monthNames, genitveMonthNames) || !EqualStringArrays(abbrevMonthNames, genetiveAbbrevMonthNames))
- ? FORMATFLAGS.UseGenitiveMonth : 0);
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Scan the month names to see if spaces are used or start with a digit, and return the format flag
- //
- ////////////////////////////////////////////////////////////////////////////
- internal static FORMATFLAGS GetFormatFlagUseSpaceInMonthNames(String[] monthNames, String[] genitveMonthNames, String[] abbrevMonthNames, String[] genetiveAbbrevMonthNames)
- {
- FORMATFLAGS formatFlags = 0;
- formatFlags |= (ArrayElementsBeginWithDigit(monthNames) ||
- ArrayElementsBeginWithDigit(genitveMonthNames) ||
- ArrayElementsBeginWithDigit(abbrevMonthNames) ||
- ArrayElementsBeginWithDigit(genetiveAbbrevMonthNames)
- ? FORMATFLAGS.UseDigitPrefixInTokens : 0);
-
- formatFlags |= (ArrayElementsHaveSpace(monthNames) ||
- ArrayElementsHaveSpace(genitveMonthNames) ||
- ArrayElementsHaveSpace(abbrevMonthNames) ||
- ArrayElementsHaveSpace(genetiveAbbrevMonthNames)
- ? FORMATFLAGS.UseSpacesInMonthNames : 0);
- return (formatFlags);
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Scan the day names and set the correct format flag.
- //
- ////////////////////////////////////////////////////////////////////////////
- internal static FORMATFLAGS GetFormatFlagUseSpaceInDayNames(String[] dayNames, String[] abbrevDayNames)
- {
- return ((ArrayElementsHaveSpace(dayNames) ||
- ArrayElementsHaveSpace(abbrevDayNames))
- ? FORMATFLAGS.UseSpacesInDayNames : 0);
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Check the calendar to see if it is HebrewCalendar and set the Hebrew format flag if necessary.
- //
- ////////////////////////////////////////////////////////////////////////////
- internal static FORMATFLAGS GetFormatFlagUseHebrewCalendar(int calID)
- {
- return (calID == (int)CalendarId.HEBREW ?
- FORMATFLAGS.UseHebrewParsing | FORMATFLAGS.UseLeapYearMonth : 0);
- }
-
-
- //-----------------------------------------------------------------------------
- // EqualStringArrays
- // compares two string arrays and return true if all elements of the first
- // array equals to all elmentsof the second array.
- // otherwise it returns false.
- //-----------------------------------------------------------------------------
-
- private static bool EqualStringArrays(string[] array1, string[] array2)
- {
- // Shortcut if they're the same array
- if (array1 == array2)
- {
- return true;
- }
-
- // This is effectively impossible
- if (array1.Length != array2.Length)
- {
- return false;
- }
-
- // Check each string
- for (int i = 0; i < array1.Length; i++)
- {
- if (!array1[i].Equals(array2[i]))
- {
- return false;
- }
- }
-
- return true;
- }
-
- //-----------------------------------------------------------------------------
- // ArrayElementsHaveSpace
- // It checks all input array elements if any of them has space character
- // returns true if found space character in one of the array elements.
- // otherwise returns false.
- //-----------------------------------------------------------------------------
-
- private static bool ArrayElementsHaveSpace(string[] array)
- {
- for (int i = 0; i < array.Length; i++)
- {
- // it is faster to check for space character manually instead of calling IndexOf
- // so we don't have to go to native code side.
- for (int j = 0; j < array[i].Length; j++)
- {
- if (Char.IsWhiteSpace(array[i][j]))
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Check if any element of the array start with a digit.
- //
- ////////////////////////////////////////////////////////////////////////////
- private static bool ArrayElementsBeginWithDigit(string[] array)
- {
- for (int i = 0; i < array.Length; i++)
- {
- // it is faster to check for space character manually instead of calling IndexOf
- // so we don't have to go to native code side.
- if (array[i].Length > 0 &&
- array[i][0] >= '0' && array[i][0] <= '9')
- {
- int index = 1;
- while (index < array[i].Length && array[i][index] >= '0' && array[i][index] <= '9')
- {
- // Skip other digits.
- index++;
- }
- if (index == array[i].Length)
- {
- return (false);
- }
-
- if (index == array[i].Length - 1)
- {
- // Skip known CJK month suffix.
- // CJK uses month name like "1\x6708", since \x6708 is a known month suffix,
- // we don't need the UseDigitPrefixInTokens since it is slower.
- switch (array[i][index])
- {
- case '\x6708': // CJKMonthSuff
- case '\xc6d4': // KoreanMonthSuff
- return (false);
- }
- }
-
- if (index == array[i].Length - 4)
- {
- // Skip known CJK month suffix.
- // Starting with Windows 8, the CJK months for some cultures looks like: "1' \x6708'"
- // instead of just "1\x6708"
- if (array[i][index] == '\'' && array[i][index + 1] == ' ' &&
- array[i][index + 2] == '\x6708' && array[i][index + 3] == '\'')
- {
- return (false);
- }
- }
- return (true);
- }
- }
-
- return false;
- }
- }
-}
-
diff --git a/src/mscorlib/corefx/System/Globalization/DayLightTime.cs b/src/mscorlib/corefx/System/Globalization/DayLightTime.cs
deleted file mode 100644
index 6ec9d6a43e..0000000000
--- a/src/mscorlib/corefx/System/Globalization/DayLightTime.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-
-namespace System.Globalization
-{
- // This class represents a starting/ending time for a period of daylight saving time.
-
- [Serializable]
- public class DaylightTime
- {
- private readonly DateTime _start;
- private readonly DateTime _end;
- private readonly TimeSpan _delta;
-
- private DaylightTime()
- {
- }
-
- public DaylightTime(DateTime start, DateTime end, TimeSpan delta)
- {
- _start = start;
- _end = end;
- _delta = delta;
- }
-
- // The start date of a daylight saving period.
- public DateTime Start => _start;
-
- // The end date of a daylight saving period.
- public DateTime End => _end;
-
- // Delta to stardard offset in ticks.
- public TimeSpan Delta => _delta;
- }
-
- // Value type version of DaylightTime
- internal struct DaylightTimeStruct
- {
- public DaylightTimeStruct(DateTime start, DateTime end, TimeSpan delta)
- {
- Start = start;
- End = end;
- Delta = delta;
- }
-
- public readonly DateTime Start;
- public readonly DateTime End;
- public readonly TimeSpan Delta;
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/DigitShapes.cs b/src/mscorlib/corefx/System/Globalization/DigitShapes.cs
deleted file mode 100644
index 0e4dcc87c3..0000000000
--- a/src/mscorlib/corefx/System/Globalization/DigitShapes.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-//
-// The enumeration constants used in NumberFormatInfo.DigitSubstitution.
-//
-
-namespace System.Globalization
-{
- [Serializable]
- public enum DigitShapes : int
- {
- Context = 0x0000, // The shape depends on the previous text in the same output.
- None = 0x0001, // Gives full Unicode compatibility.
- NativeNational = 0x0002 // National shapes
- }
-} \ No newline at end of file
diff --git a/src/mscorlib/corefx/System/Globalization/EastAsianLunisolarCalendar.cs b/src/mscorlib/corefx/System/Globalization/EastAsianLunisolarCalendar.cs
deleted file mode 100644
index f82fad8e5b..0000000000
--- a/src/mscorlib/corefx/System/Globalization/EastAsianLunisolarCalendar.cs
+++ /dev/null
@@ -1,717 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about EastAsianLunisolarCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
-
- [Serializable]
- public abstract class EastAsianLunisolarCalendar : Calendar
- {
- internal const int LeapMonth = 0;
- internal const int Jan1Month = 1;
- internal const int Jan1Date = 2;
- internal const int nDaysPerMonth = 3;
-
- // # of days so far in the solar year
- internal static readonly int[] DaysToMonth365 =
- {
- 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
- };
-
- internal static readonly int[] DaysToMonth366 =
- {
- 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335
- };
-
- internal const int DatePartYear = 0;
- internal const int DatePartDayOfYear = 1;
- internal const int DatePartMonth = 2;
- internal const int DatePartDay = 3;
-
- public override CalendarAlgorithmType AlgorithmType
- {
- get
- {
- return CalendarAlgorithmType.LunisolarCalendar;
- }
- }
-
- // Return the year number in the 60-year cycle.
- //
-
- public virtual int GetSexagenaryYear(DateTime time)
- {
- CheckTicksRange(time.Ticks);
-
- int year = 0, month = 0, day = 0;
- TimeToLunar(time, ref year, ref month, ref day);
-
- return ((year - 4) % 60) + 1;
- }
-
- // Return the celestial year from the 60-year cycle.
- // The returned value is from 1 ~ 10.
- //
-
- public int GetCelestialStem(int sexagenaryYear)
- {
- if ((sexagenaryYear < 1) || (sexagenaryYear > 60))
- {
- throw new ArgumentOutOfRangeException(
- nameof(sexagenaryYear),
- SR.Format(SR.ArgumentOutOfRange_Range, 1, 60));
- }
- Contract.EndContractBlock();
-
- return ((sexagenaryYear - 1) % 10) + 1;
- }
-
- // Return the Terrestial Branch from the the 60-year cycle.
- // The returned value is from 1 ~ 12.
- //
-
- public int GetTerrestrialBranch(int sexagenaryYear)
- {
- if ((sexagenaryYear < 1) || (sexagenaryYear > 60))
- {
- throw new ArgumentOutOfRangeException(
- nameof(sexagenaryYear),
- SR.Format(SR.ArgumentOutOfRange_Range, 1, 60));
- }
- Contract.EndContractBlock();
-
- return ((sexagenaryYear - 1) % 12) + 1;
- }
-
- internal abstract int GetYearInfo(int LunarYear, int Index);
- internal abstract int GetYear(int year, DateTime time);
- internal abstract int GetGregorianYear(int year, int era);
-
- internal abstract int MinCalendarYear { get; }
- internal abstract int MaxCalendarYear { get; }
- internal abstract EraInfo[] CalEraInfo { get; }
- internal abstract DateTime MinDate { get; }
- internal abstract DateTime MaxDate { get; }
-
- internal const int MaxCalendarMonth = 13;
- internal const int MaxCalendarDay = 30;
-
- internal int MinEraCalendarYear(int era)
- {
- EraInfo[] mEraInfo = CalEraInfo;
- //ChineseLunisolarCalendar does not has m_EraInfo it is going to retuen null
- if (mEraInfo == null)
- {
- return MinCalendarYear;
- }
-
- if (era == Calendar.CurrentEra)
- {
- era = CurrentEraValue;
- }
- //era has to be in the supported range otherwise we will throw exception in CheckEraRange()
- if (era == GetEra(MinDate))
- {
- return (GetYear(MinCalendarYear, MinDate));
- }
-
- for (int i = 0; i < mEraInfo.Length; i++)
- {
- if (era == mEraInfo[i].era)
- {
- return (mEraInfo[i].minEraYear);
- }
- }
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
-
- internal int MaxEraCalendarYear(int era)
- {
- EraInfo[] mEraInfo = CalEraInfo;
- //ChineseLunisolarCalendar does not has m_EraInfo it is going to retuen null
- if (mEraInfo == null)
- {
- return MaxCalendarYear;
- }
-
- if (era == Calendar.CurrentEra)
- {
- era = CurrentEraValue;
- }
- //era has to be in the supported range otherwise we will throw exception in CheckEraRange()
- if (era == GetEra(MaxDate))
- {
- return (GetYear(MaxCalendarYear, MaxDate));
- }
-
- for (int i = 0; i < mEraInfo.Length; i++)
- {
- if (era == mEraInfo[i].era)
- {
- return (mEraInfo[i].maxEraYear);
- }
- }
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
-
- internal EastAsianLunisolarCalendar()
- {
- }
-
- internal void CheckTicksRange(long ticks)
- {
- if (ticks < MinSupportedDateTime.Ticks || ticks > MaxSupportedDateTime.Ticks)
- {
- throw new ArgumentOutOfRangeException(
- "time",
- String.Format(CultureInfo.InvariantCulture, SR.ArgumentOutOfRange_CalendarRange,
- MinSupportedDateTime, MaxSupportedDateTime));
- }
- Contract.EndContractBlock();
- }
-
- internal void CheckEraRange(int era)
- {
- if (era == Calendar.CurrentEra)
- {
- era = CurrentEraValue;
- }
-
- if ((era < GetEra(MinDate)) || (era > GetEra(MaxDate)))
- {
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
- }
-
- internal int CheckYearRange(int year, int era)
- {
- CheckEraRange(era);
- year = GetGregorianYear(year, era);
-
- if ((year < MinCalendarYear) || (year > MaxCalendarYear))
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- SR.Format(SR.ArgumentOutOfRange_Range, MinEraCalendarYear(era), MaxEraCalendarYear(era)));
- }
- return year;
- }
-
- internal int CheckYearMonthRange(int year, int month, int era)
- {
- year = CheckYearRange(year, era);
-
- if (month == 13)
- {
- //Reject if there is no leap month this year
- if (GetYearInfo(year, LeapMonth) == 0)
- throw new ArgumentOutOfRangeException(nameof(month), SR.ArgumentOutOfRange_Month);
- }
-
- if (month < 1 || month > 13)
- {
- throw new ArgumentOutOfRangeException(nameof(month), SR.ArgumentOutOfRange_Month);
- }
- return year;
- }
-
- internal int InternalGetDaysInMonth(int year, int month)
- {
- int nDays;
- int mask; // mask for extracting bits
-
- mask = 0x8000;
- // convert the lunar day into a lunar month/date
- mask >>= (month - 1);
- if ((GetYearInfo(year, nDaysPerMonth) & mask) == 0)
- nDays = 29;
- else
- nDays = 30;
- return nDays;
- }
-
- // Returns the number of days in the month given by the year and
- // month arguments.
- //
-
- public override int GetDaysInMonth(int year, int month, int era)
- {
- year = CheckYearMonthRange(year, month, era);
- return InternalGetDaysInMonth(year, month);
- }
-
- private static int GregorianIsLeapYear(int y)
- {
- return ((((y) % 4) != 0) ? 0 : ((((y) % 100) != 0) ? 1 : ((((y) % 400) != 0) ? 0 : 1)));
- }
-
- // Returns the date and time converted to a DateTime value. Throws an exception if the n-tuple is invalid.
- //
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- year = CheckYearMonthRange(year, month, era);
- int daysInMonth = InternalGetDaysInMonth(year, month);
- if (day < 1 || day > daysInMonth)
- {
- throw new ArgumentOutOfRangeException(
- nameof(day),
- SR.Format(SR.ArgumentOutOfRange_Day, daysInMonth, month));
- }
-
- int gy = 0; int gm = 0; int gd = 0;
-
- if (LunarToGregorian(year, month, day, ref gy, ref gm, ref gd))
- {
- return new DateTime(gy, gm, gd, hour, minute, second, millisecond);
- }
- else
- {
- throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadYearMonthDay);
- }
- }
-
-
- //
- // GregorianToLunar calculates lunar calendar info for the given gregorian year, month, date.
- // The input date should be validated before calling this method.
- //
- internal void GregorianToLunar(int nSYear, int nSMonth, int nSDate, ref int nLYear, ref int nLMonth, ref int nLDate)
- {
- // unsigned int nLYear, nLMonth, nLDate; // lunar ymd
- int nSolarDay; // day # in solar year
- int nLunarDay; // day # in lunar year
- int fLeap; // is it a solar leap year?
- int LDpM; // lunar days/month bitfield
- int mask; // mask for extracting bits
- int nDays; // # days this lunar month
- int nJan1Month, nJan1Date;
-
- // calc the solar day of year
- fLeap = GregorianIsLeapYear(nSYear);
- nSolarDay = (fLeap == 1) ? DaysToMonth366[nSMonth - 1] : DaysToMonth365[nSMonth - 1];
- nSolarDay += nSDate;
-
- // init lunar year info
- nLunarDay = nSolarDay;
- nLYear = nSYear;
- if (nLYear == (MaxCalendarYear + 1))
- {
- nLYear--;
- nLunarDay += ((GregorianIsLeapYear(nLYear) == 1) ? 366 : 365);
- nJan1Month = GetYearInfo(nLYear, Jan1Month);
- nJan1Date = GetYearInfo(nLYear, Jan1Date);
- }
- else
- {
- nJan1Month = GetYearInfo(nLYear, Jan1Month);
- nJan1Date = GetYearInfo(nLYear, Jan1Date);
-
- // check if this solar date is actually part of the previous
- // lunar year
- if ((nSMonth < nJan1Month) ||
- (nSMonth == nJan1Month && nSDate < nJan1Date))
- {
- // the corresponding lunar day is actually part of the previous
- // lunar year
- nLYear--;
-
- // add a solar year to the lunar day #
- nLunarDay += ((GregorianIsLeapYear(nLYear) == 1) ? 366 : 365);
-
- // update the new start of year
- nJan1Month = GetYearInfo(nLYear, Jan1Month);
- nJan1Date = GetYearInfo(nLYear, Jan1Date);
- }
- }
-
- // convert solar day into lunar day.
- // subtract off the beginning part of the solar year which is not
- // part of the lunar year. since this part is always in Jan or Feb,
- // we don't need to handle Leap Year (LY only affects March
- // and later).
- nLunarDay -= DaysToMonth365[nJan1Month - 1];
- nLunarDay -= (nJan1Date - 1);
-
- // convert the lunar day into a lunar month/date
- mask = 0x8000;
- LDpM = GetYearInfo(nLYear, nDaysPerMonth);
- nDays = ((LDpM & mask) != 0) ? 30 : 29;
- nLMonth = 1;
- while (nLunarDay > nDays)
- {
- nLunarDay -= nDays;
- nLMonth++;
- mask >>= 1;
- nDays = ((LDpM & mask) != 0) ? 30 : 29;
- }
- nLDate = nLunarDay;
- }
-
- /*
- //Convert from Lunar to Gregorian
- //Highly inefficient, but it works based on the forward conversion
- */
- internal bool LunarToGregorian(int nLYear, int nLMonth, int nLDate, ref int nSolarYear, ref int nSolarMonth, ref int nSolarDay)
- {
- int numLunarDays;
-
- if (nLDate < 1 || nLDate > 30)
- return false;
-
- numLunarDays = nLDate - 1;
-
- //Add previous months days to form the total num of days from the first of the month.
- for (int i = 1; i < nLMonth; i++)
- {
- numLunarDays += InternalGetDaysInMonth(nLYear, i);
- }
-
- //Get Gregorian First of year
- int nJan1Month = GetYearInfo(nLYear, Jan1Month);
- int nJan1Date = GetYearInfo(nLYear, Jan1Date);
-
- // calc the solar day of year of 1 Lunar day
- int fLeap = GregorianIsLeapYear(nLYear);
- int[] days = (fLeap == 1) ? DaysToMonth366 : DaysToMonth365;
-
- nSolarDay = nJan1Date;
-
- if (nJan1Month > 1)
- nSolarDay += days[nJan1Month - 1];
-
- // Add the actual lunar day to get the solar day we want
- nSolarDay = nSolarDay + numLunarDays;// - 1;
-
- if (nSolarDay > (fLeap + 365))
- {
- nSolarYear = nLYear + 1;
- nSolarDay -= (fLeap + 365);
- }
- else
- {
- nSolarYear = nLYear;
- }
-
- for (nSolarMonth = 1; nSolarMonth < 12; nSolarMonth++)
- {
- if (days[nSolarMonth] >= nSolarDay)
- break;
- }
-
- nSolarDay -= days[nSolarMonth - 1];
- return true;
- }
-
- internal DateTime LunarToTime(DateTime time, int year, int month, int day)
- {
- int gy = 0; int gm = 0; int gd = 0;
- LunarToGregorian(year, month, day, ref gy, ref gm, ref gd);
- return (GregorianCalendar.GetDefaultInstance().ToDateTime(gy, gm, gd, time.Hour, time.Minute, time.Second, time.Millisecond));
- }
-
- internal void TimeToLunar(DateTime time, ref int year, ref int month, ref int day)
- {
- int gy = 0; int gm = 0; int gd = 0;
-
- Calendar Greg = GregorianCalendar.GetDefaultInstance();
- gy = Greg.GetYear(time);
- gm = Greg.GetMonth(time);
- gd = Greg.GetDayOfMonth(time);
-
- GregorianToLunar(gy, gm, gd, ref year, ref month, ref day);
- }
-
- // Returns the DateTime resulting from adding the given number of
- // months to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year and month parts of the specified DateTime by
- // value months, and, if required, adjusting the day part of the
- // resulting date downwards to the last day of the resulting month in the
- // resulting year. The time-of-day part of the result is the same as the
- // time-of-day part of the specified DateTime.
- //
-
- public override DateTime AddMonths(DateTime time, int months)
- {
- if (months < -120000 || months > 120000)
- {
- throw new ArgumentOutOfRangeException(
- nameof(months),
- SR.Format(SR.ArgumentOutOfRange_Range, -120000, 120000));
- }
- Contract.EndContractBlock();
-
- CheckTicksRange(time.Ticks);
-
- int y = 0; int m = 0; int d = 0;
- TimeToLunar(time, ref y, ref m, ref d);
-
- int i = m + months;
- if (i > 0)
- {
- int monthsInYear = InternalIsLeapYear(y) ? 13 : 12;
-
- while (i - monthsInYear > 0)
- {
- i -= monthsInYear;
- y++;
- monthsInYear = InternalIsLeapYear(y) ? 13 : 12;
- }
- m = i;
- }
- else
- {
- int monthsInYear;
- while (i <= 0)
- {
- monthsInYear = InternalIsLeapYear(y - 1) ? 13 : 12;
- i += monthsInYear;
- y--;
- }
- m = i;
- }
-
- int days = InternalGetDaysInMonth(y, m);
- if (d > days)
- {
- d = days;
- }
- DateTime dt = LunarToTime(time, y, m, d);
-
- CheckAddResult(dt.Ticks, MinSupportedDateTime, MaxSupportedDateTime);
- return (dt);
- }
-
-
- public override DateTime AddYears(DateTime time, int years)
- {
- CheckTicksRange(time.Ticks);
-
- int y = 0; int m = 0; int d = 0;
- TimeToLunar(time, ref y, ref m, ref d);
-
- y += years;
-
- if (m == 13 && !InternalIsLeapYear(y))
- {
- m = 12;
- d = InternalGetDaysInMonth(y, m);
- }
- int DaysInMonths = InternalGetDaysInMonth(y, m);
- if (d > DaysInMonths)
- {
- d = DaysInMonths;
- }
-
- DateTime dt = LunarToTime(time, y, m, d);
- CheckAddResult(dt.Ticks, MinSupportedDateTime, MaxSupportedDateTime);
- return (dt);
- }
-
- // Returns the day-of-year part of the specified DateTime. The returned value
- // is an integer between 1 and [354|355 |383|384].
- //
-
- public override int GetDayOfYear(DateTime time)
- {
- CheckTicksRange(time.Ticks);
-
- int y = 0; int m = 0; int d = 0;
- TimeToLunar(time, ref y, ref m, ref d);
-
- for (int i = 1; i < m; i++)
- {
- d = d + InternalGetDaysInMonth(y, i);
- }
- return d;
- }
-
- // Returns the day-of-month part of the specified DateTime. The returned
- // value is an integer between 1 and 29 or 30.
- //
-
- public override int GetDayOfMonth(DateTime time)
- {
- CheckTicksRange(time.Ticks);
-
- int y = 0; int m = 0; int d = 0;
- TimeToLunar(time, ref y, ref m, ref d);
-
- return d;
- }
-
- // Returns the number of days in the year given by the year argument for the current era.
- //
-
- public override int GetDaysInYear(int year, int era)
- {
- year = CheckYearRange(year, era);
-
- int Days = 0;
- int monthsInYear = InternalIsLeapYear(year) ? 13 : 12;
-
- while (monthsInYear != 0)
- Days += InternalGetDaysInMonth(year, monthsInYear--);
-
- return Days;
- }
-
- // Returns the month part of the specified DateTime. The returned value is an
- // integer between 1 and 13.
- //
-
- public override int GetMonth(DateTime time)
- {
- CheckTicksRange(time.Ticks);
-
- int y = 0; int m = 0; int d = 0;
- TimeToLunar(time, ref y, ref m, ref d);
-
- return m;
- }
-
- // Returns the year part of the specified DateTime. The returned value is an
- // integer between 1 and MaxCalendarYear.
- //
-
- public override int GetYear(DateTime time)
- {
- CheckTicksRange(time.Ticks);
-
- int y = 0; int m = 0; int d = 0;
- TimeToLunar(time, ref y, ref m, ref d);
-
- return GetYear(y, time);
- }
-
- // Returns the day-of-week part of the specified DateTime. The returned value
- // is an integer between 0 and 6, where 0 indicates Sunday, 1 indicates
- // Monday, 2 indicates Tuesday, 3 indicates Wednesday, 4 indicates
- // Thursday, 5 indicates Friday, and 6 indicates Saturday.
- //
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- CheckTicksRange(time.Ticks);
- return ((DayOfWeek)((int)(time.Ticks / Calendar.TicksPerDay + 1) % 7));
- }
-
- // Returns the number of months in the specified year and era.
-
- public override int GetMonthsInYear(int year, int era)
- {
- year = CheckYearRange(year, era);
- return (InternalIsLeapYear(year) ? 13 : 12);
- }
-
- // Checks whether a given day in the specified era is a leap day. This method returns true if
- // the date is a leap day, or false if not.
- //
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- year = CheckYearMonthRange(year, month, era);
- int daysInMonth = InternalGetDaysInMonth(year, month);
-
- if (day < 1 || day > daysInMonth)
- {
- throw new ArgumentOutOfRangeException(
- nameof(day),
- SR.Format(SR.ArgumentOutOfRange_Day, daysInMonth, month));
- }
- int m = GetYearInfo(year, LeapMonth);
- return ((m != 0) && (month == (m + 1)));
- }
-
- // Checks whether a given month in the specified era is a leap month. This method returns true if
- // month is a leap month, or false if not.
- //
-
- public override bool IsLeapMonth(int year, int month, int era)
- {
- year = CheckYearMonthRange(year, month, era);
- int m = GetYearInfo(year, LeapMonth);
- return ((m != 0) && (month == (m + 1)));
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this this year is not a leap year.
- //
-
- public override int GetLeapMonth(int year, int era)
- {
- year = CheckYearRange(year, era);
- int month = GetYearInfo(year, LeapMonth);
- if (month > 0)
- {
- return (month + 1);
- }
- return 0;
- }
-
- internal bool InternalIsLeapYear(int year)
- {
- return (GetYearInfo(year, LeapMonth) != 0);
- }
- // Checks whether a given year in the specified era is a leap year. This method returns true if
- // year is a leap year, or false if not.
- //
-
- public override bool IsLeapYear(int year, int era)
- {
- year = CheckYearRange(year, era);
- return InternalIsLeapYear(year);
- }
-
- private const int DEFAULT_GREGORIAN_TWO_DIGIT_YEAR_MAX = 2029;
-
-
- public override int TwoDigitYearMax
- {
- get
- {
- if (twoDigitYearMax == -1)
- {
- twoDigitYearMax = GetSystemTwoDigitYearSetting(BaseCalendarID, GetYear(new DateTime(DEFAULT_GREGORIAN_TWO_DIGIT_YEAR_MAX, 1, 1)));
- }
- return (twoDigitYearMax);
- }
-
- set
- {
- VerifyWritable();
- if (value < 99 || value > MaxCalendarYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(value),
- SR.Format(SR.ArgumentOutOfRange_Range, 99, MaxCalendarYear));
- }
- twoDigitYearMax = value;
- }
- }
-
-
- public override int ToFourDigitYear(int year)
- {
- if (year < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedNonNegNum);
- }
- Contract.EndContractBlock();
-
- year = base.ToFourDigitYear(year);
- CheckYearRange(year, CurrentEra);
- return (year);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs b/src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs
deleted file mode 100644
index be5b65b385..0000000000
--- a/src/mscorlib/corefx/System/Globalization/GregorianCalendar.cs
+++ /dev/null
@@ -1,666 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-//
-
-//
-
-using System;
-using System.Globalization;
-using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
-using System.Threading;
-
-namespace System.Globalization
-{
- // This calendar recognizes two era values:
- // 0 CurrentEra (AD)
- // 1 BeforeCurrentEra (BC)
-
- [Serializable]
-
- public class GregorianCalendar : Calendar
- {
- /*
- A.D. = anno Domini
- */
-
- public const int ADEra = 1;
-
-
- internal const int DatePartYear = 0;
- internal const int DatePartDayOfYear = 1;
- internal const int DatePartMonth = 2;
- internal const int DatePartDay = 3;
-
- //
- // This is the max Gregorian year can be represented by DateTime class. The limitation
- // is derived from DateTime class.
- //
- internal const int MaxYear = 9999;
-
- internal GregorianCalendarTypes m_type;
-
- internal static readonly int[] DaysToMonth365 =
- {
- 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
- };
-
- internal static readonly int[] DaysToMonth366 =
- {
- 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366
- };
-
- private static volatile Calendar s_defaultInstance;
-
- [OnDeserialized]
- private void OnDeserialized(StreamingContext ctx)
- {
- if (m_type < GregorianCalendarTypes.Localized ||
- m_type > GregorianCalendarTypes.TransliteratedFrench)
- {
- throw new SerializationException(
- String.Format(CultureInfo.CurrentCulture, SR.Serialization_MemberOutOfRange, "type", "GregorianCalendar"));
- }
- }
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (DateTime.MinValue);
- }
- }
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (DateTime.MaxValue);
- }
- }
-
- public override CalendarAlgorithmType AlgorithmType
- {
- get
- {
- return CalendarAlgorithmType.SolarCalendar;
- }
- }
-
- /*=================================GetDefaultInstance==========================
- **Action: Internal method to provide a default intance of GregorianCalendar. Used by NLS+ implementation
- ** and other calendars.
- **Returns:
- **Arguments:
- **Exceptions:
- ============================================================================*/
-
- internal static Calendar GetDefaultInstance()
- {
- if (s_defaultInstance == null)
- {
- s_defaultInstance = new GregorianCalendar();
- }
- return (s_defaultInstance);
- }
-
- // Construct an instance of gregorian calendar.
-
- public GregorianCalendar() :
- this(GregorianCalendarTypes.Localized)
- {
- }
-
-
- public GregorianCalendar(GregorianCalendarTypes type)
- {
- if ((int)type < (int)GregorianCalendarTypes.Localized || (int)type > (int)GregorianCalendarTypes.TransliteratedFrench)
- {
- throw new ArgumentOutOfRangeException(
- nameof(type),
- SR.Format(SR.ArgumentOutOfRange_Range,
- GregorianCalendarTypes.Localized, GregorianCalendarTypes.TransliteratedFrench));
- }
- Contract.EndContractBlock();
- this.m_type = type;
- }
-
- public virtual GregorianCalendarTypes CalendarType
- {
- get
- {
- return (m_type);
- }
-
- set
- {
- VerifyWritable();
-
- switch (value)
- {
- case GregorianCalendarTypes.Localized:
- case GregorianCalendarTypes.USEnglish:
- case GregorianCalendarTypes.MiddleEastFrench:
- case GregorianCalendarTypes.Arabic:
- case GregorianCalendarTypes.TransliteratedEnglish:
- case GregorianCalendarTypes.TransliteratedFrench:
- m_type = value;
- break;
-
- default:
- throw new ArgumentOutOfRangeException("m_type", SR.ArgumentOutOfRange_Enum);
- }
- }
- }
-
- internal override CalendarId ID
- {
- get
- {
- // By returning different ID for different variations of GregorianCalendar,
- // we can support the Transliterated Gregorian calendar.
- // DateTimeFormatInfo will use this ID to get formatting information about
- // the calendar.
- return ((CalendarId)m_type);
- }
- }
-
-
- // Returns a given date part of this DateTime. This method is used
- // to compute the year, day-of-year, month, or day part.
- internal virtual int GetDatePart(long ticks, int part)
- {
- // n = number of days since 1/1/0001
- int n = (int)(ticks / TicksPerDay);
- // y400 = number of whole 400-year periods since 1/1/0001
- int y400 = n / DaysPer400Years;
- // n = day number within 400-year period
- n -= y400 * DaysPer400Years;
- // y100 = number of whole 100-year periods within 400-year period
- int y100 = n / DaysPer100Years;
- // Last 100-year period has an extra day, so decrement result if 4
- if (y100 == 4) y100 = 3;
- // n = day number within 100-year period
- n -= y100 * DaysPer100Years;
- // y4 = number of whole 4-year periods within 100-year period
- int y4 = n / DaysPer4Years;
- // n = day number within 4-year period
- n -= y4 * DaysPer4Years;
- // y1 = number of whole years within 4-year period
- int y1 = n / DaysPerYear;
- // Last year has an extra day, so decrement result if 4
- if (y1 == 4) y1 = 3;
- // If year was requested, compute and return it
- if (part == DatePartYear)
- {
- return (y400 * 400 + y100 * 100 + y4 * 4 + y1 + 1);
- }
- // n = day number within year
- n -= y1 * DaysPerYear;
- // If day-of-year was requested, return it
- if (part == DatePartDayOfYear)
- {
- return (n + 1);
- }
- // Leap year calculation looks different from IsLeapYear since y1, y4,
- // and y100 are relative to year 1, not year 0
- bool leapYear = (y1 == 3 && (y4 != 24 || y100 == 3));
- int[] days = leapYear ? DaysToMonth366 : DaysToMonth365;
- // All months have less than 32 days, so n >> 5 is a good conservative
- // estimate for the month
- int m = (n >> 5) + 1;
- // m = 1-based month number
- while (n >= days[m]) m++;
- // If month was requested, return it
- if (part == DatePartMonth) return (m);
- // Return 1-based day-of-month
- return (n - days[m - 1] + 1);
- }
-
- /*=================================GetAbsoluteDate==========================
- **Action: Gets the absolute date for the given Gregorian date. The absolute date means
- ** the number of days from January 1st, 1 A.D.
- **Returns: the absolute date
- **Arguments:
- ** year the Gregorian year
- ** month the Gregorian month
- ** day the day
- **Exceptions:
- ** ArgumentOutOfRangException if year, month, day value is valid.
- **Note:
- ** This is an internal method used by DateToTicks() and the calculations of Hijri and Hebrew calendars.
- ** Number of Days in Prior Years (both common and leap years) +
- ** Number of Days in Prior Months of Current Year +
- ** Number of Days in Current Month
- **
- ============================================================================*/
-
- internal static long GetAbsoluteDate(int year, int month, int day)
- {
- if (year >= 1 && year <= MaxYear && month >= 1 && month <= 12)
- {
- int[] days = ((year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))) ? DaysToMonth366 : DaysToMonth365;
- if (day >= 1 && (day <= days[month] - days[month - 1]))
- {
- int y = year - 1;
- int absoluteDate = y * 365 + y / 4 - y / 100 + y / 400 + days[month - 1] + day - 1;
- return (absoluteDate);
- }
- }
- throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadYearMonthDay);
- }
-
- // Returns the tick count corresponding to the given year, month, and day.
- // Will check the if the parameters are valid.
- internal virtual long DateToTicks(int year, int month, int day)
- {
- return (GetAbsoluteDate(year, month, day) * TicksPerDay);
- }
-
- // Returns the DateTime resulting from adding the given number of
- // months to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year and month parts of the specified DateTime by
- // value months, and, if required, adjusting the day part of the
- // resulting date downwards to the last day of the resulting month in the
- // resulting year. The time-of-day part of the result is the same as the
- // time-of-day part of the specified DateTime.
- //
- // In more precise terms, considering the specified DateTime to be of the
- // form y / m / d + t, where y is the
- // year, m is the month, d is the day, and t is the
- // time-of-day, the result is y1 / m1 / d1 + t,
- // where y1 and m1 are computed by adding value months
- // to y and m, and d1 is the largest value less than
- // or equal to d that denotes a valid day in month m1 of year
- // y1.
- //
-
- public override DateTime AddMonths(DateTime time, int months)
- {
- if (months < -120000 || months > 120000)
- {
- throw new ArgumentOutOfRangeException(
- nameof(months),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- -120000,
- 120000));
- }
- Contract.EndContractBlock();
- int y = GetDatePart(time.Ticks, DatePartYear);
- int m = GetDatePart(time.Ticks, DatePartMonth);
- int d = GetDatePart(time.Ticks, DatePartDay);
- int i = m - 1 + months;
- if (i >= 0)
- {
- m = i % 12 + 1;
- y = y + i / 12;
- }
- else
- {
- m = 12 + (i + 1) % 12;
- y = y + (i - 11) / 12;
- }
- int[] daysArray = (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) ? DaysToMonth366 : DaysToMonth365;
- int days = (daysArray[m] - daysArray[m - 1]);
-
- if (d > days)
- {
- d = days;
- }
- long ticks = DateToTicks(y, m, d) + time.Ticks % TicksPerDay;
- Calendar.CheckAddResult(ticks, MinSupportedDateTime, MaxSupportedDateTime);
-
- return (new DateTime(ticks));
- }
-
-
- // Returns the DateTime resulting from adding the given number of
- // years to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year part of the specified DateTime by value
- // years. If the month and day of the specified DateTime is 2/29, and if the
- // resulting year is not a leap year, the month and day of the resulting
- // DateTime becomes 2/28. Otherwise, the month, day, and time-of-day
- // parts of the result are the same as those of the specified DateTime.
- //
-
- public override DateTime AddYears(DateTime time, int years)
- {
- return (AddMonths(time, years * 12));
- }
-
- // Returns the day-of-month part of the specified DateTime. The returned
- // value is an integer between 1 and 31.
- //
-
- public override int GetDayOfMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDay));
- }
-
- // Returns the day-of-week part of the specified DateTime. The returned value
- // is an integer between 0 and 6, where 0 indicates Sunday, 1 indicates
- // Monday, 2 indicates Tuesday, 3 indicates Wednesday, 4 indicates
- // Thursday, 5 indicates Friday, and 6 indicates Saturday.
- //
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- return ((DayOfWeek)((int)(time.Ticks / TicksPerDay + 1) % 7));
- }
-
- // Returns the day-of-year part of the specified DateTime. The returned value
- // is an integer between 1 and 366.
- //
-
- public override int GetDayOfYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDayOfYear));
- }
-
- // Returns the number of days in the month given by the year and
- // month arguments.
- //
-
- public override int GetDaysInMonth(int year, int month, int era)
- {
- if (era == CurrentEra || era == ADEra)
- {
- if (year < 1 || year > MaxYear)
- {
- throw new ArgumentOutOfRangeException(nameof(year), SR.Format(SR.ArgumentOutOfRange_Range,
- 1, MaxYear));
- }
- if (month < 1 || month > 12)
- {
- throw new ArgumentOutOfRangeException(nameof(month), SR.ArgumentOutOfRange_Month);
- }
- int[] days = ((year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? DaysToMonth366 : DaysToMonth365);
- return (days[month] - days[month - 1]);
- }
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
-
- // Returns the number of days in the year given by the year argument for the current era.
- //
-
- public override int GetDaysInYear(int year, int era)
- {
- if (era == CurrentEra || era == ADEra)
- {
- if (year >= 1 && year <= MaxYear)
- {
- return ((year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? 366 : 365);
- }
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- MaxYear));
- }
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
-
- // Returns the era for the specified DateTime value.
-
- public override int GetEra(DateTime time)
- {
- return (ADEra);
- }
-
-
- public override int[] Eras
- {
- get
- {
- return (new int[] { ADEra });
- }
- }
-
-
- // Returns the month part of the specified DateTime. The returned value is an
- // integer between 1 and 12.
- //
-
- public override int GetMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartMonth));
- }
-
- // Returns the number of months in the specified year and era.
-
- public override int GetMonthsInYear(int year, int era)
- {
- if (era == CurrentEra || era == ADEra)
- {
- if (year >= 1 && year <= MaxYear)
- {
- return (12);
- }
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- MaxYear));
- }
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
-
- // Returns the year part of the specified DateTime. The returned value is an
- // integer between 1 and 9999.
- //
-
- public override int GetYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartYear));
- }
-
- // Checks whether a given day in the specified era is a leap day. This method returns true if
- // the date is a leap day, or false if not.
- //
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- if (month < 1 || month > 12)
- {
- throw new ArgumentOutOfRangeException(nameof(month), SR.Format(SR.ArgumentOutOfRange_Range,
- 1, 12));
- }
- Contract.EndContractBlock();
-
- if (era != CurrentEra && era != ADEra)
- {
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
- if (year < 1 || year > MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- SR.Format(SR.ArgumentOutOfRange_Range, 1, MaxYear));
- }
-
- if (day < 1 || day > GetDaysInMonth(year, month))
- {
- throw new ArgumentOutOfRangeException(nameof(day), SR.Format(SR.ArgumentOutOfRange_Range,
- 1, GetDaysInMonth(year, month)));
- }
- if (!IsLeapYear(year))
- {
- return (false);
- }
- if (month == 2 && day == 29)
- {
- return (true);
- }
- return (false);
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
-
- public override int GetLeapMonth(int year, int era)
- {
- if (era != CurrentEra && era != ADEra)
- {
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
- if (year < 1 || year > MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range, 1, MaxYear));
- }
- Contract.EndContractBlock();
- return (0);
- }
-
- // Checks whether a given month in the specified era is a leap month. This method returns true if
- // month is a leap month, or false if not.
- //
-
- public override bool IsLeapMonth(int year, int month, int era)
- {
- if (era != CurrentEra && era != ADEra)
- {
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
-
- if (year < 1 || year > MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range, 1, MaxYear));
- }
-
- if (month < 1 || month > 12)
- {
- throw new ArgumentOutOfRangeException(nameof(month), SR.Format(SR.ArgumentOutOfRange_Range,
- 1, 12));
- }
- Contract.EndContractBlock();
- return (false);
- }
-
- // Checks whether a given year in the specified era is a leap year. This method returns true if
- // year is a leap year, or false if not.
- //
-
- public override bool IsLeapYear(int year, int era)
- {
- if (era == CurrentEra || era == ADEra)
- {
- if (year >= 1 && year <= MaxYear)
- {
- return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
- }
-
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range, 1, MaxYear));
- }
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
-
- // Returns the date and time converted to a DateTime value. Throws an exception if the n-tuple is invalid.
- //
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- if (era == CurrentEra || era == ADEra)
- {
- return new DateTime(year, month, day, hour, minute, second, millisecond);
- }
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
-
- internal override Boolean TryToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era, out DateTime result)
- {
- if (era == CurrentEra || era == ADEra)
- {
- try
- {
- result = new DateTime(year, month, day, hour, minute, second, millisecond);
- return true;
- }
- catch (ArgumentOutOfRangeException)
- {
- result = DateTime.Now;
- return false;
- }
- catch (ArgumentException)
- {
- result = DateTime.Now;
- return false;
- }
- }
- result = DateTime.MinValue;
- return false;
- }
-
- private const int DEFAULT_TWO_DIGIT_YEAR_MAX = 2029;
-
-
- public override int TwoDigitYearMax
- {
- get
- {
- if (twoDigitYearMax == -1)
- {
- twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
- }
- return (twoDigitYearMax);
- }
-
- set
- {
- VerifyWritable();
- if (value < 99 || value > MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- "year",
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 99,
- MaxYear));
- }
- twoDigitYearMax = value;
- }
- }
-
-
- public override int ToFourDigitYear(int year)
- {
- if (year < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedNonNegNum);
- }
- Contract.EndContractBlock();
-
- if (year > MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range, 1, MaxYear));
- }
- return (base.ToFourDigitYear(year));
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/GregorianCalendarHelper.cs b/src/mscorlib/corefx/System/Globalization/GregorianCalendarHelper.cs
deleted file mode 100644
index ee8ba13894..0000000000
--- a/src/mscorlib/corefx/System/Globalization/GregorianCalendarHelper.cs
+++ /dev/null
@@ -1,668 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
-using System.Threading;
-
-namespace System.Globalization
-{
- // Gregorian Calendars use Era Info
- [Serializable]
- internal class EraInfo
- {
- internal int era; // The value of the era.
- internal long ticks; // The time in ticks when the era starts
- internal int yearOffset; // The offset to Gregorian year when the era starts.
- // Gregorian Year = Era Year + yearOffset
- // Era Year = Gregorian Year - yearOffset
- internal int minEraYear; // Min year value in this era. Generally, this value is 1, but this may
- // be affected by the DateTime.MinValue;
- internal int maxEraYear; // Max year value in this era. (== the year length of the era + 1)
-
- [OptionalField(VersionAdded = 4)]
- internal String eraName; // The era name
- [OptionalField(VersionAdded = 4)]
- internal String abbrevEraName; // Abbreviated Era Name
- [OptionalField(VersionAdded = 4)]
- internal String englishEraName; // English era name
-
- internal EraInfo(int era, int startYear, int startMonth, int startDay, int yearOffset, int minEraYear, int maxEraYear)
- {
- this.era = era;
- this.yearOffset = yearOffset;
- this.minEraYear = minEraYear;
- this.maxEraYear = maxEraYear;
- this.ticks = new DateTime(startYear, startMonth, startDay).Ticks;
- }
-
- internal EraInfo(int era, int startYear, int startMonth, int startDay, int yearOffset, int minEraYear, int maxEraYear,
- String eraName, String abbrevEraName, String englishEraName)
- {
- this.era = era;
- this.yearOffset = yearOffset;
- this.minEraYear = minEraYear;
- this.maxEraYear = maxEraYear;
- this.ticks = new DateTime(startYear, startMonth, startDay).Ticks;
- this.eraName = eraName;
- this.abbrevEraName = abbrevEraName;
- this.englishEraName = englishEraName;
- }
- }
-
- // This calendar recognizes two era values:
- // 0 CurrentEra (AD)
- // 1 BeforeCurrentEra (BC)
- [Serializable]
- internal class GregorianCalendarHelper
- {
- // 1 tick = 100ns = 10E-7 second
- // Number of ticks per time unit
- internal const long TicksPerMillisecond = 10000;
- internal const long TicksPerSecond = TicksPerMillisecond * 1000;
- internal const long TicksPerMinute = TicksPerSecond * 60;
- internal const long TicksPerHour = TicksPerMinute * 60;
- internal const long TicksPerDay = TicksPerHour * 24;
-
- // Number of milliseconds per time unit
- internal const int MillisPerSecond = 1000;
- internal const int MillisPerMinute = MillisPerSecond * 60;
- internal const int MillisPerHour = MillisPerMinute * 60;
- internal const int MillisPerDay = MillisPerHour * 24;
-
- // Number of days in a non-leap year
- internal const int DaysPerYear = 365;
- // Number of days in 4 years
- internal const int DaysPer4Years = DaysPerYear * 4 + 1;
- // Number of days in 100 years
- internal const int DaysPer100Years = DaysPer4Years * 25 - 1;
- // Number of days in 400 years
- internal const int DaysPer400Years = DaysPer100Years * 4 + 1;
-
- // Number of days from 1/1/0001 to 1/1/10000
- internal const int DaysTo10000 = DaysPer400Years * 25 - 366;
-
- internal const long MaxMillis = (long)DaysTo10000 * MillisPerDay;
-
- internal const int DatePartYear = 0;
- internal const int DatePartDayOfYear = 1;
- internal const int DatePartMonth = 2;
- internal const int DatePartDay = 3;
-
- //
- // This is the max Gregorian year can be represented by DateTime class. The limitation
- // is derived from DateTime class.
- //
- internal int MaxYear
- {
- get
- {
- return (m_maxYear);
- }
- }
-
- internal static readonly int[] DaysToMonth365 =
- {
- 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
- };
-
- internal static readonly int[] DaysToMonth366 =
- {
- 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366
- };
-
- [OptionalField(VersionAdded = 1)]
- internal int m_maxYear = 9999;
- [OptionalField(VersionAdded = 1)]
- internal int m_minYear;
- internal Calendar m_Cal;
-
- [OptionalField(VersionAdded = 1)]
- internal EraInfo[] m_EraInfo;
- [OptionalField(VersionAdded = 1)]
- internal int[] m_eras = null;
-
-
- // Construct an instance of gregorian calendar.
- internal GregorianCalendarHelper(Calendar cal, EraInfo[] eraInfo)
- {
- m_Cal = cal;
- m_EraInfo = eraInfo;
- m_maxYear = m_EraInfo[0].maxEraYear;
- m_minYear = m_EraInfo[0].minEraYear; ;
- }
-
- /*=================================GetGregorianYear==========================
- **Action: Get the Gregorian year value for the specified year in an era.
- **Returns: The Gregorian year value.
- **Arguments:
- ** year the year value in Japanese calendar
- ** era the Japanese emperor era value.
- **Exceptions:
- ** ArgumentOutOfRangeException if year value is invalid or era value is invalid.
- ============================================================================*/
-
- internal int GetGregorianYear(int year, int era)
- {
- if (year < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedNonNegNum);
- }
- Contract.EndContractBlock();
-
- if (era == Calendar.CurrentEra)
- {
- era = m_Cal.CurrentEraValue;
- }
-
- for (int i = 0; i < m_EraInfo.Length; i++)
- {
- if (era == m_EraInfo[i].era)
- {
- if (year < m_EraInfo[i].minEraYear || year > m_EraInfo[i].maxEraYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- m_EraInfo[i].minEraYear,
- m_EraInfo[i].maxEraYear));
- }
- return (m_EraInfo[i].yearOffset + year);
- }
- }
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
-
- internal bool IsValidYear(int year, int era)
- {
- if (year < 0)
- {
- return false;
- }
-
- if (era == Calendar.CurrentEra)
- {
- era = m_Cal.CurrentEraValue;
- }
-
- for (int i = 0; i < m_EraInfo.Length; i++)
- {
- if (era == m_EraInfo[i].era)
- {
- if (year < m_EraInfo[i].minEraYear || year > m_EraInfo[i].maxEraYear)
- {
- return false;
- }
- return true;
- }
- }
- return false;
- }
-
-
- // Returns a given date part of this DateTime. This method is used
- // to compute the year, day-of-year, month, or day part.
- internal virtual int GetDatePart(long ticks, int part)
- {
- CheckTicksRange(ticks);
- // n = number of days since 1/1/0001
- int n = (int)(ticks / TicksPerDay);
- // y400 = number of whole 400-year periods since 1/1/0001
- int y400 = n / DaysPer400Years;
- // n = day number within 400-year period
- n -= y400 * DaysPer400Years;
- // y100 = number of whole 100-year periods within 400-year period
- int y100 = n / DaysPer100Years;
- // Last 100-year period has an extra day, so decrement result if 4
- if (y100 == 4) y100 = 3;
- // n = day number within 100-year period
- n -= y100 * DaysPer100Years;
- // y4 = number of whole 4-year periods within 100-year period
- int y4 = n / DaysPer4Years;
- // n = day number within 4-year period
- n -= y4 * DaysPer4Years;
- // y1 = number of whole years within 4-year period
- int y1 = n / DaysPerYear;
- // Last year has an extra day, so decrement result if 4
- if (y1 == 4) y1 = 3;
- // If year was requested, compute and return it
- if (part == DatePartYear)
- {
- return (y400 * 400 + y100 * 100 + y4 * 4 + y1 + 1);
- }
- // n = day number within year
- n -= y1 * DaysPerYear;
- // If day-of-year was requested, return it
- if (part == DatePartDayOfYear)
- {
- return (n + 1);
- }
- // Leap year calculation looks different from IsLeapYear since y1, y4,
- // and y100 are relative to year 1, not year 0
- bool leapYear = (y1 == 3 && (y4 != 24 || y100 == 3));
- int[] days = leapYear ? DaysToMonth366 : DaysToMonth365;
- // All months have less than 32 days, so n >> 5 is a good conservative
- // estimate for the month
- int m = (n >> 5) + 1;
- // m = 1-based month number
- while (n >= days[m]) m++;
- // If month was requested, return it
- if (part == DatePartMonth) return (m);
- // Return 1-based day-of-month
- return (n - days[m - 1] + 1);
- }
-
- /*=================================GetAbsoluteDate==========================
- **Action: Gets the absolute date for the given Gregorian date. The absolute date means
- ** the number of days from January 1st, 1 A.D.
- **Returns: the absolute date
- **Arguments:
- ** year the Gregorian year
- ** month the Gregorian month
- ** day the day
- **Exceptions:
- ** ArgumentOutOfRangException if year, month, day value is valid.
- **Note:
- ** This is an internal method used by DateToTicks() and the calculations of Hijri and Hebrew calendars.
- ** Number of Days in Prior Years (both common and leap years) +
- ** Number of Days in Prior Months of Current Year +
- ** Number of Days in Current Month
- **
- ============================================================================*/
-
- internal static long GetAbsoluteDate(int year, int month, int day)
- {
- if (year >= 1 && year <= 9999 && month >= 1 && month <= 12)
- {
- int[] days = ((year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))) ? DaysToMonth366 : DaysToMonth365;
- if (day >= 1 && (day <= days[month] - days[month - 1]))
- {
- int y = year - 1;
- int absoluteDate = y * 365 + y / 4 - y / 100 + y / 400 + days[month - 1] + day - 1;
- return (absoluteDate);
- }
- }
- throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadYearMonthDay);
- }
-
- // Returns the tick count corresponding to the given year, month, and day.
- // Will check the if the parameters are valid.
- internal static long DateToTicks(int year, int month, int day)
- {
- return (GetAbsoluteDate(year, month, day) * TicksPerDay);
- }
-
- // Return the tick count corresponding to the given hour, minute, second.
- // Will check the if the parameters are valid.
- internal static long TimeToTicks(int hour, int minute, int second, int millisecond)
- {
- //TimeSpan.TimeToTicks is a family access function which does no error checking, so
- //we need to put some error checking out here.
- if (hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >= 0 && second < 60)
- {
- if (millisecond < 0 || millisecond >= MillisPerSecond)
- {
- throw new ArgumentOutOfRangeException(
- nameof(millisecond),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 0,
- MillisPerSecond - 1));
- }
- return (InternalGloablizationHelper.TimeToTicks(hour, minute, second) + millisecond * TicksPerMillisecond); ;
- }
- throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadHourMinuteSecond);
- }
-
-
- internal void CheckTicksRange(long ticks)
- {
- if (ticks < m_Cal.MinSupportedDateTime.Ticks || ticks > m_Cal.MaxSupportedDateTime.Ticks)
- {
- throw new ArgumentOutOfRangeException(
- "time",
- String.Format(
- CultureInfo.InvariantCulture,
- SR.ArgumentOutOfRange_CalendarRange,
- m_Cal.MinSupportedDateTime,
- m_Cal.MaxSupportedDateTime));
- }
- Contract.EndContractBlock();
- }
-
- // Returns the DateTime resulting from adding the given number of
- // months to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year and month parts of the specified DateTime by
- // value months, and, if required, adjusting the day part of the
- // resulting date downwards to the last day of the resulting month in the
- // resulting year. The time-of-day part of the result is the same as the
- // time-of-day part of the specified DateTime.
- //
- // In more precise terms, considering the specified DateTime to be of the
- // form y / m / d + t, where y is the
- // year, m is the month, d is the day, and t is the
- // time-of-day, the result is y1 / m1 / d1 + t,
- // where y1 and m1 are computed by adding value months
- // to y and m, and d1 is the largest value less than
- // or equal to d that denotes a valid day in month m1 of year
- // y1.
- //
- public DateTime AddMonths(DateTime time, int months)
- {
- if (months < -120000 || months > 120000)
- {
- throw new ArgumentOutOfRangeException(
- nameof(months),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- -120000,
- 120000));
- }
- Contract.EndContractBlock();
- CheckTicksRange(time.Ticks);
-
- int y = GetDatePart(time.Ticks, DatePartYear);
- int m = GetDatePart(time.Ticks, DatePartMonth);
- int d = GetDatePart(time.Ticks, DatePartDay);
- int i = m - 1 + months;
- if (i >= 0)
- {
- m = i % 12 + 1;
- y = y + i / 12;
- }
- else
- {
- m = 12 + (i + 1) % 12;
- y = y + (i - 11) / 12;
- }
- int[] daysArray = (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) ? DaysToMonth366 : DaysToMonth365;
- int days = (daysArray[m] - daysArray[m - 1]);
-
- if (d > days)
- {
- d = days;
- }
- long ticks = DateToTicks(y, m, d) + (time.Ticks % TicksPerDay);
- Calendar.CheckAddResult(ticks, m_Cal.MinSupportedDateTime, m_Cal.MaxSupportedDateTime);
- return (new DateTime(ticks));
- }
-
- // Returns the DateTime resulting from adding the given number of
- // years to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year part of the specified DateTime by value
- // years. If the month and day of the specified DateTime is 2/29, and if the
- // resulting year is not a leap year, the month and day of the resulting
- // DateTime becomes 2/28. Otherwise, the month, day, and time-of-day
- // parts of the result are the same as those of the specified DateTime.
- //
- public DateTime AddYears(DateTime time, int years)
- {
- return (AddMonths(time, years * 12));
- }
-
- // Returns the day-of-month part of the specified DateTime. The returned
- // value is an integer between 1 and 31.
- //
- public int GetDayOfMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDay));
- }
-
- // Returns the day-of-week part of the specified DateTime. The returned value
- // is an integer between 0 and 6, where 0 indicates Sunday, 1 indicates
- // Monday, 2 indicates Tuesday, 3 indicates Wednesday, 4 indicates
- // Thursday, 5 indicates Friday, and 6 indicates Saturday.
- //
- public DayOfWeek GetDayOfWeek(DateTime time)
- {
- CheckTicksRange(time.Ticks);
- return ((DayOfWeek)((time.Ticks / TicksPerDay + 1) % 7));
- }
-
- // Returns the day-of-year part of the specified DateTime. The returned value
- // is an integer between 1 and 366.
- //
- public int GetDayOfYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDayOfYear));
- }
-
- // Returns the number of days in the month given by the year and
- // month arguments.
- //
- [Pure]
- public int GetDaysInMonth(int year, int month, int era)
- {
- //
- // Convert year/era value to Gregorain year value.
- //
- year = GetGregorianYear(year, era);
- if (month < 1 || month > 12)
- {
- throw new ArgumentOutOfRangeException(nameof(month), SR.ArgumentOutOfRange_Month);
- }
- int[] days = ((year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? DaysToMonth366 : DaysToMonth365);
- return (days[month] - days[month - 1]);
- }
-
- // Returns the number of days in the year given by the year argument for the current era.
- //
-
- public int GetDaysInYear(int year, int era)
- {
- //
- // Convert year/era value to Gregorain year value.
- //
- year = GetGregorianYear(year, era);
- return ((year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? 366 : 365);
- }
-
- // Returns the era for the specified DateTime value.
- public int GetEra(DateTime time)
- {
- long ticks = time.Ticks;
- // The assumption here is that m_EraInfo is listed in reverse order.
- for (int i = 0; i < m_EraInfo.Length; i++)
- {
- if (ticks >= m_EraInfo[i].ticks)
- {
- return (m_EraInfo[i].era);
- }
- }
- throw new ArgumentOutOfRangeException(nameof(time), SR.ArgumentOutOfRange_Era);
- }
-
-
- public int[] Eras
- {
- get
- {
- if (m_eras == null)
- {
- m_eras = new int[m_EraInfo.Length];
- for (int i = 0; i < m_EraInfo.Length; i++)
- {
- m_eras[i] = m_EraInfo[i].era;
- }
- }
- return ((int[])m_eras.Clone());
- }
- }
-
- // Returns the month part of the specified DateTime. The returned value is an
- // integer between 1 and 12.
- //
- public int GetMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartMonth));
- }
-
- // Returns the number of months in the specified year and era.
- public int GetMonthsInYear(int year, int era)
- {
- year = GetGregorianYear(year, era);
- return (12);
- }
-
- // Returns the year part of the specified DateTime. The returned value is an
- // integer between 1 and 9999.
- //
- public int GetYear(DateTime time)
- {
- long ticks = time.Ticks;
- int year = GetDatePart(ticks, DatePartYear);
- for (int i = 0; i < m_EraInfo.Length; i++)
- {
- if (ticks >= m_EraInfo[i].ticks)
- {
- return (year - m_EraInfo[i].yearOffset);
- }
- }
- throw new ArgumentException(SR.Argument_NoEra);
- }
-
- // Returns the year that match the specified Gregorian year. The returned value is an
- // integer between 1 and 9999.
- //
- public int GetYear(int year, DateTime time)
- {
- long ticks = time.Ticks;
- for (int i = 0; i < m_EraInfo.Length; i++)
- {
- // while calculating dates with JapaneseLuniSolarCalendar, we can run into cases right after the start of the era
- // and still belong to the month which is started in previous era. Calculating equivalent calendar date will cause
- // using the new era info which will have the year offset equal to the year we are calculating year = m_EraInfo[i].yearOffset
- // which will end up with zero as calendar year.
- // We should use the previous era info instead to get the right year number. Example of such date is Feb 2nd 1989
- if (ticks >= m_EraInfo[i].ticks && year > m_EraInfo[i].yearOffset)
- {
- return (year - m_EraInfo[i].yearOffset);
- }
- }
- throw new ArgumentException(SR.Argument_NoEra);
- }
-
- // Checks whether a given day in the specified era is a leap day. This method returns true if
- // the date is a leap day, or false if not.
- //
- public bool IsLeapDay(int year, int month, int day, int era)
- {
- // year/month/era checking is done in GetDaysInMonth()
- if (day < 1 || day > GetDaysInMonth(year, month, era))
- {
- throw new ArgumentOutOfRangeException(
- nameof(day),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- GetDaysInMonth(year, month, era)));
- }
- Contract.EndContractBlock();
-
- if (!IsLeapYear(year, era))
- {
- return (false);
- }
-
- if (month == 2 && day == 29)
- {
- return (true);
- }
-
- return (false);
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
- public int GetLeapMonth(int year, int era)
- {
- year = GetGregorianYear(year, era);
- return (0);
- }
-
- // Checks whether a given month in the specified era is a leap month. This method returns true if
- // month is a leap month, or false if not.
- //
- public bool IsLeapMonth(int year, int month, int era)
- {
- year = GetGregorianYear(year, era);
- if (month < 1 || month > 12)
- {
- throw new ArgumentOutOfRangeException(
- nameof(month),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- 12));
- }
- return (false);
- }
-
- // Checks whether a given year in the specified era is a leap year. This method returns true if
- // year is a leap year, or false if not.
- //
- public bool IsLeapYear(int year, int era)
- {
- year = GetGregorianYear(year, era);
- return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
- }
-
- // Returns the date and time converted to a DateTime value. Throws an exception if the n-tuple is invalid.
- //
- public DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- year = GetGregorianYear(year, era);
- long ticks = DateToTicks(year, month, day) + TimeToTicks(hour, minute, second, millisecond);
- CheckTicksRange(ticks);
- return (new DateTime(ticks));
- }
-
- public virtual int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
- {
- CheckTicksRange(time.Ticks);
- // Use GregorianCalendar to get around the problem that the implmentation in Calendar.GetWeekOfYear()
- // can call GetYear() that exceeds the supported range of the Gregorian-based calendars.
- return (GregorianCalendar.GetDefaultInstance().GetWeekOfYear(time, rule, firstDayOfWeek));
- }
-
-
- public int ToFourDigitYear(int year, int twoDigitYearMax)
- {
- if (year < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedPosNum);
- }
- Contract.EndContractBlock();
-
- if (year < 100)
- {
- int y = year % 100;
- return ((twoDigitYearMax / 100 - (y > twoDigitYearMax % 100 ? 1 : 0)) * 100 + y);
- }
-
- if (year < m_minYear || year > m_maxYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range, m_minYear, m_maxYear));
- }
- // If the year value is above 100, just return the year value. Don't have to do
- // the TwoDigitYearMax comparison.
- return (year);
- }
- }
-}
-
diff --git a/src/mscorlib/corefx/System/Globalization/GregorianCalendarTypes.cs b/src/mscorlib/corefx/System/Globalization/GregorianCalendarTypes.cs
deleted file mode 100644
index a14010fe60..0000000000
--- a/src/mscorlib/corefx/System/Globalization/GregorianCalendarTypes.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-
-namespace System.Globalization
-{
- // Note: The values of the members of this enum must match the coresponding values
- // in the CalendarId enum (since we cast between GregorianCalendarTypes and CalendarId).
- [Serializable]
- public enum GregorianCalendarTypes
- {
- Localized = CalendarId.GREGORIAN,
- USEnglish = CalendarId.GREGORIAN_US,
- MiddleEastFrench = CalendarId.GREGORIAN_ME_FRENCH,
- Arabic = CalendarId.GREGORIAN_ARABIC,
- TransliteratedEnglish = CalendarId.GREGORIAN_XLIT_ENGLISH,
- TransliteratedFrench = CalendarId.GREGORIAN_XLIT_FRENCH,
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/HebrewCalendar.cs b/src/mscorlib/corefx/System/Globalization/HebrewCalendar.cs
deleted file mode 100644
index b4f54f8fbb..0000000000
--- a/src/mscorlib/corefx/System/Globalization/HebrewCalendar.cs
+++ /dev/null
@@ -1,1129 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Rules for the Hebrew calendar:
- // - The Hebrew calendar is both a Lunar (months) and Solar (years)
- // calendar, but allows for a week of seven days.
- // - Days begin at sunset.
- // - Leap Years occur in the 3, 6, 8, 11, 14, 17, & 19th years of a
- // 19-year cycle. Year = leap iff ((7y+1) mod 19 < 7).
- // - There are 12 months in a common year and 13 months in a leap year.
- // - In a common year, the 6th month, Adar, has 29 days. In a leap
- // year, the 6th month, Adar I, has 30 days and the leap month,
- // Adar II, has 29 days.
- // - Common years have 353-355 days. Leap years have 383-385 days.
- // - The Hebrew new year (Rosh HaShanah) begins on the 1st of Tishri,
- // the 7th month in the list below.
- // - The new year may not begin on Sunday, Wednesday, or Friday.
- // - If the new year would fall on a Tuesday and the conjunction of
- // the following year were at midday or later, the new year is
- // delayed until Thursday.
- // - If the new year would fall on a Monday after a leap year, the
- // new year is delayed until Tuesday.
- // - The length of the 8th and 9th months vary from year to year,
- // depending on the overall length of the year.
- // - The length of a year is determined by the dates of the new
- // years (Tishri 1) preceding and following the year in question.
- // - The 2th month is long (30 days) if the year has 355 or 385 days.
- // - The 3th month is short (29 days) if the year has 353 or 383 days.
- // - The Hebrew months are:
- // 1. Tishri (30 days)
- // 2. Heshvan (29 or 30 days)
- // 3. Kislev (29 or 30 days)
- // 4. Teveth (29 days)
- // 5. Shevat (30 days)
- // 6. Adar I (30 days)
- // 7. Adar {II} (29 days, this only exists if that year is a leap year)
- // 8. Nisan (30 days)
- // 9. Iyyar (29 days)
- // 10. Sivan (30 days)
- // 11. Tammuz (29 days)
- // 12. Av (30 days)
- // 13. Elul (29 days)
- //
- ////////////////////////////////////////////////////////////////////////////
- /*
- ** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 1583/01/01 2239/09/29
- ** Hebrew 5343/04/07 5999/13/29
- */
-
- // Includes CHebrew implemetation;i.e All the code necessary for converting
- // Gregorian to Hebrew Lunar from 1583 to 2239.
-
-
- [Serializable]
- public class HebrewCalendar : Calendar
- {
- public static readonly int HebrewEra = 1;
-
- internal const int DatePartYear = 0;
- internal const int DatePartDayOfYear = 1;
- internal const int DatePartMonth = 2;
- internal const int DatePartDay = 3;
- internal const int DatePartDayOfWeek = 4;
-
- //
- // Hebrew Translation Table.
- //
- // This table is used to get the following Hebrew calendar information for a
- // given Gregorian year:
- // 1. The day of the Hebrew month corresponding to Gregorian January 1st
- // for a given Gregorian year.
- // 2. The month of the Hebrew month corresponding to Gregorian January 1st
- // for a given Gregorian year.
- // The information is not directly in the table. Instead, the info is decoded
- // by special values (numbers above 29 and below 1).
- // 3. The type of the Hebrew year for a given Gregorian year.
- //
-
- /*
- More notes:
-
- This table includes 2 numbers for each year.
- The offset into the table determines the year. (offset 0 is Gregorian year 1500)
- 1st number determines the day of the Hebrew month coresponeds to January 1st.
- 2nd number determines the type of the Hebrew year. (the type determines how
- many days are there in the year.)
-
- normal years : 1 = 353 days 2 = 354 days 3 = 355 days.
- Leap years : 4 = 383 5 384 6 = 385 days.
-
- A 99 means the year is not supported for translation.
- for convenience the table was defined for 750 year,
- but only 640 years are supported. (from 1583 to 2239)
- the years before 1582 (starting of Georgian calander)
- and after 2239, are filled with 99.
-
- Greogrian January 1st falls usually in Tevet (4th month). Tevet has always 29 days.
- That's why, there no nead to specify the lunar month in the table.
- There are exceptions, these are coded by giving numbers above 29 and below 1.
- Actual decoding is takenig place whenever fetching information from the table.
- The function for decoding is in GetLunarMonthDay().
-
- Example:
- The data for 2000 - 2005 A.D. is:
-
- 23,6,6,1,17,2,27,6,7,3, // 2000 - 2004
-
- For year 2000, we know it has a Hebrew year type 6, which means it has 385 days.
- And 1/1/2000 A.D. is Hebrew year 5760, 23rd day of 4th month.
- */
-
- //
- // Jewish Era in use today is dated from the supposed year of the
- // Creation with its beginning in 3761 B.C.
- //
-
- // The Hebrew year of Gregorian 1st year AD.
- // 0001/01/01 AD is Hebrew 3760/01/01
- private const int HebrewYearOf1AD = 3760;
-
- // The first Gregorian year in HebrewTable.
- private const int FirstGregorianTableYear = 1583; // == Hebrew Year 5343
- // The last Gregorian year in HebrewTable.
- private const int LastGregorianTableYear = 2239; // == Hebrew Year 5999
- private const int TABLESIZE = (LastGregorianTableYear - FirstGregorianTableYear);
-
- private const int MinHebrewYear = HebrewYearOf1AD + FirstGregorianTableYear; // == 5343
- private const int MaxHebrewYear = HebrewYearOf1AD + LastGregorianTableYear; // == 5999
-
- private static readonly byte[] s_hebrewTable = {
- 7,3,17,3, // 1583-1584 (Hebrew year: 5343 - 5344)
- 0,4,11,2,21,6,1,3,13,2, // 1585-1589
- 25,4,5,3,16,2,27,6,9,1, // 1590-1594
- 20,2,0,6,11,3,23,4,4,2, // 1595-1599
- 14,3,27,4,8,2,18,3,28,6, // 1600
- 11,1,22,5,2,3,12,3,25,4, // 1605
- 6,2,16,3,26,6,8,2,20,1, // 1610
- 0,6,11,2,24,4,4,3,15,2, // 1615
- 25,6,8,1,19,2,29,6,9,3, // 1620
- 22,4,3,2,13,3,25,4,6,3, // 1625
- 17,2,27,6,7,3,19,2,31,4, // 1630
- 11,3,23,4,5,2,15,3,25,6, // 1635
- 6,2,19,1,29,6,10,2,22,4, // 1640
- 3,3,14,2,24,6,6,1,17,3, // 1645
- 28,5,8,3,20,1,32,5,12,3, // 1650
- 22,6,4,1,16,2,26,6,6,3, // 1655
- 17,2,0,4,10,3,22,4,3,2, // 1660
- 14,3,24,6,5,2,17,1,28,6, // 1665
- 9,2,19,3,31,4,13,2,23,6, // 1670
- 3,3,15,1,27,5,7,3,17,3, // 1675
- 29,4,11,2,21,6,3,1,14,2, // 1680
- 25,6,5,3,16,2,28,4,9,3, // 1685
- 20,2,0,6,12,1,23,6,4,2, // 1690
- 14,3,26,4,8,2,18,3,0,4, // 1695
- 10,3,21,5,1,3,13,1,24,5, // 1700
- 5,3,15,3,27,4,8,2,19,3, // 1705
- 29,6,10,2,22,4,3,3,14,2, // 1710
- 26,4,6,3,18,2,28,6,10,1, // 1715
- 20,6,2,2,12,3,24,4,5,2, // 1720
- 16,3,28,4,8,3,19,2,0,6, // 1725
- 12,1,23,5,3,3,14,3,26,4, // 1730
- 7,2,17,3,28,6,9,2,21,4, // 1735
- 1,3,13,2,25,4,5,3,16,2, // 1740
- 27,6,9,1,19,3,0,5,11,3, // 1745
- 23,4,4,2,14,3,25,6,7,1, // 1750
- 18,2,28,6,9,3,21,4,2,2, // 1755
- 12,3,25,4,6,2,16,3,26,6, // 1760
- 8,2,20,1,0,6,11,2,22,6, // 1765
- 4,1,15,2,25,6,6,3,18,1, // 1770
- 29,5,9,3,22,4,2,3,13,2, // 1775
- 23,6,4,3,15,2,27,4,7,3, // 1780
- 19,2,31,4,11,3,21,6,3,2, // 1785
- 15,1,25,6,6,2,17,3,29,4, // 1790
- 10,2,20,6,3,1,13,3,24,5, // 1795
- 4,3,16,1,27,5,7,3,17,3, // 1800
- 0,4,11,2,21,6,1,3,13,2, // 1805
- 25,4,5,3,16,2,29,4,9,3, // 1810
- 19,6,30,2,13,1,23,6,4,2, // 1815
- 14,3,27,4,8,2,18,3,0,4, // 1820
- 11,3,22,5,2,3,14,1,26,5, // 1825
- 6,3,16,3,28,4,10,2,20,6, // 1830
- 30,3,11,2,24,4,4,3,15,2, // 1835
- 25,6,8,1,19,2,29,6,9,3, // 1840
- 22,4,3,2,13,3,25,4,7,2, // 1845
- 17,3,27,6,9,1,21,5,1,3, // 1850
- 11,3,23,4,5,2,15,3,25,6, // 1855
- 6,2,19,1,29,6,10,2,22,4, // 1860
- 3,3,14,2,24,6,6,1,18,2, // 1865
- 28,6,8,3,20,4,2,2,12,3, // 1870
- 24,4,4,3,16,2,26,6,6,3, // 1875
- 17,2,0,4,10,3,22,4,3,2, // 1880
- 14,3,24,6,5,2,17,1,28,6, // 1885
- 9,2,21,4,1,3,13,2,23,6, // 1890
- 5,1,15,3,27,5,7,3,19,1, // 1895
- 0,5,10,3,22,4,2,3,13,2, // 1900
- 24,6,4,3,15,2,27,4,8,3, // 1905
- 20,4,1,2,11,3,22,6,3,2, // 1910
- 15,1,25,6,7,2,17,3,29,4, // 1915
- 10,2,21,6,1,3,13,1,24,5, // 1920
- 5,3,15,3,27,4,8,2,19,6, // 1925
- 1,1,12,2,22,6,3,3,14,2, // 1930
- 26,4,6,3,18,2,28,6,10,1, // 1935
- 20,6,2,2,12,3,24,4,5,2, // 1940
- 16,3,28,4,9,2,19,6,30,3, // 1945
- 12,1,23,5,3,3,14,3,26,4, // 1950
- 7,2,17,3,28,6,9,2,21,4, // 1955
- 1,3,13,2,25,4,5,3,16,2, // 1960
- 27,6,9,1,19,6,30,2,11,3, // 1965
- 23,4,4,2,14,3,27,4,7,3, // 1970
- 18,2,28,6,11,1,22,5,2,3, // 1975
- 12,3,25,4,6,2,16,3,26,6, // 1980
- 8,2,20,4,30,3,11,2,24,4, // 1985
- 4,3,15,2,25,6,8,1,18,3, // 1990
- 29,5,9,3,22,4,3,2,13,3, // 1995
- 23,6,6,1,17,2,27,6,7,3, // 2000 - 2004
- 20,4,1,2,11,3,23,4,5,2, // 2005 - 2009
- 15,3,25,6,6,2,19,1,29,6, // 2010
- 10,2,20,6,3,1,14,2,24,6, // 2015
- 4,3,17,1,28,5,8,3,20,4, // 2020
- 1,3,12,2,22,6,2,3,14,2, // 2025
- 26,4,6,3,17,2,0,4,10,3, // 2030
- 20,6,1,2,14,1,24,6,5,2, // 2035
- 15,3,28,4,9,2,19,6,1,1, // 2040
- 12,3,23,5,3,3,15,1,27,5, // 2045
- 7,3,17,3,29,4,11,2,21,6, // 2050
- 1,3,12,2,25,4,5,3,16,2, // 2055
- 28,4,9,3,19,6,30,2,12,1, // 2060
- 23,6,4,2,14,3,26,4,8,2, // 2065
- 18,3,0,4,10,3,22,5,2,3, // 2070
- 14,1,25,5,6,3,16,3,28,4, // 2075
- 9,2,20,6,30,3,11,2,23,4, // 2080
- 4,3,15,2,27,4,7,3,19,2, // 2085
- 29,6,11,1,21,6,3,2,13,3, // 2090
- 25,4,6,2,17,3,27,6,9,1, // 2095
- 20,5,30,3,10,3,22,4,3,2, // 2100
- 14,3,24,6,5,2,17,1,28,6, // 2105
- 9,2,21,4,1,3,13,2,23,6, // 2110
- 5,1,16,2,27,6,7,3,19,4, // 2115
- 30,2,11,3,23,4,3,3,14,2, // 2120
- 25,6,5,3,16,2,28,4,9,3, // 2125
- 21,4,2,2,12,3,23,6,4,2, // 2130
- 16,1,26,6,8,2,20,4,30,3, // 2135
- 11,2,22,6,4,1,14,3,25,5, // 2140
- 6,3,18,1,29,5,9,3,22,4, // 2145
- 2,3,13,2,23,6,4,3,15,2, // 2150
- 27,4,7,3,20,4,1,2,11,3, // 2155
- 21,6,3,2,15,1,25,6,6,2, // 2160
- 17,3,29,4,10,2,20,6,3,1, // 2165
- 13,3,24,5,4,3,17,1,28,5, // 2170
- 8,3,18,6,1,1,12,2,22,6, // 2175
- 2,3,14,2,26,4,6,3,17,2, // 2180
- 28,6,10,1,20,6,1,2,12,3, // 2185
- 24,4,5,2,15,3,28,4,9,2, // 2190
- 19,6,33,3,12,1,23,5,3,3, // 2195
- 13,3,25,4,6,2,16,3,26,6, // 2200
- 8,2,20,4,30,3,11,2,24,4, // 2205
- 4,3,15,2,25,6,8,1,18,6, // 2210
- 33,2,9,3,22,4,3,2,13,3, // 2215
- 25,4,6,3,17,2,27,6,9,1, // 2220
- 21,5,1,3,11,3,23,4,5,2, // 2225
- 15,3,25,6,6,2,19,4,33,3, // 2230
- 10,2,22,4,3,3,14,2,24,6, // 2235
- 6,1 // 2240 (Hebrew year: 6000)
- };
-
- private const int MaxMonthPlusOne = 14;
-
- //
- // The lunar calendar has 6 different variations of month lengths
- // within a year.
- //
- private static readonly byte[] s_lunarMonthLen = {
- 0,00,00,00,00,00,00,00,00,00,00,00,00,0,
- 0,30,29,29,29,30,29,30,29,30,29,30,29,0, // 3 common year variations
- 0,30,29,30,29,30,29,30,29,30,29,30,29,0,
- 0,30,30,30,29,30,29,30,29,30,29,30,29,0,
- 0,30,29,29,29,30,30,29,30,29,30,29,30,29, // 3 leap year variations
- 0,30,29,30,29,30,30,29,30,29,30,29,30,29,
- 0,30,30,30,29,30,30,29,30,29,30,29,30,29
- };
-
- internal static readonly DateTime calendarMinValue = new DateTime(1583, 1, 1);
- // Gregorian 2239/9/29 = Hebrew 5999/13/29 (last day in Hebrew year 5999).
- // We can only format/parse Hebrew numbers up to 999, so we limit the max range to Hebrew year 5999.
- internal static readonly DateTime calendarMaxValue = new DateTime((new DateTime(2239, 9, 29, 23, 59, 59, 999)).Ticks + 9999);
-
-
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (calendarMinValue);
- }
- }
-
-
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (calendarMaxValue);
- }
- }
-
- public override CalendarAlgorithmType AlgorithmType
- {
- get
- {
- return CalendarAlgorithmType.LunisolarCalendar;
- }
- }
-
- public HebrewCalendar()
- {
- }
-
- internal override CalendarId ID
- {
- get
- {
- return (CalendarId.HEBREW);
- }
- }
-
-
- /*=================================CheckHebrewYearValue==========================
- **Action: Check if the Hebrew year value is supported in this class.
- **Returns: None.
- **Arguments: y Hebrew year value
- ** ear Hebrew era value
- **Exceptions: ArgumentOutOfRange_Range if the year value is not supported.
- **Note:
- ** We use a table for the Hebrew calendar calculation, so the year supported is limited.
- ============================================================================*/
-
- private static void CheckHebrewYearValue(int y, int era, String varName)
- {
- CheckEraRange(era);
- if (y > MaxHebrewYear || y < MinHebrewYear)
- {
- throw new ArgumentOutOfRangeException(
- varName,
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- MinHebrewYear,
- MaxHebrewYear));
- }
- }
-
- /*=================================CheckHebrewMonthValue==========================
- **Action: Check if the Hebrew month value is valid.
- **Returns: None.
- **Arguments: year Hebrew year value
- ** month Hebrew month value
- **Exceptions: ArgumentOutOfRange_Range if the month value is not valid.
- **Note:
- ** Call CheckHebrewYearValue() before calling this to verify the year value is supported.
- ============================================================================*/
-
- private void CheckHebrewMonthValue(int year, int month, int era)
- {
- int monthsInYear = GetMonthsInYear(year, era);
- if (month < 1 || month > monthsInYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(month),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- monthsInYear));
- }
- }
-
- /*=================================CheckHebrewDayValue==========================
- **Action: Check if the Hebrew day value is valid.
- **Returns: None.
- **Arguments: year Hebrew year value
- ** month Hebrew month value
- ** day Hebrew day value.
- **Exceptions: ArgumentOutOfRange_Range if the day value is not valid.
- **Note:
- ** Call CheckHebrewYearValue()/CheckHebrewMonthValue() before calling this to verify the year/month values are valid.
- ============================================================================*/
-
- private void CheckHebrewDayValue(int year, int month, int day, int era)
- {
- int daysInMonth = GetDaysInMonth(year, month, era);
- if (day < 1 || day > daysInMonth)
- {
- throw new ArgumentOutOfRangeException(
- nameof(day),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- daysInMonth));
- }
- }
-
- internal static void CheckEraRange(int era)
- {
- if (era != CurrentEra && era != HebrewEra)
- {
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
- }
-
- private static void CheckTicksRange(long ticks)
- {
- if (ticks < calendarMinValue.Ticks || ticks > calendarMaxValue.Ticks)
- {
- throw new ArgumentOutOfRangeException(
- "time",
- // Print out the date in Gregorian using InvariantCulture since the DateTime is based on GreograinCalendar.
- String.Format(
- CultureInfo.InvariantCulture,
- SR.ArgumentOutOfRange_CalendarRange,
- calendarMinValue,
- calendarMaxValue));
- }
- }
-
- internal static int GetResult(__DateBuffer result, int part)
- {
- switch (part)
- {
- case DatePartYear:
- return (result.year);
- case DatePartMonth:
- return (result.month);
- case DatePartDay:
- return (result.day);
- }
-
- throw new InvalidOperationException(SR.InvalidOperation_DateTimeParsing);
- }
-
- /*=================================GetLunarMonthDay==========================
- **Action: Using the Hebrew table (HebrewTable) to get the Hebrew month/day value for Gregorian January 1st
- ** in a given Gregorian year.
- ** Greogrian January 1st falls usually in Tevet (4th month). Tevet has always 29 days.
- ** That's why, there no nead to specify the lunar month in the table. There are exceptions, and these
- ** are coded by giving numbers above 29 and below 1.
- ** Actual decoding is takenig place in the switch statement below.
- **Returns:
- ** The Hebrew year type. The value is from 1 to 6.
- ** normal years : 1 = 353 days 2 = 354 days 3 = 355 days.
- ** Leap years : 4 = 383 5 384 6 = 385 days.
- **Arguments:
- ** gregorianYear The year value in Gregorian calendar. The value should be between 1500 and 2239.
- ** lunarDate Object to take the result of the Hebrew year/month/day.
- **Exceptions:
- ============================================================================*/
-
- internal static int GetLunarMonthDay(int gregorianYear, __DateBuffer lunarDate)
- {
- //
- // Get the offset into the LunarMonthLen array and the lunar day
- // for January 1st.
- //
- int index = gregorianYear - FirstGregorianTableYear;
- if (index < 0 || index > TABLESIZE)
- {
- throw new ArgumentOutOfRangeException(nameof(gregorianYear));
- }
-
- index *= 2;
- lunarDate.day = s_hebrewTable[index];
-
- // Get the type of the year. The value is from 1 to 6
- int LunarYearType = s_hebrewTable[index + 1];
-
- //
- // Get the Lunar Month.
- //
- switch (lunarDate.day)
- {
- case (0): // 1/1 is on Shvat 1
- lunarDate.month = 5;
- lunarDate.day = 1;
- break;
- case (30): // 1/1 is on Kislev 30
- lunarDate.month = 3;
- break;
- case (31): // 1/1 is on Shvat 2
- lunarDate.month = 5;
- lunarDate.day = 2;
- break;
- case (32): // 1/1 is on Shvat 3
- lunarDate.month = 5;
- lunarDate.day = 3;
- break;
- case (33): // 1/1 is on Kislev 29
- lunarDate.month = 3;
- lunarDate.day = 29;
- break;
- default: // 1/1 is on Tevet (This is the general case)
- lunarDate.month = 4;
- break;
- }
- return (LunarYearType);
- }
-
- // Returns a given date part of this DateTime. This method is used
- // to compute the year, day-of-year, month, or day part.
-
- internal virtual int GetDatePart(long ticks, int part)
- {
- // The Gregorian year, month, day value for ticks.
- int gregorianYear, gregorianMonth, gregorianDay;
- int hebrewYearType; // lunar year type
- long AbsoluteDate; // absolute date - absolute date 1/1/1600
-
- //
- // Make sure we have a valid Gregorian date that will fit into our
- // Hebrew conversion limits.
- //
- CheckTicksRange(ticks);
-
- DateTime time = new DateTime(ticks);
-
- //
- // Save the Gregorian date values.
- //
- gregorianYear = time.Year;
- gregorianMonth = time.Month;
- gregorianDay = time.Day;
-
- __DateBuffer lunarDate = new __DateBuffer(); // lunar month and day for Jan 1
-
- // From the table looking-up value of HebrewTable[index] (stored in lunarDate.day), we get the the
- // lunar month and lunar day where the Gregorian date 1/1 falls.
- lunarDate.year = gregorianYear + HebrewYearOf1AD;
- hebrewYearType = GetLunarMonthDay(gregorianYear, lunarDate);
-
- // This is the buffer used to store the result Hebrew date.
- __DateBuffer result = new __DateBuffer();
-
- //
- // Store the values for the start of the new year - 1/1.
- //
- result.year = lunarDate.year;
- result.month = lunarDate.month;
- result.day = lunarDate.day;
-
- //
- // Get the absolute date from 1/1/1600.
- //
- AbsoluteDate = GregorianCalendar.GetAbsoluteDate(gregorianYear, gregorianMonth, gregorianDay);
-
- //
- // If the requested date was 1/1, then we're done.
- //
- if ((gregorianMonth == 1) && (gregorianDay == 1))
- {
- return (GetResult(result, part));
- }
-
- //
- // Calculate the number of days between 1/1 and the requested date.
- //
- long NumDays; // number of days since 1/1
- NumDays = AbsoluteDate - GregorianCalendar.GetAbsoluteDate(gregorianYear, 1, 1);
-
- //
- // If the requested date is within the current lunar month, then
- // we're done.
- //
- if ((NumDays + (long)lunarDate.day) <= (long)(s_lunarMonthLen[hebrewYearType * MaxMonthPlusOne + lunarDate.month]))
- {
- result.day += (int)NumDays;
- return (GetResult(result, part));
- }
-
- //
- // Adjust for the current partial month.
- //
- result.month++;
- result.day = 1;
-
- //
- // Adjust the Lunar Month and Year (if necessary) based on the number
- // of days between 1/1 and the requested date.
- //
- // Assumes Jan 1 can never translate to the last Lunar month, which
- // is true.
- //
- NumDays -= (long)(s_lunarMonthLen[hebrewYearType * MaxMonthPlusOne + lunarDate.month] - lunarDate.day);
- Debug.Assert(NumDays >= 1, "NumDays >= 1");
-
- // If NumDays is 1, then we are done. Otherwise, find the correct Hebrew month
- // and day.
- if (NumDays > 1)
- {
- //
- // See if we're on the correct Lunar month.
- //
- while (NumDays > (long)(s_lunarMonthLen[hebrewYearType * MaxMonthPlusOne + result.month]))
- {
- //
- // Adjust the number of days and move to the next month.
- //
- NumDays -= (long)(s_lunarMonthLen[hebrewYearType * MaxMonthPlusOne + result.month++]);
-
- //
- // See if we need to adjust the Year.
- // Must handle both 12 and 13 month years.
- //
- if ((result.month > 13) || (s_lunarMonthLen[hebrewYearType * MaxMonthPlusOne + result.month] == 0))
- {
- //
- // Adjust the Year.
- //
- result.year++;
- hebrewYearType = s_hebrewTable[(gregorianYear + 1 - FirstGregorianTableYear) * 2 + 1];
-
- //
- // Adjust the Month.
- //
- result.month = 1;
- }
- }
- //
- // Found the right Lunar month.
- //
- result.day += (int)(NumDays - 1);
- }
- return (GetResult(result, part));
- }
-
- // Returns the DateTime resulting from adding the given number of
- // months to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year and month parts of the specified DateTime by
- // value months, and, if required, adjusting the day part of the
- // resulting date downwards to the last day of the resulting month in the
- // resulting year. The time-of-day part of the result is the same as the
- // time-of-day part of the specified DateTime.
- //
- // In more precise terms, considering the specified DateTime to be of the
- // form y / m / d + t, where y is the
- // year, m is the month, d is the day, and t is the
- // time-of-day, the result is y1 / m1 / d1 + t,
- // where y1 and m1 are computed by adding value months
- // to y and m, and d1 is the largest value less than
- // or equal to d that denotes a valid day in month m1 of year
- // y1.
- //
-
- public override DateTime AddMonths(DateTime time, int months)
- {
- try
- {
- int y = GetDatePart(time.Ticks, DatePartYear);
- int m = GetDatePart(time.Ticks, DatePartMonth);
- int d = GetDatePart(time.Ticks, DatePartDay);
-
-
- int monthsInYear;
- int i;
- if (months >= 0)
- {
- i = m + months;
- while (i > (monthsInYear = GetMonthsInYear(y, CurrentEra)))
- {
- y++;
- i -= monthsInYear;
- }
- }
- else
- {
- if ((i = m + months) <= 0)
- {
- months = -months;
- months -= m;
- y--;
-
- while (months > (monthsInYear = GetMonthsInYear(y, CurrentEra)))
- {
- y--;
- months -= monthsInYear;
- }
- monthsInYear = GetMonthsInYear(y, CurrentEra);
- i = monthsInYear - months;
- }
- }
-
- int days = GetDaysInMonth(y, i);
- if (d > days)
- {
- d = days;
- }
- return (new DateTime(ToDateTime(y, i, d, 0, 0, 0, 0).Ticks + (time.Ticks % TicksPerDay)));
- }
- // We expect ArgumentException and ArgumentOutOfRangeException (which is subclass of ArgumentException)
- // If exception is thrown in the calls above, we are out of the supported range of this calendar.
- catch (ArgumentException)
- {
- throw new ArgumentOutOfRangeException(
- nameof(months),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_AddValue));
- }
- }
-
- // Returns the DateTime resulting from adding the given number of
- // years to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year part of the specified DateTime by value
- // years. If the month and day of the specified DateTime is 2/29, and if the
- // resulting year is not a leap year, the month and day of the resulting
- // DateTime becomes 2/28. Otherwise, the month, day, and time-of-day
- // parts of the result are the same as those of the specified DateTime.
- //
-
- public override DateTime AddYears(DateTime time, int years)
- {
- int y = GetDatePart(time.Ticks, DatePartYear);
- int m = GetDatePart(time.Ticks, DatePartMonth);
- int d = GetDatePart(time.Ticks, DatePartDay);
-
- y += years;
- CheckHebrewYearValue(y, Calendar.CurrentEra, nameof(years));
-
- int months = GetMonthsInYear(y, CurrentEra);
- if (m > months)
- {
- m = months;
- }
-
- int days = GetDaysInMonth(y, m);
- if (d > days)
- {
- d = days;
- }
-
- long ticks = ToDateTime(y, m, d, 0, 0, 0, 0).Ticks + (time.Ticks % TicksPerDay);
- Calendar.CheckAddResult(ticks, MinSupportedDateTime, MaxSupportedDateTime);
- return (new DateTime(ticks));
- }
-
- // Returns the day-of-month part of the specified DateTime. The returned
- // value is an integer between 1 and 31.
- //
-
- public override int GetDayOfMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDay));
- }
-
- // Returns the day-of-week part of the specified DateTime. The returned value
- // is an integer between 0 and 6, where 0 indicates Sunday, 1 indicates
- // Monday, 2 indicates Tuesday, 3 indicates Wednesday, 4 indicates
- // Thursday, 5 indicates Friday, and 6 indicates Saturday.
- //
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- // If we calculate back, the Hebrew day of week for Gregorian 0001/1/1 is Monday (1).
- // Therfore, the fomula is:
- return ((DayOfWeek)((int)(time.Ticks / TicksPerDay + 1) % 7));
- }
-
- internal static int GetHebrewYearType(int year, int era)
- {
- CheckHebrewYearValue(year, era, nameof(year));
- // The HebrewTable is indexed by Gregorian year and starts from FirstGregorianYear.
- // So we need to convert year (Hebrew year value) to Gregorian Year below.
- return (s_hebrewTable[(year - HebrewYearOf1AD - FirstGregorianTableYear) * 2 + 1]);
- }
-
- // Returns the day-of-year part of the specified DateTime. The returned value
- // is an integer between 1 and 366.
- //
-
- public override int GetDayOfYear(DateTime time)
- {
- // Get Hebrew year value of the specified time.
- int year = GetYear(time);
- DateTime beginOfYearDate;
- if (year == 5343)
- {
- // Gregorian 1583/01/01 corresponds to Hebrew 5343/04/07 (MinSupportedDateTime)
- // To figure out the Gregorian date associated with Hebrew 5343/01/01, we need to
- // count the days from 5343/01/01 to 5343/04/07 and subtract that from Gregorian
- // 1583/01/01.
- // 1. Tishri (30 days)
- // 2. Heshvan (30 days since 5343 has 355 days)
- // 3. Kislev (30 days since 5343 has 355 days)
- // 96 days to get from 5343/01/01 to 5343/04/07
- // Gregorian 1583/01/01 - 96 days = 1582/9/27
-
- // the beginning of Hebrew year 5343 corresponds to Gregorian September 27, 1582.
- beginOfYearDate = new DateTime(1582, 9, 27);
- }
- else
- {
- // following line will fail when year is 5343 (first supported year)
- beginOfYearDate = ToDateTime(year, 1, 1, 0, 0, 0, 0, CurrentEra);
- }
- return ((int)((time.Ticks - beginOfYearDate.Ticks) / TicksPerDay) + 1);
- }
-
- // Returns the number of days in the month given by the year and
- // month arguments.
- //
-
- public override int GetDaysInMonth(int year, int month, int era)
- {
- CheckEraRange(era);
- int hebrewYearType = GetHebrewYearType(year, era);
- CheckHebrewMonthValue(year, month, era);
-
- Debug.Assert(hebrewYearType >= 1 && hebrewYearType <= 6,
- "hebrewYearType should be from 1 to 6, but now hebrewYearType = " + hebrewYearType + " for hebrew year " + year);
- int monthDays = s_lunarMonthLen[hebrewYearType * MaxMonthPlusOne + month];
- if (monthDays == 0)
- {
- throw new ArgumentOutOfRangeException(nameof(month), SR.ArgumentOutOfRange_Month);
- }
- return (monthDays);
- }
-
- // Returns the number of days in the year given by the year argument for the current era.
- //
-
- public override int GetDaysInYear(int year, int era)
- {
- CheckEraRange(era);
- // normal years : 1 = 353 days 2 = 354 days 3 = 355 days.
- // Leap years : 4 = 383 5 384 6 = 385 days.
-
- // LunarYearType is from 1 to 6
- int LunarYearType = GetHebrewYearType(year, era);
- if (LunarYearType < 4)
- {
- // common year: LunarYearType = 1, 2, 3
- return (352 + LunarYearType);
- }
- return (382 + (LunarYearType - 3));
- }
-
- // Returns the era for the specified DateTime value.
-
- public override int GetEra(DateTime time)
- {
- return (HebrewEra);
- }
-
-
- public override int[] Eras
- {
- get
- {
- return (new int[] { HebrewEra });
- }
- }
-
- // Returns the month part of the specified DateTime. The returned value is an
- // integer between 1 and 12.
- //
-
- public override int GetMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartMonth));
- }
-
- // Returns the number of months in the specified year and era.
-
- public override int GetMonthsInYear(int year, int era)
- {
- return (IsLeapYear(year, era) ? 13 : 12);
- }
-
- // Returns the year part of the specified DateTime. The returned value is an
- // integer between 1 and 9999.
- //
-
- public override int GetYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartYear));
- }
-
- // Checks whether a given day in the specified era is a leap day. This method returns true if
- // the date is a leap day, or false if not.
- //
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- if (IsLeapMonth(year, month, era))
- {
- // Every day in a leap month is a leap day.
- CheckHebrewDayValue(year, month, day, era);
- return (true);
- }
- else if (IsLeapYear(year, Calendar.CurrentEra))
- {
- // There is an additional day in the 6th month in the leap year (the extra day is the 30th day in the 6th month),
- // so we should return true for 6/30 if that's in a leap year.
- if (month == 6 && day == 30)
- {
- return (true);
- }
- }
- CheckHebrewDayValue(year, month, day, era);
- return (false);
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
-
-
- public override int GetLeapMonth(int year, int era)
- {
- // Year/era values are checked in IsLeapYear().
- if (IsLeapYear(year, era))
- {
- // The 7th month in a leap year is a leap month.
- return (7);
- }
- return (0);
- }
-
- // Checks whether a given month in the specified era is a leap month. This method returns true if
- // month is a leap month, or false if not.
- //
-
- public override bool IsLeapMonth(int year, int month, int era)
- {
- // Year/era values are checked in IsLeapYear().
- bool isLeapYear = IsLeapYear(year, era);
- CheckHebrewMonthValue(year, month, era);
- // The 7th month in a leap year is a leap month.
- if (isLeapYear)
- {
- if (month == 7)
- {
- return (true);
- }
- }
- return (false);
- }
-
- // Checks whether a given year in the specified era is a leap year. This method returns true if
- // year is a leap year, or false if not.
- //
-
- public override bool IsLeapYear(int year, int era)
- {
- CheckHebrewYearValue(year, era, nameof(year));
- return (((7 * (long)year + 1) % 19) < 7);
- }
-
- // (month1, day1) - (month2, day2)
- private static int GetDayDifference(int lunarYearType, int month1, int day1, int month2, int day2)
- {
- if (month1 == month2)
- {
- return (day1 - day2);
- }
-
- // Make sure that (month1, day1) < (month2, day2)
- bool swap = (month1 > month2);
- if (swap)
- {
- // (month1, day1) < (month2, day2). Swap the values.
- // The result will be a negative number.
- int tempMonth, tempDay;
- tempMonth = month1; tempDay = day1;
- month1 = month2; day1 = day2;
- month2 = tempMonth; day2 = tempDay;
- }
-
- // Get the number of days from (month1,day1) to (month1, end of month1)
- int days = s_lunarMonthLen[lunarYearType * MaxMonthPlusOne + month1] - day1;
-
- // Move to next month.
- month1++;
-
- // Add up the days.
- while (month1 < month2)
- {
- days += s_lunarMonthLen[lunarYearType * MaxMonthPlusOne + month1++];
- }
- days += day2;
-
- return (swap ? days : -days);
- }
-
- /*=================================HebrewToGregorian==========================
- **Action: Convert Hebrew date to Gregorian date.
- **Returns:
- **Arguments:
- **Exceptions:
- ** The algorithm is like this:
- ** The hebrew year has an offset to the Gregorian year, so we can guess the Gregorian year for
- ** the specified Hebrew year. That is, GreogrianYear = HebrewYear - FirstHebrewYearOf1AD.
- **
- ** From the Gregorian year and HebrewTable, we can get the Hebrew month/day value
- ** of the Gregorian date January 1st. Let's call this month/day value [hebrewDateForJan1]
- **
- ** If the requested Hebrew month/day is less than [hebrewDateForJan1], we know the result
- ** Gregorian date falls in previous year. So we decrease the Gregorian year value, and
- ** retrieve the Hebrew month/day value of the Gregorian date january 1st again.
- **
- ** Now, we get the answer of the Gregorian year.
- **
- ** The next step is to get the number of days between the requested Hebrew month/day
- ** and [hebrewDateForJan1]. When we get that, we can create the DateTime by adding/subtracting
- ** the ticks value of the number of days.
- **
- ============================================================================*/
-
-
- private static DateTime HebrewToGregorian(int hebrewYear, int hebrewMonth, int hebrewDay, int hour, int minute, int second, int millisecond)
- {
- // Get the rough Gregorian year for the specified hebrewYear.
- //
- int gregorianYear = hebrewYear - HebrewYearOf1AD;
-
- __DateBuffer hebrewDateOfJan1 = new __DateBuffer(); // year value is unused.
- int lunarYearType = GetLunarMonthDay(gregorianYear, hebrewDateOfJan1);
-
- if ((hebrewMonth == hebrewDateOfJan1.month) && (hebrewDay == hebrewDateOfJan1.day))
- {
- return (new DateTime(gregorianYear, 1, 1, hour, minute, second, millisecond));
- }
-
- int days = GetDayDifference(lunarYearType, hebrewMonth, hebrewDay, hebrewDateOfJan1.month, hebrewDateOfJan1.day);
-
- DateTime gregorianNewYear = new DateTime(gregorianYear, 1, 1);
- return (new DateTime(gregorianNewYear.Ticks + days * TicksPerDay
- + TimeToTicks(hour, minute, second, millisecond)));
- }
-
- // Returns the date and time converted to a DateTime value. Throws an exception if the n-tuple is invalid.
- //
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- CheckHebrewYearValue(year, era, nameof(year));
- CheckHebrewMonthValue(year, month, era);
- CheckHebrewDayValue(year, month, day, era);
- DateTime dt = HebrewToGregorian(year, month, day, hour, minute, second, millisecond);
- CheckTicksRange(dt.Ticks);
- return (dt);
- }
-
- private const int DEFAULT_TWO_DIGIT_YEAR_MAX = 5790;
-
-
- public override int TwoDigitYearMax
- {
- get
- {
- if (twoDigitYearMax == -1)
- {
- twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
- }
- return (twoDigitYearMax);
- }
-
- set
- {
- VerifyWritable();
- if (value == 99)
- {
- // Do nothing here. Year 99 is allowed so that TwoDitYearMax is disabled.
- }
- else
- {
- CheckHebrewYearValue(value, HebrewEra, nameof(value));
- }
- twoDigitYearMax = value;
- }
- }
-
-
- public override int ToFourDigitYear(int year)
- {
- if (year < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedNonNegNum);
- }
- Contract.EndContractBlock();
-
- if (year < 100)
- {
- return (base.ToFourDigitYear(year));
- }
-
- if (year > MaxHebrewYear || year < MinHebrewYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- MinHebrewYear,
- MaxHebrewYear));
- }
- return (year);
- }
-
- internal class __DateBuffer
- {
- internal int year;
- internal int month;
- internal int day;
- }
- }
-}
-
diff --git a/src/mscorlib/corefx/System/Globalization/HebrewNumber.cs b/src/mscorlib/corefx/System/Globalization/HebrewNumber.cs
deleted file mode 100644
index 01e251d9e8..0000000000
--- a/src/mscorlib/corefx/System/Globalization/HebrewNumber.cs
+++ /dev/null
@@ -1,458 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Text;
-using System.Diagnostics;
-
-namespace System.Globalization
-{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Used in HebrewNumber.ParseByChar to maintain the context information (
- // the state in the state machine and current Hebrew number values, etc.)
- // when parsing Hebrew number character by character.
- //
- ////////////////////////////////////////////////////////////////////////////
-
- internal struct HebrewNumberParsingContext
- {
- // The current state of the state machine for parsing Hebrew numbers.
- internal HebrewNumber.HS state;
- // The current value of the Hebrew number.
- // The final value is determined when state is FoundEndOfHebrewNumber.
- internal int result;
-
- public HebrewNumberParsingContext(int result)
- {
- // Set the start state of the state machine for parsing Hebrew numbers.
- state = HebrewNumber.HS.Start;
- this.result = result;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Please see ParseByChar() for comments about different states defined here.
- //
- ////////////////////////////////////////////////////////////////////////////
-
- internal enum HebrewNumberParsingState
- {
- InvalidHebrewNumber,
- NotHebrewDigit,
- FoundEndOfHebrewNumber,
- ContinueParsing,
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // class HebrewNumber
- //
- // Provides static methods for formatting integer values into
- // Hebrew text and parsing Hebrew number text.
- //
- // Limitations:
- // Parse can only handles value 1 ~ 999.
- // ToString() can only handles 1 ~ 999. If value is greater than 5000,
- // 5000 will be subtracted from the value.
- //
- ////////////////////////////////////////////////////////////////////////////
-
- internal class HebrewNumber
- {
- // This class contains only static methods. Add a private ctor so that
- // compiler won't generate a default one for us.
- private HebrewNumber()
- {
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // ToString
- //
- // Converts the given number to Hebrew letters according to the numeric
- // value of each Hebrew letter. Basically, this converts the lunar year
- // and the lunar month to letters.
- //
- // The character of a year is described by three letters of the Hebrew
- // alphabet, the first and third giving, respectively, the days of the
- // weeks on which the New Year occurs and Passover begins, while the
- // second is the initial of the Hebrew word for defective, normal, or
- // complete.
- //
- // Defective Year : Both Heshvan and Kislev are defective (353 or 383 days)
- // Normal Year : Heshvan is defective, Kislev is full (354 or 384 days)
- // Complete Year : Both Heshvan and Kislev are full (355 or 385 days)
- //
- ////////////////////////////////////////////////////////////////////////////
-
- internal static String ToString(int Number)
- {
- char cTens = '\x0';
- char cUnits; // tens and units chars
- int Hundreds, Tens; // hundreds and tens values
- StringBuilder szHebrew = new StringBuilder();
-
-
- //
- // Adjust the number if greater than 5000.
- //
- if (Number > 5000)
- {
- Number -= 5000;
- }
-
- Debug.Assert(Number > 0 && Number <= 999, "Number is out of range."); ;
-
- //
- // Get the Hundreds.
- //
- Hundreds = Number / 100;
-
- if (Hundreds > 0)
- {
- Number -= Hundreds * 100;
- // \x05e7 = 100
- // \x05e8 = 200
- // \x05e9 = 300
- // \x05ea = 400
- // If the number is greater than 400, use the multiples of 400.
- for (int i = 0; i < (Hundreds / 4); i++)
- {
- szHebrew.Append('\x05ea');
- }
-
- int remains = Hundreds % 4;
- if (remains > 0)
- {
- szHebrew.Append((char)((int)'\x05e6' + remains));
- }
- }
-
- //
- // Get the Tens.
- //
- Tens = Number / 10;
- Number %= 10;
-
- switch (Tens)
- {
- case (0):
- cTens = '\x0';
- break;
- case (1):
- cTens = '\x05d9'; // Hebrew Letter Yod
- break;
- case (2):
- cTens = '\x05db'; // Hebrew Letter Kaf
- break;
- case (3):
- cTens = '\x05dc'; // Hebrew Letter Lamed
- break;
- case (4):
- cTens = '\x05de'; // Hebrew Letter Mem
- break;
- case (5):
- cTens = '\x05e0'; // Hebrew Letter Nun
- break;
- case (6):
- cTens = '\x05e1'; // Hebrew Letter Samekh
- break;
- case (7):
- cTens = '\x05e2'; // Hebrew Letter Ayin
- break;
- case (8):
- cTens = '\x05e4'; // Hebrew Letter Pe
- break;
- case (9):
- cTens = '\x05e6'; // Hebrew Letter Tsadi
- break;
- }
-
- //
- // Get the Units.
- //
- cUnits = (char)(Number > 0 ? ((int)'\x05d0' + Number - 1) : 0);
-
- if ((cUnits == '\x05d4') && // Hebrew Letter He (5)
- (cTens == '\x05d9'))
- { // Hebrew Letter Yod (10)
- cUnits = '\x05d5'; // Hebrew Letter Vav (6)
- cTens = '\x05d8'; // Hebrew Letter Tet (9)
- }
-
- if ((cUnits == '\x05d5') && // Hebrew Letter Vav (6)
- (cTens == '\x05d9'))
- { // Hebrew Letter Yod (10)
- cUnits = '\x05d6'; // Hebrew Letter Zayin (7)
- cTens = '\x05d8'; // Hebrew Letter Tet (9)
- }
-
- //
- // Copy the appropriate info to the given buffer.
- //
-
- if (cTens != '\x0')
- {
- szHebrew.Append(cTens);
- }
-
- if (cUnits != '\x0')
- {
- szHebrew.Append(cUnits);
- }
-
- if (szHebrew.Length > 1)
- {
- szHebrew.Insert(szHebrew.Length - 1, '"');
- }
- else
- {
- szHebrew.Append('\'');
- }
-
- //
- // Return success.
- //
- return (szHebrew.ToString());
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Token used to tokenize a Hebrew word into tokens so that we can use in the
- // state machine.
- //
- ////////////////////////////////////////////////////////////////////////////
-
- private enum HebrewToken : short
- {
- Invalid = -1,
- Digit400 = 0,
- Digit200_300 = 1,
- Digit100 = 2,
- Digit10 = 3, // 10 ~ 90
- Digit1 = 4, // 1, 2, 3, 4, 5, 8,
- Digit6_7 = 5,
- Digit7 = 6,
- Digit9 = 7,
- SingleQuote = 8,
- DoubleQuote = 9,
- };
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // This class is used to map a token into its Hebrew digit value.
- //
- ////////////////////////////////////////////////////////////////////////////
-
- private struct HebrewValue
- {
- internal HebrewToken token;
- internal short value;
- internal HebrewValue(HebrewToken token, short value)
- {
- this.token = token;
- this.value = value;
- }
- }
-
- //
- // Map a Hebrew character from U+05D0 ~ U+05EA to its digit value.
- // The value is -1 if the Hebrew character does not have a associated value.
- //
- private static readonly HebrewValue[] s_hebrewValues = {
- new HebrewValue(HebrewToken.Digit1, 1) , // '\x05d0
- new HebrewValue(HebrewToken.Digit1, 2) , // '\x05d1
- new HebrewValue(HebrewToken.Digit1, 3) , // '\x05d2
- new HebrewValue(HebrewToken.Digit1, 4) , // '\x05d3
- new HebrewValue(HebrewToken.Digit1, 5) , // '\x05d4
- new HebrewValue(HebrewToken.Digit6_7,6) , // '\x05d5
- new HebrewValue(HebrewToken.Digit6_7,7) , // '\x05d6
- new HebrewValue(HebrewToken.Digit1, 8) , // '\x05d7
- new HebrewValue(HebrewToken.Digit9, 9) , // '\x05d8
- new HebrewValue(HebrewToken.Digit10, 10) , // '\x05d9; // Hebrew Letter Yod
- new HebrewValue(HebrewToken.Invalid, -1) , // '\x05da;
- new HebrewValue(HebrewToken.Digit10, 20) , // '\x05db; // Hebrew Letter Kaf
- new HebrewValue(HebrewToken.Digit10, 30) , // '\x05dc; // Hebrew Letter Lamed
- new HebrewValue(HebrewToken.Invalid, -1) , // '\x05dd;
- new HebrewValue(HebrewToken.Digit10, 40) , // '\x05de; // Hebrew Letter Mem
- new HebrewValue(HebrewToken.Invalid, -1) , // '\x05df;
- new HebrewValue(HebrewToken.Digit10, 50) , // '\x05e0; // Hebrew Letter Nun
- new HebrewValue(HebrewToken.Digit10, 60) , // '\x05e1; // Hebrew Letter Samekh
- new HebrewValue(HebrewToken.Digit10, 70) , // '\x05e2; // Hebrew Letter Ayin
- new HebrewValue(HebrewToken.Invalid, -1) , // '\x05e3;
- new HebrewValue(HebrewToken.Digit10, 80) , // '\x05e4; // Hebrew Letter Pe
- new HebrewValue(HebrewToken.Invalid, -1) , // '\x05e5;
- new HebrewValue(HebrewToken.Digit10, 90) , // '\x05e6; // Hebrew Letter Tsadi
- new HebrewValue(HebrewToken.Digit100, 100) , // '\x05e7;
- new HebrewValue(HebrewToken.Digit200_300, 200) , // '\x05e8;
- new HebrewValue(HebrewToken.Digit200_300, 300) , // '\x05e9;
- new HebrewValue(HebrewToken.Digit400, 400) , // '\x05ea;
- };
-
- private const int minHebrewNumberCh = 0x05d0;
- private static char s_maxHebrewNumberCh = (char)(minHebrewNumberCh + s_hebrewValues.Length - 1);
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Hebrew number parsing State
- // The current state and the next token will lead to the next state in the state machine.
- // DQ = Double Quote
- //
- ////////////////////////////////////////////////////////////////////////////
-
- internal enum HS : sbyte
- {
- _err = -1, // an error state
- Start = 0,
- S400 = 1, // a Hebrew digit 400
- S400_400 = 2, // Two Hebrew digit 400
- S400_X00 = 3, // Two Hebrew digit 400 and followed by 100
- S400_X0 = 4, // Hebrew digit 400 and followed by 10 ~ 90
- X00_DQ = 5, // A hundred number and followed by a double quote.
- S400_X00_X0 = 6,
- X0_DQ = 7, // A two-digit number and followed by a double quote.
- X = 8, // A single digit Hebrew number.
- X0 = 9, // A two-digit Hebrew number
- X00 = 10, // A three-digit Hebrew number
- S400_DQ = 11, // A Hebrew digit 400 and followed by a double quote.
- S400_400_DQ = 12,
- S400_400_100 = 13,
- S9 = 14, // Hebrew digit 9
- X00_S9 = 15, // A hundered number and followed by a digit 9
- S9_DQ = 16, // Hebrew digit 9 and followed by a double quote
- END = 100, // A terminial state is reached.
- }
-
- //
- // The state machine for Hebrew number pasing.
- //
- private static readonly HS[] s_numberPasingState =
- {
- // 400 300/200 100 90~10 8~1 6, 7, 9, ' "
- /* 0 */
- HS.S400, HS.X00, HS.X00, HS.X0, HS.X, HS.X, HS.X, HS.S9, HS._err, HS._err,
- /* 1: S400 */
- HS.S400_400, HS.S400_X00, HS.S400_X00, HS.S400_X0, HS._err, HS._err, HS._err, HS.X00_S9 ,HS.END, HS.S400_DQ,
- /* 2: S400_400 */
- HS._err, HS._err, HS.S400_400_100,HS.S400_X0, HS._err, HS._err, HS._err, HS.X00_S9 ,HS._err, HS.S400_400_DQ,
- /* 3: S400_X00 */
- HS._err, HS._err, HS._err, HS.S400_X00_X0, HS._err, HS._err, HS._err, HS.X00_S9 ,HS._err, HS.X00_DQ,
- /* 4: S400_X0 */
- HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS.X0_DQ,
- /* 5: X00_DQ */
- HS._err, HS._err, HS._err, HS.END, HS.END, HS.END, HS.END, HS.END, HS._err, HS._err,
- /* 6: S400_X00_X0 */
- HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS.X0_DQ,
- /* 7: X0_DQ */
- HS._err, HS._err, HS._err, HS._err, HS.END, HS.END, HS.END, HS.END, HS._err, HS._err,
- /* 8: X */
- HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS.END, HS._err,
- /* 9: X0 */
- HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS.END, HS.X0_DQ,
- /* 10: X00 */
- HS._err, HS._err, HS._err, HS.S400_X0, HS._err, HS._err, HS._err, HS.X00_S9, HS.END, HS.X00_DQ,
- /* 11: S400_DQ */
- HS.END, HS.END, HS.END, HS.END, HS.END, HS.END, HS.END, HS.END, HS._err, HS._err,
- /* 12: S400_400_DQ*/
- HS._err, HS._err, HS.END, HS.END, HS.END, HS.END, HS.END, HS.END, HS._err, HS._err,
- /* 13: S400_400_100*/
- HS._err, HS._err, HS._err, HS.S400_X00_X0, HS._err, HS._err, HS._err, HS.X00_S9, HS._err, HS.X00_DQ,
- /* 14: S9 */
- HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS.END, HS.S9_DQ,
- /* 15: X00_S9 */
- HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS._err, HS.S9_DQ,
- /* 16: S9_DQ */
- HS._err, HS._err, HS._err, HS._err, HS._err, HS.END, HS.END, HS._err, HS._err, HS._err
- };
-
- // Count of valid HebrewToken, column count in the NumberPasingState array
- private const int HebrewTokenCount = 10;
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Actions:
- // Parse the Hebrew number by passing one character at a time.
- // The state between characters are maintained at HebrewNumberPasingContext.
- // Returns:
- // Return a enum of HebrewNumberParsingState.
- // NotHebrewDigit: The specified ch is not a valid Hebrew digit.
- // InvalidHebrewNumber: After parsing the specified ch, it will lead into
- // an invalid Hebrew number text.
- // FoundEndOfHebrewNumber: A terminal state is reached. This means that
- // we find a valid Hebrew number text after the specified ch is parsed.
- // ContinueParsing: The specified ch is a valid Hebrew digit, and
- // it will lead into a valid state in the state machine, we should
- // continue to parse incoming characters.
- //
- ////////////////////////////////////////////////////////////////////////
-
- internal static HebrewNumberParsingState ParseByChar(char ch, ref HebrewNumberParsingContext context)
- {
- Debug.Assert(s_numberPasingState.Length == HebrewTokenCount * ((int)HS.S9_DQ + 1));
-
- HebrewToken token;
- if (ch == '\'')
- {
- token = HebrewToken.SingleQuote;
- }
- else if (ch == '\"')
- {
- token = HebrewToken.DoubleQuote;
- }
- else
- {
- int index = (int)ch - minHebrewNumberCh;
- if (index >= 0 && index < s_hebrewValues.Length)
- {
- token = s_hebrewValues[index].token;
- if (token == HebrewToken.Invalid)
- {
- return (HebrewNumberParsingState.NotHebrewDigit);
- }
- context.result += s_hebrewValues[index].value;
- }
- else
- {
- // Not in valid Hebrew digit range.
- return (HebrewNumberParsingState.NotHebrewDigit);
- }
- }
- context.state = s_numberPasingState[(int)context.state * (int)HebrewTokenCount + (int)token];
- if (context.state == HS._err)
- {
- // Invalid Hebrew state. This indicates an incorrect Hebrew number.
- return (HebrewNumberParsingState.InvalidHebrewNumber);
- }
- if (context.state == HS.END)
- {
- // Reach a terminal state.
- return (HebrewNumberParsingState.FoundEndOfHebrewNumber);
- }
- // We should continue to parse.
- return (HebrewNumberParsingState.ContinueParsing);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Actions:
- // Check if the ch is a valid Hebrew number digit.
- // This function will return true if the specified char is a legal Hebrew
- // digit character, single quote, or double quote.
- // Returns:
- // true if the specified character is a valid Hebrew number character.
- //
- ////////////////////////////////////////////////////////////////////////
-
- internal static bool IsDigit(char ch)
- {
- if (ch >= minHebrewNumberCh && ch <= s_maxHebrewNumberCh)
- {
- return (s_hebrewValues[ch - minHebrewNumberCh].value >= 0);
- }
- return (ch == '\'' || ch == '\"');
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/HijriCalendar.Unix.cs b/src/mscorlib/corefx/System/Globalization/HijriCalendar.Unix.cs
deleted file mode 100644
index a6e8f73d3e..0000000000
--- a/src/mscorlib/corefx/System/Globalization/HijriCalendar.Unix.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Globalization
-{
- public partial class HijriCalendar : Calendar
- {
- private static int GetHijriDateAdjustment()
- {
- // this setting is not supported on Unix, so always return 0
- return 0;
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/HijriCalendar.Win32.cs b/src/mscorlib/corefx/System/Globalization/HijriCalendar.Win32.cs
deleted file mode 100644
index 869b809bff..0000000000
--- a/src/mscorlib/corefx/System/Globalization/HijriCalendar.Win32.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32;
-
-namespace System.Globalization
-{
- public partial class HijriCalendar : Calendar
- {
- private int GetHijriDateAdjustment()
- {
- if (_hijriAdvance == Int32.MinValue)
- {
- // Never been set before. Use the system value from registry.
- _hijriAdvance = GetAdvanceHijriDate();
- }
- return (_hijriAdvance);
- }
-
- private const String InternationalRegKey = "Control Panel\\International";
- private const String HijriAdvanceRegKeyEntry = "AddHijriDate";
-
- /*=================================GetAdvanceHijriDate==========================
- **Action: Gets the AddHijriDate value from the registry.
- **Returns:
- **Arguments: None.
- **Exceptions:
- **Note:
- ** The HijriCalendar has a user-overidable calculation. That is, use can set a value from the control
- ** panel, so that the calculation of the Hijri Calendar can move ahead or backwards from -2 to +2 days.
- **
- ** The valid string values in the registry are:
- ** "AddHijriDate-2" => Add -2 days to the current calculated Hijri date.
- ** "AddHijriDate" => Add -1 day to the current calculated Hijri date.
- ** "" => Add 0 day to the current calculated Hijri date.
- ** "AddHijriDate+1" => Add +1 days to the current calculated Hijri date.
- ** "AddHijriDate+2" => Add +2 days to the current calculated Hijri date.
- ============================================================================*/
- private static int GetAdvanceHijriDate()
- {
- int hijriAdvance = 0;
- Microsoft.Win32.RegistryKey key = null;
-
- try
- {
- // Open in read-only mode.
- // Use InternalOpenSubKey so that we avoid the security check.
- key = RegistryKey.GetBaseKey(RegistryKey.HKEY_CURRENT_USER).OpenSubKey(InternationalRegKey, false);
- }
- //If this fails for any reason, we'll just return 0.
- catch (ObjectDisposedException) { return 0; }
- catch (ArgumentException) { return 0; }
-
- if (key != null)
- {
- try
- {
- Object value = key.InternalGetValue(HijriAdvanceRegKeyEntry, null, false, false);
- if (value == null)
- {
- return (0);
- }
- String str = value.ToString();
- if (String.Compare(str, 0, HijriAdvanceRegKeyEntry, 0, HijriAdvanceRegKeyEntry.Length, StringComparison.OrdinalIgnoreCase) == 0)
- {
- if (str.Length == HijriAdvanceRegKeyEntry.Length)
- hijriAdvance = -1;
- else
- {
- str = str.Substring(HijriAdvanceRegKeyEntry.Length);
- try
- {
- int advance = Int32.Parse(str.ToString(), CultureInfo.InvariantCulture);
- if ((advance >= MinAdvancedHijri) && (advance <= MaxAdvancedHijri))
- {
- hijriAdvance = advance;
- }
- }
- // If we got garbage from registry just ignore it.
- // hijriAdvance = 0 because of declaraction assignment up above.
- catch (ArgumentException) { }
- catch (FormatException) { }
- catch (OverflowException) { }
- }
- }
- }
- finally
- {
- key.Close();
- }
- }
- return (hijriAdvance);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/HijriCalendar.WinRT.cs b/src/mscorlib/corefx/System/Globalization/HijriCalendar.WinRT.cs
deleted file mode 100644
index fb91c27ef6..0000000000
--- a/src/mscorlib/corefx/System/Globalization/HijriCalendar.WinRT.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Internal.Runtime.Augments;
-
-namespace System.Globalization
-{
- public partial class HijriCalendar : Calendar
- {
- private static int GetHijriDateAdjustment()
- {
- return WinRTInterop.Callbacks.GetHijriDateAdjustment();
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/HijriCalendar.cs b/src/mscorlib/corefx/System/Globalization/HijriCalendar.cs
deleted file mode 100644
index 0c72d9eaf5..0000000000
--- a/src/mscorlib/corefx/System/Globalization/HijriCalendar.cs
+++ /dev/null
@@ -1,679 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.Versioning;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Rules for the Hijri calendar:
- // - The Hijri calendar is a strictly Lunar calendar.
- // - Days begin at sunset.
- // - Islamic Year 1 (Muharram 1, 1 A.H.) is equivalent to absolute date
- // 227015 (Friday, July 16, 622 C.E. - Julian).
- // - Leap Years occur in the 2, 5, 7, 10, 13, 16, 18, 21, 24, 26, & 29th
- // years of a 30-year cycle. Year = leap iff ((11y+14) mod 30 < 11).
- // - There are 12 months which contain alternately 30 and 29 days.
- // - The 12th month, Dhu al-Hijjah, contains 30 days instead of 29 days
- // in a leap year.
- // - Common years have 354 days. Leap years have 355 days.
- // - There are 10,631 days in a 30-year cycle.
- // - The Islamic months are:
- // 1. Muharram (30 days) 7. Rajab (30 days)
- // 2. Safar (29 days) 8. Sha'ban (29 days)
- // 3. Rabi I (30 days) 9. Ramadan (30 days)
- // 4. Rabi II (29 days) 10. Shawwal (29 days)
- // 5. Jumada I (30 days) 11. Dhu al-Qada (30 days)
- // 6. Jumada II (29 days) 12. Dhu al-Hijjah (29 days) {30}
- //
- // NOTENOTE
- // The calculation of the HijriCalendar is based on the absolute date. And the
- // absolute date means the number of days from January 1st, 1 A.D.
- // Therefore, we do not support the days before the January 1st, 1 A.D.
- //
- ////////////////////////////////////////////////////////////////////////////
- /*
- ** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 0622/07/18 9999/12/31
- ** Hijri 0001/01/01 9666/04/03
- */
-
- [Serializable]
- public partial class HijriCalendar : Calendar
- {
- public static readonly int HijriEra = 1;
-
- internal const int DatePartYear = 0;
- internal const int DatePartDayOfYear = 1;
- internal const int DatePartMonth = 2;
- internal const int DatePartDay = 3;
-
- internal const int MinAdvancedHijri = -2;
- internal const int MaxAdvancedHijri = 2;
-
- internal static readonly int[] HijriMonthDays = { 0, 30, 59, 89, 118, 148, 177, 207, 236, 266, 295, 325, 355 };
-
- private int _hijriAdvance = Int32.MinValue;
-
- // DateTime.MaxValue = Hijri calendar (year:9666, month: 4, day: 3).
- internal const int MaxCalendarYear = 9666;
- internal const int MaxCalendarMonth = 4;
- internal const int MaxCalendarDay = 3;
- // Hijri calendar (year: 1, month: 1, day:1 ) = Gregorian (year: 622, month: 7, day: 18)
- // This is the minimal Gregorian date that we support in the HijriCalendar.
- internal static readonly DateTime calendarMinValue = new DateTime(622, 7, 18);
- internal static readonly DateTime calendarMaxValue = DateTime.MaxValue;
-
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (calendarMinValue);
- }
- }
-
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (calendarMaxValue);
- }
- }
-
- public override CalendarAlgorithmType AlgorithmType
- {
- get
- {
- return CalendarAlgorithmType.LunarCalendar;
- }
- }
-
- public HijriCalendar()
- {
- }
-
- internal override CalendarId ID
- {
- get
- {
- return CalendarId.HIJRI;
- }
- }
-
- protected override int DaysInYearBeforeMinSupportedYear
- {
- get
- {
- // the year before the 1st year of the cycle would have been the 30th year
- // of the previous cycle which is not a leap year. Common years have 354 days.
- return 354;
- }
- }
-
-
-
- /*=================================GetAbsoluteDateHijri==========================
- **Action: Gets the Absolute date for the given Hijri date. The absolute date means
- ** the number of days from January 1st, 1 A.D.
- **Returns:
- **Arguments:
- **Exceptions:
- ============================================================================*/
-
- private long GetAbsoluteDateHijri(int y, int m, int d)
- {
- return (long)(DaysUpToHijriYear(y) + HijriMonthDays[m - 1] + d - 1 - HijriAdjustment);
- }
-
- /*=================================DaysUpToHijriYear==========================
- **Action: Gets the total number of days (absolute date) up to the given Hijri Year.
- ** The absolute date means the number of days from January 1st, 1 A.D.
- **Returns: Gets the total number of days (absolute date) up to the given Hijri Year.
- **Arguments: HijriYear year value in Hijri calendar.
- **Exceptions: None
- **Notes:
- ============================================================================*/
-
- private long DaysUpToHijriYear(int HijriYear)
- {
- long NumDays; // number of absolute days
- int NumYear30; // number of years up to current 30 year cycle
- int NumYearsLeft; // number of years into 30 year cycle
-
- //
- // Compute the number of years up to the current 30 year cycle.
- //
- NumYear30 = ((HijriYear - 1) / 30) * 30;
-
- //
- // Compute the number of years left. This is the number of years
- // into the 30 year cycle for the given year.
- //
- NumYearsLeft = HijriYear - NumYear30 - 1;
-
- //
- // Compute the number of absolute days up to the given year.
- //
- NumDays = ((NumYear30 * 10631L) / 30L) + 227013L;
- while (NumYearsLeft > 0)
- {
- // Common year is 354 days, and leap year is 355 days.
- NumDays += 354 + (IsLeapYear(NumYearsLeft, CurrentEra) ? 1 : 0);
- NumYearsLeft--;
- }
-
- //
- // Return the number of absolute days.
- //
- return (NumDays);
- }
-
- public int HijriAdjustment
- {
- get
- {
- if (_hijriAdvance == Int32.MinValue)
- {
- // Never been set before. Use the system value from registry.
- _hijriAdvance = GetHijriDateAdjustment();
- }
- return (_hijriAdvance);
- }
-
- set
- {
- // NOTE: Check the value of Min/MaxAdavncedHijri with Arabic speakers to see if the assumption is good.
- if (value < MinAdvancedHijri || value > MaxAdvancedHijri)
- {
- throw new ArgumentOutOfRangeException(
- "HijriAdjustment",
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Bounds_Lower_Upper,
- MinAdvancedHijri,
- MaxAdvancedHijri));
- }
- Contract.EndContractBlock();
- VerifyWritable();
-
- _hijriAdvance = value;
- }
- }
-
- internal static void CheckTicksRange(long ticks)
- {
- if (ticks < calendarMinValue.Ticks || ticks > calendarMaxValue.Ticks)
- {
- throw new ArgumentOutOfRangeException(
- "time",
- String.Format(
- CultureInfo.InvariantCulture,
- SR.ArgumentOutOfRange_CalendarRange,
- calendarMinValue,
- calendarMaxValue));
- }
- }
-
- internal static void CheckEraRange(int era)
- {
- if (era != CurrentEra && era != HijriEra)
- {
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
- }
-
- internal static void CheckYearRange(int year, int era)
- {
- CheckEraRange(era);
- if (year < 1 || year > MaxCalendarYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- MaxCalendarYear));
- }
- }
-
- internal static void CheckYearMonthRange(int year, int month, int era)
- {
- CheckYearRange(year, era);
- if (year == MaxCalendarYear)
- {
- if (month > MaxCalendarMonth)
- {
- throw new ArgumentOutOfRangeException(
- nameof(month),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- MaxCalendarMonth));
- }
- }
-
- if (month < 1 || month > 12)
- {
- throw new ArgumentOutOfRangeException(nameof(month), SR.ArgumentOutOfRange_Month);
- }
- }
-
- /*=================================GetDatePart==========================
- **Action: Returns a given date part of this <i>DateTime</i>. This method is used
- ** to compute the year, day-of-year, month, or day part.
- **Returns:
- **Arguments:
- **Exceptions: ArgumentException if part is incorrect.
- **Notes:
- ** First, we get the absolute date (the number of days from January 1st, 1 A.C) for the given ticks.
- ** Use the formula (((AbsoluteDate - 227013) * 30) / 10631) + 1, we can a rough value for the Hijri year.
- ** In order to get the exact Hijri year, we compare the exact absolute date for HijriYear and (HijriYear + 1).
- ** From here, we can get the correct Hijri year.
- ============================================================================*/
-
- internal virtual int GetDatePart(long ticks, int part)
- {
- int HijriYear; // Hijri year
- int HijriMonth; // Hijri month
- int HijriDay; // Hijri day
- long NumDays; // The calculation buffer in number of days.
-
- CheckTicksRange(ticks);
-
- //
- // Get the absolute date. The absolute date is the number of days from January 1st, 1 A.D.
- // 1/1/0001 is absolute date 1.
- //
- NumDays = ticks / GregorianCalendar.TicksPerDay + 1;
-
- //
- // See how much we need to backup or advance
- //
- NumDays += HijriAdjustment;
-
- //
- // Calculate the appromixate Hijri Year from this magic formula.
- //
- HijriYear = (int)(((NumDays - 227013) * 30) / 10631) + 1;
-
- long daysToHijriYear = DaysUpToHijriYear(HijriYear); // The absoulte date for HijriYear
- long daysOfHijriYear = GetDaysInYear(HijriYear, CurrentEra); // The number of days for (HijriYear+1) year.
-
- if (NumDays < daysToHijriYear)
- {
- daysToHijriYear -= daysOfHijriYear;
- HijriYear--;
- }
- else if (NumDays == daysToHijriYear)
- {
- HijriYear--;
- daysToHijriYear -= GetDaysInYear(HijriYear, CurrentEra);
- }
- else
- {
- if (NumDays > daysToHijriYear + daysOfHijriYear)
- {
- daysToHijriYear += daysOfHijriYear;
- HijriYear++;
- }
- }
- if (part == DatePartYear)
- {
- return (HijriYear);
- }
-
- //
- // Calculate the Hijri Month.
- //
-
- HijriMonth = 1;
- NumDays -= daysToHijriYear;
-
- if (part == DatePartDayOfYear)
- {
- return ((int)NumDays);
- }
-
- while ((HijriMonth <= 12) && (NumDays > HijriMonthDays[HijriMonth - 1]))
- {
- HijriMonth++;
- }
- HijriMonth--;
-
- if (part == DatePartMonth)
- {
- return (HijriMonth);
- }
-
- //
- // Calculate the Hijri Day.
- //
- HijriDay = (int)(NumDays - HijriMonthDays[HijriMonth - 1]);
-
- if (part == DatePartDay)
- {
- return (HijriDay);
- }
- // Incorrect part value.
- throw new InvalidOperationException(SR.InvalidOperation_DateTimeParsing);
- }
-
- // Returns the DateTime resulting from adding the given number of
- // months to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year and month parts of the specified DateTime by
- // value months, and, if required, adjusting the day part of the
- // resulting date downwards to the last day of the resulting month in the
- // resulting year. The time-of-day part of the result is the same as the
- // time-of-day part of the specified DateTime.
- //
- // In more precise terms, considering the specified DateTime to be of the
- // form y / m / d + t, where y is the
- // year, m is the month, d is the day, and t is the
- // time-of-day, the result is y1 / m1 / d1 + t,
- // where y1 and m1 are computed by adding value months
- // to y and m, and d1 is the largest value less than
- // or equal to d that denotes a valid day in month m1 of year
- // y1.
- //
-
- public override DateTime AddMonths(DateTime time, int months)
- {
- if (months < -120000 || months > 120000)
- {
- throw new ArgumentOutOfRangeException(
- nameof(months),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- -120000,
- 120000));
- }
- Contract.EndContractBlock();
- // Get the date in Hijri calendar.
- int y = GetDatePart(time.Ticks, DatePartYear);
- int m = GetDatePart(time.Ticks, DatePartMonth);
- int d = GetDatePart(time.Ticks, DatePartDay);
- int i = m - 1 + months;
- if (i >= 0)
- {
- m = i % 12 + 1;
- y = y + i / 12;
- }
- else
- {
- m = 12 + (i + 1) % 12;
- y = y + (i - 11) / 12;
- }
- int days = GetDaysInMonth(y, m);
- if (d > days)
- {
- d = days;
- }
- long ticks = GetAbsoluteDateHijri(y, m, d) * TicksPerDay + (time.Ticks % TicksPerDay);
- Calendar.CheckAddResult(ticks, MinSupportedDateTime, MaxSupportedDateTime);
- return (new DateTime(ticks));
- }
-
- // Returns the DateTime resulting from adding the given number of
- // years to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year part of the specified DateTime by value
- // years. If the month and day of the specified DateTime is 2/29, and if the
- // resulting year is not a leap year, the month and day of the resulting
- // DateTime becomes 2/28. Otherwise, the month, day, and time-of-day
- // parts of the result are the same as those of the specified DateTime.
- //
-
- public override DateTime AddYears(DateTime time, int years)
- {
- return (AddMonths(time, years * 12));
- }
-
- // Returns the day-of-month part of the specified DateTime. The returned
- // value is an integer between 1 and 31.
- //
-
- public override int GetDayOfMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDay));
- }
-
- // Returns the day-of-week part of the specified DateTime. The returned value
- // is an integer between 0 and 6, where 0 indicates Sunday, 1 indicates
- // Monday, 2 indicates Tuesday, 3 indicates Wednesday, 4 indicates
- // Thursday, 5 indicates Friday, and 6 indicates Saturday.
- //
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- return ((DayOfWeek)((int)(time.Ticks / TicksPerDay + 1) % 7));
- }
-
- // Returns the day-of-year part of the specified DateTime. The returned value
- // is an integer between 1 and 366.
- //
-
- public override int GetDayOfYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDayOfYear));
- }
-
- // Returns the number of days in the month given by the year and
- // month arguments.
- //
- [Pure]
- public override int GetDaysInMonth(int year, int month, int era)
- {
- CheckYearMonthRange(year, month, era);
- if (month == 12)
- {
- // For the 12th month, leap year has 30 days, and common year has 29 days.
- return (IsLeapYear(year, CurrentEra) ? 30 : 29);
- }
- // Other months contain 30 and 29 days alternatively. The 1st month has 30 days.
- return (((month % 2) == 1) ? 30 : 29);
- }
-
- // Returns the number of days in the year given by the year argument for the current era.
- //
-
- public override int GetDaysInYear(int year, int era)
- {
- CheckYearRange(year, era);
- // Common years have 354 days. Leap years have 355 days.
- return (IsLeapYear(year, CurrentEra) ? 355 : 354);
- }
-
- // Returns the era for the specified DateTime value.
-
- public override int GetEra(DateTime time)
- {
- CheckTicksRange(time.Ticks);
- return (HijriEra);
- }
-
-
- public override int[] Eras
- {
- get
- {
- return (new int[] { HijriEra });
- }
- }
-
- // Returns the month part of the specified DateTime. The returned value is an
- // integer between 1 and 12.
- //
-
- public override int GetMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartMonth));
- }
-
- // Returns the number of months in the specified year and era.
-
- public override int GetMonthsInYear(int year, int era)
- {
- CheckYearRange(year, era);
- return (12);
- }
-
- // Returns the year part of the specified DateTime. The returned value is an
- // integer between 1 and MaxCalendarYear.
- //
-
- public override int GetYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartYear));
- }
-
- // Checks whether a given day in the specified era is a leap day. This method returns true if
- // the date is a leap day, or false if not.
- //
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- // The year/month/era value checking is done in GetDaysInMonth().
- int daysInMonth = GetDaysInMonth(year, month, era);
- if (day < 1 || day > daysInMonth)
- {
- throw new ArgumentOutOfRangeException(
- nameof(day),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Day,
- daysInMonth,
- month));
- }
- return (IsLeapYear(year, era) && month == 12 && day == 30);
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
-
- public override int GetLeapMonth(int year, int era)
- {
- CheckYearRange(year, era);
- return (0);
- }
-
- // Checks whether a given month in the specified era is a leap month. This method returns true if
- // month is a leap month, or false if not.
- //
-
- public override bool IsLeapMonth(int year, int month, int era)
- {
- CheckYearMonthRange(year, month, era);
- return (false);
- }
-
- // Checks whether a given year in the specified era is a leap year. This method returns true if
- // year is a leap year, or false if not.
- //
-
- public override bool IsLeapYear(int year, int era)
- {
- CheckYearRange(year, era);
- return ((((year * 11) + 14) % 30) < 11);
- }
-
- // Returns the date and time converted to a DateTime value. Throws an exception if the n-tuple is invalid.
- //
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- // The year/month/era checking is done in GetDaysInMonth().
- int daysInMonth = GetDaysInMonth(year, month, era);
- if (day < 1 || day > daysInMonth)
- {
- throw new ArgumentOutOfRangeException(
- nameof(day),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Day,
- daysInMonth,
- month));
- }
-
- long lDate = GetAbsoluteDateHijri(year, month, day);
-
- if (lDate >= 0)
- {
- return (new DateTime(lDate * GregorianCalendar.TicksPerDay + TimeToTicks(hour, minute, second, millisecond)));
- }
- else
- {
- throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadYearMonthDay);
- }
- }
-
- private const int DEFAULT_TWO_DIGIT_YEAR_MAX = 1451;
-
-
- public override int TwoDigitYearMax
- {
- get
- {
- if (twoDigitYearMax == -1)
- {
- twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
- }
- return (twoDigitYearMax);
- }
-
- set
- {
- VerifyWritable();
- if (value < 99 || value > MaxCalendarYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(value),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 99,
- MaxCalendarYear));
- }
- twoDigitYearMax = value;
- }
- }
-
-
- public override int ToFourDigitYear(int year)
- {
- if (year < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedNonNegNum);
- }
- Contract.EndContractBlock();
-
- if (year < 100)
- {
- return (base.ToFourDigitYear(year));
- }
-
- if (year > MaxCalendarYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- MaxCalendarYear));
- }
- return (year);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/IdnMapping.Unix.cs b/src/mscorlib/corefx/System/Globalization/IdnMapping.Unix.cs
deleted file mode 100644
index 58f4ccadde..0000000000
--- a/src/mscorlib/corefx/System/Globalization/IdnMapping.Unix.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Globalization
-{
- sealed partial class IdnMapping
- {
- private unsafe string GetAsciiCore(char* unicode, int count)
- {
- uint flags = Flags;
- CheckInvalidIdnCharacters(unicode, count, flags, nameof(unicode));
-
- const int StackallocThreshold = 512;
- // Each unicode character is represented by up to 3 ASCII chars
- // and the whole string is prefixed by "xn--" (length 4)
- int estimatedLength = (int)Math.Min(count * 3L + 4, StackallocThreshold);
- int actualLength;
- if (estimatedLength < StackallocThreshold)
- {
- char* outputStack = stackalloc char[estimatedLength];
- actualLength = Interop.GlobalizationInterop.ToAscii(flags, unicode, count, outputStack, estimatedLength);
- if (actualLength > 0 && actualLength <= estimatedLength)
- {
- return new string(outputStack, 0, actualLength);
- }
- }
- else
- {
- actualLength = Interop.GlobalizationInterop.ToAscii(flags, unicode, count, null, 0);
- }
- if (actualLength == 0)
- {
- throw new ArgumentException(SR.Argument_IdnIllegalName, nameof(unicode));
- }
-
- char[] outputHeap = new char[actualLength];
- fixed (char* pOutputHeap = outputHeap)
- {
- actualLength = Interop.GlobalizationInterop.ToAscii(flags, unicode, count, pOutputHeap, actualLength);
- if (actualLength == 0 || actualLength > outputHeap.Length)
- {
- throw new ArgumentException(SR.Argument_IdnIllegalName, nameof(unicode));
- }
- return new string(pOutputHeap, 0, actualLength);
- }
- }
-
- private unsafe string GetUnicodeCore(char* ascii, int count)
- {
- uint flags = Flags;
- CheckInvalidIdnCharacters(ascii, count, flags, nameof(ascii));
-
- const int StackAllocThreshold = 512;
- if (count < StackAllocThreshold)
- {
- char* output = stackalloc char[count];
- return GetUnicodeCore(ascii, count, flags, output, count, reattempt: true);
- }
- else
- {
- char[] output = new char[count];
- fixed (char* pOutput = output)
- {
- return GetUnicodeCore(ascii, count, flags, pOutput, count, reattempt: true);
- }
- }
- }
-
- private unsafe string GetUnicodeCore(char* ascii, int count, uint flags, char* output, int outputLength, bool reattempt)
- {
- int realLen = Interop.GlobalizationInterop.ToUnicode(flags, ascii, count, output, outputLength);
-
- if (realLen == 0)
- {
- throw new ArgumentException(SR.Argument_IdnIllegalName, nameof(ascii));
- }
- else if (realLen <= outputLength)
- {
- return new string(output, 0, realLen);
- }
- else if (reattempt)
- {
- char[] newOutput = new char[realLen];
- fixed (char* pNewOutput = newOutput)
- {
- return GetUnicodeCore(ascii, count, flags, pNewOutput, realLen, reattempt: false);
- }
- }
-
- throw new ArgumentException(SR.Argument_IdnIllegalName, nameof(ascii));
- }
-
- // -----------------------------
- // ---- PAL layer ends here ----
- // -----------------------------
-
- private uint Flags
- {
- get
- {
- int flags =
- (AllowUnassigned ? Interop.GlobalizationInterop.AllowUnassigned : 0) |
- (UseStd3AsciiRules ? Interop.GlobalizationInterop.UseStd3AsciiRules : 0);
- return (uint)flags;
- }
- }
-
- /// <summary>
- /// ICU doesn't check for invalid characters unless the STD3 rules option
- /// is enabled.
- ///
- /// To match Windows behavior, we walk the string ourselves looking for these
- /// bad characters so we can continue to throw ArgumentException in these cases.
- /// </summary>
- private static unsafe void CheckInvalidIdnCharacters(char* s, int count, uint flags, string paramName)
- {
- if ((flags & Interop.GlobalizationInterop.UseStd3AsciiRules) == 0)
- {
- for (int i = 0; i < count; i++)
- {
- char c = s[i];
-
- // These characters are prohibited regardless of the UseStd3AsciiRules property.
- // See https://msdn.microsoft.com/en-us/library/system.globalization.idnmapping.usestd3asciirules(v=vs.110).aspx
- if (c <= 0x1F || c == 0x7F)
- {
- throw new ArgumentException(SR.Argument_IdnIllegalName, paramName);
- }
- }
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/IdnMapping.Windows.cs b/src/mscorlib/corefx/System/Globalization/IdnMapping.Windows.cs
deleted file mode 100644
index 3d3292e3db..0000000000
--- a/src/mscorlib/corefx/System/Globalization/IdnMapping.Windows.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-namespace System.Globalization
-{
- public sealed partial class IdnMapping
- {
- private unsafe string GetAsciiCore(char* unicode, int count)
- {
- uint flags = Flags;
-
- // Determine the required length
- int length = Interop.mincore.IdnToAscii(flags, new IntPtr(unicode), count, IntPtr.Zero, 0);
- if (length == 0)
- {
- ThrowForZeroLength(nameof(unicode), SR.Argument_IdnIllegalName, SR.Argument_InvalidCharSequenceNoIndex);
- }
-
- // Do the conversion
- const int StackAllocThreshold = 512; // arbitrary limit to switch from stack to heap allocation
- if (length < StackAllocThreshold)
- {
- char* output = stackalloc char[length];
- return GetAsciiCore(unicode, count, flags, output, length);
- }
- else
- {
- char[] output = new char[length];
- fixed (char* pOutput = output)
- {
- return GetAsciiCore(unicode, count, flags, pOutput, length);
- }
- }
- }
-
- private unsafe string GetAsciiCore(char* unicode, int count, uint flags, char* output, int outputLength)
- {
- int length = Interop.mincore.IdnToAscii(flags, new IntPtr(unicode), count, new IntPtr(output), outputLength);
- if (length == 0)
- {
- ThrowForZeroLength(nameof(unicode), SR.Argument_IdnIllegalName, SR.Argument_InvalidCharSequenceNoIndex);
- }
- Debug.Assert(length == outputLength);
- return new string(output, 0, length);
- }
-
- private unsafe string GetUnicodeCore(char* ascii, int count)
- {
- uint flags = Flags;
-
- // Determine the required length
- int length = Interop.mincore.IdnToUnicode(flags, new IntPtr(ascii), count, IntPtr.Zero, 0);
- if (length == 0)
- {
- ThrowForZeroLength(nameof(ascii), SR.Argument_IdnIllegalName, SR.Argument_IdnBadPunycode);
- }
-
- // Do the conversion
- const int StackAllocThreshold = 512; // arbitrary limit to switch from stack to heap allocation
- if (length < StackAllocThreshold)
- {
- char* output = stackalloc char[length];
- return GetUnicodeCore(ascii, count, flags, output, length);
- }
- else
- {
- char[] output = new char[length];
- fixed (char* pOutput = output)
- {
- return GetUnicodeCore(ascii, count, flags, pOutput, length);
- }
- }
- }
-
- private unsafe string GetUnicodeCore(char* ascii, int count, uint flags, char* output, int outputLength)
- {
- int length = Interop.mincore.IdnToUnicode(flags, new IntPtr(ascii), count, new IntPtr(output), outputLength);
- if (length == 0)
- {
- ThrowForZeroLength(nameof(ascii), SR.Argument_IdnIllegalName, SR.Argument_IdnBadPunycode);
- }
- Debug.Assert(length == outputLength);
- return new string(output, 0, length);
- }
-
- // -----------------------------
- // ---- PAL layer ends here ----
- // -----------------------------
-
- private uint Flags
- {
- get
- {
- int flags =
- (AllowUnassigned ? Interop.mincore.IDN_ALLOW_UNASSIGNED : 0) |
- (UseStd3AsciiRules ? Interop.mincore.IDN_USE_STD3_ASCII_RULES : 0);
- return (uint)flags;
- }
- }
-
- private static void ThrowForZeroLength(string paramName, string invalidNameString, string otherString)
- {
- throw new ArgumentException(
- Marshal.GetLastWin32Error() == Interop.ERROR_INVALID_NAME ? invalidNameString : otherString,
- paramName);
- }
- }
-}
-
diff --git a/src/mscorlib/corefx/System/Globalization/IdnMapping.cs b/src/mscorlib/corefx/System/Globalization/IdnMapping.cs
deleted file mode 100644
index 8424472751..0000000000
--- a/src/mscorlib/corefx/System/Globalization/IdnMapping.cs
+++ /dev/null
@@ -1,152 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-// This file contains the IDN functions and implementation.
-//
-// This allows encoding of non-ASCII domain names in a "punycode" form,
-// for example:
-//
-// \u5B89\u5BA4\u5948\u7F8E\u6075-with-SUPER-MONKEYS
-//
-// is encoded as:
-//
-// xn---with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n
-//
-// Additional options are provided to allow unassigned IDN characters and
-// to validate according to the Std3ASCII Rules (like DNS names).
-//
-// There are also rules regarding bidirectionality of text and the length
-// of segments.
-//
-// For additional rules see also:
-// RFC 3490 - Internationalizing Domain Names in Applications (IDNA)
-// RFC 3491 - Nameprep: A Stringprep Profile for Internationalized Domain Names (IDN)
-// RFC 3492 - Punycode: A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)
-
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- // IdnMapping class used to map names to Punycode
- public sealed partial class IdnMapping
- {
- private bool _allowUnassigned;
- private bool _useStd3AsciiRules;
-
- public IdnMapping()
- {
- }
-
- public bool AllowUnassigned
- {
- get { return _allowUnassigned; }
- set { _allowUnassigned = value; }
- }
-
- public bool UseStd3AsciiRules
- {
- get { return _useStd3AsciiRules; }
- set { _useStd3AsciiRules = value; }
- }
-
- // Gets ASCII (Punycode) version of the string
- public string GetAscii(string unicode)
- {
- return GetAscii(unicode, 0);
- }
-
- public string GetAscii(string unicode, int index)
- {
- if (unicode == null)
- throw new ArgumentNullException(nameof(unicode));
- Contract.EndContractBlock();
- return GetAscii(unicode, index, unicode.Length - index);
- }
-
- public string GetAscii(string unicode, int index, int count)
- {
- if (unicode == null)
- throw new ArgumentNullException(nameof(unicode));
- if (index < 0 || count < 0)
- throw new ArgumentOutOfRangeException((index < 0) ? nameof(index) : nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (index > unicode.Length)
- throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
- if (index > unicode.Length - count)
- throw new ArgumentOutOfRangeException(nameof(unicode), SR.ArgumentOutOfRange_IndexCountBuffer);
- Contract.EndContractBlock();
-
- if (count == 0)
- {
- throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(unicode));
- }
- if (unicode[index + count - 1] == 0)
- {
- throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, index + count - 1), nameof(unicode));
- }
-
- unsafe
- {
- fixed (char* pUnicode = unicode)
- {
- return GetAsciiCore(pUnicode + index, count);
- }
- }
- }
-
- // Gets Unicode version of the string. Normalized and limited to IDNA characters.
- public string GetUnicode(string ascii)
- {
- return GetUnicode(ascii, 0);
- }
-
- public string GetUnicode(string ascii, int index)
- {
- if (ascii == null)
- throw new ArgumentNullException(nameof(ascii));
- Contract.EndContractBlock();
- return GetUnicode(ascii, index, ascii.Length - index);
- }
-
- public string GetUnicode(string ascii, int index, int count)
- {
- if (ascii == null)
- throw new ArgumentNullException(nameof(ascii));
- if (index < 0 || count < 0)
- throw new ArgumentOutOfRangeException((index < 0) ? nameof(index) : nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (index > ascii.Length)
- throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
- if (index > ascii.Length - count)
- throw new ArgumentOutOfRangeException(nameof(ascii), SR.ArgumentOutOfRange_IndexCountBuffer);
-
- // This is a case (i.e. explicitly null-terminated input) where behavior in .NET and Win32 intentionally differ.
- // The .NET APIs should (and did in v4.0 and earlier) throw an ArgumentException on input that includes a terminating null.
- // The Win32 APIs fail on an embedded null, but not on a terminating null.
- if (count > 0 && ascii[index + count - 1] == (char)0)
- throw new ArgumentException(SR.Argument_IdnBadPunycode, nameof(ascii));
- Contract.EndContractBlock();
-
- unsafe
- {
- fixed (char* pAscii = ascii)
- {
- return GetUnicodeCore(pAscii + index, count);
- }
- }
- }
-
- public override bool Equals(object obj)
- {
- IdnMapping that = obj as IdnMapping;
- return
- that != null &&
- _allowUnassigned == that._allowUnassigned &&
- _useStd3AsciiRules == that._useStd3AsciiRules;
- }
-
- public override int GetHashCode()
- {
- return (_allowUnassigned ? 100 : 200) + (_useStd3AsciiRules ? 1000 : 2000);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/InternalGlobalizationHelper.cs b/src/mscorlib/corefx/System/Globalization/InternalGlobalizationHelper.cs
deleted file mode 100644
index 0a4e6f0600..0000000000
--- a/src/mscorlib/corefx/System/Globalization/InternalGlobalizationHelper.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-
-namespace System.Globalization
-{
- internal class InternalGloablizationHelper
- {
- // Copied from the TimeSpan to be used inside the globalization code and avoid internal dependancy on TimeSpan class
- internal static long TimeToTicks(int hour, int minute, int second)
- {
- // totalSeconds is bounded by 2^31 * 2^12 + 2^31 * 2^8 + 2^31,
- // which is less than 2^44, meaning we won't overflow totalSeconds.
- long totalSeconds = (long)hour * 3600 + (long)minute * 60 + (long)second;
- if (totalSeconds > MaxSeconds || totalSeconds < MinSeconds)
- throw new ArgumentOutOfRangeException(null, SR.Overflow_TimeSpanTooLong);
- return totalSeconds * TicksPerSecond;
- }
-
-
- //
- // Define needed constants so globalization code can be independant from any other types
- //
-
- internal const long TicksPerMillisecond = 10000;
- internal const long TicksPerTenthSecond = TicksPerMillisecond * 100;
- internal const long TicksPerSecond = TicksPerMillisecond * 1000; // 10,000,000
- internal const long MaxSeconds = Int64.MaxValue / TicksPerSecond;
- internal const long MinSeconds = Int64.MinValue / TicksPerSecond;
- private const int DaysPerYear = 365;
- private const int DaysPer4Years = DaysPerYear * 4 + 1; // 1461
- private const int DaysPer100Years = DaysPer4Years * 25 - 1; // 36524
- private const int DaysPer400Years = DaysPer100Years * 4 + 1; // 146097
- private const int DaysTo10000 = DaysPer400Years * 25 - 366; // 3652059
- private const long TicksPerMinute = TicksPerSecond * 60;
- private const long TicksPerHour = TicksPerMinute * 60;
- private const long TicksPerDay = TicksPerHour * 24;
- internal const long MaxTicks = DaysTo10000 * TicksPerDay - 1;
- internal const long MinTicks = 0;
- internal const long MaxMilliSeconds = Int64.MaxValue / TicksPerMillisecond;
- internal const long MinMilliSeconds = Int64.MinValue / TicksPerMillisecond;
-
- internal const int StringBuilderDefaultCapacity = 16;
-
- internal const Int64 MaxOffset = TimeSpan.TicksPerHour * 14;
- internal const Int64 MinOffset = -MaxOffset;
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Unix.cs b/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Unix.cs
deleted file mode 100644
index b9bd94af6e..0000000000
--- a/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Unix.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Collections.Generic;
-
-namespace System.Globalization
-{
- public partial class JapaneseCalendar : Calendar
- {
- private static EraInfo[] GetJapaneseEras()
- {
- string[] eraNames;
- if (!CalendarData.EnumCalendarInfo("ja-JP", CalendarId.JAPAN, CalendarDataType.EraNames, out eraNames))
- {
- return null;
- }
-
- string[] abbrevEnglishEraNames;
- if (!CalendarData.EnumCalendarInfo("en", CalendarId.JAPAN, CalendarDataType.AbbrevEraNames, out abbrevEnglishEraNames))
- {
- return null;
- }
-
- List<EraInfo> eras = new List<EraInfo>();
- int lastMaxYear = GregorianCalendar.MaxYear;
-
- int latestEra = Interop.GlobalizationInterop.GetLatestJapaneseEra();
- for (int i = latestEra; i >= 0; i--)
- {
- DateTime dt;
- if (!GetJapaneseEraStartDate(i, out dt))
- {
- return null;
- }
-
- if (dt < JapaneseCalendar.calendarMinValue)
- {
- // only populate the Eras that are valid JapaneseCalendar date times
- break;
- }
-
- eras.Add(new EraInfo(i, dt.Year, dt.Month, dt.Day, dt.Year - 1, 1, lastMaxYear - dt.Year + 1,
- eraNames[i], GetAbbreviatedEraName(eraNames, i), abbrevEnglishEraNames[i]));
-
- lastMaxYear = dt.Year;
- }
-
- // remap the Era numbers, now that we know how many there will be
- for (int i = 0; i < eras.Count; i++)
- {
- eras[i].era = eras.Count - i;
- }
-
- return eras.ToArray();
- }
-
- // PAL Layer ends here
-
- private static string GetAbbreviatedEraName(string[] eraNames, int eraIndex)
- {
- // This matches the behavior on Win32 - only returning the first character of the era name.
- // See Calendar.EraAsString(Int32) - https://msdn.microsoft.com/en-us/library/windows/apps/br206751.aspx
- return eraNames[eraIndex].Substring(0, 1);
- }
-
- private static bool GetJapaneseEraStartDate(int era, out DateTime dateTime)
- {
- dateTime = default(DateTime);
-
- int startYear;
- int startMonth;
- int startDay;
- bool result = Interop.GlobalizationInterop.GetJapaneseEraStartDate(
- era,
- out startYear,
- out startMonth,
- out startDay);
-
- if (result)
- {
- dateTime = new DateTime(startYear, startMonth, startDay);
- }
-
- return result;
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Win32.cs b/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Win32.cs
deleted file mode 100644
index a83c4fad9e..0000000000
--- a/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.Win32.cs
+++ /dev/null
@@ -1,209 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-
-using Microsoft.Win32;
-
-namespace System.Globalization
-{
- public partial class JapaneseCalendar : Calendar
- {
- private const string c_japaneseErasHive = @"System\CurrentControlSet\Control\Nls\Calendars\Japanese\Eras";
- private const string c_japaneseErasHivePermissionList = @"HKEY_LOCAL_MACHINE\" + c_japaneseErasHive;
-
- // We know about 4 built-in eras, however users may add additional era(s) from the
- // registry, by adding values to HKLM\SYSTEM\CurrentControlSet\Control\Nls\Calendars\Japanese\Eras
- //
- // Registry values look like:
- // yyyy.mm.dd=era_abbrev_english_englishabbrev
- //
- // Where yyyy.mm.dd is the registry value name, and also the date of the era start.
- // yyyy, mm, and dd are the year, month & day the era begins (4, 2 & 2 digits long)
- // era is the Japanese Era name
- // abbrev is the Abbreviated Japanese Era Name
- // english is the English name for the Era (unused)
- // englishabbrev is the Abbreviated English name for the era.
- // . is a delimiter, but the value of . doesn't matter.
- // '_' marks the space between the japanese era name, japanese abbreviated era name
- // english name, and abbreviated english names.
- private static EraInfo[] GetJapaneseEras()
- {
- // Look in the registry key and see if we can find any ranges
- int iFoundEras = 0;
- EraInfo[] registryEraRanges = null;
-
- try
- {
- // Need to access registry
- RegistryKey key = RegistryKey.GetBaseKey(RegistryKey.HKEY_LOCAL_MACHINE).OpenSubKey(c_japaneseErasHive, false);
-
- // Abort if we didn't find anything
- if (key == null) return null;
-
- // Look up the values in our reg key
- String[] valueNames = key.GetValueNames();
- if (valueNames != null && valueNames.Length > 0)
- {
- registryEraRanges = new EraInfo[valueNames.Length];
-
- // Loop through the registry and read in all the values
- for (int i = 0; i < valueNames.Length; i++)
- {
- // See if the era is a valid date
- EraInfo era = GetEraFromValue(valueNames[i], key.GetValue(valueNames[i]).ToString());
-
- // continue if not valid
- if (era == null) continue;
-
- // Remember we found one.
- registryEraRanges[iFoundEras] = era;
- iFoundEras++;
- }
- }
- }
- catch (System.Security.SecurityException)
- {
- // If we weren't allowed to read, then just ignore the error
- return null;
- }
- catch (System.IO.IOException)
- {
- // If key is being deleted just ignore the error
- return null;
- }
- catch (System.UnauthorizedAccessException)
- {
- // Registry access rights permissions, just ignore the error
- return null;
- }
-
- //
- // If we didn't have valid eras, then fail
- // should have at least 4 eras
- //
- if (iFoundEras < 4) return null;
-
- //
- // Now we have eras, clean them up.
- //
- // Clean up array length
- Array.Resize(ref registryEraRanges, iFoundEras);
-
- // Sort them
- Array.Sort(registryEraRanges, CompareEraRanges);
-
- // Clean up era information
- for (int i = 0; i < registryEraRanges.Length; i++)
- {
- // eras count backwards from length to 1 (and are 1 based indexes into string arrays)
- registryEraRanges[i].era = registryEraRanges.Length - i;
-
- // update max era year
- if (i == 0)
- {
- // First range is 'til the end of the calendar
- registryEraRanges[0].maxEraYear = GregorianCalendar.MaxYear - registryEraRanges[0].yearOffset;
- }
- else
- {
- // Rest are until the next era (remember most recent era is first in array)
- registryEraRanges[i].maxEraYear = registryEraRanges[i - 1].yearOffset + 1 - registryEraRanges[i].yearOffset;
- }
- }
-
- // Return our ranges
- return registryEraRanges;
- }
-
- //
- // Compare two era ranges, eg just the ticks
- // Remember the era array is supposed to be in reverse chronological order
- //
- private static int CompareEraRanges(EraInfo a, EraInfo b)
- {
- return b.ticks.CompareTo(a.ticks);
- }
-
- //
- // GetEraFromValue
- //
- // Parse the registry value name/data pair into an era
- //
- // Registry values look like:
- // yyyy.mm.dd=era_abbrev_english_englishabbrev
- //
- // Where yyyy.mm.dd is the registry value name, and also the date of the era start.
- // yyyy, mm, and dd are the year, month & day the era begins (4, 2 & 2 digits long)
- // era is the Japanese Era name
- // abbrev is the Abbreviated Japanese Era Name
- // english is the English name for the Era (unused)
- // englishabbrev is the Abbreviated English name for the era.
- // . is a delimiter, but the value of . doesn't matter.
- // '_' marks the space between the japanese era name, japanese abbreviated era name
- // english name, and abbreviated english names.
- private static EraInfo GetEraFromValue(String value, String data)
- {
- // Need inputs
- if (value == null || data == null) return null;
-
- //
- // Get Date
- //
- // Need exactly 10 characters in name for date
- // yyyy.mm.dd although the . can be any character
- if (value.Length != 10) return null;
-
- int year;
- int month;
- int day;
-
- if (!Int32.TryParse(value.Substring(0, 4), NumberStyles.None, NumberFormatInfo.InvariantInfo, out year) ||
- !Int32.TryParse(value.Substring(5, 2), NumberStyles.None, NumberFormatInfo.InvariantInfo, out month) ||
- !Int32.TryParse(value.Substring(8, 2), NumberStyles.None, NumberFormatInfo.InvariantInfo, out day))
- {
- // Couldn't convert integer, fail
- return null;
- }
-
- //
- // Get Strings
- //
- // Needs to be a certain length e_a_E_A at least (7 chars, exactly 4 groups)
- String[] names = data.Split('_');
-
- // Should have exactly 4 parts
- // 0 - Era Name
- // 1 - Abbreviated Era Name
- // 2 - English Era Name
- // 3 - Abbreviated English Era Name
- if (names.Length != 4) return null;
-
- // Each part should have data in it
- if (names[0].Length == 0 ||
- names[1].Length == 0 ||
- names[2].Length == 0 ||
- names[3].Length == 0)
- return null;
-
- //
- // Now we have an era we can build
- // Note that the era # and max era year need cleaned up after sorting
- // Don't use the full English Era Name (names[2])
- //
- return new EraInfo(0, year, month, day, year - 1, 1, 0,
- names[0], names[1], names[3]);
- }
-
- // PAL Layer ends here
-
- private static string[] s_japaneseErasEnglishNames = new String[] { "M", "T", "S", "H" };
-
- private static string GetJapaneseEnglishEraName(int era)
- {
- Debug.Assert(era > 0);
- return era <= s_japaneseErasEnglishNames.Length ? s_japaneseErasEnglishNames[era - 1] : " ";
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.WinRT.cs b/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.WinRT.cs
deleted file mode 100644
index 6a9df97200..0000000000
--- a/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.WinRT.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-
-using Internal.Runtime.Augments;
-
-namespace System.Globalization
-{
- public partial class JapaneseCalendar : Calendar
- {
- private static EraInfo[] GetJapaneseEras()
- {
- int erasCount = WinRTInterop.Callbacks.GetJapaneseEraCount();
- if (erasCount < 4)
- {
- return null;
- }
-
- EraInfo[] eras = new EraInfo[erasCount];
- int lastMaxYear = GregorianCalendar.MaxYear;
-
- for (int i = erasCount; i > 0; i--)
- {
- DateTimeOffset dateOffset;
-
- string eraName;
- string abbreviatedEraName;
-
- if (!GetJapaneseEraInfo(i, out dateOffset, out eraName, out abbreviatedEraName))
- {
- return null;
- }
-
- DateTime dt = new DateTime(dateOffset.Ticks);
-
- eras[erasCount - i] = new EraInfo(i, dt.Year, dt.Month, dt.Day, dt.Year - 1, 1, lastMaxYear - dt.Year + 1,
- eraName, abbreviatedEraName, GetJapaneseEnglishEraName(i)); // era #4 start year/month/day, yearOffset, minEraYear
-
- lastMaxYear = dt.Year;
- }
-
- return eras;
- }
-
- // PAL Layer ends here
-
- private static string[] JapaneseErasEnglishNames = new String[] { "M", "T", "S", "H" };
-
- private static string GetJapaneseEnglishEraName(int era)
- {
- Debug.Assert(era > 0);
- return era <= JapaneseErasEnglishNames.Length ? JapaneseErasEnglishNames[era - 1] : " ";
- }
-
- private static bool GetJapaneseEraInfo(int era, out DateTimeOffset dateOffset, out string eraName, out string abbreviatedEraName)
- {
- return WinRTInterop.Callbacks.GetJapaneseEraInfo(era, out dateOffset, out eraName, out abbreviatedEraName);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.cs b/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.cs
deleted file mode 100644
index f0216c8f51..0000000000
--- a/src/mscorlib/corefx/System/Globalization/JapaneseCalendar.cs
+++ /dev/null
@@ -1,411 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- /*=================================JapaneseCalendar==========================
- **
- ** JapaneseCalendar is based on Gregorian calendar. The month and day values are the same as
- ** Gregorian calendar. However, the year value is an offset to the Gregorian
- ** year based on the era.
- **
- ** This system is adopted by Emperor Meiji in 1868. The year value is counted based on the reign of an emperor,
- ** and the era begins on the day an emperor ascends the throne and continues until his death.
- ** The era changes at 12:00AM.
- **
- ** For example, the current era is Heisei. It started on 1989/1/8 A.D. Therefore, Gregorian year 1989 is also Heisei 1st.
- ** 1989/1/8 A.D. is also Heisei 1st 1/8.
- **
- ** Any date in the year during which era is changed can be reckoned in either era. For example,
- ** 1989/1/1 can be 1/1 Heisei 1st year or 1/1 Showa 64th year.
- **
- ** Note:
- ** The DateTime can be represented by the JapaneseCalendar are limited to two factors:
- ** 1. The min value and max value of DateTime class.
- ** 2. The available era information.
- **
- ** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 1868/09/08 9999/12/31
- ** Japanese Meiji 01/01 Heisei 8011/12/31
- ============================================================================*/
-
-
- [Serializable]
- public partial class JapaneseCalendar : Calendar
- {
- internal static readonly DateTime calendarMinValue = new DateTime(1868, 9, 8);
-
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (calendarMinValue);
- }
- }
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (DateTime.MaxValue);
- }
- }
-
- public override CalendarAlgorithmType AlgorithmType
- {
- get
- {
- return CalendarAlgorithmType.SolarCalendar;
- }
- }
-
- //
- // Using a field initializer rather than a static constructor so that the whole class can be lazy
- // init.
- internal static volatile EraInfo[] japaneseEraInfo;
-
- //
- // Read our era info
- //
- // m_EraInfo must be listed in reverse chronological order. The most recent era
- // should be the first element.
- // That is, m_EraInfo[0] contains the most recent era.
- //
- // We know about 4 built-in eras, however users may add additional era(s) from the
- // registry, by adding values to HKLM\SYSTEM\CurrentControlSet\Control\Nls\Calendars\Japanese\Eras
- // we don't read the registry and instead we call WinRT to get the needed informatio
- //
- // Registry values look like:
- // yyyy.mm.dd=era_abbrev_english_englishabbrev
- //
- // Where yyyy.mm.dd is the registry value name, and also the date of the era start.
- // yyyy, mm, and dd are the year, month & day the era begins (4, 2 & 2 digits long)
- // era is the Japanese Era name
- // abbrev is the Abbreviated Japanese Era Name
- // english is the English name for the Era (unused)
- // englishabbrev is the Abbreviated English name for the era.
- // . is a delimiter, but the value of . doesn't matter.
- // '_' marks the space between the japanese era name, japanese abbreviated era name
- // english name, and abbreviated english names.
- //
- internal static EraInfo[] GetEraInfo()
- {
- // See if we need to build it
- if (japaneseEraInfo == null)
- {
- japaneseEraInfo = GetJapaneseEras();
- // See if we have to use the built-in eras
- if (japaneseEraInfo == null)
- {
- // We know about some built-in ranges
- EraInfo[] defaultEraRanges = new EraInfo[4];
- defaultEraRanges[0] = new EraInfo(4, 1989, 1, 8, 1988, 1, GregorianCalendar.MaxYear - 1988,
- "\x5e73\x6210", "\x5e73", "H"); // era #4 start year/month/day, yearOffset, minEraYear
- defaultEraRanges[1] = new EraInfo(3, 1926, 12, 25, 1925, 1, 1989 - 1925,
- "\x662d\x548c", "\x662d", "S"); // era #3,start year/month/day, yearOffset, minEraYear
- defaultEraRanges[2] = new EraInfo(2, 1912, 7, 30, 1911, 1, 1926 - 1911,
- "\x5927\x6b63", "\x5927", "T"); // era #2,start year/month/day, yearOffset, minEraYear
- defaultEraRanges[3] = new EraInfo(1, 1868, 1, 1, 1867, 1, 1912 - 1867,
- "\x660e\x6cbb", "\x660e", "M"); // era #1,start year/month/day, yearOffset, minEraYear
-
- // Remember the ranges we built
- japaneseEraInfo = defaultEraRanges;
- }
- }
-
- // return the era we found/made
- return japaneseEraInfo;
- }
-
- internal static volatile Calendar s_defaultInstance;
- internal GregorianCalendarHelper helper;
-
- /*=================================GetDefaultInstance==========================
- **Action: Internal method to provide a default intance of JapaneseCalendar. Used by NLS+ implementation
- ** and other calendars.
- **Returns:
- **Arguments:
- **Exceptions:
- ============================================================================*/
-
- internal static Calendar GetDefaultInstance()
- {
- if (s_defaultInstance == null)
- {
- s_defaultInstance = new JapaneseCalendar();
- }
- return (s_defaultInstance);
- }
-
-
- public JapaneseCalendar()
- {
- try
- {
- new CultureInfo("ja-JP");
- }
- catch (ArgumentException e)
- {
- throw new TypeInitializationException(this.GetType().ToString(), e);
- }
- helper = new GregorianCalendarHelper(this, GetEraInfo());
- }
-
- internal override CalendarId ID
- {
- get
- {
- return CalendarId.JAPAN;
- }
- }
-
-
- public override DateTime AddMonths(DateTime time, int months)
- {
- return (helper.AddMonths(time, months));
- }
-
-
- public override DateTime AddYears(DateTime time, int years)
- {
- return (helper.AddYears(time, years));
- }
-
- /*=================================GetDaysInMonth==========================
- **Action: Returns the number of days in the month given by the year and month arguments.
- **Returns: The number of days in the given month.
- **Arguments:
- ** year The year in Japanese calendar.
- ** month The month
- ** era The Japanese era value.
- **Exceptions
- ** ArgumentException If month is less than 1 or greater * than 12.
- ============================================================================*/
-
-
- public override int GetDaysInMonth(int year, int month, int era)
- {
- return (helper.GetDaysInMonth(year, month, era));
- }
-
-
- public override int GetDaysInYear(int year, int era)
- {
- return (helper.GetDaysInYear(year, era));
- }
-
-
- public override int GetDayOfMonth(DateTime time)
- {
- return (helper.GetDayOfMonth(time));
- }
-
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- return (helper.GetDayOfWeek(time));
- }
-
-
- public override int GetDayOfYear(DateTime time)
- {
- return (helper.GetDayOfYear(time));
- }
-
-
- public override int GetMonthsInYear(int year, int era)
- {
- return (helper.GetMonthsInYear(year, era));
- }
-
-
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
- public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
- {
- return (helper.GetWeekOfYear(time, rule, firstDayOfWeek));
- }
-
- /*=================================GetEra==========================
- **Action: Get the era value of the specified time.
- **Returns: The era value for the specified time.
- **Arguments:
- ** time the specified date time.
- **Exceptions: ArgumentOutOfRangeException if time is out of the valid era ranges.
- ============================================================================*/
-
-
- public override int GetEra(DateTime time)
- {
- return (helper.GetEra(time));
- }
-
-
- public override int GetMonth(DateTime time)
- {
- return (helper.GetMonth(time));
- }
-
-
- public override int GetYear(DateTime time)
- {
- return (helper.GetYear(time));
- }
-
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- return (helper.IsLeapDay(year, month, day, era));
- }
-
-
- public override bool IsLeapYear(int year, int era)
- {
- return (helper.IsLeapYear(year, era));
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
-
- public override int GetLeapMonth(int year, int era)
- {
- return (helper.GetLeapMonth(year, era));
- }
-
-
- public override bool IsLeapMonth(int year, int month, int era)
- {
- return (helper.IsLeapMonth(year, month, era));
- }
-
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- return (helper.ToDateTime(year, month, day, hour, minute, second, millisecond, era));
- }
-
- // For Japanese calendar, four digit year is not used. Few emperors will live for more than one hundred years.
- // Therefore, for any two digit number, we just return the original number.
-
- public override int ToFourDigitYear(int year)
- {
- if (year <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedPosNum);
- }
- Contract.EndContractBlock();
-
- if (year > helper.MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- helper.MaxYear));
- }
- return (year);
- }
-
-
- public override int[] Eras
- {
- get
- {
- return (helper.Eras);
- }
- }
-
- //
- // Return the various era strings
- // Note: The arrays are backwards of the eras
- //
- internal static String[] EraNames()
- {
- EraInfo[] eras = GetEraInfo();
- String[] eraNames = new String[eras.Length];
-
- for (int i = 0; i < eras.Length; i++)
- {
- // Strings are in chronological order, eras are backwards order.
- eraNames[i] = eras[eras.Length - i - 1].eraName;
- }
-
- return eraNames;
- }
-
- internal static String[] AbbrevEraNames()
- {
- EraInfo[] eras = GetEraInfo();
- String[] erasAbbrev = new String[eras.Length];
-
- for (int i = 0; i < eras.Length; i++)
- {
- // Strings are in chronological order, eras are backwards order.
- erasAbbrev[i] = eras[eras.Length - i - 1].abbrevEraName;
- }
-
- return erasAbbrev;
- }
-
- internal static String[] EnglishEraNames()
- {
- EraInfo[] eras = GetEraInfo();
- String[] erasEnglish = new String[eras.Length];
-
- for (int i = 0; i < eras.Length; i++)
- {
- // Strings are in chronological order, eras are backwards order.
- erasEnglish[i] = eras[eras.Length - i - 1].englishEraName;
- }
-
- return erasEnglish;
- }
-
- private const int DEFAULT_TWO_DIGIT_YEAR_MAX = 99;
-
- internal override bool IsValidYear(int year, int era)
- {
- return helper.IsValidYear(year, era);
- }
-
- public override int TwoDigitYearMax
- {
- get
- {
- if (twoDigitYearMax == -1)
- {
- twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
- }
- return (twoDigitYearMax);
- }
-
- set
- {
- VerifyWritable();
- if (value < 99 || value > helper.MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- "year",
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 99,
- helper.MaxYear));
- }
- twoDigitYearMax = value;
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/JapaneseLunisolarCalendar.cs b/src/mscorlib/corefx/System/Globalization/JapaneseLunisolarCalendar.cs
deleted file mode 100644
index cc3d34954d..0000000000
--- a/src/mscorlib/corefx/System/Globalization/JapaneseLunisolarCalendar.cs
+++ /dev/null
@@ -1,311 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about JapaneseLunisolarCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
- /*
- ** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 1960/01/28 2050/01/22
- ** JapaneseLunisolar 1960/01/01 2049/12/29
- */
-
- [Serializable]
- public class JapaneseLunisolarCalendar : EastAsianLunisolarCalendar
- {
- //
- // The era value for the current era.
- //
-
- public const int JapaneseEra = 1;
-
- internal GregorianCalendarHelper helper;
-
- internal const int MIN_LUNISOLAR_YEAR = 1960;
- internal const int MAX_LUNISOLAR_YEAR = 2049;
-
- internal const int MIN_GREGORIAN_YEAR = 1960;
- internal const int MIN_GREGORIAN_MONTH = 1;
- internal const int MIN_GREGORIAN_DAY = 28;
-
- internal const int MAX_GREGORIAN_YEAR = 2050;
- internal const int MAX_GREGORIAN_MONTH = 1;
- internal const int MAX_GREGORIAN_DAY = 22;
-
- internal static DateTime minDate = new DateTime(MIN_GREGORIAN_YEAR, MIN_GREGORIAN_MONTH, MIN_GREGORIAN_DAY);
- internal static DateTime maxDate = new DateTime((new DateTime(MAX_GREGORIAN_YEAR, MAX_GREGORIAN_MONTH, MAX_GREGORIAN_DAY, 23, 59, 59, 999)).Ticks + 9999);
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (minDate);
- }
- }
-
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (maxDate);
- }
- }
- protected override int DaysInYearBeforeMinSupportedYear
- {
- get
- {
- // 1959 from ChineseLunisolarCalendar
- return 354;
- }
- }
-
- private static readonly int[,] s_yinfo =
- {
- /*Y LM Lmon Lday DaysPerMonth D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 #Days
- 1960 */
- { 6 , 1 , 28 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 29 384
-1961 */{ 0 , 2 , 15 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1962 */{ 0 , 2 , 5 , 19808 },/* 29 30 29 29 30 30 29 30 29 30 30 29 0 354
-1963 */{ 4 , 1 , 25 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-1964 */{ 0 , 2 , 13 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1965 */{ 0 , 2 , 2 , 21104 },/* 29 30 29 30 29 29 30 29 29 30 30 30 0 354
-1966 */{ 3 , 1 , 22 , 26928 },/* 29 30 30 29 30 29 29 30 29 29 30 30 29 383
-1967 */{ 0 , 2 , 9 , 55632 },/* 30 30 29 30 30 29 29 30 29 30 29 30 0 355
-1968 */{ 7 , 1 , 30 , 27304 },/* 29 30 30 29 30 29 30 29 30 29 30 29 30 384
-1969 */{ 0 , 2 , 17 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1970 */{ 0 , 2 , 6 , 39632 },/* 30 29 29 30 30 29 30 29 30 30 29 30 0 355
-1971 */{ 5 , 1 , 27 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-1972 */{ 0 , 2 , 15 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1973 */{ 0 , 2 , 3 , 42208 },/* 30 29 30 29 29 30 29 29 30 30 30 29 0 354
-1974 */{ 4 , 1 , 23 , 53864 },/* 30 30 29 30 29 29 30 29 29 30 30 29 30 384
-1975 */{ 0 , 2 , 11 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-1976 */{ 8 , 1 , 31 , 54600 },/* 30 30 29 30 29 30 29 30 29 30 29 29 30 384
-1977 */{ 0 , 2 , 18 , 46400 },/* 30 29 30 30 29 30 29 30 29 30 29 29 0 354
-1978 */{ 0 , 2 , 7 , 54944 },/* 30 30 29 30 29 30 30 29 30 29 30 29 0 355
-1979 */{ 6 , 1 , 28 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 29 384
-1980 */{ 0 , 2 , 16 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1981 */{ 0 , 2 , 5 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1982 */{ 4 , 1 , 25 , 42200 },/* 30 29 30 29 29 30 29 29 30 30 29 30 30 384
-1983 */{ 0 , 2 , 13 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1984 */{ 10 , 2 , 2 , 45656 },/* 30 29 30 30 29 29 30 29 29 30 29 30 30 384
-1985 */{ 0 , 2 , 20 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 0 354
-1986 */{ 0 , 2 , 9 , 27968 },/* 29 30 30 29 30 30 29 30 29 30 29 29 0 354
-1987 */{ 6 , 1 , 29 , 46504 },/* 30 29 30 30 29 30 29 30 30 29 30 29 30 385
-1988 */{ 0 , 2 , 18 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1989 */{ 0 , 2 , 6 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1990 */{ 5 , 1 , 27 , 18872 },/* 29 30 29 29 30 29 29 30 30 29 30 30 30 384
-1991 */{ 0 , 2 , 15 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1992 */{ 0 , 2 , 4 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-1993 */{ 3 , 1 , 23 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 29 383
-1994 */{ 0 , 2 , 10 , 59984 },/* 30 30 30 29 30 29 30 29 29 30 29 30 0 355
-1995 */{ 8 , 1 , 31 , 27976 },/* 29 30 30 29 30 30 29 30 29 30 29 29 30 384
-1996 */{ 0 , 2 , 19 , 23248 },/* 29 30 29 30 30 29 30 29 30 30 29 30 0 355
-1997 */{ 0 , 2 , 8 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1998 */{ 5 , 1 , 28 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 29 384
-1999 */{ 0 , 2 , 16 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-2000 */{ 0 , 2 , 5 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-2001 */{ 4 , 1 , 24 , 58536 },/* 30 30 30 29 29 30 29 29 30 29 30 29 30 384
-2002 */{ 0 , 2 , 12 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-2003 */{ 0 , 2 , 1 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 0 355
-2004 */{ 2 , 1 , 22 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-2005 */{ 0 , 2 , 9 , 22208 },/* 29 30 29 30 29 30 30 29 30 30 29 29 0 354
-2006 */{ 7 , 1 , 29 , 43736 },/* 30 29 30 29 30 29 30 29 30 30 29 30 30 385
-2007 */{ 0 , 2 , 18 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-2008 */{ 0 , 2 , 7 , 37584 },/* 30 29 29 30 29 29 30 29 30 30 29 30 0 354
-2009 */{ 5 , 1 , 26 , 51544 },/* 30 30 29 29 30 29 29 30 29 30 29 30 30 384
-2010 */{ 0 , 2 , 14 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-2011 */{ 0 , 2 , 3 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-2012 */{ 3 , 1 , 23 , 47696 },/* 30 29 30 30 30 29 30 29 29 30 29 30 29 384
-2013 */{ 0 , 2 , 10 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-2014 */{ 9 , 1 , 31 , 21928 },/* 29 30 29 30 29 30 29 30 30 29 30 29 30 384
-2015 */{ 0 , 2 , 19 , 19360 },/* 29 30 29 29 30 29 30 30 30 29 30 29 0 354
-2016 */{ 0 , 2 , 8 , 42416 },/* 30 29 30 29 29 30 29 30 30 29 30 30 0 355
-2017 */{ 5 , 1 , 28 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-2018 */{ 0 , 2 , 16 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-2019 */{ 0 , 2 , 5 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-2020 */{ 4 , 1 , 25 , 46248 },/* 30 29 30 30 29 30 29 29 30 29 30 29 30 384
-2021 */{ 0 , 2 , 12 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-2022 */{ 0 , 2 , 1 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-2023 */{ 2 , 1 , 22 , 21928 },/* 29 30 29 30 29 30 29 30 30 29 30 29 30 384
-2024 */{ 0 , 2 , 10 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-2025 */{ 6 , 1 , 29 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-2026 */{ 0 , 2 , 17 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-2027 */{ 0 , 2 , 7 , 21104 },/* 29 30 29 30 29 29 30 29 29 30 30 30 0 354
-2028 */{ 5 , 1 , 27 , 26928 },/* 29 30 30 29 30 29 29 30 29 29 30 30 29 383
-2029 */{ 0 , 2 , 13 , 55600 },/* 30 30 29 30 30 29 29 30 29 29 30 30 0 355
-2030 */{ 0 , 2 , 3 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-2031 */{ 3 , 1 , 23 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 29 384
-2032 */{ 0 , 2 , 11 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-2033 */{ 11 , 1 , 31 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-2034 */{ 0 , 2 , 19 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-2035 */{ 0 , 2 , 8 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-2036 */{ 6 , 1 , 28 , 53864 },/* 30 30 29 30 29 29 30 29 29 30 30 29 30 384
-2037 */{ 0 , 2 , 15 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-2038 */{ 0 , 2 , 4 , 54560 },/* 30 30 29 30 29 30 29 30 29 29 30 29 0 354
-2039 */{ 5 , 1 , 24 , 55968 },/* 30 30 29 30 30 29 30 29 30 29 30 29 29 384
-2040 */{ 0 , 2 , 12 , 46752 },/* 30 29 30 30 29 30 30 29 30 29 30 29 0 355
-2041 */{ 0 , 2 , 1 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-2042 */{ 2 , 1 , 22 , 19160 },/* 29 30 29 29 30 29 30 29 30 30 29 30 30 384
-2043 */{ 0 , 2 , 10 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-2044 */{ 7 , 1 , 30 , 42168 },/* 30 29 30 29 29 30 29 29 30 29 30 30 30 384
-2045 */{ 0 , 2 , 17 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-2046 */{ 0 , 2 , 6 , 45648 },/* 30 29 30 30 29 29 30 29 29 30 29 30 0 354
-2047 */{ 5 , 1 , 26 , 46376 },/* 30 29 30 30 29 30 29 30 29 29 30 29 30 384
-2048 */{ 0 , 2 , 14 , 27968 },/* 29 30 30 29 30 30 29 30 29 30 29 29 0 354
-2049 */{ 0 , 2 , 2 , 44448 },/* 30 29 30 29 30 30 29 30 30 29 30 29 0 355
- */ };
-
- internal override int MinCalendarYear
- {
- get
- {
- return (MIN_LUNISOLAR_YEAR);
- }
- }
-
- internal override int MaxCalendarYear
- {
- get
- {
- return (MAX_LUNISOLAR_YEAR);
- }
- }
-
- internal override DateTime MinDate
- {
- get
- {
- return (minDate);
- }
- }
-
- internal override DateTime MaxDate
- {
- get
- {
- return (maxDate);
- }
- }
-
- internal override EraInfo[] CalEraInfo
- {
- get
- {
- return (JapaneseCalendar.GetEraInfo());
- }
- }
-
- internal override int GetYearInfo(int lunarYear, int index)
- {
- if ((lunarYear < MIN_LUNISOLAR_YEAR) || (lunarYear > MAX_LUNISOLAR_YEAR))
- {
- throw new ArgumentOutOfRangeException(
- "year",
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- MIN_LUNISOLAR_YEAR,
- MAX_LUNISOLAR_YEAR));
- }
- Contract.EndContractBlock();
-
- return s_yinfo[lunarYear - MIN_LUNISOLAR_YEAR, index];
- }
-
- internal override int GetYear(int year, DateTime time)
- {
- return helper.GetYear(year, time);
- }
-
- internal override int GetGregorianYear(int year, int era)
- {
- return helper.GetGregorianYear(year, era);
- }
-
- // Trim off the eras that are before our date range
- private static EraInfo[] TrimEras(EraInfo[] baseEras)
- {
- EraInfo[] newEras = new EraInfo[baseEras.Length];
- int newIndex = 0;
-
- // Eras have most recent first, so start with that
- for (int i = 0; i < baseEras.Length; i++)
- {
- // If this one's minimum year is bigger than our maximum year
- // then we can't use it.
- if (baseEras[i].yearOffset + baseEras[i].minEraYear >= MAX_LUNISOLAR_YEAR)
- {
- // skip this one.
- continue;
- }
-
- // If this one's maximum era is less than our minimum era
- // then we've gotten too low in the era #s, so we're done
- if (baseEras[i].yearOffset + baseEras[i].maxEraYear < MIN_LUNISOLAR_YEAR)
- {
- break;
- }
-
- // Wasn't too large or too small, can use this one
- newEras[newIndex] = baseEras[i];
- newIndex++;
- }
-
- // If we didn't copy any then something was wrong, just return base
- if (newIndex == 0) return baseEras;
-
- // Resize the output array
- Array.Resize(ref newEras, newIndex);
- return newEras;
- }
-
-
- // Construct an instance of JapaneseLunisolar calendar.
- public JapaneseLunisolarCalendar()
- {
- helper = new GregorianCalendarHelper(this, TrimEras(JapaneseCalendar.GetEraInfo()));
- }
-
-
- public override int GetEra(DateTime time)
- {
- return (helper.GetEra(time));
- }
-
- internal override CalendarId BaseCalendarID
- {
- get
- {
- return (CalendarId.JAPAN);
- }
- }
-
- internal override CalendarId ID
- {
- get
- {
- return (CalendarId.JAPANESELUNISOLAR);
- }
- }
-
-
- public override int[] Eras
- {
- get
- {
- return (helper.Eras);
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/JulianCalendar.cs b/src/mscorlib/corefx/System/Globalization/JulianCalendar.cs
deleted file mode 100644
index 43e6ad07a2..0000000000
--- a/src/mscorlib/corefx/System/Globalization/JulianCalendar.cs
+++ /dev/null
@@ -1,444 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- //
- // This class implements the Julian calendar. In 48 B.C. Julius Caesar ordered a calendar reform, and this calendar
- // is called Julian calendar. It consisted of a solar year of twelve months and of 365 days with an extra day
- // every fourth year.
- //*
- //* Calendar support range:
- //* Calendar Minimum Maximum
- //* ========== ========== ==========
- //* Gregorian 0001/01/01 9999/12/31
- //* Julia 0001/01/03 9999/10/19
-
- [Serializable]
- public class JulianCalendar : Calendar
- {
- public static readonly int JulianEra = 1;
-
- private const int DatePartYear = 0;
- private const int DatePartDayOfYear = 1;
- private const int DatePartMonth = 2;
- private const int DatePartDay = 3;
-
- // Number of days in a non-leap year
- private const int JulianDaysPerYear = 365;
- // Number of days in 4 years
- private const int JulianDaysPer4Years = JulianDaysPerYear * 4 + 1;
-
- private static readonly int[] s_daysToMonth365 =
- {
- 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
- };
-
- private static readonly int[] s_daysToMonth366 =
- {
- 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366
- };
-
- // Gregorian Calendar 9999/12/31 = Julian Calendar 9999/10/19
- // keep it as variable field for serialization compat.
- internal int MaxYear = 9999;
-
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (DateTime.MinValue);
- }
- }
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (DateTime.MaxValue);
- }
- }
-
- public override CalendarAlgorithmType AlgorithmType
- {
- get
- {
- return CalendarAlgorithmType.SolarCalendar;
- }
- }
-
- public JulianCalendar()
- {
- // There is no system setting of TwoDigitYear max, so set the value here.
- twoDigitYearMax = 2029;
- }
-
- internal override CalendarId ID
- {
- get
- {
- return CalendarId.JULIAN;
- }
- }
-
- internal static void CheckEraRange(int era)
- {
- if (era != CurrentEra && era != JulianEra)
- {
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
- }
-
- internal void CheckYearEraRange(int year, int era)
- {
- CheckEraRange(era);
- if (year <= 0 || year > MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- MaxYear));
- }
- }
-
- internal static void CheckMonthRange(int month)
- {
- if (month < 1 || month > 12)
- {
- throw new ArgumentOutOfRangeException(nameof(month), SR.ArgumentOutOfRange_Month);
- }
- }
-
- /*===================================CheckDayRange============================
- **Action: Check for if the day value is valid.
- **Returns:
- **Arguments:
- **Exceptions:
- **Notes:
- ** Before calling this method, call CheckYearEraRange()/CheckMonthRange() to make
- ** sure year/month values are correct.
- ============================================================================*/
-
- internal static void CheckDayRange(int year, int month, int day)
- {
- if (year == 1 && month == 1)
- {
- // The mimimum supported Julia date is Julian 0001/01/03.
- if (day < 3)
- {
- throw new ArgumentOutOfRangeException(null,
- SR.ArgumentOutOfRange_BadYearMonthDay);
- }
- }
- bool isLeapYear = (year % 4) == 0;
- int[] days = isLeapYear ? s_daysToMonth366 : s_daysToMonth365;
- int monthDays = days[month] - days[month - 1];
- if (day < 1 || day > monthDays)
- {
- throw new ArgumentOutOfRangeException(
- nameof(day),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- monthDays));
- }
- }
-
-
- // Returns a given date part of this DateTime. This method is used
- // to compute the year, day-of-year, month, or day part.
- internal static int GetDatePart(long ticks, int part)
- {
- // Gregorian 1/1/0001 is Julian 1/3/0001. Remember DateTime(0) is refered to Gregorian 1/1/0001.
- // The following line convert Gregorian ticks to Julian ticks.
- long julianTicks = ticks + TicksPerDay * 2;
- // n = number of days since 1/1/0001
- int n = (int)(julianTicks / TicksPerDay);
- // y4 = number of whole 4-year periods within 100-year period
- int y4 = n / JulianDaysPer4Years;
- // n = day number within 4-year period
- n -= y4 * JulianDaysPer4Years;
- // y1 = number of whole years within 4-year period
- int y1 = n / JulianDaysPerYear;
- // Last year has an extra day, so decrement result if 4
- if (y1 == 4) y1 = 3;
- // If year was requested, compute and return it
- if (part == DatePartYear)
- {
- return (y4 * 4 + y1 + 1);
- }
- // n = day number within year
- n -= y1 * JulianDaysPerYear;
- // If day-of-year was requested, return it
- if (part == DatePartDayOfYear)
- {
- return (n + 1);
- }
- // Leap year calculation looks different from IsLeapYear since y1, y4,
- // and y100 are relative to year 1, not year 0
- bool leapYear = (y1 == 3);
- int[] days = leapYear ? s_daysToMonth366 : s_daysToMonth365;
- // All months have less than 32 days, so n >> 5 is a good conservative
- // estimate for the month
- int m = (n >> 5) + 1;
- // m = 1-based month number
- while (n >= days[m]) m++;
- // If month was requested, return it
- if (part == DatePartMonth) return (m);
- // Return 1-based day-of-month
- return (n - days[m - 1] + 1);
- }
-
- // Returns the tick count corresponding to the given year, month, and day.
- internal static long DateToTicks(int year, int month, int day)
- {
- int[] days = (year % 4 == 0) ? s_daysToMonth366 : s_daysToMonth365;
- int y = year - 1;
- int n = y * 365 + y / 4 + days[month - 1] + day - 1;
- // Gregorian 1/1/0001 is Julian 1/3/0001. n * TicksPerDay is the ticks in JulianCalendar.
- // Therefore, we subtract two days in the following to convert the ticks in JulianCalendar
- // to ticks in Gregorian calendar.
- return ((n - 2) * TicksPerDay);
- }
-
-
- public override DateTime AddMonths(DateTime time, int months)
- {
- if (months < -120000 || months > 120000)
- {
- throw new ArgumentOutOfRangeException(
- nameof(months),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- -120000,
- 120000));
- }
- Contract.EndContractBlock();
- int y = GetDatePart(time.Ticks, DatePartYear);
- int m = GetDatePart(time.Ticks, DatePartMonth);
- int d = GetDatePart(time.Ticks, DatePartDay);
- int i = m - 1 + months;
- if (i >= 0)
- {
- m = i % 12 + 1;
- y = y + i / 12;
- }
- else
- {
- m = 12 + (i + 1) % 12;
- y = y + (i - 11) / 12;
- }
- int[] daysArray = (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) ? s_daysToMonth366 : s_daysToMonth365;
- int days = (daysArray[m] - daysArray[m - 1]);
-
- if (d > days)
- {
- d = days;
- }
- long ticks = DateToTicks(y, m, d) + time.Ticks % TicksPerDay;
- Calendar.CheckAddResult(ticks, MinSupportedDateTime, MaxSupportedDateTime);
- return (new DateTime(ticks));
- }
-
-
- public override DateTime AddYears(DateTime time, int years)
- {
- return (AddMonths(time, years * 12));
- }
-
-
- public override int GetDayOfMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDay));
- }
-
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- return ((DayOfWeek)((int)(time.Ticks / TicksPerDay + 1) % 7));
- }
-
-
- public override int GetDayOfYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDayOfYear));
- }
-
-
- public override int GetDaysInMonth(int year, int month, int era)
- {
- CheckYearEraRange(year, era);
- CheckMonthRange(month);
- int[] days = (year % 4 == 0) ? s_daysToMonth366 : s_daysToMonth365;
- return (days[month] - days[month - 1]);
- }
-
-
- public override int GetDaysInYear(int year, int era)
- {
- // Year/Era range is done in IsLeapYear().
- return (IsLeapYear(year, era) ? 366 : 365);
- }
-
-
- public override int GetEra(DateTime time)
- {
- return (JulianEra);
- }
-
-
- public override int GetMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartMonth));
- }
-
-
- public override int[] Eras
- {
- get
- {
- return (new int[] { JulianEra });
- }
- }
-
-
- public override int GetMonthsInYear(int year, int era)
- {
- CheckYearEraRange(year, era);
- return (12);
- }
-
-
- public override int GetYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartYear));
- }
-
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- CheckMonthRange(month);
- // Year/Era range check is done in IsLeapYear().
- if (IsLeapYear(year, era))
- {
- CheckDayRange(year, month, day);
- return (month == 2 && day == 29);
- }
- CheckDayRange(year, month, day);
- return (false);
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
-
- public override int GetLeapMonth(int year, int era)
- {
- CheckYearEraRange(year, era);
- return (0);
- }
-
-
- public override bool IsLeapMonth(int year, int month, int era)
- {
- CheckYearEraRange(year, era);
- CheckMonthRange(month);
- return (false);
- }
-
- // Checks whether a given year in the specified era is a leap year. This method returns true if
- // year is a leap year, or false if not.
- //
-
- public override bool IsLeapYear(int year, int era)
- {
- CheckYearEraRange(year, era);
- return (year % 4 == 0);
- }
-
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- CheckYearEraRange(year, era);
- CheckMonthRange(month);
- CheckDayRange(year, month, day);
- if (millisecond < 0 || millisecond >= MillisPerSecond)
- {
- throw new ArgumentOutOfRangeException(
- nameof(millisecond),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 0,
- MillisPerSecond - 1));
- }
-
- if (hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >= 0 && second < 60)
- {
- return new DateTime(DateToTicks(year, month, day) + (new TimeSpan(0, hour, minute, second, millisecond)).Ticks);
- }
- else
- {
- throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadHourMinuteSecond);
- }
- }
-
-
- public override int TwoDigitYearMax
- {
- get
- {
- return (twoDigitYearMax);
- }
-
- set
- {
- VerifyWritable();
- if (value < 99 || value > MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- "year",
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 99,
- MaxYear));
- }
- twoDigitYearMax = value;
- }
- }
-
-
- public override int ToFourDigitYear(int year)
- {
- if (year < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedNonNegNum);
- }
- Contract.EndContractBlock();
-
- if (year > MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Bounds_Lower_Upper,
- 1,
- MaxYear));
- }
- return (base.ToFourDigitYear(year));
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/KoreanCalendar.cs b/src/mscorlib/corefx/System/Globalization/KoreanCalendar.cs
deleted file mode 100644
index b015aa0716..0000000000
--- a/src/mscorlib/corefx/System/Globalization/KoreanCalendar.cs
+++ /dev/null
@@ -1,267 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- /*=================================KoreanCalendar==========================
- **
- ** Korean calendar is based on the Gregorian calendar. And the year is an offset to Gregorian calendar.
- ** That is,
- ** Korean year = Gregorian year + 2333. So 2000/01/01 A.D. is Korean 4333/01/01
- **
- ** 0001/1/1 A.D. is Korean year 2334.
- **
- ** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 0001/01/01 9999/12/31
- ** Korean 2334/01/01 12332/12/31
- ============================================================================*/
-
-
- [Serializable]
- public class KoreanCalendar : Calendar
- {
- //
- // The era value for the current era.
- //
-
- public const int KoreanEra = 1;
-
- // Since
- // Gregorian Year = Era Year + yearOffset
- // Gregorian Year 1 is Korean year 2334, so that
- // 1 = 2334 + yearOffset
- // So yearOffset = -2333
- // Gregorian year 2001 is Korean year 4334.
-
- //m_EraInfo[0] = new EraInfo(1, new DateTime(1, 1, 1).Ticks, -2333, 2334, GregorianCalendar.MaxYear + 2333);
-
- // Initialize our era info.
- internal static EraInfo[] koreanEraInfo = new EraInfo[] {
- new EraInfo( 1, 1, 1, 1, -2333, 2334, GregorianCalendar.MaxYear + 2333) // era #, start year/month/day, yearOffset, minEraYear
- };
-
- internal GregorianCalendarHelper helper;
-
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (DateTime.MinValue);
- }
- }
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (DateTime.MaxValue);
- }
- }
-
- public override CalendarAlgorithmType AlgorithmType
- {
- get
- {
- return CalendarAlgorithmType.SolarCalendar;
- }
- }
-
- public KoreanCalendar()
- {
- try
- {
- new CultureInfo("ko-KR");
- }
- catch (ArgumentException e)
- {
- throw new TypeInitializationException(this.GetType().ToString(), e);
- }
- helper = new GregorianCalendarHelper(this, koreanEraInfo);
- }
-
- internal override CalendarId ID
- {
- get
- {
- return CalendarId.KOREA;
- }
- }
-
-
- public override DateTime AddMonths(DateTime time, int months)
- {
- return (helper.AddMonths(time, months));
- }
-
-
- public override DateTime AddYears(DateTime time, int years)
- {
- return (helper.AddYears(time, years));
- }
-
- /*=================================GetDaysInMonth==========================
- **Action: Returns the number of days in the month given by the year and month arguments.
- **Returns: The number of days in the given month.
- **Arguments:
- ** year The year in Korean calendar.
- ** month The month
- ** era The Japanese era value.
- **Exceptions
- ** ArgumentException If month is less than 1 or greater * than 12.
- ============================================================================*/
-
-
- public override int GetDaysInMonth(int year, int month, int era)
- {
- return (helper.GetDaysInMonth(year, month, era));
- }
-
-
- public override int GetDaysInYear(int year, int era)
- {
- return (helper.GetDaysInYear(year, era));
- }
-
-
- public override int GetDayOfMonth(DateTime time)
- {
- return (helper.GetDayOfMonth(time));
- }
-
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- return (helper.GetDayOfWeek(time));
- }
-
-
- public override int GetDayOfYear(DateTime time)
- {
- return (helper.GetDayOfYear(time));
- }
-
-
- public override int GetMonthsInYear(int year, int era)
- {
- return (helper.GetMonthsInYear(year, era));
- }
-
-
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
- public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
- {
- return (helper.GetWeekOfYear(time, rule, firstDayOfWeek));
- }
-
-
- public override int GetEra(DateTime time)
- {
- return (helper.GetEra(time));
- }
-
- public override int GetMonth(DateTime time)
- {
- return (helper.GetMonth(time));
- }
-
-
- public override int GetYear(DateTime time)
- {
- return (helper.GetYear(time));
- }
-
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- return (helper.IsLeapDay(year, month, day, era));
- }
-
-
- public override bool IsLeapYear(int year, int era)
- {
- return (helper.IsLeapYear(year, era));
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
-
- public override int GetLeapMonth(int year, int era)
- {
- return (helper.GetLeapMonth(year, era));
- }
-
-
- public override bool IsLeapMonth(int year, int month, int era)
- {
- return (helper.IsLeapMonth(year, month, era));
- }
-
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- return (helper.ToDateTime(year, month, day, hour, minute, second, millisecond, era));
- }
-
-
- public override int[] Eras
- {
- get
- {
- return (helper.Eras);
- }
- }
-
- private const int DEFAULT_TWO_DIGIT_YEAR_MAX = 4362;
-
-
- public override int TwoDigitYearMax
- {
- get
- {
- if (twoDigitYearMax == -1)
- {
- twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
- }
- return (twoDigitYearMax);
- }
-
- set
- {
- VerifyWritable();
- if (value < 99 || value > helper.MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- "year",
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 99,
- helper.MaxYear));
- }
- twoDigitYearMax = value;
- }
- }
-
-
- public override int ToFourDigitYear(int year)
- {
- if (year < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedNonNegNum);
- }
- Contract.EndContractBlock();
-
- return (helper.ToFourDigitYear(year, this.TwoDigitYearMax));
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/KoreanLunisolarCalendar.cs b/src/mscorlib/corefx/System/Globalization/KoreanLunisolarCalendar.cs
deleted file mode 100644
index 6d091285b2..0000000000
--- a/src/mscorlib/corefx/System/Globalization/KoreanLunisolarCalendar.cs
+++ /dev/null
@@ -1,1329 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about KoreanLunisolarCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
- /*
- ** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 918/02/14 2051/02/10
- ** KoreanLunisolar 918/01/01 2050/13/29
- */
-
- [Serializable]
- public class KoreanLunisolarCalendar : EastAsianLunisolarCalendar
- {
- //
- // The era value for the current era.
- //
-
- public const int GregorianEra = 1;
-
- internal const int MIN_LUNISOLAR_YEAR = 918;
- internal const int MAX_LUNISOLAR_YEAR = 2050;
-
- internal const int MIN_GREGORIAN_YEAR = 918;
- internal const int MIN_GREGORIAN_MONTH = 2;
- internal const int MIN_GREGORIAN_DAY = 14;
-
- internal const int MAX_GREGORIAN_YEAR = 2051;
- internal const int MAX_GREGORIAN_MONTH = 2;
- internal const int MAX_GREGORIAN_DAY = 10;
-
- internal static DateTime minDate = new DateTime(MIN_GREGORIAN_YEAR, MIN_GREGORIAN_MONTH, MIN_GREGORIAN_DAY);
- internal static DateTime maxDate = new DateTime((new DateTime(MAX_GREGORIAN_YEAR, MAX_GREGORIAN_MONTH, MAX_GREGORIAN_DAY, 23, 59, 59, 999)).Ticks + 9999);
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (minDate);
- }
- }
-
-
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (maxDate);
- }
- }
-
- protected override int DaysInYearBeforeMinSupportedYear
- {
- get
- {
- // 917 -- From http://emr.cs.iit.edu/home/reingold/calendar-book/Calendrica.html
- // using ChineseLunisolar
- return 384;
- }
- }
-
- private static readonly int[,] s_yinfo =
- {
- /*Y LM Lmon Lday DaysPerMonth D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 #Days
- 918 */
- { 0 , 2 , 14 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 0 355
-919 */{ 0 , 2 , 4 , 17872 },/* 29 30 29 29 29 30 29 30 30 30 29 30 0 354
-920 */{ 6 , 1 , 24 , 41688 },/* 30 29 30 29 29 29 30 29 30 30 29 30 30 384
-921 */{ 0 , 2 , 11 , 41648 },/* 30 29 30 29 29 29 30 29 30 29 30 30 0 354
-922 */{ 0 , 1 , 31 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-923 */{ 4 , 1 , 20 , 46248 },/* 30 29 30 30 29 30 29 29 30 29 30 29 30 384
-924 */{ 0 , 2 , 8 , 27936 },/* 29 30 30 29 30 30 29 30 29 29 30 29 0 354
-925 */{ 12 , 1 , 27 , 44384 },/* 30 29 30 29 30 30 29 30 29 30 30 29 29 384
-926 */{ 0 , 2 , 15 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-927 */{ 0 , 2 , 5 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 0 355
-928 */{ 8 , 1 , 26 , 17848 },/* 29 30 29 29 29 30 29 30 30 29 30 30 30 384
-929 */{ 0 , 2 , 13 , 17776 },/* 29 30 29 29 29 30 29 30 29 30 30 30 0 354
-930 */{ 0 , 2 , 2 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-931 */{ 5 , 1 , 22 , 26960 },/* 29 30 30 29 30 29 29 30 29 30 29 30 29 383
-932 */{ 0 , 2 , 9 , 59728 },/* 30 30 30 29 30 29 29 30 29 30 29 30 0 355
-933 */{ 0 , 1 , 29 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-934 */{ 1 , 1 , 18 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 29 384
-935 */{ 0 , 2 , 6 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-936 */{ 11 , 1 , 27 , 21344 },/* 29 30 29 30 29 29 30 30 29 30 30 29 29 383
-937 */{ 0 , 2 , 13 , 51904 },/* 30 30 29 29 30 29 30 29 30 30 29 29 0 354
-938 */{ 0 , 2 , 2 , 58720 },/* 30 30 30 29 29 30 29 30 29 30 30 29 0 355
-939 */{ 7 , 1 , 23 , 53928 },/* 30 30 29 30 29 29 30 29 30 29 30 29 30 384
-940 */{ 0 , 2 , 11 , 53920 },/* 30 30 29 30 29 29 30 29 30 29 30 29 0 354
-941 */{ 0 , 1 , 30 , 55632 },/* 30 30 29 30 30 29 29 30 29 30 29 30 0 355
-942 */{ 3 , 1 , 20 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-943 */{ 0 , 2 , 8 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-944 */{ 12 , 1 , 28 , 42704 },/* 30 29 30 29 29 30 30 29 30 30 29 30 29 384
-945 */{ 0 , 2 , 15 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 0 355
-946 */{ 0 , 2 , 5 , 19152 },/* 29 30 29 29 30 29 30 29 30 30 29 30 0 354
-947 */{ 7 , 1 , 25 , 42200 },/* 30 29 30 29 29 30 29 29 30 30 29 30 30 384
-948 */{ 0 , 2 , 13 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-949 */{ 0 , 2 , 1 , 45664 },/* 30 29 30 30 29 29 30 29 29 30 30 29 0 354
-950 */{ 5 , 1 , 21 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-951 */{ 0 , 2 , 9 , 45936 },/* 30 29 30 30 29 30 29 30 29 30 29 0 0 325
-952 */{ 0 , 12 , 31 , 43728 },/* 30 29 30 29 30 29 30 29 30 30 29 30 29 384
-953 */{ 1 , 1 , 18 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 29 384
-954 */{ 0 , 2 , 6 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-955 */{ 9 , 1 , 27 , 19128 },/* 29 30 29 29 30 29 30 29 30 29 30 30 30 384
-956 */{ 0 , 2 , 15 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-957 */{ 0 , 2 , 3 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-958 */{ 7 , 1 , 23 , 43672 },/* 30 29 30 29 30 29 30 29 30 29 29 30 30 384
-959 */{ 0 , 2 , 11 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-960 */{ 0 , 1 , 31 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-961 */{ 3 , 1 , 20 , 19880 },/* 29 30 29 29 30 30 29 30 30 29 30 29 30 384
-962 */{ 0 , 2 , 8 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-963 */{ 12 , 1 , 28 , 38256 },/* 30 29 29 30 29 30 29 30 29 30 30 30 29 384
-964 */{ 0 , 2 , 16 , 41840 },/* 30 29 30 29 29 29 30 30 29 30 30 30 0 355
-965 */{ 0 , 2 , 5 , 20848 },/* 29 30 29 30 29 29 29 30 29 30 30 30 0 354
-966 */{ 8 , 1 , 25 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 29 383
-967 */{ 0 , 2 , 12 , 54448 },/* 30 30 29 30 29 30 29 29 30 29 30 30 0 355
-968 */{ 0 , 2 , 2 , 23184 },/* 29 30 29 30 30 29 30 29 30 29 29 30 0 354
-969 */{ 5 , 1 , 21 , 27472 },/* 29 30 30 29 30 29 30 30 29 30 29 30 29 384
-970 */{ 0 , 2 , 9 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-971 */{ 0 , 1 , 30 , 10976 },/* 29 29 30 29 30 29 30 29 30 30 30 29 0 354
-972 */{ 2 , 1 , 19 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 29 384
-973 */{ 0 , 2 , 6 , 41696 },/* 30 29 30 29 29 29 30 29 30 30 30 29 0 354
-974 */{ 10 , 1 , 26 , 51560 },/* 30 30 29 29 30 29 29 30 29 30 30 29 30 384
-975 */{ 0 , 2 , 14 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-976 */{ 0 , 2 , 3 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-977 */{ 7 , 1 , 22 , 55952 },/* 30 30 29 30 30 29 30 29 30 29 29 30 29 384
-978 */{ 0 , 2 , 10 , 46496 },/* 30 29 30 30 29 30 29 30 30 29 30 29 0 355
-979 */{ 0 , 1 , 31 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-980 */{ 3 , 1 , 21 , 10968 },/* 29 29 30 29 30 29 30 29 30 30 29 30 30 384
-981 */{ 0 , 2 , 8 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-982 */{ 12 , 1 , 28 , 37592 },/* 30 29 29 30 29 29 30 29 30 30 29 30 30 384
-983 */{ 0 , 2 , 16 , 37552 },/* 30 29 29 30 29 29 30 29 30 29 30 30 0 354
-984 */{ 0 , 2 , 5 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-985 */{ 9 , 1 , 24 , 46248 },/* 30 29 30 30 29 30 29 29 30 29 30 29 30 384
-986 */{ 0 , 2 , 12 , 44192 },/* 30 29 30 29 30 30 29 29 30 29 30 29 0 354
-987 */{ 0 , 2 , 1 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-988 */{ 5 , 1 , 22 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 29 384
-989 */{ 0 , 2 , 9 , 19376 },/* 29 30 29 29 30 29 30 30 30 29 30 30 0 355
-990 */{ 0 , 1 , 30 , 9648 },/* 29 29 30 29 29 30 29 30 30 29 30 30 0 354
-991 */{ 2 , 1 , 19 , 37560 },/* 30 29 29 30 29 29 30 29 30 29 30 30 30 384
-992 */{ 0 , 2 , 7 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-993 */{ 10 , 1 , 26 , 26968 },/* 29 30 30 29 30 29 29 30 29 30 29 30 30 384
-994 */{ 0 , 2 , 14 , 22864 },/* 29 30 29 30 30 29 29 30 29 30 29 30 0 354
-995 */{ 0 , 2 , 3 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-996 */{ 7 , 1 , 23 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 29 384
-997 */{ 0 , 2 , 10 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-998 */{ 0 , 1 , 31 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-999 */{ 3 , 1 , 20 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-1000 */{ 0 , 2 , 8 , 9584 },/* 29 29 30 29 29 30 29 30 29 30 30 30 0 354
-1001 */{ 12 , 1 , 28 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 29 383
-1002 */{ 0 , 2 , 15 , 53920 },/* 30 30 29 30 29 29 30 29 30 29 30 29 0 354
-1003 */{ 0 , 2 , 4 , 54608 },/* 30 30 29 30 29 30 29 30 29 30 29 30 0 355
-1004 */{ 9 , 1 , 25 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-1005 */{ 0 , 2 , 12 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1006 */{ 0 , 2 , 1 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-1007 */{ 5 , 1 , 22 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-1008 */{ 0 , 2 , 10 , 19152 },/* 29 30 29 29 30 29 30 29 30 30 29 30 0 354
-1009 */{ 0 , 1 , 29 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1010 */{ 2 , 1 , 18 , 53864 },/* 30 30 29 30 29 29 30 29 29 30 30 29 30 384
-1011 */{ 0 , 2 , 6 , 45664 },/* 30 29 30 30 29 29 30 29 29 30 30 29 0 354
-1012 */{ 10 , 1 , 26 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-1013 */{ 0 , 2 , 13 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-1014 */{ 0 , 2 , 3 , 13728 },/* 29 29 30 30 29 30 29 30 30 29 30 29 0 354
-1015 */{ 6 , 1 , 23 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 29 384
-1016 */{ 0 , 2 , 11 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1017 */{ 0 , 1 , 31 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1018 */{ 4 , 1 , 20 , 42200 },/* 30 29 30 29 29 30 29 29 30 30 29 30 30 384
-1019 */{ 0 , 2 , 8 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1020 */{ 12 , 1 , 28 , 43608 },/* 30 29 30 29 30 29 30 29 29 30 29 30 30 384
-1021 */{ 0 , 2 , 15 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1022 */{ 0 , 2 , 4 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-1023 */{ 9 , 1 , 25 , 11688 },/* 29 29 30 29 30 30 29 30 30 29 30 29 30 384
-1024 */{ 0 , 2 , 13 , 11088 },/* 29 29 30 29 30 29 30 30 29 30 29 30 0 354
-1025 */{ 0 , 2 , 1 , 38256 },/* 30 29 29 30 29 30 29 30 29 30 30 30 0 355
-1026 */{ 5 , 1 , 22 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 29 383
-1027 */{ 0 , 2 , 9 , 51568 },/* 30 30 29 29 30 29 29 30 29 30 30 30 0 355
-1028 */{ 0 , 1 , 30 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-1029 */{ 2 , 1 , 18 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 29 383
-1030 */{ 0 , 2 , 5 , 55952 },/* 30 30 29 30 30 29 30 29 30 29 29 30 0 355
-1031 */{ 10 , 1 , 26 , 27472 },/* 29 30 30 29 30 29 30 30 29 30 29 30 29 384
-1032 */{ 0 , 2 , 14 , 26320 },/* 29 30 30 29 29 30 30 29 30 30 29 30 0 355
-1033 */{ 0 , 2 , 3 , 9952 },/* 29 29 30 29 29 30 30 29 30 30 30 29 0 354
-1034 */{ 6 , 1 , 23 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 29 384
-1035 */{ 0 , 2 , 11 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1036 */{ 0 , 1 , 31 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-1037 */{ 4 , 1 , 19 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1038 */{ 0 , 2 , 7 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1039 */{ 12 , 1 , 27 , 54928 },/* 30 30 29 30 29 30 30 29 30 29 29 30 29 384
-1040 */{ 0 , 2 , 15 , 46464 },/* 30 29 30 30 29 30 29 30 30 29 29 29 0 354
-1041 */{ 0 , 2 , 3 , 54960 },/* 30 30 29 30 29 30 30 29 30 29 30 30 0 356
-1042 */{ 9 , 1 , 25 , 9944 },/* 29 29 30 29 29 30 30 29 30 30 29 30 30 384
-1043 */{ 0 , 2 , 13 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-1044 */{ 0 , 2 , 2 , 37552 },/* 30 29 29 30 29 29 30 29 30 29 30 30 0 354
-1045 */{ 5 , 1 , 21 , 43352 },/* 30 29 30 29 30 29 29 30 29 30 29 30 30 384
-1046 */{ 0 , 2 , 9 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1047 */{ 0 , 1 , 29 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-1048 */{ 1 , 1 , 18 , 46424 },/* 30 29 30 30 29 30 29 30 29 30 29 30 30 385
-1049 */{ 0 , 2 , 6 , 11600 },/* 29 29 30 29 30 30 29 30 29 30 29 30 0 354
-1050 */{ 11 , 1 , 26 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 29 384
-1051 */{ 0 , 2 , 14 , 19376 },/* 29 30 29 29 30 29 30 30 30 29 30 30 0 355
-1052 */{ 0 , 2 , 4 , 9648 },/* 29 29 30 29 29 30 29 30 30 29 30 30 0 354
-1053 */{ 7 , 1 , 23 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-1054 */{ 0 , 2 , 11 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1055 */{ 0 , 1 , 31 , 26960 },/* 29 30 30 29 30 29 29 30 29 30 29 30 0 354
-1056 */{ 3 , 1 , 20 , 27304 },/* 29 30 30 29 30 29 30 29 30 29 30 29 30 384
-1057 */{ 0 , 2 , 7 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1058 */{ 12 , 1 , 27 , 43864 },/* 30 29 30 29 30 29 30 30 29 30 29 30 30 385
-1059 */{ 0 , 2 , 16 , 10064 },/* 29 29 30 29 29 30 30 30 29 30 29 30 0 354
-1060 */{ 0 , 2 , 5 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-1061 */{ 8 , 1 , 24 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-1062 */{ 0 , 2 , 12 , 42336 },/* 30 29 30 29 29 30 29 30 29 30 30 29 0 354
-1063 */{ 0 , 2 , 1 , 53856 },/* 30 30 29 30 29 29 30 29 29 30 30 29 0 354
-1064 */{ 5 , 1 , 21 , 59696 },/* 30 30 30 29 30 29 29 30 29 29 30 30 29 384
-1065 */{ 0 , 2 , 8 , 54608 },/* 30 30 29 30 29 30 29 30 29 30 29 30 0 355
-1066 */{ 0 , 1 , 29 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1067 */{ 1 , 1 , 18 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 29 384
-1068 */{ 0 , 2 , 6 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-1069 */{ 11 , 1 , 26 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-1070 */{ 0 , 2 , 14 , 18896 },/* 29 30 29 29 30 29 29 30 30 30 29 30 0 354
-1071 */{ 0 , 2 , 3 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1072 */{ 7 , 1 , 23 , 53864 },/* 30 30 29 30 29 29 30 29 29 30 30 29 30 384
-1073 */{ 0 , 2 , 10 , 43616 },/* 30 29 30 29 30 29 30 29 29 30 30 29 0 354
-1074 */{ 0 , 1 , 30 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1075 */{ 4 , 1 , 20 , 22184 },/* 29 30 29 30 29 30 30 29 30 29 30 29 30 384
-1076 */{ 0 , 2 , 8 , 13728 },/* 29 29 30 30 29 30 29 30 30 29 30 29 0 354
-1077 */{ 0 , 1 , 27 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 0 355
-1078 */{ 1 , 1 , 17 , 19352 },/* 29 30 29 29 30 29 30 30 30 29 29 30 30 384
-1079 */{ 0 , 2 , 5 , 17840 },/* 29 30 29 29 29 30 29 30 30 29 30 30 0 354
-1080 */{ 9 , 1 , 25 , 42168 },/* 30 29 30 29 29 30 29 29 30 29 30 30 30 384
-1081 */{ 0 , 2 , 12 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-1082 */{ 0 , 2 , 1 , 43600 },/* 30 29 30 29 30 29 30 29 29 30 29 30 0 354
-1083 */{ 6 , 1 , 21 , 46408 },/* 30 29 30 30 29 30 29 30 29 30 29 29 30 384
-1084 */{ 0 , 2 , 9 , 27472 },/* 29 30 30 29 30 29 30 30 29 30 29 30 0 355
-1085 */{ 0 , 1 , 29 , 11680 },/* 29 29 30 29 30 30 29 30 30 29 30 29 0 354
-1086 */{ 2 , 1 , 18 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 29 384
-1087 */{ 0 , 2 , 6 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 0 355
-1088 */{ 12 , 1 , 27 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 29 383
-1089 */{ 0 , 2 , 13 , 51568 },/* 30 30 29 29 30 29 29 30 29 30 30 30 0 355
-1090 */{ 0 , 2 , 3 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-1091 */{ 8 , 1 , 23 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 29 383
-1092 */{ 0 , 2 , 10 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 0 355
-1093 */{ 0 , 1 , 30 , 23360 },/* 29 30 29 30 30 29 30 30 29 30 29 29 0 354
-1094 */{ 4 , 1 , 19 , 43880 },/* 30 29 30 29 30 29 30 30 29 30 30 29 30 385
-1095 */{ 0 , 2 , 8 , 10976 },/* 29 29 30 29 30 29 30 29 30 30 30 29 0 354
-1096 */{ 0 , 1 , 28 , 58896 },/* 30 30 30 29 29 30 30 29 29 29 29 30 0 354
-1097 */{ 2 , 1 , 16 , 51568 },/* 30 30 29 29 30 29 29 30 29 30 30 30 29 384
-1098 */{ 0 , 2 , 4 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-1099 */{ 9 , 1 , 24 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1100 */{ 0 , 2 , 12 , 21664 },/* 29 30 29 30 29 30 29 29 30 29 30 29 0 353
-1101 */{ 0 , 1 , 31 , 54864 },/* 30 30 29 30 29 30 30 29 29 30 29 30 0 355
-1102 */{ 6 , 1 , 21 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-1103 */{ 0 , 2 , 9 , 21968 },/* 29 30 29 30 29 30 29 30 30 30 29 30 0 355
-1104 */{ 0 , 1 , 30 , 9936 },/* 29 29 30 29 29 30 30 29 30 30 29 30 0 354
-1105 */{ 2 , 1 , 18 , 37608 },/* 30 29 29 30 29 29 30 29 30 30 30 29 30 384
-1106 */{ 0 , 2 , 6 , 37552 },/* 30 29 29 30 29 29 30 29 30 29 30 30 0 354
-1107 */{ 10 , 1 , 26 , 43352 },/* 30 29 30 29 30 29 29 30 29 30 29 30 30 384
-1108 */{ 0 , 2 , 14 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1109 */{ 0 , 2 , 2 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-1110 */{ 8 , 1 , 22 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-1111 */{ 0 , 2 , 10 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-1112 */{ 0 , 1 , 31 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 0 355
-1113 */{ 4 , 1 , 20 , 9656 },/* 29 29 30 29 29 30 29 30 30 29 30 30 30 384
-1114 */{ 0 , 2 , 8 , 17776 },/* 29 30 29 29 29 30 29 30 29 30 30 30 0 354
-1115 */{ 0 , 1 , 28 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1116 */{ 1 , 1 , 17 , 43352 },/* 30 29 30 29 30 29 29 30 29 30 29 30 30 384
-1117 */{ 0 , 2 , 4 , 26960 },/* 29 30 30 29 30 29 29 30 29 30 29 30 0 354
-1118 */{ 9 , 1 , 24 , 29352 },/* 29 30 30 30 29 29 30 29 30 29 30 29 30 384
-1119 */{ 0 , 2 , 12 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1120 */{ 0 , 2 , 1 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1121 */{ 5 , 1 , 21 , 19304 },/* 29 30 29 29 30 29 30 30 29 30 30 29 30 384
-1122 */{ 0 , 2 , 9 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-1123 */{ 0 , 1 , 29 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1124 */{ 3 , 1 , 19 , 21104 },/* 29 30 29 30 29 29 30 29 29 30 30 30 29 383
-1125 */{ 0 , 2 , 5 , 53856 },/* 30 30 29 30 29 29 30 29 29 30 30 29 0 354
-1126 */{ 11 , 1 , 25 , 59696 },/* 30 30 30 29 30 29 29 30 29 29 30 30 29 384
-1127 */{ 0 , 2 , 13 , 54608 },/* 30 30 29 30 29 30 29 30 29 30 29 30 0 355
-1128 */{ 0 , 2 , 3 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1129 */{ 8 , 1 , 22 , 39824 },/* 30 29 29 30 30 29 30 30 30 29 29 30 29 384
-1130 */{ 0 , 2 , 10 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-1131 */{ 0 , 1 , 31 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1132 */{ 4 , 1 , 20 , 42216 },/* 30 29 30 29 29 30 29 29 30 30 30 29 30 384
-1133 */{ 0 , 2 , 7 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1134 */{ 0 , 1 , 27 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-1135 */{ 2 , 1 , 16 , 55592 },/* 30 30 29 30 30 29 29 30 29 29 30 29 30 384
-1136 */{ 0 , 2 , 4 , 46400 },/* 30 29 30 30 29 30 29 30 29 30 29 29 0 354
-1137 */{ 10 , 1 , 23 , 54952 },/* 30 30 29 30 29 30 30 29 30 29 30 29 30 385
-1138 */{ 0 , 2 , 12 , 11680 },/* 29 29 30 29 30 30 29 30 30 29 30 29 0 354
-1139 */{ 0 , 2 , 1 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 0 355
-1140 */{ 6 , 1 , 22 , 19160 },/* 29 30 29 29 30 29 30 29 30 30 29 30 30 384
-1141 */{ 0 , 2 , 9 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1142 */{ 0 , 1 , 29 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1143 */{ 4 , 1 , 18 , 45656 },/* 30 29 30 30 29 29 30 29 29 30 29 30 30 384
-1144 */{ 0 , 2 , 6 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 0 354
-1145 */{ 11 , 1 , 25 , 46376 },/* 30 29 30 30 29 30 29 30 29 29 30 29 30 384
-1146 */{ 0 , 2 , 13 , 27456 },/* 29 30 30 29 30 29 30 30 29 30 29 29 0 354
-1147 */{ 0 , 2 , 2 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-1148 */{ 8 , 1 , 23 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 29 384
-1149 */{ 0 , 2 , 10 , 39280 },/* 30 29 29 30 30 29 29 30 29 30 30 30 0 355
-1150 */{ 0 , 1 , 31 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1151 */{ 4 , 1 , 20 , 25784 },/* 29 30 30 29 29 30 29 29 30 29 30 30 30 384
-1152 */{ 0 , 2 , 8 , 21680 },/* 29 30 29 30 29 30 29 29 30 29 30 30 0 354
-1153 */{ 12 , 1 , 27 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 29 383
-1154 */{ 0 , 2 , 14 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 0 355
-1155 */{ 0 , 2 , 4 , 23232 },/* 29 30 29 30 30 29 30 29 30 30 29 29 0 354
-1156 */{ 10 , 1 , 24 , 43880 },/* 30 29 30 29 30 29 30 30 29 30 30 29 30 385
-1157 */{ 0 , 2 , 12 , 9952 },/* 29 29 30 29 29 30 30 29 30 30 30 29 0 354
-1158 */{ 0 , 2 , 1 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1159 */{ 6 , 1 , 21 , 51568 },/* 30 30 29 29 30 29 29 30 29 30 30 30 29 384
-1160 */{ 0 , 2 , 9 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-1161 */{ 0 , 1 , 28 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1162 */{ 2 , 1 , 17 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 29 384
-1163 */{ 0 , 2 , 5 , 54608 },/* 30 30 29 30 29 30 29 30 29 30 29 30 0 355
-1164 */{ 11 , 1 , 26 , 22184 },/* 29 30 29 30 29 30 30 29 30 29 30 29 30 384
-1165 */{ 0 , 2 , 13 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 0 355
-1166 */{ 0 , 2 , 3 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-1167 */{ 7 , 1 , 23 , 37608 },/* 30 29 29 30 29 29 30 29 30 30 30 29 30 384
-1168 */{ 0 , 2 , 11 , 37488 },/* 30 29 29 30 29 29 30 29 29 30 30 30 0 354
-1169 */{ 0 , 1 , 30 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1170 */{ 5 , 1 , 19 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1171 */{ 0 , 2 , 7 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-1172 */{ 0 , 1 , 27 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1173 */{ 1 , 1 , 16 , 22184 },/* 29 30 29 30 29 30 30 29 30 29 30 29 30 384
-1174 */{ 0 , 2 , 4 , 19888 },/* 29 30 29 29 30 30 29 30 30 29 30 30 0 355
-1175 */{ 9 , 1 , 25 , 9648 },/* 29 29 30 29 29 30 29 30 30 29 30 30 29 383
-1176 */{ 0 , 2 , 12 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1177 */{ 0 , 2 , 1 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1178 */{ 6 , 1 , 21 , 43352 },/* 30 29 30 29 30 29 29 30 29 30 29 30 30 384
-1179 */{ 0 , 2 , 9 , 26960 },/* 29 30 30 29 30 29 29 30 29 30 29 30 0 354
-1180 */{ 0 , 1 , 29 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1181 */{ 3 , 1 , 17 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 29 384
-1182 */{ 0 , 2 , 5 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1183 */{ 11 , 1 , 26 , 19304 },/* 29 30 29 29 30 29 30 30 29 30 30 29 30 384
-1184 */{ 0 , 2 , 14 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1185 */{ 0 , 2 , 2 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1186 */{ 7 , 1 , 23 , 21104 },/* 29 30 29 30 29 29 30 29 29 30 30 30 29 383
-1187 */{ 0 , 2 , 10 , 53392 },/* 30 30 29 30 29 29 30 29 29 30 30 0 0 325
-1188 */{ 0 , 1 , 1 , 29848 },/* 29 30 30 30 29 30 29 29 30 29 29 30 30 384
-1189 */{ 5 , 1 , 19 , 27304 },/* 29 30 30 29 30 29 30 29 30 29 30 29 30 384
-1190 */{ 0 , 2 , 7 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1191 */{ 0 , 1 , 27 , 39760 },/* 30 29 29 30 30 29 30 30 29 30 29 30 0 355
-1192 */{ 2 , 1 , 17 , 19304 },/* 29 30 29 29 30 29 30 30 29 30 30 29 30 384
-1193 */{ 0 , 2 , 4 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1194 */{ 10 , 1 , 24 , 42216 },/* 30 29 30 29 29 30 29 29 30 30 30 29 30 384
-1195 */{ 0 , 2 , 12 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1196 */{ 0 , 2 , 1 , 53856 },/* 30 30 29 30 29 29 30 29 29 30 30 29 0 354
-1197 */{ 6 , 1 , 20 , 54568 },/* 30 30 29 30 29 30 29 30 29 29 30 29 30 384
-1198 */{ 0 , 2 , 8 , 46368 },/* 30 29 30 30 29 30 29 30 29 29 30 29 0 354
-1199 */{ 0 , 1 , 28 , 54944 },/* 30 30 29 30 29 30 30 29 30 29 30 29 0 355
-1200 */{ 2 , 1 , 18 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 29 384
-1201 */{ 0 , 2 , 5 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 0 355
-1202 */{ 12 , 1 , 26 , 18904 },/* 29 30 29 29 30 29 29 30 30 30 29 30 30 384
-1203 */{ 0 , 2 , 14 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1204 */{ 0 , 2 , 3 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1205 */{ 8 , 1 , 22 , 43608 },/* 30 29 30 29 30 29 30 29 29 30 29 30 30 384
-1206 */{ 0 , 2 , 10 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 0 354
-1207 */{ 0 , 1 , 30 , 46400 },/* 30 29 30 30 29 30 29 30 29 30 29 29 0 354
-1208 */{ 4 , 1 , 19 , 46496 },/* 30 29 30 30 29 30 29 30 30 29 30 29 29 384
-1209 */{ 0 , 2 , 6 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-1210 */{ 0 , 1 , 27 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1211 */{ 2 , 1 , 17 , 18872 },/* 29 30 29 29 30 29 29 30 30 29 30 30 30 384
-1212 */{ 0 , 2 , 5 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1213 */{ 9 , 1 , 24 , 25784 },/* 29 30 30 29 29 30 29 29 30 29 30 30 30 384
-1214 */{ 0 , 2 , 12 , 21680 },/* 29 30 29 30 29 30 29 29 30 29 30 30 0 354
-1215 */{ 0 , 2 , 1 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 0 354
-1216 */{ 7 , 1 , 21 , 27944 },/* 29 30 30 29 30 30 29 30 29 29 30 29 30 384
-1217 */{ 0 , 2 , 8 , 23232 },/* 29 30 29 30 30 29 30 29 30 30 29 29 0 354
-1218 */{ 0 , 1 , 28 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-1219 */{ 3 , 1 , 18 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 29 384
-1220 */{ 0 , 2 , 6 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1221 */{ 12 , 1 , 25 , 51568 },/* 30 30 29 29 30 29 29 30 29 30 30 30 29 384
-1222 */{ 0 , 2 , 13 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-1223 */{ 0 , 2 , 2 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1224 */{ 8 , 1 , 22 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 29 384
-1225 */{ 0 , 2 , 9 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1226 */{ 0 , 1 , 30 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1227 */{ 5 , 1 , 19 , 43736 },/* 30 29 30 29 30 29 30 29 30 30 29 30 30 385
-1228 */{ 0 , 2 , 8 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-1229 */{ 0 , 1 , 27 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1230 */{ 2 , 1 , 16 , 51544 },/* 30 30 29 29 30 29 29 30 29 30 29 30 30 384
-1231 */{ 0 , 2 , 4 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1232 */{ 9 , 1 , 24 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1233 */{ 0 , 2 , 11 , 45728 },/* 30 29 30 30 29 29 30 29 30 29 30 29 0 354
-1234 */{ 0 , 1 , 31 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1235 */{ 7 , 1 , 21 , 22184 },/* 29 30 29 30 29 30 30 29 30 29 30 29 30 384
-1236 */{ 0 , 2 , 9 , 19872 },/* 29 30 29 29 30 30 29 30 30 29 30 29 0 354
-1237 */{ 0 , 1 , 28 , 42416 },/* 30 29 30 29 29 30 29 30 30 29 30 30 0 355
-1238 */{ 4 , 1 , 18 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-1239 */{ 0 , 2 , 6 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1240 */{ 12 , 1 , 26 , 43320 },/* 30 29 30 29 30 29 29 30 29 29 30 30 30 384
-1241 */{ 0 , 2 , 13 , 26928 },/* 29 30 30 29 30 29 29 30 29 29 30 30 0 354
-1242 */{ 0 , 2 , 2 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1243 */{ 8 , 1 , 22 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 29 384
-1244 */{ 0 , 2 , 10 , 44624 },/* 30 29 30 29 30 30 30 29 29 30 29 30 0 355
-1245 */{ 0 , 1 , 30 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-1246 */{ 4 , 1 , 19 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-1247 */{ 0 , 2 , 7 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1248 */{ 0 , 1 , 28 , 21104 },/* 29 30 29 30 29 29 30 29 29 30 30 30 0 354
-1249 */{ 2 , 1 , 16 , 26928 },/* 29 30 30 29 30 29 29 30 29 29 30 30 29 383
-1250 */{ 0 , 2 , 3 , 58672 },/* 30 30 30 29 29 30 29 30 29 29 30 30 0 355
-1251 */{ 10 , 1 , 24 , 27800 },/* 29 30 30 29 30 30 29 29 30 29 29 30 30 384
-1252 */{ 0 , 2 , 12 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1253 */{ 0 , 1 , 31 , 23248 },/* 29 30 29 30 30 29 30 29 30 30 29 30 0 355
-1254 */{ 6 , 1 , 21 , 19304 },/* 29 30 29 29 30 29 30 30 29 30 30 29 30 384
-1255 */{ 0 , 2 , 9 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1256 */{ 0 , 1 , 29 , 42208 },/* 30 29 30 29 29 30 29 29 30 30 30 29 0 354
-1257 */{ 4 , 1 , 17 , 53864 },/* 30 30 29 30 29 29 30 29 29 30 30 29 30 384
-1258 */{ 0 , 2 , 5 , 53856 },/* 30 30 29 30 29 29 30 29 29 30 30 29 0 354
-1259 */{ 11 , 1 , 25 , 54568 },/* 30 30 29 30 29 30 29 30 29 29 30 29 30 384
-1260 */{ 0 , 2 , 13 , 46368 },/* 30 29 30 30 29 30 29 30 29 29 30 29 0 354
-1261 */{ 0 , 2 , 1 , 46752 },/* 30 29 30 30 29 30 30 29 30 29 30 29 0 355
-1262 */{ 9 , 1 , 22 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 29 384
-1263 */{ 0 , 2 , 10 , 21872 },/* 29 30 29 30 29 30 29 30 29 30 30 30 0 355
-1264 */{ 0 , 1 , 31 , 18896 },/* 29 30 29 29 30 29 29 30 30 30 29 30 0 354
-1265 */{ 5 , 1 , 19 , 42200 },/* 30 29 30 29 29 30 29 29 30 30 29 30 30 384
-1266 */{ 0 , 2 , 7 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1267 */{ 0 , 1 , 27 , 43600 },/* 30 29 30 29 30 29 30 29 29 30 29 30 0 354
-1268 */{ 1 , 1 , 16 , 46376 },/* 30 29 30 30 29 30 29 30 29 29 30 29 30 384
-1269 */{ 0 , 2 , 3 , 46368 },/* 30 29 30 30 29 30 29 30 29 29 30 29 0 354
-1270 */{ 11 , 1 , 23 , 46528 },/* 30 29 30 30 29 30 29 30 30 30 29 29 29 384
-1271 */{ 0 , 2 , 11 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-1272 */{ 0 , 2 , 1 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1273 */{ 6 , 1 , 21 , 18872 },/* 29 30 29 29 30 29 29 30 30 29 30 30 30 384
-1274 */{ 0 , 2 , 9 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1275 */{ 0 , 1 , 29 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-1276 */{ 3 , 1 , 18 , 27224 },/* 29 30 30 29 30 29 30 29 29 30 29 30 30 384
-1277 */{ 0 , 2 , 5 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 0 354
-1278 */{ 11 , 1 , 25 , 27432 },/* 29 30 30 29 30 29 30 30 29 29 30 29 30 384
-1279 */{ 0 , 2 , 13 , 23232 },/* 29 30 29 30 30 29 30 29 30 30 29 29 0 354
-1280 */{ 0 , 2 , 2 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-1281 */{ 8 , 1 , 22 , 10984 },/* 29 29 30 29 30 29 30 29 30 30 30 29 30 384
-1282 */{ 0 , 2 , 10 , 18912 },/* 29 30 29 29 30 29 29 30 30 30 30 29 0 354
-1283 */{ 0 , 1 , 30 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1284 */{ 5 , 1 , 19 , 53848 },/* 30 30 29 30 29 29 30 29 29 30 29 30 30 384
-1285 */{ 0 , 2 , 6 , 45648 },/* 30 29 30 30 29 29 30 29 29 30 29 30 0 354
-1286 */{ 0 , 1 , 26 , 46368 },/* 30 29 30 30 29 30 29 30 29 29 30 29 0 354
-1287 */{ 2 , 1 , 15 , 62096 },/* 30 30 30 30 29 29 30 29 30 29 29 30 29 384
-1288 */{ 0 , 2 , 3 , 46496 },/* 30 29 30 30 29 30 29 30 30 29 30 29 0 355
-1289 */{ 10 , 1 , 23 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 29 384
-1290 */{ 0 , 2 , 11 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1291 */{ 0 , 2 , 1 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1292 */{ 6 , 1 , 21 , 42168 },/* 30 29 30 29 29 30 29 29 30 29 30 30 30 384
-1293 */{ 0 , 2 , 8 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1294 */{ 0 , 1 , 28 , 43600 },/* 30 29 30 29 30 29 30 29 29 30 29 30 0 354
-1295 */{ 4 , 1 , 17 , 46376 },/* 30 29 30 30 29 30 29 30 29 29 30 29 30 384
-1296 */{ 0 , 2 , 5 , 27968 },/* 29 30 30 29 30 30 29 30 29 30 29 29 0 354
-1297 */{ 12 , 1 , 24 , 44384 },/* 30 29 30 29 30 30 29 30 29 30 30 29 29 384
-1298 */{ 0 , 2 , 12 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-1299 */{ 0 , 2 , 2 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 0 355
-1300 */{ 8 , 1 , 23 , 2424 },/* 29 29 29 29 30 29 29 30 29 30 30 30 30 383
-1301 */{ 0 , 2 , 10 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1302 */{ 0 , 1 , 30 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-1303 */{ 5 , 1 , 19 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 29 383
-1304 */{ 0 , 2 , 6 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 0 355
-1305 */{ 0 , 1 , 26 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1306 */{ 1 , 1 , 15 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 29 384
-1307 */{ 0 , 2 , 3 , 42720 },/* 30 29 30 29 29 30 30 29 30 30 30 29 0 355
-1308 */{ 11 , 1 , 24 , 37608 },/* 30 29 29 30 29 29 30 29 30 30 30 29 30 384
-1309 */{ 0 , 2 , 11 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1310 */{ 0 , 1 , 31 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-1311 */{ 7 , 1 , 20 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1312 */{ 0 , 2 , 8 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1313 */{ 0 , 1 , 27 , 54608 },/* 30 30 29 30 29 30 29 30 29 30 29 30 0 355
-1314 */{ 3 , 1 , 17 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-1315 */{ 0 , 2 , 5 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1316 */{ 0 , 1 , 25 , 42704 },/* 30 29 30 29 29 30 30 29 30 30 29 30 0 355
-1317 */{ 1 , 1 , 14 , 37608 },/* 30 29 29 30 29 29 30 29 30 30 30 29 30 384
-1318 */{ 0 , 2 , 2 , 37552 },/* 30 29 29 30 29 29 30 29 30 29 30 30 0 354
-1319 */{ 8 , 1 , 22 , 42328 },/* 30 29 30 29 29 30 29 30 29 30 29 30 30 384
-1320 */{ 0 , 2 , 10 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1321 */{ 0 , 1 , 29 , 45728 },/* 30 29 30 30 29 29 30 29 30 29 30 29 0 354
-1322 */{ 5 , 1 , 18 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-1323 */{ 0 , 2 , 6 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-1324 */{ 0 , 1 , 27 , 19872 },/* 29 30 29 29 30 30 29 30 30 29 30 29 0 354
-1325 */{ 1 , 1 , 15 , 42448 },/* 30 29 30 29 29 30 29 30 30 30 29 30 29 384
-1326 */{ 0 , 2 , 3 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1327 */{ 9 , 1 , 24 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-1328 */{ 0 , 2 , 12 , 21104 },/* 29 30 29 30 29 29 30 29 29 30 30 30 0 354
-1329 */{ 0 , 1 , 31 , 26928 },/* 29 30 30 29 30 29 29 30 29 29 30 30 0 354
-1330 */{ 7 , 1 , 20 , 27288 },/* 29 30 30 29 30 29 30 29 30 29 29 30 30 384
-1331 */{ 0 , 2 , 8 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1332 */{ 0 , 1 , 28 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1333 */{ 3 , 1 , 17 , 19368 },/* 29 30 29 29 30 29 30 30 30 29 30 29 30 384
-1334 */{ 0 , 2 , 5 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-1335 */{ 12 , 1 , 25 , 42608 },/* 30 29 30 29 29 30 30 29 29 30 30 30 29 384
-1336 */{ 0 , 2 , 13 , 41696 },/* 30 29 30 29 29 29 30 29 30 30 30 29 0 354
-1337 */{ 0 , 2 , 1 , 53600 },/* 30 30 29 30 29 29 29 30 29 30 30 29 0 354
-1338 */{ 8 , 1 , 21 , 59696 },/* 30 30 30 29 30 29 29 30 29 29 30 30 29 384
-1339 */{ 0 , 2 , 9 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1340 */{ 0 , 1 , 29 , 55968 },/* 30 30 29 30 30 29 30 29 30 29 30 29 0 355
-1341 */{ 5 , 1 , 18 , 23376 },/* 29 30 29 30 30 29 30 30 29 30 29 30 29 384
-1342 */{ 0 , 2 , 6 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-1343 */{ 0 , 1 , 27 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1344 */{ 2 , 1 , 16 , 41704 },/* 30 29 30 29 29 29 30 29 30 30 30 29 30 384
-1345 */{ 0 , 2 , 3 , 41680 },/* 30 29 30 29 29 29 30 29 30 30 29 30 0 354
-1346 */{ 10 , 1 , 23 , 53592 },/* 30 30 29 30 29 29 29 30 29 30 29 30 30 384
-1347 */{ 0 , 2 , 11 , 43600 },/* 30 29 30 29 30 29 30 29 29 30 29 30 0 354
-1348 */{ 0 , 1 , 31 , 46368 },/* 30 29 30 30 29 30 29 30 29 29 30 29 0 354
-1349 */{ 7 , 1 , 19 , 54944 },/* 30 30 29 30 29 30 30 29 30 29 30 29 29 384
-1350 */{ 0 , 2 , 7 , 44448 },/* 30 29 30 29 30 30 29 30 30 29 30 29 0 355
-1351 */{ 0 , 1 , 28 , 21968 },/* 29 30 29 30 29 30 29 30 30 30 29 30 0 355
-1352 */{ 3 , 1 , 18 , 18904 },/* 29 30 29 29 30 29 29 30 30 30 29 30 30 384
-1353 */{ 0 , 2 , 5 , 17840 },/* 29 30 29 29 29 30 29 30 30 29 30 30 0 354
-1354 */{ 0 , 1 , 25 , 41648 },/* 30 29 30 29 29 29 30 29 30 29 30 30 0 354
-1355 */{ 1 , 1 , 14 , 53592 },/* 30 30 29 30 29 29 29 30 29 30 29 30 30 384
-1356 */{ 0 , 2 , 2 , 43600 },/* 30 29 30 29 30 29 30 29 29 30 29 30 0 354
-1357 */{ 9 , 1 , 21 , 46376 },/* 30 29 30 30 29 30 29 30 29 29 30 29 30 384
-1358 */{ 0 , 2 , 9 , 27424 },/* 29 30 30 29 30 29 30 30 29 29 30 29 0 354
-1359 */{ 0 , 1 , 29 , 44384 },/* 30 29 30 29 30 30 29 30 29 30 30 29 0 355
-1360 */{ 5 , 1 , 19 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 29 384
-1361 */{ 0 , 2 , 6 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 0 355
-1362 */{ 0 , 1 , 27 , 17776 },/* 29 30 29 29 29 30 29 30 29 30 30 30 0 354
-1363 */{ 3 , 1 , 16 , 41656 },/* 30 29 30 29 29 29 30 29 30 29 30 30 30 384
-1364 */{ 0 , 2 , 4 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1365 */{ 10 , 1 , 23 , 43600 },/* 30 29 30 29 30 29 30 29 29 30 29 30 29 383
-1366 */{ 0 , 2 , 10 , 55632 },/* 30 30 29 30 30 29 29 30 29 30 29 30 0 355
-1367 */{ 0 , 1 , 31 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1368 */{ 7 , 1 , 20 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 29 384
-1369 */{ 0 , 2 , 7 , 42720 },/* 30 29 30 29 29 30 30 29 30 30 30 29 0 355
-1370 */{ 0 , 1 , 28 , 21216 },/* 29 30 29 30 29 29 30 29 30 30 30 29 0 354
-1371 */{ 3 , 1 , 17 , 50544 },/* 30 30 29 29 29 30 29 30 29 30 30 30 29 384
-1372 */{ 0 , 2 , 5 , 42336 },/* 30 29 30 29 29 30 29 30 29 30 30 29 0 354
-1373 */{ 11 , 1 , 24 , 53928 },/* 30 30 29 30 29 29 30 29 30 29 30 29 30 384
-1374 */{ 0 , 2 , 12 , 53920 },/* 30 30 29 30 29 29 30 29 30 29 30 29 0 354
-1375 */{ 0 , 2 , 1 , 54608 },/* 30 30 29 30 29 30 29 30 29 30 29 30 0 355
-1376 */{ 9 , 1 , 22 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-1377 */{ 0 , 2 , 9 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1378 */{ 0 , 1 , 29 , 42704 },/* 30 29 30 29 29 30 30 29 30 30 29 30 0 355
-1379 */{ 5 , 1 , 19 , 21224 },/* 29 30 29 30 29 29 30 29 30 30 30 29 30 384
-1380 */{ 0 , 2 , 7 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1381 */{ 0 , 1 , 26 , 43216 },/* 30 29 30 29 30 29 29 29 30 30 29 30 0 354
-1382 */{ 2 , 1 , 15 , 53928 },/* 30 30 29 30 29 29 30 29 30 29 30 29 30 384
-1383 */{ 0 , 2 , 3 , 45728 },/* 30 29 30 30 29 29 30 29 30 29 30 29 0 354
-1384 */{ 10 , 1 , 23 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-1385 */{ 0 , 2 , 10 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-1386 */{ 0 , 1 , 31 , 19872 },/* 29 30 29 29 30 30 29 30 30 29 30 29 0 354
-1387 */{ 6 , 1 , 20 , 42448 },/* 30 29 30 29 29 30 29 30 30 30 29 30 29 384
-1388 */{ 0 , 2 , 8 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1389 */{ 0 , 1 , 28 , 20912 },/* 29 30 29 30 29 29 29 30 30 29 30 30 0 354
-1390 */{ 4 , 1 , 17 , 43192 },/* 30 29 30 29 30 29 29 29 30 29 30 30 30 384
-1391 */{ 0 , 2 , 5 , 25904 },/* 29 30 30 29 29 30 29 30 29 29 30 30 0 354
-1392 */{ 12 , 1 , 25 , 27288 },/* 29 30 30 29 30 29 30 29 30 29 29 30 30 384
-1393 */{ 0 , 2 , 12 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1394 */{ 0 , 2 , 1 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1395 */{ 9 , 1 , 22 , 11176 },/* 29 29 30 29 30 29 30 30 30 29 30 29 30 384
-1396 */{ 0 , 2 , 10 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1397 */{ 0 , 1 , 29 , 50032 },/* 30 30 29 29 29 29 30 30 29 30 30 30 0 355
-1398 */{ 5 , 1 , 19 , 20848 },/* 29 30 29 30 29 29 29 30 29 30 30 30 29 383
-1399 */{ 0 , 2 , 6 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-1400 */{ 0 , 1 , 26 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1401 */{ 3 , 1 , 15 , 27280 },/* 29 30 30 29 30 29 30 29 30 29 29 30 29 383
-1402 */{ 0 , 2 , 2 , 55968 },/* 30 30 29 30 30 29 30 29 30 29 30 29 0 355
-1403 */{ 11 , 1 , 23 , 23376 },/* 29 30 29 30 30 29 30 30 29 30 29 30 29 384
-1404 */{ 0 , 2 , 11 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-1405 */{ 0 , 1 , 31 , 10976 },/* 29 29 30 29 30 29 30 29 30 30 30 29 0 354
-1406 */{ 7 , 1 , 20 , 41704 },/* 30 29 30 29 29 29 30 29 30 30 30 29 30 384
-1407 */{ 0 , 2 , 8 , 41680 },/* 30 29 30 29 29 29 30 29 30 30 29 30 0 354
-1408 */{ 0 , 1 , 28 , 53584 },/* 30 30 29 30 29 29 29 30 29 30 29 30 0 354
-1409 */{ 4 , 1 , 16 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1410 */{ 0 , 2 , 4 , 46368 },/* 30 29 30 30 29 30 29 30 29 29 30 29 0 354
-1411 */{ 12 , 1 , 24 , 46736 },/* 30 29 30 30 29 30 30 29 30 29 29 30 29 384
-1412 */{ 0 , 2 , 12 , 44448 },/* 30 29 30 29 30 30 29 30 30 29 30 29 0 355
-1413 */{ 0 , 2 , 1 , 21968 },/* 29 30 29 30 29 30 29 30 30 30 29 30 0 355
-1414 */{ 9 , 1 , 22 , 9688 },/* 29 29 30 29 29 30 29 30 30 30 29 30 30 384
-1415 */{ 0 , 2 , 10 , 17840 },/* 29 30 29 29 29 30 29 30 30 29 30 30 0 354
-1416 */{ 0 , 1 , 30 , 41648 },/* 30 29 30 29 29 29 30 29 30 29 30 30 0 354
-1417 */{ 5 , 1 , 18 , 43352 },/* 30 29 30 29 30 29 29 30 29 30 29 30 30 384
-1418 */{ 0 , 2 , 6 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1419 */{ 0 , 1 , 26 , 46368 },/* 30 29 30 30 29 30 29 30 29 29 30 29 0 354
-1420 */{ 1 , 1 , 15 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-1421 */{ 0 , 2 , 2 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-1422 */{ 12 , 1 , 23 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 29 384
-1423 */{ 0 , 2 , 11 , 19312 },/* 29 30 29 29 30 29 30 30 29 30 30 30 0 355
-1424 */{ 0 , 2 , 1 , 17776 },/* 29 30 29 29 29 30 29 30 29 30 30 30 0 354
-1425 */{ 7 , 1 , 20 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-1426 */{ 0 , 2 , 8 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1427 */{ 0 , 1 , 28 , 26960 },/* 29 30 30 29 30 29 29 30 29 30 29 30 0 354
-1428 */{ 4 , 1 , 17 , 27816 },/* 29 30 30 29 30 30 29 29 30 29 30 29 30 384
-1429 */{ 0 , 2 , 4 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1430 */{ 12 , 1 , 24 , 39760 },/* 30 29 29 30 30 29 30 30 29 30 29 30 29 384
-1431 */{ 0 , 2 , 12 , 42720 },/* 30 29 30 29 29 30 30 29 30 30 30 29 0 355
-1432 */{ 0 , 2 , 2 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1433 */{ 8 , 1 , 21 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-1434 */{ 0 , 2 , 9 , 42336 },/* 30 29 30 29 29 30 29 30 29 30 30 29 0 354
-1435 */{ 0 , 1 , 29 , 53920 },/* 30 30 29 30 29 29 30 29 30 29 30 29 0 354
-1436 */{ 6 , 1 , 18 , 59728 },/* 30 30 30 29 30 29 29 30 29 30 29 30 29 384
-1437 */{ 0 , 2 , 5 , 54608 },/* 30 30 29 30 29 30 29 30 29 30 29 30 0 355
-1438 */{ 0 , 1 , 26 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1439 */{ 2 , 1 , 15 , 43728 },/* 30 29 30 29 30 29 30 29 30 30 29 30 29 384
-1440 */{ 0 , 2 , 3 , 38368 },/* 30 29 29 30 29 30 29 30 30 30 30 29 0 355
-1441 */{ 11 , 1 , 23 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-1442 */{ 0 , 2 , 11 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1443 */{ 0 , 1 , 31 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1444 */{ 7 , 1 , 20 , 53872 },/* 30 30 29 30 29 29 30 29 29 30 30 30 29 384
-1445 */{ 0 , 2 , 7 , 45728 },/* 30 29 30 30 29 29 30 29 30 29 30 29 0 354
-1446 */{ 0 , 1 , 27 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1447 */{ 4 , 1 , 17 , 22184 },/* 29 30 29 30 29 30 30 29 30 29 30 29 30 384
-1448 */{ 0 , 2 , 5 , 11680 },/* 29 29 30 29 30 30 29 30 30 29 30 29 0 354
-1449 */{ 0 , 1 , 24 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1450 */{ 1 , 1 , 14 , 19128 },/* 29 30 29 29 30 29 30 29 30 29 30 30 30 384
-1451 */{ 0 , 2 , 2 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1452 */{ 9 , 1 , 22 , 42168 },/* 30 29 30 29 29 30 29 29 30 29 30 30 30 384
-1453 */{ 0 , 2 , 9 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-1454 */{ 0 , 1 , 29 , 27280 },/* 29 30 30 29 30 29 30 29 30 29 29 30 0 354
-1455 */{ 6 , 1 , 18 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 29 384
-1456 */{ 0 , 2 , 6 , 27472 },/* 29 30 30 29 30 29 30 30 29 30 29 30 0 355
-1457 */{ 0 , 1 , 26 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1458 */{ 2 , 1 , 15 , 38256 },/* 30 29 29 30 29 30 29 30 29 30 30 30 29 384
-1459 */{ 0 , 2 , 3 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 0 355
-1460 */{ 11 , 1 , 24 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 29 383
-1461 */{ 0 , 2 , 10 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-1462 */{ 0 , 1 , 30 , 58544 },/* 30 30 30 29 29 30 29 29 30 29 30 30 0 355
-1463 */{ 7 , 1 , 20 , 27280 },/* 29 30 30 29 30 29 30 29 30 29 29 30 29 383
-1464 */{ 0 , 2 , 7 , 55968 },/* 30 30 29 30 30 29 30 29 30 29 30 29 0 355
-1465 */{ 0 , 1 , 27 , 23248 },/* 29 30 29 30 30 29 30 29 30 30 29 30 0 355
-1466 */{ 3 , 1 , 17 , 11112 },/* 29 29 30 29 30 29 30 30 29 30 30 29 30 384
-1467 */{ 0 , 2 , 5 , 9952 },/* 29 29 30 29 29 30 30 29 30 30 30 29 0 354
-1468 */{ 0 , 1 , 25 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1469 */{ 2 , 1 , 13 , 51560 },/* 30 30 29 29 30 29 29 30 29 30 30 29 30 384
-1470 */{ 0 , 2 , 1 , 51536 },/* 30 30 29 29 30 29 29 30 29 30 29 30 0 354
-1471 */{ 9 , 1 , 21 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1472 */{ 0 , 2 , 9 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-1473 */{ 0 , 1 , 28 , 46736 },/* 30 29 30 30 29 30 30 29 30 29 29 30 0 355
-1474 */{ 6 , 1 , 18 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 29 384
-1475 */{ 0 , 2 , 6 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 0 355
-1476 */{ 0 , 1 , 27 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-1477 */{ 2 , 1 , 15 , 37592 },/* 30 29 29 30 29 29 30 29 30 30 29 30 30 384
-1478 */{ 0 , 2 , 3 , 37552 },/* 30 29 29 30 29 29 30 29 30 29 30 30 0 354
-1479 */{ 10 , 1 , 23 , 43352 },/* 30 29 30 29 30 29 29 30 29 30 29 30 30 384
-1480 */{ 0 , 2 , 11 , 26960 },/* 29 30 30 29 30 29 29 30 29 30 29 30 0 354
-1481 */{ 0 , 1 , 30 , 29856 },/* 29 30 30 30 29 30 29 29 30 29 30 29 0 354
-1482 */{ 8 , 1 , 19 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-1483 */{ 0 , 2 , 7 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-1484 */{ 0 , 1 , 28 , 21424 },/* 29 30 29 30 29 29 30 30 30 29 30 30 0 355
-1485 */{ 4 , 1 , 17 , 9656 },/* 29 29 30 29 29 30 29 30 30 29 30 30 30 384
-1486 */{ 0 , 2 , 5 , 9584 },/* 29 29 30 29 29 30 29 30 29 30 30 30 0 354
-1487 */{ 0 , 1 , 25 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1488 */{ 1 , 1 , 14 , 43352 },/* 30 29 30 29 30 29 29 30 29 30 29 30 30 384
-1489 */{ 0 , 2 , 1 , 26960 },/* 29 30 30 29 30 29 29 30 29 30 29 30 0 354
-1490 */{ 9 , 1 , 21 , 27304 },/* 29 30 30 29 30 29 30 29 30 29 30 29 30 384
-1491 */{ 0 , 2 , 9 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1492 */{ 0 , 1 , 29 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1493 */{ 5 , 1 , 18 , 19304 },/* 29 30 29 29 30 29 30 30 29 30 30 29 30 384
-1494 */{ 0 , 2 , 6 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1495 */{ 0 , 1 , 26 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1496 */{ 3 , 1 , 16 , 21104 },/* 29 30 29 30 29 29 30 29 29 30 30 30 29 383
-1497 */{ 0 , 2 , 2 , 53920 },/* 30 30 29 30 29 29 30 29 30 29 30 29 0 354
-1498 */{ 11 , 1 , 22 , 55632 },/* 30 30 29 30 30 29 29 30 29 30 29 30 29 384
-1499 */{ 0 , 2 , 10 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1500 */{ 0 , 1 , 31 , 5792 },/* 29 29 29 30 29 30 30 29 30 29 30 29 0 353
-1501 */{ 7 , 1 , 19 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 29 384
-1502 */{ 0 , 2 , 7 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 0 355
-1503 */{ 0 , 1 , 28 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1504 */{ 4 , 1 , 17 , 42200 },/* 30 29 30 29 29 30 29 29 30 30 29 30 30 384
-1505 */{ 0 , 2 , 4 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1506 */{ 0 , 1 , 24 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-1507 */{ 1 , 1 , 13 , 54608 },/* 30 30 29 30 29 30 29 30 29 30 29 30 29 384
-1508 */{ 0 , 2 , 1 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1509 */{ 9 , 1 , 21 , 22184 },/* 29 30 29 30 29 30 30 29 30 29 30 29 30 384
-1510 */{ 0 , 2 , 9 , 11680 },/* 29 29 30 29 30 30 29 30 30 29 30 29 0 354
-1511 */{ 0 , 1 , 29 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1512 */{ 5 , 1 , 19 , 18872 },/* 29 30 29 29 30 29 29 30 30 29 30 30 30 384
-1513 */{ 0 , 2 , 6 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1514 */{ 0 , 1 , 26 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1515 */{ 4 , 1 , 15 , 45656 },/* 30 29 30 30 29 29 30 29 29 30 29 30 30 384
-1516 */{ 0 , 2 , 3 , 27280 },/* 29 30 30 29 30 29 30 29 30 29 29 30 0 354
-1517 */{ 12 , 1 , 22 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 29 384
-1518 */{ 0 , 2 , 10 , 23376 },/* 29 30 29 30 30 29 30 30 29 30 29 30 0 355
-1519 */{ 0 , 1 , 31 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1520 */{ 8 , 1 , 20 , 38256 },/* 30 29 29 30 29 30 29 30 29 30 30 30 29 384
-1521 */{ 0 , 2 , 7 , 37616 },/* 30 29 29 30 29 29 30 29 30 30 30 30 0 355
-1522 */{ 0 , 1 , 28 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1523 */{ 4 , 1 , 17 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 29 383
-1524 */{ 0 , 2 , 4 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1525 */{ 12 , 1 , 23 , 59984 },/* 30 30 30 29 30 29 30 29 29 30 29 30 29 384
-1526 */{ 0 , 2 , 11 , 54928 },/* 30 30 29 30 29 30 30 29 30 29 29 30 0 355
-1527 */{ 0 , 2 , 1 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-1528 */{ 10 , 1 , 22 , 11112 },/* 29 29 30 29 30 29 30 30 29 30 30 29 30 384
-1529 */{ 0 , 2 , 9 , 9952 },/* 29 29 30 29 29 30 30 29 30 30 30 29 0 354
-1530 */{ 0 , 1 , 29 , 21216 },/* 29 30 29 30 29 29 30 29 30 30 30 29 0 354
-1531 */{ 6 , 1 , 18 , 51560 },/* 30 30 29 29 30 29 29 30 29 30 30 29 30 384
-1532 */{ 0 , 2 , 6 , 51536 },/* 30 30 29 29 30 29 29 30 29 30 29 30 0 354
-1533 */{ 0 , 1 , 25 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1534 */{ 2 , 1 , 14 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 29 384
-1535 */{ 0 , 2 , 2 , 46480 },/* 30 29 30 30 29 30 29 30 30 29 29 30 0 355
-1536 */{ 12 , 1 , 23 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 29 384
-1537 */{ 0 , 2 , 10 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 0 355
-1538 */{ 0 , 1 , 31 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-1539 */{ 7 , 1 , 20 , 37592 },/* 30 29 29 30 29 29 30 29 30 30 29 30 30 384
-1540 */{ 0 , 2 , 8 , 37552 },/* 30 29 29 30 29 29 30 29 30 29 30 30 0 354
-1541 */{ 0 , 1 , 27 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1542 */{ 5 , 1 , 16 , 46248 },/* 30 29 30 30 29 30 29 29 30 29 30 29 30 384
-1543 */{ 0 , 2 , 4 , 27808 },/* 29 30 30 29 30 30 29 29 30 29 30 29 0 354
-1544 */{ 0 , 1 , 24 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-1545 */{ 1 , 1 , 13 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 29 384
-1546 */{ 0 , 2 , 1 , 19376 },/* 29 30 29 29 30 29 30 30 30 29 30 30 0 355
-1547 */{ 9 , 1 , 22 , 9656 },/* 29 29 30 29 29 30 29 30 30 29 30 30 30 384
-1548 */{ 0 , 2 , 10 , 9584 },/* 29 29 30 29 29 30 29 30 29 30 30 30 0 354
-1549 */{ 0 , 1 , 29 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1550 */{ 6 , 1 , 18 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 29 383
-1551 */{ 0 , 2 , 5 , 59728 },/* 30 30 30 29 30 29 29 30 29 30 29 30 0 355
-1552 */{ 0 , 1 , 26 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1553 */{ 3 , 1 , 14 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 29 384
-1554 */{ 0 , 2 , 2 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1555 */{ 11 , 1 , 23 , 19304 },/* 29 30 29 29 30 29 30 30 29 30 30 29 30 384
-1556 */{ 0 , 2 , 11 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1557 */{ 0 , 1 , 30 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1558 */{ 7 , 1 , 20 , 21096 },/* 29 30 29 30 29 29 30 29 29 30 30 29 30 383
-1559 */{ 0 , 2 , 7 , 53856 },/* 30 30 29 30 29 29 30 29 29 30 30 29 0 354
-1560 */{ 0 , 1 , 27 , 55632 },/* 30 30 29 30 30 29 29 30 29 30 29 30 0 355
-1561 */{ 5 , 1 , 16 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-1562 */{ 0 , 2 , 4 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1563 */{ 0 , 1 , 24 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-1564 */{ 2 , 1 , 14 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-1565 */{ 0 , 2 , 1 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1566 */{ 10 , 1 , 21 , 42200 },/* 30 29 30 29 29 30 29 29 30 30 29 30 30 384
-1567 */{ 0 , 2 , 9 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1568 */{ 0 , 1 , 29 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-1569 */{ 6 , 1 , 17 , 54600 },/* 30 30 29 30 29 30 29 30 29 30 29 29 30 384
-1570 */{ 0 , 2 , 5 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1571 */{ 0 , 1 , 26 , 13728 },/* 29 29 30 30 29 30 29 30 30 29 30 29 0 354
-1572 */{ 2 , 1 , 15 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 29 384
-1573 */{ 0 , 2 , 2 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1574 */{ 12 , 1 , 23 , 18872 },/* 29 30 29 29 30 29 29 30 30 29 30 30 30 384
-1575 */{ 0 , 2 , 11 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1576 */{ 0 , 1 , 31 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1577 */{ 8 , 1 , 19 , 45656 },/* 30 29 30 30 29 29 30 29 29 30 29 30 30 384
-1578 */{ 0 , 2 , 7 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 0 354
-1579 */{ 0 , 1 , 27 , 27968 },/* 29 30 30 29 30 30 29 30 29 30 29 29 0 354
-1580 */{ 4 , 1 , 16 , 44456 },/* 30 29 30 29 30 30 29 30 30 29 30 29 30 385
-1581 */{ 0 , 2 , 4 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1582 */{ 0 , 1 , 24 , 39024 },/* 30 29 29 30 29 29 30 30 39 30 30 30 0 365
-1583 */{ 2 , 1 , 24 , 18808 },/* 29 30 29 29 30 29 29 30 29 30 30 30 30 384
-1584 */{ 0 , 2 , 12 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1585 */{ 9 , 1 , 31 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 29 383
-1586 */{ 0 , 2 , 18 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1587 */{ 0 , 3 , 9 , 53968 },/* 30 30 29 30 29 30 29 29 30 29 30 0 0 325
-1588 */{ 6 , 1 , 28 , 27464 },/* 29 30 30 29 30 29 30 30 29 30 29 29 30 384
-1589 */{ 0 , 2 , 15 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-1590 */{ 0 , 2 , 5 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1591 */{ 3 , 1 , 25 , 37616 },/* 30 29 29 30 29 29 30 29 30 30 30 30 29 384
-1592 */{ 0 , 2 , 13 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1593 */{ 11 , 2 , 1 , 51560 },/* 30 30 29 29 30 29 29 30 29 30 30 29 30 384
-1594 */{ 0 , 2 , 20 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1595 */{ 0 , 2 , 9 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1596 */{ 8 , 1 , 29 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 29 384
-1597 */{ 0 , 2 , 16 , 46288 },/* 30 29 30 30 29 30 29 29 30 30 29 30 0 355
-1598 */{ 0 , 2 , 6 , 22192 },/* 29 30 29 30 29 30 30 29 30 29 30 30 0 355
-1599 */{ 4 , 1 , 27 , 9944 },/* 29 29 30 29 29 30 30 29 30 30 29 30 30 384
-1600 */{ 0 , 2 , 15 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-1601 */{ 0 , 2 , 3 , 37584 },/* 30 29 29 30 29 29 30 29 30 30 29 30 0 354
-1602 */{ 2 , 1 , 23 , 51608 },/* 30 30 29 29 30 29 29 30 30 29 29 30 30 384
-1603 */{ 0 , 2 , 11 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1604 */{ 9 , 1 , 31 , 46248 },/* 30 29 30 30 29 30 29 29 30 29 30 29 30 384
-1605 */{ 0 , 2 , 18 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1606 */{ 0 , 2 , 7 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-1607 */{ 6 , 1 , 28 , 21928 },/* 29 30 29 30 29 30 29 30 30 29 30 29 30 384
-1608 */{ 0 , 2 , 16 , 19376 },/* 29 30 29 29 30 29 30 30 30 29 30 30 0 355
-1609 */{ 0 , 2 , 5 , 9648 },/* 29 29 30 29 29 30 29 30 30 29 30 30 0 354
-1610 */{ 3 , 1 , 25 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-1611 */{ 0 , 2 , 13 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1612 */{ 11 , 2 , 2 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 29 383
-1613 */{ 0 , 2 , 19 , 59728 },/* 30 30 30 29 30 29 29 30 29 30 29 30 0 355
-1614 */{ 0 , 2 , 9 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1615 */{ 8 , 1 , 29 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 29 384
-1616 */{ 0 , 2 , 17 , 39760 },/* 30 29 29 30 30 29 30 30 29 30 29 30 0 355
-1617 */{ 0 , 2 , 6 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-1618 */{ 4 , 1 , 26 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-1619 */{ 0 , 2 , 14 , 42224 },/* 30 29 30 29 29 30 29 29 30 30 30 30 0 355
-1620 */{ 0 , 2 , 4 , 21088 },/* 29 30 29 30 29 29 30 29 29 30 30 29 0 353
-1621 */{ 2 , 1 , 22 , 59696 },/* 30 30 30 29 30 29 29 30 29 29 30 30 29 384
-1622 */{ 0 , 2 , 10 , 54608 },/* 30 30 29 30 29 30 29 30 29 30 29 30 0 355
-1623 */{ 10 , 1 , 31 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-1624 */{ 0 , 2 , 19 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1625 */{ 0 , 2 , 7 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-1626 */{ 6 , 1 , 28 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-1627 */{ 0 , 2 , 16 , 18912 },/* 29 30 29 29 30 29 29 30 30 30 30 29 0 354
-1628 */{ 0 , 2 , 5 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1629 */{ 4 , 1 , 24 , 53864 },/* 30 30 29 30 29 29 30 29 29 30 30 29 30 384
-1630 */{ 0 , 2 , 12 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-1631 */{ 11 , 2 , 1 , 54568 },/* 30 30 29 30 29 30 29 30 29 29 30 29 30 384
-1632 */{ 0 , 2 , 20 , 46400 },/* 30 29 30 30 29 30 29 30 29 30 29 29 0 354
-1633 */{ 0 , 2 , 8 , 46496 },/* 30 29 30 30 29 30 29 30 30 29 30 29 0 355
-1634 */{ 8 , 1 , 29 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 29 384
-1635 */{ 0 , 2 , 17 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1636 */{ 0 , 2 , 7 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1637 */{ 4 , 1 , 26 , 42168 },/* 30 29 30 29 29 30 29 29 30 29 30 30 30 384
-1638 */{ 0 , 2 , 14 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1639 */{ 0 , 2 , 3 , 43600 },/* 30 29 30 29 30 29 30 29 29 30 29 30 0 354
-1640 */{ 1 , 1 , 23 , 46376 },/* 30 29 30 30 29 30 29 30 29 29 30 29 30 384
-1641 */{ 0 , 2 , 10 , 27968 },/* 29 30 30 29 30 30 29 30 29 30 29 29 0 354
-1642 */{ 11 , 1 , 30 , 44456 },/* 30 29 30 29 30 30 29 30 30 29 30 29 30 385
-1643 */{ 0 , 2 , 19 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1644 */{ 0 , 2 , 8 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 0 355
-1645 */{ 6 , 1 , 28 , 18808 },/* 29 30 29 29 30 29 29 30 29 30 30 30 30 384
-1646 */{ 0 , 2 , 16 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1647 */{ 0 , 2 , 5 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-1648 */{ 3 , 1 , 24 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 29 383
-1649 */{ 0 , 2 , 11 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 0 355
-1650 */{ 11 , 2 , 1 , 27464 },/* 29 30 30 29 30 29 30 30 29 30 29 29 30 384
-1651 */{ 0 , 2 , 20 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-1652 */{ 0 , 2 , 10 , 11168 },/* 29 29 30 29 30 29 30 30 30 29 30 29 0 354
-1653 */{ 7 , 1 , 29 , 37616 },/* 30 29 29 30 29 29 30 29 30 30 30 30 29 384
-1654 */{ 0 , 2 , 17 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1655 */{ 0 , 2 , 6 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-1656 */{ 5 , 1 , 26 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1657 */{ 0 , 2 , 13 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1658 */{ 0 , 2 , 2 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 0 355
-1659 */{ 3 , 1 , 23 , 39592 },/* 30 29 29 30 30 29 30 29 30 29 30 29 30 384
-1660 */{ 0 , 2 , 11 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1661 */{ 7 , 1 , 30 , 42704 },/* 30 29 30 29 29 30 30 29 30 30 29 30 29 384
-1662 */{ 0 , 2 , 18 , 42448 },/* 30 29 30 29 29 30 29 30 30 30 29 30 0 355
-1663 */{ 0 , 2 , 8 , 37584 },/* 30 29 29 30 29 29 30 29 30 30 29 30 0 354
-1664 */{ 6 , 1 , 28 , 43352 },/* 30 29 30 29 30 29 29 30 29 30 29 30 30 384
-1665 */{ 0 , 2 , 15 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1666 */{ 0 , 2 , 4 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-1667 */{ 4 , 1 , 24 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-1668 */{ 0 , 2 , 12 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-1669 */{ 0 , 2 , 1 , 21920 },/* 29 30 29 30 29 30 29 30 30 29 30 29 0 354
-1670 */{ 2 , 1 , 21 , 42448 },/* 30 29 30 29 29 30 29 30 30 30 29 30 29 384
-1671 */{ 0 , 2 , 9 , 42416 },/* 30 29 30 29 29 30 29 30 30 29 30 30 0 355
-1672 */{ 7 , 1 , 30 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-1673 */{ 0 , 2 , 17 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1674 */{ 0 , 2 , 6 , 26928 },/* 29 30 30 29 30 29 29 30 29 29 30 30 0 354
-1675 */{ 5 , 1 , 26 , 29864 },/* 29 30 30 30 29 30 29 29 30 29 30 29 30 384
-1676 */{ 0 , 2 , 14 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1677 */{ 0 , 2 , 2 , 44432 },/* 30 29 30 29 30 30 29 30 30 29 29 30 0 355
-1678 */{ 3 , 1 , 23 , 19880 },/* 29 30 29 29 30 30 29 30 30 29 30 29 30 384
-1679 */{ 0 , 2 , 11 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-1680 */{ 8 , 1 , 31 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-1681 */{ 0 , 2 , 18 , 42208 },/* 30 29 30 29 29 30 29 29 30 30 30 29 0 354
-1682 */{ 0 , 2 , 7 , 53856 },/* 30 30 29 30 29 29 30 29 29 30 30 29 0 354
-1683 */{ 6 , 1 , 27 , 59696 },/* 30 30 30 29 30 29 29 30 29 29 30 30 29 384
-1684 */{ 0 , 2 , 15 , 54560 },/* 30 30 29 30 29 30 29 30 29 29 30 29 0 354
-1685 */{ 0 , 2 , 3 , 55968 },/* 30 30 29 30 30 29 30 29 30 29 30 29 0 355
-1686 */{ 4 , 1 , 24 , 27472 },/* 29 30 30 29 30 29 30 30 29 30 29 30 29 384
-1687 */{ 0 , 2 , 12 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-1688 */{ 0 , 2 , 2 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1689 */{ 3 , 1 , 21 , 42216 },/* 30 29 30 29 29 30 29 29 30 30 30 29 30 384
-1690 */{ 0 , 2 , 9 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1691 */{ 7 , 1 , 29 , 53848 },/* 30 30 29 30 29 29 30 29 29 30 29 30 30 384
-1692 */{ 0 , 2 , 17 , 45136 },/* 30 29 29 32 29 29 29 29 29 30 29 30 0 354
-1693 */{ 0 , 2 , 5 , 54560 },/* 30 30 29 30 29 30 29 30 29 29 30 29 0 354
-1694 */{ 5 , 1 , 25 , 54944 },/* 30 30 29 30 29 30 30 29 30 29 30 29 29 384
-1695 */{ 0 , 2 , 13 , 46496 },/* 30 29 30 30 29 30 29 30 30 29 30 29 0 355
-1696 */{ 0 , 2 , 3 , 21968 },/* 29 30 29 30 29 30 29 30 30 30 29 30 0 355
-1697 */{ 3 , 1 , 23 , 19160 },/* 29 30 29 29 30 29 30 29 30 30 29 30 30 384
-1698 */{ 0 , 2 , 11 , 18896 },/* 29 30 29 29 30 29 29 30 30 30 29 30 0 354
-1699 */{ 7 , 1 , 31 , 42168 },/* 30 29 30 29 29 30 29 29 30 29 30 30 30 384
-1700 */{ 0 , 2 , 19 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1701 */{ 0 , 2 , 8 , 43600 },/* 30 29 30 29 30 29 30 29 29 30 29 30 0 354
-1702 */{ 6 , 1 , 28 , 46376 },/* 30 29 30 30 29 30 29 30 29 29 30 29 30 384
-1703 */{ 0 , 2 , 16 , 27936 },/* 29 30 30 29 30 30 29 30 29 29 30 29 0 354
-1704 */{ 0 , 2 , 5 , 44448 },/* 30 29 30 29 30 30 29 30 30 29 30 29 0 355
-1705 */{ 4 , 1 , 25 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 29 384
-1706 */{ 0 , 2 , 13 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 0 355
-1707 */{ 0 , 2 , 3 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1708 */{ 3 , 1 , 23 , 25784 },/* 29 30 30 29 29 30 29 29 30 29 30 30 30 384
-1709 */{ 0 , 2 , 10 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1710 */{ 7 , 1 , 30 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 29 383
-1711 */{ 0 , 2 , 17 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 0 355
-1712 */{ 0 , 2 , 7 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1713 */{ 5 , 1 , 26 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 29 384
-1714 */{ 0 , 2 , 14 , 43744 },/* 30 29 30 29 30 29 30 29 30 30 30 29 0 355
-1715 */{ 0 , 2 , 4 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1716 */{ 3 , 1 , 24 , 51568 },/* 30 30 29 29 30 29 29 30 29 30 30 30 29 384
-1717 */{ 0 , 2 , 11 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-1718 */{ 8 , 1 , 31 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1719 */{ 0 , 2 , 19 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1720 */{ 0 , 2 , 8 , 54608 },/* 30 30 29 30 29 30 29 30 29 30 29 30 0 355
-1721 */{ 6 , 1 , 28 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-1722 */{ 0 , 2 , 16 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1723 */{ 0 , 2 , 5 , 42704 },/* 30 29 30 29 29 30 30 29 30 30 29 30 0 355
-1724 */{ 4 , 1 , 26 , 21224 },/* 29 30 29 30 29 29 30 29 30 30 30 29 30 384
-1725 */{ 0 , 2 , 13 , 21200 },/* 29 30 29 30 29 29 30 29 30 30 29 30 0 354
-1726 */{ 0 , 2 , 2 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1727 */{ 3 , 1 , 22 , 58536 },/* 30 30 30 29 29 30 29 29 30 29 30 29 30 384
-1728 */{ 0 , 2 , 10 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-1729 */{ 7 , 1 , 29 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-1730 */{ 0 , 2 , 17 , 40272 },/* 30 29 29 30 30 30 29 30 29 30 29 30 0 355
-1731 */{ 0 , 2 , 7 , 21920 },/* 29 30 29 30 29 30 29 30 30 29 30 29 0 354
-1732 */{ 5 , 1 , 27 , 42448 },/* 30 29 30 29 29 30 29 30 30 30 29 30 29 384
-1733 */{ 0 , 2 , 14 , 42416 },/* 30 29 30 29 29 30 29 30 30 29 30 30 0 355
-1734 */{ 0 , 2 , 4 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1735 */{ 4 , 1 , 24 , 43192 },/* 30 29 30 29 30 29 29 29 30 29 30 30 30 384
-1736 */{ 0 , 2 , 12 , 26928 },/* 29 30 30 29 30 29 29 30 29 29 30 30 0 354
-1737 */{ 9 , 1 , 31 , 27288 },/* 29 30 30 29 30 29 30 29 30 29 29 30 30 384
-1738 */{ 0 , 2 , 19 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1739 */{ 0 , 2 , 8 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1740 */{ 6 , 1 , 29 , 19880 },/* 29 30 29 29 30 30 29 30 30 29 30 29 30 384
-1741 */{ 0 , 2 , 16 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-1742 */{ 0 , 2 , 5 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1743 */{ 4 , 1 , 26 , 20848 },/* 29 30 29 30 29 29 29 30 29 30 30 30 29 383
-1744 */{ 0 , 2 , 13 , 53600 },/* 30 30 29 30 29 29 29 30 29 30 30 29 0 354
-1745 */{ 0 , 2 , 1 , 59696 },/* 30 30 30 29 30 29 29 30 29 29 30 30 0 355
-1746 */{ 3 , 1 , 22 , 27280 },/* 29 30 30 29 30 29 30 29 30 29 29 30 29 383
-1747 */{ 0 , 2 , 9 , 55968 },/* 30 30 29 30 30 29 30 29 30 29 30 29 0 355
-1748 */{ 7 , 1 , 30 , 23376 },/* 29 30 29 30 30 29 30 30 29 30 29 30 29 384
-1749 */{ 0 , 2 , 17 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-1750 */{ 0 , 2 , 7 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1751 */{ 5 , 1 , 27 , 42200 },/* 30 29 30 29 29 30 29 29 30 30 29 30 30 384
-1752 */{ 0 , 2 , 15 , 41680 },/* 30 29 30 29 29 29 30 29 30 30 29 30 0 354
-1753 */{ 0 , 2 , 3 , 53592 },/* 30 30 29 30 29 29 29 30 29 30 29 30 30 384
-1754 */{ 4 , 2 , 22 , 43600 },/* 30 29 30 29 30 29 30 29 29 30 29 30 0 354
-1755 */{ 0 , 2 , 11 , 46368 },/* 30 29 30 30 29 30 29 30 29 29 30 29 0 354
-1756 */{ 9 , 1 , 31 , 54928 },/* 30 30 29 30 29 30 30 29 30 29 29 30 29 384
-1757 */{ 0 , 2 , 18 , 44448 },/* 30 29 30 29 30 30 29 30 30 29 30 29 0 355
-1758 */{ 0 , 2 , 8 , 21968 },/* 29 30 29 30 29 30 29 30 30 30 29 30 0 355
-1759 */{ 6 , 1 , 29 , 10968 },/* 29 29 30 29 30 29 30 29 30 30 29 30 30 384
-1760 */{ 0 , 2 , 17 , 17840 },/* 29 30 29 29 29 30 29 30 30 29 30 30 0 354
-1761 */{ 0 , 2 , 5 , 41648 },/* 30 29 30 29 29 29 30 29 30 29 30 30 0 354
-1762 */{ 5 , 1 , 25 , 45400 },/* 30 29 30 30 29 29 29 30 29 30 29 30 30 384
-1763 */{ 0 , 2 , 13 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1764 */{ 0 , 2 , 2 , 46368 },/* 30 29 30 30 29 30 29 30 29 29 30 29 0 354
-1765 */{ 2 , 1 , 21 , 46480 },/* 30 29 30 30 29 30 29 30 30 29 29 30 29 384
-1766 */{ 0 , 2 , 9 , 44384 },/* 30 29 30 29 30 30 29 30 29 30 30 29 0 355
-1767 */{ 7 , 1 , 30 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 29 384
-1768 */{ 0 , 2 , 18 , 21360 },/* 29 30 29 30 29 29 30 30 29 30 30 30 0 355
-1769 */{ 0 , 2 , 7 , 17776 },/* 29 30 29 29 29 30 29 30 29 30 30 30 0 354
-1770 */{ 5 , 1 , 27 , 25272 },/* 29 30 30 29 29 29 30 29 30 29 30 30 30 384
-1771 */{ 0 , 2 , 15 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1772 */{ 0 , 2 , 4 , 26960 },/* 29 30 30 29 30 29 29 30 29 30 29 30 0 354
-1773 */{ 3 , 1 , 23 , 27816 },/* 29 30 30 29 30 30 29 29 30 29 30 29 30 384
-1774 */{ 0 , 2 , 11 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1775 */{ 10 , 1 , 31 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 29 384
-1776 */{ 0 , 2 , 19 , 42704 },/* 30 29 30 29 29 30 30 29 30 30 29 30 0 355
-1777 */{ 0 , 2 , 8 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1778 */{ 6 , 1 , 28 , 38256 },/* 30 29 29 30 29 30 29 30 29 30 30 30 29 384
-1779 */{ 0 , 2 , 16 , 42336 },/* 30 29 30 29 29 30 29 30 29 30 30 29 0 354
-1780 */{ 0 , 2 , 5 , 53920 },/* 30 30 29 30 29 29 30 29 30 29 30 29 0 354
-1781 */{ 5 , 1 , 24 , 59728 },/* 30 30 30 29 30 29 29 30 29 30 29 30 29 384
-1782 */{ 0 , 2 , 12 , 54608 },/* 30 30 29 30 29 30 29 30 29 30 29 30 0 355
-1783 */{ 0 , 2 , 2 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1784 */{ 3 , 1 , 22 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 29 384
-1785 */{ 0 , 2 , 9 , 42704 },/* 30 29 30 29 29 30 30 29 30 30 29 30 0 355
-1786 */{ 7 , 1 , 30 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-1787 */{ 0 , 2 , 18 , 19120 },/* 29 30 29 29 30 29 30 29 30 29 30 30 0 354
-1788 */{ 0 , 2 , 7 , 43216 },/* 30 29 30 29 30 29 29 29 30 30 29 30 0 354
-1789 */{ 5 , 1 , 26 , 53928 },/* 30 30 29 30 29 29 30 29 30 29 30 29 30 384
-1790 */{ 0 , 2 , 14 , 45728 },/* 30 29 30 30 29 29 30 29 30 29 30 29 0 354
-1791 */{ 0 , 2 , 3 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1792 */{ 4 , 1 , 24 , 22184 },/* 29 30 29 30 29 30 30 29 30 29 30 29 30 384
-1793 */{ 0 , 2 , 11 , 19872 },/* 29 30 29 29 30 30 29 30 30 29 30 29 0 354
-1794 */{ 0 , 1 , 31 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 0 355
-1795 */{ 2 , 1 , 21 , 19128 },/* 29 30 29 29 30 29 30 29 30 29 30 30 30 384
-1796 */{ 0 , 2 , 9 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1797 */{ 6 , 1 , 28 , 43192 },/* 30 29 30 29 30 29 29 29 30 29 30 30 30 384
-1798 */{ 0 , 2 , 16 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-1799 */{ 0 , 2 , 5 , 27280 },/* 29 30 30 29 30 29 30 29 30 29 29 30 0 354
-1800 */{ 4 , 1 , 25 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-1801 */{ 0 , 2 , 13 , 27472 },/* 29 30 30 29 30 29 30 30 29 30 29 30 0 355
-1802 */{ 0 , 2 , 3 , 11168 },/* 29 29 30 29 30 29 30 30 30 29 30 29 0 354
-1803 */{ 2 , 1 , 23 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 29 384
-1804 */{ 0 , 2 , 11 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 0 355
-1805 */{ 6 , 1 , 31 , 20848 },/* 29 30 29 30 29 29 29 30 29 30 30 30 29 383
-1806 */{ 0 , 2 , 18 , 53600 },/* 30 30 29 30 29 29 29 30 29 30 30 29 0 354
-1807 */{ 0 , 2 , 7 , 58544 },/* 30 30 30 29 29 30 29 29 30 29 30 30 0 355
-1808 */{ 5 , 1 , 28 , 27280 },/* 29 30 30 29 30 29 30 29 30 29 29 30 29 383
-1809 */{ 0 , 2 , 14 , 55952 },/* 30 30 29 30 30 29 30 29 30 29 29 30 0 355
-1810 */{ 0 , 2 , 4 , 23376 },/* 29 30 29 30 30 29 30 30 29 30 29 30 0 355
-1811 */{ 3 , 1 , 25 , 11112 },/* 29 29 30 29 30 29 30 30 29 30 30 29 30 384
-1812 */{ 0 , 2 , 13 , 10976 },/* 29 29 30 29 30 29 30 29 30 30 30 29 0 354
-1813 */{ 0 , 2 , 1 , 41696 },/* 30 29 30 29 29 29 30 29 30 30 30 29 0 354
-1814 */{ 2 , 1 , 21 , 53608 },/* 30 30 29 30 29 29 29 30 29 30 30 29 30 384
-1815 */{ 0 , 2 , 9 , 51536 },/* 30 30 29 29 30 29 29 30 29 30 29 30 0 354
-1816 */{ 6 , 1 , 29 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1817 */{ 0 , 2 , 16 , 46368 },/* 30 29 30 30 29 30 29 30 29 29 30 29 0 354
-1818 */{ 0 , 2 , 5 , 46736 },/* 30 29 30 30 29 30 30 29 30 29 29 30 0 355
-1819 */{ 4 , 1 , 26 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 29 384
-1820 */{ 0 , 2 , 14 , 21968 },/* 29 30 29 30 29 30 29 30 30 30 29 30 0 355
-1821 */{ 0 , 2 , 3 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-1822 */{ 3 , 1 , 23 , 41688 },/* 30 29 30 29 29 29 30 29 30 30 29 30 30 384
-1823 */{ 0 , 2 , 11 , 41648 },/* 30 29 30 29 29 29 30 29 30 29 30 30 0 354
-1824 */{ 7 , 1 , 31 , 43352 },/* 30 29 30 29 30 29 29 30 29 30 29 30 30 384
-1825 */{ 0 , 2 , 18 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1826 */{ 0 , 2 , 7 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-1827 */{ 5 , 1 , 27 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-1828 */{ 0 , 2 , 15 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-1829 */{ 0 , 2 , 4 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 0 355
-1830 */{ 4 , 1 , 25 , 9656 },/* 29 29 30 29 29 30 29 30 30 29 30 30 30 384
-1831 */{ 0 , 2 , 13 , 9584 },/* 29 29 30 29 29 30 29 30 29 30 30 30 0 354
-1832 */{ 9 , 2 , 2 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-1833 */{ 0 , 2 , 20 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1834 */{ 0 , 2 , 9 , 26960 },/* 29 30 30 29 30 29 29 30 29 30 29 30 0 354
-1835 */{ 6 , 1 , 29 , 27816 },/* 29 30 30 29 30 30 29 29 30 29 30 29 30 384
-1836 */{ 0 , 2 , 17 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1837 */{ 0 , 2 , 5 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1838 */{ 4 , 1 , 26 , 21352 },/* 29 30 29 30 29 29 30 30 29 30 30 29 30 384
-1839 */{ 0 , 2 , 14 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1840 */{ 0 , 2 , 3 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1841 */{ 3 , 1 , 23 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 29 383
-1842 */{ 0 , 2 , 10 , 53920 },/* 30 30 29 30 29 29 30 29 30 29 30 29 0 354
-1843 */{ 7 , 1 , 30 , 59728 },/* 30 30 30 29 30 29 29 30 29 30 29 30 29 384
-1844 */{ 0 , 2 , 18 , 54608 },/* 30 30 29 30 29 30 29 30 29 30 29 30 0 355
-1845 */{ 0 , 2 , 7 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-1846 */{ 5 , 1 , 27 , 43728 },/* 30 29 30 29 30 29 30 29 30 30 29 30 29 384
-1847 */{ 0 , 2 , 15 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 0 355
-1848 */{ 0 , 2 , 5 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1849 */{ 4 , 1 , 24 , 42328 },/* 30 29 30 29 29 30 29 30 29 30 29 30 30 384
-1850 */{ 0 , 2 , 12 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1851 */{ 8 , 2 , 1 , 53848 },/* 30 30 29 30 29 29 30 29 29 30 29 30 30 384
-1852 */{ 0 , 2 , 20 , 45712 },/* 30 29 30 30 29 29 30 29 30 29 29 30 0 354
-1853 */{ 0 , 2 , 8 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1854 */{ 7 , 1 , 29 , 22184 },/* 29 30 29 30 29 30 30 29 30 29 30 29 30 384
-1855 */{ 0 , 2 , 17 , 11680 },/* 29 29 30 29 30 30 29 30 30 29 30 29 0 354
-1856 */{ 0 , 2 , 6 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 0 355
-1857 */{ 5 , 1 , 26 , 19128 },/* 29 30 29 29 30 29 30 29 30 29 30 30 30 384
-1858 */{ 0 , 2 , 14 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1859 */{ 0 , 2 , 3 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1860 */{ 3 , 1 , 23 , 45656 },/* 30 29 30 30 29 29 30 29 29 30 29 30 30 384
-1861 */{ 0 , 2 , 10 , 27280 },/* 29 30 30 29 30 29 30 29 30 29 29 30 0 354
-1862 */{ 8 , 1 , 30 , 44360 },/* 30 29 30 29 30 30 29 30 29 30 29 29 30 384
-1863 */{ 0 , 2 , 18 , 27472 },/* 29 30 30 29 30 29 30 30 29 30 29 30 0 355
-1864 */{ 0 , 2 , 8 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1865 */{ 5 , 1 , 27 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 29 384
-1866 */{ 0 , 2 , 15 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 0 355
-1867 */{ 0 , 2 , 5 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1868 */{ 4 , 1 , 25 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 29 383
-1869 */{ 0 , 2 , 11 , 58528 },/* 30 30 30 29 29 30 29 29 30 29 30 29 0 354
-1870 */{ 10 , 1 , 31 , 59984 },/* 30 30 30 29 30 29 30 29 29 30 29 30 29 384
-1871 */{ 0 , 2 , 19 , 55952 },/* 30 30 29 30 30 29 30 29 30 29 29 30 0 355
-1872 */{ 0 , 2 , 9 , 23248 },/* 29 30 29 30 30 29 30 29 30 30 29 30 0 355
-1873 */{ 6 , 1 , 29 , 11112 },/* 29 29 30 29 30 29 30 30 29 30 30 29 30 384
-1874 */{ 0 , 2 , 17 , 10976 },/* 29 29 30 29 30 29 30 29 30 30 30 29 0 354
-1875 */{ 0 , 2 , 6 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1876 */{ 5 , 1 , 26 , 51560 },/* 30 30 29 29 30 29 29 30 29 30 30 29 30 384
-1877 */{ 0 , 2 , 13 , 51536 },/* 30 30 29 29 30 29 29 30 29 30 29 30 0 354
-1878 */{ 0 , 2 , 2 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1879 */{ 3 , 1 , 22 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 29 384
-1880 */{ 0 , 2 , 10 , 46736 },/* 30 29 30 30 29 30 30 29 30 29 29 30 0 355
-1881 */{ 7 , 1 , 30 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 29 384
-1882 */{ 0 , 2 , 18 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 0 355
-1883 */{ 0 , 2 , 8 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-1884 */{ 5 , 1 , 28 , 37592 },/* 30 29 29 30 29 29 30 29 30 30 29 30 30 384
-1885 */{ 0 , 2 , 15 , 37552 },/* 30 29 29 30 29 29 30 29 30 29 30 30 0 354
-1886 */{ 0 , 2 , 4 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1887 */{ 4 , 1 , 24 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1888 */{ 0 , 2 , 12 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-1889 */{ 0 , 1 , 31 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1890 */{ 2 , 1 , 21 , 22184 },/* 29 30 29 30 29 30 30 29 30 29 30 29 30 384
-1891 */{ 0 , 2 , 9 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 0 355
-1892 */{ 6 , 1 , 30 , 9656 },/* 29 29 30 29 29 30 29 30 30 29 30 30 30 384
-1893 */{ 0 , 2 , 17 , 9584 },/* 29 29 30 29 29 30 29 30 29 30 30 30 0 354
-1894 */{ 0 , 2 , 6 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1895 */{ 5 , 1 , 26 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 29 383
-1896 */{ 0 , 2 , 13 , 59728 },/* 30 30 30 29 30 29 29 30 29 30 29 30 0 355
-1897 */{ 0 , 2 , 2 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1898 */{ 3 , 1 , 22 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 29 384
-1899 */{ 0 , 2 , 10 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1900 */{ 8 , 1 , 31 , 19304 },/* 29 30 29 29 30 29 30 30 29 30 30 29 30 384
-1901 */{ 0 , 2 , 19 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1902 */{ 0 , 2 , 8 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1903 */{ 5 , 1 , 29 , 21096 },/* 29 30 29 30 29 29 30 29 29 30 30 29 30 383
-1904 */{ 0 , 2 , 16 , 53856 },/* 30 30 29 30 29 29 30 29 29 30 30 29 0 354
-1905 */{ 0 , 2 , 4 , 55632 },/* 30 30 29 30 30 29 29 30 29 30 29 30 0 355
-1906 */{ 4 , 1 , 25 , 27304 },/* 29 30 30 29 30 29 30 29 30 29 30 29 30 384
-1907 */{ 0 , 2 , 13 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1908 */{ 0 , 2 , 2 , 39632 },/* 30 29 29 30 30 29 30 29 30 30 29 30 0 355
-1909 */{ 2 , 1 , 22 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-1910 */{ 0 , 2 , 10 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1911 */{ 6 , 1 , 30 , 42200 },/* 30 29 30 29 29 30 29 29 30 30 29 30 30 384
-1912 */{ 0 , 2 , 18 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1913 */{ 0 , 2 , 6 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-1914 */{ 5 , 1 , 26 , 55624 },/* 30 30 29 30 30 29 29 30 29 30 29 29 30 384
-1915 */{ 0 , 2 , 14 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1916 */{ 0 , 2 , 4 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1917 */{ 2 , 1 , 23 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 29 384
-1918 */{ 0 , 2 , 11 , 38352 },/* 30 29 29 30 29 30 29 30 30 30 29 30 0 355
-1919 */{ 7 , 2 , 1 , 19160 },/* 29 30 29 29 30 29 30 29 30 30 29 30 30 384
-1920 */{ 0 , 2 , 20 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1921 */{ 0 , 2 , 8 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1922 */{ 5 , 1 , 28 , 45656 },/* 30 29 30 30 29 29 30 29 29 30 29 30 30 384
-1923 */{ 0 , 2 , 16 , 27280 },/* 29 30 30 29 30 29 30 29 30 29 29 30 0 354
-1924 */{ 0 , 2 , 5 , 44352 },/* 30 29 30 29 30 30 29 30 29 30 29 29 0 354
-1925 */{ 4 , 1 , 24 , 46504 },/* 30 29 30 30 29 30 29 30 30 29 30 29 30 385
-1926 */{ 0 , 2 , 13 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1927 */{ 0 , 2 , 2 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1928 */{ 2 , 1 , 23 , 18872 },/* 29 30 29 29 30 29 29 30 30 29 30 30 30 384
-1929 */{ 0 , 2 , 10 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1930 */{ 6 , 1 , 30 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 29 383
-1931 */{ 0 , 2 , 17 , 58528 },/* 30 30 30 29 29 30 29 29 30 29 30 29 0 354
-1932 */{ 0 , 2 , 6 , 59984 },/* 30 30 30 29 30 29 30 29 29 30 29 30 0 355
-1933 */{ 5 , 1 , 26 , 27976 },/* 29 30 30 29 30 30 29 30 29 30 29 29 30 384
-1934 */{ 0 , 2 , 14 , 23376 },/* 29 30 29 30 30 29 30 30 29 30 29 30 0 355
-1935 */{ 0 , 2 , 4 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1936 */{ 3 , 1 , 24 , 38256 },/* 30 29 29 30 29 30 29 30 29 30 30 30 29 384
-1937 */{ 0 , 2 , 11 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1938 */{ 7 , 1 , 31 , 51560 },/* 30 30 29 29 30 29 29 30 29 30 30 29 30 384
-1939 */{ 0 , 2 , 19 , 51536 },/* 30 30 29 29 30 29 29 30 29 30 29 30 0 354
-1940 */{ 0 , 2 , 8 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1941 */{ 6 , 1 , 27 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 29 384
-1942 */{ 0 , 2 , 15 , 46736 },/* 30 29 30 30 29 30 30 29 30 29 29 30 0 355
-1943 */{ 0 , 2 , 5 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-1944 */{ 4 , 1 , 26 , 10968 },/* 29 29 30 29 30 29 30 29 30 30 29 30 30 384
-1945 */{ 0 , 2 , 13 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-1946 */{ 0 , 2 , 2 , 37584 },/* 30 29 29 30 29 29 30 29 30 30 29 30 0 354
-1947 */{ 2 , 1 , 22 , 51544 },/* 30 30 29 29 30 29 29 30 29 30 29 30 30 384
-1948 */{ 0 , 2 , 10 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1949 */{ 7 , 1 , 29 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-1950 */{ 0 , 2 , 17 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-1951 */{ 0 , 2 , 6 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1952 */{ 5 , 1 , 27 , 22184 },/* 29 30 29 30 29 30 30 29 30 29 30 29 30 384
-1953 */{ 0 , 2 , 14 , 19888 },/* 29 30 29 29 30 30 29 30 30 29 30 30 0 355
-1954 */{ 0 , 2 , 4 , 9648 },/* 29 29 30 29 29 30 29 30 30 29 30 30 0 354
-1955 */{ 3 , 1 , 24 , 37560 },/* 30 29 29 30 29 29 30 29 30 29 30 30 30 384
-1956 */{ 0 , 2 , 12 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1957 */{ 8 , 1 , 31 , 43352 },/* 30 29 30 29 30 29 29 30 29 30 29 30 30 384
-1958 */{ 0 , 2 , 19 , 26960 },/* 29 30 30 29 30 29 29 30 29 30 29 30 0 354
-1959 */{ 0 , 2 , 8 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1960 */{ 6 , 1 , 28 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 29 384
-1961 */{ 0 , 2 , 15 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1962 */{ 0 , 2 , 5 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-1963 */{ 4 , 1 , 25 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-1964 */{ 0 , 2 , 13 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1965 */{ 0 , 2 , 2 , 21104 },/* 29 30 29 30 29 29 30 29 29 30 30 30 0 354
-1966 */{ 3 , 1 , 22 , 26928 },/* 29 30 30 29 30 29 29 30 29 29 30 30 29 383
-1967 */{ 0 , 2 , 9 , 55632 },/* 30 30 29 30 30 29 29 30 29 30 29 30 0 355
-1968 */{ 7 , 1 , 30 , 27304 },/* 29 30 30 29 30 29 30 29 30 29 30 29 30 384
-1969 */{ 0 , 2 , 17 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1970 */{ 0 , 2 , 6 , 39632 },/* 30 29 29 30 30 29 30 29 30 30 29 30 0 355
-1971 */{ 5 , 1 , 27 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-1972 */{ 0 , 2 , 15 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-1973 */{ 0 , 2 , 3 , 42208 },/* 30 29 30 29 29 30 29 29 30 30 30 29 0 354
-1974 */{ 4 , 1 , 23 , 53864 },/* 30 30 29 30 29 29 30 29 29 30 30 29 30 384
-1975 */{ 0 , 2 , 11 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-1976 */{ 8 , 1 , 31 , 54600 },/* 30 30 29 30 29 30 29 30 29 30 29 29 30 384
-1977 */{ 0 , 2 , 18 , 46400 },/* 30 29 30 30 29 30 29 30 29 30 29 29 0 354
-1978 */{ 0 , 2 , 7 , 54944 },/* 30 30 29 30 29 30 30 29 30 29 30 29 0 355
-1979 */{ 6 , 1 , 28 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 29 384
-1980 */{ 0 , 2 , 16 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1981 */{ 0 , 2 , 5 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1982 */{ 4 , 1 , 25 , 42200 },/* 30 29 30 29 29 30 29 29 30 30 29 30 30 384
-1983 */{ 0 , 2 , 13 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1984 */{ 10 , 2 , 2 , 45656 },/* 30 29 30 30 29 29 30 29 29 30 29 30 30 384
-1985 */{ 0 , 2 , 20 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 0 354
-1986 */{ 0 , 2 , 9 , 27968 },/* 29 30 30 29 30 30 29 30 29 30 29 29 0 354
-1987 */{ 6 , 1 , 29 , 46504 },/* 30 29 30 30 29 30 29 30 30 29 30 29 30 385
-1988 */{ 0 , 2 , 18 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1989 */{ 0 , 2 , 6 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1990 */{ 5 , 1 , 27 , 18872 },/* 29 30 29 29 30 29 29 30 30 29 30 30 30 384
-1991 */{ 0 , 2 , 15 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1992 */{ 0 , 2 , 4 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-1993 */{ 3 , 1 , 23 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 29 383
-1994 */{ 0 , 2 , 10 , 59984 },/* 30 30 30 29 30 29 30 29 29 30 29 30 0 355
-1995 */{ 8 , 1 , 31 , 27976 },/* 29 30 30 29 30 30 29 30 29 30 29 29 30 384
-1996 */{ 0 , 2 , 19 , 23248 },/* 29 30 29 30 30 29 30 29 30 30 29 30 0 355
-1997 */{ 0 , 2 , 8 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1998 */{ 5 , 1 , 28 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 29 384
-1999 */{ 0 , 2 , 16 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-2000 */{ 0 , 2 , 5 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-2001 */{ 4 , 1 , 24 , 58536 },/* 30 30 30 29 29 30 29 29 30 29 30 29 30 384
-2002 */{ 0 , 2 , 12 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-2003 */{ 0 , 2 , 1 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 0 355
-2004 */{ 2 , 1 , 22 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-2005 */{ 0 , 2 , 9 , 22208 },/* 29 30 29 30 29 30 30 29 30 30 29 29 0 354
-2006 */{ 7 , 1 , 29 , 43736 },/* 30 29 30 29 30 29 30 29 30 30 29 30 30 385
-2007 */{ 0 , 2 , 18 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-2008 */{ 0 , 2 , 7 , 37584 },/* 30 29 29 30 29 29 30 29 30 30 29 30 0 354
-2009 */{ 5 , 1 , 26 , 51544 },/* 30 30 29 29 30 29 29 30 29 30 29 30 30 384
-2010 */{ 0 , 2 , 14 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-2011 */{ 0 , 2 , 3 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-2012 */{ 3 , 1 , 23 , 47696 },/* 30 29 30 30 30 29 30 29 29 30 29 30 29 384
-2013 */{ 0 , 2 , 10 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-2014 */{ 9 , 1 , 31 , 21928 },/* 29 30 29 30 29 30 29 30 30 29 30 29 30 384
-2015 */{ 0 , 2 , 19 , 19360 },/* 29 30 29 29 30 29 30 30 30 29 30 29 0 354
-2016 */{ 0 , 2 , 8 , 42416 },/* 30 29 30 29 29 30 29 30 30 29 30 30 0 355
-2017 */{ 5 , 1 , 28 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-2018 */{ 0 , 2 , 16 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-2019 */{ 0 , 2 , 5 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-2020 */{ 4 , 1 , 25 , 46248 },/* 30 29 30 30 29 30 29 29 30 29 30 29 30 384
-2021 */{ 0 , 2 , 12 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-2022 */{ 0 , 2 , 1 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-2023 */{ 2 , 1 , 22 , 21928 },/* 29 30 29 30 29 30 29 30 30 29 30 29 30 384
-2024 */{ 0 , 2 , 10 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-2025 */{ 6 , 1 , 29 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-2026 */{ 0 , 2 , 17 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-2027 */{ 0 , 2 , 7 , 21104 },/* 29 30 29 30 29 29 30 29 29 30 30 30 0 354
-2028 */{ 5 , 1 , 27 , 26928 },/* 29 30 30 29 30 29 29 30 29 29 30 30 29 383
-2029 */{ 0 , 2 , 13 , 55600 },/* 30 30 29 30 30 29 29 30 29 29 30 30 0 355
-2030 */{ 0 , 2 , 3 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-2031 */{ 3 , 1 , 23 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 29 384
-2032 */{ 0 , 2 , 11 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-2033 */{ 11 , 1 , 31 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-2034 */{ 0 , 2 , 19 , 19168 },/* 29 30 29 29 30 29 30 29 30 30 30 29 0 354
-2035 */{ 0 , 2 , 8 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-2036 */{ 6 , 1 , 28 , 53864 },/* 30 30 29 30 29 29 30 29 29 30 30 29 30 384
-2037 */{ 0 , 2 , 15 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-2038 */{ 0 , 2 , 4 , 54560 },/* 30 30 29 30 29 30 29 30 29 29 30 29 0 354
-2039 */{ 5 , 1 , 24 , 55968 },/* 30 30 29 30 30 29 30 29 30 29 30 29 29 384
-2040 */{ 0 , 2 , 12 , 46752 },/* 30 29 30 30 29 30 30 29 30 29 30 29 0 355
-2041 */{ 0 , 2 , 1 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-2042 */{ 2 , 1 , 22 , 19160 },/* 29 30 29 29 30 29 30 29 30 30 29 30 30 384
-2043 */{ 0 , 2 , 10 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-2044 */{ 7 , 1 , 30 , 42168 },/* 30 29 30 29 29 30 29 29 30 29 30 30 30 384
-2045 */{ 0 , 2 , 17 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-2046 */{ 0 , 2 , 6 , 45648 },/* 30 29 30 30 29 29 30 29 29 30 29 30 0 354
-2047 */{ 5 , 1 , 26 , 46376 },/* 30 29 30 30 29 30 29 30 29 29 30 29 30 384
-2048 */{ 0 , 2 , 14 , 27968 },/* 29 30 30 29 30 30 29 30 29 30 29 29 0 354
-2049 */{ 0 , 2 , 2 , 44448 },/* 30 29 30 29 30 30 29 30 30 29 30 29 0 355
-2050 */{ 3 , 1 , 23 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 29 384
- */};
-
-
- internal override int MinCalendarYear
- {
- get
- {
- return (MIN_LUNISOLAR_YEAR);
- }
- }
-
- internal override int MaxCalendarYear
- {
- get
- {
- return (MAX_LUNISOLAR_YEAR);
- }
- }
-
- internal override DateTime MinDate
- {
- get
- {
- return (minDate);
- }
- }
-
- internal override DateTime MaxDate
- {
- get
- {
- return (maxDate);
- }
- }
-
- internal override EraInfo[] CalEraInfo
- {
- get
- {
- return null;
- }
- }
-
- internal override int GetYearInfo(int lunarYear, int index)
- {
- if ((lunarYear < MIN_LUNISOLAR_YEAR) || (lunarYear > MAX_LUNISOLAR_YEAR))
- {
- throw new ArgumentOutOfRangeException(
- "year",
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- MIN_LUNISOLAR_YEAR,
- MAX_LUNISOLAR_YEAR));
- }
- Contract.EndContractBlock();
- return s_yinfo[lunarYear - MIN_LUNISOLAR_YEAR, index];
- }
-
- internal override int GetYear(int year, DateTime time)
- {
- return year;
- }
-
- internal override int GetGregorianYear(int year, int era)
- {
- if (era != CurrentEra && era != GregorianEra)
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
-
- if (year < MIN_LUNISOLAR_YEAR || year > MAX_LUNISOLAR_YEAR)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range, MIN_LUNISOLAR_YEAR, MAX_LUNISOLAR_YEAR));
- }
- Contract.EndContractBlock();
-
- return year;
- }
-
- public KoreanLunisolarCalendar()
- {
- }
-
- public override int GetEra(DateTime time)
- {
- CheckTicksRange(time.Ticks);
- return (GregorianEra);
- }
-
- internal override CalendarId BaseCalendarID
- {
- get
- {
- return (CalendarId.KOREA);
- }
- }
-
- internal override CalendarId ID
- {
- get
- {
- return (CalendarId.KOREANLUNISOLAR);
- }
- }
-
-
-
- public override int[] Eras
- {
- get
- {
- return (new int[] { GregorianEra });
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/LocaleData.Unix.cs b/src/mscorlib/corefx/System/Globalization/LocaleData.Unix.cs
deleted file mode 100644
index d4c58d8a3d..0000000000
--- a/src/mscorlib/corefx/System/Globalization/LocaleData.Unix.cs
+++ /dev/null
@@ -1,4572 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-
-// This file contains the handling of Windows OS specific culture features.
-
-namespace System.Globalization
-{
- internal enum LocaleDataParts
- {
- Lcid = 0,
- AnsiCodePage = 1,
- OemCodePage = 2,
- MacCodePage = 3,
- EbcdicCodePage = 4,
- GeoId = 5,
- DigitSubstitution = 6,
- SpecificLocaleIndex = 7,
- ConsoleLocaleIndex = 8
- }
-
- internal partial class LocaleData
- {
- // this is done rather than using a large readonly array of strings to avoid
- // generating a large amount of code in the static constructor.
- // Using indices from s_localeNamesIndices, we binary search this string when mapping
- // an culture name to Lcid. Note that these names are all lowercase and are
- // sorted alphabetically (ordinal).
- private const string c_localeNames =
- // culture name Lcid
- "aa" + // 01000 - 0
- "aa-dj" + // 01000 - 2
- "aa-er" + // 01000 - 7
- "aa-et" + // 01000 - 12
- "af" + // 00036 - 17
- "af-na" + // 01000 - 19
- "af-za" + // 00436 - 24
- "agq" + // 01000 - 29
- "agq-cm" + // 01000 - 32
- "ak" + // 01000 - 38
- "ak-gh" + // 01000 - 40
- "am" + // 0005e - 45
- "am-et" + // 0045e - 47
- "ar" + // 00001 - 52
- "ar-001" + // 01000 - 54
- "ar-ae" + // 03801 - 60
- "ar-bh" + // 03c01 - 65
- "ar-dj" + // 01000 - 70
- "ar-dz" + // 01401 - 75
- "ar-eg" + // 00c01 - 80
- "ar-er" + // 01000 - 85
- "ar-il" + // 01000 - 90
- "ar-iq" + // 00801 - 95
- "ar-jo" + // 02c01 - 100
- "ar-km" + // 01000 - 105
- "ar-kw" + // 03401 - 110
- "ar-lb" + // 03001 - 115
- "ar-ly" + // 01001 - 120
- "ar-ma" + // 01801 - 125
- "ar-mr" + // 01000 - 130
- "ar-om" + // 02001 - 135
- "ar-ps" + // 01000 - 140
- "ar-qa" + // 04001 - 145
- "ar-sa" + // 00401 - 150
- "ar-sd" + // 01000 - 155
- "ar-so" + // 01000 - 160
- "ar-ss" + // 01000 - 165
- "ar-sy" + // 02801 - 170
- "ar-td" + // 01000 - 175
- "ar-tn" + // 01c01 - 180
- "ar-ye" + // 02401 - 185
- "arn" + // 0007a - 190
- "arn-cl" + // 0047a - 193
- "as" + // 0004d - 199
- "as-in" + // 0044d - 201
- "asa" + // 01000 - 206
- "asa-tz" + // 01000 - 209
- "ast" + // 01000 - 215
- "ast-es" + // 01000 - 218
- "az" + // 0002c - 224
- "az-cyrl" + // 0742c - 226
- "az-cyrl-az" + // 0082c - 233
- "az-latn" + // 0782c - 243
- "az-latn-az" + // 0042c - 250
- "ba" + // 0006d - 260
- "ba-ru" + // 0046d - 262
- "bas" + // 01000 - 267
- "bas-cm" + // 01000 - 270
- "be" + // 00023 - 276
- "be-by" + // 00423 - 278
- "bem" + // 01000 - 283
- "bem-zm" + // 01000 - 286
- "bez" + // 01000 - 292
- "bez-tz" + // 01000 - 295
- "bg" + // 00002 - 301
- "bg-bg" + // 00402 - 303
- "bin" + // 00066 - 308
- "bin-ng" + // 00466 - 311
- "bm" + // 01000 - 317
- "bm-latn" + // 01000 - 319
- "bm-latn-ml" + // 01000 - 326
- "bn" + // 00045 - 336
- "bn-bd" + // 00845 - 338
- "bn-in" + // 00445 - 343
- "bo" + // 00051 - 348
- "bo-cn" + // 00451 - 350
- "bo-in" + // 01000 - 355
- "br" + // 0007e - 360
- "br-fr" + // 0047e - 362
- "brx" + // 01000 - 367
- "brx-in" + // 01000 - 370
- "bs" + // 0781a - 376
- "bs-cyrl" + // 0641a - 378
- "bs-cyrl-ba" + // 0201a - 385
- "bs-latn" + // 0681a - 395
- "bs-latn-ba" + // 0141a - 402
- "byn" + // 01000 - 412
- "byn-er" + // 01000 - 415
- "ca" + // 00003 - 421
- "ca-ad" + // 01000 - 423
- "ca-es" + // 00403 - 428
- "ca-es-valencia" + // 00803 - 433
- "ca-fr" + // 01000 - 447
- "ca-it" + // 01000 - 452
- "ce" + // 01000 - 457
- "ce-ru" + // 01000 - 459
- "cgg" + // 01000 - 464
- "cgg-ug" + // 01000 - 467
- "chr" + // 0005c - 473
- "chr-cher" + // 07c5c - 476
- "chr-cher-us" + // 0045c - 484
- "co" + // 00083 - 495
- "co-fr" + // 00483 - 497
- "cs" + // 00005 - 502
- "cs-cz" + // 00405 - 504
- "cu" + // 01000 - 509
- "cu-ru" + // 01000 - 511
- "cy" + // 00052 - 516
- "cy-gb" + // 00452 - 518
- "da" + // 00006 - 523
- "da-dk" + // 00406 - 525
- "da-gl" + // 01000 - 530
- "dav" + // 01000 - 535
- "dav-ke" + // 01000 - 538
- "de" + // 00007 - 544
- "de-at" + // 00c07 - 546
- "de-be" + // 01000 - 551
- "de-ch" + // 00807 - 556
- "de-de" + // 00407 - 561
- "de-de_phoneb" + // 10407 - 566
- "de-it" + // 01000 - 578
- "de-li" + // 01407 - 583
- "de-lu" + // 01007 - 588
- "dje" + // 01000 - 593
- "dje-ne" + // 01000 - 596
- "dsb" + // 07c2e - 602
- "dsb-de" + // 0082e - 605
- "dua" + // 01000 - 611
- "dua-cm" + // 01000 - 614
- "dv" + // 00065 - 620
- "dv-mv" + // 00465 - 622
- "dyo" + // 01000 - 627
- "dyo-sn" + // 01000 - 630
- "dz" + // 01000 - 636
- "dz-bt" + // 00c51 - 638
- "ebu" + // 01000 - 643
- "ebu-ke" + // 01000 - 646
- "ee" + // 01000 - 652
- "ee-gh" + // 01000 - 654
- "ee-tg" + // 01000 - 659
- "el" + // 00008 - 664
- "el-cy" + // 01000 - 666
- "el-gr" + // 00408 - 671
- "en" + // 00009 - 676
- "en-001" + // 01000 - 678
- "en-029" + // 02409 - 684
- "en-150" + // 01000 - 690
- "en-ag" + // 01000 - 696
- "en-ai" + // 01000 - 701
- "en-as" + // 01000 - 706
- "en-at" + // 01000 - 711
- "en-au" + // 00c09 - 716
- "en-bb" + // 01000 - 721
- "en-be" + // 01000 - 726
- "en-bi" + // 01000 - 731
- "en-bm" + // 01000 - 736
- "en-bs" + // 01000 - 741
- "en-bw" + // 01000 - 746
- "en-bz" + // 02809 - 751
- "en-ca" + // 01009 - 756
- "en-cc" + // 01000 - 761
- "en-ch" + // 01000 - 766
- "en-ck" + // 01000 - 771
- "en-cm" + // 01000 - 776
- "en-cx" + // 01000 - 781
- "en-cy" + // 01000 - 786
- "en-de" + // 01000 - 791
- "en-dk" + // 01000 - 796
- "en-dm" + // 01000 - 801
- "en-er" + // 01000 - 806
- "en-fi" + // 01000 - 811
- "en-fj" + // 01000 - 816
- "en-fk" + // 01000 - 821
- "en-fm" + // 01000 - 826
- "en-gb" + // 00809 - 831
- "en-gd" + // 01000 - 836
- "en-gg" + // 01000 - 841
- "en-gh" + // 01000 - 846
- "en-gi" + // 01000 - 851
- "en-gm" + // 01000 - 856
- "en-gu" + // 01000 - 861
- "en-gy" + // 01000 - 866
- "en-hk" + // 03c09 - 871
- "en-id" + // 03809 - 876
- "en-ie" + // 01809 - 881
- "en-il" + // 01000 - 886
- "en-im" + // 01000 - 891
- "en-in" + // 04009 - 896
- "en-io" + // 01000 - 901
- "en-je" + // 01000 - 906
- "en-jm" + // 02009 - 911
- "en-ke" + // 01000 - 916
- "en-ki" + // 01000 - 921
- "en-kn" + // 01000 - 926
- "en-ky" + // 01000 - 931
- "en-lc" + // 01000 - 936
- "en-lr" + // 01000 - 941
- "en-ls" + // 01000 - 946
- "en-mg" + // 01000 - 951
- "en-mh" + // 01000 - 956
- "en-mo" + // 01000 - 961
- "en-mp" + // 01000 - 966
- "en-ms" + // 01000 - 971
- "en-mt" + // 01000 - 976
- "en-mu" + // 01000 - 981
- "en-mw" + // 01000 - 986
- "en-my" + // 04409 - 991
- "en-na" + // 01000 - 996
- "en-nf" + // 01000 - 1001
- "en-ng" + // 01000 - 1006
- "en-nl" + // 01000 - 1011
- "en-nr" + // 01000 - 1016
- "en-nu" + // 01000 - 1021
- "en-nz" + // 01409 - 1026
- "en-pg" + // 01000 - 1031
- "en-ph" + // 03409 - 1036
- "en-pk" + // 01000 - 1041
- "en-pn" + // 01000 - 1046
- "en-pr" + // 01000 - 1051
- "en-pw" + // 01000 - 1056
- "en-rw" + // 01000 - 1061
- "en-sb" + // 01000 - 1066
- "en-sc" + // 01000 - 1071
- "en-sd" + // 01000 - 1076
- "en-se" + // 01000 - 1081
- "en-sg" + // 04809 - 1086
- "en-sh" + // 01000 - 1091
- "en-si" + // 01000 - 1096
- "en-sl" + // 01000 - 1101
- "en-ss" + // 01000 - 1106
- "en-sx" + // 01000 - 1111
- "en-sz" + // 01000 - 1116
- "en-tc" + // 01000 - 1121
- "en-tk" + // 01000 - 1126
- "en-to" + // 01000 - 1131
- "en-tt" + // 02c09 - 1136
- "en-tv" + // 01000 - 1141
- "en-tz" + // 01000 - 1146
- "en-ug" + // 01000 - 1151
- "en-um" + // 01000 - 1156
- "en-us" + // 00409 - 1161
- "en-vc" + // 01000 - 1166
- "en-vg" + // 01000 - 1171
- "en-vi" + // 01000 - 1176
- "en-vu" + // 01000 - 1181
- "en-ws" + // 01000 - 1186
- "en-za" + // 01c09 - 1191
- "en-zm" + // 01000 - 1196
- "en-zw" + // 03009 - 1201
- "eo" + // 01000 - 1206
- "eo-001" + // 01000 - 1208
- "es" + // 0000a - 1214
- "es-419" + // 0580a - 1216
- "es-ar" + // 02c0a - 1222
- "es-bo" + // 0400a - 1227
- "es-br" + // 01000 - 1232
- "es-cl" + // 0340a - 1237
- "es-co" + // 0240a - 1242
- "es-cr" + // 0140a - 1247
- "es-cu" + // 05c0a - 1252
- "es-do" + // 01c0a - 1257
- "es-ec" + // 0300a - 1262
- "es-es" + // 00c0a - 1267
- "es-es_tradnl" + // 0040a - 1272
- "es-gq" + // 01000 - 1284
- "es-gt" + // 0100a - 1289
- "es-hn" + // 0480a - 1294
- "es-mx" + // 0080a - 1299
- "es-ni" + // 04c0a - 1304
- "es-pa" + // 0180a - 1309
- "es-pe" + // 0280a - 1314
- "es-ph" + // 01000 - 1319
- "es-pr" + // 0500a - 1324
- "es-py" + // 03c0a - 1329
- "es-sv" + // 0440a - 1334
- "es-us" + // 0540a - 1339
- "es-uy" + // 0380a - 1344
- "es-ve" + // 0200a - 1349
- "et" + // 00025 - 1354
- "et-ee" + // 00425 - 1356
- "eu" + // 0002d - 1361
- "eu-es" + // 0042d - 1363
- "ewo" + // 01000 - 1368
- "ewo-cm" + // 01000 - 1371
- "fa" + // 00029 - 1377
- "fa-ir" + // 00429 - 1379
- "ff" + // 00067 - 1384
- "ff-cm" + // 01000 - 1386
- "ff-gn" + // 01000 - 1391
- "ff-latn" + // 07c67 - 1396
- "ff-latn-sn" + // 00867 - 1403
- "ff-mr" + // 01000 - 1413
- "ff-ng" + // 00467 - 1418
- "fi" + // 0000b - 1423
- "fi-fi" + // 0040b - 1425
- "fil" + // 00064 - 1430
- "fil-ph" + // 00464 - 1433
- "fo" + // 00038 - 1439
- "fo-dk" + // 01000 - 1441
- "fo-fo" + // 00438 - 1446
- "fr" + // 0000c - 1451
- "fr-029" + // 01c0c - 1453
- "fr-be" + // 0080c - 1459
- "fr-bf" + // 01000 - 1464
- "fr-bi" + // 01000 - 1469
- "fr-bj" + // 01000 - 1474
- "fr-bl" + // 01000 - 1479
- "fr-ca" + // 00c0c - 1484
- "fr-cd" + // 0240c - 1489
- "fr-cf" + // 01000 - 1494
- "fr-cg" + // 01000 - 1499
- "fr-ch" + // 0100c - 1504
- "fr-ci" + // 0300c - 1509
- "fr-cm" + // 02c0c - 1514
- "fr-dj" + // 01000 - 1519
- "fr-dz" + // 01000 - 1524
- "fr-fr" + // 0040c - 1529
- "fr-ga" + // 01000 - 1534
- "fr-gf" + // 01000 - 1539
- "fr-gn" + // 01000 - 1544
- "fr-gp" + // 01000 - 1549
- "fr-gq" + // 01000 - 1554
- "fr-ht" + // 03c0c - 1559
- "fr-km" + // 01000 - 1564
- "fr-lu" + // 0140c - 1569
- "fr-ma" + // 0380c - 1574
- "fr-mc" + // 0180c - 1579
- "fr-mf" + // 01000 - 1584
- "fr-mg" + // 01000 - 1589
- "fr-ml" + // 0340c - 1594
- "fr-mq" + // 01000 - 1599
- "fr-mr" + // 01000 - 1604
- "fr-mu" + // 01000 - 1609
- "fr-nc" + // 01000 - 1614
- "fr-ne" + // 01000 - 1619
- "fr-pf" + // 01000 - 1624
- "fr-pm" + // 01000 - 1629
- "fr-re" + // 0200c - 1634
- "fr-rw" + // 01000 - 1639
- "fr-sc" + // 01000 - 1644
- "fr-sn" + // 0280c - 1649
- "fr-sy" + // 01000 - 1654
- "fr-td" + // 01000 - 1659
- "fr-tg" + // 01000 - 1664
- "fr-tn" + // 01000 - 1669
- "fr-vu" + // 01000 - 1674
- "fr-wf" + // 01000 - 1679
- "fr-yt" + // 01000 - 1684
- "fur" + // 01000 - 1689
- "fur-it" + // 01000 - 1692
- "fy" + // 00062 - 1698
- "fy-nl" + // 00462 - 1700
- "ga" + // 0003c - 1705
- "ga-ie" + // 0083c - 1707
- "gd" + // 00091 - 1712
- "gd-gb" + // 00491 - 1714
- "gl" + // 00056 - 1719
- "gl-es" + // 00456 - 1721
- "gn" + // 00074 - 1726
- "gn-py" + // 00474 - 1728
- "gsw" + // 00084 - 1733
- "gsw-ch" + // 01000 - 1736
- "gsw-fr" + // 00484 - 1742
- "gsw-li" + // 01000 - 1748
- "gu" + // 00047 - 1754
- "gu-in" + // 00447 - 1756
- "guz" + // 01000 - 1761
- "guz-ke" + // 01000 - 1764
- "gv" + // 01000 - 1770
- "gv-im" + // 01000 - 1772
- "ha" + // 00068 - 1777
- "ha-latn" + // 07c68 - 1779
- "ha-latn-gh" + // 01000 - 1786
- "ha-latn-ne" + // 01000 - 1796
- "ha-latn-ng" + // 00468 - 1806
- "haw" + // 00075 - 1816
- "haw-us" + // 00475 - 1819
- "he" + // 0000d - 1825
- "he-il" + // 0040d - 1827
- "hi" + // 00039 - 1832
- "hi-in" + // 00439 - 1834
- "hr" + // 0001a - 1839
- "hr-ba" + // 0101a - 1841
- "hr-hr" + // 0041a - 1846
- "hsb" + // 0002e - 1851
- "hsb-de" + // 0042e - 1854
- "hu" + // 0000e - 1860
- "hu-hu" + // 0040e - 1862
- "hu-hu_technl" + // 1040e - 1867
- "hy" + // 0002b - 1879
- "hy-am" + // 0042b - 1881
- "ia" + // 01000 - 1886
- "ia-001" + // 01000 - 1888
- "ia-fr" + // 01000 - 1894
- "ibb" + // 00069 - 1899
- "ibb-ng" + // 00469 - 1902
- "id" + // 00021 - 1908
- "id-id" + // 00421 - 1910
- "ig" + // 00070 - 1915
- "ig-ng" + // 00470 - 1917
- "ii" + // 00078 - 1922
- "ii-cn" + // 00478 - 1924
- "is" + // 0000f - 1929
- "is-is" + // 0040f - 1931
- "it" + // 00010 - 1936
- "it-ch" + // 00810 - 1938
- "it-it" + // 00410 - 1943
- "it-sm" + // 01000 - 1948
- "iu" + // 0005d - 1953
- "iu-cans" + // 0785d - 1955
- "iu-cans-ca" + // 0045d - 1962
- "iu-latn" + // 07c5d - 1972
- "iu-latn-ca" + // 0085d - 1979
- "ja" + // 00011 - 1989
- "ja-jp" + // 00411 - 1991
- "ja-jp_radstr" + // 40411 - 1996
- "jgo" + // 01000 - 2008
- "jgo-cm" + // 01000 - 2011
- "jmc" + // 01000 - 2017
- "jmc-tz" + // 01000 - 2020
- "jv" + // 01000 - 2026
- "jv-java" + // 01000 - 2028
- "jv-java-id" + // 01000 - 2035
- "jv-latn" + // 01000 - 2045
- "jv-latn-id" + // 01000 - 2052
- "ka" + // 00037 - 2062
- "ka-ge" + // 00437 - 2064
- "ka-ge_modern" + // 10437 - 2069
- "kab" + // 01000 - 2081
- "kab-dz" + // 01000 - 2084
- "kam" + // 01000 - 2090
- "kam-ke" + // 01000 - 2093
- "kde" + // 01000 - 2099
- "kde-tz" + // 01000 - 2102
- "kea" + // 01000 - 2108
- "kea-cv" + // 01000 - 2111
- "khq" + // 01000 - 2117
- "khq-ml" + // 01000 - 2120
- "ki" + // 01000 - 2126
- "ki-ke" + // 01000 - 2128
- "kk" + // 0003f - 2133
- "kk-kz" + // 0043f - 2135
- "kkj" + // 01000 - 2140
- "kkj-cm" + // 01000 - 2143
- "kl" + // 0006f - 2149
- "kl-gl" + // 0046f - 2151
- "kln" + // 01000 - 2156
- "kln-ke" + // 01000 - 2159
- "km" + // 00053 - 2165
- "km-kh" + // 00453 - 2167
- "kn" + // 0004b - 2172
- "kn-in" + // 0044b - 2174
- "ko" + // 00012 - 2179
- "ko-kp" + // 01000 - 2181
- "ko-kr" + // 00412 - 2186
- "kok" + // 00057 - 2191
- "kok-in" + // 00457 - 2194
- "kr" + // 00071 - 2200
- "kr-ng" + // 00471 - 2202
- "ks" + // 00060 - 2207
- "ks-arab" + // 00460 - 2209
- "ks-arab-in" + // 01000 - 2216
- "ks-deva" + // 01000 - 2226
- "ks-deva-in" + // 00860 - 2233
- "ksb" + // 01000 - 2243
- "ksb-tz" + // 01000 - 2246
- "ksf" + // 01000 - 2252
- "ksf-cm" + // 01000 - 2255
- "ksh" + // 01000 - 2261
- "ksh-de" + // 01000 - 2264
- "ku" + // 00092 - 2270
- "ku-arab" + // 07c92 - 2272
- "ku-arab-iq" + // 00492 - 2279
- "ku-arab-ir" + // 01000 - 2289
- "kw" + // 01000 - 2299
- "kw-gb" + // 01000 - 2301
- "ky" + // 00040 - 2306
- "ky-kg" + // 00440 - 2308
- "la" + // 00076 - 2313
- "la-001" + // 00476 - 2315
- "lag" + // 01000 - 2321
- "lag-tz" + // 01000 - 2324
- "lb" + // 0006e - 2330
- "lb-lu" + // 0046e - 2332
- "lg" + // 01000 - 2337
- "lg-ug" + // 01000 - 2339
- "lkt" + // 01000 - 2344
- "lkt-us" + // 01000 - 2347
- "ln" + // 01000 - 2353
- "ln-ao" + // 01000 - 2355
- "ln-cd" + // 01000 - 2360
- "ln-cf" + // 01000 - 2365
- "ln-cg" + // 01000 - 2370
- "lo" + // 00054 - 2375
- "lo-la" + // 00454 - 2377
- "lrc" + // 01000 - 2382
- "lrc-iq" + // 01000 - 2385
- "lrc-ir" + // 01000 - 2391
- "lt" + // 00027 - 2397
- "lt-lt" + // 00427 - 2399
- "lu" + // 01000 - 2404
- "lu-cd" + // 01000 - 2406
- "luo" + // 01000 - 2411
- "luo-ke" + // 01000 - 2414
- "luy" + // 01000 - 2420
- "luy-ke" + // 01000 - 2423
- "lv" + // 00026 - 2429
- "lv-lv" + // 00426 - 2431
- "mas" + // 01000 - 2436
- "mas-ke" + // 01000 - 2439
- "mas-tz" + // 01000 - 2445
- "mer" + // 01000 - 2451
- "mer-ke" + // 01000 - 2454
- "mfe" + // 01000 - 2460
- "mfe-mu" + // 01000 - 2463
- "mg" + // 01000 - 2469
- "mg-mg" + // 01000 - 2471
- "mgh" + // 01000 - 2476
- "mgh-mz" + // 01000 - 2479
- "mgo" + // 01000 - 2485
- "mgo-cm" + // 01000 - 2488
- "mi" + // 00081 - 2494
- "mi-nz" + // 00481 - 2496
- "mk" + // 0002f - 2501
- "mk-mk" + // 0042f - 2503
- "ml" + // 0004c - 2508
- "ml-in" + // 0044c - 2510
- "mn" + // 00050 - 2515
- "mn-cyrl" + // 07850 - 2517
- "mn-mn" + // 00450 - 2524
- "mn-mong" + // 07c50 - 2529
- "mn-mong-cn" + // 00850 - 2536
- "mn-mong-mn" + // 00c50 - 2546
- "mni" + // 00058 - 2556
- "mni-in" + // 00458 - 2559
- "moh" + // 0007c - 2565
- "moh-ca" + // 0047c - 2568
- "mr" + // 0004e - 2574
- "mr-in" + // 0044e - 2576
- "ms" + // 0003e - 2581
- "ms-bn" + // 0083e - 2583
- "ms-my" + // 0043e - 2588
- "ms-sg" + // 01000 - 2593
- "mt" + // 0003a - 2598
- "mt-mt" + // 0043a - 2600
- "mua" + // 01000 - 2605
- "mua-cm" + // 01000 - 2608
- "my" + // 00055 - 2614
- "my-mm" + // 00455 - 2616
- "mzn" + // 01000 - 2621
- "mzn-ir" + // 01000 - 2624
- "naq" + // 01000 - 2630
- "naq-na" + // 01000 - 2633
- "nb" + // 07c14 - 2639
- "nb-no" + // 00414 - 2641
- "nb-sj" + // 01000 - 2646
- "nd" + // 01000 - 2651
- "nd-zw" + // 01000 - 2653
- "nds" + // 01000 - 2658
- "nds-de" + // 01000 - 2661
- "nds-nl" + // 01000 - 2667
- "ne" + // 00061 - 2673
- "ne-in" + // 00861 - 2675
- "ne-np" + // 00461 - 2680
- "nl" + // 00013 - 2685
- "nl-aw" + // 01000 - 2687
- "nl-be" + // 00813 - 2692
- "nl-bq" + // 01000 - 2697
- "nl-cw" + // 01000 - 2702
- "nl-nl" + // 00413 - 2707
- "nl-sr" + // 01000 - 2712
- "nl-sx" + // 01000 - 2717
- "nmg" + // 01000 - 2722
- "nmg-cm" + // 01000 - 2725
- "nn" + // 07814 - 2731
- "nn-no" + // 00814 - 2733
- "nnh" + // 01000 - 2738
- "nnh-cm" + // 01000 - 2741
- "no" + // 00014 - 2747
- "nqo" + // 01000 - 2749
- "nqo-gn" + // 01000 - 2752
- "nr" + // 01000 - 2758
- "nr-za" + // 01000 - 2760
- "nso" + // 0006c - 2765
- "nso-za" + // 0046c - 2768
- "nus" + // 01000 - 2774
- "nus-ss" + // 01000 - 2777
- "nyn" + // 01000 - 2783
- "nyn-ug" + // 01000 - 2786
- "oc" + // 00082 - 2792
- "oc-fr" + // 00482 - 2794
- "om" + // 00072 - 2799
- "om-et" + // 00472 - 2801
- "om-ke" + // 01000 - 2806
- "or" + // 00048 - 2811
- "or-in" + // 00448 - 2813
- "os" + // 01000 - 2818
- "os-ge" + // 01000 - 2820
- "os-ru" + // 01000 - 2825
- "pa" + // 00046 - 2830
- "pa-arab" + // 07c46 - 2832
- "pa-arab-pk" + // 00846 - 2839
- "pa-in" + // 00446 - 2849
- "pap" + // 00079 - 2854
- "pap-029" + // 00479 - 2857
- "pl" + // 00015 - 2864
- "pl-pl" + // 00415 - 2866
- "prg" + // 01000 - 2871
- "prg-001" + // 01000 - 2874
- "prs" + // 0008c - 2881
- "prs-af" + // 0048c - 2884
- "ps" + // 00063 - 2890
- "ps-af" + // 00463 - 2892
- "pt" + // 00016 - 2897
- "pt-ao" + // 01000 - 2899
- "pt-br" + // 00416 - 2904
- "pt-ch" + // 01000 - 2909
- "pt-cv" + // 01000 - 2914
- "pt-gq" + // 01000 - 2919
- "pt-gw" + // 01000 - 2924
- "pt-lu" + // 01000 - 2929
- "pt-mo" + // 01000 - 2934
- "pt-mz" + // 01000 - 2939
- "pt-pt" + // 00816 - 2944
- "pt-st" + // 01000 - 2949
- "pt-tl" + // 01000 - 2954
- "qps-latn-x-sh" + // 00901 - 2959
- "qps-ploc" + // 00501 - 2972
- "qps-ploca" + // 005fe - 2980
- "qps-plocm" + // 009ff - 2989
- "quc" + // 00086 - 2998
- "quc-latn" + // 07c86 - 3001
- "quc-latn-gt" + // 00486 - 3009
- "quz" + // 0006b - 3020
- "quz-bo" + // 0046b - 3023
- "quz-ec" + // 0086b - 3029
- "quz-pe" + // 00c6b - 3035
- "rm" + // 00017 - 3041
- "rm-ch" + // 00417 - 3043
- "rn" + // 01000 - 3048
- "rn-bi" + // 01000 - 3050
- "ro" + // 00018 - 3055
- "ro-md" + // 00818 - 3057
- "ro-ro" + // 00418 - 3062
- "rof" + // 01000 - 3067
- "rof-tz" + // 01000 - 3070
- "ru" + // 00019 - 3076
- "ru-by" + // 01000 - 3078
- "ru-kg" + // 01000 - 3083
- "ru-kz" + // 01000 - 3088
- "ru-md" + // 00819 - 3093
- "ru-ru" + // 00419 - 3098
- "ru-ua" + // 01000 - 3103
- "rw" + // 00087 - 3108
- "rw-rw" + // 00487 - 3110
- "rwk" + // 01000 - 3115
- "rwk-tz" + // 01000 - 3118
- "sa" + // 0004f - 3124
- "sa-in" + // 0044f - 3126
- "sah" + // 00085 - 3131
- "sah-ru" + // 00485 - 3134
- "saq" + // 01000 - 3140
- "saq-ke" + // 01000 - 3143
- "sbp" + // 01000 - 3149
- "sbp-tz" + // 01000 - 3152
- "sd" + // 00059 - 3158
- "sd-arab" + // 07c59 - 3160
- "sd-arab-pk" + // 00859 - 3167
- "sd-deva" + // 01000 - 3177
- "sd-deva-in" + // 00459 - 3184
- "se" + // 0003b - 3194
- "se-fi" + // 00c3b - 3196
- "se-no" + // 0043b - 3201
- "se-se" + // 0083b - 3206
- "seh" + // 01000 - 3211
- "seh-mz" + // 01000 - 3214
- "ses" + // 01000 - 3220
- "ses-ml" + // 01000 - 3223
- "sg" + // 01000 - 3229
- "sg-cf" + // 01000 - 3231
- "shi" + // 01000 - 3236
- "shi-latn" + // 01000 - 3239
- "shi-latn-ma" + // 01000 - 3247
- "shi-tfng" + // 01000 - 3258
- "shi-tfng-ma" + // 01000 - 3266
- "si" + // 0005b - 3277
- "si-lk" + // 0045b - 3279
- "sk" + // 0001b - 3284
- "sk-sk" + // 0041b - 3286
- "sl" + // 00024 - 3291
- "sl-si" + // 00424 - 3293
- "sma" + // 0783b - 3298
- "sma-no" + // 0183b - 3301
- "sma-se" + // 01c3b - 3307
- "smj" + // 07c3b - 3313
- "smj-no" + // 0103b - 3316
- "smj-se" + // 0143b - 3322
- "smn" + // 0703b - 3328
- "smn-fi" + // 0243b - 3331
- "sms" + // 0743b - 3337
- "sms-fi" + // 0203b - 3340
- "sn" + // 01000 - 3346
- "sn-latn" + // 01000 - 3348
- "sn-latn-zw" + // 01000 - 3355
- "so" + // 00077 - 3365
- "so-dj" + // 01000 - 3367
- "so-et" + // 01000 - 3372
- "so-ke" + // 01000 - 3377
- "so-so" + // 00477 - 3382
- "sq" + // 0001c - 3387
- "sq-al" + // 0041c - 3389
- "sq-mk" + // 01000 - 3394
- "sq-xk" + // 01000 - 3399
- "sr" + // 07c1a - 3404
- "sr-cyrl" + // 06c1a - 3406
- "sr-cyrl-ba" + // 01c1a - 3413
- "sr-cyrl-cs" + // 00c1a - 3423
- "sr-cyrl-me" + // 0301a - 3433
- "sr-cyrl-rs" + // 0281a - 3443
- "sr-cyrl-xk" + // 01000 - 3453
- "sr-latn" + // 0701a - 3463
- "sr-latn-ba" + // 0181a - 3470
- "sr-latn-cs" + // 0081a - 3480
- "sr-latn-me" + // 02c1a - 3490
- "sr-latn-rs" + // 0241a - 3500
- "sr-latn-xk" + // 01000 - 3510
- "ss" + // 01000 - 3520
- "ss-sz" + // 01000 - 3522
- "ss-za" + // 01000 - 3527
- "ssy" + // 01000 - 3532
- "ssy-er" + // 01000 - 3535
- "st" + // 00030 - 3541
- "st-ls" + // 01000 - 3543
- "st-za" + // 00430 - 3548
- "sv" + // 0001d - 3553
- "sv-ax" + // 01000 - 3555
- "sv-fi" + // 0081d - 3560
- "sv-se" + // 0041d - 3565
- "sw" + // 00041 - 3570
- "sw-cd" + // 01000 - 3572
- "sw-ke" + // 00441 - 3577
- "sw-tz" + // 01000 - 3582
- "sw-ug" + // 01000 - 3587
- "swc" + // 01000 - 3592
- "swc-cd" + // 01000 - 3595
- "syr" + // 0005a - 3601
- "syr-sy" + // 0045a - 3604
- "ta" + // 00049 - 3610
- "ta-in" + // 00449 - 3612
- "ta-lk" + // 00849 - 3617
- "ta-my" + // 01000 - 3622
- "ta-sg" + // 01000 - 3627
- "te" + // 0004a - 3632
- "te-in" + // 0044a - 3634
- "teo" + // 01000 - 3639
- "teo-ke" + // 01000 - 3642
- "teo-ug" + // 01000 - 3648
- "tg" + // 00028 - 3654
- "tg-cyrl" + // 07c28 - 3656
- "tg-cyrl-tj" + // 00428 - 3663
- "th" + // 0001e - 3673
- "th-th" + // 0041e - 3675
- "ti" + // 00073 - 3680
- "ti-er" + // 00873 - 3682
- "ti-et" + // 00473 - 3687
- "tig" + // 01000 - 3692
- "tig-er" + // 01000 - 3695
- "tk" + // 00042 - 3701
- "tk-tm" + // 00442 - 3703
- "tn" + // 00032 - 3708
- "tn-bw" + // 00832 - 3710
- "tn-za" + // 00432 - 3715
- "to" + // 01000 - 3720
- "to-to" + // 01000 - 3722
- "tr" + // 0001f - 3727
- "tr-cy" + // 01000 - 3729
- "tr-tr" + // 0041f - 3734
- "ts" + // 00031 - 3739
- "ts-za" + // 00431 - 3741
- "tt" + // 00044 - 3746
- "tt-ru" + // 00444 - 3748
- "twq" + // 01000 - 3753
- "twq-ne" + // 01000 - 3756
- "tzm" + // 0005f - 3762
- "tzm-arab" + // 01000 - 3765
- "tzm-arab-ma" + // 0045f - 3773
- "tzm-latn" + // 07c5f - 3784
- "tzm-latn-dz" + // 0085f - 3792
- "tzm-latn-ma" + // 01000 - 3803
- "tzm-tfng" + // 0785f - 3814
- "tzm-tfng-ma" + // 0105f - 3822
- "ug" + // 00080 - 3833
- "ug-cn" + // 00480 - 3835
- "uk" + // 00022 - 3840
- "uk-ua" + // 00422 - 3842
- "ur" + // 00020 - 3847
- "ur-in" + // 00820 - 3849
- "ur-pk" + // 00420 - 3854
- "uz" + // 00043 - 3859
- "uz-arab" + // 01000 - 3861
- "uz-arab-af" + // 01000 - 3868
- "uz-cyrl" + // 07843 - 3878
- "uz-cyrl-uz" + // 00843 - 3885
- "uz-latn" + // 07c43 - 3895
- "uz-latn-uz" + // 00443 - 3902
- "vai" + // 01000 - 3912
- "vai-latn" + // 01000 - 3915
- "vai-latn-lr" + // 01000 - 3923
- "vai-vaii" + // 01000 - 3934
- "vai-vaii-lr" + // 01000 - 3942
- "ve" + // 00033 - 3953
- "ve-za" + // 00433 - 3955
- "vi" + // 0002a - 3960
- "vi-vn" + // 0042a - 3962
- "vo" + // 01000 - 3967
- "vo-001" + // 01000 - 3969
- "vun" + // 01000 - 3975
- "vun-tz" + // 01000 - 3978
- "wae" + // 01000 - 3984
- "wae-ch" + // 01000 - 3987
- "wal" + // 01000 - 3993
- "wal-et" + // 01000 - 3996
- "wo" + // 00088 - 4002
- "wo-sn" + // 00488 - 4004
- "x-iv_mathan" + // 1007f - 4009
- "xh" + // 00034 - 4020
- "xh-za" + // 00434 - 4022
- "xog" + // 01000 - 4027
- "xog-ug" + // 01000 - 4030
- "yav" + // 01000 - 4036
- "yav-cm" + // 01000 - 4039
- "yi" + // 0003d - 4045
- "yi-001" + // 0043d - 4047
- "yo" + // 0006a - 4053
- "yo-bj" + // 01000 - 4055
- "yo-ng" + // 0046a - 4060
- "yue" + // 01000 - 4065
- "yue-hk" + // 01000 - 4068
- "zgh" + // 01000 - 4074
- "zgh-tfng" + // 01000 - 4077
- "zgh-tfng-ma" + // 01000 - 4085
- "zh" + // 07804 - 4096
- "zh-chs" + // 00004 - 4098
- "zh-cht" + // 07c04 - 4104
- "zh-cn" + // 00804 - 4110
- "zh-cn_phoneb" + // 50804 - 4115
- "zh-cn_stroke" + // 20804 - 4127
- "zh-hans" + // 00004 - 4139
- "zh-hans-hk" + // 01000 - 4146
- "zh-hans-mo" + // 01000 - 4156
- "zh-hant" + // 07c04 - 4166
- "zh-hk" + // 00c04 - 4173
- "zh-hk_radstr" + // 40c04 - 4178
- "zh-mo" + // 01404 - 4190
- "zh-mo_radstr" + // 41404 - 4195
- "zh-mo_stroke" + // 21404 - 4207
- "zh-sg" + // 01004 - 4219
- "zh-sg_phoneb" + // 51004 - 4224
- "zh-sg_stroke" + // 21004 - 4236
- "zh-tw" + // 00404 - 4248
- "zh-tw_pronun" + // 30404 - 4253
- "zh-tw_radstr" + // 40404 - 4265
- "zu" + // 00035 - 4277
- "zu-za"; // 00435 - 4279
-
- // c_threeLetterWindowsLanguageName is string containing 3-letter Windows language names
- // every 3-characters entry is matching locale name entry in c_localeNames
-
- private const string c_threeLetterWindowsLanguageName =
- "ZZZ" + // aa
- "ZZZ" + // aa-dj
- "ZZZ" + // aa-er
- "ZZZ" + // aa-et
- "AFK" + // af
- "ZZZ" + // af-na
- "AFK" + // af-za
- "ZZZ" + // agq
- "ZZZ" + // agq-cm
- "ZZZ" + // ak
- "ZZZ" + // ak-gh
- "AMH" + // am
- "AMH" + // am-et
- "ARA" + // ar
- "ZZZ" + // ar-001
- "ARU" + // ar-ae
- "ARH" + // ar-bh
- "ZZZ" + // ar-dj
- "ARG" + // ar-dz
- "ARE" + // ar-eg
- "ZZZ" + // ar-er
- "ZZZ" + // ar-il
- "ARI" + // ar-iq
- "ARJ" + // ar-jo
- "ZZZ" + // ar-km
- "ARK" + // ar-kw
- "ARB" + // ar-lb
- "ARL" + // ar-ly
- "ARM" + // ar-ma
- "ZZZ" + // ar-mr
- "ARO" + // ar-om
- "ZZZ" + // ar-ps
- "ARQ" + // ar-qa
- "ARA" + // ar-sa
- "ZZZ" + // ar-sd
- "ZZZ" + // ar-so
- "ZZZ" + // ar-ss
- "ARS" + // ar-sy
- "ZZZ" + // ar-td
- "ART" + // ar-tn
- "ARY" + // ar-ye
- "MPD" + // arn
- "MPD" + // arn-cl
- "ASM" + // as
- "ASM" + // as-in
- "ZZZ" + // asa
- "ZZZ" + // asa-tz
- "ZZZ" + // ast
- "ZZZ" + // ast-es
- "AZE" + // az
- "AZC" + // az-cyrl
- "AZC" + // az-cyrl-az
- "AZE" + // az-latn
- "AZE" + // az-latn-az
- "BAS" + // ba
- "BAS" + // ba-ru
- "ZZZ" + // bas
- "ZZZ" + // bas-cm
- "BEL" + // be
- "BEL" + // be-by
- "ZZZ" + // bem
- "ZZZ" + // bem-zm
- "ZZZ" + // bez
- "ZZZ" + // bez-tz
- "BGR" + // bg
- "BGR" + // bg-bg
- "ZZZ" + // bin
- "ZZZ" + // bin-ng
- "ZZZ" + // bm
- "ZZZ" + // bm-latn
- "ZZZ" + // bm-latn-ml
- "BNB" + // bn
- "BNB" + // bn-bd
- "BNG" + // bn-in
- "BOB" + // bo
- "BOB" + // bo-cn
- "ZZZ" + // bo-in
- "BRE" + // br
- "BRE" + // br-fr
- "ZZZ" + // brx
- "ZZZ" + // brx-in
- "BSB" + // bs
- "BSC" + // bs-cyrl
- "BSC" + // bs-cyrl-ba
- "BSB" + // bs-latn
- "BSB" + // bs-latn-ba
- "ZZZ" + // byn
- "ZZZ" + // byn-er
- "CAT" + // ca
- "ZZZ" + // ca-ad
- "CAT" + // ca-es
- "VAL" + // ca-es-valencia
- "ZZZ" + // ca-fr
- "ZZZ" + // ca-it
- "ZZZ" + // ce
- "ZZZ" + // ce-ru
- "ZZZ" + // cgg
- "ZZZ" + // cgg-ug
- "CRE" + // chr
- "CRE" + // chr-cher
- "CRE" + // chr-cher-us
- "COS" + // co
- "COS" + // co-fr
- "CSY" + // cs
- "CSY" + // cs-cz
- "ZZZ" + // cu
- "ZZZ" + // cu-ru
- "CYM" + // cy
- "CYM" + // cy-gb
- "DAN" + // da
- "DAN" + // da-dk
- "ZZZ" + // da-gl
- "ZZZ" + // dav
- "ZZZ" + // dav-ke
- "DEU" + // de
- "DEA" + // de-at
- "ZZZ" + // de-be
- "DES" + // de-ch
- "DEU" + // de-de
- "DEU" + // de-de_phoneb
- "ZZZ" + // de-it
- "DEC" + // de-li
- "DEL" + // de-lu
- "ZZZ" + // dje
- "ZZZ" + // dje-ne
- "DSB" + // dsb
- "DSB" + // dsb-de
- "ZZZ" + // dua
- "ZZZ" + // dua-cm
- "DIV" + // dv
- "DIV" + // dv-mv
- "ZZZ" + // dyo
- "ZZZ" + // dyo-sn
- "ZZZ" + // dz
- "ZZZ" + // dz-bt
- "ZZZ" + // ebu
- "ZZZ" + // ebu-ke
- "ZZZ" + // ee
- "ZZZ" + // ee-gh
- "ZZZ" + // ee-tg
- "ELL" + // el
- "ZZZ" + // el-cy
- "ELL" + // el-gr
- "ENU" + // en
- "ZZZ" + // en-001
- "ENB" + // en-029
- "ZZZ" + // en-150
- "ZZZ" + // en-ag
- "ZZZ" + // en-ai
- "ZZZ" + // en-as
- "ZZZ" + // en-at
- "ENA" + // en-au
- "ZZZ" + // en-bb
- "ZZZ" + // en-be
- "ZZZ" + // en-bi
- "ZZZ" + // en-bm
- "ZZZ" + // en-bs
- "ZZZ" + // en-bw
- "ENL" + // en-bz
- "ENC" + // en-ca
- "ZZZ" + // en-cc
- "ZZZ" + // en-ch
- "ZZZ" + // en-ck
- "ZZZ" + // en-cm
- "ZZZ" + // en-cx
- "ZZZ" + // en-cy
- "ZZZ" + // en-de
- "ZZZ" + // en-dk
- "ZZZ" + // en-dm
- "ZZZ" + // en-er
- "ZZZ" + // en-fi
- "ZZZ" + // en-fj
- "ZZZ" + // en-fk
- "ZZZ" + // en-fm
- "ENG" + // en-gb
- "ZZZ" + // en-gd
- "ZZZ" + // en-gg
- "ZZZ" + // en-gh
- "ZZZ" + // en-gi
- "ZZZ" + // en-gm
- "ZZZ" + // en-gu
- "ZZZ" + // en-gy
- "ENH" + // en-hk
- "ZZZ" + // en-id
- "ENI" + // en-ie
- "ZZZ" + // en-il
- "ZZZ" + // en-im
- "ENN" + // en-in
- "ZZZ" + // en-io
- "ZZZ" + // en-je
- "ENJ" + // en-jm
- "ZZZ" + // en-ke
- "ZZZ" + // en-ki
- "ZZZ" + // en-kn
- "ZZZ" + // en-ky
- "ZZZ" + // en-lc
- "ZZZ" + // en-lr
- "ZZZ" + // en-ls
- "ZZZ" + // en-mg
- "ZZZ" + // en-mh
- "ZZZ" + // en-mo
- "ZZZ" + // en-mp
- "ZZZ" + // en-ms
- "ZZZ" + // en-mt
- "ZZZ" + // en-mu
- "ZZZ" + // en-mw
- "ENM" + // en-my
- "ZZZ" + // en-na
- "ZZZ" + // en-nf
- "ZZZ" + // en-ng
- "ZZZ" + // en-nl
- "ZZZ" + // en-nr
- "ZZZ" + // en-nu
- "ENZ" + // en-nz
- "ZZZ" + // en-pg
- "ENP" + // en-ph
- "ZZZ" + // en-pk
- "ZZZ" + // en-pn
- "ZZZ" + // en-pr
- "ZZZ" + // en-pw
- "ZZZ" + // en-rw
- "ZZZ" + // en-sb
- "ZZZ" + // en-sc
- "ZZZ" + // en-sd
- "ZZZ" + // en-se
- "ENE" + // en-sg
- "ZZZ" + // en-sh
- "ZZZ" + // en-si
- "ZZZ" + // en-sl
- "ZZZ" + // en-ss
- "ZZZ" + // en-sx
- "ZZZ" + // en-sz
- "ZZZ" + // en-tc
- "ZZZ" + // en-tk
- "ZZZ" + // en-to
- "ENT" + // en-tt
- "ZZZ" + // en-tv
- "ZZZ" + // en-tz
- "ZZZ" + // en-ug
- "ZZZ" + // en-um
- "ENU" + // en-us
- "ZZZ" + // en-vc
- "ZZZ" + // en-vg
- "ZZZ" + // en-vi
- "ZZZ" + // en-vu
- "ZZZ" + // en-ws
- "ENS" + // en-za
- "ZZZ" + // en-zm
- "ENW" + // en-zw
- "ZZZ" + // eo
- "ZZZ" + // eo-001
- "ESN" + // es
- "ESJ" + // es-419
- "ESS" + // es-ar
- "ESB" + // es-bo
- "ZZZ" + // es-br
- "ESL" + // es-cl
- "ESO" + // es-co
- "ESC" + // es-cr
- "ESK" + // es-cu
- "ESD" + // es-do
- "ESF" + // es-ec
- "ESN" + // es-es
- "ESP" + // es-es_tradnl
- "ZZZ" + // es-gq
- "ESG" + // es-gt
- "ESH" + // es-hn
- "ESM" + // es-mx
- "ESI" + // es-ni
- "ESA" + // es-pa
- "ESR" + // es-pe
- "ZZZ" + // es-ph
- "ESU" + // es-pr
- "ESZ" + // es-py
- "ESE" + // es-sv
- "EST" + // es-us
- "ESY" + // es-uy
- "ESV" + // es-ve
- "ETI" + // et
- "ETI" + // et-ee
- "EUQ" + // eu
- "EUQ" + // eu-es
- "ZZZ" + // ewo
- "ZZZ" + // ewo-cm
- "FAR" + // fa
- "FAR" + // fa-ir
- "FUL" + // ff
- "ZZZ" + // ff-cm
- "ZZZ" + // ff-gn
- "FUL" + // ff-latn
- "FUL" + // ff-latn-sn
- "ZZZ" + // ff-mr
- "ZZZ" + // ff-ng
- "FIN" + // fi
- "FIN" + // fi-fi
- "FPO" + // fil
- "FPO" + // fil-ph
- "FOS" + // fo
- "ZZZ" + // fo-dk
- "FOS" + // fo-fo
- "FRA" + // fr
- "ZZZ" + // fr-029
- "FRB" + // fr-be
- "ZZZ" + // fr-bf
- "ZZZ" + // fr-bi
- "ZZZ" + // fr-bj
- "ZZZ" + // fr-bl
- "FRC" + // fr-ca
- "FRD" + // fr-cd
- "ZZZ" + // fr-cf
- "ZZZ" + // fr-cg
- "FRS" + // fr-ch
- "FRI" + // fr-ci
- "FRE" + // fr-cm
- "ZZZ" + // fr-dj
- "ZZZ" + // fr-dz
- "FRA" + // fr-fr
- "ZZZ" + // fr-ga
- "ZZZ" + // fr-gf
- "ZZZ" + // fr-gn
- "ZZZ" + // fr-gp
- "ZZZ" + // fr-gq
- "FRH" + // fr-ht
- "ZZZ" + // fr-km
- "FRL" + // fr-lu
- "FRO" + // fr-ma
- "FRM" + // fr-mc
- "ZZZ" + // fr-mf
- "ZZZ" + // fr-mg
- "FRF" + // fr-ml
- "ZZZ" + // fr-mq
- "ZZZ" + // fr-mr
- "ZZZ" + // fr-mu
- "ZZZ" + // fr-nc
- "ZZZ" + // fr-ne
- "ZZZ" + // fr-pf
- "ZZZ" + // fr-pm
- "FRR" + // fr-re
- "ZZZ" + // fr-rw
- "ZZZ" + // fr-sc
- "FRN" + // fr-sn
- "ZZZ" + // fr-sy
- "ZZZ" + // fr-td
- "ZZZ" + // fr-tg
- "ZZZ" + // fr-tn
- "ZZZ" + // fr-vu
- "ZZZ" + // fr-wf
- "ZZZ" + // fr-yt
- "ZZZ" + // fur
- "ZZZ" + // fur-it
- "FYN" + // fy
- "FYN" + // fy-nl
- "IRE" + // ga
- "IRE" + // ga-ie
- "GLA" + // gd
- "GLA" + // gd-gb
- "GLC" + // gl
- "GLC" + // gl-es
- "GRN" + // gn
- "GRN" + // gn-py
- "ZZZ" + // gsw
- "ZZZ" + // gsw-ch
- "GSW" + // gsw-fr
- "ZZZ" + // gsw-li
- "GUJ" + // gu
- "GUJ" + // gu-in
- "ZZZ" + // guz
- "ZZZ" + // guz-ke
- "ZZZ" + // gv
- "ZZZ" + // gv-im
- "HAU" + // ha
- "HAU" + // ha-latn
- "ZZZ" + // ha-latn-gh
- "ZZZ" + // ha-latn-ne
- "HAU" + // ha-latn-ng
- "HAW" + // haw
- "HAW" + // haw-us
- "HEB" + // he
- "HEB" + // he-il
- "HIN" + // hi
- "HIN" + // hi-in
- "HRV" + // hr
- "HRB" + // hr-ba
- "HRV" + // hr-hr
- "HSB" + // hsb
- "HSB" + // hsb-de
- "HUN" + // hu
- "HUN" + // hu-hu
- "HUN" + // hu-hu_technl
- "HYE" + // hy
- "HYE" + // hy-am
- "ZZZ" + // ia
- "ZZZ" + // ia-001
- "ZZZ" + // ia-fr
- "ZZZ" + // ibb
- "ZZZ" + // ibb-ng
- "IND" + // id
- "IND" + // id-id
- "IBO" + // ig
- "IBO" + // ig-ng
- "III" + // ii
- "III" + // ii-cn
- "ISL" + // is
- "ISL" + // is-is
- "ITA" + // it
- "ITS" + // it-ch
- "ITA" + // it-it
- "ZZZ" + // it-sm
- "IUK" + // iu
- "IUS" + // iu-cans
- "IUS" + // iu-cans-ca
- "IUK" + // iu-latn
- "IUK" + // iu-latn-ca
- "JPN" + // ja
- "JPN" + // ja-jp
- "JPN" + // ja-jp_radstr
- "ZZZ" + // jgo
- "ZZZ" + // jgo-cm
- "ZZZ" + // jmc
- "ZZZ" + // jmc-tz
- "JAV" + // jv
- "ZZZ" + // jv-java
- "ZZZ" + // jv-java-id
- "JAV" + // jv-latn
- "JAV" + // jv-latn-id
- "KAT" + // ka
- "KAT" + // ka-ge
- "KAT" + // ka-ge_modern
- "ZZZ" + // kab
- "ZZZ" + // kab-dz
- "ZZZ" + // kam
- "ZZZ" + // kam-ke
- "ZZZ" + // kde
- "ZZZ" + // kde-tz
- "ZZZ" + // kea
- "ZZZ" + // kea-cv
- "ZZZ" + // khq
- "ZZZ" + // khq-ml
- "ZZZ" + // ki
- "ZZZ" + // ki-ke
- "KKZ" + // kk
- "KKZ" + // kk-kz
- "ZZZ" + // kkj
- "ZZZ" + // kkj-cm
- "KAL" + // kl
- "KAL" + // kl-gl
- "ZZZ" + // kln
- "ZZZ" + // kln-ke
- "KHM" + // km
- "KHM" + // km-kh
- "KDI" + // kn
- "KDI" + // kn-in
- "KOR" + // ko
- "ZZZ" + // ko-kp
- "KOR" + // ko-kr
- "KNK" + // kok
- "KNK" + // kok-in
- "ZZZ" + // kr
- "ZZZ" + // kr-ng
- "ZZZ" + // ks
- "ZZZ" + // ks-arab
- "ZZZ" + // ks-arab-in
- "ZZZ" + // ks-deva
- "ZZZ" + // ks-deva-in
- "ZZZ" + // ksb
- "ZZZ" + // ksb-tz
- "ZZZ" + // ksf
- "ZZZ" + // ksf-cm
- "ZZZ" + // ksh
- "ZZZ" + // ksh-de
- "KUR" + // ku
- "KUR" + // ku-arab
- "KUR" + // ku-arab-iq
- "ZZZ" + // ku-arab-ir
- "ZZZ" + // kw
- "ZZZ" + // kw-gb
- "KYR" + // ky
- "KYR" + // ky-kg
- "ZZZ" + // la
- "ZZZ" + // la-001
- "ZZZ" + // lag
- "ZZZ" + // lag-tz
- "LBX" + // lb
- "LBX" + // lb-lu
- "ZZZ" + // lg
- "ZZZ" + // lg-ug
- "ZZZ" + // lkt
- "ZZZ" + // lkt-us
- "ZZZ" + // ln
- "ZZZ" + // ln-ao
- "ZZZ" + // ln-cd
- "ZZZ" + // ln-cf
- "ZZZ" + // ln-cg
- "LAO" + // lo
- "LAO" + // lo-la
- "ZZZ" + // lrc
- "ZZZ" + // lrc-iq
- "ZZZ" + // lrc-ir
- "LTH" + // lt
- "LTH" + // lt-lt
- "ZZZ" + // lu
- "ZZZ" + // lu-cd
- "ZZZ" + // luo
- "ZZZ" + // luo-ke
- "ZZZ" + // luy
- "ZZZ" + // luy-ke
- "LVI" + // lv
- "LVI" + // lv-lv
- "ZZZ" + // mas
- "ZZZ" + // mas-ke
- "ZZZ" + // mas-tz
- "ZZZ" + // mer
- "ZZZ" + // mer-ke
- "ZZZ" + // mfe
- "ZZZ" + // mfe-mu
- "MLG" + // mg
- "MLG" + // mg-mg
- "ZZZ" + // mgh
- "ZZZ" + // mgh-mz
- "ZZZ" + // mgo
- "ZZZ" + // mgo-cm
- "MRI" + // mi
- "MRI" + // mi-nz
- "MKI" + // mk
- "MKI" + // mk-mk
- "MYM" + // ml
- "MYM" + // ml-in
- "MNN" + // mn
- "MNN" + // mn-cyrl
- "MNN" + // mn-mn
- "MNG" + // mn-mong
- "MNG" + // mn-mong-cn
- "MNM" + // mn-mong-mn
- "ZZZ" + // mni
- "ZZZ" + // mni-in
- "MWK" + // moh
- "MWK" + // moh-ca
- "MAR" + // mr
- "MAR" + // mr-in
- "MSL" + // ms
- "MSB" + // ms-bn
- "MSL" + // ms-my
- "ZZZ" + // ms-sg
- "MLT" + // mt
- "MLT" + // mt-mt
- "ZZZ" + // mua
- "ZZZ" + // mua-cm
- "MYA" + // my
- "MYA" + // my-mm
- "ZZZ" + // mzn
- "ZZZ" + // mzn-ir
- "ZZZ" + // naq
- "ZZZ" + // naq-na
- "NOR" + // nb
- "NOR" + // nb-no
- "ZZZ" + // nb-sj
- "ZZZ" + // nd
- "ZZZ" + // nd-zw
- "ZZZ" + // nds
- "ZZZ" + // nds-de
- "ZZZ" + // nds-nl
- "NEP" + // ne
- "NEI" + // ne-in
- "NEP" + // ne-np
- "NLD" + // nl
- "ZZZ" + // nl-aw
- "NLB" + // nl-be
- "ZZZ" + // nl-bq
- "ZZZ" + // nl-cw
- "NLD" + // nl-nl
- "ZZZ" + // nl-sr
- "ZZZ" + // nl-sx
- "ZZZ" + // nmg
- "ZZZ" + // nmg-cm
- "NON" + // nn
- "NON" + // nn-no
- "ZZZ" + // nnh
- "ZZZ" + // nnh-cm
- "NOR" + // no
- "NQO" + // nqo
- "NQO" + // nqo-gn
- "ZZZ" + // nr
- "ZZZ" + // nr-za
- "NSO" + // nso
- "NSO" + // nso-za
- "ZZZ" + // nus
- "ZZZ" + // nus-ss
- "ZZZ" + // nyn
- "ZZZ" + // nyn-ug
- "OCI" + // oc
- "OCI" + // oc-fr
- "ORM" + // om
- "ORM" + // om-et
- "ZZZ" + // om-ke
- "ORI" + // or
- "ORI" + // or-in
- "ZZZ" + // os
- "ZZZ" + // os-ge
- "ZZZ" + // os-ru
- "PAN" + // pa
- "PAP" + // pa-arab
- "PAP" + // pa-arab-pk
- "PAN" + // pa-in
- "ZZZ" + // pap
- "ZZZ" + // pap-029
- "PLK" + // pl
- "PLK" + // pl-pl
- "ZZZ" + // prg
- "ZZZ" + // prg-001
- "PRS" + // prs
- "PRS" + // prs-af
- "PAS" + // ps
- "PAS" + // ps-af
- "PTB" + // pt
- "PTA" + // pt-ao
- "PTB" + // pt-br
- "ZZZ" + // pt-ch
- "ZZZ" + // pt-cv
- "ZZZ" + // pt-gq
- "ZZZ" + // pt-gw
- "ZZZ" + // pt-lu
- "ZZZ" + // pt-mo
- "ZZZ" + // pt-mz
- "PTG" + // pt-pt
- "ZZZ" + // pt-st
- "ZZZ" + // pt-tl
- "ENJ" + // qps-latn-x-sh
- "ENU" + // qps-ploc
- "JPN" + // qps-ploca
- "ARA" + // qps-plocm
- "QUT" + // quc
- "QUT" + // quc-latn
- "QUT" + // quc-latn-gt
- "QUB" + // quz
- "QUB" + // quz-bo
- "QUE" + // quz-ec
- "QUP" + // quz-pe
- "RMC" + // rm
- "RMC" + // rm-ch
- "ZZZ" + // rn
- "ZZZ" + // rn-bi
- "ROM" + // ro
- "ROD" + // ro-md
- "ROM" + // ro-ro
- "ZZZ" + // rof
- "ZZZ" + // rof-tz
- "RUS" + // ru
- "ZZZ" + // ru-by
- "ZZZ" + // ru-kg
- "ZZZ" + // ru-kz
- "RUM" + // ru-md
- "RUS" + // ru-ru
- "ZZZ" + // ru-ua
- "KIN" + // rw
- "KIN" + // rw-rw
- "ZZZ" + // rwk
- "ZZZ" + // rwk-tz
- "SAN" + // sa
- "SAN" + // sa-in
- "SAH" + // sah
- "SAH" + // sah-ru
- "ZZZ" + // saq
- "ZZZ" + // saq-ke
- "ZZZ" + // sbp
- "ZZZ" + // sbp-tz
- "SIP" + // sd
- "SIP" + // sd-arab
- "SIP" + // sd-arab-pk
- "ZZZ" + // sd-deva
- "ZZZ" + // sd-deva-in
- "SME" + // se
- "SMG" + // se-fi
- "SME" + // se-no
- "SMF" + // se-se
- "ZZZ" + // seh
- "ZZZ" + // seh-mz
- "ZZZ" + // ses
- "ZZZ" + // ses-ml
- "ZZZ" + // sg
- "ZZZ" + // sg-cf
- "ZZZ" + // shi
- "ZZZ" + // shi-latn
- "ZZZ" + // shi-latn-ma
- "ZZZ" + // shi-tfng
- "ZZZ" + // shi-tfng-ma
- "SIN" + // si
- "SIN" + // si-lk
- "SKY" + // sk
- "SKY" + // sk-sk
- "SLV" + // sl
- "SLV" + // sl-si
- "SMB" + // sma
- "SMA" + // sma-no
- "SMB" + // sma-se
- "SMK" + // smj
- "SMJ" + // smj-no
- "SMK" + // smj-se
- "SMN" + // smn
- "SMN" + // smn-fi
- "SMS" + // sms
- "SMS" + // sms-fi
- "SNA" + // sn
- "SNA" + // sn-latn
- "SNA" + // sn-latn-zw
- "SOM" + // so
- "ZZZ" + // so-dj
- "ZZZ" + // so-et
- "ZZZ" + // so-ke
- "SOM" + // so-so
- "SQI" + // sq
- "SQI" + // sq-al
- "ZZZ" + // sq-mk
- "ZZZ" + // sq-xk
- "SRM" + // sr
- "SRO" + // sr-cyrl
- "SRN" + // sr-cyrl-ba
- "SRB" + // sr-cyrl-cs
- "SRQ" + // sr-cyrl-me
- "SRO" + // sr-cyrl-rs
- "ZZZ" + // sr-cyrl-xk
- "SRM" + // sr-latn
- "SRS" + // sr-latn-ba
- "SRL" + // sr-latn-cs
- "SRP" + // sr-latn-me
- "SRM" + // sr-latn-rs
- "ZZZ" + // sr-latn-xk
- "ZZZ" + // ss
- "ZZZ" + // ss-sz
- "ZZZ" + // ss-za
- "ZZZ" + // ssy
- "ZZZ" + // ssy-er
- "SOT" + // st
- "ZZZ" + // st-ls
- "SOT" + // st-za
- "SVE" + // sv
- "ZZZ" + // sv-ax
- "SVF" + // sv-fi
- "SVE" + // sv-se
- "SWK" + // sw
- "ZZZ" + // sw-cd
- "SWK" + // sw-ke
- "ZZZ" + // sw-tz
- "ZZZ" + // sw-ug
- "ZZZ" + // swc
- "ZZZ" + // swc-cd
- "SYR" + // syr
- "SYR" + // syr-sy
- "TAI" + // ta
- "TAI" + // ta-in
- "TAM" + // ta-lk
- "ZZZ" + // ta-my
- "ZZZ" + // ta-sg
- "TEL" + // te
- "TEL" + // te-in
- "ZZZ" + // teo
- "ZZZ" + // teo-ke
- "ZZZ" + // teo-ug
- "TAJ" + // tg
- "TAJ" + // tg-cyrl
- "TAJ" + // tg-cyrl-tj
- "THA" + // th
- "THA" + // th-th
- "TIR" + // ti
- "TIR" + // ti-er
- "TIE" + // ti-et
- "ZZZ" + // tig
- "ZZZ" + // tig-er
- "TUK" + // tk
- "TUK" + // tk-tm
- "TSN" + // tn
- "TSB" + // tn-bw
- "TSN" + // tn-za
- "ZZZ" + // to
- "ZZZ" + // to-to
- "TRK" + // tr
- "ZZZ" + // tr-cy
- "TRK" + // tr-tr
- "TSO" + // ts
- "TSO" + // ts-za
- "TTT" + // tt
- "TTT" + // tt-ru
- "ZZZ" + // twq
- "ZZZ" + // twq-ne
- "TZA" + // tzm
- "ZZZ" + // tzm-arab
- "ZZZ" + // tzm-arab-ma
- "TZA" + // tzm-latn
- "TZA" + // tzm-latn-dz
- "ZZZ" + // tzm-latn-ma
- "TZM" + // tzm-tfng
- "TZM" + // tzm-tfng-ma
- "UIG" + // ug
- "UIG" + // ug-cn
- "UKR" + // uk
- "UKR" + // uk-ua
- "URD" + // ur
- "URI" + // ur-in
- "URD" + // ur-pk
- "UZB" + // uz
- "ZZZ" + // uz-arab
- "ZZZ" + // uz-arab-af
- "UZC" + // uz-cyrl
- "UZC" + // uz-cyrl-uz
- "UZB" + // uz-latn
- "UZB" + // uz-latn-uz
- "ZZZ" + // vai
- "ZZZ" + // vai-latn
- "ZZZ" + // vai-latn-lr
- "ZZZ" + // vai-vaii
- "ZZZ" + // vai-vaii-lr
- "ZZZ" + // ve
- "ZZZ" + // ve-za
- "VIT" + // vi
- "VIT" + // vi-vn
- "ZZZ" + // vo
- "ZZZ" + // vo-001
- "ZZZ" + // vun
- "ZZZ" + // vun-tz
- "ZZZ" + // wae
- "ZZZ" + // wae-ch
- "ZZZ" + // wal
- "ZZZ" + // wal-et
- "WOL" + // wo
- "WOL" + // wo-sn
- "IVL" + // x-iv_mathan
- "XHO" + // xh
- "XHO" + // xh-za
- "ZZZ" + // xog
- "ZZZ" + // xog-ug
- "ZZZ" + // yav
- "ZZZ" + // yav-cm
- "ZZZ" + // yi
- "ZZZ" + // yi-001
- "YOR" + // yo
- "ZZZ" + // yo-bj
- "YOR" + // yo-ng
- "ZZZ" + // yue
- "ZZZ" + // yue-hk
- "ZHG" + // zgh
- "ZHG" + // zgh-tfng
- "ZHG" + // zgh-tfng-ma
- "CHS" + // zh
- "CHS" + // zh-chs
- "CHT" + // zh-cht
- "CHS" + // zh-cn
- "CHS" + // zh-cn_phoneb
- "CHS" + // zh-cn_stroke
- "CHS" + // zh-hans
- "ZZZ" + // zh-hans-hk
- "ZZZ" + // zh-hans-mo
- "ZHH" + // zh-hant
- "ZHH" + // zh-hk
- "ZHH" + // zh-hk_radstr
- "ZHM" + // zh-mo
- "ZHM" + // zh-mo_radstr
- "ZHM" + // zh-mo_stroke
- "ZHI" + // zh-sg
- "ZHI" + // zh-sg_phoneb
- "ZHI" + // zh-sg_stroke
- "CHT" + // zh-tw
- "CHT" + // zh-tw_pronun
- "CHT" + // zh-tw_radstr
- "ZUL" + // zu
- "ZUL"; // zu-za
-
- // s_localeNamesIndices contains the start index of every culture name in the string
- // s_localeNames. We infer the length of each string by looking at the start index
- // of the next string.
- private static readonly int[] s_localeNamesIndices = new int[]
- {
- // c_localeNames index, // index to this array - culture name
- 0 , // 0 - aa
- 2 , // 1 - aa-dj
- 7 , // 2 - aa-er
- 12 , // 3 - aa-et
- 17 , // 4 - af
- 19 , // 5 - af-na
- 24 , // 6 - af-za
- 29 , // 7 - agq
- 32 , // 8 - agq-cm
- 38 , // 9 - ak
- 40 , // 10 - ak-gh
- 45 , // 11 - am
- 47 , // 12 - am-et
- 52 , // 13 - ar
- 54 , // 14 - ar-001
- 60 , // 15 - ar-ae
- 65 , // 16 - ar-bh
- 70 , // 17 - ar-dj
- 75 , // 18 - ar-dz
- 80 , // 19 - ar-eg
- 85 , // 20 - ar-er
- 90 , // 21 - ar-il
- 95 , // 22 - ar-iq
- 100 , // 23 - ar-jo
- 105 , // 24 - ar-km
- 110 , // 25 - ar-kw
- 115 , // 26 - ar-lb
- 120 , // 27 - ar-ly
- 125 , // 28 - ar-ma
- 130 , // 29 - ar-mr
- 135 , // 30 - ar-om
- 140 , // 31 - ar-ps
- 145 , // 32 - ar-qa
- 150 , // 33 - ar-sa
- 155 , // 34 - ar-sd
- 160 , // 35 - ar-so
- 165 , // 36 - ar-ss
- 170 , // 37 - ar-sy
- 175 , // 38 - ar-td
- 180 , // 39 - ar-tn
- 185 , // 40 - ar-ye
- 190 , // 41 - arn
- 193 , // 42 - arn-cl
- 199 , // 43 - as
- 201 , // 44 - as-in
- 206 , // 45 - asa
- 209 , // 46 - asa-tz
- 215 , // 47 - ast
- 218 , // 48 - ast-es
- 224 , // 49 - az
- 226 , // 50 - az-cyrl
- 233 , // 51 - az-cyrl-az
- 243 , // 52 - az-latn
- 250 , // 53 - az-latn-az
- 260 , // 54 - ba
- 262 , // 55 - ba-ru
- 267 , // 56 - bas
- 270 , // 57 - bas-cm
- 276 , // 58 - be
- 278 , // 59 - be-by
- 283 , // 60 - bem
- 286 , // 61 - bem-zm
- 292 , // 62 - bez
- 295 , // 63 - bez-tz
- 301 , // 64 - bg
- 303 , // 65 - bg-bg
- 308 , // 66 - bin
- 311 , // 67 - bin-ng
- 317 , // 68 - bm
- 319 , // 69 - bm-latn
- 326 , // 70 - bm-latn-ml
- 336 , // 71 - bn
- 338 , // 72 - bn-bd
- 343 , // 73 - bn-in
- 348 , // 74 - bo
- 350 , // 75 - bo-cn
- 355 , // 76 - bo-in
- 360 , // 77 - br
- 362 , // 78 - br-fr
- 367 , // 79 - brx
- 370 , // 80 - brx-in
- 376 , // 81 - bs
- 378 , // 82 - bs-cyrl
- 385 , // 83 - bs-cyrl-ba
- 395 , // 84 - bs-latn
- 402 , // 85 - bs-latn-ba
- 412 , // 86 - byn
- 415 , // 87 - byn-er
- 421 , // 88 - ca
- 423 , // 89 - ca-ad
- 428 , // 90 - ca-es
- 433 , // 91 - ca-es-valencia
- 447 , // 92 - ca-fr
- 452 , // 93 - ca-it
- 457 , // 94 - ce
- 459 , // 95 - ce-ru
- 464 , // 96 - cgg
- 467 , // 97 - cgg-ug
- 473 , // 98 - chr
- 476 , // 99 - chr-cher
- 484 , // 100 - chr-cher-us
- 495 , // 101 - co
- 497 , // 102 - co-fr
- 502 , // 103 - cs
- 504 , // 104 - cs-cz
- 509 , // 105 - cu
- 511 , // 106 - cu-ru
- 516 , // 107 - cy
- 518 , // 108 - cy-gb
- 523 , // 109 - da
- 525 , // 110 - da-dk
- 530 , // 111 - da-gl
- 535 , // 112 - dav
- 538 , // 113 - dav-ke
- 544 , // 114 - de
- 546 , // 115 - de-at
- 551 , // 116 - de-be
- 556 , // 117 - de-ch
- 561 , // 118 - de-de
- 566 , // 119 - de-de_phoneb
- 578 , // 120 - de-it
- 583 , // 121 - de-li
- 588 , // 122 - de-lu
- 593 , // 123 - dje
- 596 , // 124 - dje-ne
- 602 , // 125 - dsb
- 605 , // 126 - dsb-de
- 611 , // 127 - dua
- 614 , // 128 - dua-cm
- 620 , // 129 - dv
- 622 , // 130 - dv-mv
- 627 , // 131 - dyo
- 630 , // 132 - dyo-sn
- 636 , // 133 - dz
- 638 , // 134 - dz-bt
- 643 , // 135 - ebu
- 646 , // 136 - ebu-ke
- 652 , // 137 - ee
- 654 , // 138 - ee-gh
- 659 , // 139 - ee-tg
- 664 , // 140 - el
- 666 , // 141 - el-cy
- 671 , // 142 - el-gr
- 676 , // 143 - en
- 678 , // 144 - en-001
- 684 , // 145 - en-029
- 690 , // 146 - en-150
- 696 , // 147 - en-ag
- 701 , // 148 - en-ai
- 706 , // 149 - en-as
- 711 , // 150 - en-at
- 716 , // 151 - en-au
- 721 , // 152 - en-bb
- 726 , // 153 - en-be
- 731 , // 154 - en-bi
- 736 , // 155 - en-bm
- 741 , // 156 - en-bs
- 746 , // 157 - en-bw
- 751 , // 158 - en-bz
- 756 , // 159 - en-ca
- 761 , // 160 - en-cc
- 766 , // 161 - en-ch
- 771 , // 162 - en-ck
- 776 , // 163 - en-cm
- 781 , // 164 - en-cx
- 786 , // 165 - en-cy
- 791 , // 166 - en-de
- 796 , // 167 - en-dk
- 801 , // 168 - en-dm
- 806 , // 169 - en-er
- 811 , // 170 - en-fi
- 816 , // 171 - en-fj
- 821 , // 172 - en-fk
- 826 , // 173 - en-fm
- 831 , // 174 - en-gb
- 836 , // 175 - en-gd
- 841 , // 176 - en-gg
- 846 , // 177 - en-gh
- 851 , // 178 - en-gi
- 856 , // 179 - en-gm
- 861 , // 180 - en-gu
- 866 , // 181 - en-gy
- 871 , // 182 - en-hk
- 876 , // 183 - en-id
- 881 , // 184 - en-ie
- 886 , // 185 - en-il
- 891 , // 186 - en-im
- 896 , // 187 - en-in
- 901 , // 188 - en-io
- 906 , // 189 - en-je
- 911 , // 190 - en-jm
- 916 , // 191 - en-ke
- 921 , // 192 - en-ki
- 926 , // 193 - en-kn
- 931 , // 194 - en-ky
- 936 , // 195 - en-lc
- 941 , // 196 - en-lr
- 946 , // 197 - en-ls
- 951 , // 198 - en-mg
- 956 , // 199 - en-mh
- 961 , // 200 - en-mo
- 966 , // 201 - en-mp
- 971 , // 202 - en-ms
- 976 , // 203 - en-mt
- 981 , // 204 - en-mu
- 986 , // 205 - en-mw
- 991 , // 206 - en-my
- 996 , // 207 - en-na
- 1001, // 208 - en-nf
- 1006, // 209 - en-ng
- 1011, // 210 - en-nl
- 1016, // 211 - en-nr
- 1021, // 212 - en-nu
- 1026, // 213 - en-nz
- 1031, // 214 - en-pg
- 1036, // 215 - en-ph
- 1041, // 216 - en-pk
- 1046, // 217 - en-pn
- 1051, // 218 - en-pr
- 1056, // 219 - en-pw
- 1061, // 220 - en-rw
- 1066, // 221 - en-sb
- 1071, // 222 - en-sc
- 1076, // 223 - en-sd
- 1081, // 224 - en-se
- 1086, // 225 - en-sg
- 1091, // 226 - en-sh
- 1096, // 227 - en-si
- 1101, // 228 - en-sl
- 1106, // 229 - en-ss
- 1111, // 230 - en-sx
- 1116, // 231 - en-sz
- 1121, // 232 - en-tc
- 1126, // 233 - en-tk
- 1131, // 234 - en-to
- 1136, // 235 - en-tt
- 1141, // 236 - en-tv
- 1146, // 237 - en-tz
- 1151, // 238 - en-ug
- 1156, // 239 - en-um
- 1161, // 240 - en-us
- 1166, // 241 - en-vc
- 1171, // 242 - en-vg
- 1176, // 243 - en-vi
- 1181, // 244 - en-vu
- 1186, // 245 - en-ws
- 1191, // 246 - en-za
- 1196, // 247 - en-zm
- 1201, // 248 - en-zw
- 1206, // 249 - eo
- 1208, // 250 - eo-001
- 1214, // 251 - es
- 1216, // 252 - es-419
- 1222, // 253 - es-ar
- 1227, // 254 - es-bo
- 1232, // 255 - es-br
- 1237, // 256 - es-cl
- 1242, // 257 - es-co
- 1247, // 258 - es-cr
- 1252, // 259 - es-cu
- 1257, // 260 - es-do
- 1262, // 261 - es-ec
- 1267, // 262 - es-es
- 1272, // 263 - es-es_tradnl
- 1284, // 264 - es-gq
- 1289, // 265 - es-gt
- 1294, // 266 - es-hn
- 1299, // 267 - es-mx
- 1304, // 268 - es-ni
- 1309, // 269 - es-pa
- 1314, // 270 - es-pe
- 1319, // 271 - es-ph
- 1324, // 272 - es-pr
- 1329, // 273 - es-py
- 1334, // 274 - es-sv
- 1339, // 275 - es-us
- 1344, // 276 - es-uy
- 1349, // 277 - es-ve
- 1354, // 278 - et
- 1356, // 279 - et-ee
- 1361, // 280 - eu
- 1363, // 281 - eu-es
- 1368, // 282 - ewo
- 1371, // 283 - ewo-cm
- 1377, // 284 - fa
- 1379, // 285 - fa-ir
- 1384, // 286 - ff
- 1386, // 287 - ff-cm
- 1391, // 288 - ff-gn
- 1396, // 289 - ff-latn
- 1403, // 290 - ff-latn-sn
- 1413, // 291 - ff-mr
- 1418, // 292 - ff-ng
- 1423, // 293 - fi
- 1425, // 294 - fi-fi
- 1430, // 295 - fil
- 1433, // 296 - fil-ph
- 1439, // 297 - fo
- 1441, // 298 - fo-dk
- 1446, // 299 - fo-fo
- 1451, // 300 - fr
- 1453, // 301 - fr-029
- 1459, // 302 - fr-be
- 1464, // 303 - fr-bf
- 1469, // 304 - fr-bi
- 1474, // 305 - fr-bj
- 1479, // 306 - fr-bl
- 1484, // 307 - fr-ca
- 1489, // 308 - fr-cd
- 1494, // 309 - fr-cf
- 1499, // 310 - fr-cg
- 1504, // 311 - fr-ch
- 1509, // 312 - fr-ci
- 1514, // 313 - fr-cm
- 1519, // 314 - fr-dj
- 1524, // 315 - fr-dz
- 1529, // 316 - fr-fr
- 1534, // 317 - fr-ga
- 1539, // 318 - fr-gf
- 1544, // 319 - fr-gn
- 1549, // 320 - fr-gp
- 1554, // 321 - fr-gq
- 1559, // 322 - fr-ht
- 1564, // 323 - fr-km
- 1569, // 324 - fr-lu
- 1574, // 325 - fr-ma
- 1579, // 326 - fr-mc
- 1584, // 327 - fr-mf
- 1589, // 328 - fr-mg
- 1594, // 329 - fr-ml
- 1599, // 330 - fr-mq
- 1604, // 331 - fr-mr
- 1609, // 332 - fr-mu
- 1614, // 333 - fr-nc
- 1619, // 334 - fr-ne
- 1624, // 335 - fr-pf
- 1629, // 336 - fr-pm
- 1634, // 337 - fr-re
- 1639, // 338 - fr-rw
- 1644, // 339 - fr-sc
- 1649, // 340 - fr-sn
- 1654, // 341 - fr-sy
- 1659, // 342 - fr-td
- 1664, // 343 - fr-tg
- 1669, // 344 - fr-tn
- 1674, // 345 - fr-vu
- 1679, // 346 - fr-wf
- 1684, // 347 - fr-yt
- 1689, // 348 - fur
- 1692, // 349 - fur-it
- 1698, // 350 - fy
- 1700, // 351 - fy-nl
- 1705, // 352 - ga
- 1707, // 353 - ga-ie
- 1712, // 354 - gd
- 1714, // 355 - gd-gb
- 1719, // 356 - gl
- 1721, // 357 - gl-es
- 1726, // 358 - gn
- 1728, // 359 - gn-py
- 1733, // 360 - gsw
- 1736, // 361 - gsw-ch
- 1742, // 362 - gsw-fr
- 1748, // 363 - gsw-li
- 1754, // 364 - gu
- 1756, // 365 - gu-in
- 1761, // 366 - guz
- 1764, // 367 - guz-ke
- 1770, // 368 - gv
- 1772, // 369 - gv-im
- 1777, // 370 - ha
- 1779, // 371 - ha-latn
- 1786, // 372 - ha-latn-gh
- 1796, // 373 - ha-latn-ne
- 1806, // 374 - ha-latn-ng
- 1816, // 375 - haw
- 1819, // 376 - haw-us
- 1825, // 377 - he
- 1827, // 378 - he-il
- 1832, // 379 - hi
- 1834, // 380 - hi-in
- 1839, // 381 - hr
- 1841, // 382 - hr-ba
- 1846, // 383 - hr-hr
- 1851, // 384 - hsb
- 1854, // 385 - hsb-de
- 1860, // 386 - hu
- 1862, // 387 - hu-hu
- 1867, // 388 - hu-hu_technl
- 1879, // 389 - hy
- 1881, // 390 - hy-am
- 1886, // 391 - ia
- 1888, // 392 - ia-001
- 1894, // 393 - ia-fr
- 1899, // 394 - ibb
- 1902, // 395 - ibb-ng
- 1908, // 396 - id
- 1910, // 397 - id-id
- 1915, // 398 - ig
- 1917, // 399 - ig-ng
- 1922, // 400 - ii
- 1924, // 401 - ii-cn
- 1929, // 402 - is
- 1931, // 403 - is-is
- 1936, // 404 - it
- 1938, // 405 - it-ch
- 1943, // 406 - it-it
- 1948, // 407 - it-sm
- 1953, // 408 - iu
- 1955, // 409 - iu-cans
- 1962, // 410 - iu-cans-ca
- 1972, // 411 - iu-latn
- 1979, // 412 - iu-latn-ca
- 1989, // 413 - ja
- 1991, // 414 - ja-jp
- 1996, // 415 - ja-jp_radstr
- 2008, // 416 - jgo
- 2011, // 417 - jgo-cm
- 2017, // 418 - jmc
- 2020, // 419 - jmc-tz
- 2026, // 420 - jv
- 2028, // 421 - jv-java
- 2035, // 422 - jv-java-id
- 2045, // 423 - jv-latn
- 2052, // 424 - jv-latn-id
- 2062, // 425 - ka
- 2064, // 426 - ka-ge
- 2069, // 427 - ka-ge_modern
- 2081, // 428 - kab
- 2084, // 429 - kab-dz
- 2090, // 430 - kam
- 2093, // 431 - kam-ke
- 2099, // 432 - kde
- 2102, // 433 - kde-tz
- 2108, // 434 - kea
- 2111, // 435 - kea-cv
- 2117, // 436 - khq
- 2120, // 437 - khq-ml
- 2126, // 438 - ki
- 2128, // 439 - ki-ke
- 2133, // 440 - kk
- 2135, // 441 - kk-kz
- 2140, // 442 - kkj
- 2143, // 443 - kkj-cm
- 2149, // 444 - kl
- 2151, // 445 - kl-gl
- 2156, // 446 - kln
- 2159, // 447 - kln-ke
- 2165, // 448 - km
- 2167, // 449 - km-kh
- 2172, // 450 - kn
- 2174, // 451 - kn-in
- 2179, // 452 - ko
- 2181, // 453 - ko-kp
- 2186, // 454 - ko-kr
- 2191, // 455 - kok
- 2194, // 456 - kok-in
- 2200, // 457 - kr
- 2202, // 458 - kr-ng
- 2207, // 459 - ks
- 2209, // 460 - ks-arab
- 2216, // 461 - ks-arab-in
- 2226, // 462 - ks-deva
- 2233, // 463 - ks-deva-in
- 2243, // 464 - ksb
- 2246, // 465 - ksb-tz
- 2252, // 466 - ksf
- 2255, // 467 - ksf-cm
- 2261, // 468 - ksh
- 2264, // 469 - ksh-de
- 2270, // 470 - ku
- 2272, // 471 - ku-arab
- 2279, // 472 - ku-arab-iq
- 2289, // 473 - ku-arab-ir
- 2299, // 474 - kw
- 2301, // 475 - kw-gb
- 2306, // 476 - ky
- 2308, // 477 - ky-kg
- 2313, // 478 - la
- 2315, // 479 - la-001
- 2321, // 480 - lag
- 2324, // 481 - lag-tz
- 2330, // 482 - lb
- 2332, // 483 - lb-lu
- 2337, // 484 - lg
- 2339, // 485 - lg-ug
- 2344, // 486 - lkt
- 2347, // 487 - lkt-us
- 2353, // 488 - ln
- 2355, // 489 - ln-ao
- 2360, // 490 - ln-cd
- 2365, // 491 - ln-cf
- 2370, // 492 - ln-cg
- 2375, // 493 - lo
- 2377, // 494 - lo-la
- 2382, // 495 - lrc
- 2385, // 496 - lrc-iq
- 2391, // 497 - lrc-ir
- 2397, // 498 - lt
- 2399, // 499 - lt-lt
- 2404, // 500 - lu
- 2406, // 501 - lu-cd
- 2411, // 502 - luo
- 2414, // 503 - luo-ke
- 2420, // 504 - luy
- 2423, // 505 - luy-ke
- 2429, // 506 - lv
- 2431, // 507 - lv-lv
- 2436, // 508 - mas
- 2439, // 509 - mas-ke
- 2445, // 510 - mas-tz
- 2451, // 511 - mer
- 2454, // 512 - mer-ke
- 2460, // 513 - mfe
- 2463, // 514 - mfe-mu
- 2469, // 515 - mg
- 2471, // 516 - mg-mg
- 2476, // 517 - mgh
- 2479, // 518 - mgh-mz
- 2485, // 519 - mgo
- 2488, // 520 - mgo-cm
- 2494, // 521 - mi
- 2496, // 522 - mi-nz
- 2501, // 523 - mk
- 2503, // 524 - mk-mk
- 2508, // 525 - ml
- 2510, // 526 - ml-in
- 2515, // 527 - mn
- 2517, // 528 - mn-cyrl
- 2524, // 529 - mn-mn
- 2529, // 530 - mn-mong
- 2536, // 531 - mn-mong-cn
- 2546, // 532 - mn-mong-mn
- 2556, // 533 - mni
- 2559, // 534 - mni-in
- 2565, // 535 - moh
- 2568, // 536 - moh-ca
- 2574, // 537 - mr
- 2576, // 538 - mr-in
- 2581, // 539 - ms
- 2583, // 540 - ms-bn
- 2588, // 541 - ms-my
- 2593, // 542 - ms-sg
- 2598, // 543 - mt
- 2600, // 544 - mt-mt
- 2605, // 545 - mua
- 2608, // 546 - mua-cm
- 2614, // 547 - my
- 2616, // 548 - my-mm
- 2621, // 549 - mzn
- 2624, // 550 - mzn-ir
- 2630, // 551 - naq
- 2633, // 552 - naq-na
- 2639, // 553 - nb
- 2641, // 554 - nb-no
- 2646, // 555 - nb-sj
- 2651, // 556 - nd
- 2653, // 557 - nd-zw
- 2658, // 558 - nds
- 2661, // 559 - nds-de
- 2667, // 560 - nds-nl
- 2673, // 561 - ne
- 2675, // 562 - ne-in
- 2680, // 563 - ne-np
- 2685, // 564 - nl
- 2687, // 565 - nl-aw
- 2692, // 566 - nl-be
- 2697, // 567 - nl-bq
- 2702, // 568 - nl-cw
- 2707, // 569 - nl-nl
- 2712, // 570 - nl-sr
- 2717, // 571 - nl-sx
- 2722, // 572 - nmg
- 2725, // 573 - nmg-cm
- 2731, // 574 - nn
- 2733, // 575 - nn-no
- 2738, // 576 - nnh
- 2741, // 577 - nnh-cm
- 2747, // 578 - no
- 2749, // 579 - nqo
- 2752, // 580 - nqo-gn
- 2758, // 581 - nr
- 2760, // 582 - nr-za
- 2765, // 583 - nso
- 2768, // 584 - nso-za
- 2774, // 585 - nus
- 2777, // 586 - nus-ss
- 2783, // 587 - nyn
- 2786, // 588 - nyn-ug
- 2792, // 589 - oc
- 2794, // 590 - oc-fr
- 2799, // 591 - om
- 2801, // 592 - om-et
- 2806, // 593 - om-ke
- 2811, // 594 - or
- 2813, // 595 - or-in
- 2818, // 596 - os
- 2820, // 597 - os-ge
- 2825, // 598 - os-ru
- 2830, // 599 - pa
- 2832, // 600 - pa-arab
- 2839, // 601 - pa-arab-pk
- 2849, // 602 - pa-in
- 2854, // 603 - pap
- 2857, // 604 - pap-029
- 2864, // 605 - pl
- 2866, // 606 - pl-pl
- 2871, // 607 - prg
- 2874, // 608 - prg-001
- 2881, // 609 - prs
- 2884, // 610 - prs-af
- 2890, // 611 - ps
- 2892, // 612 - ps-af
- 2897, // 613 - pt
- 2899, // 614 - pt-ao
- 2904, // 615 - pt-br
- 2909, // 616 - pt-ch
- 2914, // 617 - pt-cv
- 2919, // 618 - pt-gq
- 2924, // 619 - pt-gw
- 2929, // 620 - pt-lu
- 2934, // 621 - pt-mo
- 2939, // 622 - pt-mz
- 2944, // 623 - pt-pt
- 2949, // 624 - pt-st
- 2954, // 625 - pt-tl
- 2959, // 626 - qps-latn-x-sh
- 2972, // 627 - qps-ploc
- 2980, // 628 - qps-ploca
- 2989, // 629 - qps-plocm
- 2998, // 630 - quc
- 3001, // 631 - quc-latn
- 3009, // 632 - quc-latn-gt
- 3020, // 633 - quz
- 3023, // 634 - quz-bo
- 3029, // 635 - quz-ec
- 3035, // 636 - quz-pe
- 3041, // 637 - rm
- 3043, // 638 - rm-ch
- 3048, // 639 - rn
- 3050, // 640 - rn-bi
- 3055, // 641 - ro
- 3057, // 642 - ro-md
- 3062, // 643 - ro-ro
- 3067, // 644 - rof
- 3070, // 645 - rof-tz
- 3076, // 646 - ru
- 3078, // 647 - ru-by
- 3083, // 648 - ru-kg
- 3088, // 649 - ru-kz
- 3093, // 650 - ru-md
- 3098, // 651 - ru-ru
- 3103, // 652 - ru-ua
- 3108, // 653 - rw
- 3110, // 654 - rw-rw
- 3115, // 655 - rwk
- 3118, // 656 - rwk-tz
- 3124, // 657 - sa
- 3126, // 658 - sa-in
- 3131, // 659 - sah
- 3134, // 660 - sah-ru
- 3140, // 661 - saq
- 3143, // 662 - saq-ke
- 3149, // 663 - sbp
- 3152, // 664 - sbp-tz
- 3158, // 665 - sd
- 3160, // 666 - sd-arab
- 3167, // 667 - sd-arab-pk
- 3177, // 668 - sd-deva
- 3184, // 669 - sd-deva-in
- 3194, // 670 - se
- 3196, // 671 - se-fi
- 3201, // 672 - se-no
- 3206, // 673 - se-se
- 3211, // 674 - seh
- 3214, // 675 - seh-mz
- 3220, // 676 - ses
- 3223, // 677 - ses-ml
- 3229, // 678 - sg
- 3231, // 679 - sg-cf
- 3236, // 680 - shi
- 3239, // 681 - shi-latn
- 3247, // 682 - shi-latn-ma
- 3258, // 683 - shi-tfng
- 3266, // 684 - shi-tfng-ma
- 3277, // 685 - si
- 3279, // 686 - si-lk
- 3284, // 687 - sk
- 3286, // 688 - sk-sk
- 3291, // 689 - sl
- 3293, // 690 - sl-si
- 3298, // 691 - sma
- 3301, // 692 - sma-no
- 3307, // 693 - sma-se
- 3313, // 694 - smj
- 3316, // 695 - smj-no
- 3322, // 696 - smj-se
- 3328, // 697 - smn
- 3331, // 698 - smn-fi
- 3337, // 699 - sms
- 3340, // 700 - sms-fi
- 3346, // 701 - sn
- 3348, // 702 - sn-latn
- 3355, // 703 - sn-latn-zw
- 3365, // 704 - so
- 3367, // 705 - so-dj
- 3372, // 706 - so-et
- 3377, // 707 - so-ke
- 3382, // 708 - so-so
- 3387, // 709 - sq
- 3389, // 710 - sq-al
- 3394, // 711 - sq-mk
- 3399, // 712 - sq-xk
- 3404, // 713 - sr
- 3406, // 714 - sr-cyrl
- 3413, // 715 - sr-cyrl-ba
- 3423, // 716 - sr-cyrl-cs
- 3433, // 717 - sr-cyrl-me
- 3443, // 718 - sr-cyrl-rs
- 3453, // 719 - sr-cyrl-xk
- 3463, // 720 - sr-latn
- 3470, // 721 - sr-latn-ba
- 3480, // 722 - sr-latn-cs
- 3490, // 723 - sr-latn-me
- 3500, // 724 - sr-latn-rs
- 3510, // 725 - sr-latn-xk
- 3520, // 726 - ss
- 3522, // 727 - ss-sz
- 3527, // 728 - ss-za
- 3532, // 729 - ssy
- 3535, // 730 - ssy-er
- 3541, // 731 - st
- 3543, // 732 - st-ls
- 3548, // 733 - st-za
- 3553, // 734 - sv
- 3555, // 735 - sv-ax
- 3560, // 736 - sv-fi
- 3565, // 737 - sv-se
- 3570, // 738 - sw
- 3572, // 739 - sw-cd
- 3577, // 740 - sw-ke
- 3582, // 741 - sw-tz
- 3587, // 742 - sw-ug
- 3592, // 743 - swc
- 3595, // 744 - swc-cd
- 3601, // 745 - syr
- 3604, // 746 - syr-sy
- 3610, // 747 - ta
- 3612, // 748 - ta-in
- 3617, // 749 - ta-lk
- 3622, // 750 - ta-my
- 3627, // 751 - ta-sg
- 3632, // 752 - te
- 3634, // 753 - te-in
- 3639, // 754 - teo
- 3642, // 755 - teo-ke
- 3648, // 756 - teo-ug
- 3654, // 757 - tg
- 3656, // 758 - tg-cyrl
- 3663, // 759 - tg-cyrl-tj
- 3673, // 760 - th
- 3675, // 761 - th-th
- 3680, // 762 - ti
- 3682, // 763 - ti-er
- 3687, // 764 - ti-et
- 3692, // 765 - tig
- 3695, // 766 - tig-er
- 3701, // 767 - tk
- 3703, // 768 - tk-tm
- 3708, // 769 - tn
- 3710, // 770 - tn-bw
- 3715, // 771 - tn-za
- 3720, // 772 - to
- 3722, // 773 - to-to
- 3727, // 774 - tr
- 3729, // 775 - tr-cy
- 3734, // 776 - tr-tr
- 3739, // 777 - ts
- 3741, // 778 - ts-za
- 3746, // 779 - tt
- 3748, // 780 - tt-ru
- 3753, // 781 - twq
- 3756, // 782 - twq-ne
- 3762, // 783 - tzm
- 3765, // 784 - tzm-arab
- 3773, // 785 - tzm-arab-ma
- 3784, // 786 - tzm-latn
- 3792, // 787 - tzm-latn-dz
- 3803, // 788 - tzm-latn-ma
- 3814, // 789 - tzm-tfng
- 3822, // 790 - tzm-tfng-ma
- 3833, // 791 - ug
- 3835, // 792 - ug-cn
- 3840, // 793 - uk
- 3842, // 794 - uk-ua
- 3847, // 795 - ur
- 3849, // 796 - ur-in
- 3854, // 797 - ur-pk
- 3859, // 798 - uz
- 3861, // 799 - uz-arab
- 3868, // 800 - uz-arab-af
- 3878, // 801 - uz-cyrl
- 3885, // 802 - uz-cyrl-uz
- 3895, // 803 - uz-latn
- 3902, // 804 - uz-latn-uz
- 3912, // 805 - vai
- 3915, // 806 - vai-latn
- 3923, // 807 - vai-latn-lr
- 3934, // 808 - vai-vaii
- 3942, // 809 - vai-vaii-lr
- 3953, // 810 - ve
- 3955, // 811 - ve-za
- 3960, // 812 - vi
- 3962, // 813 - vi-vn
- 3967, // 814 - vo
- 3969, // 815 - vo-001
- 3975, // 816 - vun
- 3978, // 817 - vun-tz
- 3984, // 818 - wae
- 3987, // 819 - wae-ch
- 3993, // 820 - wal
- 3996, // 821 - wal-et
- 4002, // 822 - wo
- 4004, // 823 - wo-sn
- 4009, // 824 - x-iv_mathan
- 4020, // 825 - xh
- 4022, // 826 - xh-za
- 4027, // 827 - xog
- 4030, // 828 - xog-ug
- 4036, // 829 - yav
- 4039, // 830 - yav-cm
- 4045, // 831 - yi
- 4047, // 832 - yi-001
- 4053, // 833 - yo
- 4055, // 834 - yo-bj
- 4060, // 835 - yo-ng
- 4065, // 836 - yue
- 4068, // 837 - yue-hk
- 4074, // 838 - zgh
- 4077, // 839 - zgh-tfng
- 4085, // 840 - zgh-tfng-ma
- 4096, // 841 - zh
- 4098, // 842 - zh-chs
- 4104, // 843 - zh-cht
- 4110, // 844 - zh-cn
- 4115, // 845 - zh-cn_phoneb
- 4127, // 846 - zh-cn_stroke
- 4139, // 847 - zh-hans
- 4146, // 848 - zh-hans-hk
- 4156, // 849 - zh-hans-mo
- 4166, // 850 - zh-hant
- 4173, // 851 - zh-hk
- 4178, // 852 - zh-hk_radstr
- 4190, // 853 - zh-mo
- 4195, // 854 - zh-mo_radstr
- 4207, // 855 - zh-mo_stroke
- 4219, // 856 - zh-sg
- 4224, // 857 - zh-sg_phoneb
- 4236, // 858 - zh-sg_stroke
- 4248, // 859 - zh-tw
- 4253, // 860 - zh-tw_pronun
- 4265, // 861 - zh-tw_radstr
- 4277, // 862 - zu
- 4279, // 863 - zu-za
- 4284
- };
-
- private const int NUMERIC_LOCALE_DATA_COUNT_PER_ROW = 9;
- // s_nameIndexToNumericData is mapping from index in s_localeNamesIndices to locale data.
- // each row in the table will have the following data:
- // Lcid, Ansi codepage, Oem codepage, MAC codepage, EBCDIC codepage, Geo Id, Digit Substitution, specific locale index, Console locale index
- private static readonly int[] s_nameIndexToNumericData = new int[]
- {
- // Lcid, Ansi CP, Oem CP, MAC CP, EBCDIC CP, Geo Id, digit substitution, Specific culture index, keyboard Id, Console locale index // index - locale name
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x49 , 1 , 3 , 240 , // 0 - aa
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x3e , 1 , 1 , 240 , // 1 - aa-dj
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x47 , 1 , 2 , 240 , // 2 - aa-er
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x49 , 1 , 3 , 240 , // 3 - aa-et
- 0x36 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd1 , 1 , 6 , 6 , // 4 - af
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xfe , 1 , 5 , 240 , // 5 - af-na
- 0x436 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd1 , 1 , 6 , 6 , // 6 - af-za
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 8 , 240 , // 7 - agq
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 8 , 240 , // 8 - agq-cm
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x59 , 1 , 10 , 240 , // 9 - ak
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x59 , 1 , 10 , 240 , // 10 - ak-gh
- 0x5e , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x49 , 1 , 12 , 143 , // 11 - am
- 0x45e , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x49 , 1 , 12 , 143 , // 12 - am-et
- 0x1 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xcd , 0 , 33 , 143 , // 13 - ar
- 0x1000 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x989e, 0 , 14 , 240 , // 14 - ar-001
- 0x3801 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xe0 , 0 , 15 , 143 , // 15 - ar-ae
- 0x3c01 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x11 , 0 , 16 , 143 , // 16 - ar-bh
- 0x1000 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x3e , 0 , 17 , 240 , // 17 - ar-dj
- 0x1401 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x4 , 1 , 18 , 300 , // 18 - ar-dz
- 0xc01 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x43 , 0 , 19 , 143 , // 19 - ar-eg
- 0x1000 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x47 , 0 , 20 , 240 , // 20 - ar-er
- 0x1000 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x75 , 0 , 21 , 240 , // 21 - ar-il
- 0x801 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x79 , 0 , 22 , 143 , // 22 - ar-iq
- 0x2c01 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x7e , 0 , 23 , 143 , // 23 - ar-jo
- 0x1000 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x32 , 0 , 24 , 240 , // 24 - ar-km
- 0x3401 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x88 , 0 , 25 , 143 , // 25 - ar-kw
- 0x3001 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x8b , 0 , 26 , 143 , // 26 - ar-lb
- 0x1001 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x94 , 1 , 27 , 143 , // 27 - ar-ly
- 0x1801 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x9f , 1 , 28 , 300 , // 28 - ar-ma
- 0x1000 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xa2 , 0 , 29 , 240 , // 29 - ar-mr
- 0x2001 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xa4 , 0 , 30 , 143 , // 30 - ar-om
- 0x1000 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xb8 , 0 , 31 , 240 , // 31 - ar-ps
- 0x4001 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xc5 , 0 , 32 , 143 , // 32 - ar-qa
- 0x401 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xcd , 0 , 33 , 143 , // 33 - ar-sa
- 0x1000 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xdb , 0 , 34 , 240 , // 34 - ar-sd
- 0x1000 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xd8 , 0 , 35 , 240 , // 35 - ar-so
- 0x1000 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x114 , 0 , 36 , 240 , // 36 - ar-ss
- 0x2801 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xde , 0 , 37 , 143 , // 37 - ar-sy
- 0x1000 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x29 , 0 , 38 , 240 , // 38 - ar-td
- 0x1c01 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xea , 1 , 39 , 300 , // 39 - ar-tn
- 0x2401 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x105 , 0 , 40 , 143 , // 40 - ar-ye
- 0x7a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x2e , 1 , 42 , 42 , // 41 - arn
- 0x47a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x2e , 1 , 42 , 42 , // 42 - arn-cl
- 0x4d , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 44 , 143 , // 43 - as
- 0x44d , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 44 , 143 , // 44 - as-in
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 46 , 240 , // 45 - asa
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 46 , 240 , // 46 - asa-tz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd9 , 1 , 48 , 240 , // 47 - ast
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd9 , 1 , 48 , 240 , // 48 - ast-es
- 0x2c , 0x4e6 , 0x359 , 0x2761, 0x51a9, 0x5 , 1 , 53 , 53 , // 49 - az
- 0x742c , 0x4e3 , 0x362 , 0x2717, 0x5190, 0x5 , 1 , 51 , 51 , // 50 - az-cyrl
- 0x82c , 0x4e3 , 0x362 , 0x2717, 0x5190, 0x5 , 1 , 51 , 51 , // 51 - az-cyrl-az
- 0x782c , 0x4e6 , 0x359 , 0x2761, 0x51a9, 0x5 , 1 , 53 , 53 , // 52 - az-latn
- 0x42c , 0x4e6 , 0x359 , 0x2761, 0x51a9, 0x5 , 1 , 53 , 53 , // 53 - az-latn-az
- 0x6d , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xcb , 1 , 55 , 55 , // 54 - ba
- 0x46d , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xcb , 1 , 55 , 55 , // 55 - ba-ru
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 57 , 240 , // 56 - bas
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 57 , 240 , // 57 - bas-cm
- 0x23 , 0x4e3 , 0x362 , 0x2717, 0x1f4 , 0x1d , 1 , 59 , 59 , // 58 - be
- 0x423 , 0x4e3 , 0x362 , 0x2717, 0x1f4 , 0x1d , 1 , 59 , 59 , // 59 - be-by
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x107 , 1 , 61 , 240 , // 60 - bem
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x107 , 1 , 61 , 240 , // 61 - bem-zm
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 63 , 240 , // 62 - bez
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 63 , 240 , // 63 - bez-tz
- 0x2 , 0x4e3 , 0x362 , 0x2717, 0x5221, 0x23 , 1 , 65 , 65 , // 64 - bg
- 0x402 , 0x4e3 , 0x362 , 0x2717, 0x5221, 0x23 , 1 , 65 , 65 , // 65 - bg-bg
- 0x66 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xaf , 1 , 67 , 240 , // 66 - bin
- 0x466 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xaf , 1 , 67 , 240 , // 67 - bin-ng
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9d , 1 , 70 , 240 , // 68 - bm
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9d , 1 , 70 , 240 , // 69 - bm-latn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9d , 1 , 70 , 240 , // 70 - bm-latn-ml
- 0x45 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x17 , 1 , 72 , 143 , // 71 - bn
- 0x845 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x17 , 1 , 72 , 143 , // 72 - bn-bd
- 0x445 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 73 , 143 , // 73 - bn-in
- 0x51 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2d , 1 , 75 , 143 , // 74 - bo
- 0x451 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2d , 1 , 75 , 143 , // 75 - bo-cn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 76 , 240 , // 76 - bo-in
- 0x7e , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x54 , 1 , 78 , 78 , // 77 - br
- 0x47e , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x54 , 1 , 78 , 78 , // 78 - br-fr
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 80 , 240 , // 79 - brx
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 80 , 240 , // 80 - brx-in
- 0x781a , 0x4e2 , 0x354 , 0x2762, 0x366 , 0x19 , 1 , 85 , 85 , // 81 - bs
- 0x641a , 0x4e3 , 0x357 , 0x2762, 0x366 , 0x19 , 1 , 83 , 83 , // 82 - bs-cyrl
- 0x201a , 0x4e3 , 0x357 , 0x2762, 0x366 , 0x19 , 1 , 83 , 83 , // 83 - bs-cyrl-ba
- 0x681a , 0x4e2 , 0x354 , 0x2762, 0x366 , 0x19 , 1 , 85 , 85 , // 84 - bs-latn
- 0x141a , 0x4e2 , 0x354 , 0x2762, 0x366 , 0x19 , 1 , 85 , 85 , // 85 - bs-latn-ba
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x47 , 1 , 87 , 240 , // 86 - byn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x47 , 1 , 87 , 240 , // 87 - byn-er
- 0x3 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd9 , 1 , 90 , 90 , // 88 - ca
- 0x1000 , 0x4e4 , 0x352 , 0x2 , 0x1f4 , 0x8 , 1 , 89 , 240 , // 89 - ca-ad
- 0x403 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd9 , 1 , 90 , 90 , // 90 - ca-es
- 0x803 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd9 , 1 , 91 , 90 , // 91 - ca-es-valencia
- 0x1000 , 0x4e4 , 0x352 , 0x2 , 0x1f4 , 0x54 , 1 , 92 , 240 , // 92 - ca-fr
- 0x1000 , 0x4e4 , 0x352 , 0x2 , 0x1f4 , 0x76 , 1 , 93 , 240 , // 93 - ca-it
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xcb , 1 , 95 , 240 , // 94 - ce
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xcb , 1 , 95 , 240 , // 95 - ce-ru
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf0 , 1 , 97 , 240 , // 96 - cgg
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf0 , 1 , 97 , 240 , // 97 - cgg-ug
- 0x5c , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf4 , 1 , 100 , 240 , // 98 - chr
- 0x7c5c , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf4 , 1 , 100 , 240 , // 99 - chr-cher
- 0x45c , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf4 , 1 , 100 , 240 , // 100 - chr-cher-us
- 0x83 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x54 , 1 , 102 , 102 , // 101 - co
- 0x483 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x54 , 1 , 102 , 102 , // 102 - co-fr
- 0x5 , 0x4e2 , 0x354 , 0x272d, 0x1f4 , 0x4b , 1 , 104 , 104 , // 103 - cs
- 0x405 , 0x4e2 , 0x354 , 0x272d, 0x1f4 , 0x4b , 1 , 104 , 104 , // 104 - cs-cz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xcb , 1 , 106 , 240 , // 105 - cu
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xcb , 1 , 106 , 240 , // 106 - cu-ru
- 0x52 , 0x4e4 , 0x352 , 0x2710, 0x4f3d, 0xf2 , 1 , 108 , 108 , // 107 - cy
- 0x452 , 0x4e4 , 0x352 , 0x2710, 0x4f3d, 0xf2 , 1 , 108 , 108 , // 108 - cy-gb
- 0x6 , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0x3d , 1 , 110 , 110 , // 109 - da
- 0x406 , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0x3d , 1 , 110 , 110 , // 110 - da-dk
- 0x1000 , 0x4e4 , 0x352 , 0x2 , 0x1f4 , 0x5d , 1 , 111 , 240 , // 111 - da-gl
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 113 , 240 , // 112 - dav
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 113 , 240 , // 113 - dav-ke
- 0x7 , 0x4e4 , 0x352 , 0x2710, 0x4f31, 0x5e , 1 , 118 , 118 , // 114 - de
- 0xc07 , 0x4e4 , 0x352 , 0x2710, 0x4f31, 0xe , 1 , 115 , 115 , // 115 - de-at
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f31, 0x15 , 1 , 116 , 240 , // 116 - de-be
- 0x807 , 0x4e4 , 0x352 , 0x2710, 0x4f31, 0xdf , 1 , 117 , 117 , // 117 - de-ch
- 0x407 , 0x4e4 , 0x352 , 0x2710, 0x4f31, 0x5e , 1 , 118 , 118 , // 118 - de-de
- 0x10407, 0x4e4 , 0x352 , 0x2710, 0x4f31, 0x5e , 1 , 118 , 118 , // 119 - de-de_phoneb
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x76 , 1 , 120 , 240 , // 120 - de-it
- 0x1407 , 0x4e4 , 0x352 , 0x2710, 0x4f31, 0x91 , 1 , 121 , 121 , // 121 - de-li
- 0x1007 , 0x4e4 , 0x352 , 0x2710, 0x4f31, 0x93 , 1 , 122 , 122 , // 122 - de-lu
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xad , 1 , 124 , 240 , // 123 - dje
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xad , 1 , 124 , 240 , // 124 - dje-ne
- 0x7c2e , 0x4e4 , 0x352 , 0x2710, 0x366 , 0x5e , 1 , 126 , 126 , // 125 - dsb
- 0x82e , 0x4e4 , 0x352 , 0x2710, 0x366 , 0x5e , 1 , 126 , 126 , // 126 - dsb-de
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 128 , 240 , // 127 - dua
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 128 , 240 , // 128 - dua-cm
- 0x65 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xa5 , 1 , 130 , 143 , // 129 - dv
- 0x465 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xa5 , 1 , 130 , 143 , // 130 - dv-mv
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd2 , 1 , 132 , 240 , // 131 - dyo
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd2 , 1 , 132 , 240 , // 132 - dyo-sn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x22 , 2 , 134 , 240 , // 133 - dz
- 0xc51 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x22 , 2 , 134 , 240 , // 134 - dz-bt
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 136 , 240 , // 135 - ebu
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 136 , 240 , // 136 - ebu-ke
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x59 , 1 , 138 , 240 , // 137 - ee
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x59 , 1 , 138 , 240 , // 138 - ee-gh
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xe8 , 1 , 139 , 240 , // 139 - ee-tg
- 0x8 , 0x4e5 , 0x2e1 , 0x2716, 0x4f31, 0x62 , 1 , 142 , 142 , // 140 - el
- 0x1000 , 0x4e5 , 0x2e1 , 0x2716, 0x4f31, 0x3b , 1 , 141 , 240 , // 141 - el-cy
- 0x408 , 0x4e5 , 0x2e1 , 0x2716, 0x4f31, 0x62 , 1 , 142 , 142 , // 142 - el-gr
- 0x9 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xf4 , 1 , 240 , 240 , // 143 - en
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x989e, 1 , 144 , 240 , // 144 - en-001
- 0x2409 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x993248, 1 , 145 , 145 , // 145 - en-029
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x292d, 1 , 146 , 240 , // 146 - en-150
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x2 , 1 , 147 , 240 , // 147 - en-ag
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x12c , 1 , 148 , 240 , // 148 - en-ai
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xa , 1 , 149 , 240 , // 149 - en-as
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xe , 1 , 150 , 240 , // 150 - en-at
- 0xc09 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xc , 1 , 151 , 151 , // 151 - en-au
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x12 , 1 , 152 , 240 , // 152 - en-bb
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x15 , 1 , 153 , 240 , // 153 - en-be
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x26 , 1 , 154 , 240 , // 154 - en-bi
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x14 , 1 , 155 , 240 , // 155 - en-bm
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x16 , 1 , 156 , 240 , // 156 - en-bs
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x13 , 1 , 157 , 240 , // 157 - en-bw
- 0x2809 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x18 , 1 , 158 , 158 , // 158 - en-bz
- 0x1009 , 0x4e4 , 0x352 , 0x2710, 0x25 , 0x27 , 1 , 159 , 159 , // 159 - en-ca
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x137 , 1 , 160 , 240 , // 160 - en-cc
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xdf , 1 , 161 , 240 , // 161 - en-ch
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x138 , 1 , 162 , 240 , // 162 - en-ck
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x31 , 1 , 163 , 240 , // 163 - en-cm
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x135 , 1 , 164 , 240 , // 164 - en-cx
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x3b , 1 , 165 , 240 , // 165 - en-cy
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x5e , 1 , 166 , 240 , // 166 - en-de
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x3d , 1 , 167 , 240 , // 167 - en-dk
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x3f , 1 , 168 , 240 , // 168 - en-dm
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x47 , 1 , 169 , 240 , // 169 - en-er
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x4d , 1 , 170 , 240 , // 170 - en-fi
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x4e , 1 , 171 , 240 , // 171 - en-fj
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x13b , 1 , 172 , 240 , // 172 - en-fk
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x50 , 1 , 173 , 240 , // 173 - en-fm
- 0x809 , 0x4e4 , 0x352 , 0x2710, 0x4f3d, 0xf2 , 1 , 174 , 174 , // 174 - en-gb
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x5b , 1 , 175 , 240 , // 175 - en-gd
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x144 , 1 , 176 , 240 , // 176 - en-gg
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x59 , 1 , 177 , 240 , // 177 - en-gh
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x5a , 1 , 178 , 240 , // 178 - en-gi
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x56 , 1 , 179 , 240 , // 179 - en-gm
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x142 , 1 , 180 , 240 , // 180 - en-gu
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x65 , 1 , 181 , 240 , // 181 - en-gy
- 0x3c09 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x68 , 1 , 182 , 240 , // 182 - en-hk
- 0x3809 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x6f , 1 , 183 , 240 , // 183 - en-id
- 0x1809 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x44 , 1 , 184 , 184 , // 184 - en-ie
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x75 , 1 , 185 , 240 , // 185 - en-il
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x3b16, 1 , 186 , 240 , // 186 - en-im
- 0x4009 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0x71 , 1 , 187 , 187 , // 187 - en-in
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x72 , 1 , 188 , 240 , // 188 - en-io
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x148 , 1 , 189 , 240 , // 189 - en-je
- 0x2009 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x7c , 1 , 190 , 190 , // 190 - en-jm
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x81 , 1 , 191 , 240 , // 191 - en-ke
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x85 , 1 , 192 , 240 , // 192 - en-ki
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xcf , 1 , 193 , 240 , // 193 - en-kn
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x133 , 1 , 194 , 240 , // 194 - en-ky
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xda , 1 , 195 , 240 , // 195 - en-lc
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x8e , 1 , 196 , 240 , // 196 - en-lr
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x92 , 1 , 197 , 240 , // 197 - en-ls
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x95 , 1 , 198 , 240 , // 198 - en-mg
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xc7 , 1 , 199 , 240 , // 199 - en-mh
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x97 , 1 , 200 , 240 , // 200 - en-mo
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x151 , 1 , 201 , 240 , // 201 - en-mp
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x14c , 1 , 202 , 240 , // 202 - en-ms
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xa3 , 1 , 203 , 240 , // 203 - en-mt
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xa0 , 1 , 204 , 240 , // 204 - en-mu
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x9c , 1 , 205 , 240 , // 205 - en-mw
- 0x4409 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xa7 , 1 , 206 , 206 , // 206 - en-my
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xfe , 1 , 207 , 240 , // 207 - en-na
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x150 , 1 , 208 , 240 , // 208 - en-nf
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xaf , 1 , 209 , 240 , // 209 - en-ng
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xb0 , 1 , 210 , 240 , // 210 - en-nl
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xb4 , 1 , 211 , 240 , // 211 - en-nr
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x14f , 1 , 212 , 240 , // 212 - en-nu
- 0x1409 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xb7 , 1 , 213 , 213 , // 213 - en-nz
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xc2 , 1 , 214 , 240 , // 214 - en-pg
- 0x3409 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0xc9 , 1 , 215 , 215 , // 215 - en-ph
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xbe , 1 , 216 , 240 , // 216 - en-pk
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x153 , 1 , 217 , 240 , // 217 - en-pn
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xca , 1 , 218 , 240 , // 218 - en-pr
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xc3 , 1 , 219 , 240 , // 219 - en-pw
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xcc , 1 , 220 , 240 , // 220 - en-rw
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x1e , 1 , 221 , 240 , // 221 - en-sb
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd0 , 1 , 222 , 240 , // 222 - en-sc
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xdb , 1 , 223 , 240 , // 223 - en-sd
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xdd , 1 , 224 , 240 , // 224 - en-se
- 0x4809 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xd7 , 1 , 225 , 225 , // 225 - en-sg
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x157 , 1 , 226 , 240 , // 226 - en-sh
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd4 , 1 , 227 , 240 , // 227 - en-si
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd5 , 1 , 228 , 240 , // 228 - en-sl
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x114 , 1 , 229 , 240 , // 229 - en-ss
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x78f7, 1 , 230 , 240 , // 230 - en-sx
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x104 , 1 , 231 , 240 , // 231 - en-sz
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x15d , 1 , 232 , 240 , // 232 - en-tc
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x15b , 1 , 233 , 240 , // 233 - en-tk
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xe7 , 1 , 234 , 240 , // 234 - en-to
- 0x2c09 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xe1 , 1 , 235 , 235 , // 235 - en-tt
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xec , 1 , 236 , 240 , // 236 - en-tv
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xef , 1 , 237 , 240 , // 237 - en-tz
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xf0 , 1 , 238 , 240 , // 238 - en-ug
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x9a55d40, 1 , 239 , 240 , // 239 - en-um
- 0x409 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xf4 , 1 , 240 , 240 , // 240 - en-us
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xf8 , 1 , 241 , 240 , // 241 - en-vc
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x15f , 1 , 242 , 240 , // 242 - en-vg
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xfc , 1 , 243 , 240 , // 243 - en-vi
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xae , 1 , 244 , 240 , // 244 - en-vu
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x103 , 1 , 245 , 240 , // 245 - en-ws
- 0x1c09 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0xd1 , 1 , 246 , 246 , // 246 - en-za
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x107 , 1 , 247 , 240 , // 247 - en-zm
- 0x3009 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0x108 , 1 , 248 , 248 , // 248 - en-zw
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x989e, 1 , 250 , 240 , // 249 - eo
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x989e, 1 , 250 , 240 , // 250 - eo-001
- 0xa , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xd9 , 1 , 262 , 262 , // 251 - es
- 0x580a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x9a55d41, 1 , 252 , 240 , // 252 - es-419
- 0x2c0a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xb , 1 , 253 , 253 , // 253 - es-ar
- 0x400a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x1a , 1 , 254 , 254 , // 254 - es-bo
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x20 , 1 , 255 , 240 , // 255 - es-br
- 0x340a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x2e , 1 , 256 , 256 , // 256 - es-cl
- 0x240a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x33 , 1 , 257 , 257 , // 257 - es-co
- 0x140a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x36 , 1 , 258 , 258 , // 258 - es-cr
- 0x5c0a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x38 , 1 , 259 , 240 , // 259 - es-cu
- 0x1c0a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x41 , 1 , 260 , 260 , // 260 - es-do
- 0x300a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x42 , 1 , 261 , 261 , // 261 - es-ec
- 0xc0a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xd9 , 1 , 262 , 262 , // 262 - es-es
- 0x40a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xd9 , 1 , 263 , 263 , // 263 - es-es_tradnl
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x45 , 1 , 264 , 240 , // 264 - es-gq
- 0x100a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x63 , 1 , 265 , 265 , // 265 - es-gt
- 0x480a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x6a , 1 , 266 , 266 , // 266 - es-hn
- 0x80a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xa6 , 1 , 267 , 267 , // 267 - es-mx
- 0x4c0a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xb6 , 1 , 268 , 268 , // 268 - es-ni
- 0x180a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xc0 , 1 , 269 , 269 , // 269 - es-pa
- 0x280a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xbb , 1 , 270 , 270 , // 270 - es-pe
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xc9 , 1 , 271 , 240 , // 271 - es-ph
- 0x500a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xca , 1 , 272 , 272 , // 272 - es-pr
- 0x3c0a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xb9 , 1 , 273 , 273 , // 273 - es-py
- 0x440a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x48 , 1 , 274 , 274 , // 274 - es-sv
- 0x540a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xf4 , 1 , 275 , 275 , // 275 - es-us
- 0x380a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xf6 , 1 , 276 , 276 , // 276 - es-uy
- 0x200a , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xf9 , 1 , 277 , 277 , // 277 - es-ve
- 0x25 , 0x4e9 , 0x307 , 0x272d, 0x1f4 , 0x46 , 1 , 279 , 279 , // 278 - et
- 0x425 , 0x4e9 , 0x307 , 0x272d, 0x1f4 , 0x46 , 1 , 279 , 279 , // 279 - et-ee
- 0x2d , 0x4e4 , 0x352 , 0x2 , 0x1f4 , 0xd9 , 1 , 281 , 240 , // 280 - eu
- 0x42d , 0x4e4 , 0x352 , 0x2 , 0x1f4 , 0xd9 , 1 , 281 , 240 , // 281 - eu-es
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 283 , 240 , // 282 - ewo
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 283 , 240 , // 283 - ewo-cm
- 0x29 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x74 , 0 , 285 , 143 , // 284 - fa
- 0x429 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x74 , 0 , 285 , 143 , // 285 - fa-ir
- 0x67 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xd2 , 1 , 290 , 290 , // 286 - ff
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x31 , 1 , 287 , 240 , // 287 - ff-cm
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x64 , 1 , 288 , 240 , // 288 - ff-gn
- 0x7c67 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xd2 , 1 , 290 , 290 , // 289 - ff-latn
- 0x867 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xd2 , 1 , 290 , 290 , // 290 - ff-latn-sn
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xa2 , 1 , 291 , 240 , // 291 - ff-mr
- 0x467 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xaf , 1 , 292 , 240 , // 292 - ff-ng
- 0xb , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0x4d , 1 , 294 , 294 , // 293 - fi
- 0x40b , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0x4d , 1 , 294 , 294 , // 294 - fi-fi
- 0x64 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0xc9 , 1 , 296 , 296 , // 295 - fil
- 0x464 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0xc9 , 1 , 296 , 296 , // 296 - fil-ph
- 0x38 , 0x4e4 , 0x352 , 0x275f, 0x4f35, 0x51 , 1 , 299 , 299 , // 297 - fo
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x3d , 1 , 298 , 240 , // 298 - fo-dk
- 0x438 , 0x4e4 , 0x352 , 0x275f, 0x4f35, 0x51 , 1 , 299 , 299 , // 299 - fo-fo
- 0xc , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x54 , 1 , 316 , 316 , // 300 - fr
- 0x1c0c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x993248, 1 , 301 , 316 , // 301 - fr-029
- 0x80c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x15 , 1 , 302 , 302 , // 302 - fr-be
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xf5 , 1 , 303 , 240 , // 303 - fr-bf
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x26 , 1 , 304 , 240 , // 304 - fr-bi
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x1c , 1 , 305 , 240 , // 305 - fr-bj
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x9a55c4f, 1 , 306 , 240 , // 306 - fr-bl
- 0xc0c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x27 , 1 , 307 , 307 , // 307 - fr-ca
- 0x240c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x2c , 1 , 308 , 240 , // 308 - fr-cd
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x37 , 1 , 309 , 240 , // 309 - fr-cf
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x2b , 1 , 310 , 240 , // 310 - fr-cg
- 0x100c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xdf , 1 , 311 , 311 , // 311 - fr-ch
- 0x300c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x77 , 1 , 312 , 240 , // 312 - fr-ci
- 0x2c0c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x31 , 1 , 313 , 240 , // 313 - fr-cm
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x3e , 1 , 314 , 240 , // 314 - fr-dj
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x4 , 1 , 315 , 240 , // 315 - fr-dz
- 0x40c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x54 , 1 , 316 , 316 , // 316 - fr-fr
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x57 , 1 , 317 , 240 , // 317 - fr-ga
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x13d , 1 , 318 , 240 , // 318 - fr-gf
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x64 , 1 , 319 , 240 , // 319 - fr-gn
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x141 , 1 , 320 , 240 , // 320 - fr-gp
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x45 , 1 , 321 , 240 , // 321 - fr-gq
- 0x3c0c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x67 , 1 , 322 , 240 , // 322 - fr-ht
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x32 , 1 , 323 , 240 , // 323 - fr-km
- 0x140c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x93 , 1 , 324 , 324 , // 324 - fr-lu
- 0x380c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x9f , 1 , 325 , 240 , // 325 - fr-ma
- 0x180c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x9e , 1 , 326 , 326 , // 326 - fr-mc
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x7bda, 1 , 327 , 240 , // 327 - fr-mf
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x95 , 1 , 328 , 240 , // 328 - fr-mg
- 0x340c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x9d , 1 , 329 , 240 , // 329 - fr-ml
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x14a , 1 , 330 , 240 , // 330 - fr-mq
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xa2 , 1 , 331 , 240 , // 331 - fr-mr
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xa0 , 1 , 332 , 240 , // 332 - fr-mu
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x14e , 1 , 333 , 240 , // 333 - fr-nc
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xad , 1 , 334 , 240 , // 334 - fr-ne
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x13e , 1 , 335 , 240 , // 335 - fr-pf
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xce , 1 , 336 , 240 , // 336 - fr-pm
- 0x200c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xc6 , 1 , 337 , 240 , // 337 - fr-re
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xcc , 1 , 338 , 240 , // 338 - fr-rw
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xd0 , 1 , 339 , 240 , // 339 - fr-sc
- 0x280c , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xd2 , 1 , 340 , 240 , // 340 - fr-sn
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xde , 1 , 341 , 240 , // 341 - fr-sy
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x29 , 1 , 342 , 240 , // 342 - fr-td
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xe8 , 1 , 343 , 240 , // 343 - fr-tg
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xea , 1 , 344 , 240 , // 344 - fr-tn
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xae , 1 , 345 , 240 , // 345 - fr-vu
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x160 , 1 , 346 , 240 , // 346 - fr-wf
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x14b , 1 , 347 , 240 , // 347 - fr-yt
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x76 , 1 , 349 , 240 , // 348 - fur
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x76 , 1 , 349 , 240 , // 349 - fur-it
- 0x62 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xb0 , 1 , 351 , 351 , // 350 - fy
- 0x462 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xb0 , 1 , 351 , 351 , // 351 - fy-nl
- 0x3c , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x44 , 1 , 353 , 353 , // 352 - ga
- 0x83c , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x44 , 1 , 353 , 353 , // 353 - ga-ie
- 0x91 , 0x4e4 , 0x352 , 0x2710, 0x4f3d, 0xf2 , 1 , 355 , 355 , // 354 - gd
- 0x491 , 0x4e4 , 0x352 , 0x2710, 0x4f3d, 0xf2 , 1 , 355 , 355 , // 355 - gd-gb
- 0x56 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd9 , 1 , 357 , 357 , // 356 - gl
- 0x456 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd9 , 1 , 357 , 357 , // 357 - gl-es
- 0x74 , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xb9 , 1 , 359 , 359 , // 358 - gn
- 0x474 , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xb9 , 1 , 359 , 359 , // 359 - gn-py
- 0x84 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xdf , 1 , 361 , 240 , // 360 - gsw
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xdf , 1 , 361 , 240 , // 361 - gsw-ch
- 0x484 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x54 , 1 , 362 , 362 , // 362 - gsw-fr
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x91 , 1 , 363 , 240 , // 363 - gsw-li
- 0x47 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 365 , 143 , // 364 - gu
- 0x447 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 365 , 143 , // 365 - gu-in
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 367 , 240 , // 366 - guz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 367 , 240 , // 367 - guz-ke
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x3b16, 1 , 369 , 240 , // 368 - gv
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x3b16, 1 , 369 , 240 , // 369 - gv-im
- 0x68 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xaf , 1 , 374 , 374 , // 370 - ha
- 0x7c68 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xaf , 1 , 374 , 374 , // 371 - ha-latn
- 0x1000 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0x59 , 1 , 372 , 240 , // 372 - ha-latn-gh
- 0x1000 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0xad , 1 , 373 , 240 , // 373 - ha-latn-ne
- 0x468 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xaf , 1 , 374 , 374 , // 374 - ha-latn-ng
- 0x75 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xf4 , 1 , 376 , 376 , // 375 - haw
- 0x475 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xf4 , 1 , 376 , 376 , // 376 - haw-us
- 0xd , 0x4e7 , 0x35e , 0x2715, 0x1f4 , 0x75 , 1 , 378 , 143 , // 377 - he
- 0x40d , 0x4e7 , 0x35e , 0x2715, 0x1f4 , 0x75 , 1 , 378 , 143 , // 378 - he-il
- 0x39 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 380 , 143 , // 379 - hi
- 0x439 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 380 , 143 , // 380 - hi-in
- 0x1a , 0x4e2 , 0x354 , 0x2762, 0x1f4 , 0x6c , 1 , 383 , 383 , // 381 - hr
- 0x101a , 0x4e2 , 0x354 , 0x2762, 0x366 , 0x19 , 1 , 382 , 382 , // 382 - hr-ba
- 0x41a , 0x4e2 , 0x354 , 0x2762, 0x1f4 , 0x6c , 1 , 383 , 383 , // 383 - hr-hr
- 0x2e , 0x4e4 , 0x352 , 0x2710, 0x366 , 0x5e , 1 , 385 , 385 , // 384 - hsb
- 0x42e , 0x4e4 , 0x352 , 0x2710, 0x366 , 0x5e , 1 , 385 , 385 , // 385 - hsb-de
- 0xe , 0x4e2 , 0x354 , 0x272d, 0x1f4 , 0x6d , 1 , 387 , 387 , // 386 - hu
- 0x40e , 0x4e2 , 0x354 , 0x272d, 0x1f4 , 0x6d , 1 , 387 , 387 , // 387 - hu-hu
- 0x1040e, 0x4e2 , 0x354 , 0x272d, 0x1f4 , 0x6d , 1 , 387 , 387 , // 388 - hu-hu_technl
- 0x2b , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x7 , 1 , 390 , 390 , // 389 - hy
- 0x42b , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x7 , 1 , 390 , 390 , // 390 - hy-am
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x54 , 1 , 393 , 240 , // 391 - ia
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x989e, 1 , 392 , 240 , // 392 - ia-001
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x54 , 1 , 393 , 240 , // 393 - ia-fr
- 0x69 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xaf , 1 , 395 , 240 , // 394 - ibb
- 0x469 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xaf , 1 , 395 , 240 , // 395 - ibb-ng
- 0x21 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x6f , 1 , 397 , 397 , // 396 - id
- 0x421 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x6f , 1 , 397 , 397 , // 397 - id-id
- 0x70 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xaf , 1 , 399 , 399 , // 398 - ig
- 0x470 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xaf , 1 , 399 , 399 , // 399 - ig-ng
- 0x78 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2d , 1 , 401 , 143 , // 400 - ii
- 0x478 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2d , 1 , 401 , 143 , // 401 - ii-cn
- 0xf , 0x4e4 , 0x352 , 0x275f, 0x5187, 0x6e , 1 , 403 , 403 , // 402 - is
- 0x40f , 0x4e4 , 0x352 , 0x275f, 0x5187, 0x6e , 1 , 403 , 403 , // 403 - is-is
- 0x10 , 0x4e4 , 0x352 , 0x2710, 0x4f38, 0x76 , 1 , 406 , 406 , // 404 - it
- 0x810 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xdf , 1 , 405 , 405 , // 405 - it-ch
- 0x410 , 0x4e4 , 0x352 , 0x2710, 0x4f38, 0x76 , 1 , 406 , 406 , // 406 - it-it
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f38, 0xd6 , 1 , 407 , 240 , // 407 - it-sm
- 0x5d , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0x27 , 1 , 412 , 412 , // 408 - iu
- 0x785d , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x27 , 1 , 410 , 143 , // 409 - iu-cans
- 0x45d , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x27 , 1 , 410 , 143 , // 410 - iu-cans-ca
- 0x7c5d , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0x27 , 1 , 412 , 412 , // 411 - iu-latn
- 0x85d , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0x27 , 1 , 412 , 412 , // 412 - iu-latn-ca
- 0x11 , 0x3a4 , 0x3a4 , 0x2711, 0x4f42, 0x7a , 1 , 414 , 414 , // 413 - ja
- 0x411 , 0x3a4 , 0x3a4 , 0x2711, 0x4f42, 0x7a , 1 , 414 , 414 , // 414 - ja-jp
- 0x40411, 0x3a4 , 0x3a4 , 0x2711, 0x4f42, 0x7a , 1 , 414 , 414 , // 415 - ja-jp_radstr
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 417 , 240 , // 416 - jgo
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 417 , 240 , // 417 - jgo-cm
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 419 , 240 , // 418 - jmc
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 419 , 240 , // 419 - jmc-tz
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x6f , 1 , 424 , 424 , // 420 - jv
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x6f , 1 , 422 , 424 , // 421 - jv-java
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x6f , 1 , 422 , 424 , // 422 - jv-java-id
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x6f , 1 , 424 , 424 , // 423 - jv-latn
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x6f , 1 , 424 , 424 , // 424 - jv-latn-id
- 0x37 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x58 , 1 , 426 , 426 , // 425 - ka
- 0x437 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x58 , 1 , 426 , 426 , // 426 - ka-ge
- 0x10437, 0x0 , 0x1 , 0x2 , 0x1f4 , 0x58 , 1 , 426 , 426 , // 427 - ka-ge_modern
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x4 , 1 , 429 , 240 , // 428 - kab
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x4 , 1 , 429 , 240 , // 429 - kab-dz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 431 , 240 , // 430 - kam
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 431 , 240 , // 431 - kam-ke
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 433 , 240 , // 432 - kde
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 433 , 240 , // 433 - kde-tz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x39 , 1 , 435 , 240 , // 434 - kea
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x39 , 1 , 435 , 240 , // 435 - kea-cv
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9d , 1 , 437 , 240 , // 436 - khq
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9d , 1 , 437 , 240 , // 437 - khq-ml
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 439 , 240 , // 438 - ki
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 439 , 240 , // 439 - ki-ke
- 0x3f , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x89 , 1 , 441 , 441 , // 440 - kk
- 0x43f , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x89 , 1 , 441 , 441 , // 441 - kk-kz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 443 , 240 , // 442 - kkj
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 443 , 240 , // 443 - kkj-cm
- 0x6f , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0x5d , 1 , 445 , 445 , // 444 - kl
- 0x46f , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0x5d , 1 , 445 , 445 , // 445 - kl-gl
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 447 , 240 , // 446 - kln
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 447 , 240 , // 447 - kln-ke
- 0x53 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x28 , 2 , 449 , 143 , // 448 - km
- 0x453 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x28 , 2 , 449 , 143 , // 449 - km-kh
- 0x4b , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 451 , 143 , // 450 - kn
- 0x44b , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 451 , 143 , // 451 - kn-in
- 0x12 , 0x3b5 , 0x3b5 , 0x2713, 0x5161, 0x86 , 1 , 454 , 454 , // 452 - ko
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x83 , 1 , 453 , 240 , // 453 - ko-kp
- 0x412 , 0x3b5 , 0x3b5 , 0x2713, 0x5161, 0x86 , 1 , 454 , 454 , // 454 - ko-kr
- 0x57 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 456 , 143 , // 455 - kok
- 0x457 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 456 , 143 , // 456 - kok-in
- 0x71 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xaf , 1 , 458 , 240 , // 457 - kr
- 0x471 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xaf , 1 , 458 , 240 , // 458 - kr-ng
- 0x60 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 2 , 461 , 240 , // 459 - ks
- 0x460 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 2 , 461 , 240 , // 460 - ks-arab
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 2 , 461 , 240 , // 461 - ks-arab-in
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 463 , 187 , // 462 - ks-deva
- 0x860 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 463 , 187 , // 463 - ks-deva-in
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 465 , 240 , // 464 - ksb
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 465 , 240 , // 465 - ksb-tz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 467 , 240 , // 466 - ksf
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 467 , 240 , // 467 - ksf-cm
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x5e , 1 , 469 , 240 , // 468 - ksh
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x5e , 1 , 469 , 240 , // 469 - ksh-de
- 0x92 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x79 , 0 , 472 , 143 , // 470 - ku
- 0x7c92 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x79 , 0 , 472 , 143 , // 471 - ku-arab
- 0x492 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x79 , 0 , 472 , 143 , // 472 - ku-arab-iq
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x74 , 0 , 473 , 240 , // 473 - ku-arab-ir
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf2 , 1 , 475 , 240 , // 474 - kw
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf2 , 1 , 475 , 240 , // 475 - kw-gb
- 0x40 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0x82 , 1 , 477 , 477 , // 476 - ky
- 0x440 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0x82 , 1 , 477 , 477 , // 477 - ky-kg
- 0x76 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0x989e, 1 , 479 , 143 , // 478 - la
- 0x476 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0x989e, 1 , 479 , 143 , // 479 - la-001
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 481 , 240 , // 480 - lag
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 481 , 240 , // 481 - lag-tz
- 0x6e , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x93 , 1 , 483 , 483 , // 482 - lb
- 0x46e , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x93 , 1 , 483 , 483 , // 483 - lb-lu
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf0 , 1 , 485 , 240 , // 484 - lg
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf0 , 1 , 485 , 240 , // 485 - lg-ug
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf4 , 1 , 487 , 240 , // 486 - lkt
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf4 , 1 , 487 , 240 , // 487 - lkt-us
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2c , 1 , 490 , 240 , // 488 - ln
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9 , 1 , 489 , 240 , // 489 - ln-ao
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2c , 1 , 490 , 240 , // 490 - ln-cd
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x37 , 1 , 491 , 240 , // 491 - ln-cf
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2b , 1 , 492 , 240 , // 492 - ln-cg
- 0x54 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x8a , 1 , 494 , 143 , // 493 - lo
- 0x454 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x8a , 1 , 494 , 143 , // 494 - lo-la
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x74 , 2 , 497 , 240 , // 495 - lrc
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x79 , 2 , 496 , 240 , // 496 - lrc-iq
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x74 , 2 , 497 , 240 , // 497 - lrc-ir
- 0x27 , 0x4e9 , 0x307 , 0x272d, 0x1f4 , 0x8d , 1 , 499 , 499 , // 498 - lt
- 0x427 , 0x4e9 , 0x307 , 0x272d, 0x1f4 , 0x8d , 1 , 499 , 499 , // 499 - lt-lt
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2c , 1 , 501 , 240 , // 500 - lu
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2c , 1 , 501 , 240 , // 501 - lu-cd
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 503 , 240 , // 502 - luo
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 503 , 240 , // 503 - luo-ke
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 505 , 240 , // 504 - luy
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 505 , 240 , // 505 - luy-ke
- 0x26 , 0x4e9 , 0x307 , 0x272d, 0x1f4 , 0x8c , 1 , 507 , 507 , // 506 - lv
- 0x426 , 0x4e9 , 0x307 , 0x272d, 0x1f4 , 0x8c , 1 , 507 , 507 , // 507 - lv-lv
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 509 , 240 , // 508 - mas
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 509 , 240 , // 509 - mas-ke
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 510 , 240 , // 510 - mas-tz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 512 , 240 , // 511 - mer
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 512 , 240 , // 512 - mer-ke
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xa0 , 1 , 514 , 240 , // 513 - mfe
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xa0 , 1 , 514 , 240 , // 514 - mfe-mu
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x95 , 1 , 516 , 240 , // 515 - mg
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x95 , 1 , 516 , 240 , // 516 - mg-mg
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xa8 , 1 , 518 , 240 , // 517 - mgh
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xa8 , 1 , 518 , 240 , // 518 - mgh-mz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 520 , 240 , // 519 - mgo
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 520 , 240 , // 520 - mgo-cm
- 0x81 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xb7 , 1 , 522 , 522 , // 521 - mi
- 0x481 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xb7 , 1 , 522 , 522 , // 522 - mi-nz
- 0x2f , 0x4e3 , 0x362 , 0x2717, 0x1f4 , 0x4ca2, 1 , 524 , 524 , // 523 - mk
- 0x42f , 0x4e3 , 0x362 , 0x2717, 0x1f4 , 0x4ca2, 1 , 524 , 524 , // 524 - mk-mk
- 0x4c , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 526 , 143 , // 525 - ml
- 0x44c , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 526 , 143 , // 526 - ml-in
- 0x50 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0x9a , 1 , 529 , 529 , // 527 - mn
- 0x7850 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0x9a , 1 , 529 , 529 , // 528 - mn-cyrl
- 0x450 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0x9a , 1 , 529 , 529 , // 529 - mn-mn
- 0x7c50 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2d , 1 , 531 , 531 , // 530 - mn-mong
- 0x850 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2d , 1 , 531 , 531 , // 531 - mn-mong-cn
- 0xc50 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9a , 1 , 532 , 532 , // 532 - mn-mong-mn
- 0x58 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 534 , 187 , // 533 - mni
- 0x458 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 534 , 187 , // 534 - mni-in
- 0x7c , 0x4e4 , 0x352 , 0x2710, 0x25 , 0x27 , 1 , 536 , 240 , // 535 - moh
- 0x47c , 0x4e4 , 0x352 , 0x2710, 0x25 , 0x27 , 1 , 536 , 240 , // 536 - moh-ca
- 0x4e , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 538 , 143 , // 537 - mr
- 0x44e , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 538 , 143 , // 538 - mr-in
- 0x3e , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xa7 , 1 , 541 , 541 , // 539 - ms
- 0x83e , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x25 , 1 , 540 , 540 , // 540 - ms-bn
- 0x43e , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xa7 , 1 , 541 , 541 , // 541 - ms-my
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd7 , 1 , 542 , 240 , // 542 - ms-sg
- 0x3a , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xa3 , 1 , 544 , 544 , // 543 - mt
- 0x43a , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xa3 , 1 , 544 , 544 , // 544 - mt-mt
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 546 , 240 , // 545 - mua
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 546 , 240 , // 546 - mua-cm
- 0x55 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x1b , 2 , 548 , 240 , // 547 - my
- 0x455 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x1b , 2 , 548 , 240 , // 548 - my-mm
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x74 , 2 , 550 , 240 , // 549 - mzn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x74 , 2 , 550 , 240 , // 550 - mzn-ir
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xfe , 1 , 552 , 240 , // 551 - naq
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xfe , 1 , 552 , 240 , // 552 - naq-na
- 0x7c14 , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0xb1 , 1 , 554 , 554 , // 553 - nb
- 0x414 , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0xb1 , 1 , 554 , 554 , // 554 - nb-no
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0xdc , 1 , 555 , 240 , // 555 - nb-sj
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x108 , 1 , 557 , 240 , // 556 - nd
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x108 , 1 , 557 , 240 , // 557 - nd-zw
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x5e , 1 , 559 , 240 , // 558 - nds
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x5e , 1 , 559 , 240 , // 559 - nds-de
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xb0 , 1 , 560 , 240 , // 560 - nds-nl
- 0x61 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xb2 , 1 , 563 , 143 , // 561 - ne
- 0x861 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 2 , 562 , 240 , // 562 - ne-in
- 0x461 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xb2 , 1 , 563 , 143 , // 563 - ne-np
- 0x13 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xb0 , 1 , 569 , 569 , // 564 - nl
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x12e , 1 , 565 , 240 , // 565 - nl-aw
- 0x813 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x15 , 1 , 566 , 566 , // 566 - nl-be
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x9a55d42, 1 , 567 , 240 , // 567 - nl-bq
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x111 , 1 , 568 , 240 , // 568 - nl-cw
- 0x413 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xb0 , 1 , 569 , 569 , // 569 - nl-nl
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xb5 , 1 , 570 , 240 , // 570 - nl-sr
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x78f7, 1 , 571 , 240 , // 571 - nl-sx
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 573 , 240 , // 572 - nmg
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 573 , 240 , // 573 - nmg-cm
- 0x7814 , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0xb1 , 1 , 575 , 575 , // 574 - nn
- 0x814 , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0xb1 , 1 , 575 , 575 , // 575 - nn-no
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 577 , 240 , // 576 - nnh
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 577 , 240 , // 577 - nnh-cm
- 0x14 , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0xb1 , 1 , 554 , 554 , // 578 - no
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x64 , 2 , 580 , 143 , // 579 - nqo
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x64 , 2 , 580 , 143 , // 580 - nqo-gn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd1 , 1 , 582 , 240 , // 581 - nr
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd1 , 1 , 582 , 240 , // 582 - nr-za
- 0x6c , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd1 , 1 , 584 , 584 , // 583 - nso
- 0x46c , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd1 , 1 , 584 , 584 , // 584 - nso-za
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x114 , 1 , 586 , 240 , // 585 - nus
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x114 , 1 , 586 , 240 , // 586 - nus-ss
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf0 , 1 , 588 , 240 , // 587 - nyn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf0 , 1 , 588 , 240 , // 588 - nyn-ug
- 0x82 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x54 , 1 , 590 , 590 , // 589 - oc
- 0x482 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x54 , 1 , 590 , 590 , // 590 - oc-fr
- 0x72 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x49 , 1 , 592 , 240 , // 591 - om
- 0x472 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x49 , 1 , 592 , 240 , // 592 - om-et
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 593 , 240 , // 593 - om-ke
- 0x48 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 595 , 143 , // 594 - or
- 0x448 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 595 , 143 , // 595 - or-in
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x58 , 1 , 597 , 240 , // 596 - os
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x58 , 1 , 597 , 240 , // 597 - os-ge
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xcb , 1 , 598 , 240 , // 598 - os-ru
- 0x46 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 602 , 143 , // 599 - pa
- 0x7c46 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xbe , 2 , 601 , 143 , // 600 - pa-arab
- 0x846 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xbe , 2 , 601 , 143 , // 601 - pa-arab-pk
- 0x446 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 602 , 143 , // 602 - pa-in
- 0x79 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x993248, 1 , 604 , 145 , // 603 - pap
- 0x479 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x993248, 1 , 604 , 145 , // 604 - pap-029
- 0x15 , 0x4e2 , 0x354 , 0x272d, 0x5190, 0xbf , 1 , 606 , 606 , // 605 - pl
- 0x415 , 0x4e2 , 0x354 , 0x272d, 0x5190, 0xbf , 1 , 606 , 606 , // 606 - pl-pl
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x989e, 1 , 608 , 240 , // 607 - prg
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x989e, 1 , 608 , 240 , // 608 - prg-001
- 0x8c , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x3 , 2 , 610 , 143 , // 609 - prs
- 0x48c , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x3 , 2 , 610 , 143 , // 610 - prs-af
- 0x63 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x3 , 2 , 612 , 143 , // 611 - ps
- 0x463 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x3 , 2 , 612 , 143 , // 612 - ps-af
- 0x16 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x20 , 1 , 615 , 615 , // 613 - pt
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x9 , 1 , 614 , 240 , // 614 - pt-ao
- 0x416 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x20 , 1 , 615 , 615 , // 615 - pt-br
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xdf , 1 , 616 , 240 , // 616 - pt-ch
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x39 , 1 , 617 , 240 , // 617 - pt-cv
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x45 , 1 , 618 , 240 , // 618 - pt-gq
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xc4 , 1 , 619 , 240 , // 619 - pt-gw
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x93 , 1 , 620 , 240 , // 620 - pt-lu
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x97 , 1 , 621 , 240 , // 621 - pt-mo
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xa8 , 1 , 622 , 240 , // 622 - pt-mz
- 0x816 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xc1 , 1 , 623 , 623 , // 623 - pt-pt
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xe9 , 1 , 624 , 240 , // 624 - pt-st
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x6f60e7, 1 , 625 , 240 , // 625 - pt-tl
- 0x901 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x7c , 1 , 626 , 190 , // 626 - qps-latn-x-sh
- 0x501 , 0x4e2 , 0x354 , 0x272d, 0x5190, 0xf4 , 1 , 627 , 627 , // 627 - qps-ploc
- 0x5fe , 0x3a4 , 0x3a4 , 0x2711, 0x4f42, 0x7a , 1 , 628 , 628 , // 628 - qps-ploca
- 0x9ff , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xcd , 0 , 629 , 143 , // 629 - qps-plocm
- 0x86 , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x63 , 1 , 632 , 632 , // 630 - quc
- 0x7c86 , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x63 , 1 , 632 , 632 , // 631 - quc-latn
- 0x486 , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x63 , 1 , 632 , 632 , // 632 - quc-latn-gt
- 0x6b , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x1a , 1 , 634 , 634 , // 633 - quz
- 0x46b , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x1a , 1 , 634 , 634 , // 634 - quz-bo
- 0x86b , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0x42 , 1 , 635 , 635 , // 635 - quz-ec
- 0xc6b , 0x4e4 , 0x352 , 0x2710, 0x4f3c, 0xbb , 1 , 636 , 636 , // 636 - quz-pe
- 0x17 , 0x4e4 , 0x352 , 0x2710, 0x4f31, 0xdf , 1 , 638 , 638 , // 637 - rm
- 0x417 , 0x4e4 , 0x352 , 0x2710, 0x4f31, 0xdf , 1 , 638 , 638 , // 638 - rm-ch
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x26 , 1 , 640 , 240 , // 639 - rn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x26 , 1 , 640 , 240 , // 640 - rn-bi
- 0x18 , 0x4e2 , 0x354 , 0x272d, 0x5190, 0xc8 , 1 , 643 , 643 , // 641 - ro
- 0x818 , 0x4e2 , 0x354 , 0x2 , 0x1f4 , 0x98 , 1 , 642 , 240 , // 642 - ro-md
- 0x418 , 0x4e2 , 0x354 , 0x272d, 0x5190, 0xc8 , 1 , 643 , 643 , // 643 - ro-ro
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 645 , 240 , // 644 - rof
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 645 , 240 , // 645 - rof-tz
- 0x19 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xcb , 1 , 651 , 651 , // 646 - ru
- 0x1000 , 0x4e3 , 0x362 , 0x2 , 0x1f4 , 0x1d , 1 , 647 , 240 , // 647 - ru-by
- 0x1000 , 0x4e3 , 0x362 , 0x2 , 0x1f4 , 0x82 , 1 , 648 , 240 , // 648 - ru-kg
- 0x1000 , 0x4e3 , 0x362 , 0x2 , 0x1f4 , 0x89 , 1 , 649 , 240 , // 649 - ru-kz
- 0x819 , 0x4e3 , 0x362 , 0x2 , 0x1f4 , 0x98 , 1 , 650 , 240 , // 650 - ru-md
- 0x419 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xcb , 1 , 651 , 651 , // 651 - ru-ru
- 0x1000 , 0x4e3 , 0x362 , 0x2 , 0x1f4 , 0xf1 , 1 , 652 , 240 , // 652 - ru-ua
- 0x87 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xcc , 1 , 654 , 654 , // 653 - rw
- 0x487 , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xcc , 1 , 654 , 654 , // 654 - rw-rw
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 656 , 240 , // 655 - rwk
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 656 , 240 , // 656 - rwk-tz
- 0x4f , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 658 , 143 , // 657 - sa
- 0x44f , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 658 , 143 , // 658 - sa-in
- 0x85 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xcb , 1 , 660 , 660 , // 659 - sah
- 0x485 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xcb , 1 , 660 , 660 , // 660 - sah-ru
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 662 , 240 , // 661 - saq
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 662 , 240 , // 662 - saq-ke
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 664 , 240 , // 663 - sbp
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 664 , 240 , // 664 - sbp-tz
- 0x59 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xbe , 2 , 667 , 143 , // 665 - sd
- 0x7c59 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xbe , 2 , 667 , 143 , // 666 - sd-arab
- 0x859 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xbe , 2 , 667 , 143 , // 667 - sd-arab-pk
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 669 , 187 , // 668 - sd-deva
- 0x459 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 669 , 187 , // 669 - sd-deva-in
- 0x3b , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0xb1 , 1 , 672 , 672 , // 670 - se
- 0xc3b , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0x4d , 1 , 671 , 671 , // 671 - se-fi
- 0x43b , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0xb1 , 1 , 672 , 672 , // 672 - se-no
- 0x83b , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0xdd , 1 , 673 , 673 , // 673 - se-se
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xa8 , 1 , 675 , 240 , // 674 - seh
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xa8 , 1 , 675 , 240 , // 675 - seh-mz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9d , 1 , 677 , 240 , // 676 - ses
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9d , 1 , 677 , 240 , // 677 - ses-ml
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x37 , 1 , 679 , 240 , // 678 - sg
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x37 , 1 , 679 , 240 , // 679 - sg-cf
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9f , 1 , 684 , 240 , // 680 - shi
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9f , 1 , 682 , 240 , // 681 - shi-latn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9f , 1 , 682 , 240 , // 682 - shi-latn-ma
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9f , 1 , 684 , 240 , // 683 - shi-tfng
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9f , 1 , 684 , 240 , // 684 - shi-tfng-ma
- 0x5b , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2a , 1 , 686 , 143 , // 685 - si
- 0x45b , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2a , 1 , 686 , 143 , // 686 - si-lk
- 0x1b , 0x4e2 , 0x354 , 0x272d, 0x5190, 0x8f , 1 , 688 , 688 , // 687 - sk
- 0x41b , 0x4e2 , 0x354 , 0x272d, 0x5190, 0x8f , 1 , 688 , 688 , // 688 - sk-sk
- 0x24 , 0x4e2 , 0x354 , 0x272d, 0x5190, 0xd4 , 1 , 690 , 690 , // 689 - sl
- 0x424 , 0x4e2 , 0x354 , 0x272d, 0x5190, 0xd4 , 1 , 690 , 690 , // 690 - sl-si
- 0x783b , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0xdd , 1 , 693 , 693 , // 691 - sma
- 0x183b , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0xb1 , 1 , 692 , 692 , // 692 - sma-no
- 0x1c3b , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0xdd , 1 , 693 , 693 , // 693 - sma-se
- 0x7c3b , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0xdd , 1 , 696 , 696 , // 694 - smj
- 0x103b , 0x4e4 , 0x352 , 0x2710, 0x4f35, 0xb1 , 1 , 695 , 695 , // 695 - smj-no
- 0x143b , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0xdd , 1 , 696 , 696 , // 696 - smj-se
- 0x703b , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0x4d , 1 , 698 , 698 , // 697 - smn
- 0x243b , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0x4d , 1 , 698 , 698 , // 698 - smn-fi
- 0x743b , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0x4d , 1 , 700 , 700 , // 699 - sms
- 0x203b , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0x4d , 1 , 700 , 700 , // 700 - sms-fi
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x108 , 1 , 703 , 240 , // 701 - sn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x108 , 1 , 703 , 240 , // 702 - sn-latn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x108 , 1 , 703 , 240 , // 703 - sn-latn-zw
- 0x77 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd8 , 1 , 708 , 240 , // 704 - so
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x3e , 1 , 705 , 240 , // 705 - so-dj
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x49 , 1 , 706 , 240 , // 706 - so-et
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 707 , 240 , // 707 - so-ke
- 0x477 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd8 , 1 , 708 , 240 , // 708 - so-so
- 0x1c , 0x4e2 , 0x354 , 0x272d, 0x5190, 0x6 , 1 , 710 , 710 , // 709 - sq
- 0x41c , 0x4e2 , 0x354 , 0x272d, 0x5190, 0x6 , 1 , 710 , 710 , // 710 - sq-al
- 0x1000 , 0x4e2 , 0x354 , 0x272d, 0x5190, 0x4ca2, 1 , 711 , 240 , // 711 - sq-mk
- 0x1000 , 0x4e2 , 0x354 , 0x272d, 0x5190, 0x974941, 1 , 712 , 240 , // 712 - sq-xk
- 0x7c1a , 0x4e2 , 0x354 , 0x272d, 0x1f4 , 0x10f , 1 , 724 , 724 , // 713 - sr
- 0x6c1a , 0x4e3 , 0x357 , 0x2717, 0x5221, 0x10f , 1 , 718 , 718 , // 714 - sr-cyrl
- 0x1c1a , 0x4e3 , 0x357 , 0x2717, 0x5221, 0x19 , 1 , 715 , 715 , // 715 - sr-cyrl-ba
- 0xc1a , 0x4e3 , 0x357 , 0x2717, 0x5221, 0x10d , 1 , 716 , 716 , // 716 - sr-cyrl-cs
- 0x301a , 0x4e3 , 0x357 , 0x2717, 0x5221, 0x10e , 1 , 717 , 717 , // 717 - sr-cyrl-me
- 0x281a , 0x4e3 , 0x357 , 0x2717, 0x5221, 0x10f , 1 , 718 , 718 , // 718 - sr-cyrl-rs
- 0x1000 , 0x4e3 , 0x357 , 0x2717, 0x5221, 0x974941, 1 , 719 , 240 , // 719 - sr-cyrl-xk
- 0x701a , 0x4e2 , 0x354 , 0x272d, 0x1f4 , 0x10f , 1 , 724 , 724 , // 720 - sr-latn
- 0x181a , 0x4e2 , 0x354 , 0x2762, 0x366 , 0x19 , 1 , 721 , 721 , // 721 - sr-latn-ba
- 0x81a , 0x4e2 , 0x354 , 0x272d, 0x1f4 , 0x10d , 1 , 722 , 722 , // 722 - sr-latn-cs
- 0x2c1a , 0x4e2 , 0x354 , 0x272d, 0x1f4 , 0x10e , 1 , 723 , 723 , // 723 - sr-latn-me
- 0x241a , 0x4e2 , 0x354 , 0x272d, 0x1f4 , 0x10f , 1 , 724 , 724 , // 724 - sr-latn-rs
- 0x1000 , 0x4e2 , 0x354 , 0x272d, 0x1f4 , 0x974941, 1 , 725 , 240 , // 725 - sr-latn-xk
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd1 , 1 , 728 , 240 , // 726 - ss
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x104 , 1 , 727 , 240 , // 727 - ss-sz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd1 , 1 , 728 , 240 , // 728 - ss-za
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x47 , 1 , 730 , 240 , // 729 - ssy
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x47 , 1 , 730 , 240 , // 730 - ssy-er
- 0x30 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd1 , 1 , 733 , 240 , // 731 - st
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x92 , 1 , 732 , 240 , // 732 - st-ls
- 0x430 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd1 , 1 , 733 , 240 , // 733 - st-za
- 0x1d , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0xdd , 1 , 737 , 737 , // 734 - sv
- 0x1000 , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0x9906f5, 1 , 735 , 240 , // 735 - sv-ax
- 0x81d , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0x4d , 1 , 736 , 736 , // 736 - sv-fi
- 0x41d , 0x4e4 , 0x352 , 0x2710, 0x4f36, 0xdd , 1 , 737 , 737 , // 737 - sv-se
- 0x41 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0x81 , 1 , 740 , 740 , // 738 - sw
- 0x1000 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0x2c , 1 , 739 , 740 , // 739 - sw-cd
- 0x441 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0x81 , 1 , 740 , 740 , // 740 - sw-ke
- 0x1000 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0xef , 1 , 741 , 240 , // 741 - sw-tz
- 0x1000 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0xf0 , 1 , 742 , 240 , // 742 - sw-ug
- 0x1000 , 0x0 , 0x1 , 0x0 , 0x1f4 , 0x2c , 1 , 744 , 240 , // 743 - swc
- 0x1000 , 0x0 , 0x1 , 0x0 , 0x1f4 , 0x2c , 1 , 744 , 240 , // 744 - swc-cd
- 0x5a , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xde , 1 , 746 , 143 , // 745 - syr
- 0x45a , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xde , 1 , 746 , 143 , // 746 - syr-sy
- 0x49 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 748 , 143 , // 747 - ta
- 0x449 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 748 , 143 , // 748 - ta-in
- 0x849 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x2a , 1 , 749 , 143 , // 749 - ta-lk
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xa7 , 1 , 750 , 240 , // 750 - ta-my
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd7 , 1 , 751 , 240 , // 751 - ta-sg
- 0x4a , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 753 , 143 , // 752 - te
- 0x44a , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x71 , 1 , 753 , 143 , // 753 - te-in
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf0 , 1 , 756 , 240 , // 754 - teo
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x81 , 1 , 755 , 240 , // 755 - teo-ke
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf0 , 1 , 756 , 240 , // 756 - teo-ug
- 0x28 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xe4 , 1 , 759 , 759 , // 757 - tg
- 0x7c28 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xe4 , 1 , 759 , 759 , // 758 - tg-cyrl
- 0x428 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xe4 , 1 , 759 , 759 , // 759 - tg-cyrl-tj
- 0x1e , 0x36a , 0x36a , 0x2725, 0x5166, 0xe3 , 1 , 761 , 143 , // 760 - th
- 0x41e , 0x36a , 0x36a , 0x2725, 0x5166, 0xe3 , 1 , 761 , 143 , // 761 - th-th
- 0x73 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x47 , 1 , 763 , 143 , // 762 - ti
- 0x873 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x47 , 1 , 763 , 143 , // 763 - ti-er
- 0x473 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x49 , 1 , 764 , 143 , // 764 - ti-et
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x47 , 1 , 766 , 240 , // 765 - tig
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x47 , 1 , 766 , 240 , // 766 - tig-er
- 0x42 , 0x4e2 , 0x354 , 0x272d, 0x5190, 0xee , 1 , 768 , 768 , // 767 - tk
- 0x442 , 0x4e2 , 0x354 , 0x272d, 0x5190, 0xee , 1 , 768 , 768 , // 768 - tk-tm
- 0x32 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd1 , 1 , 771 , 771 , // 769 - tn
- 0x832 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0x13 , 1 , 770 , 770 , // 770 - tn-bw
- 0x432 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd1 , 1 , 771 , 771 , // 771 - tn-za
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xe7 , 1 , 773 , 240 , // 772 - to
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xe7 , 1 , 773 , 240 , // 773 - to-to
- 0x1f , 0x4e6 , 0x359 , 0x2761, 0x51a9, 0xeb , 1 , 776 , 776 , // 774 - tr
- 0x1000 , 0x4e6 , 0x359 , 0x2761, 0x51a9, 0x3b , 1 , 775 , 240 , // 775 - tr-cy
- 0x41f , 0x4e6 , 0x359 , 0x2761, 0x51a9, 0xeb , 1 , 776 , 776 , // 776 - tr-tr
- 0x31 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd1 , 1 , 778 , 240 , // 777 - ts
- 0x431 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd1 , 1 , 778 , 240 , // 778 - ts-za
- 0x44 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xcb , 1 , 780 , 780 , // 779 - tt
- 0x444 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xcb , 1 , 780 , 780 , // 780 - tt-ru
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xad , 1 , 782 , 240 , // 781 - twq
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xad , 1 , 782 , 240 , // 782 - twq-ne
- 0x5f , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x4 , 1 , 787 , 787 , // 783 - tzm
- 0x1000 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x9f , 1 , 785 , 240 , // 784 - tzm-arab
- 0x45f , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x9f , 1 , 785 , 240 , // 785 - tzm-arab-ma
- 0x7c5f , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x4 , 1 , 787 , 787 , // 786 - tzm-latn
- 0x85f , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0x4 , 1 , 787 , 787 , // 787 - tzm-latn-dz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9f , 1 , 788 , 240 , // 788 - tzm-latn-ma
- 0x785f , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9f , 1 , 790 , 316 , // 789 - tzm-tfng
- 0x105f , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9f , 1 , 790 , 316 , // 790 - tzm-tfng-ma
- 0x80 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x2d , 1 , 792 , 143 , // 791 - ug
- 0x480 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0x2d , 1 , 792 , 143 , // 792 - ug-cn
- 0x22 , 0x4e3 , 0x362 , 0x2721, 0x1f4 , 0xf1 , 1 , 794 , 794 , // 793 - uk
- 0x422 , 0x4e3 , 0x362 , 0x2721, 0x1f4 , 0xf1 , 1 , 794 , 794 , // 794 - uk-ua
- 0x20 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xbe , 1 , 797 , 143 , // 795 - ur
- 0x820 , 0x4e8 , 0x2d0 , 0x2 , 0x1f4 , 0x71 , 2 , 796 , 240 , // 796 - ur-in
- 0x420 , 0x4e8 , 0x2d0 , 0x2714, 0x4fc4, 0xbe , 1 , 797 , 143 , // 797 - ur-pk
- 0x43 , 0x4e6 , 0x359 , 0x272d, 0x1f4 , 0xf7 , 1 , 804 , 804 , // 798 - uz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x3 , 2 , 800 , 240 , // 799 - uz-arab
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x3 , 2 , 800 , 240 , // 800 - uz-arab-af
- 0x7843 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xf7 , 1 , 802 , 802 , // 801 - uz-cyrl
- 0x843 , 0x4e3 , 0x362 , 0x2717, 0x5190, 0xf7 , 1 , 802 , 802 , // 802 - uz-cyrl-uz
- 0x7c43 , 0x4e6 , 0x359 , 0x272d, 0x1f4 , 0xf7 , 1 , 804 , 804 , // 803 - uz-latn
- 0x443 , 0x4e6 , 0x359 , 0x272d, 0x1f4 , 0xf7 , 1 , 804 , 804 , // 804 - uz-latn-uz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x8e , 1 , 809 , 240 , // 805 - vai
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x8e , 1 , 807 , 240 , // 806 - vai-latn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x8e , 1 , 807 , 240 , // 807 - vai-latn-lr
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x8e , 1 , 809 , 240 , // 808 - vai-vaii
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x8e , 1 , 809 , 240 , // 809 - vai-vaii-lr
- 0x33 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd1 , 1 , 811 , 240 , // 810 - ve
- 0x433 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xd1 , 1 , 811 , 240 , // 811 - ve-za
- 0x2a , 0x4ea , 0x4ea , 0x2710, 0x1f4 , 0xfb , 1 , 813 , 143 , // 812 - vi
- 0x42a , 0x4ea , 0x4ea , 0x2710, 0x1f4 , 0xfb , 1 , 813 , 143 , // 813 - vi-vn
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x989e, 1 , 815 , 240 , // 814 - vo
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x989e, 1 , 815 , 240 , // 815 - vo-001
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 817 , 240 , // 816 - vun
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xef , 1 , 817 , 240 , // 817 - vun-tz
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xdf , 1 , 819 , 240 , // 818 - wae
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xdf , 1 , 819 , 240 , // 819 - wae-ch
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x49 , 1 , 821 , 240 , // 820 - wal
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x49 , 1 , 821 , 240 , // 821 - wal-et
- 0x88 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xd2 , 1 , 823 , 823 , // 822 - wo
- 0x488 , 0x4e4 , 0x352 , 0x2710, 0x4f49, 0xd2 , 1 , 823 , 823 , // 823 - wo-sn
- 0x1007f, 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xf4 , 1 , -1 , -1 , // 824 - x-iv_mathan
- 0x34 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd1 , 1 , 826 , 826 , // 825 - xh
- 0x434 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd1 , 1 , 826 , 826 , // 826 - xh-za
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf0 , 1 , 828 , 240 , // 827 - xog
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0xf0 , 1 , 828 , 240 , // 828 - xog-ug
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 830 , 240 , // 829 - yav
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x31 , 1 , 830 , 240 , // 830 - yav-cm
- 0x3d , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x989e, 1 , 832 , 240 , // 831 - yi
- 0x43d , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x989e, 1 , 832 , 240 , // 832 - yi-001
- 0x6a , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xaf , 1 , 835 , 835 , // 833 - yo
- 0x1000 , 0x4e4 , 0x1b5 , 0x2710, 0x1f4 , 0x1c , 1 , 834 , 240 , // 834 - yo-bj
- 0x46a , 0x4e4 , 0x1b5 , 0x2710, 0x25 , 0xaf , 1 , 835 , 835 , // 835 - yo-ng
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x68 , 1 , 837 , 240 , // 836 - yue
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x68 , 1 , 837 , 240 , // 837 - yue-hk
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9f , 1 , 840 , 316 , // 838 - zgh
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9f , 1 , 840 , 316 , // 839 - zgh-tfng
- 0x1000 , 0x0 , 0x1 , 0x2 , 0x1f4 , 0x9f , 1 , 840 , 316 , // 840 - zgh-tfng-ma
- 0x7804 , 0x3a8 , 0x3a8 , 0x2718, 0x1f4 , 0x2d , 1 , 844 , 844 , // 841 - zh
- 0x4 , 0x3a8 , 0x3a8 , 0x0 , 0x1f4 , 0x2d , 1 , 844 , 844 , // 842 - zh-chs
- 0x7c04 , 0x3b6 , 0x3b6 , 0x0 , 0x1f4 , 0x68 , 1 , 851 , 851 , // 843 - zh-cht
- 0x804 , 0x3a8 , 0x3a8 , 0x2718, 0x1f4 , 0x2d , 1 , 844 , 844 , // 844 - zh-cn
- 0x50804, 0x3a8 , 0x3a8 , 0x2718, 0x1f4 , 0x2d , 1 , 844 , 844 , // 845 - zh-cn_phoneb
- 0x20804, 0x3a8 , 0x3a8 , 0x2718, 0x1f4 , 0x2d , 1 , 844 , 844 , // 846 - zh-cn_stroke
- 0x4 , 0x3a8 , 0x3a8 , 0x2718, 0x1f4 , 0x2d , 1 , 844 , 844 , // 847 - zh-hans
- 0x1000 , 0x3a8 , 0x3a8 , 0x2718, 0x1f4 , 0x68 , 1 , 848 , 240 , // 848 - zh-hans-hk
- 0x1000 , 0x3a8 , 0x3a8 , 0x2718, 0x1f4 , 0x97 , 1 , 849 , 240 , // 849 - zh-hans-mo
- 0x7c04 , 0x3b6 , 0x3b6 , 0x2712, 0x1f4 , 0x68 , 1 , 851 , 851 , // 850 - zh-hant
- 0xc04 , 0x3b6 , 0x3b6 , 0x2712, 0x1f4 , 0x68 , 1 , 851 , 851 , // 851 - zh-hk
- 0x40c04, 0x3b6 , 0x3b6 , 0x2712, 0x1f4 , 0x68 , 1 , 851 , 851 , // 852 - zh-hk_radstr
- 0x1404 , 0x3b6 , 0x3b6 , 0x2712, 0x1f4 , 0x97 , 1 , 853 , 853 , // 853 - zh-mo
- 0x41404, 0x3b6 , 0x3b6 , 0x2712, 0x1f4 , 0x97 , 1 , 853 , 853 , // 854 - zh-mo_radstr
- 0x21404, 0x3b6 , 0x3b6 , 0x2712, 0x1f4 , 0x97 , 1 , 853 , 853 , // 855 - zh-mo_stroke
- 0x1004 , 0x3a8 , 0x3a8 , 0x2718, 0x1f4 , 0xd7 , 1 , 856 , 856 , // 856 - zh-sg
- 0x51004, 0x3a8 , 0x3a8 , 0x2718, 0x1f4 , 0xd7 , 1 , 856 , 856 , // 857 - zh-sg_phoneb
- 0x21004, 0x3a8 , 0x3a8 , 0x2718, 0x1f4 , 0xd7 , 1 , 856 , 856 , // 858 - zh-sg_stroke
- 0x404 , 0x3b6 , 0x3b6 , 0x2712, 0x1f4 , 0xed , 1 , 859 , 859 , // 859 - zh-tw
- 0x30404, 0x3b6 , 0x3b6 , 0x2712, 0x1f4 , 0xed , 1 , 859 , 859 , // 860 - zh-tw_pronun
- 0x40404, 0x3b6 , 0x3b6 , 0x2712, 0x1f4 , 0xed , 1 , 859 , 859 , // 861 - zh-tw_radstr
- 0x35 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd1 , 1 , 863 , 863 , // 862 - zu
- 0x435 , 0x4e4 , 0x352 , 0x2710, 0x1f4 , 0xd1 , 1 , 863 , 863 , // 863 - zu-za
- };
-
- // s_lcids list all supported lcids. used to binary search and we use the index of the matched lcid to
- // get the index in s_localeNamesIndices using s_lcidToCultureNameIndices
- private static readonly int[] s_lcids = new int[]
- {
- // Lcid , index - index in c_localeNames
- 0x1 , // 0 - 52
- 0x2 , // 1 - 301
- 0x3 , // 2 - 421
- 0x4 , // 3 - 4139
- 0x5 , // 4 - 502
- 0x6 , // 5 - 523
- 0x7 , // 6 - 544
- 0x8 , // 7 - 664
- 0x9 , // 8 - 676
- 0xa , // 9 - 1214
- 0xb , // 10 - 1423
- 0xc , // 11 - 1451
- 0xd , // 12 - 1825
- 0xe , // 13 - 1860
- 0xf , // 14 - 1929
- 0x10 , // 15 - 1936
- 0x11 , // 16 - 1989
- 0x12 , // 17 - 2179
- 0x13 , // 18 - 2685
- 0x14 , // 19 - 2747
- 0x15 , // 20 - 2864
- 0x16 , // 21 - 2897
- 0x17 , // 22 - 3041
- 0x18 , // 23 - 3055
- 0x19 , // 24 - 3076
- 0x1a , // 25 - 1839
- 0x1b , // 26 - 3284
- 0x1c , // 27 - 3387
- 0x1d , // 28 - 3553
- 0x1e , // 29 - 3673
- 0x1f , // 30 - 3727
- 0x20 , // 31 - 3847
- 0x21 , // 32 - 1908
- 0x22 , // 33 - 3840
- 0x23 , // 34 - 276
- 0x24 , // 35 - 3291
- 0x25 , // 36 - 1354
- 0x26 , // 37 - 2429
- 0x27 , // 38 - 2397
- 0x28 , // 39 - 3654
- 0x29 , // 40 - 1377
- 0x2a , // 41 - 3960
- 0x2b , // 42 - 1879
- 0x2c , // 43 - 224
- 0x2d , // 44 - 1361
- 0x2e , // 45 - 1851
- 0x2f , // 46 - 2501
- 0x30 , // 47 - 3541
- 0x31 , // 48 - 3739
- 0x32 , // 49 - 3708
- 0x33 , // 50 - 3953
- 0x34 , // 51 - 4020
- 0x35 , // 52 - 4277
- 0x36 , // 53 - 17
- 0x37 , // 54 - 2062
- 0x38 , // 55 - 1439
- 0x39 , // 56 - 1832
- 0x3a , // 57 - 2598
- 0x3b , // 58 - 3194
- 0x3c , // 59 - 1705
- 0x3d , // 60 - 4045
- 0x3e , // 61 - 2581
- 0x3f , // 62 - 2133
- 0x40 , // 63 - 2306
- 0x41 , // 64 - 3570
- 0x42 , // 65 - 3701
- 0x43 , // 66 - 3859
- 0x44 , // 67 - 3746
- 0x45 , // 68 - 336
- 0x46 , // 69 - 2830
- 0x47 , // 70 - 1754
- 0x48 , // 71 - 2811
- 0x49 , // 72 - 3610
- 0x4a , // 73 - 3632
- 0x4b , // 74 - 2172
- 0x4c , // 75 - 2508
- 0x4d , // 76 - 199
- 0x4e , // 77 - 2574
- 0x4f , // 78 - 3124
- 0x50 , // 79 - 2515
- 0x51 , // 80 - 348
- 0x52 , // 81 - 516
- 0x53 , // 82 - 2165
- 0x54 , // 83 - 2375
- 0x55 , // 84 - 2614
- 0x56 , // 85 - 1719
- 0x57 , // 86 - 2191
- 0x58 , // 87 - 2556
- 0x59 , // 88 - 3158
- 0x5a , // 89 - 3601
- 0x5b , // 90 - 3277
- 0x5c , // 91 - 473
- 0x5d , // 92 - 1953
- 0x5e , // 93 - 45
- 0x5f , // 94 - 3762
- 0x60 , // 95 - 2207
- 0x61 , // 96 - 2673
- 0x62 , // 97 - 1698
- 0x63 , // 98 - 2890
- 0x64 , // 99 - 1430
- 0x65 , // 100 - 620
- 0x66 , // 101 - 308
- 0x67 , // 102 - 1384
- 0x68 , // 103 - 1777
- 0x69 , // 104 - 1899
- 0x6a , // 105 - 4053
- 0x6b , // 106 - 3020
- 0x6c , // 107 - 2765
- 0x6d , // 108 - 260
- 0x6e , // 109 - 2330
- 0x6f , // 110 - 2149
- 0x70 , // 111 - 1915
- 0x71 , // 112 - 2200
- 0x72 , // 113 - 2799
- 0x73 , // 114 - 3680
- 0x74 , // 115 - 1726
- 0x75 , // 116 - 1816
- 0x76 , // 117 - 2313
- 0x77 , // 118 - 3365
- 0x78 , // 119 - 1922
- 0x79 , // 120 - 2854
- 0x7a , // 121 - 190
- 0x7c , // 122 - 2565
- 0x7e , // 123 - 360
- 0x80 , // 124 - 3833
- 0x81 , // 125 - 2494
- 0x82 , // 126 - 2792
- 0x83 , // 127 - 495
- 0x84 , // 128 - 1733
- 0x85 , // 129 - 3131
- 0x86 , // 130 - 2998
- 0x87 , // 131 - 3108
- 0x88 , // 132 - 4002
- 0x8c , // 133 - 2881
- 0x91 , // 134 - 1712
- 0x92 , // 135 - 2270
- 0x401 , // 136 - 150
- 0x402 , // 137 - 303
- 0x403 , // 138 - 428
- 0x404 , // 139 - 4248
- 0x405 , // 140 - 504
- 0x406 , // 141 - 525
- 0x407 , // 142 - 561
- 0x408 , // 143 - 671
- 0x409 , // 144 - 1161
- 0x40a , // 145 - 1272
- 0x40b , // 146 - 1425
- 0x40c , // 147 - 1529
- 0x40d , // 148 - 1827
- 0x40e , // 149 - 1862
- 0x40f , // 150 - 1931
- 0x410 , // 151 - 1943
- 0x411 , // 152 - 1991
- 0x412 , // 153 - 2186
- 0x413 , // 154 - 2707
- 0x414 , // 155 - 2641
- 0x415 , // 156 - 2866
- 0x416 , // 157 - 2904
- 0x417 , // 158 - 3043
- 0x418 , // 159 - 3062
- 0x419 , // 160 - 3098
- 0x41a , // 161 - 1846
- 0x41b , // 162 - 3286
- 0x41c , // 163 - 3389
- 0x41d , // 164 - 3565
- 0x41e , // 165 - 3675
- 0x41f , // 166 - 3734
- 0x420 , // 167 - 3854
- 0x421 , // 168 - 1910
- 0x422 , // 169 - 3842
- 0x423 , // 170 - 278
- 0x424 , // 171 - 3293
- 0x425 , // 172 - 1356
- 0x426 , // 173 - 2431
- 0x427 , // 174 - 2399
- 0x428 , // 175 - 3663
- 0x429 , // 176 - 1379
- 0x42a , // 177 - 3962
- 0x42b , // 178 - 1881
- 0x42c , // 179 - 250
- 0x42d , // 180 - 1363
- 0x42e , // 181 - 1854
- 0x42f , // 182 - 2503
- 0x430 , // 183 - 3548
- 0x431 , // 184 - 3741
- 0x432 , // 185 - 3715
- 0x433 , // 186 - 3955
- 0x434 , // 187 - 4022
- 0x435 , // 188 - 4279
- 0x436 , // 189 - 24
- 0x437 , // 190 - 2064
- 0x438 , // 191 - 1446
- 0x439 , // 192 - 1834
- 0x43a , // 193 - 2600
- 0x43b , // 194 - 3201
- 0x43d , // 195 - 4047
- 0x43e , // 196 - 2588
- 0x43f , // 197 - 2135
- 0x440 , // 198 - 2308
- 0x441 , // 199 - 3577
- 0x442 , // 200 - 3703
- 0x443 , // 201 - 3902
- 0x444 , // 202 - 3748
- 0x445 , // 203 - 343
- 0x446 , // 204 - 2849
- 0x447 , // 205 - 1756
- 0x448 , // 206 - 2813
- 0x449 , // 207 - 3612
- 0x44a , // 208 - 3634
- 0x44b , // 209 - 2174
- 0x44c , // 210 - 2510
- 0x44d , // 211 - 201
- 0x44e , // 212 - 2576
- 0x44f , // 213 - 3126
- 0x450 , // 214 - 2524
- 0x451 , // 215 - 350
- 0x452 , // 216 - 518
- 0x453 , // 217 - 2167
- 0x454 , // 218 - 2377
- 0x455 , // 219 - 2616
- 0x456 , // 220 - 1721
- 0x457 , // 221 - 2194
- 0x458 , // 222 - 2559
- 0x459 , // 223 - 3184
- 0x45a , // 224 - 3604
- 0x45b , // 225 - 3279
- 0x45c , // 226 - 484
- 0x45d , // 227 - 1962
- 0x45e , // 228 - 47
- 0x45f , // 229 - 3773
- 0x460 , // 230 - 2209
- 0x461 , // 231 - 2680
- 0x462 , // 232 - 1700
- 0x463 , // 233 - 2892
- 0x464 , // 234 - 1433
- 0x465 , // 235 - 622
- 0x466 , // 236 - 311
- 0x467 , // 237 - 1418
- 0x468 , // 238 - 1806
- 0x469 , // 239 - 1902
- 0x46a , // 240 - 4060
- 0x46b , // 241 - 3023
- 0x46c , // 242 - 2768
- 0x46d , // 243 - 262
- 0x46e , // 244 - 2332
- 0x46f , // 245 - 2151
- 0x470 , // 246 - 1917
- 0x471 , // 247 - 2202
- 0x472 , // 248 - 2801
- 0x473 , // 249 - 3687
- 0x474 , // 250 - 1728
- 0x475 , // 251 - 1819
- 0x476 , // 252 - 2315
- 0x477 , // 253 - 3382
- 0x478 , // 254 - 1924
- 0x479 , // 255 - 2857
- 0x47a , // 256 - 193
- 0x47c , // 257 - 2568
- 0x47e , // 258 - 362
- 0x480 , // 259 - 3835
- 0x481 , // 260 - 2496
- 0x482 , // 261 - 2794
- 0x483 , // 262 - 497
- 0x484 , // 263 - 1742
- 0x485 , // 264 - 3134
- 0x486 , // 265 - 3009
- 0x487 , // 266 - 3110
- 0x488 , // 267 - 4004
- 0x48c , // 268 - 2884
- 0x491 , // 269 - 1714
- 0x492 , // 270 - 2279
- 0x501 , // 271 - 2972
- 0x5fe , // 272 - 2980
- 0x801 , // 273 - 95
- 0x803 , // 274 - 433
- 0x804 , // 275 - 4110
- 0x807 , // 276 - 556
- 0x809 , // 277 - 831
- 0x80a , // 278 - 1299
- 0x80c , // 279 - 1459
- 0x810 , // 280 - 1938
- 0x813 , // 281 - 2692
- 0x814 , // 282 - 2733
- 0x816 , // 283 - 2944
- 0x818 , // 284 - 3057
- 0x819 , // 285 - 3093
- 0x81a , // 286 - 3480
- 0x81d , // 287 - 3560
- 0x820 , // 288 - 3849
- 0x82c , // 289 - 233
- 0x82e , // 290 - 605
- 0x832 , // 291 - 3710
- 0x83b , // 292 - 3206
- 0x83c , // 293 - 1707
- 0x83e , // 294 - 2583
- 0x843 , // 295 - 3885
- 0x845 , // 296 - 338
- 0x846 , // 297 - 2839
- 0x849 , // 298 - 3617
- 0x850 , // 299 - 2536
- 0x859 , // 300 - 3167
- 0x85d , // 301 - 1979
- 0x85f , // 302 - 3792
- 0x860 , // 303 - 2233
- 0x861 , // 304 - 2675
- 0x867 , // 305 - 1403
- 0x86b , // 306 - 3029
- 0x873 , // 307 - 3682
- 0x901 , // 308 - 2959
- 0x9ff , // 309 - 2989
- 0xc01 , // 310 - 80
- 0xc04 , // 311 - 4173
- 0xc07 , // 312 - 546
- 0xc09 , // 313 - 716
- 0xc0a , // 314 - 1267
- 0xc0c , // 315 - 1484
- 0xc1a , // 316 - 3423
- 0xc3b , // 317 - 3196
- 0xc50 , // 318 - 2546
- 0xc51 , // 319 - 638
- 0xc6b , // 320 - 3035
- 0x1001 , // 321 - 120
- 0x1004 , // 322 - 4219
- 0x1007 , // 323 - 588
- 0x1009 , // 324 - 756
- 0x100a , // 325 - 1289
- 0x100c , // 326 - 1504
- 0x101a , // 327 - 1841
- 0x103b , // 328 - 3316
- 0x105f , // 329 - 3822
- 0x1401 , // 330 - 75
- 0x1404 , // 331 - 4190
- 0x1407 , // 332 - 583
- 0x1409 , // 333 - 1026
- 0x140a , // 334 - 1247
- 0x140c , // 335 - 1569
- 0x141a , // 336 - 402
- 0x143b , // 337 - 3322
- 0x1801 , // 338 - 125
- 0x1809 , // 339 - 881
- 0x180a , // 340 - 1309
- 0x180c , // 341 - 1579
- 0x181a , // 342 - 3470
- 0x183b , // 343 - 3301
- 0x1c01 , // 344 - 180
- 0x1c09 , // 345 - 1191
- 0x1c0a , // 346 - 1257
- 0x1c0c , // 347 - 1453
- 0x1c1a , // 348 - 3413
- 0x1c3b , // 349 - 3307
- 0x2001 , // 350 - 135
- 0x2009 , // 351 - 911
- 0x200a , // 352 - 1349
- 0x200c , // 353 - 1634
- 0x201a , // 354 - 385
- 0x203b , // 355 - 3340
- 0x2401 , // 356 - 185
- 0x2409 , // 357 - 684
- 0x240a , // 358 - 1242
- 0x240c , // 359 - 1489
- 0x241a , // 360 - 3500
- 0x243b , // 361 - 3331
- 0x2801 , // 362 - 170
- 0x2809 , // 363 - 751
- 0x280a , // 364 - 1314
- 0x280c , // 365 - 1649
- 0x281a , // 366 - 3443
- 0x2c01 , // 367 - 100
- 0x2c09 , // 368 - 1136
- 0x2c0a , // 369 - 1222
- 0x2c0c , // 370 - 1514
- 0x2c1a , // 371 - 3490
- 0x3001 , // 372 - 115
- 0x3009 , // 373 - 1201
- 0x300a , // 374 - 1262
- 0x300c , // 375 - 1509
- 0x301a , // 376 - 3433
- 0x3401 , // 377 - 110
- 0x3409 , // 378 - 1036
- 0x340a , // 379 - 1237
- 0x340c , // 380 - 1594
- 0x3801 , // 381 - 60
- 0x3809 , // 382 - 876
- 0x380a , // 383 - 1344
- 0x380c , // 384 - 1574
- 0x3c01 , // 385 - 65
- 0x3c09 , // 386 - 871
- 0x3c0a , // 387 - 1329
- 0x3c0c , // 388 - 1559
- 0x4001 , // 389 - 145
- 0x4009 , // 390 - 896
- 0x400a , // 391 - 1227
- 0x4409 , // 392 - 991
- 0x440a , // 393 - 1334
- 0x4809 , // 394 - 1086
- 0x480a , // 395 - 1294
- 0x4c0a , // 396 - 1304
- 0x500a , // 397 - 1324
- 0x540a , // 398 - 1339
- 0x580a , // 399 - 1216
- 0x5c0a , // 400 - 1252
- 0x641a , // 401 - 378
- 0x681a , // 402 - 395
- 0x6c1a , // 403 - 3406
- 0x701a , // 404 - 3463
- 0x703b , // 405 - 3328
- 0x742c , // 406 - 226
- 0x743b , // 407 - 3337
- 0x7804 , // 408 - 4096
- 0x7814 , // 409 - 2731
- 0x781a , // 410 - 376
- 0x782c , // 411 - 243
- 0x783b , // 412 - 3298
- 0x7843 , // 413 - 3878
- 0x7850 , // 414 - 2517
- 0x785d , // 415 - 1955
- 0x785f , // 416 - 3814
- 0x7c04 , // 417 - 4166
- 0x7c14 , // 418 - 2639
- 0x7c1a , // 419 - 3404
- 0x7c28 , // 420 - 3656
- 0x7c2e , // 421 - 602
- 0x7c3b , // 422 - 3313
- 0x7c43 , // 423 - 3895
- 0x7c46 , // 424 - 2832
- 0x7c50 , // 425 - 2529
- 0x7c59 , // 426 - 3160
- 0x7c5c , // 427 - 476
- 0x7c5d , // 428 - 1972
- 0x7c5f , // 429 - 3784
- 0x7c67 , // 430 - 1396
- 0x7c68 , // 431 - 1779
- 0x7c86 , // 432 - 3001
- 0x7c92 , // 433 - 2272
- 0x1007f, // 434 - 4009
- 0x10407, // 435 - 566
- 0x1040e, // 436 - 1867
- 0x10437, // 437 - 2069
- 0x20804, // 438 - 4127
- 0x21004, // 439 - 4236
- 0x21404, // 440 - 4207
- 0x30404, // 441 - 4253
- 0x40404, // 442 - 4265
- 0x40411, // 443 - 1996
- 0x40c04, // 444 - 4178
- 0x41404, // 445 - 4195
- 0x50804, // 446 - 4115
- 0x51004 // 447 - 4224
- };
- // each element in s_lcidToCultureNameIndices is index to s_localeNamesIndices
- private static readonly int[] s_lcidToCultureNameIndices = new int[]
- {
- // Index to s_localeNamesIndices, index to this array - lcid - index to the c_localeNames
- 13 , // 0 - 1 - 52
- 64 , // 1 - 2 - 301
- 88 , // 2 - 3 - 421
- 847 , // 3 - 4 - 4139
- 103 , // 4 - 5 - 502
- 109 , // 5 - 6 - 523
- 114 , // 6 - 7 - 544
- 140 , // 7 - 8 - 664
- 143 , // 8 - 9 - 676
- 251 , // 9 - a - 1214
- 293 , // 10 - b - 1423
- 300 , // 11 - c - 1451
- 377 , // 12 - d - 1825
- 386 , // 13 - e - 1860
- 402 , // 14 - f - 1929
- 404 , // 15 - 10 - 1936
- 413 , // 16 - 11 - 1989
- 452 , // 17 - 12 - 2179
- 564 , // 18 - 13 - 2685
- 578 , // 19 - 14 - 2747
- 605 , // 20 - 15 - 2864
- 613 , // 21 - 16 - 2897
- 637 , // 22 - 17 - 3041
- 641 , // 23 - 18 - 3055
- 646 , // 24 - 19 - 3076
- 381 , // 25 - 1a - 1839
- 687 , // 26 - 1b - 3284
- 709 , // 27 - 1c - 3387
- 734 , // 28 - 1d - 3553
- 760 , // 29 - 1e - 3673
- 774 , // 30 - 1f - 3727
- 795 , // 31 - 20 - 3847
- 396 , // 32 - 21 - 1908
- 793 , // 33 - 22 - 3840
- 58 , // 34 - 23 - 276
- 689 , // 35 - 24 - 3291
- 278 , // 36 - 25 - 1354
- 506 , // 37 - 26 - 2429
- 498 , // 38 - 27 - 2397
- 757 , // 39 - 28 - 3654
- 284 , // 40 - 29 - 1377
- 812 , // 41 - 2a - 3960
- 389 , // 42 - 2b - 1879
- 49 , // 43 - 2c - 224
- 280 , // 44 - 2d - 1361
- 384 , // 45 - 2e - 1851
- 523 , // 46 - 2f - 2501
- 731 , // 47 - 30 - 3541
- 777 , // 48 - 31 - 3739
- 769 , // 49 - 32 - 3708
- 810 , // 50 - 33 - 3953
- 825 , // 51 - 34 - 4020
- 862 , // 52 - 35 - 4277
- 4 , // 53 - 36 - 17
- 425 , // 54 - 37 - 2062
- 297 , // 55 - 38 - 1439
- 379 , // 56 - 39 - 1832
- 543 , // 57 - 3a - 2598
- 670 , // 58 - 3b - 3194
- 352 , // 59 - 3c - 1705
- 831 , // 60 - 3d - 4045
- 539 , // 61 - 3e - 2581
- 440 , // 62 - 3f - 2133
- 476 , // 63 - 40 - 2306
- 738 , // 64 - 41 - 3570
- 767 , // 65 - 42 - 3701
- 798 , // 66 - 43 - 3859
- 779 , // 67 - 44 - 3746
- 71 , // 68 - 45 - 336
- 599 , // 69 - 46 - 2830
- 364 , // 70 - 47 - 1754
- 594 , // 71 - 48 - 2811
- 747 , // 72 - 49 - 3610
- 752 , // 73 - 4a - 3632
- 450 , // 74 - 4b - 2172
- 525 , // 75 - 4c - 2508
- 43 , // 76 - 4d - 199
- 537 , // 77 - 4e - 2574
- 657 , // 78 - 4f - 3124
- 527 , // 79 - 50 - 2515
- 74 , // 80 - 51 - 348
- 107 , // 81 - 52 - 516
- 448 , // 82 - 53 - 2165
- 493 , // 83 - 54 - 2375
- 547 , // 84 - 55 - 2614
- 356 , // 85 - 56 - 1719
- 455 , // 86 - 57 - 2191
- 533 , // 87 - 58 - 2556
- 665 , // 88 - 59 - 3158
- 745 , // 89 - 5a - 3601
- 685 , // 90 - 5b - 3277
- 98 , // 91 - 5c - 473
- 408 , // 92 - 5d - 1953
- 11 , // 93 - 5e - 45
- 783 , // 94 - 5f - 3762
- 459 , // 95 - 60 - 2207
- 561 , // 96 - 61 - 2673
- 350 , // 97 - 62 - 1698
- 611 , // 98 - 63 - 2890
- 295 , // 99 - 64 - 1430
- 129 , // 100 - 65 - 620
- 66 , // 101 - 66 - 308
- 286 , // 102 - 67 - 1384
- 370 , // 103 - 68 - 1777
- 394 , // 104 - 69 - 1899
- 833 , // 105 - 6a - 4053
- 633 , // 106 - 6b - 3020
- 583 , // 107 - 6c - 2765
- 54 , // 108 - 6d - 260
- 482 , // 109 - 6e - 2330
- 444 , // 110 - 6f - 2149
- 398 , // 111 - 70 - 1915
- 457 , // 112 - 71 - 2200
- 591 , // 113 - 72 - 2799
- 762 , // 114 - 73 - 3680
- 358 , // 115 - 74 - 1726
- 375 , // 116 - 75 - 1816
- 478 , // 117 - 76 - 2313
- 704 , // 118 - 77 - 3365
- 400 , // 119 - 78 - 1922
- 603 , // 120 - 79 - 2854
- 41 , // 121 - 7a - 190
- 535 , // 122 - 7c - 2565
- 77 , // 123 - 7e - 360
- 791 , // 124 - 80 - 3833
- 521 , // 125 - 81 - 2494
- 589 , // 126 - 82 - 2792
- 101 , // 127 - 83 - 495
- 360 , // 128 - 84 - 1733
- 659 , // 129 - 85 - 3131
- 630 , // 130 - 86 - 2998
- 653 , // 131 - 87 - 3108
- 822 , // 132 - 88 - 4002
- 609 , // 133 - 8c - 2881
- 354 , // 134 - 91 - 1712
- 470 , // 135 - 92 - 2270
- 33 , // 136 - 401 - 150
- 65 , // 137 - 402 - 303
- 90 , // 138 - 403 - 428
- 859 , // 139 - 404 - 4248
- 104 , // 140 - 405 - 504
- 110 , // 141 - 406 - 525
- 118 , // 142 - 407 - 561
- 142 , // 143 - 408 - 671
- 240 , // 144 - 409 - 1161
- 263 , // 145 - 40a - 1272
- 294 , // 146 - 40b - 1425
- 316 , // 147 - 40c - 1529
- 378 , // 148 - 40d - 1827
- 387 , // 149 - 40e - 1862
- 403 , // 150 - 40f - 1931
- 406 , // 151 - 410 - 1943
- 414 , // 152 - 411 - 1991
- 454 , // 153 - 412 - 2186
- 569 , // 154 - 413 - 2707
- 554 , // 155 - 414 - 2641
- 606 , // 156 - 415 - 2866
- 615 , // 157 - 416 - 2904
- 638 , // 158 - 417 - 3043
- 643 , // 159 - 418 - 3062
- 651 , // 160 - 419 - 3098
- 383 , // 161 - 41a - 1846
- 688 , // 162 - 41b - 3286
- 710 , // 163 - 41c - 3389
- 737 , // 164 - 41d - 3565
- 761 , // 165 - 41e - 3675
- 776 , // 166 - 41f - 3734
- 797 , // 167 - 420 - 3854
- 397 , // 168 - 421 - 1910
- 794 , // 169 - 422 - 3842
- 59 , // 170 - 423 - 278
- 690 , // 171 - 424 - 3293
- 279 , // 172 - 425 - 1356
- 507 , // 173 - 426 - 2431
- 499 , // 174 - 427 - 2399
- 759 , // 175 - 428 - 3663
- 285 , // 176 - 429 - 1379
- 813 , // 177 - 42a - 3962
- 390 , // 178 - 42b - 1881
- 53 , // 179 - 42c - 250
- 281 , // 180 - 42d - 1363
- 385 , // 181 - 42e - 1854
- 524 , // 182 - 42f - 2503
- 733 , // 183 - 430 - 3548
- 778 , // 184 - 431 - 3741
- 771 , // 185 - 432 - 3715
- 811 , // 186 - 433 - 3955
- 826 , // 187 - 434 - 4022
- 863 , // 188 - 435 - 4279
- 6 , // 189 - 436 - 24
- 426 , // 190 - 437 - 2064
- 299 , // 191 - 438 - 1446
- 380 , // 192 - 439 - 1834
- 544 , // 193 - 43a - 2600
- 672 , // 194 - 43b - 3201
- 832 , // 195 - 43d - 4047
- 541 , // 196 - 43e - 2588
- 441 , // 197 - 43f - 2135
- 477 , // 198 - 440 - 2308
- 740 , // 199 - 441 - 3577
- 768 , // 200 - 442 - 3703
- 804 , // 201 - 443 - 3902
- 780 , // 202 - 444 - 3748
- 73 , // 203 - 445 - 343
- 602 , // 204 - 446 - 2849
- 365 , // 205 - 447 - 1756
- 595 , // 206 - 448 - 2813
- 748 , // 207 - 449 - 3612
- 753 , // 208 - 44a - 3634
- 451 , // 209 - 44b - 2174
- 526 , // 210 - 44c - 2510
- 44 , // 211 - 44d - 201
- 538 , // 212 - 44e - 2576
- 658 , // 213 - 44f - 3126
- 529 , // 214 - 450 - 2524
- 75 , // 215 - 451 - 350
- 108 , // 216 - 452 - 518
- 449 , // 217 - 453 - 2167
- 494 , // 218 - 454 - 2377
- 548 , // 219 - 455 - 2616
- 357 , // 220 - 456 - 1721
- 456 , // 221 - 457 - 2194
- 534 , // 222 - 458 - 2559
- 669 , // 223 - 459 - 3184
- 746 , // 224 - 45a - 3604
- 686 , // 225 - 45b - 3279
- 100 , // 226 - 45c - 484
- 410 , // 227 - 45d - 1962
- 12 , // 228 - 45e - 47
- 785 , // 229 - 45f - 3773
- 460 , // 230 - 460 - 2209
- 563 , // 231 - 461 - 2680
- 351 , // 232 - 462 - 1700
- 612 , // 233 - 463 - 2892
- 296 , // 234 - 464 - 1433
- 130 , // 235 - 465 - 622
- 67 , // 236 - 466 - 311
- 292 , // 237 - 467 - 1418
- 374 , // 238 - 468 - 1806
- 395 , // 239 - 469 - 1902
- 835 , // 240 - 46a - 4060
- 634 , // 241 - 46b - 3023
- 584 , // 242 - 46c - 2768
- 55 , // 243 - 46d - 262
- 483 , // 244 - 46e - 2332
- 445 , // 245 - 46f - 2151
- 399 , // 246 - 470 - 1917
- 458 , // 247 - 471 - 2202
- 592 , // 248 - 472 - 2801
- 764 , // 249 - 473 - 3687
- 359 , // 250 - 474 - 1728
- 376 , // 251 - 475 - 1819
- 479 , // 252 - 476 - 2315
- 708 , // 253 - 477 - 3382
- 401 , // 254 - 478 - 1924
- 604 , // 255 - 479 - 2857
- 42 , // 256 - 47a - 193
- 536 , // 257 - 47c - 2568
- 78 , // 258 - 47e - 362
- 792 , // 259 - 480 - 3835
- 522 , // 260 - 481 - 2496
- 590 , // 261 - 482 - 2794
- 102 , // 262 - 483 - 497
- 362 , // 263 - 484 - 1742
- 660 , // 264 - 485 - 3134
- 632 , // 265 - 486 - 3009
- 654 , // 266 - 487 - 3110
- 823 , // 267 - 488 - 4004
- 610 , // 268 - 48c - 2884
- 355 , // 269 - 491 - 1714
- 472 , // 270 - 492 - 2279
- 627 , // 271 - 501 - 2972
- 628 , // 272 - 5fe - 2980
- 22 , // 273 - 801 - 95
- 91 , // 274 - 803 - 433
- 844 , // 275 - 804 - 4110
- 117 , // 276 - 807 - 556
- 174 , // 277 - 809 - 831
- 267 , // 278 - 80a - 1299
- 302 , // 279 - 80c - 1459
- 405 , // 280 - 810 - 1938
- 566 , // 281 - 813 - 2692
- 575 , // 282 - 814 - 2733
- 623 , // 283 - 816 - 2944
- 642 , // 284 - 818 - 3057
- 650 , // 285 - 819 - 3093
- 722 , // 286 - 81a - 3480
- 736 , // 287 - 81d - 3560
- 796 , // 288 - 820 - 3849
- 51 , // 289 - 82c - 233
- 126 , // 290 - 82e - 605
- 770 , // 291 - 832 - 3710
- 673 , // 292 - 83b - 3206
- 353 , // 293 - 83c - 1707
- 540 , // 294 - 83e - 2583
- 802 , // 295 - 843 - 3885
- 72 , // 296 - 845 - 338
- 601 , // 297 - 846 - 2839
- 749 , // 298 - 849 - 3617
- 531 , // 299 - 850 - 2536
- 667 , // 300 - 859 - 3167
- 412 , // 301 - 85d - 1979
- 787 , // 302 - 85f - 3792
- 463 , // 303 - 860 - 2233
- 562 , // 304 - 861 - 2675
- 290 , // 305 - 867 - 1403
- 635 , // 306 - 86b - 3029
- 763 , // 307 - 873 - 3682
- 626 , // 308 - 901 - 2959
- 629 , // 309 - 9ff - 2989
- 19 , // 310 - c01 - 80
- 851 , // 311 - c04 - 4173
- 115 , // 312 - c07 - 546
- 151 , // 313 - c09 - 716
- 262 , // 314 - c0a - 1267
- 307 , // 315 - c0c - 1484
- 716 , // 316 - c1a - 3423
- 671 , // 317 - c3b - 3196
- 532 , // 318 - c50 - 2546
- 134 , // 319 - c51 - 638
- 636 , // 320 - c6b - 3035
- 27 , // 321 - 1001 - 120
- 856 , // 322 - 1004 - 4219
- 122 , // 323 - 1007 - 588
- 159 , // 324 - 1009 - 756
- 265 , // 325 - 100a - 1289
- 311 , // 326 - 100c - 1504
- 382 , // 327 - 101a - 1841
- 695 , // 328 - 103b - 3316
- 790 , // 329 - 105f - 3822
- 18 , // 330 - 1401 - 75
- 853 , // 331 - 1404 - 4190
- 121 , // 332 - 1407 - 583
- 213 , // 333 - 1409 - 1026
- 258 , // 334 - 140a - 1247
- 324 , // 335 - 140c - 1569
- 85 , // 336 - 141a - 402
- 696 , // 337 - 143b - 3322
- 28 , // 338 - 1801 - 125
- 184 , // 339 - 1809 - 881
- 269 , // 340 - 180a - 1309
- 326 , // 341 - 180c - 1579
- 721 , // 342 - 181a - 3470
- 692 , // 343 - 183b - 3301
- 39 , // 344 - 1c01 - 180
- 246 , // 345 - 1c09 - 1191
- 260 , // 346 - 1c0a - 1257
- 301 , // 347 - 1c0c - 1453
- 715 , // 348 - 1c1a - 3413
- 693 , // 349 - 1c3b - 3307
- 30 , // 350 - 2001 - 135
- 190 , // 351 - 2009 - 911
- 277 , // 352 - 200a - 1349
- 337 , // 353 - 200c - 1634
- 83 , // 354 - 201a - 385
- 700 , // 355 - 203b - 3340
- 40 , // 356 - 2401 - 185
- 145 , // 357 - 2409 - 684
- 257 , // 358 - 240a - 1242
- 308 , // 359 - 240c - 1489
- 724 , // 360 - 241a - 3500
- 698 , // 361 - 243b - 3331
- 37 , // 362 - 2801 - 170
- 158 , // 363 - 2809 - 751
- 270 , // 364 - 280a - 1314
- 340 , // 365 - 280c - 1649
- 718 , // 366 - 281a - 3443
- 23 , // 367 - 2c01 - 100
- 235 , // 368 - 2c09 - 1136
- 253 , // 369 - 2c0a - 1222
- 313 , // 370 - 2c0c - 1514
- 723 , // 371 - 2c1a - 3490
- 26 , // 372 - 3001 - 115
- 248 , // 373 - 3009 - 1201
- 261 , // 374 - 300a - 1262
- 312 , // 375 - 300c - 1509
- 717 , // 376 - 301a - 3433
- 25 , // 377 - 3401 - 110
- 215 , // 378 - 3409 - 1036
- 256 , // 379 - 340a - 1237
- 329 , // 380 - 340c - 1594
- 15 , // 381 - 3801 - 60
- 183 , // 382 - 3809 - 876
- 276 , // 383 - 380a - 1344
- 325 , // 384 - 380c - 1574
- 16 , // 385 - 3c01 - 65
- 182 , // 386 - 3c09 - 871
- 273 , // 387 - 3c0a - 1329
- 322 , // 388 - 3c0c - 1559
- 32 , // 389 - 4001 - 145
- 187 , // 390 - 4009 - 896
- 254 , // 391 - 400a - 1227
- 206 , // 392 - 4409 - 991
- 274 , // 393 - 440a - 1334
- 225 , // 394 - 4809 - 1086
- 266 , // 395 - 480a - 1294
- 268 , // 396 - 4c0a - 1304
- 272 , // 397 - 500a - 1324
- 275 , // 398 - 540a - 1339
- 252 , // 399 - 580a - 1216
- 259 , // 400 - 5c0a - 1252
- 82 , // 401 - 641a - 378
- 84 , // 402 - 681a - 395
- 714 , // 403 - 6c1a - 3406
- 720 , // 404 - 701a - 3463
- 697 , // 405 - 703b - 3328
- 50 , // 406 - 742c - 226
- 699 , // 407 - 743b - 3337
- 841 , // 408 - 7804 - 4096
- 574 , // 409 - 7814 - 2731
- 81 , // 410 - 781a - 376
- 52 , // 411 - 782c - 243
- 691 , // 412 - 783b - 3298
- 801 , // 413 - 7843 - 3878
- 528 , // 414 - 7850 - 2517
- 409 , // 415 - 785d - 1955
- 789 , // 416 - 785f - 3814
- 850 , // 417 - 7c04 - 4166
- 553 , // 418 - 7c14 - 2639
- 713 , // 419 - 7c1a - 3404
- 758 , // 420 - 7c28 - 3656
- 125 , // 421 - 7c2e - 602
- 694 , // 422 - 7c3b - 3313
- 803 , // 423 - 7c43 - 3895
- 600 , // 424 - 7c46 - 2832
- 530 , // 425 - 7c50 - 2529
- 666 , // 426 - 7c59 - 3160
- 99 , // 427 - 7c5c - 476
- 411 , // 428 - 7c5d - 1972
- 786 , // 429 - 7c5f - 3784
- 289 , // 430 - 7c67 - 1396
- 371 , // 431 - 7c68 - 1779
- 631 , // 432 - 7c86 - 3001
- 471 , // 433 - 7c92 - 2272
- 824 , // 434 - 1007f - 4009
- 119 , // 435 - 10407 - 566
- 388 , // 436 - 1040e - 1867
- 427 , // 437 - 10437 - 2069
- 846 , // 438 - 20804 - 4127
- 858 , // 439 - 21004 - 4236
- 855 , // 440 - 21404 - 4207
- 860 , // 441 - 30404 - 4253
- 861 , // 442 - 40404 - 4265
- 415 , // 443 - 40411 - 1996
- 852 , // 444 - 40c04 - 4178
- 854 , // 445 - 41404 - 4195
- 845 , // 446 - 50804 - 4115
- 857 // 447 - 51004 - 4224
- };
-
- internal static string LCIDToLocaleName(int culture)
- {
- int left = 0;
- int right = s_lcids.Length - 1;
- int index;
-
- Debug.Assert(s_lcids.Length == s_lcidToCultureNameIndices.Length);
-
- while (left <= right)
- {
- index = (right + left) / 2;
-
- if (culture == s_lcids[index])
- {
- int indexToLocaleNamesIndices = s_lcidToCultureNameIndices[index];
- Debug.Assert(indexToLocaleNamesIndices < s_localeNamesIndices.Length - 1);
-
- return c_localeNames.Substring(s_localeNamesIndices[indexToLocaleNamesIndices],
- s_localeNamesIndices[indexToLocaleNamesIndices + 1] -
- s_localeNamesIndices[indexToLocaleNamesIndices]);
- }
- else if (culture < s_lcids[index])
- {
- right = index - 1;
- }
- else
- {
- left = index + 1;
- }
- }
-
- return null;
- }
-
- internal static int GetLocaleDataNumericPart(string cultureName, LocaleDataParts part)
- {
- int index = SearchCultureName(cultureName);
- if (index < 0)
- {
- return -1;
- }
-
- Debug.Assert((s_localeNamesIndices.Length-1 == (s_nameIndexToNumericData.Length/NUMERIC_LOCALE_DATA_COUNT_PER_ROW)) &&
- index < s_localeNamesIndices.Length);
-
- return s_nameIndexToNumericData[index * NUMERIC_LOCALE_DATA_COUNT_PER_ROW + (int) part];
- }
-
- internal static string GetThreeLetterWindowsLangageName(string cultureName)
- {
- int index = SearchCultureName(cultureName);
- if (index < 0)
- {
- return null;
- }
-
- Debug.Assert(s_localeNamesIndices.Length-1 == (c_threeLetterWindowsLanguageName.Length / 3));
- return c_threeLetterWindowsLanguageName.Substring(index * 3, 3);
- }
-
- internal static string GetLocaleDataMappedCulture(string cultureName, LocaleDataParts part)
- {
- int indexToIndicesTable = GetLocaleDataNumericPart(cultureName, part);
- if (indexToIndicesTable < 0)
- {
- return ""; // fallback to invariant
- }
-
- Debug.Assert(indexToIndicesTable < s_localeNamesIndices.Length-1);
-
- return c_localeNames.Substring(s_localeNamesIndices[indexToIndicesTable],
- s_localeNamesIndices[indexToIndicesTable+1] - s_localeNamesIndices[indexToIndicesTable]);
- }
-
- internal static string GetSpecificCultureName(string cultureName)
- {
- return GetLocaleDataMappedCulture(cultureName, LocaleDataParts.SpecificLocaleIndex);
- }
-
- internal static string GetConsoleUICulture(string cultureName)
- {
- return GetLocaleDataMappedCulture(cultureName, LocaleDataParts.ConsoleLocaleIndex);
- }
-
- // SearchCultureName will binary search c_localeNames using s_localeNamesIndices.
- // return index in s_localeNamesIndices, or -1 if it fail finding any match
- private static int SearchCultureName(string name)
- {
- int left = 0;
- int right = s_localeNamesIndices.Length - 2;
- int index;
- int result;
-
- Debug.Assert(s_localeNamesIndices[s_localeNamesIndices.Length - 1] == c_localeNames.Length);
-
- name = CultureData.AnsiToLower(name);
-
- // Binary search the array until we have only a couple of elements left and then
- // just walk those elements.
- while ((right - left) > 3)
- {
- index = ((right - left) / 2) + left;
-
- Debug.Assert(index < s_localeNamesIndices.Length - 1);
- result = CompareOrdinal(name, c_localeNames, s_localeNamesIndices[index], s_localeNamesIndices[index + 1] - s_localeNamesIndices[index]);
- if (result == 0)
- {
- return index;
- }
- else if (result < 0)
- {
- right = index;
- }
- else
- {
- left = index;
- }
- }
-
- // Walk the remaining elements (it'll be 3 or fewer).
- for (; left <= right; left++)
- {
- Debug.Assert(left < s_localeNamesIndices.Length - 1);
- if (CompareOrdinal(name, c_localeNames, s_localeNamesIndices[left], s_localeNamesIndices[left + 1] - s_localeNamesIndices[left]) == 0)
- {
- return (left);
- }
- }
-
- // couldn't find culture name
- return -1;
- }
-
- // optimized to avoid parameters checking
- private static int CompareOrdinal(string s1, string s2, int index, int length)
- {
- int count = s1.Length;
- if (count > length)
- count = length;
-
- int i = 0;
- while (i < count && s1[i] == s2[index + i])
- i++;
-
- if (i < count)
- return (int)(s1[i] - s2[index + i]);
-
- return s1.Length - length;
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/NumberFormatInfo.cs b/src/mscorlib/corefx/System/Globalization/NumberFormatInfo.cs
deleted file mode 100644
index 54cf492135..0000000000
--- a/src/mscorlib/corefx/System/Globalization/NumberFormatInfo.cs
+++ /dev/null
@@ -1,900 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
-using System.Text;
-
-namespace System.Globalization
-{
- //
- // Property Default Description
- // PositiveSign '+' Character used to indicate positive values.
- // NegativeSign '-' Character used to indicate negative values.
- // NumberDecimalSeparator '.' The character used as the decimal separator.
- // NumberGroupSeparator ',' The character used to separate groups of
- // digits to the left of the decimal point.
- // NumberDecimalDigits 2 The default number of decimal places.
- // NumberGroupSizes 3 The number of digits in each group to the
- // left of the decimal point.
- // NaNSymbol "NaN" The string used to represent NaN values.
- // PositiveInfinitySymbol"Infinity" The string used to represent positive
- // infinities.
- // NegativeInfinitySymbol"-Infinity" The string used to represent negative
- // infinities.
- //
- //
- //
- // Property Default Description
- // CurrencyDecimalSeparator '.' The character used as the decimal
- // separator.
- // CurrencyGroupSeparator ',' The character used to separate groups
- // of digits to the left of the decimal
- // point.
- // CurrencyDecimalDigits 2 The default number of decimal places.
- // CurrencyGroupSizes 3 The number of digits in each group to
- // the left of the decimal point.
- // CurrencyPositivePattern 0 The format of positive values.
- // CurrencyNegativePattern 0 The format of negative values.
- // CurrencySymbol "$" String used as local monetary symbol.
- //
-
- [Serializable]
- sealed public class NumberFormatInfo : IFormatProvider, ICloneable
- {
- // invariantInfo is constant irrespective of your current culture.
- private static volatile NumberFormatInfo s_invariantInfo;
-
- // READTHIS READTHIS READTHIS
- // This class has an exact mapping onto a native structure defined in COMNumber.cpp
- // DO NOT UPDATE THIS WITHOUT UPDATING THAT STRUCTURE. IF YOU ADD BOOL, ADD THEM AT THE END.
- // ALSO MAKE SURE TO UPDATE mscorlib.h in the VM directory to check field offsets.
- // READTHIS READTHIS READTHIS
- internal int[] numberGroupSizes = new int[] { 3 };
- internal int[] currencyGroupSizes = new int[] { 3 };
- internal int[] percentGroupSizes = new int[] { 3 };
- internal String positiveSign = "+";
- internal String negativeSign = "-";
- internal String numberDecimalSeparator = ".";
- internal String numberGroupSeparator = ",";
- internal String currencyGroupSeparator = ",";
- internal String currencyDecimalSeparator = ".";
- internal String currencySymbol = "$"; // TODO: CoreFX #846 Restore to the original value "\x00a4"; // U+00a4 is the symbol for International Monetary Fund.
- internal String nanSymbol = "NaN";
- internal String positiveInfinitySymbol = "Infinity";
- internal String negativeInfinitySymbol = "-Infinity";
- internal String percentDecimalSeparator = ".";
- internal String percentGroupSeparator = ",";
- internal String percentSymbol = "%";
- internal String perMilleSymbol = "\u2030";
-
-
- [OptionalField(VersionAdded = 2)]
- internal String[] nativeDigits = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
-
- internal int numberDecimalDigits = 2;
- internal int currencyDecimalDigits = 2;
- internal int currencyPositivePattern = 0;
- internal int currencyNegativePattern = 0;
- internal int numberNegativePattern = 1;
- internal int percentPositivePattern = 0;
- internal int percentNegativePattern = 0;
- internal int percentDecimalDigits = 2;
-
- [OptionalField(VersionAdded = 2)]
- internal int digitSubstitution = (int) DigitShapes.None;
-
- internal bool isReadOnly = false;
-
- // Is this NumberFormatInfo for invariant culture?
-
- [OptionalField(VersionAdded = 2)]
- internal bool m_isInvariant = false;
-
- public NumberFormatInfo() : this(null)
- {
- }
-
- [OnSerializing]
- private void OnSerializing(StreamingContext ctx) { }
-
- [OnDeserializing]
- private void OnDeserializing(StreamingContext ctx) { }
-
- [OnDeserialized]
- private void OnDeserialized(StreamingContext ctx) { }
-
- private static void VerifyDecimalSeparator(String decSep, String propertyName)
- {
- if (decSep == null)
- {
- throw new ArgumentNullException(propertyName,
- SR.ArgumentNull_String);
- }
-
- if (decSep.Length == 0)
- {
- throw new ArgumentException(SR.Argument_EmptyDecString);
- }
- Contract.EndContractBlock();
- }
-
- private static void VerifyGroupSeparator(String groupSep, String propertyName)
- {
- if (groupSep == null)
- {
- throw new ArgumentNullException(propertyName,
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- }
-
- private static void VerifyNativeDigits(string [] nativeDig, string propertyName)
- {
- if (nativeDig == null)
- {
- throw new ArgumentNullException(propertyName, SR.ArgumentNull_Array);
- }
-
- if (nativeDig.Length != 10)
- {
- throw new ArgumentException(SR.Argument_InvalidNativeDigitCount, propertyName);
- }
- Contract.EndContractBlock();
-
- for (int i = 0; i < nativeDig.Length; i++)
- {
- if (nativeDig[i] == null)
- {
- throw new ArgumentNullException(propertyName, SR.ArgumentNull_ArrayValue);
- }
-
- if (nativeDig[i].Length != 1)
- {
- if (nativeDig[i].Length != 2)
- {
- // Not 1 or 2 UTF-16 code points
- throw new ArgumentException(SR.Argument_InvalidNativeDigitValue, propertyName);
- }
- else if (!char.IsSurrogatePair(nativeDig[i][0], nativeDig[i][1]))
- {
- // 2 UTF-6 code points, but not a surrogate pair
- throw new ArgumentException(SR.Argument_InvalidNativeDigitValue, propertyName);
- }
- }
-
- if (CharUnicodeInfo.GetDecimalDigitValue(nativeDig[i], 0) != i &&
- CharUnicodeInfo.GetUnicodeCategory(nativeDig[i], 0) != UnicodeCategory.PrivateUse)
- {
- // Not the appropriate digit according to the Unicode data properties
- // (Digit 0 must be a 0, etc.).
- throw new ArgumentException(SR.Argument_InvalidNativeDigitValue, propertyName);
- }
- }
- }
-
- private static void VerifyDigitSubstitution(DigitShapes digitSub, string propertyName)
- {
- switch (digitSub)
- {
- case DigitShapes.Context:
- case DigitShapes.None:
- case DigitShapes.NativeNational:
- // Success.
- break;
-
- default:
- throw new ArgumentException(SR.Argument_InvalidDigitSubstitution, propertyName);
- }
- }
-
- internal NumberFormatInfo(CultureData cultureData)
- {
- if (cultureData != null)
- {
- // We directly use fields here since these data is coming from data table or Win32, so we
- // don't need to verify their values (except for invalid parsing situations).
- cultureData.GetNFIValues(this);
-
- if (cultureData.IsInvariantCulture)
- {
- // For invariant culture
- this.m_isInvariant = true;
- }
- }
- }
-
- [Pure]
- private void VerifyWritable()
- {
- if (isReadOnly)
- {
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- }
- Contract.EndContractBlock();
- }
-
- // Returns a default NumberFormatInfo that will be universally
- // supported and constant irrespective of the current culture.
- // Used by FromString methods.
- //
-
- public static NumberFormatInfo InvariantInfo
- {
- get
- {
- if (s_invariantInfo == null)
- {
- // Lazy create the invariant info. This cannot be done in a .cctor because exceptions can
- // be thrown out of a .cctor stack that will need this.
- NumberFormatInfo nfi = new NumberFormatInfo();
- nfi.m_isInvariant = true;
- s_invariantInfo = ReadOnly(nfi);
- }
- return s_invariantInfo;
- }
- }
-
- public static NumberFormatInfo GetInstance(IFormatProvider formatProvider)
- {
- // Fast case for a regular CultureInfo
- NumberFormatInfo info;
- CultureInfo cultureProvider = formatProvider as CultureInfo;
- if (cultureProvider != null && !cultureProvider.m_isInherited)
- {
- info = cultureProvider.numInfo;
- if (info != null)
- {
- return info;
- }
- else
- {
- return cultureProvider.NumberFormat;
- }
- }
- // Fast case for an NFI;
- info = formatProvider as NumberFormatInfo;
- if (info != null)
- {
- return info;
- }
- if (formatProvider != null)
- {
- info = formatProvider.GetFormat(typeof(NumberFormatInfo)) as NumberFormatInfo;
- if (info != null)
- {
- return info;
- }
- }
- return CurrentInfo;
- }
-
-
-
- public Object Clone()
- {
- NumberFormatInfo n = (NumberFormatInfo)MemberwiseClone();
- n.isReadOnly = false;
- return n;
- }
-
-
- public int CurrencyDecimalDigits
- {
- get { return currencyDecimalDigits; }
- set
- {
- if (value < 0 || value > 99)
- {
- throw new ArgumentOutOfRangeException(
- nameof(CurrencyDecimalDigits),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 0,
- 99));
- }
- Contract.EndContractBlock();
- VerifyWritable();
- currencyDecimalDigits = value;
- }
- }
-
-
- public String CurrencyDecimalSeparator
- {
- get { return currencyDecimalSeparator; }
- set
- {
- VerifyWritable();
- VerifyDecimalSeparator(value, "CurrencyDecimalSeparator");
- currencyDecimalSeparator = value;
- }
- }
-
-
- public bool IsReadOnly
- {
- get
- {
- return isReadOnly;
- }
- }
-
- //
- // Check the values of the groupSize array.
- //
- // Every element in the groupSize array should be between 1 and 9
- // excpet the last element could be zero.
- //
- internal static void CheckGroupSize(String propName, int[] groupSize)
- {
- for (int i = 0; i < groupSize.Length; i++)
- {
- if (groupSize[i] < 1)
- {
- if (i == groupSize.Length - 1 && groupSize[i] == 0)
- return;
- throw new ArgumentException(SR.Argument_InvalidGroupSize, propName);
- }
- else if (groupSize[i] > 9)
- {
- throw new ArgumentException(SR.Argument_InvalidGroupSize, propName);
- }
- }
- }
-
-
- public int[] CurrencyGroupSizes
- {
- get
- {
- return ((int[])currencyGroupSizes.Clone());
- }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(CurrencyGroupSizes),
- SR.ArgumentNull_Obj);
- }
- Contract.EndContractBlock();
- VerifyWritable();
-
- Int32[] inputSizes = (Int32[])value.Clone();
- CheckGroupSize(nameof(CurrencyGroupSizes), inputSizes);
- currencyGroupSizes = inputSizes;
- }
- }
-
-
-
- public int[] NumberGroupSizes
- {
- get
- {
- return ((int[])numberGroupSizes.Clone());
- }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(NumberGroupSizes),
- SR.ArgumentNull_Obj);
- }
- Contract.EndContractBlock();
- VerifyWritable();
-
- Int32[] inputSizes = (Int32[])value.Clone();
- CheckGroupSize(nameof(NumberGroupSizes), inputSizes);
- numberGroupSizes = inputSizes;
- }
- }
-
-
- public int[] PercentGroupSizes
- {
- get
- {
- return ((int[])percentGroupSizes.Clone());
- }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException("PercentGroupSizes",
- SR.ArgumentNull_Obj);
- }
- Contract.EndContractBlock();
- VerifyWritable();
- Int32[] inputSizes = (Int32[])value.Clone();
- CheckGroupSize("PercentGroupSizes", inputSizes);
- percentGroupSizes = inputSizes;
- }
- }
-
-
- public String CurrencyGroupSeparator
- {
- get { return currencyGroupSeparator; }
- set
- {
- VerifyWritable();
- VerifyGroupSeparator(value, nameof(CurrencyGroupSeparator));
- currencyGroupSeparator = value;
- }
- }
-
-
- public String CurrencySymbol
- {
- get { return currencySymbol; }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(CurrencySymbol),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- VerifyWritable();
- currencySymbol = value;
- }
- }
-
- // Returns the current culture's NumberFormatInfo. Used by Parse methods.
- //
-
- public static NumberFormatInfo CurrentInfo
- {
- get
- {
- System.Globalization.CultureInfo culture = CultureInfo.CurrentCulture;
- if (!culture.m_isInherited)
- {
- NumberFormatInfo info = culture.numInfo;
- if (info != null)
- {
- return info;
- }
- }
- return ((NumberFormatInfo)culture.GetFormat(typeof(NumberFormatInfo)));
- }
- }
-
-
- public String NaNSymbol
- {
- get
- {
- return nanSymbol;
- }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(NaNSymbol),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- VerifyWritable();
- nanSymbol = value;
- }
- }
-
-
-
- public int CurrencyNegativePattern
- {
- get { return currencyNegativePattern; }
- set
- {
- if (value < 0 || value > 15)
- {
- throw new ArgumentOutOfRangeException(
- nameof(CurrencyNegativePattern),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 0,
- 15));
- }
- Contract.EndContractBlock();
- VerifyWritable();
- currencyNegativePattern = value;
- }
- }
-
-
- public int NumberNegativePattern
- {
- get { return numberNegativePattern; }
- set
- {
- //
- // NOTENOTE: the range of value should correspond to negNumberFormats[] in vm\COMNumber.cpp.
- //
- if (value < 0 || value > 4)
- {
- throw new ArgumentOutOfRangeException(
- nameof(NumberNegativePattern),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 0,
- 4));
- }
- Contract.EndContractBlock();
- VerifyWritable();
- numberNegativePattern = value;
- }
- }
-
-
- public int PercentPositivePattern
- {
- get { return percentPositivePattern; }
- set
- {
- //
- // NOTENOTE: the range of value should correspond to posPercentFormats[] in vm\COMNumber.cpp.
- //
- if (value < 0 || value > 3)
- {
- throw new ArgumentOutOfRangeException(
- nameof(PercentPositivePattern),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 0,
- 3));
- }
- Contract.EndContractBlock();
- VerifyWritable();
- percentPositivePattern = value;
- }
- }
-
-
- public int PercentNegativePattern
- {
- get { return percentNegativePattern; }
- set
- {
- //
- // NOTENOTE: the range of value should correspond to posPercentFormats[] in vm\COMNumber.cpp.
- //
- if (value < 0 || value > 11)
- {
- throw new ArgumentOutOfRangeException(
- nameof(PercentNegativePattern),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 0,
- 11));
- }
- Contract.EndContractBlock();
- VerifyWritable();
- percentNegativePattern = value;
- }
- }
-
-
- public String NegativeInfinitySymbol
- {
- get
- {
- return negativeInfinitySymbol;
- }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(NegativeInfinitySymbol),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- VerifyWritable();
- negativeInfinitySymbol = value;
- }
- }
-
-
- public String NegativeSign
- {
- get { return negativeSign; }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(NegativeSign),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- VerifyWritable();
- negativeSign = value;
- }
- }
-
-
- public int NumberDecimalDigits
- {
- get { return numberDecimalDigits; }
- set
- {
- if (value < 0 || value > 99)
- {
- throw new ArgumentOutOfRangeException(
- nameof(NumberDecimalDigits),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 0,
- 99));
- }
- Contract.EndContractBlock();
- VerifyWritable();
- numberDecimalDigits = value;
- }
- }
-
-
- public String NumberDecimalSeparator
- {
- get { return numberDecimalSeparator; }
- set
- {
- VerifyWritable();
- VerifyDecimalSeparator(value, nameof(NumberDecimalSeparator));
- numberDecimalSeparator = value;
- }
- }
-
-
- public String NumberGroupSeparator
- {
- get { return numberGroupSeparator; }
- set
- {
- VerifyWritable();
- VerifyGroupSeparator(value, nameof(NumberGroupSeparator));
- numberGroupSeparator = value;
- }
- }
-
-
- public int CurrencyPositivePattern
- {
- get { return currencyPositivePattern; }
- set
- {
- if (value < 0 || value > 3)
- {
- throw new ArgumentOutOfRangeException(
- nameof(CurrencyPositivePattern),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 0,
- 3));
- }
- Contract.EndContractBlock();
- VerifyWritable();
- currencyPositivePattern = value;
- }
- }
-
-
- public String PositiveInfinitySymbol
- {
- get
- {
- return positiveInfinitySymbol;
- }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(PositiveInfinitySymbol),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- VerifyWritable();
- positiveInfinitySymbol = value;
- }
- }
-
-
- public String PositiveSign
- {
- get { return positiveSign; }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(PositiveSign),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- VerifyWritable();
- positiveSign = value;
- }
- }
-
-
- public int PercentDecimalDigits
- {
- get { return percentDecimalDigits; }
- set
- {
- if (value < 0 || value > 99)
- {
- throw new ArgumentOutOfRangeException(
- nameof(PercentDecimalDigits),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 0,
- 99));
- }
- Contract.EndContractBlock();
- VerifyWritable();
- percentDecimalDigits = value;
- }
- }
-
-
- public String PercentDecimalSeparator
- {
- get { return percentDecimalSeparator; }
- set
- {
- VerifyWritable();
- VerifyDecimalSeparator(value, nameof(PercentDecimalSeparator));
- percentDecimalSeparator = value;
- }
- }
-
-
- public String PercentGroupSeparator
- {
- get { return percentGroupSeparator; }
- set
- {
- VerifyWritable();
- VerifyGroupSeparator(value, nameof(PercentGroupSeparator));
- percentGroupSeparator = value;
- }
- }
-
-
- public String PercentSymbol
- {
- get
- {
- return percentSymbol;
- }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(PercentSymbol),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- VerifyWritable();
- percentSymbol = value;
- }
- }
-
-
- public String PerMilleSymbol
- {
- get { return perMilleSymbol; }
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(PerMilleSymbol),
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
- VerifyWritable();
- perMilleSymbol = value;
- }
- }
-
- public string [] NativeDigits
- {
- get { return (String[]) nativeDigits.Clone(); }
- set
- {
- VerifyWritable();
- VerifyNativeDigits(value, nameof(NativeDigits));
- nativeDigits = value;
- }
- }
-
- public DigitShapes DigitSubstitution
- {
- get { return (DigitShapes) digitSubstitution; }
- set
- {
- VerifyWritable();
- VerifyDigitSubstitution(value, nameof(DigitSubstitution));
- digitSubstitution = (int) value;
- }
- }
-
- public Object GetFormat(Type formatType)
- {
- return formatType == typeof(NumberFormatInfo) ? this : null;
- }
-
- public static NumberFormatInfo ReadOnly(NumberFormatInfo nfi)
- {
- if (nfi == null)
- {
- throw new ArgumentNullException(nameof(nfi));
- }
- Contract.EndContractBlock();
- if (nfi.IsReadOnly)
- {
- return (nfi);
- }
- NumberFormatInfo info = (NumberFormatInfo)(nfi.MemberwiseClone());
- info.isReadOnly = true;
- return info;
- }
-
- // private const NumberStyles InvalidNumberStyles = unchecked((NumberStyles) 0xFFFFFC00);
- private const NumberStyles InvalidNumberStyles = ~(NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite
- | NumberStyles.AllowLeadingSign | NumberStyles.AllowTrailingSign
- | NumberStyles.AllowParentheses | NumberStyles.AllowDecimalPoint
- | NumberStyles.AllowThousands | NumberStyles.AllowExponent
- | NumberStyles.AllowCurrencySymbol | NumberStyles.AllowHexSpecifier);
-
- internal static void ValidateParseStyleInteger(NumberStyles style)
- {
- // Check for undefined flags
- if ((style & InvalidNumberStyles) != 0)
- {
- throw new ArgumentException(SR.Argument_InvalidNumberStyles, nameof(style));
- }
- Contract.EndContractBlock();
- if ((style & NumberStyles.AllowHexSpecifier) != 0)
- { // Check for hex number
- if ((style & ~NumberStyles.HexNumber) != 0)
- {
- throw new ArgumentException(SR.Arg_InvalidHexStyle);
- }
- }
- }
-
- internal static void ValidateParseStyleFloatingPoint(NumberStyles style)
- {
- // Check for undefined flags
- if ((style & InvalidNumberStyles) != 0)
- {
- throw new ArgumentException(SR.Argument_InvalidNumberStyles, nameof(style));
- }
- Contract.EndContractBlock();
- if ((style & NumberStyles.AllowHexSpecifier) != 0)
- { // Check for hex number
- throw new ArgumentException(SR.Arg_HexStyleNotSupported);
- }
- }
- } // NumberFormatInfo
-}
-
-
-
-
-
-
-
-
-
diff --git a/src/mscorlib/corefx/System/Globalization/PersianCalendar.cs b/src/mscorlib/corefx/System/Globalization/PersianCalendar.cs
deleted file mode 100644
index b8b3da6911..0000000000
--- a/src/mscorlib/corefx/System/Globalization/PersianCalendar.cs
+++ /dev/null
@@ -1,611 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about PersianCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
- // Modern Persian calendar is a solar observation based calendar. Each new year begins on the day when the vernal equinox occurs before noon.
- // The epoch is the date of the vernal equinox prior to the epoch of the Islamic calendar (March 19, 622 Julian or March 22, 622 Gregorian)
-
- // There is no Persian year 0. Ordinary years have 365 days. Leap years have 366 days with the last month (Esfand) gaining the extra day.
- /*
- ** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 0622/03/22 9999/12/31
- ** Persian 0001/01/01 9378/10/13
- */
-
- [Serializable]
- public class PersianCalendar : Calendar
- {
- public static readonly int PersianEra = 1;
-
- internal static long PersianEpoch = new DateTime(622, 3, 22).Ticks / GregorianCalendar.TicksPerDay;
- private const int ApproximateHalfYear = 180;
-
- internal const int DatePartYear = 0;
- internal const int DatePartDayOfYear = 1;
- internal const int DatePartMonth = 2;
- internal const int DatePartDay = 3;
- internal const int MonthsPerYear = 12;
-
- internal static int[] DaysToMonth = { 0, 31, 62, 93, 124, 155, 186, 216, 246, 276, 306, 336, 366 };
-
- internal const int MaxCalendarYear = 9378;
- internal const int MaxCalendarMonth = 10;
- internal const int MaxCalendarDay = 13;
-
- // Persian calendar (year: 1, month: 1, day:1 ) = Gregorian (year: 622, month: 3, day: 22)
- // This is the minimal Gregorian date that we support in the PersianCalendar.
- internal static DateTime minDate = new DateTime(622, 3, 22);
- internal static DateTime maxDate = DateTime.MaxValue;
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (minDate);
- }
- }
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (maxDate);
- }
- }
-
- public override CalendarAlgorithmType AlgorithmType
- {
- get
- {
- return CalendarAlgorithmType.SolarCalendar;
- }
- }
-
- // Construct an instance of Persian calendar.
-
- public PersianCalendar()
- {
- }
-
-
- internal override CalendarId BaseCalendarID
- {
- get
- {
- return CalendarId.GREGORIAN;
- }
- }
-
- internal override CalendarId ID
- {
- get
- {
- return CalendarId.PERSIAN;
- }
- }
-
-
- /*=================================GetAbsoluteDatePersian==========================
- **Action: Gets the Absolute date for the given Persian date. The absolute date means
- ** the number of days from January 1st, 1 A.D.
- **Returns:
- **Arguments:
- **Exceptions:
- ============================================================================*/
-
- private long GetAbsoluteDatePersian(int year, int month, int day)
- {
- if (year >= 1 && year <= MaxCalendarYear && month >= 1 && month <= 12)
- {
- int ordinalDay = DaysInPreviousMonths(month) + day - 1; // day is one based, make 0 based since this will be the number of days we add to beginning of year below
- int approximateDaysFromEpochForYearStart = (int)(CalendricalCalculationsHelper.MeanTropicalYearInDays * (year - 1));
- long yearStart = CalendricalCalculationsHelper.PersianNewYearOnOrBefore(PersianEpoch + approximateDaysFromEpochForYearStart + ApproximateHalfYear);
- yearStart += ordinalDay;
- return yearStart;
- }
- throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadYearMonthDay);
- }
-
- internal static void CheckTicksRange(long ticks)
- {
- if (ticks < minDate.Ticks || ticks > maxDate.Ticks)
- {
- throw new ArgumentOutOfRangeException(
- "time",
- String.Format(
- CultureInfo.InvariantCulture,
- SR.ArgumentOutOfRange_CalendarRange,
- minDate,
- maxDate));
- }
- }
-
- internal static void CheckEraRange(int era)
- {
- if (era != CurrentEra && era != PersianEra)
- {
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
- }
-
- internal static void CheckYearRange(int year, int era)
- {
- CheckEraRange(era);
- if (year < 1 || year > MaxCalendarYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- MaxCalendarYear));
- }
- }
-
- internal static void CheckYearMonthRange(int year, int month, int era)
- {
- CheckYearRange(year, era);
- if (year == MaxCalendarYear)
- {
- if (month > MaxCalendarMonth)
- {
- throw new ArgumentOutOfRangeException(
- nameof(month),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- MaxCalendarMonth));
- }
- }
-
- if (month < 1 || month > 12)
- {
- throw new ArgumentOutOfRangeException(nameof(month), SR.ArgumentOutOfRange_Month);
- }
- }
-
- private static int MonthFromOrdinalDay(int ordinalDay)
- {
- Debug.Assert(ordinalDay <= 366);
- int index = 0;
- while (ordinalDay > DaysToMonth[index])
- index++;
-
- return index;
- }
-
- private static int DaysInPreviousMonths(int month)
- {
- Debug.Assert(1 <= month && month <= 12);
- --month; // months are one based but for calculations use 0 based
- return DaysToMonth[month];
- }
-
- /*=================================GetDatePart==========================
- **Action: Returns a given date part of this <i>DateTime</i>. This method is used
- ** to compute the year, day-of-year, month, or day part.
- **Returns:
- **Arguments:
- **Exceptions: ArgumentException if part is incorrect.
- ============================================================================*/
-
- internal int GetDatePart(long ticks, int part)
- {
- long NumDays; // The calculation buffer in number of days.
-
- CheckTicksRange(ticks);
-
- //
- // Get the absolute date. The absolute date is the number of days from January 1st, 1 A.D.
- // 1/1/0001 is absolute date 1.
- //
- NumDays = ticks / GregorianCalendar.TicksPerDay + 1;
-
- //
- // Calculate the appromixate Persian Year.
- //
-
- long yearStart = CalendricalCalculationsHelper.PersianNewYearOnOrBefore(NumDays);
- int y = (int)(Math.Floor(((yearStart - PersianEpoch) / CalendricalCalculationsHelper.MeanTropicalYearInDays) + 0.5)) + 1;
- Debug.Assert(y >= 1);
-
- if (part == DatePartYear)
- {
- return y;
- }
-
- //
- // Calculate the Persian Month.
- //
-
- int ordinalDay = (int)(NumDays - CalendricalCalculationsHelper.GetNumberOfDays(this.ToDateTime(y, 1, 1, 0, 0, 0, 0, 1)));
-
- if (part == DatePartDayOfYear)
- {
- return ordinalDay;
- }
-
- int m = MonthFromOrdinalDay(ordinalDay);
- Debug.Assert(ordinalDay >= 1);
- Debug.Assert(m >= 1 && m <= 12);
- if (part == DatePartMonth)
- {
- return m;
- }
-
- int d = ordinalDay - DaysInPreviousMonths(m);
- Debug.Assert(1 <= d);
- Debug.Assert(d <= 31);
-
- //
- // Calculate the Persian Day.
- //
-
- if (part == DatePartDay)
- {
- return (d);
- }
-
- // Incorrect part value.
- throw new InvalidOperationException(SR.InvalidOperation_DateTimeParsing);
- }
-
- // Returns the DateTime resulting from adding the given number of
- // months to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year and month parts of the specified DateTime by
- // value months, and, if required, adjusting the day part of the
- // resulting date downwards to the last day of the resulting month in the
- // resulting year. The time-of-day part of the result is the same as the
- // time-of-day part of the specified DateTime.
- //
- // In more precise terms, considering the specified DateTime to be of the
- // form y / m / d + t, where y is the
- // year, m is the month, d is the day, and t is the
- // time-of-day, the result is y1 / m1 / d1 + t,
- // where y1 and m1 are computed by adding value months
- // to y and m, and d1 is the largest value less than
- // or equal to d that denotes a valid day in month m1 of year
- // y1.
- //
-
-
- public override DateTime AddMonths(DateTime time, int months)
- {
- if (months < -120000 || months > 120000)
- {
- throw new ArgumentOutOfRangeException(
- nameof(months),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- -120000,
- 120000));
- }
- Contract.EndContractBlock();
- // Get the date in Persian calendar.
- int y = GetDatePart(time.Ticks, DatePartYear);
- int m = GetDatePart(time.Ticks, DatePartMonth);
- int d = GetDatePart(time.Ticks, DatePartDay);
- int i = m - 1 + months;
- if (i >= 0)
- {
- m = i % 12 + 1;
- y = y + i / 12;
- }
- else
- {
- m = 12 + (i + 1) % 12;
- y = y + (i - 11) / 12;
- }
- int days = GetDaysInMonth(y, m);
- if (d > days)
- {
- d = days;
- }
- long ticks = GetAbsoluteDatePersian(y, m, d) * TicksPerDay + time.Ticks % TicksPerDay;
- Calendar.CheckAddResult(ticks, MinSupportedDateTime, MaxSupportedDateTime);
- return (new DateTime(ticks));
- }
-
- // Returns the DateTime resulting from adding the given number of
- // years to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year part of the specified DateTime by value
- // years. If the month and day of the specified DateTime is 2/29, and if the
- // resulting year is not a leap year, the month and day of the resulting
- // DateTime becomes 2/28. Otherwise, the month, day, and time-of-day
- // parts of the result are the same as those of the specified DateTime.
- //
-
-
- public override DateTime AddYears(DateTime time, int years)
- {
- return (AddMonths(time, years * 12));
- }
-
- // Returns the day-of-month part of the specified DateTime. The returned
- // value is an integer between 1 and 31.
- //
-
-
- public override int GetDayOfMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDay));
- }
-
- // Returns the day-of-week part of the specified DateTime. The returned value
- // is an integer between 0 and 6, where 0 indicates Sunday, 1 indicates
- // Monday, 2 indicates Tuesday, 3 indicates Wednesday, 4 indicates
- // Thursday, 5 indicates Friday, and 6 indicates Saturday.
- //
-
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- return ((DayOfWeek)((int)(time.Ticks / TicksPerDay + 1) % 7));
- }
-
- // Returns the day-of-year part of the specified DateTime. The returned value
- // is an integer between 1 and 366.
- //
-
-
- public override int GetDayOfYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDayOfYear));
- }
-
- // Returns the number of days in the month given by the year and
- // month arguments.
- //
-
-
- public override int GetDaysInMonth(int year, int month, int era)
- {
- CheckYearMonthRange(year, month, era);
-
- if ((month == MaxCalendarMonth) && (year == MaxCalendarYear))
- {
- return MaxCalendarDay;
- }
-
- int daysInMonth = DaysToMonth[month] - DaysToMonth[month - 1];
- if ((month == MonthsPerYear) && !IsLeapYear(year))
- {
- Debug.Assert(daysInMonth == 30);
- --daysInMonth;
- }
- return daysInMonth;
- }
-
- // Returns the number of days in the year given by the year argument for the current era.
- //
-
- public override int GetDaysInYear(int year, int era)
- {
- CheckYearRange(year, era);
- if (year == MaxCalendarYear)
- {
- return DaysToMonth[MaxCalendarMonth - 1] + MaxCalendarDay;
- }
- // Common years have 365 days. Leap years have 366 days.
- return (IsLeapYear(year, CurrentEra) ? 366 : 365);
- }
-
- // Returns the era for the specified DateTime value.
-
-
- public override int GetEra(DateTime time)
- {
- CheckTicksRange(time.Ticks);
- return (PersianEra);
- }
-
-
-
- public override int[] Eras
- {
- get
- {
- return (new int[] { PersianEra });
- }
- }
-
- // Returns the month part of the specified DateTime. The returned value is an
- // integer between 1 and 12.
- //
-
-
- public override int GetMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartMonth));
- }
-
- // Returns the number of months in the specified year and era.
-
-
- public override int GetMonthsInYear(int year, int era)
- {
- CheckYearRange(year, era);
- if (year == MaxCalendarYear)
- {
- return MaxCalendarMonth;
- }
- return (12);
- }
-
- // Returns the year part of the specified DateTime. The returned value is an
- // integer between 1 and MaxCalendarYear.
- //
-
-
- public override int GetYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartYear));
- }
-
- // Checks whether a given day in the specified era is a leap day. This method returns true if
- // the date is a leap day, or false if not.
- //
-
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- // The year/month/era value checking is done in GetDaysInMonth().
- int daysInMonth = GetDaysInMonth(year, month, era);
- if (day < 1 || day > daysInMonth)
- {
- throw new ArgumentOutOfRangeException(
- nameof(day),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Day,
- daysInMonth,
- month));
- }
- return (IsLeapYear(year, era) && month == 12 && day == 30);
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
-
-
- public override int GetLeapMonth(int year, int era)
- {
- CheckYearRange(year, era);
- return (0);
- }
-
- // Checks whether a given month in the specified era is a leap month. This method returns true if
- // month is a leap month, or false if not.
- //
-
-
- public override bool IsLeapMonth(int year, int month, int era)
- {
- CheckYearMonthRange(year, month, era);
- return (false);
- }
-
- // Checks whether a given year in the specified era is a leap year. This method returns true if
- // year is a leap year, or false if not.
- //
-
- public override bool IsLeapYear(int year, int era)
- {
- CheckYearRange(year, era);
-
- if (year == MaxCalendarYear)
- {
- return false;
- }
-
- return (GetAbsoluteDatePersian(year + 1, 1, 1) - GetAbsoluteDatePersian(year, 1, 1)) == 366;
- }
-
- // Returns the date and time converted to a DateTime value. Throws an exception if the n-tuple is invalid.
- //
-
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- // The year/month/era checking is done in GetDaysInMonth().
- int daysInMonth = GetDaysInMonth(year, month, era);
- if (day < 1 || day > daysInMonth)
- {
- // BCLDebug.Log("year = " + year + ", month = " + month + ", day = " + day);
- throw new ArgumentOutOfRangeException(
- nameof(day),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Day,
- daysInMonth,
- month));
- }
-
- long lDate = GetAbsoluteDatePersian(year, month, day);
-
- if (lDate >= 0)
- {
- return (new DateTime(lDate * GregorianCalendar.TicksPerDay + TimeToTicks(hour, minute, second, millisecond)));
- }
- else
- {
- throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadYearMonthDay);
- }
- }
-
- private const int DEFAULT_TWO_DIGIT_YEAR_MAX = 1410;
-
- public override int TwoDigitYearMax
- {
- get
- {
- if (twoDigitYearMax == -1)
- {
- twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
- }
- return (twoDigitYearMax);
- }
-
- set
- {
- VerifyWritable();
- if (value < 99 || value > MaxCalendarYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(value),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 99,
- MaxCalendarYear));
- }
- twoDigitYearMax = value;
- }
- }
-
-
-
- public override int ToFourDigitYear(int year)
- {
- if (year < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedNonNegNum);
- }
- Contract.EndContractBlock();
-
- if (year < 100)
- {
- return (base.ToFourDigitYear(year));
- }
-
- if (year > MaxCalendarYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- MaxCalendarYear));
- }
- return (year);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/RegionInfo.cs b/src/mscorlib/corefx/System/Globalization/RegionInfo.cs
deleted file mode 100644
index 15679d24dd..0000000000
--- a/src/mscorlib/corefx/System/Globalization/RegionInfo.cs
+++ /dev/null
@@ -1,421 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////
-//
-//
-// Purpose: This class represents settings specified by de jure or
-// de facto standards for a particular country/region. In
-// contrast to CultureInfo, the RegionInfo does not represent
-// preferences of the user and does not depend on the user's
-// language or culture.
-//
-//
-////////////////////////////////////////////////////////////////////////////
-
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
-
-namespace System.Globalization
-{
- [Serializable]
- public class RegionInfo
- {
- //--------------------------------------------------------------------//
- // Internal Information //
- //--------------------------------------------------------------------//
-
- //
- // Variables.
- //
-
- //
- // Name of this region (ie: es-US): serialized, the field used for deserialization
- //
- internal String _name;
-
- //
- // The CultureData instance that we are going to read data from.
- //
- internal CultureData _cultureData;
-
- //
- // The RegionInfo for our current region
- //
- internal static volatile RegionInfo s_currentRegionInfo;
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // RegionInfo Constructors
- //
- // Note: We prefer that a region be created with a full culture name (ie: en-US)
- // because otherwise the native strings won't be right.
- //
- // In Silverlight we enforce that RegionInfos must be created with a full culture name
- //
- ////////////////////////////////////////////////////////////////////////
- public RegionInfo(String name)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
-
- if (name.Length == 0) //The InvariantCulture has no matching region
- {
- throw new ArgumentException(SR.Argument_NoRegionInvariantCulture, nameof(name));
- }
-
- Contract.EndContractBlock();
-
- //
- // For CoreCLR we only want the region names that are full culture names
- //
- _cultureData = CultureData.GetCultureDataForRegion(name, true);
- if (_cultureData == null)
- throw new ArgumentException(
- String.Format(
- CultureInfo.CurrentCulture,
- SR.Argument_InvalidCultureName, name), nameof(name));
-
-
- // Not supposed to be neutral
- if (_cultureData.IsNeutralCulture)
- throw new ArgumentException(SR.Format(SR.Argument_InvalidNeutralRegionName, name), nameof(name));
-
- SetName(name);
- }
-
- public RegionInfo(int culture)
- {
- if (culture == CultureInfo.LOCALE_INVARIANT) //The InvariantCulture has no matching region
- {
- throw new ArgumentException(SR.Argument_NoRegionInvariantCulture);
- }
-
- if (culture == CultureInfo.LOCALE_NEUTRAL)
- {
- // Not supposed to be neutral
- throw new ArgumentException(SR.Format(SR.Argument_CultureIsNeutral, culture), nameof(culture));
- }
-
- if (culture == CultureInfo.LOCALE_CUSTOM_DEFAULT)
- {
- // Not supposed to be neutral
- throw new ArgumentException(SR.Format(SR.Argument_CustomCultureCannotBePassedByNumber, culture), nameof(culture));
- }
-
- _cultureData = CultureData.GetCultureData(culture, true);
- _name = _cultureData.SREGIONNAME;
-
- if (_cultureData.IsNeutralCulture)
- {
- // Not supposed to be neutral
- throw new ArgumentException(SR.Format(SR.Argument_CultureIsNeutral, culture), nameof(culture));
- }
- }
-
- internal RegionInfo(CultureData cultureData)
- {
- _cultureData = cultureData;
- _name = _cultureData.SREGIONNAME;
- }
-
- private void SetName(string name)
- {
- // Use the name of the region we found
- _name = _cultureData.SREGIONNAME;
- }
-
- [OnSerializing]
- private void OnSerializing(StreamingContext ctx) { }
-
- [OnDeserialized]
- private void OnDeserialized(StreamingContext ctx)
- {
- _cultureData = CultureData.GetCultureData(_name, true);
-
- if (_cultureData == null)
- {
- throw new ArgumentException(
- String.Format(CultureInfo.CurrentCulture, SR.Argument_InvalidCultureName, _name),
- "_name");
- }
-
- _name = _cultureData.SREGIONNAME;
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetCurrentRegion
- //
- // This instance provides methods based on the current user settings.
- // These settings are volatile and may change over the lifetime of the
- // thread.
- //
- ////////////////////////////////////////////////////////////////////////
- public static RegionInfo CurrentRegion
- {
- get
- {
- RegionInfo temp = s_currentRegionInfo;
- if (temp == null)
- {
- temp = new RegionInfo(CultureInfo.CurrentCulture.m_cultureData);
-
- // Need full name for custom cultures
- temp._name = temp._cultureData.SREGIONNAME;
- s_currentRegionInfo = temp;
- }
- return temp;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetName
- //
- // Returns the name of the region (ie: en-US)
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String Name
- {
- get
- {
- Debug.Assert(_name != null, "Expected RegionInfo._name to be populated already");
- return (_name);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetEnglishName
- //
- // Returns the name of the region in English. (ie: United States)
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String EnglishName
- {
- get
- {
- return (_cultureData.SENGCOUNTRY);
- }
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetDisplayName
- //
- // Returns the display name (localized) of the region. (ie: United States
- // if the current UI language is en-US)
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String DisplayName
- {
- get
- {
- return (_cultureData.SLOCALIZEDCOUNTRY);
- }
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetNativeName
- //
- // Returns the native name of the region. (ie: Deutschland)
- // WARNING: You need a full locale name for this to make sense.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String NativeName
- {
- get
- {
- return (_cultureData.SNATIVECOUNTRY);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // TwoLetterISORegionName
- //
- // Returns the two letter ISO region name (ie: US)
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String TwoLetterISORegionName
- {
- get
- {
- return (_cultureData.SISO3166CTRYNAME);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ThreeLetterISORegionName
- //
- // Returns the three letter ISO region name (ie: USA)
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String ThreeLetterISORegionName
- {
- get
- {
- return (_cultureData.SISO3166CTRYNAME2);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ThreeLetterWindowsRegionName
- //
- // Returns the three letter windows region name (ie: USA)
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String ThreeLetterWindowsRegionName
- {
- get
- {
- // ThreeLetterWindowsRegionName is really same as ThreeLetterISORegionName
- return ThreeLetterISORegionName;
- }
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // IsMetric
- //
- // Returns true if this region uses the metric measurement system
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual bool IsMetric
- {
- get
- {
- int value = _cultureData.IMEASURE;
- return (value == 0);
- }
- }
-
- public virtual int GeoId
- {
- get
- {
- return (_cultureData.IGEOID);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // CurrencyEnglishName
- //
- // English name for this region's currency, ie: Swiss Franc
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual string CurrencyEnglishName
- {
- get
- {
- return (_cultureData.SENGLISHCURRENCY);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // CurrencyNativeName
- //
- // Native name for this region's currency, ie: Schweizer Franken
- // WARNING: You need a full locale name for this to make sense.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual string CurrencyNativeName
- {
- get
- {
- return (_cultureData.SNATIVECURRENCY);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // CurrencySymbol
- //
- // Currency Symbol for this locale, ie: Fr. or $
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String CurrencySymbol
- {
- get
- {
- return (_cultureData.SCURRENCY);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ISOCurrencySymbol
- //
- // ISO Currency Symbol for this locale, ie: CHF
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String ISOCurrencySymbol
- {
- get
- {
- return (_cultureData.SINTLSYMBOL);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Equals
- //
- // Implements Object.Equals(). Returns a boolean indicating whether
- // or not object refers to the same RegionInfo as the current instance.
- //
- // RegionInfos are considered equal if and only if they have the same name
- // (ie: en-US)
- //
- ////////////////////////////////////////////////////////////////////////
- public override bool Equals(Object value)
- {
- RegionInfo that = value as RegionInfo;
- if (that != null)
- {
- return this.Name.Equals(that.Name);
- }
-
- return (false);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetHashCode
- //
- // Implements Object.GetHashCode(). Returns the hash code for the
- // CultureInfo. The hash code is guaranteed to be the same for RegionInfo
- // A and B where A.Equals(B) is true.
- //
- ////////////////////////////////////////////////////////////////////////
- public override int GetHashCode()
- {
- return (this.Name.GetHashCode());
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ToString
- //
- // Implements Object.ToString(). Returns the name of the Region, ie: es-US
- //
- ////////////////////////////////////////////////////////////////////////
- public override String ToString()
- {
- return (Name);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/SortKey.cs b/src/mscorlib/corefx/System/Globalization/SortKey.cs
deleted file mode 100644
index 9e22a6f332..0000000000
--- a/src/mscorlib/corefx/System/Globalization/SortKey.cs
+++ /dev/null
@@ -1,208 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////
-//
-//
-// Purpose: This class implements a set of methods for retrieving
-// sort key information.
-//
-//
-////////////////////////////////////////////////////////////////////////////
-
-namespace System.Globalization {
-
- using System;
- using System.Runtime.CompilerServices;
- using System.Runtime.Serialization;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
-
- [Serializable]
- public partial class SortKey
- {
- //--------------------------------------------------------------------//
- // Internal Information //
- //--------------------------------------------------------------------//
-
- //
- // Variables.
- //
-
- [OptionalField(VersionAdded = 3)]
- internal string _localeName; // locale identifier
-
- [OptionalField(VersionAdded = 1)] // LCID field so serialization is Whidbey compatible though we don't officially support it
- internal int _win32LCID;
- // Whidbey serialization
-
- internal CompareOptions _options; // options
- internal string _string; // original string
- internal byte[] _keyData; // sortkey data
-
- //
- // The following constructor is designed to be called from CompareInfo to get the
- // the sort key of specific string for synthetic culture
- //
- internal SortKey(String localeName, String str, CompareOptions options, byte[] keyData)
- {
- _keyData = keyData;
- _localeName = localeName;
- _options = options;
- _string = str;
- }
-
- [OnSerializing]
- private void OnSerializing(StreamingContext context)
- {
- //set LCID to proper value for Whidbey serialization (no other use)
- if (_win32LCID == 0)
- {
- _win32LCID = CultureInfo.GetCultureInfo(_localeName).LCID;
- }
- }
-
- [OnDeserialized]
- private void OnDeserialized(StreamingContext context)
- {
- //set locale name to proper value after Whidbey deserialization
- if (String.IsNullOrEmpty(_localeName) && _win32LCID != 0)
- {
- _localeName = CultureInfo.GetCultureInfo(_win32LCID).Name;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetOriginalString
- //
- // Returns the original string used to create the current instance
- // of SortKey.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String OriginalString
- {
- get
- {
- return (_string);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetKeyData
- //
- // Returns a byte array representing the current instance of the
- // sort key.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual byte[] KeyData
- {
- get
- {
- return (byte[])(_keyData.Clone());
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Compare
- //
- // Compares the two sort keys. Returns 0 if the two sort keys are
- // equal, a number less than 0 if sortkey1 is less than sortkey2,
- // and a number greater than 0 if sortkey1 is greater than sortkey2.
- //
- ////////////////////////////////////////////////////////////////////////
- public static int Compare(SortKey sortkey1, SortKey sortkey2)
- {
- if (sortkey1==null || sortkey2==null)
- {
- throw new ArgumentNullException((sortkey1 == null ? nameof(sortkey1) : nameof(sortkey2)));
- }
- Contract.EndContractBlock();
-
- byte[] key1Data = sortkey1._keyData;
- byte[] key2Data = sortkey2._keyData;
-
- Debug.Assert(key1Data != null, "key1Data != null");
- Debug.Assert(key2Data != null, "key2Data != null");
-
- if (key1Data.Length == 0)
- {
- if (key2Data.Length == 0)
- {
- return (0);
- }
- return (-1);
- }
- if (key2Data.Length == 0)
- {
- return (1);
- }
-
- int compLen = (key1Data.Length<key2Data.Length)?key1Data.Length:key2Data.Length;
-
- for (int i=0; i<compLen; i++)
- {
- if (key1Data[i]>key2Data[i])
- {
- return (1);
- }
- if (key1Data[i]<key2Data[i])
- {
- return (-1);
- }
- }
-
- return 0;
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Equals
- //
- // Implements Object.Equals(). Returns a boolean indicating whether
- // or not object refers to the same SortKey as the current instance.
- //
- ////////////////////////////////////////////////////////////////////////
- public override bool Equals(Object value)
- {
- SortKey that = value as SortKey;
-
- if (that != null)
- {
- return Compare(this, that) == 0;
- }
-
- return (false);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetHashCode
- //
- // Implements Object.GetHashCode(). Returns the hash code for the
- // SortKey. The hash code is guaranteed to be the same for
- // SortKey A and B where A.Equals(B) is true.
- //
- ////////////////////////////////////////////////////////////////////////
- public override int GetHashCode()
- {
- return (CompareInfo.GetCompareInfo(_localeName).GetHashCodeOfString(_string, _options));
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ToString
- //
- // Implements Object.ToString(). Returns a string describing the
- // SortKey.
- //
- ////////////////////////////////////////////////////////////////////////
- public override String ToString()
- {
- return ("SortKey - " + _localeName + ", " + _options + ", " + _string);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/SortVersion.cs b/src/mscorlib/corefx/System/Globalization/SortVersion.cs
deleted file mode 100644
index 983179c149..0000000000
--- a/src/mscorlib/corefx/System/Globalization/SortVersion.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- [Serializable]
- public sealed class SortVersion : IEquatable<SortVersion>
- {
- private int _nlsVersion;
- private Guid _sortId;
-
- public int FullVersion
- {
- get
- {
- return _nlsVersion;
- }
- }
-
- public Guid SortId
- {
- get
- {
- return _sortId;
- }
- }
-
- public SortVersion(int fullVersion, Guid sortId)
- {
- _sortId = sortId;
- _nlsVersion = fullVersion;
- }
-
- internal SortVersion(int nlsVersion, int effectiveId, Guid customVersion)
- {
- _nlsVersion = nlsVersion;
-
- if (customVersion == Guid.Empty)
- {
- byte b1 = (byte)(effectiveId >> 24);
- byte b2 = (byte)((effectiveId & 0x00FF0000) >> 16);
- byte b3 = (byte)((effectiveId & 0x0000FF00) >> 8);
- byte b4 = (byte)(effectiveId & 0xFF);
- customVersion = new Guid(0, 0, 0, 0, 0, 0, 0, b1, b2, b3, b4);
- }
-
- _sortId = customVersion;
- }
-
- public override bool Equals(object obj)
- {
- SortVersion n = obj as SortVersion;
- if (n != null)
- {
- return this.Equals(n);
- }
-
- return false;
- }
-
- public bool Equals(SortVersion other)
- {
- if (other == null)
- {
- return false;
- }
-
- return _nlsVersion == other._nlsVersion && _sortId == other._sortId;
- }
-
- public override int GetHashCode()
- {
- return _nlsVersion * 7 | _sortId.GetHashCode();
- }
-
- public static bool operator ==(SortVersion left, SortVersion right)
- {
- if (((object)left) != null)
- {
- return left.Equals(right);
- }
-
- if (((object)right) != null)
- {
- return right.Equals(left);
- }
-
- // Both null.
- return true;
- }
-
- public static bool operator !=(SortVersion left, SortVersion right)
- {
- return !(left == right);
- }
- }
-} \ No newline at end of file
diff --git a/src/mscorlib/corefx/System/Globalization/StringInfo.cs b/src/mscorlib/corefx/System/Globalization/StringInfo.cs
deleted file mode 100644
index f1dd30561b..0000000000
--- a/src/mscorlib/corefx/System/Globalization/StringInfo.cs
+++ /dev/null
@@ -1,374 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////
-//
-//
-// Purpose: This class defines behaviors specific to a writing system.
-// A writing system is the collection of scripts and
-// orthographic rules required to represent a language as text.
-//
-//
-////////////////////////////////////////////////////////////////////////////
-
-using System;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
-
-namespace System.Globalization
-{
- [Serializable]
- public class StringInfo
- {
- [OptionalField(VersionAdded = 2)]
- private string _str;
-
- [NonSerialized]
- private int[] _indexes;
-
- // Legacy constructor
- public StringInfo() : this("") { }
-
- // Primary, useful constructor
- public StringInfo(string value)
- {
- this.String = value;
- }
-
- [OnDeserializing]
- private void OnDeserializing(StreamingContext ctx)
- {
- _str = String.Empty;
- }
-
- [OnDeserialized]
- private void OnDeserialized(StreamingContext ctx)
- {
- if (_str.Length == 0)
- {
- _indexes = null;
- }
- }
-
- public override bool Equals(Object value)
- {
- StringInfo that = value as StringInfo;
- if (that != null)
- {
- return (_str.Equals(that._str));
- }
- return (false);
- }
-
- public override int GetHashCode()
- {
- return _str.GetHashCode();
- }
-
-
- // Our zero-based array of index values into the string. Initialize if
- // our private array is not yet, in fact, initialized.
- private int[] Indexes
- {
- get
- {
- if ((null == _indexes) && (0 < this.String.Length))
- {
- _indexes = StringInfo.ParseCombiningCharacters(this.String);
- }
-
- return (_indexes);
- }
- }
-
- public string String
- {
- get
- {
- return (_str);
- }
- set
- {
- if (null == value)
- {
- throw new ArgumentNullException("String",
- SR.ArgumentNull_String);
- }
- Contract.EndContractBlock();
-
- _str = value;
- _indexes = null;
- }
- }
-
- public int LengthInTextElements
- {
- get
- {
- if (null == this.Indexes)
- {
- // Indexes not initialized, so assume length zero
- return (0);
- }
-
- return (this.Indexes.Length);
- }
- }
-
- public string SubstringByTextElements(int startingTextElement)
- {
- // If the string is empty, no sense going further.
- if (null == this.Indexes)
- {
- // Just decide which error to give depending on the param they gave us....
- if (startingTextElement < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(startingTextElement), SR.ArgumentOutOfRange_NeedPosNum);
- }
- else
- {
- throw new ArgumentOutOfRangeException(nameof(startingTextElement), SR.Arg_ArgumentOutOfRangeException);
- }
- }
- return (SubstringByTextElements(startingTextElement, Indexes.Length - startingTextElement));
- }
-
- public string SubstringByTextElements(int startingTextElement, int lengthInTextElements)
- {
- if (startingTextElement < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(startingTextElement), SR.ArgumentOutOfRange_NeedPosNum);
- }
-
- if (this.String.Length == 0 || startingTextElement >= Indexes.Length)
- {
- throw new ArgumentOutOfRangeException(nameof(startingTextElement), SR.Arg_ArgumentOutOfRangeException);
- }
-
- if (lengthInTextElements < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(lengthInTextElements), SR.ArgumentOutOfRange_NeedPosNum);
- }
-
- if (startingTextElement > Indexes.Length - lengthInTextElements)
- {
- throw new ArgumentOutOfRangeException(nameof(lengthInTextElements), SR.Arg_ArgumentOutOfRangeException);
- }
-
- int start = Indexes[startingTextElement];
-
- if (startingTextElement + lengthInTextElements == Indexes.Length)
- {
- // We are at the last text element in the string and because of that
- // must handle the call differently.
- return (this.String.Substring(start));
- }
- else
- {
- return (this.String.Substring(start, (Indexes[lengthInTextElements + startingTextElement] - start)));
- }
- }
-
- public static string GetNextTextElement(string str)
- {
- return (GetNextTextElement(str, 0));
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Get the code point count of the current text element.
- //
- // A combining class is defined as:
- // A character/surrogate that has the following Unicode category:
- // * NonSpacingMark (e.g. U+0300 COMBINING GRAVE ACCENT)
- // * SpacingCombiningMark (e.g. U+ 0903 DEVANGARI SIGN VISARGA)
- // * EnclosingMark (e.g. U+20DD COMBINING ENCLOSING CIRCLE)
- //
- // In the context of GetNextTextElement() and ParseCombiningCharacters(), a text element is defined as:
- //
- // 1. If a character/surrogate is in the following category, it is a text element.
- // It can NOT further combine with characters in the combinging class to form a text element.
- // * one of the Unicode category in the combinging class
- // * UnicodeCategory.Format
- // * UnicodeCateogry.Control
- // * UnicodeCategory.OtherNotAssigned
- // 2. Otherwise, the character/surrogate can be combined with characters in the combinging class to form a text element.
- //
- // Return:
- // The length of the current text element
- //
- // Parameters:
- // String str
- // index The starting index
- // len The total length of str (to define the upper boundary)
- // ucCurrent The Unicode category pointed by Index. It will be updated to the uc of next character if this is not the last text element.
- // currentCharCount The char count of an abstract char pointed by Index. It will be updated to the char count of next abstract character if this is not the last text element.
- //
- ////////////////////////////////////////////////////////////////////////
-
- internal static int GetCurrentTextElementLen(string str, int index, int len, ref UnicodeCategory ucCurrent, ref int currentCharCount)
- {
- Debug.Assert(index >= 0 && len >= 0, "StringInfo.GetCurrentTextElementLen() : index = " + index + ", len = " + len);
- Debug.Assert(index < len, "StringInfo.GetCurrentTextElementLen() : index = " + index + ", len = " + len);
- if (index + currentCharCount == len)
- {
- // This is the last character/surrogate in the string.
- return (currentCharCount);
- }
-
- // Call an internal GetUnicodeCategory, which will tell us both the unicode category, and also tell us if it is a surrogate pair or not.
- int nextCharCount;
- UnicodeCategory ucNext = CharUnicodeInfo.InternalGetUnicodeCategory(str, index + currentCharCount, out nextCharCount);
- if (CharUnicodeInfo.IsCombiningCategory(ucNext))
- {
- // The next element is a combining class.
- // Check if the current text element to see if it is a valid base category (i.e. it should not be a combining category,
- // not a format character, and not a control character).
-
- if (CharUnicodeInfo.IsCombiningCategory(ucCurrent)
- || (ucCurrent == UnicodeCategory.Format)
- || (ucCurrent == UnicodeCategory.Control)
- || (ucCurrent == UnicodeCategory.OtherNotAssigned)
- || (ucCurrent == UnicodeCategory.Surrogate)) // An unpair high surrogate or low surrogate
- {
- // Will fall thru and return the currentCharCount
- }
- else
- {
- int startIndex = index; // Remember the current index.
-
- // We have a valid base characters, and we have a character (or surrogate) that is combining.
- // Check if there are more combining characters to follow.
- // Check if the next character is a nonspacing character.
- index += currentCharCount + nextCharCount;
-
- while (index < len)
- {
- ucNext = CharUnicodeInfo.InternalGetUnicodeCategory(str, index, out nextCharCount);
- if (!CharUnicodeInfo.IsCombiningCategory(ucNext))
- {
- ucCurrent = ucNext;
- currentCharCount = nextCharCount;
- break;
- }
- index += nextCharCount;
- }
- return (index - startIndex);
- }
- }
- // The return value will be the currentCharCount.
- int ret = currentCharCount;
- ucCurrent = ucNext;
- // Update currentCharCount.
- currentCharCount = nextCharCount;
- return (ret);
- }
-
- // Returns the str containing the next text element in str starting at
- // index index. If index is not supplied, then it will start at the beginning
- // of str. It recognizes a base character plus one or more combining
- // characters or a properly formed surrogate pair as a text element. See also
- // the ParseCombiningCharacters() and the ParseSurrogates() methods.
- public static string GetNextTextElement(string str, int index)
- {
- //
- // Validate parameters.
- //
- if (str == null)
- {
- throw new ArgumentNullException(nameof(str));
- }
- Contract.EndContractBlock();
-
- int len = str.Length;
- if (index < 0 || index >= len)
- {
- if (index == len)
- {
- return (String.Empty);
- }
- throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
- }
-
- int charLen;
- UnicodeCategory uc = CharUnicodeInfo.InternalGetUnicodeCategory(str, index, out charLen);
- return (str.Substring(index, GetCurrentTextElementLen(str, index, len, ref uc, ref charLen)));
- }
-
- public static TextElementEnumerator GetTextElementEnumerator(string str)
- {
- return (GetTextElementEnumerator(str, 0));
- }
-
- public static TextElementEnumerator GetTextElementEnumerator(string str, int index)
- {
- //
- // Validate parameters.
- //
- if (str == null)
- {
- throw new ArgumentNullException(nameof(str));
- }
- Contract.EndContractBlock();
-
- int len = str.Length;
- if (index < 0 || (index > len))
- {
- throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
- }
-
- return (new TextElementEnumerator(str, index, len));
- }
-
- /*
- * Returns the indices of each base character or properly formed surrogate pair
- * within the str. It recognizes a base character plus one or more combining
- * characters or a properly formed surrogate pair as a text element and returns
- * the index of the base character or high surrogate. Each index is the
- * beginning of a text element within a str. The length of each element is
- * easily computed as the difference between successive indices. The length of
- * the array will always be less than or equal to the length of the str. For
- * example, given the str \u4f00\u302a\ud800\udc00\u4f01, this method would
- * return the indices: 0, 2, 4.
- */
-
- public static int[] ParseCombiningCharacters(string str)
- {
- if (str == null)
- {
- throw new ArgumentNullException(nameof(str));
- }
- Contract.EndContractBlock();
-
- int len = str.Length;
- int[] result = new int[len];
- if (len == 0)
- {
- return (result);
- }
-
- int resultCount = 0;
-
- int i = 0;
- int currentCharLen;
- UnicodeCategory currentCategory = CharUnicodeInfo.InternalGetUnicodeCategory(str, 0, out currentCharLen);
-
- while (i < len)
- {
- result[resultCount++] = i;
- i += GetCurrentTextElementLen(str, i, len, ref currentCategory, ref currentCharLen);
- }
-
- if (resultCount < len)
- {
- int[] returnArray = new int[resultCount];
- Array.Copy(result, returnArray, resultCount);
- return (returnArray);
- }
- return (result);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/TaiwanCalendar.cs b/src/mscorlib/corefx/System/Globalization/TaiwanCalendar.cs
deleted file mode 100644
index 2e735e0cb9..0000000000
--- a/src/mscorlib/corefx/System/Globalization/TaiwanCalendar.cs
+++ /dev/null
@@ -1,285 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- /*=================================TaiwanCalendar==========================
- **
- ** Taiwan calendar is based on the Gregorian calendar. And the year is an offset to Gregorian calendar.
- ** That is,
- ** Taiwan year = Gregorian year - 1911. So 1912/01/01 A.D. is Taiwan 1/01/01
- **
- ** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 1912/01/01 9999/12/31
- ** Taiwan 01/01/01 8088/12/31
- ============================================================================*/
-
- [Serializable]
- public class TaiwanCalendar : Calendar
- {
- //
- // The era value for the current era.
- //
-
- // Since
- // Gregorian Year = Era Year + yearOffset
- // When Gregorian Year 1912 is year 1, so that
- // 1912 = 1 + yearOffset
- // So yearOffset = 1911
- //m_EraInfo[0] = new EraInfo(1, new DateTime(1912, 1, 1).Ticks, 1911, 1, GregorianCalendar.MaxYear - 1911);
-
- // Initialize our era info.
- internal static EraInfo[] taiwanEraInfo = new EraInfo[] {
- new EraInfo( 1, 1912, 1, 1, 1911, 1, GregorianCalendar.MaxYear - 1911) // era #, start year/month/day, yearOffset, minEraYear
- };
-
- internal static volatile Calendar s_defaultInstance;
-
- internal GregorianCalendarHelper helper;
-
- /*=================================GetDefaultInstance==========================
- **Action: Internal method to provide a default intance of TaiwanCalendar. Used by NLS+ implementation
- ** and other calendars.
- **Returns:
- **Arguments:
- **Exceptions:
- ============================================================================*/
-
- internal static Calendar GetDefaultInstance()
- {
- if (s_defaultInstance == null)
- {
- s_defaultInstance = new TaiwanCalendar();
- }
- return (s_defaultInstance);
- }
-
- internal static readonly DateTime calendarMinValue = new DateTime(1912, 1, 1);
-
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (calendarMinValue);
- }
- }
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (DateTime.MaxValue);
- }
- }
-
- public override CalendarAlgorithmType AlgorithmType
- {
- get
- {
- return CalendarAlgorithmType.SolarCalendar;
- }
- }
-
- // Return the type of the Taiwan calendar.
- //
-
- public TaiwanCalendar()
- {
- try
- {
- new CultureInfo("zh-TW");
- }
- catch (ArgumentException e)
- {
- throw new TypeInitializationException(this.GetType().ToString(), e);
- }
- helper = new GregorianCalendarHelper(this, taiwanEraInfo);
- }
-
- internal override CalendarId ID
- {
- get
- {
- return CalendarId.TAIWAN;
- }
- }
-
-
- public override DateTime AddMonths(DateTime time, int months)
- {
- return (helper.AddMonths(time, months));
- }
-
-
- public override DateTime AddYears(DateTime time, int years)
- {
- return (helper.AddYears(time, years));
- }
-
-
- public override int GetDaysInMonth(int year, int month, int era)
- {
- return (helper.GetDaysInMonth(year, month, era));
- }
-
-
- public override int GetDaysInYear(int year, int era)
- {
- return (helper.GetDaysInYear(year, era));
- }
-
-
- public override int GetDayOfMonth(DateTime time)
- {
- return (helper.GetDayOfMonth(time));
- }
-
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- return (helper.GetDayOfWeek(time));
- }
-
-
- public override int GetDayOfYear(DateTime time)
- {
- return (helper.GetDayOfYear(time));
- }
-
-
- public override int GetMonthsInYear(int year, int era)
- {
- return (helper.GetMonthsInYear(year, era));
- }
-
-
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
- public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
- {
- return (helper.GetWeekOfYear(time, rule, firstDayOfWeek));
- }
-
-
- public override int GetEra(DateTime time)
- {
- return (helper.GetEra(time));
- }
-
- public override int GetMonth(DateTime time)
- {
- return (helper.GetMonth(time));
- }
-
-
- public override int GetYear(DateTime time)
- {
- return (helper.GetYear(time));
- }
-
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- return (helper.IsLeapDay(year, month, day, era));
- }
-
-
- public override bool IsLeapYear(int year, int era)
- {
- return (helper.IsLeapYear(year, era));
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
-
- public override int GetLeapMonth(int year, int era)
- {
- return (helper.GetLeapMonth(year, era));
- }
-
-
- public override bool IsLeapMonth(int year, int month, int era)
- {
- return (helper.IsLeapMonth(year, month, era));
- }
-
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- return (helper.ToDateTime(year, month, day, hour, minute, second, millisecond, era));
- }
-
-
- public override int[] Eras
- {
- get
- {
- return (helper.Eras);
- }
- }
-
- private const int DEFAULT_TWO_DIGIT_YEAR_MAX = 99;
-
- public override int TwoDigitYearMax
- {
- get
- {
- if (twoDigitYearMax == -1)
- {
- twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
- }
- return (twoDigitYearMax);
- }
-
- set
- {
- VerifyWritable();
- if (value < 99 || value > helper.MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- "year",
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 99,
- helper.MaxYear));
- }
- twoDigitYearMax = value;
- }
- }
-
- // For Taiwan calendar, four digit year is not used.
- // Therefore, for any two digit number, we just return the original number.
-
- public override int ToFourDigitYear(int year)
- {
- if (year <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedPosNum);
- }
- Contract.EndContractBlock();
-
- if (year > helper.MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 1,
- helper.MaxYear));
- }
- return (year);
- }
- }
-}
-
diff --git a/src/mscorlib/corefx/System/Globalization/TaiwanLunisolarCalendar.cs b/src/mscorlib/corefx/System/Globalization/TaiwanLunisolarCalendar.cs
deleted file mode 100644
index 1f75ac9a04..0000000000
--- a/src/mscorlib/corefx/System/Globalization/TaiwanLunisolarCalendar.cs
+++ /dev/null
@@ -1,330 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about TaiwanLunisolarCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
- /*
- ** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 1912/02/18 2051/02/10
- ** TaiwanLunisolar 1912/01/01 2050/13/29
- */
-
- [Serializable]
- public class TaiwanLunisolarCalendar : EastAsianLunisolarCalendar
- {
- // Since
- // Gregorian Year = Era Year + yearOffset
- // When Gregorian Year 1912 is year 1, so that
- // 1912 = 1 + yearOffset
- // So yearOffset = 1911
- //m_EraInfo[0] = new EraInfo(1, new DateTime(1912, 1, 1).Ticks, 1911, 1, GregorianCalendar.MaxYear - 1911);
-
- // Initialize our era info.
- internal static EraInfo[] taiwanLunisolarEraInfo = new EraInfo[] {
- new EraInfo( 1, 1912, 1, 1, 1911, 1, GregorianCalendar.MaxYear - 1911) // era #, start year/month/day, yearOffset, minEraYear
- };
-
- internal GregorianCalendarHelper helper;
-
- internal const int MIN_LUNISOLAR_YEAR = 1912;
- internal const int MAX_LUNISOLAR_YEAR = 2050;
-
- internal const int MIN_GREGORIAN_YEAR = 1912;
- internal const int MIN_GREGORIAN_MONTH = 2;
- internal const int MIN_GREGORIAN_DAY = 18;
-
- internal const int MAX_GREGORIAN_YEAR = 2051;
- internal const int MAX_GREGORIAN_MONTH = 2;
- internal const int MAX_GREGORIAN_DAY = 10;
-
- internal static DateTime minDate = new DateTime(MIN_GREGORIAN_YEAR, MIN_GREGORIAN_MONTH, MIN_GREGORIAN_DAY);
- internal static DateTime maxDate = new DateTime((new DateTime(MAX_GREGORIAN_YEAR, MAX_GREGORIAN_MONTH, MAX_GREGORIAN_DAY, 23, 59, 59, 999)).Ticks + 9999);
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (minDate);
- }
- }
-
-
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (maxDate);
- }
- }
-
- protected override int DaysInYearBeforeMinSupportedYear
- {
- get
- {
- // 1911 from ChineseLunisolarCalendar
- return 384;
- }
- }
-
- private static readonly int[,] s_yinfo =
- {
- /*Y LM Lmon Lday DaysPerMonth D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 #Days
- 1912 */
- { 0 , 2 , 18 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1913 */{ 0 , 2 , 6 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-1914 */{ 5 , 1 , 26 , 54568 },/* 30 30 29 30 29 30 29 30 29 29 30 29 30 384
-1915 */{ 0 , 2 , 14 , 46400 },/* 30 29 30 30 29 30 29 30 29 30 29 29 0 354
-1916 */{ 0 , 2 , 3 , 54944 },/* 30 30 29 30 29 30 30 29 30 29 30 29 0 355
-1917 */{ 2 , 1 , 23 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 29 384
-1918 */{ 0 , 2 , 11 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1919 */{ 7 , 2 , 1 , 18872 },/* 29 30 29 29 30 29 29 30 30 29 30 30 30 384
-1920 */{ 0 , 2 , 20 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1921 */{ 0 , 2 , 8 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1922 */{ 5 , 1 , 28 , 45656 },/* 30 29 30 30 29 29 30 29 29 30 29 30 30 384
-1923 */{ 0 , 2 , 16 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 0 354
-1924 */{ 0 , 2 , 5 , 27968 },/* 29 30 30 29 30 30 29 30 29 30 29 29 0 354
-1925 */{ 4 , 1 , 24 , 44456 },/* 30 29 30 29 30 30 29 30 30 29 30 29 30 385
-1926 */{ 0 , 2 , 13 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1927 */{ 0 , 2 , 2 , 38256 },/* 30 29 29 30 29 30 29 30 29 30 30 30 0 355
-1928 */{ 2 , 1 , 23 , 18808 },/* 29 30 29 29 30 29 29 30 29 30 30 30 30 384
-1929 */{ 0 , 2 , 10 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1930 */{ 6 , 1 , 30 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 29 383
-1931 */{ 0 , 2 , 17 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1932 */{ 0 , 2 , 6 , 59984 },/* 30 30 30 29 30 29 30 29 29 30 29 30 0 355
-1933 */{ 5 , 1 , 26 , 27976 },/* 29 30 30 29 30 30 29 30 29 30 29 29 30 384
-1934 */{ 0 , 2 , 14 , 23248 },/* 29 30 29 30 30 29 30 29 30 30 29 30 0 355
-1935 */{ 0 , 2 , 4 , 11104 },/* 29 29 30 29 30 29 30 30 29 30 30 29 0 354
-1936 */{ 3 , 1 , 24 , 37744 },/* 30 29 29 30 29 29 30 30 29 30 30 30 29 384
-1937 */{ 0 , 2 , 11 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-1938 */{ 7 , 1 , 31 , 51560 },/* 30 30 29 29 30 29 29 30 29 30 30 29 30 384
-1939 */{ 0 , 2 , 19 , 51536 },/* 30 30 29 29 30 29 29 30 29 30 29 30 0 354
-1940 */{ 0 , 2 , 8 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-1941 */{ 6 , 1 , 27 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 29 384
-1942 */{ 0 , 2 , 15 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1943 */{ 0 , 2 , 5 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1944 */{ 4 , 1 , 25 , 43736 },/* 30 29 30 29 30 29 30 29 30 30 29 30 30 385
-1945 */{ 0 , 2 , 13 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-1946 */{ 0 , 2 , 2 , 37584 },/* 30 29 29 30 29 29 30 29 30 30 29 30 0 354
-1947 */{ 2 , 1 , 22 , 51544 },/* 30 30 29 29 30 29 29 30 29 30 29 30 30 384
-1948 */{ 0 , 2 , 10 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-1949 */{ 7 , 1 , 29 , 46248 },/* 30 29 30 30 29 30 29 29 30 29 30 29 30 384
-1950 */{ 0 , 2 , 17 , 27808 },/* 29 30 30 29 30 30 29 29 30 29 30 29 0 354
-1951 */{ 0 , 2 , 6 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 0 355
-1952 */{ 5 , 1 , 27 , 21928 },/* 29 30 29 30 29 30 29 30 30 29 30 29 30 384
-1953 */{ 0 , 2 , 14 , 19872 },/* 29 30 29 29 30 30 29 30 30 29 30 29 0 354
-1954 */{ 0 , 2 , 3 , 42416 },/* 30 29 30 29 29 30 29 30 30 29 30 30 0 355
-1955 */{ 3 , 1 , 24 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-1956 */{ 0 , 2 , 12 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-1957 */{ 8 , 1 , 31 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 29 383
-1958 */{ 0 , 2 , 18 , 59728 },/* 30 30 30 29 30 29 29 30 29 30 29 30 0 355
-1959 */{ 0 , 2 , 8 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-1960 */{ 6 , 1 , 28 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 29 384
-1961 */{ 0 , 2 , 15 , 43856 },/* 30 29 30 29 30 29 30 30 29 30 29 30 0 355
-1962 */{ 0 , 2 , 5 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-1963 */{ 4 , 1 , 25 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-1964 */{ 0 , 2 , 13 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 0 355
-1965 */{ 0 , 2 , 2 , 21088 },/* 29 30 29 30 29 29 30 29 29 30 30 29 0 353
-1966 */{ 3 , 1 , 21 , 59696 },/* 30 30 30 29 30 29 29 30 29 29 30 30 29 384
-1967 */{ 0 , 2 , 9 , 55632 },/* 30 30 29 30 30 29 29 30 29 30 29 30 0 355
-1968 */{ 7 , 1 , 30 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-1969 */{ 0 , 2 , 17 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-1970 */{ 0 , 2 , 6 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-1971 */{ 5 , 1 , 27 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-1972 */{ 0 , 2 , 15 , 19152 },/* 29 30 29 29 30 29 30 29 30 30 29 30 0 354
-1973 */{ 0 , 2 , 3 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-1974 */{ 4 , 1 , 23 , 53864 },/* 30 30 29 30 29 29 30 29 29 30 30 29 30 384
-1975 */{ 0 , 2 , 11 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-1976 */{ 8 , 1 , 31 , 54568 },/* 30 30 29 30 29 30 29 30 29 29 30 29 30 384
-1977 */{ 0 , 2 , 18 , 46400 },/* 30 29 30 30 29 30 29 30 29 30 29 29 0 354
-1978 */{ 0 , 2 , 7 , 46752 },/* 30 29 30 30 29 30 30 29 30 29 30 29 0 355
-1979 */{ 6 , 1 , 28 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 29 384
-1980 */{ 0 , 2 , 16 , 38320 },/* 30 29 29 30 29 30 29 30 30 29 30 30 0 355
-1981 */{ 0 , 2 , 5 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-1982 */{ 4 , 1 , 25 , 42168 },/* 30 29 30 29 29 30 29 29 30 29 30 30 30 384
-1983 */{ 0 , 2 , 13 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-1984 */{ 10 , 2 , 2 , 45656 },/* 30 29 30 30 29 29 30 29 29 30 29 30 30 384
-1985 */{ 0 , 2 , 20 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 0 354
-1986 */{ 0 , 2 , 9 , 27968 },/* 29 30 30 29 30 30 29 30 29 30 29 29 0 354
-1987 */{ 6 , 1 , 29 , 44448 },/* 30 29 30 29 30 30 29 30 30 29 30 29 29 384
-1988 */{ 0 , 2 , 17 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-1989 */{ 0 , 2 , 6 , 38256 },/* 30 29 29 30 29 30 29 30 29 30 30 30 0 355
-1990 */{ 5 , 1 , 27 , 18808 },/* 29 30 29 29 30 29 29 30 29 30 30 30 30 384
-1991 */{ 0 , 2 , 15 , 18800 },/* 29 30 29 29 30 29 29 30 29 30 30 30 0 354
-1992 */{ 0 , 2 , 4 , 25776 },/* 29 30 30 29 29 30 29 29 30 29 30 30 0 354
-1993 */{ 3 , 1 , 23 , 27216 },/* 29 30 30 29 30 29 30 29 29 30 29 30 29 383
-1994 */{ 0 , 2 , 10 , 59984 },/* 30 30 30 29 30 29 30 29 29 30 29 30 0 355
-1995 */{ 8 , 1 , 31 , 27432 },/* 29 30 30 29 30 29 30 30 29 29 30 29 30 384
-1996 */{ 0 , 2 , 19 , 23232 },/* 29 30 29 30 30 29 30 29 30 30 29 29 0 354
-1997 */{ 0 , 2 , 7 , 43872 },/* 30 29 30 29 30 29 30 30 29 30 30 29 0 355
-1998 */{ 5 , 1 , 28 , 37736 },/* 30 29 29 30 29 29 30 30 29 30 30 29 30 384
-1999 */{ 0 , 2 , 16 , 37600 },/* 30 29 29 30 29 29 30 29 30 30 30 29 0 354
-2000 */{ 0 , 2 , 5 , 51552 },/* 30 30 29 29 30 29 29 30 29 30 30 29 0 354
-2001 */{ 4 , 1 , 24 , 54440 },/* 30 30 29 30 29 30 29 29 30 29 30 29 30 384
-2002 */{ 0 , 2 , 12 , 54432 },/* 30 30 29 30 29 30 29 29 30 29 30 29 0 354
-2003 */{ 0 , 2 , 1 , 55888 },/* 30 30 29 30 30 29 30 29 29 30 29 30 0 355
-2004 */{ 2 , 1 , 22 , 23208 },/* 29 30 29 30 30 29 30 29 30 29 30 29 30 384
-2005 */{ 0 , 2 , 9 , 22176 },/* 29 30 29 30 29 30 30 29 30 29 30 29 0 354
-2006 */{ 7 , 1 , 29 , 43736 },/* 30 29 30 29 30 29 30 29 30 30 29 30 30 385
-2007 */{ 0 , 2 , 18 , 9680 },/* 29 29 30 29 29 30 29 30 30 30 29 30 0 354
-2008 */{ 0 , 2 , 7 , 37584 },/* 30 29 29 30 29 29 30 29 30 30 29 30 0 354
-2009 */{ 5 , 1 , 26 , 51544 },/* 30 30 29 29 30 29 29 30 29 30 29 30 30 384
-2010 */{ 0 , 2 , 14 , 43344 },/* 30 29 30 29 30 29 29 30 29 30 29 30 0 354
-2011 */{ 0 , 2 , 3 , 46240 },/* 30 29 30 30 29 30 29 29 30 29 30 29 0 354
-2012 */{ 4 , 1 , 23 , 46416 },/* 30 29 30 30 29 30 29 30 29 30 29 30 29 384
-2013 */{ 0 , 2 , 10 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-2014 */{ 9 , 1 , 31 , 21928 },/* 29 30 29 30 29 30 29 30 30 29 30 29 30 384
-2015 */{ 0 , 2 , 19 , 19360 },/* 29 30 29 29 30 29 30 30 30 29 30 29 0 354
-2016 */{ 0 , 2 , 8 , 42416 },/* 30 29 30 29 29 30 29 30 30 29 30 30 0 355
-2017 */{ 6 , 1 , 28 , 21176 },/* 29 30 29 30 29 29 30 29 30 29 30 30 30 384
-2018 */{ 0 , 2 , 16 , 21168 },/* 29 30 29 30 29 29 30 29 30 29 30 30 0 354
-2019 */{ 0 , 2 , 5 , 43312 },/* 30 29 30 29 30 29 29 30 29 29 30 30 0 354
-2020 */{ 4 , 1 , 25 , 29864 },/* 29 30 30 30 29 30 29 29 30 29 30 29 30 384
-2021 */{ 0 , 2 , 12 , 27296 },/* 29 30 30 29 30 29 30 29 30 29 30 29 0 354
-2022 */{ 0 , 2 , 1 , 44368 },/* 30 29 30 29 30 30 29 30 29 30 29 30 0 355
-2023 */{ 2 , 1 , 22 , 19880 },/* 29 30 29 29 30 30 29 30 30 29 30 29 30 384
-2024 */{ 0 , 2 , 10 , 19296 },/* 29 30 29 29 30 29 30 30 29 30 30 29 0 354
-2025 */{ 6 , 1 , 29 , 42352 },/* 30 29 30 29 29 30 29 30 29 30 30 30 29 384
-2026 */{ 0 , 2 , 17 , 42208 },/* 30 29 30 29 29 30 29 29 30 30 30 29 0 354
-2027 */{ 0 , 2 , 6 , 53856 },/* 30 30 29 30 29 29 30 29 29 30 30 29 0 354
-2028 */{ 5 , 1 , 26 , 59696 },/* 30 30 30 29 30 29 29 30 29 29 30 30 29 384
-2029 */{ 0 , 2 , 13 , 54576 },/* 30 30 29 30 29 30 29 30 29 29 30 30 0 355
-2030 */{ 0 , 2 , 3 , 23200 },/* 29 30 29 30 30 29 30 29 30 29 30 29 0 354
-2031 */{ 3 , 1 , 23 , 27472 },/* 29 30 30 29 30 29 30 30 29 30 29 30 29 384
-2032 */{ 0 , 2 , 11 , 38608 },/* 30 29 29 30 29 30 30 29 30 30 29 30 0 355
-2033 */{ 11 , 1 , 31 , 19176 },/* 29 30 29 29 30 29 30 29 30 30 30 29 30 384
-2034 */{ 0 , 2 , 19 , 19152 },/* 29 30 29 29 30 29 30 29 30 30 29 30 0 354
-2035 */{ 0 , 2 , 8 , 42192 },/* 30 29 30 29 29 30 29 29 30 30 29 30 0 354
-2036 */{ 6 , 1 , 28 , 53848 },/* 30 30 29 30 29 29 30 29 29 30 29 30 30 384
-2037 */{ 0 , 2 , 15 , 53840 },/* 30 30 29 30 29 29 30 29 29 30 29 30 0 354
-2038 */{ 0 , 2 , 4 , 54560 },/* 30 30 29 30 29 30 29 30 29 29 30 29 0 354
-2039 */{ 5 , 1 , 24 , 55968 },/* 30 30 29 30 30 29 30 29 30 29 30 29 29 384
-2040 */{ 0 , 2 , 12 , 46496 },/* 30 29 30 30 29 30 29 30 30 29 30 29 0 355
-2041 */{ 0 , 2 , 1 , 22224 },/* 29 30 29 30 29 30 30 29 30 30 29 30 0 355
-2042 */{ 2 , 1 , 22 , 19160 },/* 29 30 29 29 30 29 30 29 30 30 29 30 30 384
-2043 */{ 0 , 2 , 10 , 18864 },/* 29 30 29 29 30 29 29 30 30 29 30 30 0 354
-2044 */{ 7 , 1 , 30 , 42168 },/* 30 29 30 29 29 30 29 29 30 29 30 30 30 384
-2045 */{ 0 , 2 , 17 , 42160 },/* 30 29 30 29 29 30 29 29 30 29 30 30 0 354
-2046 */{ 0 , 2 , 6 , 43600 },/* 30 29 30 29 30 29 30 29 29 30 29 30 0 354
-2047 */{ 5 , 1 , 26 , 46376 },/* 30 29 30 30 29 30 29 30 29 29 30 29 30 384
-2048 */{ 0 , 2 , 14 , 27936 },/* 29 30 30 29 30 30 29 30 29 29 30 29 0 354
-2049 */{ 0 , 2 , 2 , 44448 },/* 30 29 30 29 30 30 29 30 30 29 30 29 0 355
-2050 */{ 3 , 1 , 23 , 21936 },/* 29 30 29 30 29 30 29 30 30 29 30 30 29 384
- */};
-
-
- internal override int MinCalendarYear
- {
- get
- {
- return (MIN_LUNISOLAR_YEAR);
- }
- }
-
- internal override int MaxCalendarYear
- {
- get
- {
- return (MAX_LUNISOLAR_YEAR);
- }
- }
-
- internal override DateTime MinDate
- {
- get
- {
- return (minDate);
- }
- }
-
- internal override DateTime MaxDate
- {
- get
- {
- return (maxDate);
- }
- }
-
- internal override EraInfo[] CalEraInfo
- {
- get
- {
- return (taiwanLunisolarEraInfo);
- }
- }
-
- internal override int GetYearInfo(int lunarYear, int index)
- {
- if ((lunarYear < MIN_LUNISOLAR_YEAR) || (lunarYear > MAX_LUNISOLAR_YEAR))
- {
- throw new ArgumentOutOfRangeException(
- "year",
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- MIN_LUNISOLAR_YEAR,
- MAX_LUNISOLAR_YEAR));
- }
- Contract.EndContractBlock();
-
- return s_yinfo[lunarYear - MIN_LUNISOLAR_YEAR, index];
- }
-
- internal override int GetYear(int year, DateTime time)
- {
- return helper.GetYear(year, time);
- }
-
- internal override int GetGregorianYear(int year, int era)
- {
- return helper.GetGregorianYear(year, era);
- }
-
- public TaiwanLunisolarCalendar()
- {
- helper = new GregorianCalendarHelper(this, taiwanLunisolarEraInfo);
- }
-
- public override int GetEra(DateTime time)
- {
- return (helper.GetEra(time));
- }
-
- internal override CalendarId BaseCalendarID
- {
- get
- {
- return (CalendarId.TAIWAN);
- }
- }
-
- internal override CalendarId ID
- {
- get
- {
- return (CalendarId.TAIWANLUNISOLAR);
- }
- }
-
-
-
- public override int[] Eras
- {
- get
- {
- return (helper.Eras);
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/TextElementEnumerator.cs b/src/mscorlib/corefx/System/Globalization/TextElementEnumerator.cs
deleted file mode 100644
index 464897b03f..0000000000
--- a/src/mscorlib/corefx/System/Globalization/TextElementEnumerator.cs
+++ /dev/null
@@ -1,153 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////
-//
-//
-// Purpose:
-//
-//
-////////////////////////////////////////////////////////////////////////////
-
-using System.Collections;
-using System.Diagnostics;
-using System.Runtime.Serialization;
-
-namespace System.Globalization
-{
- //
- // This is public because GetTextElement() is public.
- //
-
- [Serializable]
- public class TextElementEnumerator : IEnumerator
- {
- private String _str;
- private int _index;
- private int _startIndex;
-
- [NonSerialized]
- private int _strLen; // This is the length of the total string, counting from the beginning of string.
-
- [NonSerialized]
- private int _currTextElementLen; // The current text element lenght after MoveNext() is called.
-
- [OptionalField(VersionAdded = 2)]
- private UnicodeCategory _uc;
-
- [OptionalField(VersionAdded = 2)]
- private int _charLen; // The next abstract char to look at after MoveNext() is called. It could be 1 or 2, depending on if it is a surrogate or not.
-
- internal TextElementEnumerator(String str, int startIndex, int strLen)
- {
- Debug.Assert(str != null, "TextElementEnumerator(): str != null");
- Debug.Assert(startIndex >= 0 && strLen >= 0, "TextElementEnumerator(): startIndex >= 0 && strLen >= 0");
- Debug.Assert(strLen >= startIndex, "TextElementEnumerator(): strLen >= startIndex");
- _str = str;
- _startIndex = startIndex;
- _strLen = strLen;
- Reset();
- }
-
- // the following fields is defined to keep the compatibility with Everett.
- // don't change/remove the names/types of these fields.
- private int _endIndex;
- private int _nextTextElementLen;
-
- [OnDeserializing]
- private void OnDeserializing(StreamingContext ctx)
- {
- _charLen = -1;
- }
-
- [OnDeserialized]
- private void OnDeserialized(StreamingContext ctx)
- {
- _strLen = _endIndex + 1;
- _currTextElementLen = _nextTextElementLen;
-
- if (_charLen == -1)
- {
- _uc = CharUnicodeInfo.InternalGetUnicodeCategory(_str, _index, out _charLen);
- }
- }
-
- [OnSerializing]
- private void OnSerializing(StreamingContext ctx)
- {
- _endIndex = _strLen - 1;
- _nextTextElementLen = _currTextElementLen;
- }
-
- public bool MoveNext()
- {
- if (_index >= _strLen)
- {
- // Make the _index to be greater than _strLen so that we can throw exception if GetTextElement() is called.
- _index = _strLen + 1;
- return (false);
- }
- _currTextElementLen = StringInfo.GetCurrentTextElementLen(_str, _index, _strLen, ref _uc, ref _charLen);
- _index += _currTextElementLen;
- return (true);
- }
-
- //
- // Get the current text element.
- //
-
- public Object Current
- {
- get
- {
- return (GetTextElement());
- }
- }
-
- //
- // Get the current text element.
- //
-
- public String GetTextElement()
- {
- if (_index == _startIndex)
- {
- throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted);
- }
- if (_index > _strLen)
- {
- throw new InvalidOperationException(SR.InvalidOperation_EnumEnded);
- }
-
- return (_str.Substring(_index - _currTextElementLen, _currTextElementLen));
- }
-
- //
- // Get the starting index of the current text element.
- //
-
- public int ElementIndex
- {
- get
- {
- if (_index == _startIndex)
- {
- throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted);
- }
- return (_index - _currTextElementLen);
- }
- }
-
-
- public void Reset()
- {
- _index = _startIndex;
- if (_index < _strLen)
- {
- // If we have more than 1 character, get the category of the current char.
- _uc = CharUnicodeInfo.InternalGetUnicodeCategory(_str, _index, out _charLen);
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs b/src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs
deleted file mode 100644
index 67836d89d6..0000000000
--- a/src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs
+++ /dev/null
@@ -1,126 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-using System.Security;
-using System.Text;
-
-namespace System.Globalization
-{
- public partial class TextInfo
- {
- [NonSerialized]
- private Tristate _needsTurkishCasing = Tristate.NotInitialized;
-
- //////////////////////////////////////////////////////////////////////////
- ////
- //// TextInfo Constructors
- ////
- //// Implements CultureInfo.TextInfo.
- ////
- //////////////////////////////////////////////////////////////////////////
- internal unsafe TextInfo(CultureData cultureData)
- {
- _cultureData = cultureData;
- _cultureName = _cultureData.CultureName;
- _textInfoName = _cultureData.STEXTINFO;
- FinishInitialization(_textInfoName);
- }
-
- private void FinishInitialization(string textInfoName)
- {
- }
-
- private unsafe string ChangeCase(string s, bool toUpper)
- {
- Debug.Assert(s != null);
-
- if (s.Length == 0)
- {
- return string.Empty;
- }
-
- string result = string.FastAllocateString(s.Length);
-
- fixed (char* pSource = s)
- {
- fixed (char* pResult = result)
- {
- if (IsAsciiCasingSameAsInvariant && s.IsAscii())
- {
- int length = s.Length;
- char* a = pSource, b = pResult;
- if (toUpper)
- {
- while (length-- != 0)
- {
- *b++ = ToUpperAsciiInvariant(*a++);
- }
- }
- else
- {
- while (length-- != 0)
- {
- *b++ = ToLowerAsciiInvariant(*a++);
- }
- }
- }
- else
- {
- ChangeCase(pSource, s.Length, pResult, result.Length, toUpper);
- }
- }
- }
-
- return result;
- }
-
- private unsafe char ChangeCase(char c, bool toUpper)
- {
- char dst = default(char);
-
- ChangeCase(&c, 1, &dst, 1, toUpper);
-
- return dst;
- }
-
- // -----------------------------
- // ---- PAL layer ends here ----
- // -----------------------------
-
- private bool NeedsTurkishCasing(string localeName)
- {
- Debug.Assert(localeName != null);
-
- return CultureInfo.GetCultureInfo(localeName).CompareInfo.Compare("\u0131", "I", CompareOptions.IgnoreCase) == 0;
- }
-
- private bool IsInvariant { get { return _cultureName.Length == 0; } }
-
- internal unsafe void ChangeCase(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper)
- {
- if (IsInvariant)
- {
- Interop.GlobalizationInterop.ChangeCaseInvariant(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper);
- }
- else
- {
- if (_needsTurkishCasing == Tristate.NotInitialized)
- {
- _needsTurkishCasing = NeedsTurkishCasing(_textInfoName) ? Tristate.True : Tristate.False;
- }
- if (_needsTurkishCasing == Tristate.True)
- {
- Interop.GlobalizationInterop.ChangeCaseTurkish(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper);
- }
- else
- {
- Interop.GlobalizationInterop.ChangeCase(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper);
- }
- }
- }
-
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/TextInfo.Windows.cs b/src/mscorlib/corefx/System/Globalization/TextInfo.Windows.cs
deleted file mode 100644
index b2f692e2d0..0000000000
--- a/src/mscorlib/corefx/System/Globalization/TextInfo.Windows.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-
-namespace System.Globalization
-{
- public partial class TextInfo
- {
- //////////////////////////////////////////////////////////////////////////
- ////
- //// TextInfo Constructors
- ////
- //// Implements CultureInfo.TextInfo.
- ////
- //////////////////////////////////////////////////////////////////////////
- internal unsafe TextInfo(CultureData cultureData)
- {
- // This is our primary data source, we don't need most of the rest of this
- _cultureData = cultureData;
- _cultureName = _cultureData.CultureName;
- _textInfoName = _cultureData.STEXTINFO;
- FinishInitialization(_textInfoName);
- }
-
- private void FinishInitialization(string textInfoName)
- {
- const uint LCMAP_SORTHANDLE = 0x20000000;
-
- long handle;
- int ret = Interop.mincore.LCMapStringEx(_textInfoName, LCMAP_SORTHANDLE, null, 0, &handle, IntPtr.Size, null, null, IntPtr.Zero);
- _sortHandle = ret > 0 ? (IntPtr)handle : IntPtr.Zero;
- }
-
- private unsafe string ChangeCase(string s, bool toUpper)
- {
- Debug.Assert(s != null);
-
- //
- // Get the length of the string.
- //
- int nLengthInput = s.Length;
-
- //
- // Check if we have the empty string.
- //
- if (nLengthInput == 0)
- {
- return s;
- }
- else
- {
- int ret;
-
- // Check for Invariant to avoid A/V in LCMapStringEx
- uint linguisticCasing = IsInvariantLocale(_textInfoName) ? 0 : LCMAP_LINGUISTIC_CASING;
-
- //
- // Create the result string.
- //
- string result = string.FastAllocateString(nLengthInput);
-
- fixed (char* pSource = s)
- fixed (char* pResult = result)
- {
- ret = Interop.mincore.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _textInfoName,
- toUpper ? LCMAP_UPPERCASE | linguisticCasing : LCMAP_LOWERCASE | linguisticCasing,
- pSource,
- nLengthInput,
- pResult,
- nLengthInput,
- null,
- null,
- _sortHandle);
- }
-
- if (0 == ret)
- {
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- }
-
- Debug.Assert(ret == nLengthInput, "Expected getting the same length of the original string");
- return result;
- }
- }
-
- private unsafe char ChangeCase(char c, bool toUpper)
- {
- char retVal = '\0';
-
- // Check for Invariant to avoid A/V in LCMapStringEx
- uint linguisticCasing = IsInvariantLocale(_textInfoName) ? 0 : LCMAP_LINGUISTIC_CASING;
-
- Interop.mincore.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _textInfoName,
- toUpper ? LCMAP_UPPERCASE | linguisticCasing : LCMAP_LOWERCASE | linguisticCasing,
- &c,
- 1,
- &retVal,
- 1,
- null,
- null,
- _sortHandle);
-
- return retVal;
- }
-
- // PAL Ends here
-
- private readonly IntPtr _sortHandle;
-
- private const uint LCMAP_LINGUISTIC_CASING = 0x01000000;
- private const uint LCMAP_LOWERCASE = 0x00000100;
- private const uint LCMAP_UPPERCASE = 0x00000200;
-
- private static bool IsInvariantLocale(string localeName)
- {
- return localeName == "";
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/TextInfo.cs b/src/mscorlib/corefx/System/Globalization/TextInfo.cs
deleted file mode 100644
index 172bbd25b2..0000000000
--- a/src/mscorlib/corefx/System/Globalization/TextInfo.cs
+++ /dev/null
@@ -1,746 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////
-//
-//
-// Purpose: This Class defines behaviors specific to a writing system.
-// A writing system is the collection of scripts and
-// orthographic rules required to represent a language as text.
-//
-//
-////////////////////////////////////////////////////////////////////////////
-
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-using System.Runtime.Serialization;
-using System.Text;
-
-namespace System.Globalization
-{
- [Serializable]
- public partial class TextInfo : ICloneable, IDeserializationCallback
- {
- ////--------------------------------------------------------------------//
- //// Internal Information //
- ////--------------------------------------------------------------------//
-
- private enum Tristate : byte
- {
- NotInitialized,
- True,
- False,
- }
-
- ////
- //// Variables.
- ////
-
- [OptionalField(VersionAdded = 2)]
- private String _listSeparator;
- [OptionalField(VersionAdded = 2)]
- private bool _isReadOnly = false;
-
- //// _cultureName is the name of the creating culture. Note that we consider this authoratative,
- //// if the culture's textinfo changes when deserializing, then behavior may change.
- //// (ala Whidbey behavior). This is the only string Arrowhead needs to serialize.
- //// _cultureData is the data that backs this class.
- //// _textInfoName is the actual name of the textInfo (from cultureData.STEXTINFO)
- //// this can be the same as _cultureName on Silverlight since the OS knows
- //// how to do the sorting. However in the desktop, when we call the sorting dll, it doesn't
- //// know how to resolve custom locle names to sort ids so we have to have alredy resolved this.
- ////
-
- [OptionalField(VersionAdded = 3)]
- private String _cultureName; // Name of the culture that created this text info
- [NonSerialized]
- private CultureData _cultureData; // Data record for the culture that made us, not for this textinfo
- [NonSerialized]
- private String _textInfoName; // Name of the text info we're using (ie: _cultureData.STEXTINFO)
- [NonSerialized]
- private Tristate _isAsciiCasingSameAsInvariant = Tristate.NotInitialized;
-
- // Invariant text info
- internal static TextInfo Invariant
- {
- get
- {
- if (s_Invariant == null)
- s_Invariant = new TextInfo(CultureData.Invariant);
- return s_Invariant;
- }
- }
- internal volatile static TextInfo s_Invariant;
-
- [OnSerializing]
- private void OnSerializing(StreamingContext ctx) { }
-
- [OnDeserializing]
- private void OnDeserializing(StreamingContext ctx)
- {
- // Clear these so we can check if we've fixed them yet
- _cultureData = null;
- _cultureName = null;
- }
-
- [OnDeserialized]
- private void OnDeserialized(StreamingContext ctx)
- {
- OnDeserialized();
- }
-
- void IDeserializationCallback.OnDeserialization(Object sender)
- {
- OnDeserialized();
- }
-
- private void OnDeserialized()
- {
- // this method will be called twice because of the support of IDeserializationCallback
- if (_cultureData == null)
- {
- // Get the text info name belonging to that culture
- _cultureData = CultureInfo.GetCultureInfo(_cultureName).m_cultureData;
- _textInfoName = _cultureData.STEXTINFO;
- FinishInitialization(_textInfoName);
- }
- }
-
- //
- // Internal ordinal comparison functions
- //
-
- internal static int GetHashCodeOrdinalIgnoreCase(String s)
- {
- // This is the same as an case insensitive hash for Invariant
- // (not necessarily true for sorting, but OK for casing & then we apply normal hash code rules)
- return (Invariant.GetCaseInsensitiveHashCode(s));
- }
-
- // Currently we don't have native functions to do this, so we do it the hard way
- internal static int IndexOfStringOrdinalIgnoreCase(String source, String value, int startIndex, int count)
- {
- if (count > source.Length || count < 0 || startIndex < 0 || startIndex >= source.Length || startIndex + count > source.Length)
- {
- return -1;
- }
-
- return CompareInfo.IndexOfOrdinal(source, value, startIndex, count, ignoreCase: true);
- }
-
- // Currently we don't have native functions to do this, so we do it the hard way
- internal static int LastIndexOfStringOrdinalIgnoreCase(String source, String value, int startIndex, int count)
- {
- if (count > source.Length || count < 0 || startIndex < 0 || startIndex > source.Length - 1 || (startIndex - count + 1 < 0))
- {
- return -1;
- }
-
- return CompareInfo.LastIndexOfOrdinal(source, value, startIndex, count, ignoreCase: true);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // CodePage
- //
- // Returns the number of the code page used by this writing system.
- // The type parameter can be any of the following values:
- // ANSICodePage
- // OEMCodePage
- // MACCodePage
- //
- ////////////////////////////////////////////////////////////////////////
-
-
- public virtual int ANSICodePage
- {
- get
- {
- return (_cultureData.IDEFAULTANSICODEPAGE);
- }
- }
-
-
- public virtual int OEMCodePage
- {
- get
- {
- return (_cultureData.IDEFAULTOEMCODEPAGE);
- }
- }
-
-
- public virtual int MacCodePage
- {
- get
- {
- return (_cultureData.IDEFAULTMACCODEPAGE);
- }
- }
-
-
- public virtual int EBCDICCodePage
- {
- get
- {
- return (_cultureData.IDEFAULTEBCDICCODEPAGE);
- }
- }
-
- public int LCID
- {
- get
- {
- // Just use the LCID from our text info name
- return CultureInfo.GetCultureInfo(_textInfoName).LCID;
- }
- }
-
- //////////////////////////////////////////////////////////////////////////
- ////
- //// CultureName
- ////
- //// The name of the culture associated with the current TextInfo.
- ////
- //////////////////////////////////////////////////////////////////////////
- public string CultureName
- {
- get
- {
- return _textInfoName;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // IsReadOnly
- //
- // Detect if the object is readonly.
- //
- ////////////////////////////////////////////////////////////////////////
- public bool IsReadOnly
- {
- get { return (_isReadOnly); }
- }
-
- //////////////////////////////////////////////////////////////////////////
- ////
- //// Clone
- ////
- //// Is the implementation of ICloneable.
- ////
- //////////////////////////////////////////////////////////////////////////
- public virtual object Clone()
- {
- object o = MemberwiseClone();
- ((TextInfo)o).SetReadOnlyState(false);
- return (o);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ReadOnly
- //
- // Create a cloned readonly instance or return the input one if it is
- // readonly.
- //
- ////////////////////////////////////////////////////////////////////////
- public static TextInfo ReadOnly(TextInfo textInfo)
- {
- if (textInfo == null) { throw new ArgumentNullException(nameof(textInfo)); }
- Contract.EndContractBlock();
- if (textInfo.IsReadOnly) { return (textInfo); }
-
- TextInfo clonedTextInfo = (TextInfo)(textInfo.MemberwiseClone());
- clonedTextInfo.SetReadOnlyState(true);
-
- return (clonedTextInfo);
- }
-
- private void VerifyWritable()
- {
- if (_isReadOnly)
- {
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- }
- }
-
- internal void SetReadOnlyState(bool readOnly)
- {
- _isReadOnly = readOnly;
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ListSeparator
- //
- // Returns the string used to separate items in a list.
- //
- ////////////////////////////////////////////////////////////////////////
- public virtual String ListSeparator
- {
- get
- {
- if (_listSeparator == null)
- {
- _listSeparator = _cultureData.SLIST;
- }
- return (_listSeparator);
- }
-
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value), SR.ArgumentNull_String);
- }
- VerifyWritable();
- _listSeparator = value;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ToLower
- //
- // Converts the character or string to lower case. Certain locales
- // have different casing semantics from the file systems in Win32.
- //
- ////////////////////////////////////////////////////////////////////////
- public unsafe virtual char ToLower(char c)
- {
- if (IsAscii(c) && IsAsciiCasingSameAsInvariant)
- {
- return ToLowerAsciiInvariant(c);
- }
- return (ChangeCase(c, toUpper: false));
- }
-
- public unsafe virtual String ToLower(String str)
- {
- if (str == null) { throw new ArgumentNullException(nameof(str)); }
-
- return ChangeCase(str, toUpper: false);
- }
-
- private static Char ToLowerAsciiInvariant(Char c)
- {
- if ((uint)(c - 'A') <= (uint)('Z' - 'A'))
- {
- c = (Char)(c | 0x20);
- }
- return c;
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ToUpper
- //
- // Converts the character or string to upper case. Certain locales
- // have different casing semantics from the file systems in Win32.
- //
- ////////////////////////////////////////////////////////////////////////
- public unsafe virtual char ToUpper(char c)
- {
- if (IsAscii(c) && IsAsciiCasingSameAsInvariant)
- {
- return ToUpperAsciiInvariant(c);
- }
- return (ChangeCase(c, toUpper: true));
- }
-
- public unsafe virtual String ToUpper(String str)
- {
- if (str == null) { throw new ArgumentNullException(nameof(str)); }
-
- return ChangeCase(str, toUpper: true);
- }
-
- private static Char ToUpperAsciiInvariant(Char c)
- {
- if ((uint)(c - 'a') <= (uint)('z' - 'a'))
- {
- c = (Char)(c & ~0x20);
- }
- return c;
- }
-
- private static bool IsAscii(Char c)
- {
- return c < 0x80;
- }
-
- private bool IsAsciiCasingSameAsInvariant
- {
- get
- {
- if (_isAsciiCasingSameAsInvariant == Tristate.NotInitialized)
- {
- _isAsciiCasingSameAsInvariant = CultureInfo.GetCultureInfo(_textInfoName).CompareInfo.Compare("abcdefghijklmnopqrstuvwxyz",
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
- CompareOptions.IgnoreCase) == 0 ? Tristate.True : Tristate.False;
- }
- return _isAsciiCasingSameAsInvariant == Tristate.True;
- }
- }
-
- // IsRightToLeft
- //
- // Returns true if the dominant direction of text and UI such as the relative position of buttons and scroll bars
- //
- public bool IsRightToLeft
- {
- get
- {
- return _cultureData.IsRightToLeft;
- }
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // Equals
- //
- // Implements Object.Equals(). Returns a boolean indicating whether
- // or not object refers to the same CultureInfo as the current instance.
- //
- ////////////////////////////////////////////////////////////////////////
- public override bool Equals(Object obj)
- {
- TextInfo that = obj as TextInfo;
-
- if (that != null)
- {
- return this.CultureName.Equals(that.CultureName);
- }
-
- return (false);
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // GetHashCode
- //
- // Implements Object.GetHashCode(). Returns the hash code for the
- // CultureInfo. The hash code is guaranteed to be the same for CultureInfo A
- // and B where A.Equals(B) is true.
- //
- ////////////////////////////////////////////////////////////////////////
- public override int GetHashCode()
- {
- return (this.CultureName.GetHashCode());
- }
-
- ////////////////////////////////////////////////////////////////////////
- //
- // ToString
- //
- // Implements Object.ToString(). Returns a string describing the
- // TextInfo.
- //
- ////////////////////////////////////////////////////////////////////////
- public override String ToString()
- {
- return ("TextInfo - " + _cultureData.CultureName);
- }
-
- //
- // Titlecasing:
- // -----------
- // Titlecasing refers to a casing practice wherein the first letter of a word is an uppercase letter
- // and the rest of the letters are lowercase. The choice of which words to titlecase in headings
- // and titles is dependent on language and local conventions. For example, "The Merry Wives of Windor"
- // is the appropriate titlecasing of that play's name in English, with the word "of" not titlecased.
- // In German, however, the title is "Die lustigen Weiber von Windsor," and both "lustigen" and "von"
- // are not titlecased. In French even fewer words are titlecased: "Les joyeuses commeres de Windsor."
- //
- // Moreover, the determination of what actually constitutes a word is language dependent, and this can
- // influence which letter or letters of a "word" are uppercased when titlecasing strings. For example
- // "l'arbre" is considered two words in French, whereas "can't" is considered one word in English.
- //
- public unsafe String ToTitleCase(String str)
- {
- if (str == null)
- {
- throw new ArgumentNullException(nameof(str));
- }
- Contract.EndContractBlock();
- if (str.Length == 0)
- {
- return (str);
- }
-
- StringBuilder result = new StringBuilder();
- string lowercaseData = null;
-
- for (int i = 0; i < str.Length; i++)
- {
- UnicodeCategory charType;
- int charLen;
-
- charType = CharUnicodeInfo.InternalGetUnicodeCategory(str, i, out charLen);
- if (Char.CheckLetter(charType))
- {
- // Do the titlecasing for the first character of the word.
- i = AddTitlecaseLetter(ref result, ref str, i, charLen) + 1;
-
- //
- // Convert the characters until the end of the this word
- // to lowercase.
- //
- int lowercaseStart = i;
-
- //
- // Use hasLowerCase flag to prevent from lowercasing acronyms (like "URT", "USA", etc)
- // This is in line with Word 2000 behavior of titlecasing.
- //
- bool hasLowerCase = (charType == UnicodeCategory.LowercaseLetter);
- // Use a loop to find all of the other letters following this letter.
- while (i < str.Length)
- {
- charType = CharUnicodeInfo.InternalGetUnicodeCategory(str, i, out charLen);
- if (IsLetterCategory(charType))
- {
- if (charType == UnicodeCategory.LowercaseLetter)
- {
- hasLowerCase = true;
- }
- i += charLen;
- }
- else if (str[i] == '\'')
- {
- i++;
- if (hasLowerCase)
- {
- if (lowercaseData == null)
- {
- lowercaseData = this.ToLower(str);
- }
- result.Append(lowercaseData, lowercaseStart, i - lowercaseStart);
- }
- else
- {
- result.Append(str, lowercaseStart, i - lowercaseStart);
- }
- lowercaseStart = i;
- hasLowerCase = true;
- }
- else if (!IsWordSeparator(charType))
- {
- // This category is considered to be part of the word.
- // This is any category that is marked as false in wordSeprator array.
- i+= charLen;
- }
- else
- {
- // A word separator. Break out of the loop.
- break;
- }
- }
-
- int count = i - lowercaseStart;
-
- if (count > 0)
- {
- if (hasLowerCase)
- {
- if (lowercaseData == null)
- {
- lowercaseData = this.ToLower(str);
- }
- result.Append(lowercaseData, lowercaseStart, count);
- }
- else
- {
- result.Append(str, lowercaseStart, count);
- }
- }
-
- if (i < str.Length)
- {
- // not a letter, just append it
- i = AddNonLetter(ref result, ref str, i, charLen);
- }
- }
- else
- {
- // not a letter, just append it
- i = AddNonLetter(ref result, ref str, i, charLen);
- }
- }
- return (result.ToString());
- }
-
- private static int AddNonLetter(ref StringBuilder result, ref String input, int inputIndex, int charLen)
- {
- Debug.Assert(charLen == 1 || charLen == 2, "[TextInfo.AddNonLetter] CharUnicodeInfo.InternalGetUnicodeCategory returned an unexpected charLen!");
- if (charLen == 2)
- {
- // Surrogate pair
- result.Append(input[inputIndex++]);
- result.Append(input[inputIndex]);
- }
- else
- {
- result.Append(input[inputIndex]);
- }
- return inputIndex;
- }
-
- private int AddTitlecaseLetter(ref StringBuilder result, ref String input, int inputIndex, int charLen)
- {
- Debug.Assert(charLen == 1 || charLen == 2, "[TextInfo.AddTitlecaseLetter] CharUnicodeInfo.InternalGetUnicodeCategory returned an unexpected charLen!");
-
- // for surrogate pairs do a simple ToUpper operation on the substring
- if (charLen == 2)
- {
- // Surrogate pair
- result.Append(ToUpper(input.Substring(inputIndex, charLen)));
- inputIndex++;
- }
- else
- {
- switch (input[inputIndex])
- {
- //
- // For AppCompat, the Titlecase Case Mapping data from NDP 2.0 is used below.
- case (char) 0x01C4: // DZ with Caron -> Dz with Caron
- case (char) 0x01C5: // Dz with Caron -> Dz with Caron
- case (char) 0x01C6: // dz with Caron -> Dz with Caron
- result.Append((char) 0x01C5);
- break;
- case (char) 0x01C7: // LJ -> Lj
- case (char) 0x01C8: // Lj -> Lj
- case (char) 0x01C9: // lj -> Lj
- result.Append((char) 0x01C8);
- break;
- case (char) 0x01CA: // NJ -> Nj
- case (char) 0x01CB: // Nj -> Nj
- case (char) 0x01CC: // nj -> Nj
- result.Append((char) 0x01CB);
- break;
- case (char) 0x01F1: // DZ -> Dz
- case (char) 0x01F2: // Dz -> Dz
- case (char) 0x01F3: // dz -> Dz
- result.Append((char) 0x01F2);
- break;
- default:
- result.Append(ToUpper(input[inputIndex]));
- break;
- }
- }
- return inputIndex;
- }
-
- //
- // Used in ToTitleCase():
- // When we find a starting letter, the following array decides if a category should be
- // considered as word seprator or not.
- //
- private const int c_wordSeparatorMask =
- /* false */ (0 << 0) | // UppercaseLetter = 0,
- /* false */ (0 << 1) | // LowercaseLetter = 1,
- /* false */ (0 << 2) | // TitlecaseLetter = 2,
- /* false */ (0 << 3) | // ModifierLetter = 3,
- /* false */ (0 << 4) | // OtherLetter = 4,
- /* false */ (0 << 5) | // NonSpacingMark = 5,
- /* false */ (0 << 6) | // SpacingCombiningMark = 6,
- /* false */ (0 << 7) | // EnclosingMark = 7,
- /* false */ (0 << 8) | // DecimalDigitNumber = 8,
- /* false */ (0 << 9) | // LetterNumber = 9,
- /* false */ (0 << 10) | // OtherNumber = 10,
- /* true */ (1 << 11) | // SpaceSeparator = 11,
- /* true */ (1 << 12) | // LineSeparator = 12,
- /* true */ (1 << 13) | // ParagraphSeparator = 13,
- /* true */ (1 << 14) | // Control = 14,
- /* true */ (1 << 15) | // Format = 15,
- /* false */ (0 << 16) | // Surrogate = 16,
- /* false */ (0 << 17) | // PrivateUse = 17,
- /* true */ (1 << 18) | // ConnectorPunctuation = 18,
- /* true */ (1 << 19) | // DashPunctuation = 19,
- /* true */ (1 << 20) | // OpenPunctuation = 20,
- /* true */ (1 << 21) | // ClosePunctuation = 21,
- /* true */ (1 << 22) | // InitialQuotePunctuation = 22,
- /* true */ (1 << 23) | // FinalQuotePunctuation = 23,
- /* true */ (1 << 24) | // OtherPunctuation = 24,
- /* true */ (1 << 25) | // MathSymbol = 25,
- /* true */ (1 << 26) | // CurrencySymbol = 26,
- /* true */ (1 << 27) | // ModifierSymbol = 27,
- /* true */ (1 << 28) | // OtherSymbol = 28,
- /* false */ (0 << 29); // OtherNotAssigned = 29;
-
- private static bool IsWordSeparator(UnicodeCategory category)
- {
- return (c_wordSeparatorMask & (1 << (int) category)) != 0;
- }
-
- private static bool IsLetterCategory(UnicodeCategory uc)
- {
- return (uc == UnicodeCategory.UppercaseLetter
- || uc == UnicodeCategory.LowercaseLetter
- || uc == UnicodeCategory.TitlecaseLetter
- || uc == UnicodeCategory.ModifierLetter
- || uc == UnicodeCategory.OtherLetter);
- }
-
- //
- // Get case-insensitive hash code for the specified string.
- //
- internal unsafe int GetCaseInsensitiveHashCode(String str)
- {
- // Validate inputs
- if (str == null)
- {
- throw new ArgumentNullException(nameof(str));
- }
-
- // This code assumes that ASCII casing is safe for whatever context is passed in.
- // this is true today, because we only ever call these methods on Invariant. It would be ideal to refactor
- // these methods so they were correct by construction and we could only ever use Invariant.
-
- uint hash = 5381;
- uint c;
-
- // Note: We assume that str contains only ASCII characters until
- // we hit a non-ASCII character to optimize the common case.
- for (int i = 0; i < str.Length; i++)
- {
- c = str[i];
- if (c >= 0x80)
- {
- return GetCaseInsensitiveHashCodeSlow(str);
- }
-
- // If we have a lowercase character, ANDing off 0x20
- // will make it an uppercase character.
- if ((c - 'a') <= ('z' - 'a'))
- {
- c = (uint)((int)c & ~0x20);
- }
-
- hash = ((hash << 5) + hash) ^ c;
- }
-
- return (int)hash;
- }
-
- private unsafe int GetCaseInsensitiveHashCodeSlow(String str)
- {
- Debug.Assert(str != null);
-
- string upper = ToUpper(str);
-
- uint hash = 5381;
- uint c;
-
- for (int i = 0; i < upper.Length; i++)
- {
- c = upper[i];
- hash = ((hash << 5) + hash) ^ c;
- }
-
- return (int)hash;
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/ThaiBuddhistCalendar.cs b/src/mscorlib/corefx/System/Globalization/ThaiBuddhistCalendar.cs
deleted file mode 100644
index 9e6e30406c..0000000000
--- a/src/mscorlib/corefx/System/Globalization/ThaiBuddhistCalendar.cs
+++ /dev/null
@@ -1,236 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics.CodeAnalysis;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- /*=================================ThaiBuddhistCalendar==========================
- **
- ** ThaiBuddhistCalendar is based on Gregorian calendar. Its year value has
- ** an offset to the Gregorain calendar.
- **
- ** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 0001/01/01 9999/12/31
- ** Thai 0544/01/01 10542/12/31
- ============================================================================*/
-
- [Serializable]
- public class ThaiBuddhistCalendar : Calendar
- {
- // Initialize our era info.
- internal static EraInfo[] thaiBuddhistEraInfo = new EraInfo[] {
- new EraInfo( 1, 1, 1, 1, -543, 544, GregorianCalendar.MaxYear + 543) // era #, start year/month/day, yearOffset, minEraYear
- };
-
- //
- // The era value for the current era.
- //
-
- public const int ThaiBuddhistEra = 1;
-
- internal GregorianCalendarHelper helper;
-
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (DateTime.MinValue);
- }
- }
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (DateTime.MaxValue);
- }
- }
-
- public override CalendarAlgorithmType AlgorithmType
- {
- get
- {
- return CalendarAlgorithmType.SolarCalendar;
- }
- }
-
- public ThaiBuddhistCalendar()
- {
- helper = new GregorianCalendarHelper(this, thaiBuddhistEraInfo);
- }
-
- internal override CalendarId ID
- {
- get
- {
- return (CalendarId.THAI);
- }
- }
-
-
- public override DateTime AddMonths(DateTime time, int months)
- {
- return (helper.AddMonths(time, months));
- }
-
-
- public override DateTime AddYears(DateTime time, int years)
- {
- return (helper.AddYears(time, years));
- }
-
-
- public override int GetDaysInMonth(int year, int month, int era)
- {
- return (helper.GetDaysInMonth(year, month, era));
- }
-
-
- public override int GetDaysInYear(int year, int era)
- {
- return (helper.GetDaysInYear(year, era));
- }
-
-
- public override int GetDayOfMonth(DateTime time)
- {
- return (helper.GetDayOfMonth(time));
- }
-
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- return (helper.GetDayOfWeek(time));
- }
-
-
- public override int GetDayOfYear(DateTime time)
- {
- return (helper.GetDayOfYear(time));
- }
-
-
- public override int GetMonthsInYear(int year, int era)
- {
- return (helper.GetMonthsInYear(year, era));
- }
-
-
- [SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
- public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
- {
- return (helper.GetWeekOfYear(time, rule, firstDayOfWeek));
- }
-
-
- public override int GetEra(DateTime time)
- {
- return (helper.GetEra(time));
- }
-
- public override int GetMonth(DateTime time)
- {
- return (helper.GetMonth(time));
- }
-
-
- public override int GetYear(DateTime time)
- {
- return (helper.GetYear(time));
- }
-
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- return (helper.IsLeapDay(year, month, day, era));
- }
-
-
- public override bool IsLeapYear(int year, int era)
- {
- return (helper.IsLeapYear(year, era));
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
-
- public override int GetLeapMonth(int year, int era)
- {
- return (helper.GetLeapMonth(year, era));
- }
-
-
- public override bool IsLeapMonth(int year, int month, int era)
- {
- return (helper.IsLeapMonth(year, month, era));
- }
-
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- return (helper.ToDateTime(year, month, day, hour, minute, second, millisecond, era));
- }
-
-
- public override int[] Eras
- {
- get
- {
- return (helper.Eras);
- }
- }
-
- private const int DEFAULT_TWO_DIGIT_YEAR_MAX = 2572;
-
-
- public override int TwoDigitYearMax
- {
- get
- {
- if (twoDigitYearMax == -1)
- {
- twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
- }
- return (twoDigitYearMax);
- }
-
- set
- {
- VerifyWritable();
- if (value < 99 || value > helper.MaxYear)
- {
- throw new ArgumentOutOfRangeException(
- "year",
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- 99,
- helper.MaxYear));
- }
- twoDigitYearMax = value;
- }
- }
-
-
- public override int ToFourDigitYear(int year)
- {
- if (year < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedNonNegNum);
- }
- Contract.EndContractBlock();
-
- return (helper.ToFourDigitYear(year, this.TwoDigitYearMax));
- }
- }
-}
-
diff --git a/src/mscorlib/corefx/System/Globalization/TimeSpanStyles.cs b/src/mscorlib/corefx/System/Globalization/TimeSpanStyles.cs
deleted file mode 100644
index 68a47bcbe6..0000000000
--- a/src/mscorlib/corefx/System/Globalization/TimeSpanStyles.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Globalization
-{
- [Flags]
- public enum TimeSpanStyles
- {
- None = 0x00000000,
- AssumeNegative = 0x00000001,
- }
-}
diff --git a/src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs b/src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs
deleted file mode 100644
index 7b47d9c02b..0000000000
--- a/src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs
+++ /dev/null
@@ -1,870 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-
-namespace System.Globalization
-{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about UmAlQuraCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
- /*
- ** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 1900/04/30 2077/05/13
- ** UmAlQura 1318/01/01 1500/12/30
- */
-
- [Serializable]
- public partial class UmAlQuraCalendar : Calendar
- {
- internal const int MinCalendarYear = 1318;
- internal const int MaxCalendarYear = 1500;
-
- internal struct DateMapping
- {
- internal DateMapping(int MonthsLengthFlags, int GYear, int GMonth, int GDay)
- {
- HijriMonthsLengthFlags = MonthsLengthFlags;
- GregorianDate = new DateTime(GYear, GMonth, GDay);
- }
- internal int HijriMonthsLengthFlags;
- internal DateTime GregorianDate;
- }
-
- private static readonly DateMapping[] s_hijriYearInfo = InitDateMapping();
-
- private static DateMapping[] InitDateMapping()
- {
- short[] rawData = new short[]
- {
- //These data is taken from Tables/Excel/UmAlQura.xls please make sure that the two places are in sync
- /* DaysPerM GY GM GD D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12
- 1318*/0x02EA, 1900, 4, 30,/* 0 1 0 1 0 1 1 1 0 1 0 0 4/30/1900
- 1319*/0x06E9, 1901, 4, 19,/* 1 0 0 1 0 1 1 1 0 1 1 0 4/19/1901
- 1320*/0x0ED2, 1902, 4, 9,/* 0 1 0 0 1 0 1 1 0 1 1 1 4/9/1902
- 1321*/0x0EA4, 1903, 3, 30,/* 0 0 1 0 0 1 0 1 0 1 1 1 3/30/1903
- 1322*/0x0D4A, 1904, 3, 18,/* 0 1 0 1 0 0 1 0 1 0 1 1 3/18/1904
- 1323*/0x0A96, 1905, 3, 7,/* 0 1 1 0 1 0 0 1 0 1 0 1 3/7/1905
- 1324*/0x0536, 1906, 2, 24,/* 0 1 1 0 1 1 0 0 1 0 1 0 2/24/1906
- 1325*/0x0AB5, 1907, 2, 13,/* 1 0 1 0 1 1 0 1 0 1 0 1 2/13/1907
- 1326*/0x0DAA, 1908, 2, 3,/* 0 1 0 1 0 1 0 1 1 0 1 1 2/3/1908
- 1327*/0x0BA4, 1909, 1, 23,/* 0 0 1 0 0 1 0 1 1 1 0 1 1/23/1909
- 1328*/0x0B49, 1910, 1, 12,/* 1 0 0 1 0 0 1 0 1 1 0 1 1/12/1910
- 1329*/0x0A93, 1911, 1, 1,/* 1 1 0 0 1 0 0 1 0 1 0 1 1/1/1911
- 1330*/0x052B, 1911, 12, 21,/* 1 1 0 1 0 1 0 0 1 0 1 0 12/21/1911
- 1331*/0x0A57, 1912, 12, 9,/* 1 1 1 0 1 0 1 0 0 1 0 1 12/9/1912
- 1332*/0x04B6, 1913, 11, 29,/* 0 1 1 0 1 1 0 1 0 0 1 0 11/29/1913
- 1333*/0x0AB5, 1914, 11, 18,/* 1 0 1 0 1 1 0 1 0 1 0 1 11/18/1914
- 1334*/0x05AA, 1915, 11, 8,/* 0 1 0 1 0 1 0 1 1 0 1 0 11/8/1915
- 1335*/0x0D55, 1916, 10, 27,/* 1 0 1 0 1 0 1 0 1 0 1 1 10/27/1916
- 1336*/0x0D2A, 1917, 10, 17,/* 0 1 0 1 0 1 0 0 1 0 1 1 10/17/1917
- 1337*/0x0A56, 1918, 10, 6,/* 0 1 1 0 1 0 1 0 0 1 0 1 10/6/1918
- 1338*/0x04AE, 1919, 9, 25,/* 0 1 1 1 0 1 0 1 0 0 1 0 9/25/1919
- 1339*/0x095D, 1920, 9, 13,/* 1 0 1 1 1 0 1 0 1 0 0 1 9/13/1920
- 1340*/0x02EC, 1921, 9, 3,/* 0 0 1 1 0 1 1 1 0 1 0 0 9/3/1921
- 1341*/0x06D5, 1922, 8, 23,/* 1 0 1 0 1 0 1 1 0 1 1 0 8/23/1922
- 1342*/0x06AA, 1923, 8, 13,/* 0 1 0 1 0 1 0 1 0 1 1 0 8/13/1923
- 1343*/0x0555, 1924, 8, 1,/* 1 0 1 0 1 0 1 0 1 0 1 0 8/1/1924
- 1344*/0x04AB, 1925, 7, 21,/* 1 1 0 1 0 1 0 1 0 0 1 0 7/21/1925
- 1345*/0x095B, 1926, 7, 10,/* 1 1 0 1 1 0 1 0 1 0 0 1 7/10/1926
- 1346*/0x02BA, 1927, 6, 30,/* 0 1 0 1 1 1 0 1 0 1 0 0 6/30/1927
- 1347*/0x0575, 1928, 6, 18,/* 1 0 1 0 1 1 1 0 1 0 1 0 6/18/1928
- 1348*/0x0BB2, 1929, 6, 8,/* 0 1 0 0 1 1 0 1 1 1 0 1 6/8/1929
- 1349*/0x0764, 1930, 5, 29,/* 0 0 1 0 0 1 1 0 1 1 1 0 5/29/1930
- 1350*/0x0749, 1931, 5, 18,/* 1 0 0 1 0 0 1 0 1 1 1 0 5/18/1931
- 1351*/0x0655, 1932, 5, 6,/* 1 0 1 0 1 0 1 0 0 1 1 0 5/6/1932
- 1352*/0x02AB, 1933, 4, 25,/* 1 1 0 1 0 1 0 1 0 1 0 0 4/25/1933
- 1353*/0x055B, 1934, 4, 14,/* 1 1 0 1 1 0 1 0 1 0 1 0 4/14/1934
- 1354*/0x0ADA, 1935, 4, 4,/* 0 1 0 1 1 0 1 1 0 1 0 1 4/4/1935
- 1355*/0x06D4, 1936, 3, 24,/* 0 0 1 0 1 0 1 1 0 1 1 0 3/24/1936
- 1356*/0x0EC9, 1937, 3, 13,/* 1 0 0 1 0 0 1 1 0 1 1 1 3/13/1937
- 1357*/0x0D92, 1938, 3, 3,/* 0 1 0 0 1 0 0 1 1 0 1 1 3/3/1938
- 1358*/0x0D25, 1939, 2, 20,/* 1 0 1 0 0 1 0 0 1 0 1 1 2/20/1939
- 1359*/0x0A4D, 1940, 2, 9,/* 1 0 1 1 0 0 1 0 0 1 0 1 2/9/1940
- 1360*/0x02AD, 1941, 1, 28,/* 1 0 1 1 0 1 0 1 0 1 0 0 1/28/1941
- 1361*/0x056D, 1942, 1, 17,/* 1 0 1 1 0 1 1 0 1 0 1 0 1/17/1942
- 1362*/0x0B6A, 1943, 1, 7,/* 0 1 0 1 0 1 1 0 1 1 0 1 1/7/1943
- 1363*/0x0B52, 1943, 12, 28,/* 0 1 0 0 1 0 1 0 1 1 0 1 12/28/1943
- 1364*/0x0AA5, 1944, 12, 16,/* 1 0 1 0 0 1 0 1 0 1 0 1 12/16/1944
- 1365*/0x0A4B, 1945, 12, 5,/* 1 1 0 1 0 0 1 0 0 1 0 1 12/5/1945
- 1366*/0x0497, 1946, 11, 24,/* 1 1 1 0 1 0 0 1 0 0 1 0 11/24/1946
- 1367*/0x0937, 1947, 11, 13,/* 1 1 1 0 1 1 0 0 1 0 0 1 11/13/1947
- 1368*/0x02B6, 1948, 11, 2,/* 0 1 1 0 1 1 0 1 0 1 0 0 11/2/1948
- 1369*/0x0575, 1949, 10, 22,/* 1 0 1 0 1 1 1 0 1 0 1 0 10/22/1949
- 1370*/0x0D6A, 1950, 10, 12,/* 0 1 0 1 0 1 1 0 1 0 1 1 10/12/1950
- 1371*/0x0D52, 1951, 10, 2,/* 0 1 0 0 1 0 1 0 1 0 1 1 10/2/1951
- 1372*/0x0A96, 1952, 9, 20,/* 0 1 1 0 1 0 0 1 0 1 0 1 9/20/1952
- 1373*/0x092D, 1953, 9, 9,/* 1 0 1 1 0 1 0 0 1 0 0 1 9/9/1953
- 1374*/0x025D, 1954, 8, 29,/* 1 0 1 1 1 0 1 0 0 1 0 0 8/29/1954
- 1375*/0x04DD, 1955, 8, 18,/* 1 0 1 1 1 0 1 1 0 0 1 0 8/18/1955
- 1376*/0x0ADA, 1956, 8, 7,/* 0 1 0 1 1 0 1 1 0 1 0 1 8/7/1956
- 1377*/0x05D4, 1957, 7, 28,/* 0 0 1 0 1 0 1 1 1 0 1 0 7/28/1957
- 1378*/0x0DA9, 1958, 7, 17,/* 1 0 0 1 0 1 0 1 1 0 1 1 7/17/1958
- 1379*/0x0D52, 1959, 7, 7,/* 0 1 0 0 1 0 1 0 1 0 1 1 7/7/1959
- 1380*/0x0AAA, 1960, 6, 25,/* 0 1 0 1 0 1 0 1 0 1 0 1 6/25/1960
- 1381*/0x04D6, 1961, 6, 14,/* 0 1 1 0 1 0 1 1 0 0 1 0 6/14/1961
- 1382*/0x09B6, 1962, 6, 3,/* 0 1 1 0 1 1 0 1 1 0 0 1 6/3/1962
- 1383*/0x0374, 1963, 5, 24,/* 0 0 1 0 1 1 1 0 1 1 0 0 5/24/1963
- 1384*/0x0769, 1964, 5, 12,/* 1 0 0 1 0 1 1 0 1 1 1 0 5/12/1964
- 1385*/0x0752, 1965, 5, 2,/* 0 1 0 0 1 0 1 0 1 1 1 0 5/2/1965
- 1386*/0x06A5, 1966, 4, 21,/* 1 0 1 0 0 1 0 1 0 1 1 0 4/21/1966
- 1387*/0x054B, 1967, 4, 10,/* 1 1 0 1 0 0 1 0 1 0 1 0 4/10/1967
- 1388*/0x0AAB, 1968, 3, 29,/* 1 1 0 1 0 1 0 1 0 1 0 1 3/29/1968
- 1389*/0x055A, 1969, 3, 19,/* 0 1 0 1 1 0 1 0 1 0 1 0 3/19/1969
- 1390*/0x0AD5, 1970, 3, 8,/* 1 0 1 0 1 0 1 1 0 1 0 1 3/8/1970
- 1391*/0x0DD2, 1971, 2, 26,/* 0 1 0 0 1 0 1 1 1 0 1 1 2/26/1971
- 1392*/0x0DA4, 1972, 2, 16,/* 0 0 1 0 0 1 0 1 1 0 1 1 2/16/1972
- 1393*/0x0D49, 1973, 2, 4,/* 1 0 0 1 0 0 1 0 1 0 1 1 2/4/1973
- 1394*/0x0A95, 1974, 1, 24,/* 1 0 1 0 1 0 0 1 0 1 0 1 1/24/1974
- 1395*/0x052D, 1975, 1, 13,/* 1 0 1 1 0 1 0 0 1 0 1 0 1/13/1975
- 1396*/0x0A5D, 1976, 1, 2,/* 1 0 1 1 1 0 1 0 0 1 0 1 1/2/1976
- 1397*/0x055A, 1976, 12, 22,/* 0 1 0 1 1 0 1 0 1 0 1 0 12/22/1976
- 1398*/0x0AD5, 1977, 12, 11,/* 1 0 1 0 1 0 1 1 0 1 0 1 12/11/1977
- 1399*/0x06AA, 1978, 12, 1,/* 0 1 0 1 0 1 0 1 0 1 1 0 12/1/1978
- 1400*/0x0695, 1979, 11, 20,/* 1 0 1 0 1 0 0 1 0 1 1 0 11/20/1979
- 1401*/0x052B, 1980, 11, 8,/* 1 1 0 1 0 1 0 0 1 0 1 0 11/8/1980
- 1402*/0x0A57, 1981, 10, 28,/* 1 1 1 0 1 0 1 0 0 1 0 1 10/28/1981
- 1403*/0x04AE, 1982, 10, 18,/* 0 1 1 1 0 1 0 1 0 0 1 0 10/18/1982
- 1404*/0x0976, 1983, 10, 7,/* 0 1 1 0 1 1 1 0 1 0 0 1 10/7/1983
- 1405*/0x056C, 1984, 9, 26,/* 0 0 1 1 0 1 1 0 1 0 1 0 9/26/1984
- 1406*/0x0B55, 1985, 9, 15,/* 1 0 1 0 1 0 1 0 1 1 0 1 9/15/1985
- 1407*/0x0AAA, 1986, 9, 5,/* 0 1 0 1 0 1 0 1 0 1 0 1 9/5/1986
- 1408*/0x0A55, 1987, 8, 25,/* 1 0 1 0 1 0 1 0 0 1 0 1 8/25/1987
- 1409*/0x04AD, 1988, 8, 13,/* 1 0 1 1 0 1 0 1 0 0 1 0 8/13/1988
- 1410*/0x095D, 1989, 8, 2,/* 1 0 1 1 1 0 1 0 1 0 0 1 8/2/1989
- 1411*/0x02DA, 1990, 7, 23,/* 0 1 0 1 1 0 1 1 0 1 0 0 7/23/1990
- 1412*/0x05D9, 1991, 7, 12,/* 1 0 0 1 1 0 1 1 1 0 1 0 7/12/1991
- 1413*/0x0DB2, 1992, 7, 1,/* 0 1 0 0 1 1 0 1 1 0 1 1 7/1/1992
- 1414*/0x0BA4, 1993, 6, 21,/* 0 0 1 0 0 1 0 1 1 1 0 1 6/21/1993
- 1415*/0x0B4A, 1994, 6, 10,/* 0 1 0 1 0 0 1 0 1 1 0 1 6/10/1994
- 1416*/0x0A55, 1995, 5, 30,/* 1 0 1 0 1 0 1 0 0 1 0 1 5/30/1995
- 1417*/0x02B5, 1996, 5, 18,/* 1 0 1 0 1 1 0 1 0 1 0 0 5/18/1996
- 1418*/0x0575, 1997, 5, 7,/* 1 0 1 0 1 1 1 0 1 0 1 0 5/7/1997
- 1419*/0x0B6A, 1998, 4, 27,/* 0 1 0 1 0 1 1 0 1 1 0 1 4/27/1998
- 1420*/0x0BD2, 1999, 4, 17,/* 0 1 0 0 1 0 1 1 1 1 0 1 4/17/1999
- 1421*/0x0BC4, 2000, 4, 6,/* 0 0 1 0 0 0 1 1 1 1 0 1 4/6/2000
- 1422*/0x0B89, 2001, 3, 26,/* 1 0 0 1 0 0 0 1 1 1 0 1 3/26/2001
- 1423*/0x0A95, 2002, 3, 15,/* 1 0 1 0 1 0 0 1 0 1 0 1 3/15/2002
- 1424*/0x052D, 2003, 3, 4,/* 1 0 1 1 0 1 0 0 1 0 1 0 3/4/2003
- 1425*/0x05AD, 2004, 2, 21,/* 1 0 1 1 0 1 0 1 1 0 1 0 2/21/2004
- 1426*/0x0B6A, 2005, 2, 10,/* 0 1 0 1 0 1 1 0 1 1 0 1 2/10/2005
- 1427*/0x06D4, 2006, 1, 31,/* 0 0 1 0 1 0 1 1 0 1 1 0 1/31/2006
- 1428*/0x0DC9, 2007, 1, 20,/* 1 0 0 1 0 0 1 1 1 0 1 1 1/20/2007
- 1429*/0x0D92, 2008, 1, 10,/* 0 1 0 0 1 0 0 1 1 0 1 1 1/10/2008
- 1430*/0x0AA6, 2008, 12, 29,/* 0 1 1 0 0 1 0 1 0 1 0 1 12/29/2008
- 1431*/0x0956, 2009, 12, 18,/* 0 1 1 0 1 0 1 0 1 0 0 1 12/18/2009
- 1432*/0x02AE, 2010, 12, 7,/* 0 1 1 1 0 1 0 1 0 1 0 0 12/7/2010
- 1433*/0x056D, 2011, 11, 26,/* 1 0 1 1 0 1 1 0 1 0 1 0 11/26/2011
- 1434*/0x036A, 2012, 11, 15,/* 0 1 0 1 0 1 1 0 1 1 0 0 11/15/2012
- 1435*/0x0B55, 2013, 11, 4,/* 1 0 1 0 1 0 1 0 1 1 0 1 11/4/2013
- 1436*/0x0AAA, 2014, 10, 25,/* 0 1 0 1 0 1 0 1 0 1 0 1 10/25/2014
- 1437*/0x094D, 2015, 10, 14,/* 1 0 1 1 0 0 1 0 1 0 0 1 10/14/2015
- 1438*/0x049D, 2016, 10, 2,/* 1 0 1 1 1 0 0 1 0 0 1 0 10/2/2016
- 1439*/0x095D, 2017, 9, 21,/* 1 0 1 1 1 0 1 0 1 0 0 1 9/21/2017
- 1440*/0x02BA, 2018, 9, 11,/* 0 1 0 1 1 1 0 1 0 1 0 0 9/11/2018
- 1441*/0x05B5, 2019, 8, 31,/* 1 0 1 0 1 1 0 1 1 0 1 0 8/31/2019
- 1442*/0x05AA, 2020, 8, 20,/* 0 1 0 1 0 1 0 1 1 0 1 0 8/20/2020
- 1443*/0x0D55, 2021, 8, 9,/* 1 0 1 0 1 0 1 0 1 0 1 1 8/9/2021
- 1444*/0x0A9A, 2022, 7, 30,/* 0 1 0 1 1 0 0 1 0 1 0 1 7/30/2022
- 1445*/0x092E, 2023, 7, 19,/* 0 1 1 1 0 1 0 0 1 0 0 1 7/19/2023
- 1446*/0x026E, 2024, 7, 7,/* 0 1 1 1 0 1 1 0 0 1 0 0 7/7/2024
- 1447*/0x055D, 2025, 6, 26,/* 1 0 1 1 1 0 1 0 1 0 1 0 6/26/2025
- 1448*/0x0ADA, 2026, 6, 16,/* 0 1 0 1 1 0 1 1 0 1 0 1 6/16/2026
- 1449*/0x06D4, 2027, 6, 6,/* 0 0 1 0 1 0 1 1 0 1 1 0 6/6/2027
- 1450*/0x06A5, 2028, 5, 25,/* 1 0 1 0 0 1 0 1 0 1 1 0 5/25/2028
- 1451*/0x054B, 2029, 5, 14,/* 1 1 0 1 0 0 1 0 1 0 1 0 5/14/2029
- 1452*/0x0A97, 2030, 5, 3,/* 1 1 1 0 1 0 0 1 0 1 0 1 5/3/2030
- 1453*/0x054E, 2031, 4, 23,/* 0 1 1 1 0 0 1 0 1 0 1 0 4/23/2031
- 1454*/0x0AAE, 2032, 4, 11,/* 0 1 1 1 0 1 0 1 0 1 0 1 4/11/2032
- 1455*/0x05AC, 2033, 4, 1,/* 0 0 1 1 0 1 0 1 1 0 1 0 4/1/2033
- 1456*/0x0BA9, 2034, 3, 21,/* 1 0 0 1 0 1 0 1 1 1 0 1 3/21/2034
- 1457*/0x0D92, 2035, 3, 11,/* 0 1 0 0 1 0 0 1 1 0 1 1 3/11/2035
- 1458*/0x0B25, 2036, 2, 28,/* 1 0 1 0 0 1 0 0 1 1 0 1 2/28/2036
- 1459*/0x064B, 2037, 2, 16,/* 1 1 0 1 0 0 1 0 0 1 1 0 2/16/2037
- 1460*/0x0CAB, 2038, 2, 5,/* 1 1 0 1 0 1 0 1 0 0 1 1 2/5/2038
- 1461*/0x055A, 2039, 1, 26,/* 0 1 0 1 1 0 1 0 1 0 1 0 1/26/2039
- 1462*/0x0B55, 2040, 1, 15,/* 1 0 1 0 1 0 1 0 1 1 0 1 1/15/2040
- 1463*/0x06D2, 2041, 1, 4,/* 0 1 0 0 1 0 1 1 0 1 1 0 1/4/2041
- 1464*/0x0EA5, 2041, 12, 24,/* 1 0 1 0 0 1 0 1 0 1 1 1 12/24/2041
- 1465*/0x0E4A, 2042, 12, 14,/* 0 1 0 1 0 0 1 0 0 1 1 1 12/14/2042
- 1466*/0x0A95, 2043, 12, 3,/* 1 0 1 0 1 0 0 1 0 1 0 1 12/3/2043
- 1467*/0x052D, 2044, 11, 21,/* 1 0 1 1 0 1 0 0 1 0 1 0 11/21/2044
- 1468*/0x0AAD, 2045, 11, 10,/* 1 0 1 1 0 1 0 1 0 1 0 1 11/10/2045
- 1469*/0x036C, 2046, 10, 31,/* 0 0 1 1 0 1 1 0 1 1 0 0 10/31/2046
- 1470*/0x0759, 2047, 10, 20,/* 1 0 0 1 1 0 1 0 1 1 1 0 10/20/2047
- 1471*/0x06D2, 2048, 10, 9,/* 0 1 0 0 1 0 1 1 0 1 1 0 10/9/2048
- 1472*/0x0695, 2049, 9, 28,/* 1 0 1 0 1 0 0 1 0 1 1 0 9/28/2049
- 1473*/0x052D, 2050, 9, 17,/* 1 0 1 1 0 1 0 0 1 0 1 0 9/17/2050
- 1474*/0x0A5B, 2051, 9, 6,/* 1 1 0 1 1 0 1 0 0 1 0 1 9/6/2051
- 1475*/0x04BA, 2052, 8, 26,/* 0 1 0 1 1 1 0 1 0 0 1 0 8/26/2052
- 1476*/0x09BA, 2053, 8, 15,/* 0 1 0 1 1 1 0 1 1 0 0 1 8/15/2053
- 1477*/0x03B4, 2054, 8, 5,/* 0 0 1 0 1 1 0 1 1 1 0 0 8/5/2054
- 1478*/0x0B69, 2055, 7, 25,/* 1 0 0 1 0 1 1 0 1 1 0 1 7/25/2055
- 1479*/0x0B52, 2056, 7, 14,/* 0 1 0 0 1 0 1 0 1 1 0 1 7/14/2056
- 1480*/0x0AA6, 2057, 7, 3,/* 0 1 1 0 0 1 0 1 0 1 0 1 7/3/2057
- 1481*/0x04B6, 2058, 6, 22,/* 0 1 1 0 1 1 0 1 0 0 1 0 6/22/2058
- 1482*/0x096D, 2059, 6, 11,/* 1 0 1 1 0 1 1 0 1 0 0 1 6/11/2059
- 1483*/0x02EC, 2060, 5, 31,/* 0 0 1 1 0 1 1 1 0 1 0 0 5/31/2060
- 1484*/0x06D9, 2061, 5, 20,/* 1 0 0 1 1 0 1 1 0 1 1 0 5/20/2061
- 1485*/0x0EB2, 2062, 5, 10,/* 0 1 0 0 1 1 0 1 0 1 1 1 5/10/2062
- 1486*/0x0D54, 2063, 4, 30,/* 0 0 1 0 1 0 1 0 1 0 1 1 4/30/2063
- 1487*/0x0D2A, 2064, 4, 18,/* 0 1 0 1 0 1 0 0 1 0 1 1 4/18/2064
- 1488*/0x0A56, 2065, 4, 7,/* 0 1 1 0 1 0 1 0 0 1 0 1 4/7/2065
- 1489*/0x04AE, 2066, 3, 27,/* 0 1 1 1 0 1 0 1 0 0 1 0 3/27/2066
- 1490*/0x096D, 2067, 3, 16,/* 1 0 1 1 0 1 1 0 1 0 0 1 3/16/2067
- 1491*/0x0D6A, 2068, 3, 5,/* 0 1 0 1 0 1 1 0 1 0 1 1 3/5/2068
- 1492*/0x0B54, 2069, 2, 23,/* 0 0 1 0 1 0 1 0 1 1 0 1 2/23/2069
- 1493*/0x0B29, 2070, 2, 12,/* 1 0 0 1 0 1 0 0 1 1 0 1 2/12/2070
- 1494*/0x0A93, 2071, 2, 1,/* 1 1 0 0 1 0 0 1 0 1 0 1 2/1/2071
- 1495*/0x052B, 2072, 1, 21,/* 1 1 0 1 0 1 0 0 1 0 1 0 1/21/2072
- 1496*/0x0A57, 2073, 1, 9,/* 1 1 1 0 1 0 1 0 0 1 0 1 1/9/2073
- 1497*/0x0536, 2073, 12, 30,/* 0 1 1 0 1 1 0 0 1 0 1 0 12/30/2073
- 1498*/0x0AB5, 2074, 12, 19,/* 1 0 1 0 1 1 0 1 0 1 0 1 12/19/2074
- 1499*/0x06AA, 2075, 12, 9,/* 0 1 0 1 0 1 0 1 0 1 1 0 12/9/2075
- 1500*/0x0E93, 2076, 11, 27,/* 1 1 0 0 1 0 0 1 0 1 1 1 11/27/2076
- 1501*/ 0, 2077, 11, 17,/* 0 0 0 0 0 0 0 0 0 0 0 0 11/17/2077
- */ };
- // Direct inline initialization of DateMapping array would produce a lot of code bloat.
-
- // We take advantage of C# compiler compiles inline initialization of primitive type array into very compact code.
- // So we start with raw data stored in primitive type array, and initialize the DateMapping out of it
-
- DateMapping[] mapping = new DateMapping[rawData.Length / 4];
- for (int i = 0; i < mapping.Length; i++)
- mapping[i] = new DateMapping(rawData[i * 4], rawData[i * 4 + 1], rawData[i * 4 + 2], rawData[i * 4 + 3]);
- return mapping;
- }
-
- public const int UmAlQuraEra = 1;
-
- internal const int DateCycle = 30;
- internal const int DatePartYear = 0;
- internal const int DatePartDayOfYear = 1;
- internal const int DatePartMonth = 2;
- internal const int DatePartDay = 3;
-
-
- // This is the minimal Gregorian date that we support in the UmAlQuraCalendar.
- internal static DateTime minDate = new DateTime(1900, 4, 30);
- internal static DateTime maxDate = new DateTime((new DateTime(2077, 11, 16, 23, 59, 59, 999)).Ticks + 9999);
-
- public override DateTime MinSupportedDateTime
- {
- get
- {
- return (minDate);
- }
- }
-
- public override DateTime MaxSupportedDateTime
- {
- get
- {
- return (maxDate);
- }
- }
-
- public override CalendarAlgorithmType AlgorithmType
- {
- get
- {
- return CalendarAlgorithmType.LunarCalendar;
- }
- }
-
- public UmAlQuraCalendar()
- {
- }
-
- internal override CalendarId BaseCalendarID
- {
- get
- {
- return (CalendarId.HIJRI);
- }
- }
-
- internal override CalendarId ID
- {
- get
- {
- return (CalendarId.UMALQURA);
- }
- }
-
- protected override int DaysInYearBeforeMinSupportedYear
- {
- get
- {
- // HijriCalendar has same number of days as UmAlQuraCalendar for any given year
- // HijriCalendar says year 1317 has 355 days.
- return 355;
- }
- }
-
- /*==========================ConvertHijriToGregorian==========================
- ** Purpose: convert Hdate(year,month,day) to Gdate(year,month,day)
- ** Arguments:
- ** Input/Ouput: Hijrah date: year:yh, month:mh, day:dh
- ** Output: Gregorian date: year:yg, month:mg, day:dg , day of week:dayweek
- ** and returns flag found:1 not found:0
- =========================ConvertHijriToGregorian============================*/
- private static void ConvertHijriToGregorian(int HijriYear, int HijriMonth, int HijriDay, ref int yg, ref int mg, ref int dg)
- {
- Debug.Assert((HijriYear >= MinCalendarYear) && (HijriYear <= MaxCalendarYear), "Hijri year is out of range.");
- Debug.Assert(HijriMonth >= 1, "Hijri month is out of range.");
- Debug.Assert(HijriDay >= 1, "Hijri day is out of range.");
- int index, b, nDays = HijriDay - 1;
- DateTime dt;
-
-
- index = HijriYear - MinCalendarYear;
- dt = s_hijriYearInfo[index].GregorianDate;
-
-
- b = s_hijriYearInfo[index].HijriMonthsLengthFlags;
-
- for (int m = 1; m < HijriMonth; m++)
- {
- nDays = nDays + 29 + (b & 1); /* Add the months lengths before mh */
- b = b >> 1;
- }
-
- dt = dt.AddDays(nDays);
- yg = dt.Year;
- mg = dt.Month;
- dg = dt.Day;
- }
-
- /*=================================GetAbsoluteDateUmAlQura==========================
- **Action: Gets the Absolute date for the given UmAlQura date. The absolute date means
- ** the number of days from January 1st, 1 A.D.
- **Returns:
- **Arguments:
- **Exceptions:
- ============================================================================*/
- private static long GetAbsoluteDateUmAlQura(int year, int month, int day)
- {
- //Caller should check the validaty of year, month and day.
-
- int yg = 0, mg = 0, dg = 0;
- ConvertHijriToGregorian(year, month, day, ref yg, ref mg, ref dg);
- return GregorianCalendar.GetAbsoluteDate(yg, mg, dg);
- }
-
- internal static void CheckTicksRange(long ticks)
- {
- if (ticks < minDate.Ticks || ticks > maxDate.Ticks)
- {
- throw new ArgumentOutOfRangeException(
- "time",
- String.Format(
- CultureInfo.InvariantCulture,
- SR.ArgumentOutOfRange_CalendarRange,
- minDate,
- maxDate));
- }
- }
-
- internal static void CheckEraRange(int era)
- {
- if (era != CurrentEra && era != UmAlQuraEra)
- {
- throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue);
- }
- }
-
- internal static void CheckYearRange(int year, int era)
- {
- CheckEraRange(era);
- if (year < MinCalendarYear || year > MaxCalendarYear)
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- MinCalendarYear,
- MaxCalendarYear));
- }
- }
-
- internal static void CheckYearMonthRange(int year, int month, int era)
- {
- CheckYearRange(year, era);
- if (month < 1 || month > 12)
- {
- throw new ArgumentOutOfRangeException(nameof(month), SR.ArgumentOutOfRange_Month);
- }
- }
-
- /*========================ConvertGregorianToHijri============================
- ** Purpose: convert DateTime to Hdate(year,month,day)
- ** Arguments:
- ** Input: DateTime
- ** Output: Hijrah date: year:yh, month:mh, day:dh
- ============================================================================*/
- private static void ConvertGregorianToHijri(DateTime time, ref int HijriYear, ref int HijriMonth, ref int HijriDay)
- {
- int index, b, DaysPerThisMonth;
- double nDays;
- TimeSpan ts;
- int yh1 = 0, mh1 = 0, dh1 = 0;
-
- Debug.Assert((time.Ticks >= minDate.Ticks) && (time.Ticks <= maxDate.Ticks), "Gregorian date is out of range.");
-
- // Find the index where we should start our search by quessing the Hijri year that we will be in HijriYearInfo.
- // A Hijri year is 354 or 355 days. Use 355 days so that we will search from a lower index.
-
- index = (int)((time.Ticks - minDate.Ticks) / Calendar.TicksPerDay) / 355;
- do
- {
- } while (time.CompareTo(s_hijriYearInfo[++index].GregorianDate) > 0); //while greater
-
- if (time.CompareTo(s_hijriYearInfo[index].GregorianDate) != 0)
- {
- index--;
- }
-
- ts = time.Subtract(s_hijriYearInfo[index].GregorianDate);
- yh1 = index + MinCalendarYear;
-
- mh1 = 1;
- dh1 = 1;
- nDays = ts.TotalDays;
- b = s_hijriYearInfo[index].HijriMonthsLengthFlags;
- DaysPerThisMonth = 29 + (b & 1);
-
- while (nDays >= DaysPerThisMonth)
- {
- nDays -= DaysPerThisMonth;
- b = b >> 1;
- DaysPerThisMonth = 29 + (b & 1);
- mh1++;
- }
- dh1 += (int)nDays;
-
- HijriDay = dh1;
- HijriMonth = mh1;
- HijriYear = yh1;
- }
-
- /*=================================GetDatePart==========================
- **Action: Returns a given date part of this <i>DateTime</i>. This method is used
- ** to compute the year, day-of-year, month, or day part.
- **Returns:
- **Arguments:
- **Exceptions: ArgumentException if part is incorrect.
- **Notes:
- ** First, we get the absolute date (the number of days from January 1st, 1 A.C) for the given ticks.
- ** Use the formula (((AbsoluteDate - 226894) * 33) / (33 * 365 + 8)) + 1, we can a rough value for the UmAlQura year.
- ** In order to get the exact UmAlQura year, we compare the exact absolute date for UmAlQuraYear and (UmAlQuraYear + 1).
- ** From here, we can get the correct UmAlQura year.
- ============================================================================*/
-
- internal virtual int GetDatePart(DateTime time, int part)
- {
- int UmAlQuraYear = 0; // UmAlQura year
- int UmAlQuraMonth = 0; // UmAlQura month
- int UmAlQuraDay = 0; // UmAlQura day
- long ticks = time.Ticks;
- CheckTicksRange(ticks);
-
- ConvertGregorianToHijri(time, ref UmAlQuraYear, ref UmAlQuraMonth, ref UmAlQuraDay);
-
- if (part == DatePartYear)
- return (UmAlQuraYear);
-
- if (part == DatePartMonth)
- return (UmAlQuraMonth);
-
- if (part == DatePartDay)
- return (UmAlQuraDay);
-
- if (part == DatePartDayOfYear)
- return (int)(GetAbsoluteDateUmAlQura(UmAlQuraYear, UmAlQuraMonth, UmAlQuraDay) - GetAbsoluteDateUmAlQura(UmAlQuraYear, 1, 1) + 1);
-
- // Incorrect part value.
- throw new InvalidOperationException(SR.InvalidOperation_DateTimeParsing);
- }
-
- // Returns the DateTime resulting from adding the given number of
- // months to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year and month parts of the specified DateTime by
- // value months, and, if required, adjusting the day part of the
- // resulting date downwards to the last day of the resulting month in the
- // resulting year. The time-of-day part of the result is the same as the
- // time-of-day part of the specified DateTime.
- //
- // In more precise terms, considering the specified DateTime to be of the
- // form y / m / d + t, where y is the
- // year, m is the month, d is the day, and t is the
- // time-of-day, the result is y1 / m1 / d1 + t,
- // where y1 and m1 are computed by adding value months
- // to y and m, and d1 is the largest value less than
- // or equal to d that denotes a valid day in month m1 of year
- // y1.
- //
-
-
- public override DateTime AddMonths(DateTime time, int months)
- {
- if (months < -120000 || months > 120000)
- {
- throw new ArgumentOutOfRangeException(
- nameof(months),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- -120000,
- 120000));
- }
- Contract.EndContractBlock();
- // Get the date in UmAlQura calendar.
- int y = GetDatePart(time, DatePartYear);
- int m = GetDatePart(time, DatePartMonth);
- int d = GetDatePart(time, DatePartDay);
- int i = m - 1 + months;
-
- if (i >= 0)
- {
- m = i % 12 + 1;
- y = y + i / 12;
- }
- else
- {
- m = 12 + (i + 1) % 12;
- y = y + (i - 11) / 12;
- }
-
- if (d > 29)
- {
- int days = GetDaysInMonth(y, m);
- if (d > days)
- {
- d = days;
- }
- }
- CheckYearRange(y, UmAlQuraEra);
- DateTime dt = new DateTime(GetAbsoluteDateUmAlQura(y, m, d) * TicksPerDay + time.Ticks % TicksPerDay);
- Calendar.CheckAddResult(dt.Ticks, MinSupportedDateTime, MaxSupportedDateTime);
- return (dt);
- }
-
- // Returns the DateTime resulting from adding the given number of
- // years to the specified DateTime. The result is computed by incrementing
- // (or decrementing) the year part of the specified DateTime by value
- // years. If the month and day of the specified DateTime is 2/29, and if the
- // resulting year is not a leap year, the month and day of the resulting
- // DateTime becomes 2/28. Otherwise, the month, day, and time-of-day
- // parts of the result are the same as those of the specified DateTime.
- //
-
-
- public override DateTime AddYears(DateTime time, int years)
- {
- return (AddMonths(time, years * 12));
- }
-
- // Returns the day-of-month part of the specified DateTime. The returned
- // value is an integer between 1 and 31.
- //
-
-
- public override int GetDayOfMonth(DateTime time)
- {
- return (GetDatePart(time, DatePartDay));
- }
-
- // Returns the day-of-week part of the specified DateTime. The returned value
- // is an integer between 0 and 6, where 0 indicates Sunday, 1 indicates
- // Monday, 2 indicates Tuesday, 3 indicates Wednesday, 4 indicates
- // Thursday, 5 indicates Friday, and 6 indicates Saturday.
- //
-
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- return ((DayOfWeek)((int)(time.Ticks / TicksPerDay + 1) % 7));
- }
-
- // Returns the day-of-year part of the specified DateTime. The returned value
- // is an integer between 1 and 354 or 355.
- //
-
-
- public override int GetDayOfYear(DateTime time)
- {
- return (GetDatePart(time, DatePartDayOfYear));
- }
-
- /*
- internal bool CouldBeLeapYear(int year)
- {
- return ((((year * 11) + 14) % 30) < 11);
- }
- */
-
- // Returns the number of days in the month given by the year and
- // month arguments.
- //
-
-
- public override int GetDaysInMonth(int year, int month, int era)
- {
- CheckYearMonthRange(year, month, era);
-
- if ((s_hijriYearInfo[year - MinCalendarYear].HijriMonthsLengthFlags & (1 << month - 1)) == 0)
- return 29;
- else
- return 30;
- }
-
- internal static int RealGetDaysInYear(int year)
- {
- int days = 0, b;
-
- Debug.Assert((year >= MinCalendarYear) && (year <= MaxCalendarYear), "Hijri year is out of range.");
-
- b = s_hijriYearInfo[year - MinCalendarYear].HijriMonthsLengthFlags;
-
- for (int m = 1; m <= 12; m++)
- {
- days = days + 29 + (b & 1); /* Add the months lengths before mh */
- b = b >> 1;
- }
- Debug.Assert((days == 354) || (days == 355), "Hijri year has to be 354 or 355 days.");
- return days;
- }
-
- // Returns the number of days in the year given by the year argument for the current era.
- //
-
-
- public override int GetDaysInYear(int year, int era)
- {
- CheckYearRange(year, era);
- return (RealGetDaysInYear(year));
- }
-
- // Returns the era for the specified DateTime value.
-
-
- public override int GetEra(DateTime time)
- {
- CheckTicksRange(time.Ticks);
- return (UmAlQuraEra);
- }
-
-
-
- public override int[] Eras
- {
- get
- {
- return (new int[] { UmAlQuraEra });
- }
- }
-
- // Returns the month part of the specified DateTime. The returned value is an
- // integer between 1 and 12.
- //
-
-
- public override int GetMonth(DateTime time)
- {
- return (GetDatePart(time, DatePartMonth));
- }
-
- // Returns the number of months in the specified year and era.
-
-
- public override int GetMonthsInYear(int year, int era)
- {
- CheckYearRange(year, era);
- return (12);
- }
-
- // Returns the year part of the specified DateTime. The returned value is an
- // integer between MinCalendarYear and MaxCalendarYear.
- //
-
-
- public override int GetYear(DateTime time)
- {
- return (GetDatePart(time, DatePartYear));
- }
-
- // Checks whether a given day in the specified era is a leap day. This method returns true if
- // the date is a leap day, or false if not.
- //
-
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- if (day >= 1 && day <= 29)
- {
- CheckYearMonthRange(year, month, era);
- return (false);
- }
-
- // The year/month/era value checking is done in GetDaysInMonth().
- int daysInMonth = GetDaysInMonth(year, month, era);
- if (day < 1 || day > daysInMonth)
- {
- throw new ArgumentOutOfRangeException(
- nameof(day),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Day,
- daysInMonth,
- month));
- }
- return (false);
- }
-
- // Returns the leap month in a calendar year of the specified era. This method returns 0
- // if this calendar does not have leap month, or this year is not a leap year.
- //
-
-
- public override int GetLeapMonth(int year, int era)
- {
- CheckYearRange(year, era);
- return (0);
- }
-
- // Checks whether a given month in the specified era is a leap month. This method returns true if
- // month is a leap month, or false if not.
- //
-
-
- public override bool IsLeapMonth(int year, int month, int era)
- {
- CheckYearMonthRange(year, month, era);
- return (false);
- }
-
- // Checks whether a given year in the specified era is a leap year. This method returns true if
- // year is a leap year, or false if not.
- //
-
-
- public override bool IsLeapYear(int year, int era)
- {
- CheckYearRange(year, era);
- if (RealGetDaysInYear(year) == 355)
- return true;
- else
- return false;
- }
-
- // Returns the date and time converted to a DateTime value. Throws an exception if the n-tuple is invalid.
- //
-
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- if (day >= 1 && day <= 29)
- {
- CheckYearMonthRange(year, month, era);
- goto DayInRang;
- }
-
- // The year/month/era value checking is done in GetDaysInMonth().
- int daysInMonth = GetDaysInMonth(year, month, era);
-
- if (day < 1 || day > daysInMonth)
- {
- throw new ArgumentOutOfRangeException(
- nameof(day),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Day,
- daysInMonth,
- month));
- }
- DayInRang:
- long lDate = GetAbsoluteDateUmAlQura(year, month, day);
-
- if (lDate >= 0)
- {
- return (new DateTime(lDate * GregorianCalendar.TicksPerDay + TimeToTicks(hour, minute, second, millisecond)));
- }
- else
- {
- throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadYearMonthDay);
- }
- }
-
- private const int DEFAULT_TWO_DIGIT_YEAR_MAX = 1451;
-
-
-
- public override int TwoDigitYearMax
- {
- get
- {
- if (twoDigitYearMax == -1)
- {
- twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
- }
- return (twoDigitYearMax);
- }
-
- set
- {
- if (value != 99 && (value < MinCalendarYear || value > MaxCalendarYear))
- {
- throw new ArgumentOutOfRangeException(
- nameof(value),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- MinCalendarYear,
- MaxCalendarYear));
- }
- Contract.EndContractBlock();
- VerifyWritable();
- // We allow year 99 to be set so that one can make ToFourDigitYearMax a no-op by setting TwoDigitYearMax to 99.
- twoDigitYearMax = value;
- }
- }
-
-
-
- public override int ToFourDigitYear(int year)
- {
- if (year < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(year),
- SR.ArgumentOutOfRange_NeedNonNegNum);
- }
- Contract.EndContractBlock();
-
- if (year < 100)
- {
- return (base.ToFourDigitYear(year));
- }
-
- if ((year < MinCalendarYear) || (year > MaxCalendarYear))
- {
- throw new ArgumentOutOfRangeException(
- nameof(year),
- String.Format(
- CultureInfo.CurrentCulture,
- SR.ArgumentOutOfRange_Range,
- MinCalendarYear,
- MaxCalendarYear));
- }
- return (year);
- }
- }
-}
-
diff --git a/src/mscorlib/corefx/System/Globalization/UnicodeCategory.cs b/src/mscorlib/corefx/System/Globalization/UnicodeCategory.cs
deleted file mode 100644
index 1c5e6bca56..0000000000
--- a/src/mscorlib/corefx/System/Globalization/UnicodeCategory.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Globalization
-{
- [Serializable]
- public enum UnicodeCategory
- {
- UppercaseLetter = 0,
-
- LowercaseLetter = 1,
-
- TitlecaseLetter = 2,
-
- ModifierLetter = 3,
-
- OtherLetter = 4,
-
- NonSpacingMark = 5,
-
- SpacingCombiningMark = 6,
-
- EnclosingMark = 7,
-
- DecimalDigitNumber = 8,
-
- LetterNumber = 9,
-
- OtherNumber = 10,
-
- SpaceSeparator = 11,
-
- LineSeparator = 12,
-
- ParagraphSeparator = 13,
-
- Control = 14,
-
- Format = 15,
-
- Surrogate = 16,
-
- PrivateUse = 17,
-
- ConnectorPunctuation = 18,
-
- DashPunctuation = 19,
-
- OpenPunctuation = 20,
-
- ClosePunctuation = 21,
-
- InitialQuotePunctuation = 22,
-
- FinalQuotePunctuation = 23,
-
- OtherPunctuation = 24,
-
- MathSymbol = 25,
-
- CurrencySymbol = 26,
-
- ModifierSymbol = 27,
-
- OtherSymbol = 28,
-
- OtherNotAssigned = 29,
- }
-}
diff --git a/src/mscorlib/corefx/System/HResults.cs b/src/mscorlib/corefx/System/HResults.cs
deleted file mode 100644
index fa0e24f00b..0000000000
--- a/src/mscorlib/corefx/System/HResults.cs
+++ /dev/null
@@ -1,236 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-//=============================================================================
-//
-//
-// Purpose: Define HResult constants. Every exception has one of these.
-//
-//
-//===========================================================================*/
-
-using System;
-
-namespace System
-{
- // Note: FACILITY_URT is defined as 0x13 (0x8013xxxx). Within that
- // range, 0x1yyy is for Runtime errors (used for Security, Metadata, etc).
- // In that subrange, 0x15zz and 0x16zz have been allocated for classlib-type
- // HResults. Also note that some of our HResults have to map to certain
- // COM HR's, etc.
-
- // Another arbitrary decision... Feel free to change this, as long as you
- // renumber the HResults yourself (and update rexcep.h).
- // Reflection will use 0x1600 -> 0x161f. IO will use 0x1620 -> 0x163f.
- // Security will use 0x1640 -> 0x165f
-
- // There are HResults files in the IO, Remoting, Reflection &
- // Security/Util directories as well, so choose your HResults carefully.
- internal static class HResults
- {
- internal const int APPMODEL_ERROR_NO_PACKAGE = unchecked((int)0x80073D54);
- internal const int CLDB_E_FILE_CORRUPT = unchecked((int)0x8013110e);
- internal const int CLDB_E_FILE_OLDVER = unchecked((int)0x80131107);
- internal const int CLDB_E_INDEX_NOTFOUND = unchecked((int)0x80131124);
- internal const int CLR_E_BIND_ASSEMBLY_NOT_FOUND = unchecked((int)0x80132004);
- internal const int CLR_E_BIND_ASSEMBLY_PUBLIC_KEY_MISMATCH = unchecked((int)0x80132001);
- internal const int CLR_E_BIND_ASSEMBLY_VERSION_TOO_LOW = unchecked((int)0x80132000);
- internal const int CLR_E_BIND_TYPE_NOT_FOUND = unchecked((int)0x80132005);
- internal const int CLR_E_BIND_UNRECOGNIZED_IDENTITY_FORMAT = unchecked((int)0x80132003);
- internal const int COR_E_ABANDONEDMUTEX = unchecked((int)0x8013152D);
- internal const int COR_E_AMBIGUOUSMATCH = unchecked((int)0x8000211D);
- internal const int COR_E_APPDOMAINUNLOADED = unchecked((int)0x80131014);
- internal const int COR_E_APPLICATION = unchecked((int)0x80131600);
- internal const int COR_E_ARGUMENT = unchecked((int)0x80070057);
- internal const int COR_E_ARGUMENTOUTOFRANGE = unchecked((int)0x80131502);
- internal const int COR_E_ARITHMETIC = unchecked((int)0x80070216);
- internal const int COR_E_ARRAYTYPEMISMATCH = unchecked((int)0x80131503);
- internal const int COR_E_ASSEMBLYEXPECTED = unchecked((int)0x80131018);
- internal const int COR_E_BADIMAGEFORMAT = unchecked((int)0x8007000B);
- internal const int COR_E_CANNOTUNLOADAPPDOMAIN = unchecked((int)0x80131015);
- internal const int COR_E_CODECONTRACTFAILED = unchecked((int)0x80131542);
- internal const int COR_E_CONTEXTMARSHAL = unchecked((int)0x80131504);
- internal const int COR_E_CUSTOMATTRIBUTEFORMAT = unchecked((int)0x80131605);
- internal const int COR_E_DATAMISALIGNED = unchecked((int)0x80131541);
- internal const int COR_E_DIVIDEBYZERO = unchecked((int)0x80020012); // DISP_E_DIVBYZERO
- internal const int COR_E_DLLNOTFOUND = unchecked((int)0x80131524);
- internal const int COR_E_DUPLICATEWAITOBJECT = unchecked((int)0x80131529);
- internal const int COR_E_ENTRYPOINTNOTFOUND = unchecked((int)0x80131523);
- internal const int COR_E_EXCEPTION = unchecked((int)0x80131500);
- internal const int COR_E_EXECUTIONENGINE = unchecked((int)0x80131506);
- internal const int COR_E_FIELDACCESS = unchecked((int)0x80131507);
- internal const int COR_E_FIXUPSINEXE = unchecked((int)0x80131019);
- internal const int COR_E_FORMAT = unchecked((int)0x80131537);
- internal const int COR_E_INDEXOUTOFRANGE = unchecked((int)0x80131508);
- internal const int COR_E_INSUFFICIENTEXECUTIONSTACK = unchecked((int)0x80131578);
- internal const int COR_E_INVALIDCAST = unchecked((int)0x80004002);
- internal const int COR_E_INVALIDCOMOBJECT = unchecked((int)0x80131527);
- internal const int COR_E_INVALIDFILTERCRITERIA = unchecked((int)0x80131601);
- internal const int COR_E_INVALIDOLEVARIANTTYPE = unchecked((int)0x80131531);
- internal const int COR_E_INVALIDOPERATION = unchecked((int)0x80131509);
- internal const int COR_E_INVALIDPROGRAM = unchecked((int)0x8013153a);
- internal const int COR_E_KEYNOTFOUND = unchecked((int)0x80131577);
- internal const int COR_E_LOADING_REFERENCE_ASSEMBLY = unchecked((int)0x80131058);
- internal const int COR_E_MARSHALDIRECTIVE = unchecked((int)0x80131535);
- internal const int COR_E_MEMBERACCESS = unchecked((int)0x8013151A);
- internal const int COR_E_METHODACCESS = unchecked((int)0x80131510);
- internal const int COR_E_MISSINGFIELD = unchecked((int)0x80131511);
- internal const int COR_E_MISSINGMANIFESTRESOURCE = unchecked((int)0x80131532);
- internal const int COR_E_MISSINGMEMBER = unchecked((int)0x80131512);
- internal const int COR_E_MISSINGMETHOD = unchecked((int)0x80131513);
- internal const int COR_E_MISSINGSATELLITEASSEMBLY = unchecked((int)0x80131536);
- internal const int COR_E_MODULE_HASH_CHECK_FAILED = unchecked((int)0x80131039);
- internal const int COR_E_MULTICASTNOTSUPPORTED = unchecked((int)0x80131514);
- internal const int COR_E_NEWER_RUNTIME = unchecked((int)0x8013101b);
- internal const int COR_E_NOTFINITENUMBER = unchecked((int)0x80131528);
- internal const int COR_E_NOTSUPPORTED = unchecked((int)0x80131515);
- internal const int COR_E_NULLREFERENCE = unchecked((int)0x80004003);
- internal const int COR_E_OBJECTDISPOSED = unchecked((int)0x80131622);
- internal const int COR_E_OPERATIONCANCELED = unchecked((int)0x8013153B);
- internal const int COR_E_OUTOFMEMORY = unchecked((int)0x8007000E);
- internal const int COR_E_OVERFLOW = unchecked((int)0x80131516);
- internal const int COR_E_PLATFORMNOTSUPPORTED = unchecked((int)0x80131539);
- internal const int COR_E_RANK = unchecked((int)0x80131517);
- internal const int COR_E_REFLECTIONTYPELOAD = unchecked((int)0x80131602);
- internal const int COR_E_REMOTING = unchecked((int)0x8013150b);
- internal const int COR_E_RUNTIMEWRAPPED = unchecked((int)0x8013153e);
- internal const int COR_E_SAFEARRAYRANKMISMATCH = unchecked((int)0x80131538);
- internal const int COR_E_SAFEARRAYTYPEMISMATCH = unchecked((int)0x80131533);
- internal const int COR_E_SECURITY = unchecked((int)0x8013150A);
- internal const int COR_E_SERIALIZATION = unchecked((int)0x8013150C);
- internal const int COR_E_SERVER = unchecked((int)0x8013150e);
- internal const int COR_E_STACKOVERFLOW = unchecked((int)0x800703E9);
- internal const int COR_E_SYNCHRONIZATIONLOCK = unchecked((int)0x80131518);
- internal const int COR_E_SYSTEM = unchecked((int)0x80131501);
- internal const int COR_E_TARGET = unchecked((int)0x80131603);
- internal const int COR_E_TARGETINVOCATION = unchecked((int)0x80131604);
- internal const int COR_E_TARGETPARAMCOUNT = unchecked((int)0x8002000e);
- internal const int COR_E_THREADABORTED = unchecked((int)0x80131530);
- internal const int COR_E_THREADINTERRUPTED = unchecked((int)0x80131519);
- internal const int COR_E_THREADSTART = unchecked((int)0x80131525);
- internal const int COR_E_THREADSTATE = unchecked((int)0x80131520);
- internal const int COR_E_TIMEOUT = unchecked((int)0x80131505);
- internal const int COR_E_TYPEACCESS = unchecked((int)0x80131543);
- internal const int COR_E_TYPEINITIALIZATION = unchecked((int)0x80131534);
- internal const int COR_E_TYPELOAD = unchecked((int)0x80131522);
- internal const int COR_E_TYPEUNLOADED = unchecked((int)0x80131013);
- internal const int COR_E_UNAUTHORIZEDACCESS = unchecked((int)0x80070005);
- internal const int COR_E_VERIFICATION = unchecked((int)0x8013150D);
- internal const int COR_E_WAITHANDLECANNOTBEOPENED = unchecked((int)0x8013152C);
- internal const int CORSEC_E_CRYPTO = unchecked((int)0x80131430);
- internal const int CORSEC_E_CRYPTO_UNEX_OPER = unchecked((int)0x80131431);
- internal const int CORSEC_E_INVALID_IMAGE_FORMAT = unchecked((int)0x8013141d);
- internal const int CORSEC_E_INVALID_PUBLICKEY = unchecked((int)0x8013141e);
- internal const int CORSEC_E_INVALID_STRONGNAME = unchecked((int)0x8013141a);
- internal const int CORSEC_E_MIN_GRANT_FAIL = unchecked((int)0x80131417);
- internal const int CORSEC_E_MISSING_STRONGNAME = unchecked((int)0x8013141b);
- internal const int CORSEC_E_NO_EXEC_PERM = unchecked((int)0x80131418);
- internal const int CORSEC_E_POLICY_EXCEPTION = unchecked((int)0x80131416);
- internal const int CORSEC_E_SIGNATURE_MISMATCH = unchecked((int)0x80131420);
- internal const int CORSEC_E_XMLSYNTAX = unchecked((int)0x80131419);
- internal const int CTL_E_DEVICEIOERROR = unchecked((int)0x800A0039);
- internal const int CTL_E_DIVISIONBYZERO = unchecked((int)0x800A000B);
- internal const int CTL_E_FILENOTFOUND = unchecked((int)0x800A0035);
- internal const int CTL_E_OUTOFMEMORY = unchecked((int)0x800A0007);
- internal const int CTL_E_OUTOFSTACKSPACE = unchecked((int)0x800A001C);
- internal const int CTL_E_OVERFLOW = unchecked((int)0x800A0006);
- internal const int CTL_E_PATHFILEACCESSERROR = unchecked((int)0x800A004B);
- internal const int CTL_E_PATHNOTFOUND = unchecked((int)0x800A004C);
- internal const int CTL_E_PERMISSIONDENIED = unchecked((int)0x800A0046);
- internal const int E_ELEMENTNOTAVAILABLE = unchecked((int)0x802B001F);
- internal const int E_ELEMENTNOTENABLED = unchecked((int)0x802B001E);
- internal const int E_FAIL = unchecked((int)0x80004005);
- internal const int E_HANDLE = unchecked((int)0x80070006);
- internal const int E_ILLEGAL_DELEGATE_ASSIGNMENT = unchecked((int)0x80000018);
- internal const int E_ILLEGAL_METHOD_CALL = unchecked((int)0x8000000E);
- internal const int E_ILLEGAL_STATE_CHANGE = unchecked((int)0x8000000D);
- internal const int E_INVALIDARG = unchecked((int)0x80070057);
- internal const int E_LAYOUTCYCLE = unchecked((int)0x802B0014);
- internal const int E_NOTIMPL = unchecked((int)0x80004001);
- internal const int E_OUTOFMEMORY = unchecked((int)0x8007000E);
- internal const int E_POINTER = unchecked((int)0x80004003L);
- internal const int E_XAMLPARSEFAILED = unchecked((int)0x802B000A);
- internal const int ERROR_BAD_EXE_FORMAT = unchecked((int)0x800700C1);
- internal const int ERROR_BAD_NET_NAME = unchecked((int)0x80070043);
- internal const int ERROR_BAD_NETPATH = unchecked((int)0x80070035);
- internal const int ERROR_DISK_CORRUPT = unchecked((int)0x80070571);
- internal const int ERROR_DLL_INIT_FAILED = unchecked((int)0x8007045A);
- internal const int ERROR_DLL_NOT_FOUND = unchecked((int)0x80070485);
- internal const int ERROR_EXE_MARKED_INVALID = unchecked((int)0x800700C0);
- internal const int ERROR_FILE_CORRUPT = unchecked((int)0x80070570);
- internal const int ERROR_FILE_INVALID = unchecked((int)0x800703EE);
- internal const int ERROR_FILE_NOT_FOUND = unchecked((int)0x80070002);
- internal const int ERROR_INVALID_DLL = unchecked((int)0x80070482);
- internal const int ERROR_INVALID_NAME = unchecked((int)0x8007007B);
- internal const int ERROR_INVALID_ORDINAL = unchecked((int)0x800700B6);
- internal const int ERROR_INVALID_PARAMETER = unchecked((int)0x80070057);
- internal const int ERROR_LOCK_VIOLATION = unchecked((int)0x80070021);
- internal const int ERROR_MOD_NOT_FOUND = unchecked((int)0x8007007E);
- internal const int ERROR_NO_UNICODE_TRANSLATION = unchecked((int)0x80070459);
- internal const int ERROR_NOACCESS = unchecked((int)0x800703E6);
- internal const int ERROR_NOT_READY = unchecked((int)0x80070015);
- internal const int ERROR_OPEN_FAILED = unchecked((int)0x8007006E);
- internal const int ERROR_PATH_NOT_FOUND = unchecked((int)0x80070003);
- internal const int ERROR_SHARING_VIOLATION = unchecked((int)0x80070020);
- internal const int ERROR_TOO_MANY_OPEN_FILES = unchecked((int)0x80070004);
- internal const int ERROR_UNRECOGNIZED_VOLUME = unchecked((int)0x800703ED);
- internal const int ERROR_WRONG_TARGET_NAME = unchecked((int)0x80070574);
- internal const int FUSION_E_ASM_MODULE_MISSING = unchecked((int)0x80131042);
- internal const int FUSION_E_CACHEFILE_FAILED = unchecked((int)0x80131052);
- internal const int FUSION_E_CODE_DOWNLOAD_DISABLED = unchecked((int)0x80131048);
- internal const int FUSION_E_HOST_GAC_ASM_MISMATCH = unchecked((int)0x80131050);
- internal const int FUSION_E_INVALID_NAME = unchecked((int)0x80131047);
- internal const int FUSION_E_INVALID_PRIVATE_ASM_LOCATION = unchecked((int)0x80131041);
- internal const int FUSION_E_LOADFROM_BLOCKED = unchecked((int)0x80131051);
- internal const int FUSION_E_PRIVATE_ASM_DISALLOWED = unchecked((int)0x80131044);
- internal const int FUSION_E_REF_DEF_MISMATCH = unchecked((int)0x80131040);
- internal const int FUSION_E_SIGNATURE_CHECK_FAILED = unchecked((int)0x80131045);
- internal const int INET_E_CANNOT_CONNECT = unchecked((int)0x800C0004);
- internal const int INET_E_CONNECTION_TIMEOUT = unchecked((int)0x800C000B);
- internal const int INET_E_DATA_NOT_AVAILABLE = unchecked((int)0x800C0007);
- internal const int INET_E_DOWNLOAD_FAILURE = unchecked((int)0x800C0008);
- internal const int INET_E_OBJECT_NOT_FOUND = unchecked((int)0x800C0006);
- internal const int INET_E_RESOURCE_NOT_FOUND = unchecked((int)0x800C0005);
- internal const int INET_E_UNKNOWN_PROTOCOL = unchecked((int)0x800C000D);
- internal const int ISS_E_ALLOC_TOO_LARGE = unchecked((int)0x80131484);
- internal const int ISS_E_BLOCK_SIZE_TOO_SMALL = unchecked((int)0x80131483);
- internal const int ISS_E_CALLER = unchecked((int)0x801314A1);
- internal const int ISS_E_CORRUPTED_STORE_FILE = unchecked((int)0x80131480);
- internal const int ISS_E_CREATE_DIR = unchecked((int)0x80131468);
- internal const int ISS_E_CREATE_MUTEX = unchecked((int)0x80131464);
- internal const int ISS_E_DEPRECATE = unchecked((int)0x801314A0);
- internal const int ISS_E_FILE_NOT_MAPPED = unchecked((int)0x80131482);
- internal const int ISS_E_FILE_WRITE = unchecked((int)0x80131466);
- internal const int ISS_E_GET_FILE_SIZE = unchecked((int)0x80131463);
- internal const int ISS_E_ISOSTORE = unchecked((int)0x80131450);
- internal const int ISS_E_LOCK_FAILED = unchecked((int)0x80131465);
- internal const int ISS_E_MACHINE = unchecked((int)0x801314A3);
- internal const int ISS_E_MACHINE_DACL = unchecked((int)0x801314A4);
- internal const int ISS_E_MAP_VIEW_OF_FILE = unchecked((int)0x80131462);
- internal const int ISS_E_OPEN_FILE_MAPPING = unchecked((int)0x80131461);
- internal const int ISS_E_OPEN_STORE_FILE = unchecked((int)0x80131460);
- internal const int ISS_E_PATH_LENGTH = unchecked((int)0x801314A2);
- internal const int ISS_E_SET_FILE_POINTER = unchecked((int)0x80131467);
- internal const int ISS_E_STORE_NOT_OPEN = unchecked((int)0x80131469);
- internal const int ISS_E_STORE_VERSION = unchecked((int)0x80131481);
- internal const int ISS_E_TABLE_ROW_NOT_FOUND = unchecked((int)0x80131486);
- internal const int ISS_E_USAGE_WILL_EXCEED_QUOTA = unchecked((int)0x80131485);
- internal const int META_E_BAD_SIGNATURE = unchecked((int)0x80131192);
- internal const int META_E_CA_FRIENDS_SN_REQUIRED = unchecked((int)0x801311e6);
- internal const int MSEE_E_ASSEMBLYLOADINPROGRESS = unchecked((int)0x80131016);
- internal const int RO_E_CLOSED = unchecked((int)0x80000013);
- internal const int E_BOUNDS = unchecked((int)0x8000000B);
- internal const int RO_E_METADATA_NAME_NOT_FOUND = unchecked((int)0x8000000F);
- internal const int SECURITY_E_INCOMPATIBLE_EVIDENCE = unchecked((int)0x80131403);
- internal const int SECURITY_E_INCOMPATIBLE_SHARE = unchecked((int)0x80131401);
- internal const int SECURITY_E_UNVERIFIABLE = unchecked((int)0x80131402);
- internal const int STG_E_PATHNOTFOUND = unchecked((int)0x80030003);
- public const int COR_E_DIRECTORYNOTFOUND = unchecked((int)0x80070003);
- public const int COR_E_ENDOFSTREAM = unchecked((int)0x80070026); // OS defined
- public const int COR_E_FILELOAD = unchecked((int)0x80131621);
- public const int COR_E_FILENOTFOUND = unchecked((int)0x80070002);
- public const int COR_E_IO = unchecked((int)0x80131620);
- public const int COR_E_PATHTOOLONG = unchecked((int)0x800700CE);
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/Error.cs b/src/mscorlib/corefx/System/IO/Error.cs
deleted file mode 100644
index c8434ffad8..0000000000
--- a/src/mscorlib/corefx/System/IO/Error.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Globalization;
-using System.Diagnostics.Contracts;
-
-namespace System.IO
-{
- /// <summary>
- /// Provides centralized methods for creating exceptions for System.IO.FileSystem.
- /// </summary>
- [Pure]
- internal static class Error
- {
- internal static Exception GetEndOfFile()
- {
- return new EndOfStreamException(SR.IO_EOF_ReadBeyondEOF);
- }
-
- internal static Exception GetFileNotOpen()
- {
- return new ObjectDisposedException(null, SR.ObjectDisposed_FileClosed);
- }
-
- internal static Exception GetReadNotSupported()
- {
- return new NotSupportedException(SR.NotSupported_UnreadableStream);
- }
-
- internal static Exception GetSeekNotSupported()
- {
- return new NotSupportedException(SR.NotSupported_UnseekableStream);
- }
-
- internal static Exception GetWriteNotSupported()
- {
- return new NotSupportedException(SR.NotSupported_UnwritableStream);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/FileStream.Unix.cs b/src/mscorlib/corefx/System/IO/FileStream.Unix.cs
deleted file mode 100644
index f83fc84259..0000000000
--- a/src/mscorlib/corefx/System/IO/FileStream.Unix.cs
+++ /dev/null
@@ -1,934 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Microsoft.Win32.SafeHandles;
-using System.Diagnostics;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace System.IO
-{
- /// <summary>Provides an implementation of a file stream for Unix files.</summary>
- public partial class FileStream : Stream
- {
- /// <summary>File mode.</summary>
- private FileMode _mode;
-
- /// <summary>Advanced options requested when opening the file.</summary>
- private FileOptions _options;
-
- /// <summary>If the file was opened with FileMode.Append, the length of the file when opened; otherwise, -1.</summary>
- private long _appendStart = -1;
-
- /// <summary>
- /// Extra state used by the file stream when _useAsyncIO is true. This includes
- /// the semaphore used to serialize all operation, the buffer/offset/count provided by the
- /// caller for ReadAsync/WriteAsync operations, and the last successful task returned
- /// synchronously from ReadAsync which can be reused if the count matches the next request.
- /// Only initialized when <see cref="_useAsyncIO"/> is true.
- /// </summary>
- private AsyncState _asyncState;
-
- /// <summary>Lazily-initialized value for whether the file supports seeking.</summary>
- private bool? _canSeek;
-
- private SafeFileHandle OpenHandle(FileMode mode, FileShare share, FileOptions options)
- {
- // FileStream performs most of the general argument validation. We can assume here that the arguments
- // are all checked and consistent (e.g. non-null-or-empty path; valid enums in mode, access, share, and options; etc.)
- // Store the arguments
- _mode = mode;
- _options = options;
-
- if (_useAsyncIO)
- _asyncState = new AsyncState();
-
- // Translate the arguments into arguments for an open call.
- Interop.Sys.OpenFlags openFlags = PreOpenConfigurationFromOptions(mode, _access, options); // FileShare currently ignored
-
- // If the file gets created a new, we'll select the permissions for it. Most Unix utilities by default use 666 (read and
- // write for all), so we do the same (even though this doesn't match Windows, where by default it's possible to write out
- // a file and then execute it). No matter what we choose, it'll be subject to the umask applied by the system, such that the
- // actual permissions will typically be less than what we select here.
- const Interop.Sys.Permissions OpenPermissions =
- Interop.Sys.Permissions.S_IRUSR | Interop.Sys.Permissions.S_IWUSR |
- Interop.Sys.Permissions.S_IRGRP | Interop.Sys.Permissions.S_IWGRP |
- Interop.Sys.Permissions.S_IROTH | Interop.Sys.Permissions.S_IWOTH;
-
- // Open the file and store the safe handle.
- return SafeFileHandle.Open(_path, openFlags, (int)OpenPermissions);
- }
-
- /// <summary>Initializes a stream for reading or writing a Unix file.</summary>
- /// <param name="mode">How the file should be opened.</param>
- /// <param name="share">What other access to the file should be allowed. This is currently ignored.</param>
- private void Init(FileMode mode, FileShare share)
- {
- _fileHandle.IsAsync = _useAsyncIO;
-
- // Lock the file if requested via FileShare. This is only advisory locking. FileShare.None implies an exclusive
- // lock on the file and all other modes use a shared lock. While this is not as granular as Windows, not mandatory,
- // and not atomic with file opening, it's better than nothing.
- Interop.Sys.LockOperations lockOperation = (share == FileShare.None) ? Interop.Sys.LockOperations.LOCK_EX : Interop.Sys.LockOperations.LOCK_SH;
- if (Interop.Sys.FLock(_fileHandle, lockOperation | Interop.Sys.LockOperations.LOCK_NB) < 0)
- {
- // The only error we care about is EWOULDBLOCK, which indicates that the file is currently locked by someone
- // else and we would block trying to access it. Other errors, such as ENOTSUP (locking isn't supported) or
- // EACCES (the file system doesn't allow us to lock), will only hamper FileStream's usage without providing value,
- // given again that this is only advisory / best-effort.
- Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
- if (errorInfo.Error == Interop.Error.EWOULDBLOCK)
- {
- throw Interop.GetExceptionForIoErrno(errorInfo, _path, isDirectory: false);
- }
- }
-
- // These provide hints around how the file will be accessed. Specifying both RandomAccess
- // and Sequential together doesn't make sense as they are two competing options on the same spectrum,
- // so if both are specified, we prefer RandomAccess (behavior on Windows is unspecified if both are provided).
- Interop.Sys.FileAdvice fadv =
- (_options & FileOptions.RandomAccess) != 0 ? Interop.Sys.FileAdvice.POSIX_FADV_RANDOM :
- (_options & FileOptions.SequentialScan) != 0 ? Interop.Sys.FileAdvice.POSIX_FADV_SEQUENTIAL :
- 0;
- if (fadv != 0)
- {
- CheckFileCall(Interop.Sys.PosixFAdvise(_fileHandle, 0, 0, fadv),
- ignoreNotSupported: true); // just a hint.
- }
-
- // Jump to the end of the file if opened as Append.
- if (_mode == FileMode.Append)
- {
- _appendStart = SeekCore(0, SeekOrigin.End);
- }
- }
-
- /// <summary>Initializes a stream from an already open file handle (file descriptor).</summary>
- /// <param name="handle">The handle to the file.</param>
- /// <param name="bufferSize">The size of the buffer to use when buffering.</param>
- /// <param name="useAsyncIO">Whether access to the stream is performed asynchronously.</param>
- private void InitFromHandle(SafeFileHandle handle)
- {
- if (_useAsyncIO)
- _asyncState = new AsyncState();
-
- if (CanSeekCore) // use non-virtual CanSeekCore rather than CanSeek to avoid making virtual call during ctor
- SeekCore(0, SeekOrigin.Current);
- }
-
- /// <summary>Translates the FileMode, FileAccess, and FileOptions values into flags to be passed when opening the file.</summary>
- /// <param name="mode">The FileMode provided to the stream's constructor.</param>
- /// <param name="access">The FileAccess provided to the stream's constructor</param>
- /// <param name="options">The FileOptions provided to the stream's constructor</param>
- /// <returns>The flags value to be passed to the open system call.</returns>
- private static Interop.Sys.OpenFlags PreOpenConfigurationFromOptions(FileMode mode, FileAccess access, FileOptions options)
- {
- // Translate FileMode. Most of the values map cleanly to one or more options for open.
- Interop.Sys.OpenFlags flags = default(Interop.Sys.OpenFlags);
- switch (mode)
- {
- default:
- case FileMode.Open: // Open maps to the default behavior for open(...). No flags needed.
- break;
-
- case FileMode.Append: // Append is the same as OpenOrCreate, except that we'll also separately jump to the end later
- case FileMode.OpenOrCreate:
- flags |= Interop.Sys.OpenFlags.O_CREAT;
- break;
-
- case FileMode.Create:
- flags |= (Interop.Sys.OpenFlags.O_CREAT | Interop.Sys.OpenFlags.O_TRUNC);
- break;
-
- case FileMode.CreateNew:
- flags |= (Interop.Sys.OpenFlags.O_CREAT | Interop.Sys.OpenFlags.O_EXCL);
- break;
-
- case FileMode.Truncate:
- flags |= Interop.Sys.OpenFlags.O_TRUNC;
- break;
- }
-
- // Translate FileAccess. All possible values map cleanly to corresponding values for open.
- switch (access)
- {
- case FileAccess.Read:
- flags |= Interop.Sys.OpenFlags.O_RDONLY;
- break;
-
- case FileAccess.ReadWrite:
- flags |= Interop.Sys.OpenFlags.O_RDWR;
- break;
-
- case FileAccess.Write:
- flags |= Interop.Sys.OpenFlags.O_WRONLY;
- break;
- }
-
- // Translate some FileOptions; some just aren't supported, and others will be handled after calling open.
- // - Asynchronous: Handled in ctor, setting _useAsync and SafeFileHandle.IsAsync to true
- // - DeleteOnClose: Doesn't have a Unix equivalent, but we approximate it in Dispose
- // - Encrypted: No equivalent on Unix and is ignored
- // - RandomAccess: Implemented after open if posix_fadvise is available
- // - SequentialScan: Implemented after open if posix_fadvise is available
- // - WriteThrough: Handled here
- if ((options & FileOptions.WriteThrough) != 0)
- {
- flags |= Interop.Sys.OpenFlags.O_SYNC;
- }
-
- return flags;
- }
-
- /// <summary>Gets a value indicating whether the current stream supports seeking.</summary>
- public override bool CanSeek => CanSeekCore;
-
- /// <summary>Gets a value indicating whether the current stream supports seeking.</summary>
- /// <remarks>Separated out of CanSeek to enable making non-virtual call to this logic.</remarks>
- private bool CanSeekCore
- {
- get
- {
- if (_fileHandle.IsClosed)
- {
- return false;
- }
-
- if (!_canSeek.HasValue)
- {
- // Lazily-initialize whether we're able to seek, tested by seeking to our current location.
- _canSeek = Interop.Sys.LSeek(_fileHandle, 0, Interop.Sys.SeekWhence.SEEK_CUR) >= 0;
- }
- return _canSeek.Value;
- }
- }
-
- private long GetLengthInternal()
- {
- // Get the length of the file as reported by the OS
- Interop.Sys.FileStatus status;
- CheckFileCall(Interop.Sys.FStat(_fileHandle, out status));
- long length = status.Size;
-
- // But we may have buffered some data to be written that puts our length
- // beyond what the OS is aware of. Update accordingly.
- if (_writePos > 0 && _filePosition + _writePos > length)
- {
- length = _writePos + _filePosition;
- }
-
- return length;
- }
-
- /// <summary>Releases the unmanaged resources used by the stream.</summary>
- /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
- protected override void Dispose(bool disposing)
- {
- try
- {
- if (_fileHandle != null && !_fileHandle.IsClosed)
- {
- // Flush any remaining data in the file
- FlushWriteBuffer();
-
- // If DeleteOnClose was requested when constructed, delete the file now.
- // (Unix doesn't directly support DeleteOnClose, so we mimic it here.)
- if (_path != null && (_options & FileOptions.DeleteOnClose) != 0)
- {
- // Since we still have the file open, this will end up deleting
- // it (assuming we're the only link to it) once it's closed, but the
- // name will be removed immediately.
- Interop.Sys.Unlink(_path); // ignore errors; it's valid that the path may no longer exist
- }
- }
- }
- finally
- {
- if (_fileHandle != null && !_fileHandle.IsClosed)
- {
- _fileHandle.Dispose();
- }
- base.Dispose(disposing);
- }
- }
-
- /// <summary>Flushes the OS buffer. This does not flush the internal read/write buffer.</summary>
- private void FlushOSBuffer()
- {
- if (Interop.Sys.FSync(_fileHandle) < 0)
- {
- Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
- switch (errorInfo.Error)
- {
- case Interop.Error.EROFS:
- case Interop.Error.EINVAL:
- case Interop.Error.ENOTSUP:
- // Ignore failures due to the FileStream being bound to a special file that
- // doesn't support synchronization. In such cases there's nothing to flush.
- break;
- default:
- throw Interop.GetExceptionForIoErrno(errorInfo, _path, isDirectory: false);
- }
- }
- }
-
- /// <summary>Writes any data in the write buffer to the underlying stream and resets the buffer.</summary>
- private void FlushWriteBuffer()
- {
- AssertBufferInvariants();
- if (_writePos > 0)
- {
- WriteNative(GetBuffer(), 0, _writePos);
- _writePos = 0;
- }
- }
-
- /// <summary>Asynchronously clears all buffers for this stream, causing any buffered data to be written to the underlying device.</summary>
- /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
- /// <returns>A task that represents the asynchronous flush operation.</returns>
- private Task FlushAsyncInternal(CancellationToken cancellationToken)
- {
- if (cancellationToken.IsCancellationRequested)
- {
- return Task.FromCanceled(cancellationToken);
- }
- if (_fileHandle.IsClosed)
- {
- throw Error.GetFileNotOpen();
- }
-
- // As with Win32FileStream, flush the buffers synchronously to avoid race conditions.
- try
- {
- FlushInternalBuffer();
- }
- catch (Exception e)
- {
- return Task.FromException(e);
- }
-
- // We then separately flush to disk asynchronously. This is only
- // necessary if we support writing; otherwise, we're done.
- if (CanWrite)
- {
- return Task.Factory.StartNew(
- state => ((FileStream)state).FlushOSBuffer(),
- this,
- cancellationToken,
- TaskCreationOptions.DenyChildAttach,
- TaskScheduler.Default);
- }
- else
- {
- return Task.CompletedTask;
- }
- }
-
- /// <summary>Sets the length of this stream to the given value.</summary>
- /// <param name="value">The new length of the stream.</param>
- private void SetLengthInternal(long value)
- {
- FlushInternalBuffer();
-
- if (_appendStart != -1 && value < _appendStart)
- {
- throw new IOException(SR.IO_SetLengthAppendTruncate);
- }
-
- long origPos = _filePosition;
-
- VerifyOSHandlePosition();
-
- if (_filePosition != value)
- {
- SeekCore(value, SeekOrigin.Begin);
- }
-
- CheckFileCall(Interop.Sys.FTruncate(_fileHandle, value));
-
- // Return file pointer to where it was before setting length
- if (origPos != value)
- {
- if (origPos < value)
- {
- SeekCore(origPos, SeekOrigin.Begin);
- }
- else
- {
- SeekCore(0, SeekOrigin.End);
- }
- }
- }
-
- /// <summary>Reads a block of bytes from the stream and writes the data in a given buffer.</summary>
- /// <param name="array">
- /// When this method returns, contains the specified byte array with the values between offset and
- /// (offset + count - 1) replaced by the bytes read from the current source.
- /// </param>
- /// <param name="offset">The byte offset in array at which the read bytes will be placed.</param>
- /// <param name="count">The maximum number of bytes to read. </param>
- /// <returns>
- /// The total number of bytes read into the buffer. This might be less than the number of bytes requested
- /// if that number of bytes are not currently available, or zero if the end of the stream is reached.
- /// </returns>
- public override int Read(byte[] array, int offset, int count)
- {
- ValidateReadWriteArgs(array, offset, count);
-
- if (_useAsyncIO)
- {
- _asyncState.Wait();
- try { return ReadCore(array, offset, count); }
- finally { _asyncState.Release(); }
- }
- else
- {
- return ReadCore(array, offset, count);
- }
- }
-
- /// <summary>Reads a block of bytes from the stream and writes the data in a given buffer.</summary>
- /// <param name="array">
- /// When this method returns, contains the specified byte array with the values between offset and
- /// (offset + count - 1) replaced by the bytes read from the current source.
- /// </param>
- /// <param name="offset">The byte offset in array at which the read bytes will be placed.</param>
- /// <param name="count">The maximum number of bytes to read. </param>
- /// <returns>
- /// The total number of bytes read into the buffer. This might be less than the number of bytes requested
- /// if that number of bytes are not currently available, or zero if the end of the stream is reached.
- /// </returns>
- private int ReadCore(byte[] array, int offset, int count)
- {
- PrepareForReading();
-
- // Are there any bytes available in the read buffer? If yes,
- // we can just return from the buffer. If the buffer is empty
- // or has no more available data in it, we can either refill it
- // (and then read from the buffer into the user's buffer) or
- // we can just go directly into the user's buffer, if they asked
- // for more data than we'd otherwise buffer.
- int numBytesAvailable = _readLength - _readPos;
- bool readFromOS = false;
- if (numBytesAvailable == 0)
- {
- // If we're not able to seek, then we're not able to rewind the stream (i.e. flushing
- // a read buffer), in which case we don't want to use a read buffer. Similarly, if
- // the user has asked for more data than we can buffer, we also want to skip the buffer.
- if (!CanSeek || (count >= _bufferLength))
- {
- // Read directly into the user's buffer
- _readPos = _readLength = 0;
- return ReadNative(array, offset, count);
- }
- else
- {
- // Read into our buffer.
- _readLength = numBytesAvailable = ReadNative(GetBuffer(), 0, _bufferLength);
- _readPos = 0;
- if (numBytesAvailable == 0)
- {
- return 0;
- }
-
- // Note that we did an OS read as part of this Read, so that later
- // we don't try to do one again if what's in the buffer doesn't
- // meet the user's request.
- readFromOS = true;
- }
- }
-
- // Now that we know there's data in the buffer, read from it into the user's buffer.
- Debug.Assert(numBytesAvailable > 0, "Data must be in the buffer to be here");
- int bytesRead = Math.Min(numBytesAvailable, count);
- Buffer.BlockCopy(GetBuffer(), _readPos, array, offset, bytesRead);
- _readPos += bytesRead;
-
- // We may not have had enough data in the buffer to completely satisfy the user's request.
- // While Read doesn't require that we return as much data as the user requested (any amount
- // up to the requested count is fine), FileStream on Windows tries to do so by doing a
- // subsequent read from the file if we tried to satisfy the request with what was in the
- // buffer but the buffer contained less than the requested count. To be consistent with that
- // behavior, we do the same thing here on Unix. Note that we may still get less the requested
- // amount, as the OS may give us back fewer than we request, either due to reaching the end of
- // file, or due to its own whims.
- if (!readFromOS && bytesRead < count)
- {
- Debug.Assert(_readPos == _readLength, "bytesToRead should only be < count if numBytesAvailable < count");
- _readPos = _readLength = 0; // no data left in the read buffer
- bytesRead += ReadNative(array, offset + bytesRead, count - bytesRead);
- }
-
- return bytesRead;
- }
-
- /// <summary>Unbuffered, reads a block of bytes from the stream and writes the data in a given buffer.</summary>
- /// <param name="array">
- /// When this method returns, contains the specified byte array with the values between offset and
- /// (offset + count - 1) replaced by the bytes read from the current source.
- /// </param>
- /// <param name="offset">The byte offset in array at which the read bytes will be placed.</param>
- /// <param name="count">The maximum number of bytes to read. </param>
- /// <returns>
- /// The total number of bytes read into the buffer. This might be less than the number of bytes requested
- /// if that number of bytes are not currently available, or zero if the end of the stream is reached.
- /// </returns>
- private unsafe int ReadNative(byte[] array, int offset, int count)
- {
- FlushWriteBuffer(); // we're about to read; dump the write buffer
-
- VerifyOSHandlePosition();
-
- int bytesRead;
- fixed (byte* bufPtr = array)
- {
- bytesRead = CheckFileCall(Interop.Sys.Read(_fileHandle, bufPtr + offset, count));
- Debug.Assert(bytesRead <= count);
- }
- _filePosition += bytesRead;
- return bytesRead;
- }
-
- /// <summary>
- /// Asynchronously reads a sequence of bytes from the current stream and advances
- /// the position within the stream by the number of bytes read.
- /// </summary>
- /// <param name="buffer">The buffer to write the data into.</param>
- /// <param name="offset">The byte offset in buffer at which to begin writing data from the stream.</param>
- /// <param name="count">The maximum number of bytes to read.</param>
- /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
- /// <returns>A task that represents the asynchronous read operation.</returns>
- private Task<int> ReadAsyncInternal(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
- {
- if (_useAsyncIO)
- {
- if (!CanRead) // match Windows behavior; this gets thrown synchronously
- {
- throw Error.GetReadNotSupported();
- }
-
- // Serialize operations using the semaphore.
- Task waitTask = _asyncState.WaitAsync();
-
- // If we got ownership immediately, and if there's enough data in our buffer
- // to satisfy the full request of the caller, hand back the buffered data.
- // While it would be a legal implementation of the Read contract, we don't
- // hand back here less than the amount requested so as to match the behavior
- // in ReadCore that will make a native call to try to fulfill the remainder
- // of the request.
- if (waitTask.Status == TaskStatus.RanToCompletion)
- {
- int numBytesAvailable = _readLength - _readPos;
- if (numBytesAvailable >= count)
- {
- try
- {
- PrepareForReading();
-
- Buffer.BlockCopy(GetBuffer(), _readPos, buffer, offset, count);
- _readPos += count;
-
- return _asyncState._lastSuccessfulReadTask != null && _asyncState._lastSuccessfulReadTask.Result == count ?
- _asyncState._lastSuccessfulReadTask :
- (_asyncState._lastSuccessfulReadTask = Task.FromResult(count));
- }
- catch (Exception exc)
- {
- return Task.FromException<int>(exc);
- }
- finally
- {
- _asyncState.Release();
- }
- }
- }
-
- // Otherwise, issue the whole request asynchronously.
- _asyncState.Update(buffer, offset, count);
- return waitTask.ContinueWith((t, s) =>
- {
- // The options available on Unix for writing asynchronously to an arbitrary file
- // handle typically amount to just using another thread to do the synchronous write,
- // which is exactly what this implementation does. This does mean there are subtle
- // differences in certain FileStream behaviors between Windows and Unix when multiple
- // asynchronous operations are issued against the stream to execute concurrently; on
- // Unix the operations will be serialized due to the usage of a semaphore, but the
- // position /length information won't be updated until after the write has completed,
- // whereas on Windows it may happen before the write has completed.
-
- Debug.Assert(t.Status == TaskStatus.RanToCompletion);
- var thisRef = (FileStream)s;
- try
- {
- byte[] b = thisRef._asyncState._buffer;
- thisRef._asyncState._buffer = null; // remove reference to user's buffer
- return thisRef.ReadCore(b, thisRef._asyncState._offset, thisRef._asyncState._count);
- }
- finally { thisRef._asyncState.Release(); }
- }, this, CancellationToken.None, TaskContinuationOptions.DenyChildAttach, TaskScheduler.Default);
- }
- else
- {
- return base.ReadAsync(buffer, offset, count, cancellationToken);
- }
- }
-
- /// <summary>
- /// Reads a byte from the stream and advances the position within the stream
- /// by one byte, or returns -1 if at the end of the stream.
- /// </summary>
- /// <returns>The unsigned byte cast to an Int32, or -1 if at the end of the stream.</returns>
- public override int ReadByte()
- {
- if (_useAsyncIO)
- {
- _asyncState.Wait();
- try { return ReadByteCore(); }
- finally { _asyncState.Release(); }
- }
- else
- {
- return ReadByteCore();
- }
- }
-
- /// <summary>Writes a block of bytes to the file stream.</summary>
- /// <param name="array">The buffer containing data to write to the stream.</param>
- /// <param name="offset">The zero-based byte offset in array from which to begin copying bytes to the stream.</param>
- /// <param name="count">The maximum number of bytes to write.</param>
- public override void Write(byte[] array, int offset, int count)
- {
- ValidateReadWriteArgs(array, offset, count);
-
- if (_useAsyncIO)
- {
- _asyncState.Wait();
- try { WriteCore(array, offset, count); }
- finally { _asyncState.Release(); }
- }
- else
- {
- WriteCore(array, offset, count);
- }
- }
-
- /// <summary>Writes a block of bytes to the file stream.</summary>
- /// <param name="array">The buffer containing data to write to the stream.</param>
- /// <param name="offset">The zero-based byte offset in array from which to begin copying bytes to the stream.</param>
- /// <param name="count">The maximum number of bytes to write.</param>
- private void WriteCore(byte[] array, int offset, int count)
- {
- PrepareForWriting();
-
- // If no data is being written, nothing more to do.
- if (count == 0)
- {
- return;
- }
-
- // If there's already data in our write buffer, then we need to go through
- // our buffer to ensure data isn't corrupted.
- if (_writePos > 0)
- {
- // If there's space remaining in the buffer, then copy as much as
- // we can from the user's buffer into ours.
- int spaceRemaining = _bufferLength - _writePos;
- if (spaceRemaining > 0)
- {
- int bytesToCopy = Math.Min(spaceRemaining, count);
- Buffer.BlockCopy(array, offset, GetBuffer(), _writePos, bytesToCopy);
- _writePos += bytesToCopy;
-
- // If we've successfully copied all of the user's data, we're done.
- if (count == bytesToCopy)
- {
- return;
- }
-
- // Otherwise, keep track of how much more data needs to be handled.
- offset += bytesToCopy;
- count -= bytesToCopy;
- }
-
- // At this point, the buffer is full, so flush it out.
- FlushWriteBuffer();
- }
-
- // Our buffer is now empty. If using the buffer would slow things down (because
- // the user's looking to write more data than we can store in the buffer),
- // skip the buffer. Otherwise, put the remaining data into the buffer.
- Debug.Assert(_writePos == 0);
- if (count >= _bufferLength)
- {
- WriteNative(array, offset, count);
- }
- else
- {
- Buffer.BlockCopy(array, offset, GetBuffer(), _writePos, count);
- _writePos = count;
- }
- }
-
- /// <summary>Unbuffered, writes a block of bytes to the file stream.</summary>
- /// <param name="array">The buffer containing data to write to the stream.</param>
- /// <param name="offset">The zero-based byte offset in array from which to begin copying bytes to the stream.</param>
- /// <param name="count">The maximum number of bytes to write.</param>
- private unsafe void WriteNative(byte[] array, int offset, int count)
- {
- VerifyOSHandlePosition();
-
- fixed (byte* bufPtr = array)
- {
- while (count > 0)
- {
- int bytesWritten = CheckFileCall(Interop.Sys.Write(_fileHandle, bufPtr + offset, count));
- Debug.Assert(bytesWritten <= count);
-
- _filePosition += bytesWritten;
- count -= bytesWritten;
- offset += bytesWritten;
- }
- }
- }
-
- /// <summary>
- /// Asynchronously writes a sequence of bytes to the current stream, advances
- /// the current position within this stream by the number of bytes written, and
- /// monitors cancellation requests.
- /// </summary>
- /// <param name="buffer">The buffer to write data from.</param>
- /// <param name="offset">The zero-based byte offset in buffer from which to begin copying bytes to the stream.</param>
- /// <param name="count">The maximum number of bytes to write.</param>
- /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
- /// <returns>A task that represents the asynchronous write operation.</returns>
- private Task WriteAsyncInternal(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
- {
- if (cancellationToken.IsCancellationRequested)
- return Task.FromCanceled(cancellationToken);
-
- if (_fileHandle.IsClosed)
- throw Error.GetFileNotOpen();
-
- if (_useAsyncIO)
- {
- if (!CanWrite) // match Windows behavior; this gets thrown synchronously
- {
- throw Error.GetWriteNotSupported();
- }
-
- // Serialize operations using the semaphore.
- Task waitTask = _asyncState.WaitAsync();
-
- // If we got ownership immediately, and if there's enough space in our buffer
- // to buffer the entire write request, then do so and we're done.
- if (waitTask.Status == TaskStatus.RanToCompletion)
- {
- int spaceRemaining = _bufferLength - _writePos;
- if (spaceRemaining >= count)
- {
- try
- {
- PrepareForWriting();
-
- Buffer.BlockCopy(buffer, offset, GetBuffer(), _writePos, count);
- _writePos += count;
-
- return Task.CompletedTask;
- }
- catch (Exception exc)
- {
- return Task.FromException(exc);
- }
- finally
- {
- _asyncState.Release();
- }
- }
- }
-
- // Otherwise, issue the whole request asynchronously.
- _asyncState.Update(buffer, offset, count);
- return waitTask.ContinueWith((t, s) =>
- {
- // The options available on Unix for writing asynchronously to an arbitrary file
- // handle typically amount to just using another thread to do the synchronous write,
- // which is exactly what this implementation does. This does mean there are subtle
- // differences in certain FileStream behaviors between Windows and Unix when multiple
- // asynchronous operations are issued against the stream to execute concurrently; on
- // Unix the operations will be serialized due to the usage of a semaphore, but the
- // position /length information won't be updated until after the write has completed,
- // whereas on Windows it may happen before the write has completed.
-
- Debug.Assert(t.Status == TaskStatus.RanToCompletion);
- var thisRef = (FileStream)s;
- try
- {
- byte[] b = thisRef._asyncState._buffer;
- thisRef._asyncState._buffer = null; // remove reference to user's buffer
- thisRef.WriteCore(b, thisRef._asyncState._offset, thisRef._asyncState._count);
- }
- finally { thisRef._asyncState.Release(); }
- }, this, CancellationToken.None, TaskContinuationOptions.DenyChildAttach, TaskScheduler.Default);
- }
- else
- {
- return base.WriteAsync(buffer, offset, count, cancellationToken);
- }
- }
-
- /// <summary>
- /// Writes a byte to the current position in the stream and advances the position
- /// within the stream by one byte.
- /// </summary>
- /// <param name="value">The byte to write to the stream.</param>
- public override void WriteByte(byte value) // avoids an array allocation in the base implementation
- {
- if (_useAsyncIO)
- {
- _asyncState.Wait();
- try { WriteByteCore(value); }
- finally { _asyncState.Release(); }
- }
- else
- {
- WriteByteCore(value);
- }
- }
-
- /// <summary>Prevents other processes from reading from or writing to the FileStream.</summary>
- /// <param name="position">The beginning of the range to lock.</param>
- /// <param name="length">The range to be locked.</param>
- private void LockInternal(long position, long length)
- {
- CheckFileCall(Interop.Sys.LockFileRegion(_fileHandle, position, length, Interop.Sys.LockType.F_WRLCK));
- }
-
- /// <summary>Allows access by other processes to all or part of a file that was previously locked.</summary>
- /// <param name="position">The beginning of the range to unlock.</param>
- /// <param name="length">The range to be unlocked.</param>
- private void UnlockInternal(long position, long length)
- {
- CheckFileCall(Interop.Sys.LockFileRegion(_fileHandle, position, length, Interop.Sys.LockType.F_UNLCK));
- }
-
- /// <summary>Sets the current position of this stream to the given value.</summary>
- /// <param name="offset">The point relative to origin from which to begin seeking. </param>
- /// <param name="origin">
- /// Specifies the beginning, the end, or the current position as a reference
- /// point for offset, using a value of type SeekOrigin.
- /// </param>
- /// <returns>The new position in the stream.</returns>
- public override long Seek(long offset, SeekOrigin origin)
- {
- if (origin < SeekOrigin.Begin || origin > SeekOrigin.End)
- {
- throw new ArgumentException(SR.Argument_InvalidSeekOrigin, nameof(origin));
- }
- if (_fileHandle.IsClosed)
- {
- throw Error.GetFileNotOpen();
- }
- if (!CanSeek)
- {
- throw Error.GetSeekNotSupported();
- }
-
- VerifyOSHandlePosition();
-
- // Flush our write/read buffer. FlushWrite will output any write buffer we have and reset _bufferWritePos.
- // We don't call FlushRead, as that will do an unnecessary seek to rewind the read buffer, and since we're
- // about to seek and update our position, we can simply update the offset as necessary and reset our read
- // position and length to 0. (In the future, for some simple cases we could potentially add an optimization
- // here to just move data around in the buffer for short jumps, to avoid re-reading the data from disk.)
- FlushWriteBuffer();
- if (origin == SeekOrigin.Current)
- {
- offset -= (_readLength - _readPos);
- }
- _readPos = _readLength = 0;
-
- // Keep track of where we were, in case we're in append mode and need to verify
- long oldPos = 0;
- if (_appendStart >= 0)
- {
- oldPos = SeekCore(0, SeekOrigin.Current);
- }
-
- // Jump to the new location
- long pos = SeekCore(offset, origin);
-
- // Prevent users from overwriting data in a file that was opened in append mode.
- if (_appendStart != -1 && pos < _appendStart)
- {
- SeekCore(oldPos, SeekOrigin.Begin);
- throw new IOException(SR.IO_SeekAppendOverwrite);
- }
-
- // Return the new position
- return pos;
- }
-
- /// <summary>Sets the current position of this stream to the given value.</summary>
- /// <param name="offset">The point relative to origin from which to begin seeking. </param>
- /// <param name="origin">
- /// Specifies the beginning, the end, or the current position as a reference
- /// point for offset, using a value of type SeekOrigin.
- /// </param>
- /// <returns>The new position in the stream.</returns>
- private long SeekCore(long offset, SeekOrigin origin)
- {
- Debug.Assert(!_fileHandle.IsClosed && (GetType() != typeof(FileStream) || CanSeek)); // verify that we can seek, but only if CanSeek won't be a virtual call (which could happen in the ctor)
- Debug.Assert(origin >= SeekOrigin.Begin && origin <= SeekOrigin.End);
-
- long pos = CheckFileCall(Interop.Sys.LSeek(_fileHandle, offset, (Interop.Sys.SeekWhence)(int)origin)); // SeekOrigin values are the same as Interop.libc.SeekWhence values
- _filePosition = pos;
- return pos;
- }
-
- private long CheckFileCall(long result, bool ignoreNotSupported = false)
- {
- if (result < 0)
- {
- Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();
- if (!(ignoreNotSupported && errorInfo.Error == Interop.Error.ENOTSUP))
- {
- throw Interop.GetExceptionForIoErrno(errorInfo, _path, isDirectory: false);
- }
- }
-
- return result;
- }
-
- private int CheckFileCall(int result, bool ignoreNotSupported = false)
- {
- CheckFileCall((long)result, ignoreNotSupported);
-
- return result;
- }
-
- /// <summary>State used when the stream is in async mode.</summary>
- private sealed class AsyncState : SemaphoreSlim
- {
- /// <summary>The caller's buffer currently being used by the active async operation.</summary>
- internal byte[] _buffer;
- /// <summary>The caller's offset currently being used by the active async operation.</summary>
- internal int _offset;
- /// <summary>The caller's count currently being used by the active async operation.</summary>
- internal int _count;
- /// <summary>The last task successfully, synchronously returned task from ReadAsync.</summary>
- internal Task<int> _lastSuccessfulReadTask;
-
- /// <summary>Initialize the AsyncState.</summary>
- internal AsyncState() : base(initialCount: 1, maxCount: 1) { }
-
- /// <summary>Sets the active buffer, offset, and count.</summary>
- internal void Update(byte[] buffer, int offset, int count)
- {
- _buffer = buffer;
- _offset = offset;
- _count = count;
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/FileStream.Win32.cs b/src/mscorlib/corefx/System/IO/FileStream.Win32.cs
deleted file mode 100644
index 683eef5e43..0000000000
--- a/src/mscorlib/corefx/System/IO/FileStream.Win32.cs
+++ /dev/null
@@ -1,1770 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Buffers;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Win32.SafeHandles;
-using System.Runtime.CompilerServices;
-
-/*
- * Win32FileStream supports different modes of accessing the disk - async mode
- * and sync mode. They are two completely different codepaths in the
- * sync & async methods (i.e. Read/Write vs. ReadAsync/WriteAsync). File
- * handles in NT can be opened in only sync or overlapped (async) mode,
- * and we have to deal with this pain. Stream has implementations of
- * the sync methods in terms of the async ones, so we'll
- * call through to our base class to get those methods when necessary.
- *
- * Also buffering is added into Win32FileStream as well. Folded in the
- * code from BufferedStream, so all the comments about it being mostly
- * aggressive (and the possible perf improvement) apply to Win32FileStream as
- * well. Also added some buffering to the async code paths.
- *
- * Class Invariants:
- * The class has one buffer, shared for reading & writing. It can only be
- * used for one or the other at any point in time - not both. The following
- * should be true:
- * 0 <= _readPos <= _readLen < _bufferSize
- * 0 <= _writePos < _bufferSize
- * _readPos == _readLen && _readPos > 0 implies the read buffer is valid,
- * but we're at the end of the buffer.
- * _readPos == _readLen == 0 means the read buffer contains garbage.
- * Either _writePos can be greater than 0, or _readLen & _readPos can be
- * greater than zero, but neither can be greater than zero at the same time.
- *
- */
-
-namespace System.IO
-{
- public partial class FileStream : Stream
- {
- private bool _canSeek;
- private bool _isPipe; // Whether to disable async buffering code.
- private long _appendStart; // When appending, prevent overwriting file.
-
- private static unsafe IOCompletionCallback s_ioCallback = FileStreamCompletionSource.IOCallback;
-
- private Task<int> _lastSynchronouslyCompletedTask = null; // cached task for read ops that complete synchronously
- private Task _activeBufferOperation = null; // tracks in-progress async ops using the buffer
- private PreAllocatedOverlapped _preallocatedOverlapped; // optimization for async ops to avoid per-op allocations
- private FileStreamCompletionSource _currentOverlappedOwner; // async op currently using the preallocated overlapped
-
- private SafeFileHandle OpenHandle(FileMode mode, FileShare share, FileOptions options)
- {
- Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = GetSecAttrs(share);
-
- int fAccess =
- ((_access & FileAccess.Read) == FileAccess.Read ? GENERIC_READ : 0) |
- ((_access & FileAccess.Write) == FileAccess.Write ? GENERIC_WRITE : 0);
-
- // Our Inheritable bit was stolen from Windows, but should be set in
- // the security attributes class. Don't leave this bit set.
- share &= ~FileShare.Inheritable;
-
- // Must use a valid Win32 constant here...
- if (mode == FileMode.Append)
- mode = FileMode.OpenOrCreate;
-
- int flagsAndAttributes = (int)options;
-
- // For mitigating local elevation of privilege attack through named pipes
- // make sure we always call CreateFile with SECURITY_ANONYMOUS so that the
- // named pipe server can't impersonate a high privileged client security context
- flagsAndAttributes |= (Interop.Kernel32.SecurityOptions.SECURITY_SQOS_PRESENT | Interop.Kernel32.SecurityOptions.SECURITY_ANONYMOUS);
-
- // Don't pop up a dialog for reading from an empty floppy drive
- uint oldMode = Interop.Kernel32.SetErrorMode(Interop.Kernel32.SEM_FAILCRITICALERRORS);
- try
- {
- SafeFileHandle fileHandle = Interop.Kernel32.SafeCreateFile(_path, fAccess, share, ref secAttrs, mode, flagsAndAttributes, IntPtr.Zero);
- fileHandle.IsAsync = _useAsyncIO;
-
- if (fileHandle.IsInvalid)
- {
- // Return a meaningful exception with the full path.
-
- // NT5 oddity - when trying to open "C:\" as a Win32FileStream,
- // we usually get ERROR_PATH_NOT_FOUND from the OS. We should
- // probably be consistent w/ every other directory.
- int errorCode = Marshal.GetLastWin32Error();
-
- if (errorCode == Interop.Errors.ERROR_PATH_NOT_FOUND && _path.Equals(Directory.InternalGetDirectoryRoot(_path)))
- errorCode = Interop.Errors.ERROR_ACCESS_DENIED;
-
- throw Win32Marshal.GetExceptionForWin32Error(errorCode, _path);
- }
-
- return fileHandle;
- }
- finally
- {
- Interop.Kernel32.SetErrorMode(oldMode);
- }
- }
-
- private void Init(FileMode mode, FileShare share)
- {
- // Disallow access to all non-file devices from the Win32FileStream
- // constructors that take a String. Everyone else can call
- // CreateFile themselves then use the constructor that takes an
- // IntPtr. Disallows "con:", "com1:", "lpt1:", etc.
- int fileType = Interop.Kernel32.GetFileType(_fileHandle);
- if (fileType != Interop.Kernel32.FileTypes.FILE_TYPE_DISK)
- {
- _fileHandle.Dispose();
- throw new NotSupportedException(SR.NotSupported_FileStreamOnNonFiles);
- }
-
- // This is necessary for async IO using IO Completion ports via our
- // managed Threadpool API's. This (theoretically) calls the OS's
- // BindIoCompletionCallback method, and passes in a stub for the
- // LPOVERLAPPED_COMPLETION_ROUTINE. This stub looks at the Overlapped
- // struct for this request and gets a delegate to a managed callback
- // from there, which it then calls on a threadpool thread. (We allocate
- // our native OVERLAPPED structs 2 pointers too large and store EE state
- // & GC handles there, one to an IAsyncResult, the other to a delegate.)
- if (_useAsyncIO)
- {
- try
- {
- _fileHandle.ThreadPoolBinding = ThreadPoolBoundHandle.BindHandle(_fileHandle);
- }
- catch (ArgumentException ex)
- {
- throw new IOException(SR.IO_BindHandleFailed, ex);
- }
- finally
- {
- if (_fileHandle.ThreadPoolBinding == null)
- {
- // We should close the handle so that the handle is not open until SafeFileHandle GC
- Debug.Assert(!_exposedHandle, "Are we closing handle that we exposed/not own, how?");
- _fileHandle.Dispose();
- }
- }
- }
-
- _canSeek = true;
-
- // For Append mode...
- if (mode == FileMode.Append)
- {
- _appendStart = SeekCore(0, SeekOrigin.End);
- }
- else
- {
- _appendStart = -1;
- }
- }
-
- private void InitFromHandle(SafeFileHandle handle)
- {
- int handleType = Interop.Kernel32.GetFileType(_fileHandle);
- Debug.Assert(handleType == Interop.Kernel32.FileTypes.FILE_TYPE_DISK || handleType == Interop.Kernel32.FileTypes.FILE_TYPE_PIPE || handleType == Interop.Kernel32.FileTypes.FILE_TYPE_CHAR, "FileStream was passed an unknown file type!");
-
- _canSeek = handleType == Interop.Kernel32.FileTypes.FILE_TYPE_DISK;
- _isPipe = handleType == Interop.Kernel32.FileTypes.FILE_TYPE_PIPE;
-
- // This is necessary for async IO using IO Completion ports via our
- // managed Threadpool API's. This calls the OS's
- // BindIoCompletionCallback method, and passes in a stub for the
- // LPOVERLAPPED_COMPLETION_ROUTINE. This stub looks at the Overlapped
- // struct for this request and gets a delegate to a managed callback
- // from there, which it then calls on a threadpool thread. (We allocate
- // our native OVERLAPPED structs 2 pointers too large and store EE
- // state & a handle to a delegate there.)
- //
- // If, however, we've already bound this file handle to our completion port,
- // don't try to bind it again because it will fail. A handle can only be
- // bound to a single completion port at a time.
- if (_useAsyncIO && !GetSuppressBindHandle(handle))
- {
- try
- {
- _fileHandle.ThreadPoolBinding = ThreadPoolBoundHandle.BindHandle(_fileHandle);
- }
- catch (Exception ex)
- {
- // If you passed in a synchronous handle and told us to use
- // it asynchronously, throw here.
- throw new ArgumentException(SR.Arg_HandleNotAsync, nameof(handle), ex);
- }
- }
- else if (!_useAsyncIO)
- {
- if (handleType != Interop.Kernel32.FileTypes.FILE_TYPE_PIPE)
- VerifyHandleIsSync();
- }
-
- if (_canSeek)
- SeekCore(0, SeekOrigin.Current);
- else
- _filePosition = 0;
- }
-
- private static bool GetSuppressBindHandle(SafeFileHandle handle)
- {
- return handle.IsAsync.HasValue ? handle.IsAsync.Value : false;
- }
-
- private unsafe static Interop.Kernel32.SECURITY_ATTRIBUTES GetSecAttrs(FileShare share)
- {
- Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = default(Interop.Kernel32.SECURITY_ATTRIBUTES);
- if ((share & FileShare.Inheritable) != 0)
- {
- secAttrs = new Interop.Kernel32.SECURITY_ATTRIBUTES();
- secAttrs.nLength = (uint)sizeof(Interop.Kernel32.SECURITY_ATTRIBUTES);
-
- secAttrs.bInheritHandle = Interop.BOOL.TRUE;
- }
- return secAttrs;
- }
-
- // Verifies that this handle supports synchronous IO operations (unless you
- // didn't open it for either reading or writing).
- private unsafe void VerifyHandleIsSync()
- {
- Debug.Assert(!_useAsyncIO);
-
- // Do NOT use this method on pipes. Reading or writing to a pipe may
- // cause an app to block incorrectly, introducing a deadlock (depending
- // on whether a write will wake up an already-blocked thread or this
- // Win32FileStream's thread).
- Debug.Assert(Interop.Kernel32.GetFileType(_fileHandle) != Interop.Kernel32.FileTypes.FILE_TYPE_PIPE);
-
- byte* bytes = stackalloc byte[1];
- int numBytesReadWritten;
- int r = -1;
-
- // If the handle is a pipe, ReadFile will block until there
- // has been a write on the other end. We'll just have to deal with it,
- // For the read end of a pipe, you can mess up and
- // accidentally read synchronously from an async pipe.
- if ((_access & FileAccess.Read) != 0) // don't use the virtual CanRead or CanWrite, as this may be used in the ctor
- {
- r = Interop.Kernel32.ReadFile(_fileHandle, bytes, 0, out numBytesReadWritten, IntPtr.Zero);
- }
- else if ((_access & FileAccess.Write) != 0) // don't use the virtual CanRead or CanWrite, as this may be used in the ctor
- {
- r = Interop.Kernel32.WriteFile(_fileHandle, bytes, 0, out numBytesReadWritten, IntPtr.Zero);
- }
-
- if (r == 0)
- {
- int errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid(throwIfInvalidHandle: true);
- if (errorCode == ERROR_INVALID_PARAMETER)
- throw new ArgumentException(SR.Arg_HandleNotSync, "handle");
- }
- }
-
- private bool HasActiveBufferOperation
- {
- get { return _activeBufferOperation != null && !_activeBufferOperation.IsCompleted; }
- }
-
- public override bool CanSeek
- {
- get { return _canSeek; }
- }
-
- private long GetLengthInternal()
- {
- Interop.Kernel32.FILE_STANDARD_INFO info = new Interop.Kernel32.FILE_STANDARD_INFO();
-
- if (!Interop.Kernel32.GetFileInformationByHandleEx(_fileHandle, Interop.Kernel32.FILE_INFO_BY_HANDLE_CLASS.FileStandardInfo, out info, (uint)Marshal.SizeOf<Interop.Kernel32.FILE_STANDARD_INFO>()))
- throw Win32Marshal.GetExceptionForLastWin32Error();
- long len = info.EndOfFile;
- // If we're writing near the end of the file, we must include our
- // internal buffer in our Length calculation. Don't flush because
- // we use the length of the file in our async write method.
- if (_writePos > 0 && _filePosition + _writePos > len)
- len = _writePos + _filePosition;
- return len;
- }
-
- protected override void Dispose(bool disposing)
- {
- // Nothing will be done differently based on whether we are
- // disposing vs. finalizing. This is taking advantage of the
- // weak ordering between normal finalizable objects & critical
- // finalizable objects, which I included in the SafeHandle
- // design for Win32FileStream, which would often "just work" when
- // finalized.
- try
- {
- if (_fileHandle != null && !_fileHandle.IsClosed)
- {
- // Flush data to disk iff we were writing. After
- // thinking about this, we also don't need to flush
- // our read position, regardless of whether the handle
- // was exposed to the user. They probably would NOT
- // want us to do this.
- if (_writePos > 0)
- {
- FlushWriteBuffer(!disposing);
- }
- }
- }
- finally
- {
- if (_fileHandle != null && !_fileHandle.IsClosed)
- {
- if (_fileHandle.ThreadPoolBinding != null)
- _fileHandle.ThreadPoolBinding.Dispose();
-
- _fileHandle.Dispose();
- }
-
- if (_preallocatedOverlapped != null)
- _preallocatedOverlapped.Dispose();
-
- _canSeek = false;
-
- // Don't set the buffer to null, to avoid a NullReferenceException
- // when users have a race condition in their code (i.e. they call
- // Close when calling another method on Stream like Read).
- //_buffer = null;
- base.Dispose(disposing);
- }
- }
-
- private void FlushOSBuffer()
- {
- if (!Interop.Kernel32.FlushFileBuffers(_fileHandle))
- {
- throw Win32Marshal.GetExceptionForLastWin32Error();
- }
- }
-
- // Returns a task that flushes the internal write buffer
- private Task FlushWriteAsync(CancellationToken cancellationToken)
- {
- Debug.Assert(_useAsyncIO);
- Debug.Assert(_readPos == 0 && _readLength == 0, "FileStream: Read buffer must be empty in FlushWriteAsync!");
-
- // If the buffer is already flushed, don't spin up the OS write
- if (_writePos == 0) return Task.CompletedTask;
-
- Task flushTask = WriteInternalCoreAsync(GetBuffer(), 0, _writePos, cancellationToken);
- _writePos = 0;
-
- // Update the active buffer operation
- _activeBufferOperation = HasActiveBufferOperation ?
- Task.WhenAll(_activeBufferOperation, flushTask) :
- flushTask;
-
- return flushTask;
- }
-
- // Writes are buffered. Anytime the buffer fills up
- // (_writePos + delta > _bufferSize) or the buffer switches to reading
- // and there is left over data (_writePos > 0), this function must be called.
- private void FlushWriteBuffer(bool calledFromFinalizer = false)
- {
- if (_writePos == 0) return;
- Debug.Assert(_readPos == 0 && _readLength == 0, "FileStream: Read buffer must be empty in FlushWrite!");
-
- if (_useAsyncIO)
- {
- Task writeTask = FlushWriteAsync(CancellationToken.None);
- // With our Whidbey async IO & overlapped support for AD unloads,
- // we don't strictly need to block here to release resources
- // since that support takes care of the pinning & freeing the
- // overlapped struct. We need to do this when called from
- // Close so that the handle is closed when Close returns, but
- // we don't need to call EndWrite from the finalizer.
- // Additionally, if we do call EndWrite, we block forever
- // because AD unloads prevent us from running the managed
- // callback from the IO completion port. Blocking here when
- // called from the finalizer during AD unload is clearly wrong,
- // but we can't use any sort of test for whether the AD is
- // unloading because if we weren't unloading, an AD unload
- // could happen on a separate thread before we call EndWrite.
- if (!calledFromFinalizer)
- {
- writeTask.GetAwaiter().GetResult();
- }
- }
- else
- {
- WriteCore(GetBuffer(), 0, _writePos);
- }
-
- _writePos = 0;
- }
-
- private void SetLengthInternal(long value)
- {
- // Handle buffering updates.
- if (_writePos > 0)
- {
- FlushWriteBuffer();
- }
- else if (_readPos < _readLength)
- {
- FlushReadBuffer();
- }
- _readPos = 0;
- _readLength = 0;
-
- if (_appendStart != -1 && value < _appendStart)
- throw new IOException(SR.IO_SetLengthAppendTruncate);
- SetLengthCore(value);
- }
-
- // We absolutely need this method broken out so that WriteInternalCoreAsync can call
- // a method without having to go through buffering code that might call FlushWrite.
- private void SetLengthCore(long value)
- {
- Debug.Assert(value >= 0, "value >= 0");
- long origPos = _filePosition;
-
- VerifyOSHandlePosition();
- if (_filePosition != value)
- SeekCore(value, SeekOrigin.Begin);
- if (!Interop.Kernel32.SetEndOfFile(_fileHandle))
- {
- int errorCode = Marshal.GetLastWin32Error();
- if (errorCode == Interop.Errors.ERROR_INVALID_PARAMETER)
- throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_FileLengthTooBig);
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- // Return file pointer to where it was before setting length
- if (origPos != value)
- {
- if (origPos < value)
- SeekCore(origPos, SeekOrigin.Begin);
- else
- SeekCore(0, SeekOrigin.End);
- }
- }
-
- // Instance method to help code external to this MarshalByRefObject avoid
- // accessing its fields by ref. This avoids a compiler warning.
- private FileStreamCompletionSource CompareExchangeCurrentOverlappedOwner(FileStreamCompletionSource newSource, FileStreamCompletionSource existingSource) => Interlocked.CompareExchange(ref _currentOverlappedOwner, newSource, existingSource);
-
- public override int Read(byte[] array, int offset, int count)
- {
- ValidateReadWriteArgs(array, offset, count);
- return ReadCore(array, offset, count);
- }
-
- private int ReadCore(byte[] array, int offset, int count)
- {
- Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength),
- "We're either reading or writing, but not both.");
-
- bool isBlocked = false;
- int n = _readLength - _readPos;
- // if the read buffer is empty, read into either user's array or our
- // buffer, depending on number of bytes user asked for and buffer size.
- if (n == 0)
- {
- if (!CanRead) throw Error.GetReadNotSupported();
- if (_writePos > 0) FlushWriteBuffer();
- if (!CanSeek || (count >= _bufferLength))
- {
- n = ReadNative(array, offset, count);
- // Throw away read buffer.
- _readPos = 0;
- _readLength = 0;
- return n;
- }
- n = ReadNative(GetBuffer(), 0, _bufferLength);
- if (n == 0) return 0;
- isBlocked = n < _bufferLength;
- _readPos = 0;
- _readLength = n;
- }
- // Now copy min of count or numBytesAvailable (i.e. near EOF) to array.
- if (n > count) n = count;
- Buffer.BlockCopy(GetBuffer(), _readPos, array, offset, n);
- _readPos += n;
-
- // We may have read less than the number of bytes the user asked
- // for, but that is part of the Stream contract. Reading again for
- // more data may cause us to block if we're using a device with
- // no clear end of file, such as a serial port or pipe. If we
- // blocked here & this code was used with redirected pipes for a
- // process's standard output, this can lead to deadlocks involving
- // two processes. But leave this here for files to avoid what would
- // probably be a breaking change. --
-
- // If we are reading from a device with no clear EOF like a
- // serial port or a pipe, this will cause us to block incorrectly.
- if (!_isPipe)
- {
- // If we hit the end of the buffer and didn't have enough bytes, we must
- // read some more from the underlying stream. However, if we got
- // fewer bytes from the underlying stream than we asked for (i.e. we're
- // probably blocked), don't ask for more bytes.
- if (n < count && !isBlocked)
- {
- Debug.Assert(_readPos == _readLength, "Read buffer should be empty!");
- int moreBytesRead = ReadNative(array, offset + n, count - n);
- n += moreBytesRead;
- // We've just made our buffer inconsistent with our position
- // pointer. We must throw away the read buffer.
- _readPos = 0;
- _readLength = 0;
- }
- }
-
- return n;
- }
-
- [Conditional("DEBUG")]
- private void AssertCanRead(byte[] buffer, int offset, int count)
- {
- Debug.Assert(!_fileHandle.IsClosed, "!_fileHandle.IsClosed");
- Debug.Assert(CanRead, "CanRead");
- Debug.Assert(buffer != null, "buffer != null");
- Debug.Assert(_writePos == 0, "_writePos == 0");
- Debug.Assert(offset >= 0, "offset is negative");
- Debug.Assert(count >= 0, "count is negative");
- }
-
- private unsafe int ReadNative(byte[] buffer, int offset, int count)
- {
- AssertCanRead(buffer, offset, count);
-
- if (_useAsyncIO)
- return ReadNativeAsync(buffer, offset, count, 0, CancellationToken.None).GetAwaiter().GetResult();
-
- // Make sure we are reading from the right spot
- VerifyOSHandlePosition();
-
- int errorCode = 0;
- int r = ReadFileNative(_fileHandle, buffer, offset, count, null, out errorCode);
-
- if (r == -1)
- {
- // For pipes, ERROR_BROKEN_PIPE is the normal end of the pipe.
- if (errorCode == ERROR_BROKEN_PIPE)
- {
- r = 0;
- }
- else
- {
- if (errorCode == ERROR_INVALID_PARAMETER)
- throw new ArgumentException(SR.Arg_HandleNotSync, "_fileHandle");
-
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- }
- Debug.Assert(r >= 0, "FileStream's ReadNative is likely broken.");
- _filePosition += r;
-
- return r;
- }
-
- public override long Seek(long offset, SeekOrigin origin)
- {
- if (origin < SeekOrigin.Begin || origin > SeekOrigin.End)
- throw new ArgumentException(SR.Argument_InvalidSeekOrigin, nameof(origin));
- if (_fileHandle.IsClosed) throw Error.GetFileNotOpen();
- if (!CanSeek) throw Error.GetSeekNotSupported();
-
- Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength), "We're either reading or writing, but not both.");
-
- // If we've got bytes in our buffer to write, write them out.
- // If we've read in and consumed some bytes, we'll have to adjust
- // our seek positions ONLY IF we're seeking relative to the current
- // position in the stream. This simulates doing a seek to the new
- // position, then a read for the number of bytes we have in our buffer.
- if (_writePos > 0)
- {
- FlushWriteBuffer();
- }
- else if (origin == SeekOrigin.Current)
- {
- // Don't call FlushRead here, which would have caused an infinite
- // loop. Simply adjust the seek origin. This isn't necessary
- // if we're seeking relative to the beginning or end of the stream.
- offset -= (_readLength - _readPos);
- }
- _readPos = _readLength = 0;
-
- // Verify that internal position is in sync with the handle
- VerifyOSHandlePosition();
-
- long oldPos = _filePosition + (_readPos - _readLength);
- long pos = SeekCore(offset, origin);
-
- // Prevent users from overwriting data in a file that was opened in
- // append mode.
- if (_appendStart != -1 && pos < _appendStart)
- {
- SeekCore(oldPos, SeekOrigin.Begin);
- throw new IOException(SR.IO_SeekAppendOverwrite);
- }
-
- // We now must update the read buffer. We can in some cases simply
- // update _readPos within the buffer, copy around the buffer so our
- // Position property is still correct, and avoid having to do more
- // reads from the disk. Otherwise, discard the buffer's contents.
- if (_readLength > 0)
- {
- // We can optimize the following condition:
- // oldPos - _readPos <= pos < oldPos + _readLen - _readPos
- if (oldPos == pos)
- {
- if (_readPos > 0)
- {
- //Console.WriteLine("Seek: seeked for 0, adjusting buffer back by: "+_readPos+" _readLen: "+_readLen);
- Buffer.BlockCopy(GetBuffer(), _readPos, GetBuffer(), 0, _readLength - _readPos);
- _readLength -= _readPos;
- _readPos = 0;
- }
- // If we still have buffered data, we must update the stream's
- // position so our Position property is correct.
- if (_readLength > 0)
- SeekCore(_readLength, SeekOrigin.Current);
- }
- else if (oldPos - _readPos < pos && pos < oldPos + _readLength - _readPos)
- {
- int diff = (int)(pos - oldPos);
- //Console.WriteLine("Seek: diff was "+diff+", readpos was "+_readPos+" adjusting buffer - shrinking by "+ (_readPos + diff));
- Buffer.BlockCopy(GetBuffer(), _readPos + diff, GetBuffer(), 0, _readLength - (_readPos + diff));
- _readLength -= (_readPos + diff);
- _readPos = 0;
- if (_readLength > 0)
- SeekCore(_readLength, SeekOrigin.Current);
- }
- else
- {
- // Lose the read buffer.
- _readPos = 0;
- _readLength = 0;
- }
- Debug.Assert(_readLength >= 0 && _readPos <= _readLength, "_readLen should be nonnegative, and _readPos should be less than or equal _readLen");
- Debug.Assert(pos == Position, "Seek optimization: pos != Position! Buffer math was mangled.");
- }
- return pos;
- }
-
- // This doesn't do argument checking. Necessary for SetLength, which must
- // set the file pointer beyond the end of the file. This will update the
- // internal position
- // This is called during construction so it should avoid any virtual
- // calls
- private long SeekCore(long offset, SeekOrigin origin)
- {
- Debug.Assert(!_fileHandle.IsClosed && _canSeek, "!_handle.IsClosed && _parent.CanSeek");
- Debug.Assert(origin >= SeekOrigin.Begin && origin <= SeekOrigin.End, "origin>=SeekOrigin.Begin && origin<=SeekOrigin.End");
- long ret = 0;
-
- if (!Interop.Kernel32.SetFilePointerEx(_fileHandle, offset, out ret, (uint)origin))
- {
- int errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid();
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
-
- _filePosition = ret;
- return ret;
- }
-
- partial void OnBufferAllocated()
- {
- Debug.Assert(_buffer != null);
- Debug.Assert(_preallocatedOverlapped == null);
-
- if (_useAsyncIO)
- _preallocatedOverlapped = new PreAllocatedOverlapped(s_ioCallback, this, _buffer);
- }
-
- public override void Write(byte[] array, int offset, int count)
- {
- ValidateReadWriteArgs(array, offset, count);
-
- if (_writePos == 0)
- {
- // Ensure we can write to the stream, and ready buffer for writing.
- if (!CanWrite) throw Error.GetWriteNotSupported();
- if (_readPos < _readLength) FlushReadBuffer();
- _readPos = 0;
- _readLength = 0;
- }
-
- // If our buffer has data in it, copy data from the user's array into
- // the buffer, and if we can fit it all there, return. Otherwise, write
- // the buffer to disk and copy any remaining data into our buffer.
- // The assumption here is memcpy is cheaper than disk (or net) IO.
- // (10 milliseconds to disk vs. ~20-30 microseconds for a 4K memcpy)
- // So the extra copying will reduce the total number of writes, in
- // non-pathological cases (i.e. write 1 byte, then write for the buffer
- // size repeatedly)
- if (_writePos > 0)
- {
- int numBytes = _bufferLength - _writePos; // space left in buffer
- if (numBytes > 0)
- {
- if (numBytes > count)
- numBytes = count;
- Buffer.BlockCopy(array, offset, GetBuffer(), _writePos, numBytes);
- _writePos += numBytes;
- if (count == numBytes) return;
- offset += numBytes;
- count -= numBytes;
- }
- // Reset our buffer. We essentially want to call FlushWrite
- // without calling Flush on the underlying Stream.
-
- if (_useAsyncIO)
- {
- WriteInternalCoreAsync(GetBuffer(), 0, _writePos, CancellationToken.None).GetAwaiter().GetResult();
- }
- else
- {
- WriteCore(GetBuffer(), 0, _writePos);
- }
- _writePos = 0;
- }
- // If the buffer would slow writes down, avoid buffer completely.
- if (count >= _bufferLength)
- {
- Debug.Assert(_writePos == 0, "FileStream cannot have buffered data to write here! Your stream will be corrupted.");
- WriteCore(array, offset, count);
- return;
- }
- else if (count == 0)
- {
- return; // Don't allocate a buffer then call memcpy for 0 bytes.
- }
-
- // Copy remaining bytes into buffer, to write at a later date.
- Buffer.BlockCopy(array, offset, GetBuffer(), _writePos, count);
- _writePos = count;
- return;
- }
-
- private unsafe void WriteCore(byte[] buffer, int offset, int count)
- {
- Debug.Assert(!_fileHandle.IsClosed, "!_handle.IsClosed");
- Debug.Assert(CanWrite, "_parent.CanWrite");
-
- Debug.Assert(buffer != null, "buffer != null");
- Debug.Assert(_readPos == _readLength, "_readPos == _readLen");
- Debug.Assert(offset >= 0, "offset is negative");
- Debug.Assert(count >= 0, "count is negative");
- if (_useAsyncIO)
- {
- WriteInternalCoreAsync(buffer, offset, count, CancellationToken.None).GetAwaiter().GetResult();
- return;
- }
-
- // Make sure we are writing to the position that we think we are
- VerifyOSHandlePosition();
-
- int errorCode = 0;
- int r = WriteFileNative(_fileHandle, buffer, offset, count, null, out errorCode);
-
- if (r == -1)
- {
- // For pipes, ERROR_NO_DATA is not an error, but the pipe is closing.
- if (errorCode == ERROR_NO_DATA)
- {
- r = 0;
- }
- else
- {
- // ERROR_INVALID_PARAMETER may be returned for writes
- // where the position is too large (i.e. writing at Int64.MaxValue
- // on Win9x) OR for synchronous writes to a handle opened
- // asynchronously.
- if (errorCode == ERROR_INVALID_PARAMETER)
- throw new IOException(SR.IO_FileTooLongOrHandleNotSync);
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- }
- Debug.Assert(r >= 0, "FileStream's WriteCore is likely broken.");
- _filePosition += r;
- return;
- }
-
- private Task<int> ReadAsyncInternal(byte[] array, int offset, int numBytes, CancellationToken cancellationToken)
- {
- // If async IO is not supported on this platform or
- // if this Win32FileStream was not opened with FileOptions.Asynchronous.
- if (!_useAsyncIO)
- {
- return base.ReadAsync(array, offset, numBytes, cancellationToken);
- }
-
- if (!CanRead) throw Error.GetReadNotSupported();
-
- Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength), "We're either reading or writing, but not both.");
-
- if (_isPipe)
- {
- // Pipes are tricky, at least when you have 2 different pipes
- // that you want to use simultaneously. When redirecting stdout
- // & stderr with the Process class, it's easy to deadlock your
- // parent & child processes when doing writes 4K at a time. The
- // OS appears to use a 4K buffer internally. If you write to a
- // pipe that is full, you will block until someone read from
- // that pipe. If you try reading from an empty pipe and
- // Win32FileStream's ReadAsync blocks waiting for data to fill it's
- // internal buffer, you will be blocked. In a case where a child
- // process writes to stdout & stderr while a parent process tries
- // reading from both, you can easily get into a deadlock here.
- // To avoid this deadlock, don't buffer when doing async IO on
- // pipes. But don't completely ignore buffered data either.
- if (_readPos < _readLength)
- {
- int n = _readLength - _readPos;
- if (n > numBytes) n = numBytes;
- Buffer.BlockCopy(GetBuffer(), _readPos, array, offset, n);
- _readPos += n;
-
- // Return a completed task
- return TaskFromResultOrCache(n);
- }
- else
- {
- Debug.Assert(_writePos == 0, "Win32FileStream must not have buffered write data here! Pipes should be unidirectional.");
- return ReadNativeAsync(array, offset, numBytes, 0, cancellationToken);
- }
- }
-
- Debug.Assert(!_isPipe, "Should not be a pipe.");
-
- // Handle buffering.
- if (_writePos > 0) FlushWriteBuffer();
- if (_readPos == _readLength)
- {
- // I can't see how to handle buffering of async requests when
- // filling the buffer asynchronously, without a lot of complexity.
- // The problems I see are issuing an async read, we do an async
- // read to fill the buffer, then someone issues another read
- // (either synchronously or asynchronously) before the first one
- // returns. This would involve some sort of complex buffer locking
- // that we probably don't want to get into, at least not in V1.
- // If we did a sync read to fill the buffer, we could avoid the
- // problem, and any async read less than 64K gets turned into a
- // synchronous read by NT anyways... --
-
- if (numBytes < _bufferLength)
- {
- Task<int> readTask = ReadNativeAsync(GetBuffer(), 0, _bufferLength, 0, cancellationToken);
- _readLength = readTask.GetAwaiter().GetResult();
- int n = _readLength;
- if (n > numBytes) n = numBytes;
- Buffer.BlockCopy(GetBuffer(), 0, array, offset, n);
- _readPos = n;
-
- // Return a completed task (recycling the one above if possible)
- return (_readLength == n ? readTask : TaskFromResultOrCache(n));
- }
- else
- {
- // Here we're making our position pointer inconsistent
- // with our read buffer. Throw away the read buffer's contents.
- _readPos = 0;
- _readLength = 0;
- return ReadNativeAsync(array, offset, numBytes, 0, cancellationToken);
- }
- }
- else
- {
- int n = _readLength - _readPos;
- if (n > numBytes) n = numBytes;
- Buffer.BlockCopy(GetBuffer(), _readPos, array, offset, n);
- _readPos += n;
-
- if (n >= numBytes)
- {
- // Return a completed task
- return TaskFromResultOrCache(n);
- }
- else
- {
- // For streams with no clear EOF like serial ports or pipes
- // we cannot read more data without causing an app to block
- // incorrectly. Pipes don't go down this path
- // though. This code needs to be fixed.
- // Throw away read buffer.
- _readPos = 0;
- _readLength = 0;
- return ReadNativeAsync(array, offset + n, numBytes - n, n, cancellationToken);
- }
- }
- }
-
- unsafe private Task<int> ReadNativeAsync(byte[] bytes, int offset, int numBytes, int numBufferedBytesRead, CancellationToken cancellationToken)
- {
- AssertCanRead(bytes, offset, numBytes);
- Debug.Assert(_useAsyncIO, "ReadNativeAsync doesn't work on synchronous file streams!");
-
- // Create and store async stream class library specific data in the async result
-
- FileStreamCompletionSource completionSource = new FileStreamCompletionSource(this, numBufferedBytesRead, bytes, cancellationToken);
- NativeOverlapped* intOverlapped = completionSource.Overlapped;
-
- // Calculate position in the file we should be at after the read is done
- if (CanSeek)
- {
- long len = Length;
-
- // Make sure we are reading from the position that we think we are
- VerifyOSHandlePosition();
-
- if (_filePosition + numBytes > len)
- {
- if (_filePosition <= len)
- numBytes = (int)(len - _filePosition);
- else
- numBytes = 0;
- }
-
- // Now set the position to read from in the NativeOverlapped struct
- // For pipes, we should leave the offset fields set to 0.
- intOverlapped->OffsetLow = unchecked((int)_filePosition);
- intOverlapped->OffsetHigh = (int)(_filePosition >> 32);
-
- // When using overlapped IO, the OS is not supposed to
- // touch the file pointer location at all. We will adjust it
- // ourselves. This isn't threadsafe.
-
- // WriteFile should not update the file pointer when writing
- // in overlapped mode, according to MSDN. But it does update
- // the file pointer when writing to a UNC path!
- // So changed the code below to seek to an absolute
- // location, not a relative one. ReadFile seems consistent though.
- SeekCore(numBytes, SeekOrigin.Current);
- }
-
- // queue an async ReadFile operation and pass in a packed overlapped
- int errorCode = 0;
- int r = ReadFileNative(_fileHandle, bytes, offset, numBytes, intOverlapped, out errorCode);
- // ReadFile, the OS version, will return 0 on failure. But
- // my ReadFileNative wrapper returns -1. My wrapper will return
- // the following:
- // On error, r==-1.
- // On async requests that are still pending, r==-1 w/ errorCode==ERROR_IO_PENDING
- // on async requests that completed sequentially, r==0
- // You will NEVER RELIABLY be able to get the number of bytes
- // read back from this call when using overlapped structures! You must
- // not pass in a non-null lpNumBytesRead to ReadFile when using
- // overlapped structures! This is by design NT behavior.
- if (r == -1 && numBytes != -1)
- {
- // For pipes, when they hit EOF, they will come here.
- if (errorCode == ERROR_BROKEN_PIPE)
- {
- // Not an error, but EOF. AsyncFSCallback will NOT be
- // called. Call the user callback here.
-
- // We clear the overlapped status bit for this special case.
- // Failure to do so looks like we are freeing a pending overlapped later.
- intOverlapped->InternalLow = IntPtr.Zero;
- completionSource.SetCompletedSynchronously(0);
- }
- else if (errorCode != ERROR_IO_PENDING)
- {
- if (!_fileHandle.IsClosed && CanSeek) // Update Position - It could be anywhere.
- {
- SeekCore(0, SeekOrigin.Current);
- }
-
- completionSource.ReleaseNativeResource();
-
- if (errorCode == ERROR_HANDLE_EOF)
- {
- throw Error.GetEndOfFile();
- }
- else
- {
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- }
- else
- {
- // Only once the IO is pending do we register for cancellation
- completionSource.RegisterForCancellation();
- }
- }
- else
- {
- // Due to a workaround for a race condition in NT's ReadFile &
- // WriteFile routines, we will always be returning 0 from ReadFileNative
- // when we do async IO instead of the number of bytes read,
- // irregardless of whether the operation completed
- // synchronously or asynchronously. We absolutely must not
- // set asyncResult._numBytes here, since will never have correct
- // results.
- //Console.WriteLine("ReadFile returned: "+r+" (0x"+Int32.Format(r, "x")+") The IO completed synchronously, but the user callback was called on a separate thread");
- }
-
- return completionSource.Task;
- }
-
- // Reads a byte from the file stream. Returns the byte cast to an int
- // or -1 if reading from the end of the stream.
- public override int ReadByte()
- {
- return ReadByteCore();
- }
-
- private Task WriteAsyncInternal(byte[] array, int offset, int numBytes, CancellationToken cancellationToken)
- {
- // If async IO is not supported on this platform or
- // if this Win32FileStream was not opened with FileOptions.Asynchronous.
- if (!_useAsyncIO)
- {
- return base.WriteAsync(array, offset, numBytes, cancellationToken);
- }
-
- if (!CanWrite) throw Error.GetWriteNotSupported();
-
- Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength), "We're either reading or writing, but not both.");
- Debug.Assert(!_isPipe || (_readPos == 0 && _readLength == 0), "Win32FileStream must not have buffered data here! Pipes should be unidirectional.");
-
- bool writeDataStoredInBuffer = false;
- if (!_isPipe) // avoid async buffering with pipes, as doing so can lead to deadlocks (see comments in ReadInternalAsyncCore)
- {
- // Ensure the buffer is clear for writing
- if (_writePos == 0)
- {
- if (_readPos < _readLength)
- {
- FlushReadBuffer();
- }
- _readPos = 0;
- _readLength = 0;
- }
-
- // Determine how much space remains in the buffer
- int remainingBuffer = _bufferLength - _writePos;
- Debug.Assert(remainingBuffer >= 0);
-
- // Simple/common case:
- // - The write is smaller than our buffer, such that it's worth considering buffering it.
- // - There's no active flush operation, such that we don't have to worry about the existing buffer being in use.
- // - And the data we're trying to write fits in the buffer, meaning it wasn't already filled by previous writes.
- // In that case, just store it in the buffer.
- if (numBytes < _bufferLength && !HasActiveBufferOperation && numBytes <= remainingBuffer)
- {
- Buffer.BlockCopy(array, offset, GetBuffer(), _writePos, numBytes);
- _writePos += numBytes;
- writeDataStoredInBuffer = true;
-
- // There is one special-but-common case, common because devs often use
- // byte[] sizes that are powers of 2 and thus fit nicely into our buffer, which is
- // also a power of 2. If after our write the buffer still has remaining space,
- // then we're done and can return a completed task now. But if we filled the buffer
- // completely, we want to do the asynchronous flush/write as part of this operation
- // rather than waiting until the next write that fills the buffer.
- if (numBytes != remainingBuffer)
- return Task.CompletedTask;
-
- Debug.Assert(_writePos == _bufferLength);
- }
- }
-
- // At this point, at least one of the following is true:
- // 1. There was an active flush operation (it could have completed by now, though).
- // 2. The data doesn't fit in the remaining buffer (or it's a pipe and we chose not to try).
- // 3. We wrote all of the data to the buffer, filling it.
- //
- // If there's an active operation, we can't touch the current buffer because it's in use.
- // That gives us a choice: we can either allocate a new buffer, or we can skip the buffer
- // entirely (even if the data would otherwise fit in it). For now, for simplicity, we do
- // the latter; it could also have performance wins due to OS-level optimizations, and we could
- // potentially add support for PreAllocatedOverlapped due to having a single buffer. (We can
- // switch to allocating a new buffer, potentially experimenting with buffer pooling, should
- // performance data suggest it's appropriate.)
- //
- // If the data doesn't fit in the remaining buffer, it could be because it's so large
- // it's greater than the entire buffer size, in which case we'd always skip the buffer,
- // or it could be because there's more data than just the space remaining. For the latter
- // case, we need to issue an asynchronous write to flush that data, which then turns this into
- // the first case above with an active operation.
- //
- // If we already stored the data, then we have nothing additional to write beyond what
- // we need to flush.
- //
- // In any of these cases, we have the same outcome:
- // - If there's data in the buffer, flush it by writing it out asynchronously.
- // - Then, if there's any data to be written, issue a write for it concurrently.
- // We return a Task that represents one or both.
-
- // Flush the buffer asynchronously if there's anything to flush
- Task flushTask = null;
- if (_writePos > 0)
- {
- flushTask = FlushWriteAsync(cancellationToken);
-
- // If we already copied all of the data into the buffer,
- // simply return the flush task here. Same goes for if the task has
- // already completed and was unsuccessful.
- if (writeDataStoredInBuffer ||
- flushTask.IsFaulted ||
- flushTask.IsCanceled)
- {
- return flushTask;
- }
- }
-
- Debug.Assert(!writeDataStoredInBuffer);
- Debug.Assert(_writePos == 0);
-
- // Finally, issue the write asynchronously, and return a Task that logically
- // represents the write operation, including any flushing done.
- Task writeTask = WriteInternalCoreAsync(array, offset, numBytes, cancellationToken);
- return
- (flushTask == null || flushTask.Status == TaskStatus.RanToCompletion) ? writeTask :
- (writeTask.Status == TaskStatus.RanToCompletion) ? flushTask :
- Task.WhenAll(flushTask, writeTask);
- }
-
- private unsafe Task WriteInternalCoreAsync(byte[] bytes, int offset, int numBytes, CancellationToken cancellationToken)
- {
- Debug.Assert(!_fileHandle.IsClosed, "!_handle.IsClosed");
- Debug.Assert(CanWrite, "_parent.CanWrite");
- Debug.Assert(bytes != null, "bytes != null");
- Debug.Assert(_readPos == _readLength, "_readPos == _readLen");
- Debug.Assert(_useAsyncIO, "WriteInternalCoreAsync doesn't work on synchronous file streams!");
- Debug.Assert(offset >= 0, "offset is negative");
- Debug.Assert(numBytes >= 0, "numBytes is negative");
-
- // Create and store async stream class library specific data in the async result
- FileStreamCompletionSource completionSource = new FileStreamCompletionSource(this, 0, bytes, cancellationToken);
- NativeOverlapped* intOverlapped = completionSource.Overlapped;
-
- if (CanSeek)
- {
- // Make sure we set the length of the file appropriately.
- long len = Length;
- //Console.WriteLine("WriteInternalCoreAsync - Calculating end pos. pos: "+pos+" len: "+len+" numBytes: "+numBytes);
-
- // Make sure we are writing to the position that we think we are
- VerifyOSHandlePosition();
-
- if (_filePosition + numBytes > len)
- {
- //Console.WriteLine("WriteInternalCoreAsync - Setting length to: "+(pos + numBytes));
- SetLengthCore(_filePosition + numBytes);
- }
-
- // Now set the position to read from in the NativeOverlapped struct
- // For pipes, we should leave the offset fields set to 0.
- intOverlapped->OffsetLow = (int)_filePosition;
- intOverlapped->OffsetHigh = (int)(_filePosition >> 32);
-
- // When using overlapped IO, the OS is not supposed to
- // touch the file pointer location at all. We will adjust it
- // ourselves. This isn't threadsafe.
- SeekCore(numBytes, SeekOrigin.Current);
- }
-
- //Console.WriteLine("WriteInternalCoreAsync finishing. pos: "+pos+" numBytes: "+numBytes+" _pos: "+_pos+" Position: "+Position);
-
- int errorCode = 0;
- // queue an async WriteFile operation and pass in a packed overlapped
- int r = WriteFileNative(_fileHandle, bytes, offset, numBytes, intOverlapped, out errorCode);
-
- // WriteFile, the OS version, will return 0 on failure. But
- // my WriteFileNative wrapper returns -1. My wrapper will return
- // the following:
- // On error, r==-1.
- // On async requests that are still pending, r==-1 w/ errorCode==ERROR_IO_PENDING
- // On async requests that completed sequentially, r==0
- // You will NEVER RELIABLY be able to get the number of bytes
- // written back from this call when using overlapped IO! You must
- // not pass in a non-null lpNumBytesWritten to WriteFile when using
- // overlapped structures! This is ByDesign NT behavior.
- if (r == -1 && numBytes != -1)
- {
- //Console.WriteLine("WriteFile returned 0; Write will complete asynchronously (if errorCode==3e5) errorCode: 0x{0:x}", errorCode);
-
- // For pipes, when they are closed on the other side, they will come here.
- if (errorCode == ERROR_NO_DATA)
- {
- // Not an error, but EOF. AsyncFSCallback will NOT be called.
- // Completing TCS and return cached task allowing the GC to collect TCS.
- completionSource.SetCompletedSynchronously(0);
- return Task.CompletedTask;
- }
- else if (errorCode != ERROR_IO_PENDING)
- {
- if (!_fileHandle.IsClosed && CanSeek) // Update Position - It could be anywhere.
- {
- SeekCore(0, SeekOrigin.Current);
- }
-
- completionSource.ReleaseNativeResource();
-
- if (errorCode == ERROR_HANDLE_EOF)
- {
- throw Error.GetEndOfFile();
- }
- else
- {
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- }
- else // ERROR_IO_PENDING
- {
- // Only once the IO is pending do we register for cancellation
- completionSource.RegisterForCancellation();
- }
- }
- else
- {
- // Due to a workaround for a race condition in NT's ReadFile &
- // WriteFile routines, we will always be returning 0 from WriteFileNative
- // when we do async IO instead of the number of bytes written,
- // irregardless of whether the operation completed
- // synchronously or asynchronously. We absolutely must not
- // set asyncResult._numBytes here, since will never have correct
- // results.
- //Console.WriteLine("WriteFile returned: "+r+" (0x"+Int32.Format(r, "x")+") The IO completed synchronously, but the user callback was called on another thread.");
- }
-
- return completionSource.Task;
- }
-
- public override void WriteByte(byte value)
- {
- WriteByteCore(value);
- }
-
- // Windows API definitions, from winbase.h and others
-
- private const int FILE_ATTRIBUTE_NORMAL = 0x00000080;
- private const int FILE_ATTRIBUTE_ENCRYPTED = 0x00004000;
- private const int FILE_FLAG_OVERLAPPED = 0x40000000;
- internal const int GENERIC_READ = unchecked((int)0x80000000);
- private const int GENERIC_WRITE = 0x40000000;
-
- private const int FILE_BEGIN = 0;
- private const int FILE_CURRENT = 1;
- private const int FILE_END = 2;
-
- // Error codes (not HRESULTS), from winerror.h
- internal const int ERROR_BROKEN_PIPE = 109;
- internal const int ERROR_NO_DATA = 232;
- private const int ERROR_HANDLE_EOF = 38;
- private const int ERROR_INVALID_PARAMETER = 87;
- private const int ERROR_IO_PENDING = 997;
-
- // __ConsoleStream also uses this code.
- private unsafe int ReadFileNative(SafeFileHandle handle, byte[] bytes, int offset, int count, NativeOverlapped* overlapped, out int errorCode)
- {
- Debug.Assert(handle != null, "handle != null");
- Debug.Assert(offset >= 0, "offset >= 0");
- Debug.Assert(count >= 0, "count >= 0");
- Debug.Assert(bytes != null, "bytes != null");
- // Don't corrupt memory when multiple threads are erroneously writing
- // to this stream simultaneously.
- if (bytes.Length - offset < count)
- throw new IndexOutOfRangeException(SR.IndexOutOfRange_IORaceCondition);
-
- Debug.Assert((_useAsyncIO && overlapped != null) || (!_useAsyncIO && overlapped == null), "Async IO and overlapped parameters inconsistent in call to ReadFileNative.");
-
- // You can't use the fixed statement on an array of length 0.
- if (bytes.Length == 0)
- {
- errorCode = 0;
- return 0;
- }
-
- int r = 0;
- int numBytesRead = 0;
-
- fixed (byte* p = &bytes[0])
- {
- if (_useAsyncIO)
- r = Interop.Kernel32.ReadFile(handle, p + offset, count, IntPtr.Zero, overlapped);
- else
- r = Interop.Kernel32.ReadFile(handle, p + offset, count, out numBytesRead, IntPtr.Zero);
- }
-
- if (r == 0)
- {
- errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid();
- return -1;
- }
- else
- {
- errorCode = 0;
- return numBytesRead;
- }
- }
-
- private unsafe int WriteFileNative(SafeFileHandle handle, byte[] bytes, int offset, int count, NativeOverlapped* overlapped, out int errorCode)
- {
- Debug.Assert(handle != null, "handle != null");
- Debug.Assert(offset >= 0, "offset >= 0");
- Debug.Assert(count >= 0, "count >= 0");
- Debug.Assert(bytes != null, "bytes != null");
- // Don't corrupt memory when multiple threads are erroneously writing
- // to this stream simultaneously. (the OS is reading from
- // the array we pass to WriteFile, but if we read beyond the end and
- // that memory isn't allocated, we could get an AV.)
- if (bytes.Length - offset < count)
- throw new IndexOutOfRangeException(SR.IndexOutOfRange_IORaceCondition);
-
- Debug.Assert((_useAsyncIO && overlapped != null) || (!_useAsyncIO && overlapped == null), "Async IO and overlapped parameters inconsistent in call to WriteFileNative.");
-
- // You can't use the fixed statement on an array of length 0.
- if (bytes.Length == 0)
- {
- errorCode = 0;
- return 0;
- }
-
- int numBytesWritten = 0;
- int r = 0;
-
- fixed (byte* p = &bytes[0])
- {
- if (_useAsyncIO)
- r = Interop.Kernel32.WriteFile(handle, p + offset, count, IntPtr.Zero, overlapped);
- else
- r = Interop.Kernel32.WriteFile(handle, p + offset, count, out numBytesWritten, IntPtr.Zero);
- }
-
- if (r == 0)
- {
- errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid();
- return -1;
- }
- else
- {
- errorCode = 0;
- return numBytesWritten;
- }
- }
-
- private int GetLastWin32ErrorAndDisposeHandleIfInvalid(bool throwIfInvalidHandle = false)
- {
- int errorCode = Marshal.GetLastWin32Error();
-
- // If ERROR_INVALID_HANDLE is returned, it doesn't suffice to set
- // the handle as invalid; the handle must also be closed.
- //
- // Marking the handle as invalid but not closing the handle
- // resulted in exceptions during finalization and locked column
- // values (due to invalid but unclosed handle) in SQL Win32FileStream
- // scenarios.
- //
- // A more mainstream scenario involves accessing a file on a
- // network share. ERROR_INVALID_HANDLE may occur because the network
- // connection was dropped and the server closed the handle. However,
- // the client side handle is still open and even valid for certain
- // operations.
- //
- // Note that _parent.Dispose doesn't throw so we don't need to special case.
- // SetHandleAsInvalid only sets _closed field to true (without
- // actually closing handle) so we don't need to call that as well.
- if (errorCode == Interop.Errors.ERROR_INVALID_HANDLE)
- {
- _fileHandle.Dispose();
-
- if (throwIfInvalidHandle)
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
-
- return errorCode;
- }
-
- public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
- {
- // If we're in sync mode, just use the shared CopyToAsync implementation that does
- // typical read/write looping. We also need to take this path if this is a derived
- // instance from FileStream, as a derived type could have overridden ReadAsync, in which
- // case our custom CopyToAsync implementation isn't necessarily correct.
- if (!_useAsyncIO || GetType() != typeof(FileStream))
- {
- return base.CopyToAsync(destination, bufferSize, cancellationToken);
- }
-
- StreamHelpers.ValidateCopyToArgs(this, destination, bufferSize);
-
- // Bail early for cancellation if cancellation has been requested
- if (cancellationToken.IsCancellationRequested)
- {
- return Task.FromCanceled<int>(cancellationToken);
- }
-
- // Fail if the file was closed
- if (_fileHandle.IsClosed)
- {
- throw Error.GetFileNotOpen();
- }
-
- // Do the async copy, with differing implementations based on whether the FileStream was opened as async or sync
- Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength), "We're either reading or writing, but not both.");
- return AsyncModeCopyToAsync(destination, bufferSize, cancellationToken);
- }
-
- private async Task AsyncModeCopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
- {
- Debug.Assert(_useAsyncIO, "This implementation is for async mode only");
- Debug.Assert(!_fileHandle.IsClosed, "!_handle.IsClosed");
- Debug.Assert(CanRead, "_parent.CanRead");
-
- // Make sure any pending writes have been flushed before we do a read.
- if (_writePos > 0)
- {
- await FlushWriteAsync(cancellationToken).ConfigureAwait(false);
- }
-
- // Typically CopyToAsync would be invoked as the only "read" on the stream, but it's possible some reading is
- // done and then the CopyToAsync is issued. For that case, see if we have any data available in the buffer.
- if (GetBuffer() != null)
- {
- int bufferedBytes = _readLength - _readPos;
- if (bufferedBytes > 0)
- {
- await destination.WriteAsync(GetBuffer(), _readPos, bufferedBytes, cancellationToken).ConfigureAwait(false);
- _readPos = _readLength = 0;
- }
- }
-
- // For efficiency, we avoid creating a new task and associated state for each asynchronous read.
- // Instead, we create a single reusable awaitable object that will be triggered when an await completes
- // and reset before going again.
- var readAwaitable = new AsyncCopyToAwaitable(this);
-
- // Make sure we are reading from the position that we think we are.
- // Only set the position in the awaitable if we can seek (e.g. not for pipes).
- bool canSeek = CanSeek;
- if (canSeek)
- {
- VerifyOSHandlePosition();
- readAwaitable._position = _filePosition;
- }
-
- // Get the buffer to use for the copy operation, as the base CopyToAsync does. We don't try to use
- // _buffer here, even if it's not null, as concurrent operations are allowed, and another operation may
- // actually be using the buffer already. Plus, it'll be rare for _buffer to be non-null, as typically
- // CopyToAsync is used as the only operation performed on the stream, and the buffer is lazily initialized.
- // Further, typically the CopyToAsync buffer size will be larger than that used by the FileStream, such that
- // we'd likely be unable to use it anyway. Instead, we rent the buffer from a pool.
- byte[] copyBuffer = ArrayPool<byte>.Shared.Rent(bufferSize);
- bufferSize = 0; // repurpose bufferSize to be the high water mark for the buffer, to avoid an extra field in the state machine
-
- // Allocate an Overlapped we can use repeatedly for all operations
- var awaitableOverlapped = new PreAllocatedOverlapped(AsyncCopyToAwaitable.s_callback, readAwaitable, copyBuffer);
- var cancellationReg = default(CancellationTokenRegistration);
- try
- {
- // Register for cancellation. We do this once for the whole copy operation, and just try to cancel
- // whatever read operation may currently be in progress, if there is one. It's possible the cancellation
- // request could come in between operations, in which case we flag that with explicit calls to ThrowIfCancellationRequested
- // in the read/write copy loop.
- if (cancellationToken.CanBeCanceled)
- {
- cancellationReg = cancellationToken.Register(s =>
- {
- var innerAwaitable = (AsyncCopyToAwaitable)s;
- unsafe
- {
- lock (innerAwaitable.CancellationLock) // synchronize with cleanup of the overlapped
- {
- if (innerAwaitable._nativeOverlapped != null)
- {
- // Try to cancel the I/O. We ignore the return value, as cancellation is opportunistic and we
- // don't want to fail the operation because we couldn't cancel it.
- Interop.Kernel32.CancelIoEx(innerAwaitable._fileStream._fileHandle, innerAwaitable._nativeOverlapped);
- }
- }
- }
- }, readAwaitable);
- }
-
- // Repeatedly read from this FileStream and write the results to the destination stream.
- while (true)
- {
- cancellationToken.ThrowIfCancellationRequested();
- readAwaitable.ResetForNextOperation();
-
- try
- {
- bool synchronousSuccess;
- int errorCode;
- unsafe
- {
- // Allocate a native overlapped for our reusable overlapped, and set position to read based on the next
- // desired address stored in the awaitable. (This position may be 0, if either we're at the beginning or
- // if the stream isn't seekable.)
- readAwaitable._nativeOverlapped = _fileHandle.ThreadPoolBinding.AllocateNativeOverlapped(awaitableOverlapped);
- if (canSeek)
- {
- readAwaitable._nativeOverlapped->OffsetLow = unchecked((int)readAwaitable._position);
- readAwaitable._nativeOverlapped->OffsetHigh = (int)(readAwaitable._position >> 32);
- }
-
- // Kick off the read.
- synchronousSuccess = ReadFileNative(_fileHandle, copyBuffer, 0, copyBuffer.Length, readAwaitable._nativeOverlapped, out errorCode) >= 0;
- }
-
- // If the operation did not synchronously succeed, it either failed or initiated the asynchronous operation.
- if (!synchronousSuccess)
- {
- switch (errorCode)
- {
- case ERROR_IO_PENDING:
- // Async operation in progress.
- break;
- case ERROR_BROKEN_PIPE:
- case ERROR_HANDLE_EOF:
- // We're at or past the end of the file, and the overlapped callback
- // won't be raised in these cases. Mark it as completed so that the await
- // below will see it as such.
- readAwaitable.MarkCompleted();
- break;
- default:
- // Everything else is an error (and there won't be a callback).
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- }
-
- // Wait for the async operation (which may or may not have already completed), then throw if it failed.
- await readAwaitable;
- switch (readAwaitable._errorCode)
- {
- case 0: // success
- Debug.Assert(readAwaitable._numBytes >= 0, $"Expected non-negative numBytes, got {readAwaitable._numBytes}");
- break;
- case ERROR_BROKEN_PIPE: // logically success with 0 bytes read (write end of pipe closed)
- case ERROR_HANDLE_EOF: // logically success with 0 bytes read (read at end of file)
- Debug.Assert(readAwaitable._numBytes == 0, $"Expected 0 bytes read, got {readAwaitable._numBytes}");
- break;
- case Interop.Errors.ERROR_OPERATION_ABORTED: // canceled
- throw new OperationCanceledException(cancellationToken.IsCancellationRequested ? cancellationToken : new CancellationToken(true));
- default: // error
- throw Win32Marshal.GetExceptionForWin32Error((int)readAwaitable._errorCode);
- }
-
- // Successful operation. If we got zero bytes, we're done: exit the read/write loop.
- int numBytesRead = (int)readAwaitable._numBytes;
- if (numBytesRead == 0)
- {
- break;
- }
-
- // Otherwise, update the read position for next time accordingly.
- if (canSeek)
- {
- readAwaitable._position += numBytesRead;
- }
-
- // (and keep track of the maximum number of bytes in the buffer we used, to avoid excessive and unnecessary
- // clearing of the buffer before we return it to the pool)
- if (numBytesRead > bufferSize)
- {
- bufferSize = numBytesRead;
- }
- }
- finally
- {
- // Free the resources for this read operation
- unsafe
- {
- NativeOverlapped* overlapped;
- lock (readAwaitable.CancellationLock) // just an Exchange, but we need this to be synchronized with cancellation, so using the same lock
- {
- overlapped = readAwaitable._nativeOverlapped;
- readAwaitable._nativeOverlapped = null;
- }
- if (overlapped != null)
- {
- _fileHandle.ThreadPoolBinding.FreeNativeOverlapped(overlapped);
- }
- }
- }
-
- // Write out the read data.
- await destination.WriteAsync(copyBuffer, 0, (int)readAwaitable._numBytes, cancellationToken).ConfigureAwait(false);
- }
- }
- finally
- {
- // Cleanup from the whole copy operation
- cancellationReg.Dispose();
- awaitableOverlapped.Dispose();
-
- Array.Clear(copyBuffer, 0, bufferSize);
- ArrayPool<byte>.Shared.Return(copyBuffer, clearArray: false);
-
- // Make sure the stream's current position reflects where we ended up
- if (!_fileHandle.IsClosed && CanSeek)
- {
- SeekCore(0, SeekOrigin.End);
- }
- }
- }
-
- /// <summary>Used by CopyToAsync to enable awaiting the result of an overlapped I/O operation with minimal overhead.</summary>
- private sealed unsafe class AsyncCopyToAwaitable : ICriticalNotifyCompletion
- {
- /// <summary>Sentinel object used to indicate that the I/O operation has completed before being awaited.</summary>
- private readonly static Action s_sentinel = () => { };
- /// <summary>Cached delegate to IOCallback.</summary>
- internal static readonly IOCompletionCallback s_callback = IOCallback;
-
- /// <summary>The FileStream that owns this instance.</summary>
- internal readonly FileStream _fileStream;
-
- /// <summary>Tracked position representing the next location from which to read.</summary>
- internal long _position;
- /// <summary>The current native overlapped pointer. This changes for each operation.</summary>
- internal NativeOverlapped* _nativeOverlapped;
- /// <summary>
- /// null if the operation is still in progress,
- /// s_sentinel if the I/O operation completed before the await,
- /// s_callback if it completed after the await yielded.
- /// </summary>
- internal Action _continuation;
- /// <summary>Last error code from completed operation.</summary>
- internal uint _errorCode;
- /// <summary>Last number of read bytes from completed operation.</summary>
- internal uint _numBytes;
-
- /// <summary>Lock object used to protect cancellation-related access to _nativeOverlapped.</summary>
- internal object CancellationLock => this;
-
- /// <summary>Initialize the awaitable.</summary>
- internal unsafe AsyncCopyToAwaitable(FileStream fileStream)
- {
- _fileStream = fileStream;
- }
-
- /// <summary>Reset state to prepare for the next read operation.</summary>
- internal void ResetForNextOperation()
- {
- Debug.Assert(_position >= 0, $"Expected non-negative position, got {_position}");
- _continuation = null;
- _errorCode = 0;
- _numBytes = 0;
- }
-
- /// <summary>Overlapped callback: store the results, then invoke the continuation delegate.</summary>
- internal unsafe static void IOCallback(uint errorCode, uint numBytes, NativeOverlapped* pOVERLAP)
- {
- var awaitable = (AsyncCopyToAwaitable)ThreadPoolBoundHandle.GetNativeOverlappedState(pOVERLAP);
-
- Debug.Assert(awaitable._continuation != s_sentinel, "Sentinel must not have already been set as the continuation");
- awaitable._errorCode = errorCode;
- awaitable._numBytes = numBytes;
-
- (awaitable._continuation ?? Interlocked.CompareExchange(ref awaitable._continuation, s_sentinel, null))?.Invoke();
- }
-
- /// <summary>
- /// Called when it's known that the I/O callback for an operation will not be invoked but we'll
- /// still be awaiting the awaitable.
- /// </summary>
- internal void MarkCompleted()
- {
- Debug.Assert(_continuation == null, "Expected null continuation");
- _continuation = s_sentinel;
- }
-
- public AsyncCopyToAwaitable GetAwaiter() => this;
- public bool IsCompleted => _continuation == s_sentinel;
- public void GetResult() { }
- public void OnCompleted(Action continuation) => UnsafeOnCompleted(continuation);
- public void UnsafeOnCompleted(Action continuation)
- {
- if (_continuation == s_sentinel ||
- Interlocked.CompareExchange(ref _continuation, continuation, null) != null)
- {
- Debug.Assert(_continuation == s_sentinel, $"Expected continuation set to s_sentinel, got ${_continuation}");
- Task.Run(continuation);
- }
- }
- }
-
- // Unlike Flush(), FlushAsync() always flushes to disk. This is intentional.
- // Legend is that we chose not to flush the OS file buffers in Flush() in fear of
- // perf problems with frequent, long running FlushFileBuffers() calls. But we don't
- // have that problem with FlushAsync() because we will call FlushFileBuffers() in the background.
- private Task FlushAsyncInternal(CancellationToken cancellationToken)
- {
- if (cancellationToken.IsCancellationRequested)
- return Task.FromCanceled(cancellationToken);
-
- if (_fileHandle.IsClosed)
- throw Error.GetFileNotOpen();
-
- // The always synchronous data transfer between the OS and the internal buffer is intentional
- // because this is needed to allow concurrent async IO requests. Concurrent data transfer
- // between the OS and the internal buffer will result in race conditions. Since FlushWrite and
- // FlushRead modify internal state of the stream and transfer data between the OS and the
- // internal buffer, they cannot be truly async. We will, however, flush the OS file buffers
- // asynchronously because it doesn't modify any internal state of the stream and is potentially
- // a long running process.
- try
- {
- FlushInternalBuffer();
- }
- catch (Exception e)
- {
- return Task.FromException(e);
- }
-
- if (CanWrite)
- {
- return Task.Factory.StartNew(
- state => ((FileStream)state).FlushOSBuffer(),
- this,
- cancellationToken,
- TaskCreationOptions.DenyChildAttach,
- TaskScheduler.Default);
- }
- else
- {
- return Task.CompletedTask;
- }
- }
-
- private Task<int> TaskFromResultOrCache(int result)
- {
- Task<int> completedTask = _lastSynchronouslyCompletedTask;
- Debug.Assert(completedTask == null || completedTask.Status == TaskStatus.RanToCompletion, "Cached task should have completed successfully");
-
- if ((completedTask == null) || (completedTask.Result != result))
- {
- completedTask = Task.FromResult(result);
- _lastSynchronouslyCompletedTask = completedTask;
- }
-
- return completedTask;
- }
-
- private void LockInternal(long position, long length)
- {
- int positionLow = unchecked((int)(position));
- int positionHigh = unchecked((int)(position >> 32));
- int lengthLow = unchecked((int)(length));
- int lengthHigh = unchecked((int)(length >> 32));
-
- if (!Interop.Kernel32.LockFile(_fileHandle, positionLow, positionHigh, lengthLow, lengthHigh))
- {
- throw Win32Marshal.GetExceptionForLastWin32Error();
- }
- }
-
- private void UnlockInternal(long position, long length)
- {
- int positionLow = unchecked((int)(position));
- int positionHigh = unchecked((int)(position >> 32));
- int lengthLow = unchecked((int)(length));
- int lengthHigh = unchecked((int)(length >> 32));
-
- if (!Interop.Kernel32.UnlockFile(_fileHandle, positionLow, positionHigh, lengthLow, lengthHigh))
- {
- throw Win32Marshal.GetExceptionForLastWin32Error();
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/FileStream.cs b/src/mscorlib/corefx/System/IO/FileStream.cs
deleted file mode 100644
index 7db8518435..0000000000
--- a/src/mscorlib/corefx/System/IO/FileStream.cs
+++ /dev/null
@@ -1,684 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Win32.SafeHandles;
-using System.Diagnostics;
-
-namespace System.IO
-{
- public partial class FileStream : Stream
- {
- private const FileShare DefaultShare = FileShare.Read;
- private const bool DefaultIsAsync = false;
- internal const int DefaultBufferSize = 4096;
-
- private byte[] _buffer;
- private int _bufferLength;
- private readonly SafeFileHandle _fileHandle;
-
- /// <summary>Whether the file is opened for reading, writing, or both.</summary>
- private readonly FileAccess _access;
-
- /// <summary>The path to the opened file.</summary>
- private readonly string _path;
-
- /// <summary>The next available byte to be read from the _buffer.</summary>
- private int _readPos;
-
- /// <summary>The number of valid bytes in _buffer.</summary>
- private int _readLength;
-
- /// <summary>The next location in which a write should occur to the buffer.</summary>
- private int _writePos;
-
- /// <summary>
- /// Whether asynchronous read/write/flush operations should be performed using async I/O.
- /// On Windows FileOptions.Asynchronous controls how the file handle is configured,
- /// and then as a result how operations are issued against that file handle. On Unix,
- /// there isn't any distinction around how file descriptors are created for async vs
- /// sync, but we still differentiate how the operations are issued in order to provide
- /// similar behavioral semantics and performance characteristics as on Windows. On
- /// Windows, if non-async, async read/write requests just delegate to the base stream,
- /// and no attempt is made to synchronize between sync and async operations on the stream;
- /// if async, then async read/write requests are implemented specially, and sync read/write
- /// requests are coordinated with async ones by implementing the sync ones over the async
- /// ones. On Unix, we do something similar. If non-async, async read/write requests just
- /// delegate to the base stream, and no attempt is made to synchronize. If async, we use
- /// a semaphore to coordinate both sync and async operations.
- /// </summary>
- private readonly bool _useAsyncIO;
-
- /// <summary>
- /// Currently cached position in the stream. This should always mirror the underlying file's actual position,
- /// and should only ever be out of sync if another stream with access to this same file manipulates it, at which
- /// point we attempt to error out.
- /// </summary>
- private long _filePosition;
-
- /// <summary>Whether the file stream's handle has been exposed.</summary>
- private bool _exposedHandle;
-
- [Obsolete("This constructor has been deprecated. Please use new FileStream(SafeFileHandle handle, FileAccess access) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public FileStream(IntPtr handle, FileAccess access)
- : this(handle, access, true, DefaultBufferSize, false)
- {
- }
-
- [Obsolete("This constructor has been deprecated. Please use new FileStream(SafeFileHandle handle, FileAccess access) instead, and optionally make a new SafeFileHandle with ownsHandle=false if needed. http://go.microsoft.com/fwlink/?linkid=14202")]
- public FileStream(IntPtr handle, FileAccess access, bool ownsHandle)
- : this(handle, access, ownsHandle, DefaultBufferSize, false)
- {
- }
-
- [Obsolete("This constructor has been deprecated. Please use new FileStream(SafeFileHandle handle, FileAccess access, int bufferSize) instead, and optionally make a new SafeFileHandle with ownsHandle=false if needed. http://go.microsoft.com/fwlink/?linkid=14202")]
- public FileStream(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize)
- : this(handle, access, ownsHandle, bufferSize, false)
- {
- }
-
- [Obsolete("This constructor has been deprecated. Please use new FileStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) instead, and optionally make a new SafeFileHandle with ownsHandle=false if needed. http://go.microsoft.com/fwlink/?linkid=14202")]
- public FileStream(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync)
- : this(new SafeFileHandle(handle, ownsHandle), access, bufferSize, isAsync)
- {
- }
-
- public FileStream(SafeFileHandle handle, FileAccess access)
- : this(handle, access, DefaultBufferSize)
- {
- }
-
- public FileStream(SafeFileHandle handle, FileAccess access, int bufferSize)
- : this(handle, access, bufferSize, GetDefaultIsAsync(handle))
- {
- }
-
- public FileStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync)
- {
- if (handle.IsInvalid)
- throw new ArgumentException(SR.Arg_InvalidHandle, nameof(handle));
-
- if (access < FileAccess.Read || access > FileAccess.ReadWrite)
- throw new ArgumentOutOfRangeException(nameof(access), SR.ArgumentOutOfRange_Enum);
- if (bufferSize <= 0)
- throw new ArgumentOutOfRangeException(nameof(bufferSize), SR.ArgumentOutOfRange_NeedPosNum);
-
- if (handle.IsClosed)
- throw new ObjectDisposedException(SR.ObjectDisposed_FileClosed);
- if (handle.IsAsync.HasValue && isAsync != handle.IsAsync.Value)
- throw new ArgumentException(SR.Arg_HandleNotAsync, nameof(handle));
-
- _access = access;
- _useAsyncIO = isAsync;
- _exposedHandle = true;
- _bufferLength = bufferSize;
- _fileHandle = handle;
-
- InitFromHandle(handle);
- }
-
- public FileStream(string path, FileMode mode) :
- this(path, mode, (mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite), DefaultShare, DefaultBufferSize, DefaultIsAsync)
- { }
-
- public FileStream(string path, FileMode mode, FileAccess access) :
- this(path, mode, access, DefaultShare, DefaultBufferSize, DefaultIsAsync)
- { }
-
- public FileStream(string path, FileMode mode, FileAccess access, FileShare share) :
- this(path, mode, access, share, DefaultBufferSize, DefaultIsAsync)
- { }
-
- public FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize) :
- this(path, mode, access, share, bufferSize, DefaultIsAsync)
- { }
-
- public FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool useAsync) :
- this(path, mode, access, share, bufferSize, useAsync ? FileOptions.Asynchronous : FileOptions.None)
- { }
-
- public FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)
- {
- if (path == null)
- throw new ArgumentNullException(nameof(path), SR.ArgumentNull_Path);
- if (path.Length == 0)
- throw new ArgumentException(SR.Argument_EmptyPath, nameof(path));
-
- // don't include inheritable in our bounds check for share
- FileShare tempshare = share & ~FileShare.Inheritable;
- string badArg = null;
-
- if (mode < FileMode.CreateNew || mode > FileMode.Append)
- badArg = nameof(mode);
- else if (access < FileAccess.Read || access > FileAccess.ReadWrite)
- badArg = nameof(access);
- else if (tempshare < FileShare.None || tempshare > (FileShare.ReadWrite | FileShare.Delete))
- badArg = nameof(share);
-
- if (badArg != null)
- throw new ArgumentOutOfRangeException(badArg, SR.ArgumentOutOfRange_Enum);
-
- // NOTE: any change to FileOptions enum needs to be matched here in the error validation
- if (options != FileOptions.None && (options & ~(FileOptions.WriteThrough | FileOptions.Asynchronous | FileOptions.RandomAccess | FileOptions.DeleteOnClose | FileOptions.SequentialScan | FileOptions.Encrypted | (FileOptions)0x20000000 /* NoBuffering */)) != 0)
- throw new ArgumentOutOfRangeException(nameof(options), SR.ArgumentOutOfRange_Enum);
-
- if (bufferSize <= 0)
- throw new ArgumentOutOfRangeException(nameof(bufferSize), SR.ArgumentOutOfRange_NeedPosNum);
-
- // Write access validation
- if ((access & FileAccess.Write) == 0)
- {
- if (mode == FileMode.Truncate || mode == FileMode.CreateNew || mode == FileMode.Create || mode == FileMode.Append)
- {
- // No write access, mode and access disagree but flag access since mode comes first
- throw new ArgumentException(SR.Format(SR.Argument_InvalidFileModeAndAccessCombo, mode, access), nameof(access));
- }
- }
-
- if ((access & FileAccess.Read) != 0 && mode == FileMode.Append)
- throw new ArgumentException(SR.Argument_InvalidAppendMode, nameof(access));
-
- string fullPath = Path.GetFullPath(path);
-
- _path = fullPath;
- _access = access;
- _bufferLength = bufferSize;
-
- if ((options & FileOptions.Asynchronous) != 0)
- _useAsyncIO = true;
-
- _fileHandle = OpenHandle(mode, share, options);
-
- try
- {
- Init(mode, share);
- }
- catch
- {
- // If anything goes wrong while setting up the stream, make sure we deterministically dispose
- // of the opened handle.
- _fileHandle.Dispose();
- _fileHandle = null;
- throw;
- }
- }
-
- private static bool GetDefaultIsAsync(SafeFileHandle handle)
- {
- // This will eventually get more complicated as we can actually check the underlying handle type on Windows
- return handle.IsAsync.HasValue ? handle.IsAsync.Value : false;
- }
-
- [Obsolete("This property has been deprecated. Please use FileStream's SafeFileHandle property instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public virtual IntPtr Handle { get { return SafeFileHandle.DangerousGetHandle(); } }
-
- public virtual void Lock(long position, long length)
- {
- if (position < 0 || length < 0)
- {
- throw new ArgumentOutOfRangeException(position < 0 ? nameof(position) : nameof(length), SR.ArgumentOutOfRange_NeedNonNegNum);
- }
-
- if (_fileHandle.IsClosed)
- {
- throw Error.GetFileNotOpen();
- }
-
- LockInternal(position, length);
- }
-
- public virtual void Unlock(long position, long length)
- {
- if (position < 0 || length < 0)
- {
- throw new ArgumentOutOfRangeException(position < 0 ? nameof(position) : nameof(length), SR.ArgumentOutOfRange_NeedNonNegNum);
- }
-
- if (_fileHandle.IsClosed)
- {
- throw Error.GetFileNotOpen();
- }
-
- UnlockInternal(position, length);
- }
-
- public override Task FlushAsync(CancellationToken cancellationToken)
- {
- // If we have been inherited into a subclass, the following implementation could be incorrect
- // since it does not call through to Flush() which a subclass might have overridden. To be safe
- // we will only use this implementation in cases where we know it is safe to do so,
- // and delegate to our base class (which will call into Flush) when we are not sure.
- if (GetType() != typeof(FileStream))
- return base.FlushAsync(cancellationToken);
-
- return FlushAsyncInternal(cancellationToken);
- }
-
- public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
- {
- if (buffer == null)
- throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
- if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (buffer.Length - offset < count)
- throw new ArgumentException(SR.Argument_InvalidOffLen /*, no good single parameter name to pass*/);
-
- // If we have been inherited into a subclass, the following implementation could be incorrect
- // since it does not call through to Read() or ReadAsync() which a subclass might have overridden.
- // To be safe we will only use this implementation in cases where we know it is safe to do so,
- // and delegate to our base class (which will call into Read/ReadAsync) when we are not sure.
- if (GetType() != typeof(FileStream))
- return base.ReadAsync(buffer, offset, count, cancellationToken);
-
- if (cancellationToken.IsCancellationRequested)
- return Task.FromCanceled<int>(cancellationToken);
-
- if (IsClosed)
- throw Error.GetFileNotOpen();
-
- return ReadAsyncInternal(buffer, offset, count, cancellationToken);
- }
-
- public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
- {
- if (buffer == null)
- throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
- if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (buffer.Length - offset < count)
- throw new ArgumentException(SR.Argument_InvalidOffLen /*, no good single parameter name to pass*/);
-
- // If we have been inherited into a subclass, the following implementation could be incorrect
- // since it does not call through to Write() or WriteAsync() which a subclass might have overridden.
- // To be safe we will only use this implementation in cases where we know it is safe to do so,
- // and delegate to our base class (which will call into Write/WriteAsync) when we are not sure.
- if (GetType() != typeof(FileStream))
- return base.WriteAsync(buffer, offset, count, cancellationToken);
-
- if (cancellationToken.IsCancellationRequested)
- return Task.FromCanceled(cancellationToken);
-
- if (IsClosed)
- throw Error.GetFileNotOpen();
-
- return WriteAsyncInternal(buffer, offset, count, cancellationToken);
- }
-
- /// <summary>
- /// Clears buffers for this stream and causes any buffered data to be written to the file.
- /// </summary>
- public override void Flush()
- {
- // Make sure that we call through the public virtual API
- Flush(flushToDisk: false);
- }
-
- /// <summary>
- /// Clears buffers for this stream, and if <param name="flushToDisk"/> is true,
- /// causes any buffered data to be written to the file.
- /// </summary>
- public virtual void Flush(bool flushToDisk)
- {
- if (IsClosed) throw Error.GetFileNotOpen();
-
- FlushInternalBuffer();
-
- if (flushToDisk && CanWrite)
- {
- FlushOSBuffer();
- }
- }
-
- /// <summary>Gets a value indicating whether the current stream supports reading.</summary>
- public override bool CanRead
- {
- get { return !_fileHandle.IsClosed && (_access & FileAccess.Read) != 0; }
- }
-
- /// <summary>Gets a value indicating whether the current stream supports writing.</summary>
- public override bool CanWrite
- {
- get { return !_fileHandle.IsClosed && (_access & FileAccess.Write) != 0; }
- }
-
- /// <summary>Validates arguments to Read and Write and throws resulting exceptions.</summary>
- /// <param name="array">The buffer to read from or write to.</param>
- /// <param name="offset">The zero-based offset into the array.</param>
- /// <param name="count">The maximum number of bytes to read or write.</param>
- private void ValidateReadWriteArgs(byte[] array, int offset, int count)
- {
- if (array == null)
- throw new ArgumentNullException(nameof(array), SR.ArgumentNull_Buffer);
- if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (array.Length - offset < count)
- throw new ArgumentException(SR.Argument_InvalidOffLen /*, no good single parameter name to pass*/);
- if (_fileHandle.IsClosed)
- throw Error.GetFileNotOpen();
- }
-
- /// <summary>Sets the length of this stream to the given value.</summary>
- /// <param name="value">The new length of the stream.</param>
- public override void SetLength(long value)
- {
- if (value < 0)
- throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (_fileHandle.IsClosed)
- throw Error.GetFileNotOpen();
- if (!CanSeek)
- throw Error.GetSeekNotSupported();
- if (!CanWrite)
- throw Error.GetWriteNotSupported();
-
- SetLengthInternal(value);
- }
-
- public virtual SafeFileHandle SafeFileHandle
- {
- get
- {
- Flush();
- _exposedHandle = true;
- return _fileHandle;
- }
- }
-
- /// <summary>Gets the path that was passed to the constructor.</summary>
- public virtual string Name { get { return _path ?? SR.IO_UnknownFileName; } }
-
- /// <summary>Gets a value indicating whether the stream was opened for I/O to be performed synchronously or asynchronously.</summary>
- public virtual bool IsAsync
- {
- get { return _useAsyncIO; }
- }
-
- /// <summary>Gets the length of the stream in bytes.</summary>
- public override long Length
- {
- get
- {
- if (_fileHandle.IsClosed) throw Error.GetFileNotOpen();
- if (!CanSeek) throw Error.GetSeekNotSupported();
- return GetLengthInternal();
- }
- }
-
- /// <summary>
- /// Verify that the actual position of the OS's handle equals what we expect it to.
- /// This will fail if someone else moved the UnixFileStream's handle or if
- /// our position updating code is incorrect.
- /// </summary>
- private void VerifyOSHandlePosition()
- {
- bool verifyPosition = _exposedHandle; // in release, only verify if we've given out the handle such that someone else could be manipulating it
-#if DEBUG
- verifyPosition = true; // in debug, always make sure our position matches what the OS says it should be
-#endif
- if (verifyPosition && CanSeek)
- {
- long oldPos = _filePosition; // SeekCore will override the current _position, so save it now
- long curPos = SeekCore(0, SeekOrigin.Current);
- if (oldPos != curPos)
- {
- // For reads, this is non-fatal but we still could have returned corrupted
- // data in some cases, so discard the internal buffer. For writes,
- // this is a problem; discard the buffer and error out.
- _readPos = _readLength = 0;
- if (_writePos > 0)
- {
- _writePos = 0;
- throw new IOException(SR.IO_FileStreamHandlePosition);
- }
- }
- }
- }
-
- /// <summary>Verifies that state relating to the read/write buffer is consistent.</summary>
- [Conditional("DEBUG")]
- private void AssertBufferInvariants()
- {
- // Read buffer values must be in range: 0 <= _bufferReadPos <= _bufferReadLength <= _bufferLength
- Debug.Assert(0 <= _readPos && _readPos <= _readLength && _readLength <= _bufferLength);
-
- // Write buffer values must be in range: 0 <= _bufferWritePos <= _bufferLength
- Debug.Assert(0 <= _writePos && _writePos <= _bufferLength);
-
- // Read buffering and write buffering can't both be active
- Debug.Assert((_readPos == 0 && _readLength == 0) || _writePos == 0);
- }
-
- /// <summary>Validates that we're ready to read from the stream.</summary>
- private void PrepareForReading()
- {
- if (_fileHandle.IsClosed)
- throw Error.GetFileNotOpen();
- if (_readLength == 0 && !CanRead)
- throw Error.GetReadNotSupported();
-
- AssertBufferInvariants();
- }
-
- /// <summary>Gets or sets the position within the current stream</summary>
- public override long Position
- {
- get
- {
- if (_fileHandle.IsClosed)
- throw Error.GetFileNotOpen();
-
- if (!CanSeek)
- throw Error.GetSeekNotSupported();
-
- AssertBufferInvariants();
- VerifyOSHandlePosition();
-
- // We may have read data into our buffer from the handle, such that the handle position
- // is artificially further along than the consumer's view of the stream's position.
- // Thus, when reading, our position is really starting from the handle position negatively
- // offset by the number of bytes in the buffer and positively offset by the number of
- // bytes into that buffer we've read. When writing, both the read length and position
- // must be zero, and our position is just the handle position offset positive by how many
- // bytes we've written into the buffer.
- return (_filePosition - _readLength) + _readPos + _writePos;
- }
- set
- {
- if (value < 0)
- throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_NeedNonNegNum);
-
- Seek(value, SeekOrigin.Begin);
- }
- }
-
- internal virtual bool IsClosed => _fileHandle.IsClosed;
-
- /// <summary>
- /// Gets the array used for buffering reading and writing.
- /// If the array hasn't been allocated, this will lazily allocate it.
- /// </summary>
- /// <returns>The buffer.</returns>
- private byte[] GetBuffer()
- {
- Debug.Assert(_buffer == null || _buffer.Length == _bufferLength);
- if (_buffer == null)
- {
- _buffer = new byte[_bufferLength];
- OnBufferAllocated();
- }
-
- return _buffer;
- }
-
- partial void OnBufferAllocated();
-
- /// <summary>
- /// Flushes the internal read/write buffer for this stream. If write data has been buffered,
- /// that data is written out to the underlying file. Or if data has been buffered for
- /// reading from the stream, the data is dumped and our position in the underlying file
- /// is rewound as necessary. This does not flush the OS buffer.
- /// </summary>
- private void FlushInternalBuffer()
- {
- AssertBufferInvariants();
- if (_writePos > 0)
- {
- FlushWriteBuffer();
- }
- else if (_readPos < _readLength && CanSeek)
- {
- FlushReadBuffer();
- }
- }
-
- /// <summary>Dumps any read data in the buffer and rewinds our position in the stream, accordingly, as necessary.</summary>
- private void FlushReadBuffer()
- {
- // Reading is done by blocks from the file, but someone could read
- // 1 byte from the buffer then write. At that point, the OS's file
- // pointer is out of sync with the stream's position. All write
- // functions should call this function to preserve the position in the file.
-
- AssertBufferInvariants();
- Debug.Assert(_writePos == 0, "FileStream: Write buffer must be empty in FlushReadBuffer!");
-
- int rewind = _readPos - _readLength;
- if (rewind != 0)
- {
- Debug.Assert(CanSeek, "FileStream will lose buffered read data now.");
- SeekCore(rewind, SeekOrigin.Current);
- }
- _readPos = _readLength = 0;
- }
-
- private int ReadByteCore()
- {
- PrepareForReading();
-
- byte[] buffer = GetBuffer();
- if (_readPos == _readLength)
- {
- FlushWriteBuffer();
- Debug.Assert(_bufferLength > 0, "_bufferSize > 0");
-
- _readLength = ReadNative(buffer, 0, _bufferLength);
- _readPos = 0;
- if (_readLength == 0)
- {
- return -1;
- }
- }
-
- return buffer[_readPos++];
- }
-
- private void WriteByteCore(byte value)
- {
- PrepareForWriting();
-
- // Flush the write buffer if it's full
- if (_writePos == _bufferLength)
- FlushWriteBuffer();
-
- // We now have space in the buffer. Store the byte.
- GetBuffer()[_writePos++] = value;
- }
-
- /// <summary>
- /// Validates that we're ready to write to the stream,
- /// including flushing a read buffer if necessary.
- /// </summary>
- private void PrepareForWriting()
- {
- if (_fileHandle.IsClosed)
- throw Error.GetFileNotOpen();
-
- // Make sure we're good to write. We only need to do this if there's nothing already
- // in our write buffer, since if there is something in the buffer, we've already done
- // this checking and flushing.
- if (_writePos == 0)
- {
- if (!CanWrite) throw Error.GetWriteNotSupported();
- FlushReadBuffer();
- Debug.Assert(_bufferLength > 0, "_bufferSize > 0");
- }
- }
-
- ~FileStream()
- {
- // Preserved for compatibility since FileStream has defined a
- // finalizer in past releases and derived classes may depend
- // on Dispose(false) call.
- Dispose(false);
- }
-
- public override IAsyncResult BeginRead(byte[] array, int offset, int numBytes, AsyncCallback callback, object state)
- {
- if (array == null)
- throw new ArgumentNullException(nameof(array));
- if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (numBytes < 0)
- throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (array.Length - offset < numBytes)
- throw new ArgumentException(SR.Argument_InvalidOffLen);
-
- if (IsClosed) throw new ObjectDisposedException(SR.ObjectDisposed_FileClosed);
- if (!CanRead) throw new NotSupportedException(SR.NotSupported_UnreadableStream);
-
- if (!IsAsync)
- return base.BeginRead(array, offset, numBytes, callback, state);
- else
- return TaskToApm.Begin(ReadAsyncInternal(array, offset, numBytes, CancellationToken.None), callback, state);
- }
-
- public override IAsyncResult BeginWrite(byte[] array, int offset, int numBytes, AsyncCallback callback, object state)
- {
- if (array == null)
- throw new ArgumentNullException(nameof(array));
- if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (numBytes < 0)
- throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (array.Length - offset < numBytes)
- throw new ArgumentException(SR.Argument_InvalidOffLen);
-
- if (IsClosed) throw new ObjectDisposedException(SR.ObjectDisposed_FileClosed);
- if (!CanWrite) throw new NotSupportedException(SR.NotSupported_UnwritableStream);
-
- if (!IsAsync)
- return base.BeginWrite(array, offset, numBytes, callback, state);
- else
- return TaskToApm.Begin(WriteAsyncInternal(array, offset, numBytes, CancellationToken.None), callback, state);
- }
-
- public override int EndRead(IAsyncResult asyncResult)
- {
- if (asyncResult == null)
- throw new ArgumentNullException(nameof(asyncResult));
-
- if (!IsAsync)
- return base.EndRead(asyncResult);
- else
- return TaskToApm.End<int>(asyncResult);
- }
-
- public override void EndWrite(IAsyncResult asyncResult)
- {
- if (asyncResult == null)
- throw new ArgumentNullException(nameof(asyncResult));
-
- if (!IsAsync)
- base.EndWrite(asyncResult);
- else
- TaskToApm.End(asyncResult);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs b/src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs
deleted file mode 100644
index 159e416e63..0000000000
--- a/src/mscorlib/corefx/System/IO/FileStreamCompletionSource.Win32.cs
+++ /dev/null
@@ -1,221 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Security;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Runtime.InteropServices;
-using System.Diagnostics;
-
-namespace System.IO
-{
- public partial class FileStream : Stream
- {
- // This is an internal object extending TaskCompletionSource with fields
- // for all of the relevant data necessary to complete the IO operation.
- // This is used by IOCallback and all of the async methods.
- unsafe private sealed class FileStreamCompletionSource : TaskCompletionSource<int>
- {
- private const long NoResult = 0;
- private const long ResultSuccess = (long)1 << 32;
- private const long ResultError = (long)2 << 32;
- private const long RegisteringCancellation = (long)4 << 32;
- private const long CompletedCallback = (long)8 << 32;
- private const ulong ResultMask = ((ulong)uint.MaxValue) << 32;
-
- private static Action<object> s_cancelCallback;
-
- private readonly FileStream _stream;
- private readonly int _numBufferedBytes;
- private readonly CancellationToken _cancellationToken;
- private CancellationTokenRegistration _cancellationRegistration;
-#if DEBUG
- private bool _cancellationHasBeenRegistered;
-#endif
- private NativeOverlapped* _overlapped; // Overlapped class responsible for operations in progress when an appdomain unload occurs
- private long _result; // Using long since this needs to be used in Interlocked APIs
-
- // Using RunContinuationsAsynchronously for compat reasons (old API used Task.Factory.StartNew for continuations)
- internal FileStreamCompletionSource(FileStream stream, int numBufferedBytes, byte[] bytes, CancellationToken cancellationToken)
- : base(TaskCreationOptions.RunContinuationsAsynchronously)
- {
- _numBufferedBytes = numBufferedBytes;
- _stream = stream;
- _result = NoResult;
- _cancellationToken = cancellationToken;
-
- // Create the native overlapped. We try to use the preallocated overlapped if possible:
- // it's possible if the byte buffer is the same one that's associated with the preallocated overlapped
- // and if no one else is currently using the preallocated overlapped. This is the fast-path for cases
- // where the user-provided buffer is smaller than the FileStream's buffer (such that the FileStream's
- // buffer is used) and where operations on the FileStream are not being performed concurrently.
- _overlapped = ReferenceEquals(bytes, _stream._buffer) && _stream.CompareExchangeCurrentOverlappedOwner(this, null) == null ?
- _stream._fileHandle.ThreadPoolBinding.AllocateNativeOverlapped(_stream._preallocatedOverlapped) :
- _stream._fileHandle.ThreadPoolBinding.AllocateNativeOverlapped(s_ioCallback, this, bytes);
- Debug.Assert(_overlapped != null, "AllocateNativeOverlapped returned null");
- }
-
- internal NativeOverlapped* Overlapped
- {
- get { return _overlapped; }
- }
-
- public void SetCompletedSynchronously(int numBytes)
- {
- ReleaseNativeResource();
- TrySetResult(numBytes + _numBufferedBytes);
- }
-
- public void RegisterForCancellation()
- {
-#if DEBUG
- Debug.Assert(!_cancellationHasBeenRegistered, "Cannot register for cancellation twice");
- _cancellationHasBeenRegistered = true;
-#endif
-
- // Quick check to make sure that the cancellation token supports cancellation, and that the IO hasn't completed
- if ((_cancellationToken.CanBeCanceled) && (_overlapped != null))
- {
- var cancelCallback = s_cancelCallback;
- if (cancelCallback == null) s_cancelCallback = cancelCallback = Cancel;
-
- // Register the cancellation only if the IO hasn't completed
- long packedResult = Interlocked.CompareExchange(ref _result, RegisteringCancellation, NoResult);
- if (packedResult == NoResult)
- {
- _cancellationRegistration = _cancellationToken.Register(cancelCallback, this);
-
- // Switch the result, just in case IO completed while we were setting the registration
- packedResult = Interlocked.Exchange(ref _result, NoResult);
- }
- else if (packedResult != CompletedCallback)
- {
- // Failed to set the result, IO is in the process of completing
- // Attempt to take the packed result
- packedResult = Interlocked.Exchange(ref _result, NoResult);
- }
-
- // If we have a callback that needs to be completed
- if ((packedResult != NoResult) && (packedResult != CompletedCallback) && (packedResult != RegisteringCancellation))
- {
- CompleteCallback((ulong)packedResult);
- }
- }
- }
-
- internal void ReleaseNativeResource()
- {
- // Ensure that cancellation has been completed and cleaned up.
- _cancellationRegistration.Dispose();
-
- // Free the overlapped.
- // NOTE: The cancellation must *NOT* be running at this point, or it may observe freed memory
- // (this is why we disposed the registration above).
- if (_overlapped != null)
- {
- _stream._fileHandle.ThreadPoolBinding.FreeNativeOverlapped(_overlapped);
- _overlapped = null;
- }
-
- // Ensure we're no longer set as the current completion source (we may not have been to begin with).
- // Only one operation at a time is eligible to use the preallocated overlapped,
- _stream.CompareExchangeCurrentOverlappedOwner(null, this);
- }
-
- // When doing IO asynchronously (i.e. _isAsync==true), this callback is
- // called by a free thread in the threadpool when the IO operation
- // completes.
- internal static unsafe void IOCallback(uint errorCode, uint numBytes, NativeOverlapped* pOverlapped)
- {
- // Extract the completion source from the overlapped. The state in the overlapped
- // will either be a Win32FileStream (in the case where the preallocated overlapped was used),
- // in which case the operation being completed is its _currentOverlappedOwner, or it'll
- // be directly the FileStreamCompletion that's completing (in the case where the preallocated
- // overlapped was already in use by another operation).
- object state = ThreadPoolBoundHandle.GetNativeOverlappedState(pOverlapped);
- FileStream fs = state as FileStream;
- FileStreamCompletionSource completionSource = fs != null ?
- fs._currentOverlappedOwner :
- (FileStreamCompletionSource)state;
- Debug.Assert(completionSource._overlapped == pOverlapped, "Overlaps don't match");
-
- // Handle reading from & writing to closed pipes. While I'm not sure
- // this is entirely necessary anymore, maybe it's possible for
- // an async read on a pipe to be issued and then the pipe is closed,
- // returning this error. This may very well be necessary.
- ulong packedResult;
- if (errorCode != 0 && errorCode != ERROR_BROKEN_PIPE && errorCode != ERROR_NO_DATA)
- {
- packedResult = ((ulong)ResultError | errorCode);
- }
- else
- {
- packedResult = ((ulong)ResultSuccess | numBytes);
- }
-
- // Stow the result so that other threads can observe it
- // And, if no other thread is registering cancellation, continue
- if (NoResult == Interlocked.Exchange(ref completionSource._result, (long)packedResult))
- {
- // Successfully set the state, attempt to take back the callback
- if (Interlocked.Exchange(ref completionSource._result, CompletedCallback) != NoResult)
- {
- // Successfully got the callback, finish the callback
- completionSource.CompleteCallback(packedResult);
- }
- // else: Some other thread stole the result, so now it is responsible to finish the callback
- }
- // else: Some other thread is registering a cancellation, so it *must* finish the callback
- }
-
- private void CompleteCallback(ulong packedResult) {
- // Free up the native resource and cancellation registration
- ReleaseNativeResource();
-
- // Unpack the result and send it to the user
- long result = (long)(packedResult & ResultMask);
- if (result == ResultError)
- {
- int errorCode = unchecked((int)(packedResult & uint.MaxValue));
- if (errorCode == Interop.Errors.ERROR_OPERATION_ABORTED)
- {
- TrySetCanceled(_cancellationToken.IsCancellationRequested ? _cancellationToken : new CancellationToken(true));
- }
- else
- {
- TrySetException(Win32Marshal.GetExceptionForWin32Error(errorCode));
- }
- }
- else
- {
- Debug.Assert(result == ResultSuccess, "Unknown result");
- TrySetResult((int)(packedResult & uint.MaxValue) + _numBufferedBytes);
- }
- }
-
- private static void Cancel(object state)
- {
- // WARNING: This may potentially be called under a lock (during cancellation registration)
-
- FileStreamCompletionSource completionSource = state as FileStreamCompletionSource;
- Debug.Assert(completionSource != null, "Unknown state passed to cancellation");
- Debug.Assert(completionSource._overlapped != null && !completionSource.Task.IsCompleted, "IO should not have completed yet");
-
- // If the handle is still valid, attempt to cancel the IO
- if (!completionSource._stream._fileHandle.IsInvalid &&
- !Interop.Kernel32.CancelIoEx(completionSource._stream._fileHandle, completionSource._overlapped))
- {
- int errorCode = Marshal.GetLastWin32Error();
-
- // ERROR_NOT_FOUND is returned if CancelIoEx cannot find the request to cancel.
- // This probably means that the IO operation has completed.
- if (errorCode != Interop.Errors.ERROR_NOT_FOUND)
- {
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- }
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/Path.Unix.cs b/src/mscorlib/corefx/System/IO/Path.Unix.cs
deleted file mode 100644
index c566fa0066..0000000000
--- a/src/mscorlib/corefx/System/IO/Path.Unix.cs
+++ /dev/null
@@ -1,216 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace System.IO
-{
- public static partial class Path
- {
- public static char[] GetInvalidFileNameChars() => new char[] { '\0', '/' };
-
- public static char[] GetInvalidPathChars() => new char[] { '\0' };
-
- internal static int MaxPath => Interop.Sys.MaxPath;
-
- private static readonly bool s_isMac = Interop.Sys.GetUnixName() == "OSX";
-
- // Expands the given path to a fully qualified path.
- public static string GetFullPath(string path)
- {
- if (path == null)
- throw new ArgumentNullException(nameof(path));
-
- if (path.Length == 0)
- throw new ArgumentException(SR.Arg_PathIllegal);
-
- PathInternal.CheckInvalidPathChars(path);
-
- // Expand with current directory if necessary
- if (!IsPathRooted(path))
- {
- path = Combine(Interop.Sys.GetCwd(), path);
- }
-
- // We would ideally use realpath to do this, but it resolves symlinks, requires that the file actually exist,
- // and turns it into a full path, which we only want if fullCheck is true.
- string collapsedString = RemoveRelativeSegments(path);
-
- Debug.Assert(collapsedString.Length < path.Length || collapsedString.ToString() == path,
- "Either we've removed characters, or the string should be unmodified from the input path.");
-
- if (collapsedString.Length > Interop.Sys.MaxPath)
- {
- throw new PathTooLongException(SR.IO_PathTooLong);
- }
-
- string result = collapsedString.Length == 0 ? PathInternal.DirectorySeparatorCharAsString : collapsedString;
-
- return result;
- }
-
- /// <summary>
- /// Try to remove relative segments from the given path (without combining with a root).
- /// </summary>
- /// <param name="skip">Skip the specified number of characters before evaluating.</param>
- private static string RemoveRelativeSegments(string path, int skip = 0)
- {
- bool flippedSeparator = false;
-
- // Remove "//", "/./", and "/../" from the path by copying each character to the output,
- // except the ones we're removing, such that the builder contains the normalized path
- // at the end.
- var sb = StringBuilderCache.Acquire(path.Length);
- if (skip > 0)
- {
- sb.Append(path, 0, skip);
- }
-
- int componentCharCount = 0;
- for (int i = skip; i < path.Length; i++)
- {
- char c = path[i];
-
- if (PathInternal.IsDirectorySeparator(c) && i + 1 < path.Length)
- {
- componentCharCount = 0;
-
- // Skip this character if it's a directory separator and if the next character is, too,
- // e.g. "parent//child" => "parent/child"
- if (PathInternal.IsDirectorySeparator(path[i + 1]))
- {
- continue;
- }
-
- // Skip this character and the next if it's referring to the current directory,
- // e.g. "parent/./child" =? "parent/child"
- if ((i + 2 == path.Length || PathInternal.IsDirectorySeparator(path[i + 2])) &&
- path[i + 1] == '.')
- {
- i++;
- continue;
- }
-
- // Skip this character and the next two if it's referring to the parent directory,
- // e.g. "parent/child/../grandchild" => "parent/grandchild"
- if (i + 2 < path.Length &&
- (i + 3 == path.Length || PathInternal.IsDirectorySeparator(path[i + 3])) &&
- path[i + 1] == '.' && path[i + 2] == '.')
- {
- // Unwind back to the last slash (and if there isn't one, clear out everything).
- int s;
- for (s = sb.Length - 1; s >= 0; s--)
- {
- if (PathInternal.IsDirectorySeparator(sb[s]))
- {
- sb.Length = s;
- break;
- }
- }
- if (s < 0)
- {
- sb.Length = 0;
- }
-
- i += 2;
- continue;
- }
- }
-
- if (++componentCharCount > Interop.Sys.MaxName)
- {
- throw new PathTooLongException(SR.IO_PathTooLong);
- }
-
- // Normalize the directory separator if needed
- if (c != PathInternal.DirectorySeparatorChar && c == PathInternal.AltDirectorySeparatorChar)
- {
- c = PathInternal.DirectorySeparatorChar;
- flippedSeparator = true;
- }
-
- sb.Append(c);
- }
-
- if (flippedSeparator || sb.Length != path.Length)
- {
- return StringBuilderCache.GetStringAndRelease(sb);
- }
- else
- {
- // We haven't changed the source path, return the original
- StringBuilderCache.Release(sb);
- return path;
- }
- }
-
- private static string RemoveLongPathPrefix(string path)
- {
- return path; // nop. There's nothing special about "long" paths on Unix.
- }
-
- public static string GetTempPath()
- {
- const string TempEnvVar = "TMPDIR";
- const string DefaultTempPath = "/tmp/";
-
- // Get the temp path from the TMPDIR environment variable.
- // If it's not set, just return the default path.
- // If it is, return it, ensuring it ends with a slash.
- string path = Environment.GetEnvironmentVariable(TempEnvVar);
- return
- string.IsNullOrEmpty(path) ? DefaultTempPath :
- PathInternal.IsDirectorySeparator(path[path.Length - 1]) ? path :
- path + PathInternal.DirectorySeparatorChar;
- }
-
- public static string GetTempFileName()
- {
- const string Suffix = ".tmp";
- const int SuffixByteLength = 4;
-
- // mkstemps takes a char* and overwrites the XXXXXX with six characters
- // that'll result in a unique file name.
- string template = GetTempPath() + "tmpXXXXXX" + Suffix + "\0";
- byte[] name = Encoding.UTF8.GetBytes(template);
-
- // Create, open, and close the temp file.
- IntPtr fd = Interop.CheckIo(Interop.Sys.MksTemps(name, SuffixByteLength));
- Interop.Sys.Close(fd); // ignore any errors from close; nothing to do if cleanup isn't possible
-
- // 'name' is now the name of the file
- Debug.Assert(name[name.Length - 1] == '\0');
- return Encoding.UTF8.GetString(name, 0, name.Length - 1); // trim off the trailing '\0'
- }
-
- public static bool IsPathRooted(string path)
- {
- if (path == null)
- return false;
-
- PathInternal.CheckInvalidPathChars(path);
- return path.Length > 0 && path[0] == PathInternal.DirectorySeparatorChar;
- }
-
- public static string GetPathRoot(string path)
- {
- if (path == null) return null;
- return IsPathRooted(path) ? PathInternal.DirectorySeparatorCharAsString : String.Empty;
- }
-
- private static unsafe void GetCryptoRandomBytes(byte* bytes, int byteCount)
- {
- // We want to avoid dependencies on the Crypto library when compiling in CoreCLR. This
- // will use the existing PAL implementation.
- byte[] buffer = new byte[KeyLength];
- Microsoft.Win32.Win32Native.Random(bStrong: true, buffer: buffer, length: KeyLength);
- Runtime.InteropServices.Marshal.Copy(buffer, 0, (IntPtr)bytes, KeyLength);
- }
-
- /// <summary>Gets whether the system is case-sensitive.</summary>
- internal static bool IsCaseSensitive { get { return !s_isMac; } }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/Path.Win32.cs b/src/mscorlib/corefx/System/IO/Path.Win32.cs
deleted file mode 100644
index 8a9e62e6e5..0000000000
--- a/src/mscorlib/corefx/System/IO/Path.Win32.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-
-namespace System.IO
-{
- public static partial class Path
- {
- private static unsafe void GetCryptoRandomBytes(byte* bytes, int byteCount)
- {
- // We need to fill a byte array with cryptographically-strong random bytes, but we can't reference
- // System.Security.Cryptography.RandomNumberGenerator.dll due to layering. Instead, we just
- // call to BCryptGenRandom directly, which is all that RandomNumberGenerator does.
-
- Debug.Assert(bytes != null);
- Debug.Assert(byteCount >= 0);
-
- Interop.BCrypt.NTSTATUS status = Interop.BCrypt.BCryptGenRandom(bytes, byteCount);
- if (status == Interop.BCrypt.NTSTATUS.STATUS_SUCCESS)
- {
- return;
- }
- else if (status == Interop.BCrypt.NTSTATUS.STATUS_NO_MEMORY)
- {
- throw new OutOfMemoryException();
- }
- else
- {
- Debug.Fail("BCryptGenRandom should only fail due to OOM or invalid args / handle inputs.");
- throw new InvalidOperationException();
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/Path.Windows.cs b/src/mscorlib/corefx/System/IO/Path.Windows.cs
deleted file mode 100644
index ce867efd2c..0000000000
--- a/src/mscorlib/corefx/System/IO/Path.Windows.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Text;
-
-namespace System.IO
-{
- public static partial class Path
- {
- public static char[] GetInvalidFileNameChars() => new char[]
- {
- '\"', '<', '>', '|', '\0',
- (char)1, (char)2, (char)3, (char)4, (char)5, (char)6, (char)7, (char)8, (char)9, (char)10,
- (char)11, (char)12, (char)13, (char)14, (char)15, (char)16, (char)17, (char)18, (char)19, (char)20,
- (char)21, (char)22, (char)23, (char)24, (char)25, (char)26, (char)27, (char)28, (char)29, (char)30,
- (char)31, ':', '*', '?', '\\', '/'
- };
-
- public static char[] GetInvalidPathChars() => new char[]
- {
- '|', '\0',
- (char)1, (char)2, (char)3, (char)4, (char)5, (char)6, (char)7, (char)8, (char)9, (char)10,
- (char)11, (char)12, (char)13, (char)14, (char)15, (char)16, (char)17, (char)18, (char)19, (char)20,
- (char)21, (char)22, (char)23, (char)24, (char)25, (char)26, (char)27, (char)28, (char)29, (char)30,
- (char)31
- };
-
- // The max total path is 260, and the max individual component length is 255.
- // For example, D:\<256 char file name> isn't legal, even though it's under 260 chars.
- internal const int MaxPath = 260;
-
- // Expands the given path to a fully qualified path.
- public static string GetFullPath(string path)
- {
- if (path == null)
- throw new ArgumentNullException(nameof(path));
-
- // Embedded null characters are the only invalid character case we want to check up front.
- // This is because the nulls will signal the end of the string to Win32 and therefore have
- // unpredictable results. Other invalid characters we give a chance to be normalized out.
- if (path.IndexOf('\0') != -1)
- throw new ArgumentException(SR.Argument_InvalidPathChars, nameof(path));
-
- if (PathInternal.IsExtended(path))
- {
- // We can't really know what is valid for all cases of extended paths.
- //
- // - object names can include other characters as well (':', '/', etc.)
- // - even file objects have different rules (pipe names can contain most characters)
- //
- // As such we will do no further analysis of extended paths to avoid blocking known and unknown
- // scenarios as well as minimizing compat breaks should we block now and need to unblock later.
- return path;
- }
-
- bool isDevice = PathInternal.IsDevice(path);
- if (!isDevice)
- {
- // Toss out paths with colons that aren't a valid drive specifier.
- // Cannot start with a colon and can only be of the form "C:".
- // (Note that we used to explicitly check "http:" and "file:"- these are caught by this check now.)
- int startIndex = PathInternal.PathStartSkip(path);
-
- // Move past the colon
- startIndex += 2;
-
- if ((path.Length > 0 && path[0] == PathInternal.VolumeSeparatorChar)
- || (path.Length >= startIndex && path[startIndex - 1] == PathInternal.VolumeSeparatorChar && !PathInternal.IsValidDriveChar(path[startIndex - 2]))
- || (path.Length > startIndex && path.IndexOf(PathInternal.VolumeSeparatorChar, startIndex) != -1))
- {
- throw new NotSupportedException(SR.Argument_PathFormatNotSupported);
- }
- }
-
- // Technically this doesn't matter but we used to throw for this case
- if (string.IsNullOrWhiteSpace(path))
- throw new ArgumentException(SR.Arg_PathIllegal);
-
- // We don't want to check invalid characters for device format- see comments for extended above
- string fullPath = PathHelper.Normalize(path, checkInvalidCharacters: !isDevice, expandShortPaths: true);
-
- if (!isDevice)
- {
- // Emulate FileIOPermissions checks, retained for compatibility (normal invalid characters have already been checked)
- if (PathInternal.HasWildCardCharacters(fullPath))
- throw new ArgumentException(SR.Argument_InvalidPathChars, nameof(path));
- }
-
- return fullPath;
- }
-
- public static string GetTempPath()
- {
- StringBuilder sb = StringBuilderCache.Acquire(MaxPath);
- uint r = Interop.Kernel32.GetTempPathW(MaxPath, sb);
- if (r == 0)
- throw Win32Marshal.GetExceptionForLastWin32Error();
- return GetFullPath(StringBuilderCache.GetStringAndRelease(sb));
- }
-
- // Returns a unique temporary file name, and creates a 0-byte file by that
- // name on disk.
- public static string GetTempFileName()
- {
- string path = GetTempPath();
-
- StringBuilder sb = StringBuilderCache.Acquire(MaxPath);
- uint r = Interop.Kernel32.GetTempFileNameW(path, "tmp", 0, sb);
- if (r == 0)
- throw Win32Marshal.GetExceptionForLastWin32Error();
- return StringBuilderCache.GetStringAndRelease(sb);
- }
-
- // Tests if the given path contains a root. A path is considered rooted
- // if it starts with a backslash ("\") or a drive letter and a colon (":").
- public static bool IsPathRooted(string path)
- {
- if (path != null)
- {
- PathInternal.CheckInvalidPathChars(path);
-
- int length = path.Length;
- if ((length >= 1 && PathInternal.IsDirectorySeparator(path[0])) ||
- (length >= 2 && path[1] == PathInternal.VolumeSeparatorChar))
- return true;
- }
- return false;
- }
-
- // Returns the root portion of the given path. The resulting string
- // consists of those rightmost characters of the path that constitute the
- // root of the path. Possible patterns for the resulting string are: An
- // empty string (a relative path on the current drive), "\" (an absolute
- // path on the current drive), "X:" (a relative path on a given drive,
- // where X is the drive letter), "X:\" (an absolute path on a given drive),
- // and "\\server\share" (a UNC path for a given server and share name).
- // The resulting string is null if path is null.
- public static string GetPathRoot(string path)
- {
- if (path == null) return null;
- PathInternal.CheckInvalidPathChars(path);
-
- // Need to return the normalized directory separator
- path = PathInternal.NormalizeDirectorySeparators(path);
-
- int pathRoot = PathInternal.GetRootLength(path);
- return pathRoot <= 0 ? string.Empty : path.Substring(0, pathRoot);
- }
-
- /// <summary>Gets whether the system is case-sensitive.</summary>
- internal static bool IsCaseSensitive { get { return false; } }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/Path.cs b/src/mscorlib/corefx/System/IO/Path.cs
deleted file mode 100644
index 77b213968b..0000000000
--- a/src/mscorlib/corefx/System/IO/Path.cs
+++ /dev/null
@@ -1,575 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-using System.Text;
-
-namespace System.IO
-{
- // Provides methods for processing file system strings in a cross-platform manner.
- // Most of the methods don't do a complete parsing (such as examining a UNC hostname),
- // but they will handle most string operations.
- public static partial class Path
- {
- // Public static readonly variant of the separators. The Path implementation itself is using
- // internal const variant of the separators for better performance.
- public static readonly char DirectorySeparatorChar = PathInternal.DirectorySeparatorChar;
- public static readonly char AltDirectorySeparatorChar = PathInternal.AltDirectorySeparatorChar;
- public static readonly char VolumeSeparatorChar = PathInternal.VolumeSeparatorChar;
- public static readonly char PathSeparator = PathInternal.PathSeparator;
-
- // For generating random file names
- // 8 random bytes provides 12 chars in our encoding for the 8.3 name.
- const int KeyLength = 8;
-
- [Obsolete("Please use GetInvalidPathChars or GetInvalidFileNameChars instead.")]
- public static readonly char[] InvalidPathChars = GetInvalidPathChars();
-
- // Changes the extension of a file path. The path parameter
- // specifies a file path, and the extension parameter
- // specifies a file extension (with a leading period, such as
- // ".exe" or ".cs").
- //
- // The function returns a file path with the same root, directory, and base
- // name parts as path, but with the file extension changed to
- // the specified extension. If path is null, the function
- // returns null. If path does not contain a file extension,
- // the new file extension is appended to the path. If extension
- // is null, any existing extension is removed from path.
- public static string ChangeExtension(string path, string extension)
- {
- if (path != null)
- {
- PathInternal.CheckInvalidPathChars(path);
-
- string s = path;
- for (int i = path.Length - 1; i >= 0; i--)
- {
- char ch = path[i];
- if (ch == '.')
- {
- s = path.Substring(0, i);
- break;
- }
- if (PathInternal.IsDirectoryOrVolumeSeparator(ch)) break;
- }
-
- if (extension != null && path.Length != 0)
- {
- s = (extension.Length == 0 || extension[0] != '.') ?
- s + "." + extension :
- s + extension;
- }
-
- return s;
- }
- return null;
- }
-
- // Returns the directory path of a file path. This method effectively
- // removes the last element of the given file path, i.e. it returns a
- // string consisting of all characters up to but not including the last
- // backslash ("\") in the file path. The returned value is null if the file
- // path is null or if the file path denotes a root (such as "\", "C:", or
- // "\\server\share").
- public static string GetDirectoryName(string path)
- {
- if (path != null)
- {
- PathInternal.CheckInvalidPathChars(path);
- path = PathInternal.NormalizeDirectorySeparators(path);
- int root = PathInternal.GetRootLength(path);
-
- int i = path.Length;
- if (i > root)
- {
- while (i > root && !PathInternal.IsDirectorySeparator(path[--i])) ;
- return path.Substring(0, i);
- }
- }
- return null;
- }
-
- // Returns the extension of the given path. The returned value includes the
- // period (".") character of the extension except when you have a terminal period when you get string.Empty, such as ".exe" or
- // ".cpp". The returned value is null if the given path is
- // null or if the given path does not include an extension.
- [Pure]
- public static string GetExtension(string path)
- {
- if (path == null)
- return null;
-
- PathInternal.CheckInvalidPathChars(path);
- int length = path.Length;
- for (int i = length - 1; i >= 0; i--)
- {
- char ch = path[i];
- if (ch == '.')
- {
- if (i != length - 1)
- return path.Substring(i, length - i);
- else
- return string.Empty;
- }
- if (PathInternal.IsDirectoryOrVolumeSeparator(ch))
- break;
- }
- return string.Empty;
- }
-
- // Returns the name and extension parts of the given path. The resulting
- // string contains the characters of path that follow the last
- // separator in path. The resulting string is null if path is null.
- [Pure]
- public static string GetFileName(string path)
- {
- if (path == null)
- return null;
-
- int offset = PathInternal.FindFileNameIndex(path);
- int count = path.Length - offset;
- return path.Substring(offset, count);
- }
-
- [Pure]
- public static string GetFileNameWithoutExtension(string path)
- {
- if (path == null)
- return null;
-
- int length = path.Length;
- int offset = PathInternal.FindFileNameIndex(path);
-
- int end = path.LastIndexOf('.', length - 1, length - offset);
- return end == -1 ?
- path.Substring(offset) : // No extension was found
- path.Substring(offset, end - offset);
- }
-
- // Returns a cryptographically strong random 8.3 string that can be
- // used as either a folder name or a file name.
- public static unsafe string GetRandomFileName()
- {
-
- byte* pKey = stackalloc byte[KeyLength];
- GetCryptoRandomBytes(pKey, KeyLength);
-
- const int RandomFileNameLength = 12;
- char* pRandomFileName = stackalloc char[RandomFileNameLength];
- Populate83FileNameFromRandomBytes(pKey, KeyLength, pRandomFileName, RandomFileNameLength);
- return new string(pRandomFileName, 0, RandomFileNameLength);
- }
-
- // Tests if a path includes a file extension. The result is
- // true if the characters that follow the last directory
- // separator ('\\' or '/') or volume separator (':') in the path include
- // a period (".") other than a terminal period. The result is false otherwise.
- [Pure]
- public static bool HasExtension(string path)
- {
- if (path != null)
- {
- PathInternal.CheckInvalidPathChars(path);
-
- for (int i = path.Length - 1; i >= 0; i--)
- {
- char ch = path[i];
- if (ch == '.')
- {
- return i != path.Length - 1;
- }
- if (PathInternal.IsDirectoryOrVolumeSeparator(ch)) break;
- }
- }
- return false;
- }
-
- public static string Combine(string path1, string path2)
- {
- if (path1 == null || path2 == null)
- throw new ArgumentNullException((path1 == null) ? nameof(path1): nameof(path2));
- Contract.EndContractBlock();
-
- PathInternal.CheckInvalidPathChars(path1);
- PathInternal.CheckInvalidPathChars(path2);
-
- return CombineNoChecks(path1, path2);
- }
-
- public static string Combine(string path1, string path2, string path3)
- {
- if (path1 == null || path2 == null || path3 == null)
- throw new ArgumentNullException((path1 == null) ? nameof(path1): (path2 == null) ? nameof(path2): nameof(path3));
- Contract.EndContractBlock();
-
- PathInternal.CheckInvalidPathChars(path1);
- PathInternal.CheckInvalidPathChars(path2);
- PathInternal.CheckInvalidPathChars(path3);
-
- return CombineNoChecks(path1, path2, path3);
- }
-
- public static string Combine(string path1, string path2, string path3, string path4)
- {
- if (path1 == null || path2 == null || path3 == null || path4 == null)
- throw new ArgumentNullException((path1 == null) ? nameof(path1): (path2 == null) ? nameof(path2): (path3 == null) ? nameof(path3): nameof(path4));
- Contract.EndContractBlock();
-
- PathInternal.CheckInvalidPathChars(path1);
- PathInternal.CheckInvalidPathChars(path2);
- PathInternal.CheckInvalidPathChars(path3);
- PathInternal.CheckInvalidPathChars(path4);
-
- return CombineNoChecks(path1, path2, path3, path4);
- }
-
- public static string Combine(params string[] paths)
- {
- if (paths == null)
- {
- throw new ArgumentNullException(nameof(paths));
- }
- Contract.EndContractBlock();
-
- int finalSize = 0;
- int firstComponent = 0;
-
- // We have two passes, the first calculates how large a buffer to allocate and does some precondition
- // checks on the paths passed in. The second actually does the combination.
-
- for (int i = 0; i < paths.Length; i++)
- {
- if (paths[i] == null)
- {
- throw new ArgumentNullException(nameof(paths));
- }
-
- if (paths[i].Length == 0)
- {
- continue;
- }
-
- PathInternal.CheckInvalidPathChars(paths[i]);
-
- if (IsPathRooted(paths[i]))
- {
- firstComponent = i;
- finalSize = paths[i].Length;
- }
- else
- {
- finalSize += paths[i].Length;
- }
-
- char ch = paths[i][paths[i].Length - 1];
- if (!PathInternal.IsDirectoryOrVolumeSeparator(ch))
- finalSize++;
- }
-
- StringBuilder finalPath = StringBuilderCache.Acquire(finalSize);
-
- for (int i = firstComponent; i < paths.Length; i++)
- {
- if (paths[i].Length == 0)
- {
- continue;
- }
-
- if (finalPath.Length == 0)
- {
- finalPath.Append(paths[i]);
- }
- else
- {
- char ch = finalPath[finalPath.Length - 1];
- if (!PathInternal.IsDirectoryOrVolumeSeparator(ch))
- {
- finalPath.Append(PathInternal.DirectorySeparatorChar);
- }
-
- finalPath.Append(paths[i]);
- }
- }
-
- return StringBuilderCache.GetStringAndRelease(finalPath);
- }
-
- private static string CombineNoChecks(string path1, string path2)
- {
- if (path2.Length == 0)
- return path1;
-
- if (path1.Length == 0)
- return path2;
-
- if (IsPathRooted(path2))
- return path2;
-
- char ch = path1[path1.Length - 1];
- return PathInternal.IsDirectoryOrVolumeSeparator(ch) ?
- path1 + path2 :
- path1 + PathInternal.DirectorySeparatorCharAsString + path2;
- }
-
- private static string CombineNoChecks(string path1, string path2, string path3)
- {
- if (path1.Length == 0)
- return CombineNoChecks(path2, path3);
- if (path2.Length == 0)
- return CombineNoChecks(path1, path3);
- if (path3.Length == 0)
- return CombineNoChecks(path1, path2);
-
- if (IsPathRooted(path3))
- return path3;
- if (IsPathRooted(path2))
- return CombineNoChecks(path2, path3);
-
- bool hasSep1 = PathInternal.IsDirectoryOrVolumeSeparator(path1[path1.Length - 1]);
- bool hasSep2 = PathInternal.IsDirectoryOrVolumeSeparator(path2[path2.Length - 1]);
-
- if (hasSep1 && hasSep2)
- {
- return path1 + path2 + path3;
- }
- else if (hasSep1)
- {
- return path1 + path2 + PathInternal.DirectorySeparatorCharAsString + path3;
- }
- else if (hasSep2)
- {
- return path1 + PathInternal.DirectorySeparatorCharAsString + path2 + path3;
- }
- else
- {
- // string.Concat only has string-based overloads up to four arguments; after that requires allocating
- // a params string[]. Instead, try to use a cached StringBuilder.
- StringBuilder sb = StringBuilderCache.Acquire(path1.Length + path2.Length + path3.Length + 2);
- sb.Append(path1)
- .Append(PathInternal.DirectorySeparatorChar)
- .Append(path2)
- .Append(PathInternal.DirectorySeparatorChar)
- .Append(path3);
- return StringBuilderCache.GetStringAndRelease(sb);
- }
- }
-
- private static string CombineNoChecks(string path1, string path2, string path3, string path4)
- {
- if (path1.Length == 0)
- return CombineNoChecks(path2, path3, path4);
- if (path2.Length == 0)
- return CombineNoChecks(path1, path3, path4);
- if (path3.Length == 0)
- return CombineNoChecks(path1, path2, path4);
- if (path4.Length == 0)
- return CombineNoChecks(path1, path2, path3);
-
- if (IsPathRooted(path4))
- return path4;
- if (IsPathRooted(path3))
- return CombineNoChecks(path3, path4);
- if (IsPathRooted(path2))
- return CombineNoChecks(path2, path3, path4);
-
- bool hasSep1 = PathInternal.IsDirectoryOrVolumeSeparator(path1[path1.Length - 1]);
- bool hasSep2 = PathInternal.IsDirectoryOrVolumeSeparator(path2[path2.Length - 1]);
- bool hasSep3 = PathInternal.IsDirectoryOrVolumeSeparator(path3[path3.Length - 1]);
-
- if (hasSep1 && hasSep2 && hasSep3)
- {
- // Use string.Concat overload that takes four strings
- return path1 + path2 + path3 + path4;
- }
- else
- {
- // string.Concat only has string-based overloads up to four arguments; after that requires allocating
- // a params string[]. Instead, try to use a cached StringBuilder.
- StringBuilder sb = StringBuilderCache.Acquire(path1.Length + path2.Length + path3.Length + path4.Length + 3);
-
- sb.Append(path1);
- if (!hasSep1)
- {
- sb.Append(PathInternal.DirectorySeparatorChar);
- }
-
- sb.Append(path2);
- if (!hasSep2)
- {
- sb.Append(PathInternal.DirectorySeparatorChar);
- }
-
- sb.Append(path3);
- if (!hasSep3)
- {
- sb.Append(PathInternal.DirectorySeparatorChar);
- }
-
- sb.Append(path4);
-
- return StringBuilderCache.GetStringAndRelease(sb);
- }
- }
-
- private static readonly char[] s_base32Char = {
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
- 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
- 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
- 'y', 'z', '0', '1', '2', '3', '4', '5'};
-
- private static unsafe void Populate83FileNameFromRandomBytes(byte* bytes, int byteCount, char* chars, int charCount)
- {
- Debug.Assert(bytes != null);
- Debug.Assert(chars != null);
-
- // This method requires bytes of length 8 and chars of length 12.
- Debug.Assert(byteCount == 8, $"Unexpected {nameof(byteCount)}");
- Debug.Assert(charCount == 12, $"Unexpected {nameof(charCount)}");
-
- byte b0 = bytes[0];
- byte b1 = bytes[1];
- byte b2 = bytes[2];
- byte b3 = bytes[3];
- byte b4 = bytes[4];
-
- // Consume the 5 Least significant bits of the first 5 bytes
- chars[0] = s_base32Char[b0 & 0x1F];
- chars[1] = s_base32Char[b1 & 0x1F];
- chars[2] = s_base32Char[b2 & 0x1F];
- chars[3] = s_base32Char[b3 & 0x1F];
- chars[4] = s_base32Char[b4 & 0x1F];
-
- // Consume 3 MSB of b0, b1, MSB bits 6, 7 of b3, b4
- chars[5] = s_base32Char[(
- ((b0 & 0xE0) >> 5) |
- ((b3 & 0x60) >> 2))];
-
- chars[6] = s_base32Char[(
- ((b1 & 0xE0) >> 5) |
- ((b4 & 0x60) >> 2))];
-
- // Consume 3 MSB bits of b2, 1 MSB bit of b3, b4
- b2 >>= 5;
-
- Debug.Assert(((b2 & 0xF8) == 0), "Unexpected set bits");
-
- if ((b3 & 0x80) != 0)
- b2 |= 0x08;
- if ((b4 & 0x80) != 0)
- b2 |= 0x10;
-
- chars[7] = s_base32Char[b2];
-
- // Set the file extension separator
- chars[8] = '.';
-
- // Consume the 5 Least significant bits of the remaining 3 bytes
- chars[9] = s_base32Char[(bytes[5] & 0x1F)];
- chars[10] = s_base32Char[(bytes[6] & 0x1F)];
- chars[11] = s_base32Char[(bytes[7] & 0x1F)];
- }
-
- /// <summary>
- /// Create a relative path from one path to another. Paths will be resolved before calculating the difference.
- /// Default path comparison for the active platform will be used (OrdinalIgnoreCase for Windows or Mac, Ordinal for Unix).
- /// </summary>
- /// <param name="relativeTo">The source path the output should be relative to. This path is always considered to be a directory.</param>
- /// <param name="path">The destination path.</param>
- /// <returns>The relative path or <paramref name="path"/> if the paths don't share the same root.</returns>
- /// <exception cref="ArgumentNullException">Thrown if <paramref name="relativeTo"/> or <paramref name="path"/> is <c>null</c> or an empty string.</exception>
- public static string GetRelativePath(string relativeTo, string path)
- {
- return GetRelativePath(relativeTo, path, StringComparison);
- }
-
- private static string GetRelativePath(string relativeTo, string path, StringComparison comparisonType)
- {
- if (string.IsNullOrEmpty(relativeTo)) throw new ArgumentNullException(nameof(relativeTo));
- if (string.IsNullOrWhiteSpace(path)) throw new ArgumentNullException(nameof(path));
- Debug.Assert(comparisonType == StringComparison.Ordinal || comparisonType == StringComparison.OrdinalIgnoreCase);
-
- relativeTo = GetFullPath(relativeTo);
- path = GetFullPath(path);
-
- // Need to check if the roots are different- if they are we need to return the "to" path.
- if (!PathInternal.AreRootsEqual(relativeTo, path, comparisonType))
- return path;
-
- int commonLength = PathInternal.GetCommonPathLength(relativeTo, path, ignoreCase: comparisonType == StringComparison.OrdinalIgnoreCase);
-
- // If there is nothing in common they can't share the same root, return the "to" path as is.
- if (commonLength == 0)
- return path;
-
- // Trailing separators aren't significant for comparison
- int relativeToLength = relativeTo.Length;
- if (PathInternal.EndsInDirectorySeparator(relativeTo))
- relativeToLength--;
-
- bool pathEndsInSeparator = PathInternal.EndsInDirectorySeparator(path);
- int pathLength = path.Length;
- if (pathEndsInSeparator)
- pathLength--;
-
- // If we have effectively the same path, return "."
- if (relativeToLength == pathLength && commonLength >= relativeToLength) return ".";
-
- // We have the same root, we need to calculate the difference now using the
- // common Length and Segment count past the length.
- //
- // Some examples:
- //
- // C:\Foo C:\Bar L3, S1 -> ..\Bar
- // C:\Foo C:\Foo\Bar L6, S0 -> Bar
- // C:\Foo\Bar C:\Bar\Bar L3, S2 -> ..\..\Bar\Bar
- // C:\Foo\Foo C:\Foo\Bar L7, S1 -> ..\Bar
-
- StringBuilder sb = StringBuilderCache.Acquire(Math.Max(relativeTo.Length, path.Length));
-
- // Add parent segments for segments past the common on the "from" path
- if (commonLength < relativeToLength)
- {
- sb.Append(PathInternal.ParentDirectoryPrefix);
-
- for (int i = commonLength; i < relativeToLength; i++)
- {
- if (PathInternal.IsDirectorySeparator(relativeTo[i]))
- {
- sb.Append(PathInternal.ParentDirectoryPrefix);
- }
- }
- }
- else if (PathInternal.IsDirectorySeparator(path[commonLength]))
- {
- // No parent segments and we need to eat the initial separator
- // (C:\Foo C:\Foo\Bar case)
- commonLength++;
- }
-
- // Now add the rest of the "to" path, adding back the trailing separator
- int count = pathLength - commonLength;
- if (pathEndsInSeparator)
- count++;
-
- sb.Append(path, commonLength, count);
- return StringBuilderCache.GetStringAndRelease(sb);
- }
-
- // StringComparison and IsCaseSensitive are also available in PathInternal.CaseSensitivity but we are
- // too low in System.Runtime.Extensions to use it (no FileStream, etc.)
-
- /// <summary>Returns a comparison that can be used to compare file and directory names for equality.</summary>
- internal static StringComparison StringComparison
- {
- get
- {
- return IsCaseSensitive ?
- StringComparison.Ordinal :
- StringComparison.OrdinalIgnoreCase;
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/PathHelper.Windows.cs b/src/mscorlib/corefx/System/IO/PathHelper.Windows.cs
deleted file mode 100644
index e2ead93185..0000000000
--- a/src/mscorlib/corefx/System/IO/PathHelper.Windows.cs
+++ /dev/null
@@ -1,398 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-namespace System.IO
-{
- /// <summary>
- /// Wrapper to help with path normalization.
- /// </summary>
- internal class PathHelper
- {
- // Can't be over 8.3 and be a short name
- private const int MaxShortName = 12;
-
- private const char LastAnsi = (char)255;
- private const char Delete = (char)127;
-
- /// <summary>
- /// Normalize the given path.
- /// </summary>
- /// <remarks>
- /// Normalizes via Win32 GetFullPathName(). It will also trim all "typical" whitespace at the end of the path (see s_trimEndChars). Will also trim initial
- /// spaces if the path is determined to be rooted.
- ///
- /// Note that invalid characters will be checked after the path is normalized, which could remove bad characters. (C:\|\..\a.txt -- C:\a.txt)
- /// </remarks>
- /// <param name="path">Path to normalize</param>
- /// <param name="checkInvalidCharacters">True to check for invalid characters</param>
- /// <param name="expandShortPaths">Attempt to expand short paths if true</param>
- /// <exception cref="ArgumentException">Thrown if the path is an illegal UNC (does not contain a full server/share) or contains illegal characters.</exception>
- /// <exception cref="PathTooLongException">Thrown if the path or a path segment exceeds the filesystem limits.</exception>
- /// <exception cref="FileNotFoundException">Thrown if Windows returns ERROR_FILE_NOT_FOUND. (See Win32Marshal.GetExceptionForWin32Error)</exception>
- /// <exception cref="DirectoryNotFoundException">Thrown if Windows returns ERROR_PATH_NOT_FOUND. (See Win32Marshal.GetExceptionForWin32Error)</exception>
- /// <exception cref="UnauthorizedAccessException">Thrown if Windows returns ERROR_ACCESS_DENIED. (See Win32Marshal.GetExceptionForWin32Error)</exception>
- /// <exception cref="IOException">Thrown if Windows returns an error that doesn't map to the above. (See Win32Marshal.GetExceptionForWin32Error)</exception>
- /// <returns>Normalized path</returns>
- internal static string Normalize(string path, bool checkInvalidCharacters, bool expandShortPaths)
- {
- // Get the full path
- StringBuffer fullPath = new StringBuffer(PathInternal.MaxShortPath);
-
- try
- {
- GetFullPathName(path, ref fullPath);
-
- // Trim whitespace off the end of the string. Win32 normalization trims only U+0020.
- fullPath.TrimEnd(PathInternal.s_trimEndChars);
-
- if (fullPath.Length >= PathInternal.MaxLongPath)
- {
- // Fullpath is genuinely too long
- throw new PathTooLongException(SR.IO_PathTooLong);
- }
-
- // Checking path validity used to happen before getting the full path name. To avoid additional input allocation
- // (to trim trailing whitespace) we now do it after the Win32 call. This will allow legitimate paths through that
- // used to get kicked back (notably segments with invalid characters might get removed via "..").
- //
- // There is no way that GetLongPath can invalidate the path so we'll do this (cheaper) check before we attempt to
- // expand short file names.
-
- // Scan the path for:
- //
- // - Illegal path characters.
- // - Invalid UNC paths like \\, \\server, \\server\.
- // - Segments that are too long (over MaxComponentLength)
-
- // As the path could be > 30K, we'll combine the validity scan. None of these checks are performed by the Win32
- // GetFullPathName() API.
-
- bool possibleShortPath = false;
- bool foundTilde = false;
-
- // We can get UNCs as device paths through this code (e.g. \\.\UNC\), we won't validate them as there isn't
- // an easy way to normalize without extensive cost (we'd have to hunt down the canonical name for any device
- // path that contains UNC or to see if the path was doing something like \\.\GLOBALROOT\Device\Mup\,
- // \\.\GLOBAL\UNC\, \\.\GLOBALROOT\GLOBAL??\UNC\, etc.
- bool specialPath = fullPath.Length > 1 && fullPath[0] == '\\' && fullPath[1] == '\\';
- bool isDevice = PathInternal.IsDevice(ref fullPath);
- bool possibleBadUnc = specialPath && !isDevice;
- int index = specialPath ? 2 : 0;
- int lastSeparator = specialPath ? 1 : 0;
- int segmentLength;
- char current;
-
- while (index < fullPath.Length)
- {
- current = fullPath[index];
-
- // Try to skip deeper analysis. '?' and higher are valid/ignorable except for '\', '|', and '~'
- if (current < '?' || current == '\\' || current == '|' || current == '~')
- {
- switch (current)
- {
- case '|':
- case '>':
- case '<':
- case '\"':
- if (checkInvalidCharacters) throw new ArgumentException(SR.Argument_InvalidPathChars);
- foundTilde = false;
- break;
- case '~':
- foundTilde = true;
- break;
- case '\\':
- segmentLength = index - lastSeparator - 1;
- if (segmentLength > PathInternal.MaxComponentLength)
- throw new PathTooLongException(SR.IO_PathTooLong + fullPath.ToString());
- lastSeparator = index;
-
- if (foundTilde)
- {
- if (segmentLength <= MaxShortName)
- {
- // Possibly a short path.
- possibleShortPath = true;
- }
-
- foundTilde = false;
- }
-
- if (possibleBadUnc)
- {
- // If we're at the end of the path and this is the first separator, we're missing the share.
- // Otherwise we're good, so ignore UNC tracking from here.
- if (index == fullPath.Length - 1)
- throw new ArgumentException(SR.Arg_PathIllegalUNC);
- else
- possibleBadUnc = false;
- }
-
- break;
-
- default:
- if (checkInvalidCharacters && current < ' ') throw new ArgumentException(SR.Argument_InvalidPathChars, nameof(path));
- break;
- }
- }
-
- index++;
- }
-
- if (possibleBadUnc)
- throw new ArgumentException(SR.Arg_PathIllegalUNC);
-
- segmentLength = fullPath.Length - lastSeparator - 1;
- if (segmentLength > PathInternal.MaxComponentLength)
- throw new PathTooLongException(SR.IO_PathTooLong);
-
- if (foundTilde && segmentLength <= MaxShortName)
- possibleShortPath = true;
-
- // Check for a short filename path and try and expand it. Technically you don't need to have a tilde for a short name, but
- // this is how we've always done this. This expansion is costly so we'll continue to let other short paths slide.
- if (expandShortPaths && possibleShortPath)
- {
- return TryExpandShortFileName(ref fullPath, originalPath: path);
- }
- else
- {
- if (fullPath.Length == path.Length && fullPath.StartsWith(path))
- {
- // If we have the exact same string we were passed in, don't bother to allocate another string from the StringBuilder.
- return path;
- }
- else
- {
- return fullPath.ToString();
- }
- }
- }
- finally
- {
- // Clear the buffer
- fullPath.Free();
- }
- }
-
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static bool IsDosUnc(ref StringBuffer buffer)
- {
- return !PathInternal.IsDevice(ref buffer) && buffer.Length > 1 && buffer[0] == '\\' && buffer[1] == '\\';
- }
-
- private static unsafe void GetFullPathName(string path, ref StringBuffer fullPath)
- {
- // If the string starts with an extended prefix we would need to remove it from the path before we call GetFullPathName as
- // it doesn't root extended paths correctly. We don't currently resolve extended paths, so we'll just assert here.
- Debug.Assert(PathInternal.IsPartiallyQualified(path) || !PathInternal.IsExtended(path));
-
- // Historically we would skip leading spaces *only* if the path started with a drive " C:" or a UNC " \\"
- int startIndex = PathInternal.PathStartSkip(path);
-
- fixed (char* pathStart = path)
- {
- uint result = 0;
- while ((result = Interop.Kernel32.GetFullPathNameW(pathStart + startIndex, (uint)fullPath.Capacity, fullPath.UnderlyingArray, IntPtr.Zero)) > fullPath.Capacity)
- {
- // Reported size is greater than the buffer size. Increase the capacity.
- fullPath.EnsureCapacity(checked((int)result));
- }
-
- if (result == 0)
- {
- // Failure, get the error and throw
- int errorCode = Marshal.GetLastWin32Error();
- if (errorCode == 0)
- errorCode = Interop.Errors.ERROR_BAD_PATHNAME;
- throw Win32Marshal.GetExceptionForWin32Error(errorCode, path);
- }
-
- fullPath.Length = checked((int)result);
- }
- }
-
- private static int GetInputBuffer(ref StringBuffer content, bool isDosUnc, ref StringBuffer buffer)
- {
- int length = content.Length;
-
- length += isDosUnc
- ? PathInternal.UncExtendedPrefixLength - PathInternal.UncPrefixLength
- : PathInternal.DevicePrefixLength;
-
- buffer.EnsureCapacity(length + 1);
-
- if (isDosUnc)
- {
- // Put the extended UNC prefix (\\?\UNC\) in front of the path
- buffer.CopyFrom(bufferIndex: 0, source: PathInternal.UncExtendedPathPrefix);
-
- // Copy the source buffer over after the existing UNC prefix
- content.CopyTo(
- bufferIndex: PathInternal.UncPrefixLength,
- destination: ref buffer,
- destinationIndex: PathInternal.UncExtendedPrefixLength,
- count: content.Length - PathInternal.UncPrefixLength);
-
- // Return the prefix difference
- return PathInternal.UncExtendedPrefixLength - PathInternal.UncPrefixLength;
- }
- else
- {
- int prefixSize = PathInternal.ExtendedPathPrefix.Length;
- buffer.CopyFrom(bufferIndex: 0, source: PathInternal.ExtendedPathPrefix);
- content.CopyTo(bufferIndex: 0, destination: ref buffer, destinationIndex: prefixSize, count: content.Length);
- return prefixSize;
- }
- }
-
- private static string TryExpandShortFileName(ref StringBuffer outputBuffer, string originalPath)
- {
- // We guarantee we'll expand short names for paths that only partially exist. As such, we need to find the part of the path that actually does exist. To
- // avoid allocating like crazy we'll create only one input array and modify the contents with embedded nulls.
-
- Debug.Assert(!PathInternal.IsPartiallyQualified(ref outputBuffer), "should have resolved by now");
-
- // We'll have one of a few cases by now (the normalized path will have already:
- //
- // 1. Dos path (C:\)
- // 2. Dos UNC (\\Server\Share)
- // 3. Dos device path (\\.\C:\, \\?\C:\)
- //
- // We want to put the extended syntax on the front if it doesn't already have it, which may mean switching from \\.\.
- //
- // Note that we will never get \??\ here as GetFullPathName() does not recognize \??\ and will return it as C:\??\ (or whatever the current drive is).
-
- int rootLength = PathInternal.GetRootLength(ref outputBuffer);
- bool isDevice = PathInternal.IsDevice(ref outputBuffer);
-
- StringBuffer inputBuffer = new StringBuffer(0);
- try
- {
- bool isDosUnc = false;
- int rootDifference = 0;
- bool wasDotDevice = false;
-
- // Add the extended prefix before expanding to allow growth over MAX_PATH
- if (isDevice)
- {
- // We have one of the following (\\?\ or \\.\)
- inputBuffer.Append(ref outputBuffer);
-
- if (outputBuffer[2] == '.')
- {
- wasDotDevice = true;
- inputBuffer[2] = '?';
- }
- }
- else
- {
- isDosUnc = IsDosUnc(ref outputBuffer);
- rootDifference = GetInputBuffer(ref outputBuffer, isDosUnc, ref inputBuffer);
- }
-
- rootLength += rootDifference;
- int inputLength = inputBuffer.Length;
-
- bool success = false;
- int foundIndex = inputBuffer.Length - 1;
-
- while (!success)
- {
- uint result = Interop.Kernel32.GetLongPathNameW(inputBuffer.UnderlyingArray, outputBuffer.UnderlyingArray, (uint)outputBuffer.Capacity);
-
- // Replace any temporary null we added
- if (inputBuffer[foundIndex] == '\0') inputBuffer[foundIndex] = '\\';
-
- if (result == 0)
- {
- // Look to see if we couldn't find the file
- int error = Marshal.GetLastWin32Error();
- if (error != Interop.Errors.ERROR_FILE_NOT_FOUND && error != Interop.Errors.ERROR_PATH_NOT_FOUND)
- {
- // Some other failure, give up
- break;
- }
-
- // We couldn't find the path at the given index, start looking further back in the string.
- foundIndex--;
-
- for (; foundIndex > rootLength && inputBuffer[foundIndex] != '\\'; foundIndex--) ;
- if (foundIndex == rootLength)
- {
- // Can't trim the path back any further
- break;
- }
- else
- {
- // Temporarily set a null in the string to get Windows to look further up the path
- inputBuffer[foundIndex] = '\0';
- }
- }
- else if (result > outputBuffer.Capacity)
- {
- // Not enough space. The result count for this API does not include the null terminator.
- outputBuffer.EnsureCapacity(checked((int)result));
- result = Interop.Kernel32.GetLongPathNameW(inputBuffer.UnderlyingArray, outputBuffer.UnderlyingArray, (uint)outputBuffer.Capacity);
- }
- else
- {
- // Found the path
- success = true;
- outputBuffer.Length = checked((int)result);
- if (foundIndex < inputLength - 1)
- {
- // It was a partial find, put the non-existent part of the path back
- outputBuffer.Append(ref inputBuffer, foundIndex, inputBuffer.Length - foundIndex);
- }
- }
- }
-
- // Strip out the prefix and return the string
- ref StringBuffer bufferToUse = ref Choose(success, ref outputBuffer, ref inputBuffer);
-
- // Switch back from \\?\ to \\.\ if necessary
- if (wasDotDevice)
- bufferToUse[2] = '.';
-
- string returnValue = null;
-
- int newLength = (int)(bufferToUse.Length - rootDifference);
- if (isDosUnc)
- {
- // Need to go from \\?\UNC\ to \\?\UN\\
- bufferToUse[PathInternal.UncExtendedPrefixLength - PathInternal.UncPrefixLength] = '\\';
- }
-
- // We now need to strip out any added characters at the front of the string
- if (bufferToUse.SubstringEquals(originalPath, rootDifference, newLength))
- {
- // Use the original path to avoid allocating
- returnValue = originalPath;
- }
- else
- {
- returnValue = bufferToUse.Substring(rootDifference, newLength);
- }
-
- return returnValue;
- }
- finally
- {
- inputBuffer.Free();
- }
- }
-
- // Helper method to workaround lack of operator ? support for ref values
- private static ref StringBuffer Choose(bool condition, ref StringBuffer s1, ref StringBuffer s2)
- {
- if (condition) return ref s1;
- else return ref s2;
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/PathInternal.Unix.cs b/src/mscorlib/corefx/System/IO/PathInternal.Unix.cs
deleted file mode 100644
index 08dc1d0251..0000000000
--- a/src/mscorlib/corefx/System/IO/PathInternal.Unix.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Text;
-
-namespace System.IO
-{
- /// <summary>Contains internal path helpers that are shared between many projects.</summary>
- internal static partial class PathInternal
- {
- internal const char DirectorySeparatorChar = '/';
- internal const char AltDirectorySeparatorChar = '/';
- internal const char VolumeSeparatorChar = '/';
- internal const char PathSeparator = ':';
-
- internal const string DirectorySeparatorCharAsString = "/";
-
- // There is only one invalid path character in Unix
- private const char InvalidPathChar = '\0';
-
- internal const string ParentDirectoryPrefix = @"../";
-
- /// <summary>Returns a value indicating if the given path contains invalid characters.</summary>
- internal static bool HasIllegalCharacters(string path)
- {
- Debug.Assert(path != null);
- return path.IndexOf(InvalidPathChar) >= 0;
- }
-
- internal static int GetRootLength(string path)
- {
- return path.Length > 0 && IsDirectorySeparator(path[0]) ? 1 : 0;
- }
-
- internal static bool IsDirectorySeparator(char c)
- {
- // The alternate directory separator char is the same as the directory separator,
- // so we only need to check one.
- Debug.Assert(DirectorySeparatorChar == AltDirectorySeparatorChar);
- return c == DirectorySeparatorChar;
- }
-
- /// <summary>
- /// Normalize separators in the given path. Compresses forward slash runs.
- /// </summary>
- internal static string NormalizeDirectorySeparators(string path)
- {
- if (string.IsNullOrEmpty(path)) return path;
-
- // Make a pass to see if we need to normalize so we can potentially skip allocating
- bool normalized = true;
-
- for (int i = 0; i < path.Length; i++)
- {
- if (IsDirectorySeparator(path[i])
- && (i + 1 < path.Length && IsDirectorySeparator(path[i + 1])))
- {
- normalized = false;
- break;
- }
- }
-
- if (normalized) return path;
-
- StringBuilder builder = new StringBuilder(path.Length);
-
- for (int i = 0; i < path.Length; i++)
- {
- char current = path[i];
-
- // Skip if we have another separator following
- if (IsDirectorySeparator(current)
- && (i + 1 < path.Length && IsDirectorySeparator(path[i + 1])))
- continue;
-
- builder.Append(current);
- }
-
- return builder.ToString();
- }
-
- /// <summary>
- /// Returns true if the character is a directory or volume separator.
- /// </summary>
- /// <param name="ch">The character to test.</param>
- internal static bool IsDirectoryOrVolumeSeparator(char ch)
- {
- // The directory separator, volume separator, and the alternate directory
- // separator should be the same on Unix, so we only need to check one.
- Debug.Assert(DirectorySeparatorChar == AltDirectorySeparatorChar);
- Debug.Assert(DirectorySeparatorChar == VolumeSeparatorChar);
- return ch == DirectorySeparatorChar;
- }
-
- internal static bool IsPartiallyQualified(string path)
- {
- // This is much simpler than Windows where paths can be rooted, but not fully qualified (such as Drive Relative)
- // As long as the path is rooted in Unix it doesn't use the current directory and therefore is fully qualified.
- return !Path.IsPathRooted(path);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/PathInternal.Windows.StringBuffer.cs b/src/mscorlib/corefx/System/IO/PathInternal.Windows.StringBuffer.cs
deleted file mode 100644
index 84953df37b..0000000000
--- a/src/mscorlib/corefx/System/IO/PathInternal.Windows.StringBuffer.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-namespace System.IO
-{
- /// <summary>Contains internal path helpers that are shared between many projects.</summary>
- internal static partial class PathInternal
- {
- /// <summary>
- /// Returns true if the path uses the extended syntax (\\?\)
- /// </summary>
- internal static bool IsExtended(ref StringBuffer path)
- {
- // While paths like "//?/C:/" will work, they're treated the same as "\\.\" paths.
- // Skipping of normalization will *only* occur if back slashes ('\') are used.
- return path.Length >= DevicePrefixLength
- && path[0] == '\\'
- && (path[1] == '\\' || path[1] == '?')
- && path[2] == '?'
- && path[3] == '\\';
- }
-
- /// <summary>
- /// Gets the length of the root of the path (drive, share, etc.).
- /// </summary>
- internal unsafe static int GetRootLength(ref StringBuffer path)
- {
- if (path.Length == 0) return 0;
-
- fixed (char* value = path.UnderlyingArray)
- {
- return GetRootLength(value, path.Length);
- }
- }
-
- /// <summary>
- /// Returns true if the path uses any of the DOS device path syntaxes. ("\\.\", "\\?\", or "\??\")
- /// </summary>
- internal static bool IsDevice(ref StringBuffer path)
- {
- // If the path begins with any two separators is will be recognized and normalized and prepped with
- // "\??\" for internal usage correctly. "\??\" is recognized and handled, "/??/" is not.
- return IsExtended(ref path)
- ||
- (
- path.Length >= DevicePrefixLength
- && IsDirectorySeparator(path[0])
- && IsDirectorySeparator(path[1])
- && (path[2] == '.' || path[2] == '?')
- && IsDirectorySeparator(path[3])
- );
- }
-
- /// <summary>
- /// Returns true if the path specified is relative to the current drive or working directory.
- /// Returns false if the path is fixed to a specific drive or UNC path. This method does no
- /// validation of the path (URIs will be returned as relative as a result).
- /// </summary>
- /// <remarks>
- /// Handles paths that use the alternate directory separator. It is a frequent mistake to
- /// assume that rooted paths (Path.IsPathRooted) are not relative. This isn't the case.
- /// "C:a" is drive relative- meaning that it will be resolved against the current directory
- /// for C: (rooted, but relative). "C:\a" is rooted and not relative (the current directory
- /// will not be used to modify the path).
- /// </remarks>
- internal static bool IsPartiallyQualified(ref StringBuffer path)
- {
- if (path.Length < 2)
- {
- // It isn't fixed, it must be relative. There is no way to specify a fixed
- // path with one character (or less).
- return true;
- }
-
- if (IsDirectorySeparator(path[0]))
- {
- // There is no valid way to specify a relative path with two initial slashes or
- // \? as ? isn't valid for drive relative paths and \??\ is equivalent to \\?\
- return !(path[1] == '?' || IsDirectorySeparator(path[1]));
- }
-
- // The only way to specify a fixed path that doesn't begin with two slashes
- // is the drive, colon, slash format- i.e. C:\
- return !((path.Length >= 3)
- && (path[1] == VolumeSeparatorChar)
- && IsDirectorySeparator(path[2]));
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/PathInternal.Windows.cs b/src/mscorlib/corefx/System/IO/PathInternal.Windows.cs
deleted file mode 100644
index 0ec9b30f99..0000000000
--- a/src/mscorlib/corefx/System/IO/PathInternal.Windows.cs
+++ /dev/null
@@ -1,442 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Text;
-
-namespace System.IO
-{
- /// <summary>Contains internal path helpers that are shared between many projects.</summary>
- internal static partial class PathInternal
- {
- // All paths in Win32 ultimately end up becoming a path to a File object in the Windows object manager. Passed in paths get mapped through
- // DosDevice symbolic links in the object tree to actual File objects under \Devices. To illustrate, this is what happens with a typical
- // path "Foo" passed as a filename to any Win32 API:
- //
- // 1. "Foo" is recognized as a relative path and is appended to the current directory (say, "C:\" in our example)
- // 2. "C:\Foo" is prepended with the DosDevice namespace "\??\"
- // 3. CreateFile tries to create an object handle to the requested file "\??\C:\Foo"
- // 4. The Object Manager recognizes the DosDevices prefix and looks
- // a. First in the current session DosDevices ("\Sessions\1\DosDevices\" for example, mapped network drives go here)
- // b. If not found in the session, it looks in the Global DosDevices ("\GLOBAL??\")
- // 5. "C:" is found in DosDevices (in our case "\GLOBAL??\C:", which is a symbolic link to "\Device\HarddiskVolume6")
- // 6. The full path is now "\Device\HarddiskVolume6\Foo", "\Device\HarddiskVolume6" is a File object and parsing is handed off
- // to the registered parsing method for Files
- // 7. The registered open method for File objects is invoked to create the file handle which is then returned
- //
- // There are multiple ways to directly specify a DosDevices path. The final format of "\??\" is one way. It can also be specified
- // as "\\.\" (the most commonly documented way) and "\\?\". If the question mark syntax is used the path will skip normalization
- // (essentially GetFullPathName()) and path length checks.
-
- // Windows Kernel-Mode Object Manager
- // https://msdn.microsoft.com/en-us/library/windows/hardware/ff565763.aspx
- // https://channel9.msdn.com/Shows/Going+Deep/Windows-NT-Object-Manager
- //
- // Introduction to MS-DOS Device Names
- // https://msdn.microsoft.com/en-us/library/windows/hardware/ff548088.aspx
- //
- // Local and Global MS-DOS Device Names
- // https://msdn.microsoft.com/en-us/library/windows/hardware/ff554302.aspx
-
- internal const char DirectorySeparatorChar = '\\';
- internal const char AltDirectorySeparatorChar = '/';
- internal const char VolumeSeparatorChar = ':';
- internal const char PathSeparator = ';';
-
- internal const string DirectorySeparatorCharAsString = "\\";
-
- internal const string ExtendedPathPrefix = @"\\?\";
- internal const string UncPathPrefix = @"\\";
- internal const string UncExtendedPrefixToInsert = @"?\UNC\";
- internal const string UncExtendedPathPrefix = @"\\?\UNC\";
- internal const string DevicePathPrefix = @"\\.\";
- internal const string ParentDirectoryPrefix = @"..\";
-
- internal const int MaxShortPath = 260;
- internal const int MaxShortDirectoryPath = 248;
- internal const int MaxLongPath = short.MaxValue;
- // \\?\, \\.\, \??\
- internal const int DevicePrefixLength = 4;
- // \\
- internal const int UncPrefixLength = 2;
- // \\?\UNC\, \\.\UNC\
- internal const int UncExtendedPrefixLength = 8;
- internal const int MaxComponentLength = 255;
-
- /// <summary>
- /// Returns true if the given character is a valid drive letter
- /// </summary>
- internal static bool IsValidDriveChar(char value)
- {
- return ((value >= 'A' && value <= 'Z') || (value >= 'a' && value <= 'z'));
- }
-
- /// <summary>
- /// Adds the extended path prefix (\\?\) if not already a device path, IF the path is not relative,
- /// AND the path is more than 259 characters. (> MAX_PATH + null)
- /// </summary>
- internal static string EnsureExtendedPrefixOverMaxPath(string path)
- {
- if (path != null && path.Length >= MaxShortPath)
- {
- return EnsureExtendedPrefix(path);
- }
- else
- {
- return path;
- }
- }
-
- /// <summary>
- /// Adds the extended path prefix (\\?\) if not relative or already a device path.
- /// </summary>
- internal static string EnsureExtendedPrefix(string path)
- {
- // Putting the extended prefix on the path changes the processing of the path. It won't get normalized, which
- // means adding to relative paths will prevent them from getting the appropriate current directory inserted.
-
- // If it already has some variant of a device path (\??\, \\?\, \\.\, //./, etc.) we don't need to change it
- // as it is either correct or we will be changing the behavior. When/if Windows supports long paths implicitly
- // in the future we wouldn't want normalization to come back and break existing code.
-
- // In any case, all internal usages should be hitting normalize path (Path.GetFullPath) before they hit this
- // shimming method. (Or making a change that doesn't impact normalization, such as adding a filename to a
- // normalized base path.)
- if (IsPartiallyQualified(path) || IsDevice(path))
- return path;
-
- // Given \\server\share in longpath becomes \\?\UNC\server\share
- if (path.StartsWith(UncPathPrefix, StringComparison.OrdinalIgnoreCase))
- return path.Insert(2, UncExtendedPrefixToInsert);
-
- return ExtendedPathPrefix + path;
- }
-
- /// <summary>
- /// Returns true if the path uses any of the DOS device path syntaxes. ("\\.\", "\\?\", or "\??\")
- /// </summary>
- internal static bool IsDevice(string path)
- {
- // If the path begins with any two separators is will be recognized and normalized and prepped with
- // "\??\" for internal usage correctly. "\??\" is recognized and handled, "/??/" is not.
- return IsExtended(path)
- ||
- (
- path.Length >= DevicePrefixLength
- && IsDirectorySeparator(path[0])
- && IsDirectorySeparator(path[1])
- && (path[2] == '.' || path[2] == '?')
- && IsDirectorySeparator(path[3])
- );
- }
-
- /// <summary>
- /// Returns true if the path uses the canonical form of extended syntax ("\\?\" or "\??\"). If the
- /// path matches exactly (cannot use alternate directory separators) Windows will skip normalization
- /// and path length checks.
- /// </summary>
- internal static bool IsExtended(string path)
- {
- // While paths like "//?/C:/" will work, they're treated the same as "\\.\" paths.
- // Skipping of normalization will *only* occur if back slashes ('\') are used.
- return path.Length >= DevicePrefixLength
- && path[0] == '\\'
- && (path[1] == '\\' || path[1] == '?')
- && path[2] == '?'
- && path[3] == '\\';
- }
-
- /// <summary>
- /// Returns a value indicating if the given path contains invalid characters (", &lt;, &gt;, |
- /// NUL, or any ASCII char whose integer representation is in the range of 1 through 31).
- /// Does not check for wild card characters ? and *.
- /// </summary>
- internal static bool HasIllegalCharacters(string path)
- {
- // This is equivalent to IndexOfAny(InvalidPathChars) >= 0,
- // except faster since IndexOfAny grows slower as the input
- // array grows larger.
- // Since we know that some of the characters we're looking
- // for are contiguous in the alphabet-- the path cannot contain
- // characters 0-31-- we can optimize this for our specific use
- // case and use simple comparison operations.
-
- for (int i = 0; i < path.Length; i++)
- {
- char c = path[i];
- if (c <= '|') // fast path for common case - '|' is highest illegal character
- {
- if (c <= '\u001f' || c == '|')
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /// <summary>
- /// Check for known wildcard characters. '*' and '?' are the most common ones.
- /// </summary>
- internal static bool HasWildCardCharacters(string path)
- {
- // Question mark is part of dos device syntax so we have to skip if we are
- int startIndex = IsDevice(path) ? ExtendedPathPrefix.Length : 0;
-
- // [MS - FSA] 2.1.4.4 Algorithm for Determining if a FileName Is in an Expression
- // https://msdn.microsoft.com/en-us/library/ff469270.aspx
- for (int i = startIndex; i < path.Length; i++)
- {
- char c = path[i];
- if (c <= '?') // fast path for common case - '?' is highest wildcard character
- {
- if (c == '\"' || c == '<' || c == '>' || c == '*' || c == '?')
- return true;
- }
- }
-
- return false;
- }
-
- /// <summary>
- /// Gets the length of the root of the path (drive, share, etc.).
- /// </summary>
- internal unsafe static int GetRootLength(string path)
- {
- fixed(char* value = path)
- {
- return GetRootLength(value, path.Length);
- }
- }
-
- private unsafe static int GetRootLength(char* path, int pathLength)
- {
- int i = 0;
- int volumeSeparatorLength = 2; // Length to the colon "C:"
- int uncRootLength = 2; // Length to the start of the server name "\\"
-
- bool extendedSyntax = StartsWithOrdinal(path, pathLength, ExtendedPathPrefix);
- bool extendedUncSyntax = StartsWithOrdinal(path, pathLength, UncExtendedPathPrefix);
- if (extendedSyntax)
- {
- // Shift the position we look for the root from to account for the extended prefix
- if (extendedUncSyntax)
- {
- // "\\" -> "\\?\UNC\"
- uncRootLength = UncExtendedPathPrefix.Length;
- }
- else
- {
- // "C:" -> "\\?\C:"
- volumeSeparatorLength += ExtendedPathPrefix.Length;
- }
- }
-
- if ((!extendedSyntax || extendedUncSyntax) && pathLength > 0 && IsDirectorySeparator(path[0]))
- {
- // UNC or simple rooted path (e.g. "\foo", NOT "\\?\C:\foo")
-
- i = 1; // Drive rooted (\foo) is one character
- if (extendedUncSyntax || (pathLength > 1 && IsDirectorySeparator(path[1])))
- {
- // UNC (\\?\UNC\ or \\), scan past the next two directory separators at most
- // (e.g. to \\?\UNC\Server\Share or \\Server\Share\)
- i = uncRootLength;
- int n = 2; // Maximum separators to skip
- while (i < pathLength && (!IsDirectorySeparator(path[i]) || --n > 0)) i++;
- }
- }
- else if (pathLength >= volumeSeparatorLength && path[volumeSeparatorLength - 1] == VolumeSeparatorChar)
- {
- // Path is at least longer than where we expect a colon, and has a colon (\\?\A:, A:)
- // If the colon is followed by a directory separator, move past it
- i = volumeSeparatorLength;
- if (pathLength >= volumeSeparatorLength + 1 && IsDirectorySeparator(path[volumeSeparatorLength])) i++;
- }
- return i;
- }
-
- private unsafe static bool StartsWithOrdinal(char* source, int sourceLength, string value)
- {
- if (sourceLength < value.Length) return false;
- for (int i = 0; i < value.Length; i++)
- {
- if (value[i] != source[i]) return false;
- }
- return true;
- }
-
- /// <summary>
- /// Returns true if the path specified is relative to the current drive or working directory.
- /// Returns false if the path is fixed to a specific drive or UNC path. This method does no
- /// validation of the path (URIs will be returned as relative as a result).
- /// </summary>
- /// <remarks>
- /// Handles paths that use the alternate directory separator. It is a frequent mistake to
- /// assume that rooted paths (Path.IsPathRooted) are not relative. This isn't the case.
- /// "C:a" is drive relative- meaning that it will be resolved against the current directory
- /// for C: (rooted, but relative). "C:\a" is rooted and not relative (the current directory
- /// will not be used to modify the path).
- /// </remarks>
- internal static bool IsPartiallyQualified(string path)
- {
- if (path.Length < 2)
- {
- // It isn't fixed, it must be relative. There is no way to specify a fixed
- // path with one character (or less).
- return true;
- }
-
- if (IsDirectorySeparator(path[0]))
- {
- // There is no valid way to specify a relative path with two initial slashes or
- // \? as ? isn't valid for drive relative paths and \??\ is equivalent to \\?\
- return !(path[1] == '?' || IsDirectorySeparator(path[1]));
- }
-
- // The only way to specify a fixed path that doesn't begin with two slashes
- // is the drive, colon, slash format- i.e. C:\
- return !((path.Length >= 3)
- && (path[1] == VolumeSeparatorChar)
- && IsDirectorySeparator(path[2])
- // To match old behavior we'll check the drive character for validity as the path is technically
- // not qualified if you don't have a valid drive. "=:\" is the "=" file's default data stream.
- && IsValidDriveChar(path[0]));
- }
-
- /// <summary>
- /// Returns the characters to skip at the start of the path if it starts with space(s) and a drive or directory separator.
- /// (examples are " C:", " \")
- /// This is a legacy behavior of Path.GetFullPath().
- /// </summary>
- /// <remarks>
- /// Note that this conflicts with IsPathRooted() which doesn't (and never did) such a skip.
- /// </remarks>
- internal static int PathStartSkip(string path)
- {
- int startIndex = 0;
- while (startIndex < path.Length && path[startIndex] == ' ') startIndex++;
-
- if (startIndex > 0 && (startIndex < path.Length && IsDirectorySeparator(path[startIndex]))
- || (startIndex + 1 < path.Length && path[startIndex + 1] == ':' && IsValidDriveChar(path[startIndex])))
- {
- // Go ahead and skip spaces as we're either " C:" or " \"
- return startIndex;
- }
-
- return 0;
- }
-
- /// <summary>
- /// True if the given character is a directory separator.
- /// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static bool IsDirectorySeparator(char c)
- {
- return c == DirectorySeparatorChar || c == AltDirectorySeparatorChar;
- }
-
- /// <summary>
- /// Normalize separators in the given path. Converts forward slashes into back slashes and compresses slash runs, keeping initial 2 if present.
- /// Also trims initial whitespace in front of "rooted" paths (see PathStartSkip).
- ///
- /// This effectively replicates the behavior of the legacy NormalizePath when it was called with fullCheck=false and expandShortpaths=false.
- /// The current NormalizePath gets directory separator normalization from Win32's GetFullPathName(), which will resolve relative paths and as
- /// such can't be used here (and is overkill for our uses).
- ///
- /// Like the current NormalizePath this will not try and analyze periods/spaces within directory segments.
- /// </summary>
- /// <remarks>
- /// The only callers that used to use Path.Normalize(fullCheck=false) were Path.GetDirectoryName() and Path.GetPathRoot(). Both usages do
- /// not need trimming of trailing whitespace here.
- ///
- /// GetPathRoot() could technically skip normalizing separators after the second segment- consider as a future optimization.
- ///
- /// For legacy desktop behavior with ExpandShortPaths:
- /// - It has no impact on GetPathRoot() so doesn't need consideration.
- /// - It could impact GetDirectoryName(), but only if the path isn't relative (C:\ or \\Server\Share).
- ///
- /// In the case of GetDirectoryName() the ExpandShortPaths behavior was undocumented and provided inconsistent results if the path was
- /// fixed/relative. For example: "C:\PROGRA~1\A.TXT" would return "C:\Program Files" while ".\PROGRA~1\A.TXT" would return ".\PROGRA~1". If you
- /// ultimately call GetFullPath() this doesn't matter, but if you don't or have any intermediate string handling could easily be tripped up by
- /// this undocumented behavior.
- ///
- /// We won't match this old behavior because:
- ///
- /// 1. It was undocumented
- /// 2. It was costly (extremely so if it actually contained '~')
- /// 3. Doesn't play nice with string logic
- /// 4. Isn't a cross-plat friendly concept/behavior
- /// </remarks>
- internal static string NormalizeDirectorySeparators(string path)
- {
- if (string.IsNullOrEmpty(path)) return path;
-
- char current;
- int start = PathStartSkip(path);
-
- if (start == 0)
- {
- // Make a pass to see if we need to normalize so we can potentially skip allocating
- bool normalized = true;
-
- for (int i = 0; i < path.Length; i++)
- {
- current = path[i];
- if (IsDirectorySeparator(current)
- && (current != DirectorySeparatorChar
- // Check for sequential separators past the first position (we need to keep initial two for UNC/extended)
- || (i > 0 && i + 1 < path.Length && IsDirectorySeparator(path[i + 1]))))
- {
- normalized = false;
- break;
- }
- }
-
- if (normalized) return path;
- }
-
- StringBuilder builder = new StringBuilder(path.Length);
-
- if (IsDirectorySeparator(path[start]))
- {
- start++;
- builder.Append(DirectorySeparatorChar);
- }
-
- for (int i = start; i < path.Length; i++)
- {
- current = path[i];
-
- // If we have a separator
- if (IsDirectorySeparator(current))
- {
- // If the next is a separator, skip adding this
- if (i + 1 < path.Length && IsDirectorySeparator(path[i + 1]))
- {
- continue;
- }
-
- // Ensure it is the primary separator
- current = DirectorySeparatorChar;
- }
-
- builder.Append(current);
- }
-
- return builder.ToString();
- }
-
- /// <summary>
- /// Returns true if the character is a directory or volume separator.
- /// </summary>
- /// <param name="ch">The character to test.</param>
- internal static bool IsDirectoryOrVolumeSeparator(char ch)
- {
- return IsDirectorySeparator(ch) || VolumeSeparatorChar == ch;
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/PathInternal.cs b/src/mscorlib/corefx/System/IO/PathInternal.cs
deleted file mode 100644
index 6b4c3b2d30..0000000000
--- a/src/mscorlib/corefx/System/IO/PathInternal.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Text;
-
-namespace System.IO
-{
- /// <summary>Contains internal path helpers that are shared between many projects.</summary>
- internal static partial class PathInternal
- {
- // Trim trailing white spaces, tabs etc but don't be aggressive in removing everything that has UnicodeCategory of trailing space.
- // string.WhitespaceChars will trim more aggressively than what the underlying FS does (for ex, NTFS, FAT).
- //
- // (This is for compatibility with old behavior.)
- internal static readonly char[] s_trimEndChars =
- {
- (char)0x9, // Horizontal tab
- (char)0xA, // Line feed
- (char)0xB, // Vertical tab
- (char)0xC, // Form feed
- (char)0xD, // Carriage return
- (char)0x20, // Space
- (char)0x85, // Next line
- (char)0xA0 // Non breaking space
- };
-
- /// <summary>
- /// Checks for invalid path characters in the given path.
- /// </summary>
- /// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
- /// <exception cref="System.ArgumentException">Thrown if the path has invalid characters.</exception>
- /// <param name="path">The path to check for invalid characters.</param>
- internal static void CheckInvalidPathChars(string path)
- {
- if (path == null)
- throw new ArgumentNullException(nameof(path));
-
- if (HasIllegalCharacters(path))
- throw new ArgumentException(SR.Argument_InvalidPathChars, nameof(path));
- }
-
- /// <summary>
- /// Returns the start index of the filename
- /// in the given path, or 0 if no directory
- /// or volume separator is found.
- /// </summary>
- /// <param name="path">The path in which to find the index of the filename.</param>
- /// <remarks>
- /// This method returns path.Length for
- /// inputs like "/usr/foo/" on Unix. As such,
- /// it is not safe for being used to index
- /// the string without additional verification.
- /// </remarks>
- internal static int FindFileNameIndex(string path)
- {
- Debug.Assert(path != null);
- CheckInvalidPathChars(path);
-
- for (int i = path.Length - 1; i >= 0; i--)
- {
- char ch = path[i];
- if (IsDirectoryOrVolumeSeparator(ch))
- return i + 1;
- }
-
- return 0; // the whole path is the filename
- }
-
- /// <summary>
- /// Returns true if the path ends in a directory separator.
- /// </summary>
- internal static bool EndsInDirectorySeparator(string path) =>
- !string.IsNullOrEmpty(path) && IsDirectorySeparator(path[path.Length - 1]);
-
- /// <summary>
- /// Get the common path length from the start of the string.
- /// </summary>
- internal static int GetCommonPathLength(string first, string second, bool ignoreCase)
- {
- int commonChars = EqualStartingCharacterCount(first, second, ignoreCase: ignoreCase);
-
- // If nothing matches
- if (commonChars == 0)
- return commonChars;
-
- // Or we're a full string and equal length or match to a separator
- if (commonChars == first.Length
- && (commonChars == second.Length || IsDirectorySeparator(second[commonChars])))
- return commonChars;
-
- if (commonChars == second.Length && IsDirectorySeparator(first[commonChars]))
- return commonChars;
-
- // It's possible we matched somewhere in the middle of a segment e.g. C:\Foodie and C:\Foobar.
- while (commonChars > 0 && !IsDirectorySeparator(first[commonChars - 1]))
- commonChars--;
-
- return commonChars;
- }
-
- /// <summary>
- /// Gets the count of common characters from the left optionally ignoring case
- /// </summary>
- unsafe internal static int EqualStartingCharacterCount(string first, string second, bool ignoreCase)
- {
- if (string.IsNullOrEmpty(first) || string.IsNullOrEmpty(second)) return 0;
-
- int commonChars = 0;
-
- fixed (char* f = first)
- fixed (char* s = second)
- {
- char* l = f;
- char* r = s;
- char* leftEnd = l + first.Length;
- char* rightEnd = r + second.Length;
-
- while (l != leftEnd && r != rightEnd
- && (*l == *r || (ignoreCase && char.ToUpperInvariant((*l)) == char.ToUpperInvariant((*r)))))
- {
- commonChars++;
- l++;
- r++;
- }
- }
-
- return commonChars;
- }
-
- /// <summary>
- /// Returns true if the two paths have the same root
- /// </summary>
- internal static bool AreRootsEqual(string first, string second, StringComparison comparisonType)
- {
- int firstRootLength = GetRootLength(first);
- int secondRootLength = GetRootLength(second);
-
- return firstRootLength == secondRootLength
- && string.Compare(
- strA: first,
- indexA: 0,
- strB: second,
- indexB: 0,
- length: firstRootLength,
- comparisonType: comparisonType) == 0;
- }
-
- /// <summary>
- /// Returns false for ".." unless it is specified as a part of a valid File/Directory name.
- /// (Used to avoid moving up directories.)
- ///
- /// Valid: a..b abc..d
- /// Invalid: ..ab ab.. .. abc..d\abc..
- /// </summary>
- internal static void CheckSearchPattern(string searchPattern)
- {
- int index;
- while ((index = searchPattern.IndexOf("..", StringComparison.Ordinal)) != -1)
- {
- // Terminal ".." . Files names cannot end in ".."
- if (index + 2 == searchPattern.Length
- || IsDirectorySeparator(searchPattern[index + 2]))
- throw new ArgumentException(SR.Arg_InvalidSearchPattern);
-
- searchPattern = searchPattern.Substring(index + 2);
- }
-
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/IO/Win32Marshal.cs b/src/mscorlib/corefx/System/IO/Win32Marshal.cs
deleted file mode 100644
index ef76c27010..0000000000
--- a/src/mscorlib/corefx/System/IO/Win32Marshal.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-namespace System.IO
-{
- /// <summary>
- /// Provides static methods for converting from Win32 errors codes to exceptions, HRESULTS and error messages.
- /// </summary>
- internal static class Win32Marshal
- {
- /// <summary>
- /// Converts, resetting it, the last Win32 error into a corresponding <see cref="Exception"/> object.
- /// </summary>
- internal static Exception GetExceptionForLastWin32Error()
- {
- int errorCode = Marshal.GetLastWin32Error();
- return GetExceptionForWin32Error(errorCode, string.Empty);
- }
-
- /// <summary>
- /// Converts the specified Win32 error into a corresponding <see cref="Exception"/> object.
- /// </summary>
- internal static Exception GetExceptionForWin32Error(int errorCode)
- {
- return GetExceptionForWin32Error(errorCode, string.Empty);
- }
-
- /// <summary>
- /// Converts the specified Win32 error into a corresponding <see cref="Exception"/> object, optionally
- /// including the specified path in the error message.
- /// </summary>
- internal static Exception GetExceptionForWin32Error(int errorCode, string path)
- {
- switch (errorCode)
- {
- case Interop.Errors.ERROR_FILE_NOT_FOUND:
- if (path.Length == 0)
- return new FileNotFoundException(SR.IO_FileNotFound);
- else
- return new FileNotFoundException(SR.Format(SR.IO_FileNotFound_FileName, path), path);
-
- case Interop.Errors.ERROR_PATH_NOT_FOUND:
- if (path.Length == 0)
- return new DirectoryNotFoundException(SR.IO_PathNotFound_NoPathName);
- else
- return new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, path));
-
- case Interop.Errors.ERROR_ACCESS_DENIED:
- if (path.Length == 0)
- return new UnauthorizedAccessException(SR.UnauthorizedAccess_IODenied_NoPathName);
- else
- return new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_IODenied_Path, path));
-
- case Interop.Errors.ERROR_ALREADY_EXISTS:
- if (path.Length == 0)
- goto default;
-
- return new IOException(SR.Format(SR.IO_AlreadyExists_Name, path), MakeHRFromErrorCode(errorCode));
-
- case Interop.Errors.ERROR_FILENAME_EXCED_RANGE:
- return new PathTooLongException(SR.IO_PathTooLong);
-
- case Interop.Errors.ERROR_INVALID_PARAMETER:
- return new IOException(GetMessage(errorCode), MakeHRFromErrorCode(errorCode));
-
- case Interop.Errors.ERROR_SHARING_VIOLATION:
- if (path.Length == 0)
- return new IOException(SR.IO_SharingViolation_NoFileName, MakeHRFromErrorCode(errorCode));
- else
- return new IOException(SR.Format(SR.IO_SharingViolation_File, path), MakeHRFromErrorCode(errorCode));
-
- case Interop.Errors.ERROR_FILE_EXISTS:
- if (path.Length == 0)
- goto default;
-
- return new IOException(SR.Format(SR.IO_FileExists_Name, path), MakeHRFromErrorCode(errorCode));
-
- case Interop.Errors.ERROR_OPERATION_ABORTED:
- return new OperationCanceledException();
-
- default:
- return new IOException(GetMessage(errorCode), MakeHRFromErrorCode(errorCode));
- }
- }
-
- /// <summary>
- /// Returns a HRESULT for the specified Win32 error code.
- /// </summary>
- internal static int MakeHRFromErrorCode(int errorCode)
- {
- Debug.Assert((0xFFFF0000 & errorCode) == 0, "This is an HRESULT, not an error code!");
-
- return unchecked(((int)0x80070000) | errorCode);
- }
-
- /// <summary>
- /// Returns a string message for the specified Win32 error code.
- /// </summary>
- internal static string GetMessage(int errorCode)
- {
- return Interop.Kernel32.GetMessage(errorCode);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Runtime/InteropServices/StringBuffer.cs b/src/mscorlib/corefx/System/Runtime/InteropServices/StringBuffer.cs
deleted file mode 100644
index fdd0b95590..0000000000
--- a/src/mscorlib/corefx/System/Runtime/InteropServices/StringBuffer.cs
+++ /dev/null
@@ -1,301 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Buffers;
-using System.Runtime.CompilerServices;
-
-namespace System.Runtime.InteropServices
-{
- /// <summary>
- /// Buffer that deals in char size increments. Dispose to free memory. Always makes ordinal
- /// comparisons. Not thread safe.
- ///
- /// A more performant replacement for StringBuilder when performing native interop.
- ///
- /// "No copy" valuetype. Has to be passed as "ref".
- ///
- /// </summary>
- /// <remarks>
- /// Suggested use through P/Invoke: define DllImport arguments that take a character buffer as SafeHandle and pass StringBuffer.GetHandle().
- /// </remarks>
- internal struct StringBuffer
- {
- private char[] _buffer;
- private int _length;
-
- /// <summary>
- /// Instantiate the buffer with capacity for at least the specified number of characters. Capacity
- /// includes the trailing null character.
- /// </summary>
- public StringBuffer(int initialCapacity)
- {
- _buffer = ArrayPool<char>.Shared.Rent(initialCapacity);
- _length = 0;
- }
-
- /// <summary>
- /// Get/set the character at the given index.
- /// </summary>
- /// <exception cref="ArgumentOutOfRangeException">Thrown if attempting to index outside of the buffer length.</exception>
- public char this[int index]
- {
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- if (index >= _length) throw new ArgumentOutOfRangeException(nameof(index));
- return _buffer[index];
- }
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- set
- {
- if (index >= _length) throw new ArgumentOutOfRangeException(nameof(index));
- _buffer[index] = value;
- }
- }
-
- /// <summary>
- /// Underlying storage of the buffer. Used for interop.
- /// </summary>
- public char[] UnderlyingArray => _buffer;
-
- /// <summary>
- /// Character capacity of the buffer. Includes the count for the trailing null character.
- /// </summary>
- public int Capacity => _buffer.Length;
-
- /// <summary>
- /// Ensure capacity in characters is at least the given minimum.
- /// </summary>
- /// <exception cref="OutOfMemoryException">Thrown if unable to allocate memory when setting.</exception>
- public void EnsureCapacity(int minCapacity)
- {
- if (minCapacity > Capacity)
- {
- char[] oldBuffer = _buffer;
- _buffer = ArrayPool<char>.Shared.Rent(minCapacity);
- Array.Copy(oldBuffer, 0, _buffer, 0, oldBuffer.Length);
- ArrayPool<char>.Shared.Return(oldBuffer);
- }
- }
-
- /// <summary>
- /// The logical length of the buffer in characters. (Does not include the final null.) Will automatically attempt to increase capacity.
- /// This is where the usable data ends.
- /// </summary>
- /// <exception cref="OutOfMemoryException">Thrown if unable to allocate memory when setting.</exception>
- /// <exception cref="ArgumentOutOfRangeException">Thrown if the set size in bytes is int.MaxValue (as space is implicitly reserved for the trailing null).</exception>
- public int Length
- {
- get { return _length; }
- set
- {
- // Null terminate
- EnsureCapacity(checked(value + 1));
- _buffer[value] = '\0';
-
- _length = value;
- }
- }
-
- /// <summary>
- /// True if the buffer contains the given character.
- /// </summary>
- public unsafe bool Contains(char value)
- {
- fixed (char* start = _buffer)
- {
- int length = _length;
- for (int i = 0; i < length; i++)
- {
- if (start[i] == value) return true;
- }
- }
-
- return false;
- }
-
- /// <summary>
- /// Returns true if the buffer starts with the given string.
- /// </summary>
- public bool StartsWith(string value)
- {
- if (value == null) throw new ArgumentNullException(nameof(value));
- if (_length < value.Length) return false;
- return SubstringEquals(value, startIndex: 0, count: value.Length);
- }
-
- /// <summary>
- /// Returns true if the specified StringBuffer substring equals the given value.
- /// </summary>
- /// <param name="value">The value to compare against the specified substring.</param>
- /// <param name="startIndex">Start index of the sub string.</param>
- /// <param name="count">Length of the substring, or -1 to check all remaining.</param>
- /// <exception cref="ArgumentOutOfRangeException">
- /// Thrown if <paramref name="startIndex"/> or <paramref name="count"/> are outside the range
- /// of the buffer's length.
- /// </exception>
- public unsafe bool SubstringEquals(string value, int startIndex = 0, int count = -1)
- {
- if (value == null) return false;
- if (count < -1) throw new ArgumentOutOfRangeException(nameof(count));
- if (startIndex > _length) throw new ArgumentOutOfRangeException(nameof(startIndex));
-
- int realCount = count == -1 ? _length - startIndex : (int)count;
- if (checked(startIndex + realCount) > _length) throw new ArgumentOutOfRangeException(nameof(count));
-
- int length = value.Length;
-
- // Check the substring length against the input length
- if (realCount != length) return false;
-
- fixed (char* valueStart = value)
- fixed (char* bufferStart = _buffer)
- {
- char* subStringStart = bufferStart + startIndex;
-
- for (int i = 0; i < length; i++)
- {
- if (subStringStart[i] != valueStart[i]) return false;
- }
- }
-
- return true;
- }
-
- /// <summary>
- /// Append the given buffer.
- /// </summary>
- /// <param name="value">The buffer to append.</param>
- /// <param name="startIndex">The index in the input buffer to start appending from.</param>
- /// <param name="count">The count of characters to copy from the buffer string.</param>
- /// <exception cref="ArgumentNullException">Thrown if <paramref name="value"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException">
- /// Thrown if <paramref name="startIndex"/> or <paramref name="count"/> are outside the range
- /// of <paramref name="value"/> characters.
- /// </exception>
- public void Append(ref StringBuffer value, int startIndex = 0)
- {
- if (value.Length == 0) return;
-
- value.CopyTo(
- bufferIndex: startIndex,
- destination: ref this,
- destinationIndex: _length,
- count: value.Length);
- }
-
- /// <summary>
- /// Append the given buffer.
- /// </summary>
- /// <param name="value">The buffer to append.</param>
- /// <param name="startIndex">The index in the input buffer to start appending from.</param>
- /// <param name="count">The count of characters to copy from the buffer string.</param>
- /// <exception cref="ArgumentNullException">Thrown if <paramref name="value"/> is null.</exception>
- /// <exception cref="ArgumentOutOfRangeException">
- /// Thrown if <paramref name="startIndex"/> or <paramref name="count"/> are outside the range
- /// of <paramref name="value"/> characters.
- /// </exception>
- public void Append(ref StringBuffer value, int startIndex, int count)
- {
- if (count == 0) return;
-
- value.CopyTo(
- bufferIndex: startIndex,
- destination: ref this,
- destinationIndex: _length,
- count: count);
- }
-
- /// <summary>
- /// Copy contents to the specified buffer. Destination index must be within current destination length.
- /// Will grow the destination buffer if needed.
- /// </summary>
- /// <exception cref="ArgumentOutOfRangeException">
- /// Thrown if <paramref name="bufferIndex"/> or <paramref name="destinationIndex"/> or <paramref name="count"/> are outside the range
- /// of <paramref name="value"/> characters.
- /// </exception>
- /// <exception cref="ArgumentNullException">Thrown if <paramref name="destination"/> is null.</exception>
- public void CopyTo(int bufferIndex, ref StringBuffer destination, int destinationIndex, int count)
- {
- if (destinationIndex > destination._length) throw new ArgumentOutOfRangeException(nameof(destinationIndex));
- if (bufferIndex >= _length) throw new ArgumentOutOfRangeException(nameof(bufferIndex));
- if (_length < checked(bufferIndex + count)) throw new ArgumentOutOfRangeException(nameof(count));
-
- if (count == 0) return;
- int lastIndex = checked(destinationIndex + count);
- if (destination.Length < lastIndex) destination.Length = lastIndex;
-
- Array.Copy(UnderlyingArray, bufferIndex, destination.UnderlyingArray, destinationIndex, count);
- }
-
- /// <summary>
- /// Copy contents from the specified string into the buffer at the given index. Start index must be within the current length of
- /// the buffer, will grow as necessary.
- /// </summary>
- public void CopyFrom(int bufferIndex, string source, int sourceIndex = 0, int count = -1)
- {
- if (source == null) throw new ArgumentNullException(nameof(source));
- if (bufferIndex > _length) throw new ArgumentOutOfRangeException(nameof(bufferIndex));
- if (sourceIndex < 0 || sourceIndex > source.Length) throw new ArgumentOutOfRangeException(nameof(sourceIndex));
- if (count == -1) count = source.Length - sourceIndex;
- if (count < 0 || source.Length - count < sourceIndex) throw new ArgumentOutOfRangeException(nameof(count));
-
- if (count == 0) return;
- int lastIndex = bufferIndex + (int)count;
- if (_length < lastIndex) Length = lastIndex;
-
- source.CopyTo(sourceIndex, UnderlyingArray, bufferIndex, count);
- }
-
- /// <summary>
- /// Trim the specified values from the end of the buffer. If nothing is specified, nothing is trimmed.
- /// </summary>
- public void TrimEnd(char[] values)
- {
- if (values == null || values.Length == 0 || _length == 0) return;
-
- while (_length > 0 && Array.IndexOf(values, _buffer[_length - 1]) >= 0)
- {
- Length = _length - 1;
- }
- }
-
- /// <summary>
- /// String representation of the entire buffer. If the buffer is larger than the maximum size string (int.MaxValue) this will throw.
- /// </summary>
- /// <exception cref="InvalidOperationException">Thrown if the buffer is too big to fit into a string.</exception>
- public override string ToString()
- {
- return new string(_buffer, startIndex: 0, length: _length);
- }
-
- /// <summary>
- /// Get the given substring in the buffer.
- /// </summary>
- /// <param name="count">Count of characters to take, or remaining characters from <paramref name="startIndex"/> if -1.</param>
- /// <exception cref="ArgumentOutOfRangeException">
- /// Thrown if <paramref name="startIndex"/> or <paramref name="count"/> are outside the range of the buffer's length
- /// or count is greater than the maximum string size (int.MaxValue).
- /// </exception>
- public string Substring(int startIndex, int count = -1)
- {
- if (startIndex > (_length == 0 ? 0 : _length - 1)) throw new ArgumentOutOfRangeException(nameof(startIndex));
- if (count < -1) throw new ArgumentOutOfRangeException(nameof(count));
-
- int realCount = count == -1 ? _length - startIndex : (int)count;
- if (realCount > int.MaxValue || checked(startIndex + realCount) > _length) throw new ArgumentOutOfRangeException(nameof(count));
-
- // The buffer could be bigger than will fit into a string, but the substring might fit. As the starting
- // index might be bigger than int we need to index ourselves.
- return new string(_buffer, startIndex: startIndex, length: realCount);
- }
-
- public void Free()
- {
- ArrayPool<char>.Shared.Return(_buffer);
- _buffer = null;
- _length = 0;
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Security/CryptographicException.cs b/src/mscorlib/corefx/System/Security/CryptographicException.cs
deleted file mode 100644
index 89cb658aa9..0000000000
--- a/src/mscorlib/corefx/System/Security/CryptographicException.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Globalization;
-using System.Runtime.Serialization;
-
-namespace System.Security.Cryptography
-{
- [Serializable]
- public class CryptographicException : SystemException
- {
- public CryptographicException()
- : base(SR.Arg_CryptographyException)
- {
- }
-
- public CryptographicException(int hr)
- : base(SR.Arg_CryptographyException)
- {
- HResult = hr;
- }
-
- public CryptographicException(string message)
- : base(message)
- {
- }
-
- public CryptographicException(string message, Exception inner)
- : base(message, inner)
- {
- }
-
- public CryptographicException(string format, string insert)
- : base(string.Format(CultureInfo.CurrentCulture, format, insert))
- {
- }
-
- protected CryptographicException(SerializationInfo info, StreamingContext context)
- : base(info, context)
- {
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Security/SafeBSTRHandle.cs b/src/mscorlib/corefx/System/Security/SafeBSTRHandle.cs
deleted file mode 100644
index 19d63d41e4..0000000000
--- a/src/mscorlib/corefx/System/Security/SafeBSTRHandle.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-namespace System.Security
-{
- internal sealed class SafeBSTRHandle : SafeBuffer
- {
- internal SafeBSTRHandle() : base(true) { }
-
- internal static SafeBSTRHandle Allocate(uint lenInChars)
- {
- uint lenInBytes = lenInChars * sizeof(char);
- SafeBSTRHandle bstr = Interop.OleAut32.SysAllocStringLen(IntPtr.Zero, lenInChars);
- if (bstr.IsInvalid) // SysAllocStringLen returns a NULL ptr when there's insufficient memory
- {
- throw new OutOfMemoryException();
- }
- bstr.Initialize(lenInBytes);
- return bstr;
- }
-
- override protected bool ReleaseHandle()
- {
- Interop.NtDll.ZeroMemory(handle, (UIntPtr)(Interop.OleAut32.SysStringLen(handle) * sizeof(char)));
- Interop.OleAut32.SysFreeString(handle);
- return true;
- }
-
- internal unsafe void ClearBuffer()
- {
- byte* bufferPtr = null;
- try
- {
- AcquirePointer(ref bufferPtr);
- Interop.NtDll.ZeroMemory((IntPtr)bufferPtr, (UIntPtr)(Interop.OleAut32.SysStringLen((IntPtr)bufferPtr) * sizeof(char)));
- }
- finally
- {
- if (bufferPtr != null)
- {
- ReleasePointer();
- }
- }
- }
-
- internal unsafe uint Length => Interop.OleAut32.SysStringLen(this);
-
- internal unsafe static void Copy(SafeBSTRHandle source, SafeBSTRHandle target, uint bytesToCopy)
- {
- if (bytesToCopy == 0)
- {
- return;
- }
-
- byte* sourcePtr = null, targetPtr = null;
- try
- {
- source.AcquirePointer(ref sourcePtr);
- target.AcquirePointer(ref targetPtr);
-
- Debug.Assert(source.ByteLength >= bytesToCopy, "Source buffer is too small.");
- Buffer.MemoryCopy(sourcePtr, targetPtr, target.ByteLength, bytesToCopy);
- }
- finally
- {
- if (targetPtr != null)
- {
- target.ReleasePointer();
- }
- if (sourcePtr != null)
- {
- source.ReleasePointer();
- }
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Security/SecureString.Unix.cs b/src/mscorlib/corefx/System/Security/SecureString.Unix.cs
deleted file mode 100644
index 0ef38e40ee..0000000000
--- a/src/mscorlib/corefx/System/Security/SecureString.Unix.cs
+++ /dev/null
@@ -1,295 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace System.Security
-{
- // SecureString attempts to provide a defense-in-depth solution.
- //
- // On Windows, this is done with several mechanisms:
- // 1. keeping the data in unmanaged memory so that copies of it aren't implicitly made by the GC moving it around
- // 2. zero'ing out that unmanaged memory so that the string is reliably removed from memory when done with it
- // 3. encrypting the data while it's not being used (it's unencrypted to manipulate and use it)
- //
- // On Unix, we do 1 and 2, but we don't do 3 as there's no CryptProtectData equivalent.
-
- public sealed partial class SecureString
- {
- private UnmanagedBuffer _buffer;
-
- internal SecureString(SecureString str)
- {
- // Allocate enough space to store the provided string
- EnsureCapacity(str._decryptedLength);
- _decryptedLength = str._decryptedLength;
-
- // Copy the string into the newly allocated space
- if (_decryptedLength > 0)
- {
- UnmanagedBuffer.Copy(str._buffer, _buffer, (ulong)(str._decryptedLength * sizeof(char)));
- }
- }
-
- private unsafe void InitializeSecureString(char* value, int length)
- {
- // Allocate enough space to store the provided string
- EnsureCapacity(length);
- _decryptedLength = length;
- if (length == 0)
- {
- return;
- }
-
- // Copy the string into the newly allocated space
- byte* ptr = null;
- try
- {
- _buffer.AcquirePointer(ref ptr);
- Buffer.MemoryCopy(value, ptr, _buffer.ByteLength, (ulong)(length * sizeof(char)));
- }
- finally
- {
- if (ptr != null)
- {
- _buffer.ReleasePointer();
- }
- }
- }
-
- private void DisposeCore()
- {
- if (_buffer != null && !_buffer.IsInvalid)
- {
- _buffer.Dispose();
- _buffer = null;
- }
- }
-
- private void EnsureNotDisposed()
- {
- if (_buffer == null)
- {
- throw new ObjectDisposedException(GetType().Name);
- }
- }
-
- private void ClearCore()
- {
- _decryptedLength = 0;
- _buffer.Clear();
- }
-
- private unsafe void AppendCharCore(char c)
- {
- // Make sure we have enough space for the new character, then write it at the end.
- EnsureCapacity(_decryptedLength + 1);
- _buffer.Write((ulong)(_decryptedLength * sizeof(char)), c);
- _decryptedLength++;
- }
-
- private unsafe void InsertAtCore(int index, char c)
- {
- // Make sure we have enough space for the new character, then shift all of the characters above it and insert it.
- EnsureCapacity(_decryptedLength + 1);
- byte* ptr = null;
- try
- {
- _buffer.AcquirePointer(ref ptr);
- ptr += index * sizeof(char);
- long bytesToShift = (_decryptedLength - index) * sizeof(char);
- Buffer.MemoryCopy(ptr, ptr + sizeof(char), bytesToShift, bytesToShift);
- *((char*)ptr) = c;
- ++_decryptedLength;
- }
- finally
- {
- if (ptr != null)
- {
- _buffer.ReleasePointer();
- }
- }
- }
-
- private unsafe void RemoveAtCore(int index)
- {
- // Shift down all values above the specified index, then null out the empty space at the end.
- byte* ptr = null;
- try
- {
- _buffer.AcquirePointer(ref ptr);
- ptr += index * sizeof(char);
- long bytesToShift = (_decryptedLength - index - 1) * sizeof(char);
- Buffer.MemoryCopy(ptr + sizeof(char), ptr, bytesToShift, bytesToShift);
- *((char*)(ptr + bytesToShift)) = (char)0;
- --_decryptedLength;
- }
- finally
- {
- if (ptr != null)
- {
- _buffer.ReleasePointer();
- }
- }
- }
-
- private void SetAtCore(int index, char c)
- {
- // Overwrite the character at the specified index
- _buffer.Write((ulong)(index * sizeof(char)), c);
- }
-
- internal unsafe IntPtr MarshalToStringCore(bool globalAlloc, bool unicode)
- {
- int length = _decryptedLength;
-
- byte* bufferPtr = null;
- IntPtr stringPtr = IntPtr.Zero, result = IntPtr.Zero;
- try
- {
- _buffer.AcquirePointer(ref bufferPtr);
- if (unicode)
- {
- int resultLength = (length + 1) * sizeof(char);
- stringPtr = globalAlloc ? Marshal.AllocHGlobal(resultLength) : Marshal.AllocCoTaskMem(resultLength);
- Buffer.MemoryCopy(
- source: bufferPtr,
- destination: (byte*)stringPtr.ToPointer(),
- destinationSizeInBytes: resultLength,
- sourceBytesToCopy: length * sizeof(char));
- *(length + (char*)stringPtr) = '\0';
- }
- else
- {
- int resultLength = Encoding.UTF8.GetByteCount((char*)bufferPtr, length) + 1;
- stringPtr = globalAlloc ? Marshal.AllocHGlobal(resultLength) : Marshal.AllocCoTaskMem(resultLength);
- int encodedLength = Encoding.UTF8.GetBytes((char*)bufferPtr, length, (byte*)stringPtr, resultLength);
- Debug.Assert(encodedLength + 1 == resultLength, $"Expected encoded length to match result, got {encodedLength} != {resultLength}");
- *(resultLength - 1 + (byte*)stringPtr) = 0;
- }
-
- result = stringPtr;
- }
- finally
- {
- // If there was a failure, such that result isn't initialized,
- // release the string if we had one.
- if (stringPtr != IntPtr.Zero && result == IntPtr.Zero)
- {
- UnmanagedBuffer.ZeroMemory((byte*)stringPtr, (ulong)(length * sizeof(char)));
- MarshalFree(stringPtr, globalAlloc);
- }
-
- if (bufferPtr != null)
- {
- _buffer.ReleasePointer();
- }
- }
-
- return result;
- }
-
- // -----------------------------
- // ---- PAL layer ends here ----
- // -----------------------------
-
- private void EnsureCapacity(int capacity)
- {
- // Make sure the requested capacity doesn't exceed SecureString's defined limit
- if (capacity > MaxLength)
- {
- throw new ArgumentOutOfRangeException(nameof(capacity), SR.ArgumentOutOfRange_Capacity);
- }
-
- // If we already have enough space allocated, we're done
- if (_buffer != null && (capacity * sizeof(char)) <= (int)_buffer.ByteLength)
- {
- return;
- }
-
- // We need more space, so allocate a new buffer, copy all our data into it,
- // and then swap the new for the old.
- UnmanagedBuffer newBuffer = UnmanagedBuffer.Allocate(capacity * sizeof(char));
- if (_buffer != null)
- {
- UnmanagedBuffer.Copy(_buffer, newBuffer, _buffer.ByteLength);
- _buffer.Dispose();
- }
- _buffer = newBuffer;
- }
-
- /// <summary>SafeBuffer for managing memory meant to be kept confidential.</summary>
- private sealed class UnmanagedBuffer : SafeBuffer
- {
- internal UnmanagedBuffer() : base(true) { }
-
- internal static UnmanagedBuffer Allocate(int bytes)
- {
- Debug.Assert(bytes >= 0);
- UnmanagedBuffer buffer = new UnmanagedBuffer();
- buffer.SetHandle(Marshal.AllocHGlobal(bytes));
- buffer.Initialize((ulong)bytes);
- return buffer;
- }
-
- internal unsafe void Clear()
- {
- byte* ptr = null;
- try
- {
- AcquirePointer(ref ptr);
- ZeroMemory(ptr, ByteLength);
- }
- finally
- {
- if (ptr != null)
- {
- ReleasePointer();
- }
- }
- }
-
- internal static unsafe void Copy(UnmanagedBuffer source, UnmanagedBuffer destination, ulong bytesLength)
- {
- if (bytesLength == 0)
- {
- return;
- }
-
- byte* srcPtr = null, dstPtr = null;
- try
- {
- source.AcquirePointer(ref srcPtr);
- destination.AcquirePointer(ref dstPtr);
- Buffer.MemoryCopy(srcPtr, dstPtr, destination.ByteLength, bytesLength);
- }
- finally
- {
- if (dstPtr != null)
- {
- destination.ReleasePointer();
- }
- if (srcPtr != null)
- {
- source.ReleasePointer();
- }
- }
- }
-
- protected override unsafe bool ReleaseHandle()
- {
- Marshal.FreeHGlobal(handle);
- return true;
- }
-
- internal static unsafe void ZeroMemory(byte* ptr, ulong len)
- {
- for (ulong i = 0; i < len; i++) *ptr++ = 0;
- }
- }
-
- }
-}
diff --git a/src/mscorlib/corefx/System/Security/SecureString.Windows.cs b/src/mscorlib/corefx/System/Security/SecureString.Windows.cs
deleted file mode 100644
index 7ed0c6a15b..0000000000
--- a/src/mscorlib/corefx/System/Security/SecureString.Windows.cs
+++ /dev/null
@@ -1,310 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using System.Security.Cryptography;
-using Microsoft.Win32;
-
-namespace System.Security
-{
- public sealed partial class SecureString
- {
- internal SecureString(SecureString str)
- {
- Debug.Assert(str != null, "Expected non-null SecureString");
- Debug.Assert(str._buffer != null, "Expected other SecureString's buffer to be non-null");
- Debug.Assert(str._encrypted, "Expected to be used only on encrypted SecureStrings");
-
- AllocateBuffer(str._buffer.Length);
- SafeBSTRHandle.Copy(str._buffer, _buffer, str._buffer.Length * sizeof(char));
-
- _decryptedLength = str._decryptedLength;
- _encrypted = str._encrypted;
- }
-
- private unsafe void InitializeSecureString(char* value, int length)
- {
- Debug.Assert(length >= 0, $"Expected non-negative length, got {length}");
-
- AllocateBuffer((uint)length);
- _decryptedLength = length;
-
- byte* bufferPtr = null;
- try
- {
- _buffer.AcquirePointer(ref bufferPtr);
- Buffer.MemoryCopy((byte*)value, bufferPtr, (long)_buffer.ByteLength, length * sizeof(char));
- }
- finally
- {
- if (bufferPtr != null)
- {
- _buffer.ReleasePointer();
- }
- }
-
- ProtectMemory();
- }
-
- private void AppendCharCore(char c)
- {
- UnprotectMemory();
- try
- {
- EnsureCapacity(_decryptedLength + 1);
- _buffer.Write<char>((uint)_decryptedLength * sizeof(char), c);
- _decryptedLength++;
- }
- finally
- {
- ProtectMemory();
- }
- }
-
- private void ClearCore()
- {
- _decryptedLength = 0;
- _buffer.ClearBuffer();
- }
-
- private void DisposeCore()
- {
- if (_buffer != null)
- {
- _buffer.Dispose();
- _buffer = null;
- }
- }
-
- private unsafe void InsertAtCore(int index, char c)
- {
- byte* bufferPtr = null;
- UnprotectMemory();
- try
- {
- EnsureCapacity(_decryptedLength + 1);
-
- _buffer.AcquirePointer(ref bufferPtr);
- char* pBuffer = (char*)bufferPtr;
-
- for (int i = _decryptedLength; i > index; i--)
- {
- pBuffer[i] = pBuffer[i - 1];
- }
- pBuffer[index] = c;
- ++_decryptedLength;
- }
- finally
- {
- ProtectMemory();
- if (bufferPtr != null)
- {
- _buffer.ReleasePointer();
- }
- }
- }
-
- private unsafe void RemoveAtCore(int index)
- {
- byte* bufferPtr = null;
- UnprotectMemory();
- try
- {
- _buffer.AcquirePointer(ref bufferPtr);
- char* pBuffer = (char*)bufferPtr;
-
- for (int i = index; i < _decryptedLength - 1; i++)
- {
- pBuffer[i] = pBuffer[i + 1];
- }
- pBuffer[--_decryptedLength] = (char)0;
- }
- finally
- {
- ProtectMemory();
- if (bufferPtr != null)
- {
- _buffer.ReleasePointer();
- }
- }
- }
-
- private void SetAtCore(int index, char c)
- {
- UnprotectMemory();
- try
- {
- _buffer.Write<char>((uint)index * sizeof(char), c);
- }
- finally
- {
- ProtectMemory();
- }
- }
-
- internal unsafe IntPtr MarshalToBSTR()
- {
- int length = _decryptedLength;
- IntPtr ptr = IntPtr.Zero;
- IntPtr result = IntPtr.Zero;
- byte* bufferPtr = null;
-
- UnprotectMemory();
- try
- {
- _buffer.AcquirePointer(ref bufferPtr);
- int resultByteLength = (length + 1) * sizeof(char);
-
- ptr = Win32Native.SysAllocStringLen(null, length);
- if (ptr == IntPtr.Zero) {
- throw new OutOfMemoryException();
- }
-
- Buffer.MemoryCopy(bufferPtr, (byte*)ptr, resultByteLength, length * sizeof(char));
-
- result = ptr;
- }
- finally
- {
- ProtectMemory();
-
- // If we failed for any reason, free the new buffer
- if (result == IntPtr.Zero && ptr != IntPtr.Zero)
- {
- Interop.NtDll.ZeroMemory(ptr, (UIntPtr)(length * sizeof(char)));
- Win32Native.SysFreeString(ptr);
- }
-
- if (bufferPtr != null)
- {
- _buffer.ReleasePointer();
- }
- }
- return result;
- }
-
- internal unsafe IntPtr MarshalToStringCore(bool globalAlloc, bool unicode)
- {
- int length = _decryptedLength;
- IntPtr ptr = IntPtr.Zero;
- IntPtr result = IntPtr.Zero;
- byte* bufferPtr = null;
-
- UnprotectMemory();
- try
- {
- _buffer.AcquirePointer(ref bufferPtr);
- if (unicode)
- {
- int resultByteLength = (length + 1) * sizeof(char);
- ptr = globalAlloc ? Marshal.AllocHGlobal(resultByteLength) : Marshal.AllocCoTaskMem(resultByteLength);
- Buffer.MemoryCopy(bufferPtr, (byte*)ptr, resultByteLength, length * sizeof(char));
- *(length + (char*)ptr) = '\0';
- }
- else
- {
- uint defaultChar = '?';
- int resultByteLength = 1 + Interop.Kernel32.WideCharToMultiByte(
- Interop.Kernel32.CP_ACP, Interop.Kernel32.WC_NO_BEST_FIT_CHARS, (char*)bufferPtr, length, null, 0, (IntPtr)(&defaultChar), IntPtr.Zero);
- ptr = globalAlloc ? Marshal.AllocHGlobal(resultByteLength) : Marshal.AllocCoTaskMem(resultByteLength);
- Interop.Kernel32.WideCharToMultiByte(
- Interop.Kernel32.CP_ACP, Interop.Kernel32.WC_NO_BEST_FIT_CHARS, (char*)bufferPtr, length, (byte*)ptr, resultByteLength - 1, (IntPtr)(&defaultChar), IntPtr.Zero);
- *(resultByteLength - 1 + (byte*)ptr) = 0;
- }
- result = ptr;
- }
- finally
- {
- ProtectMemory();
-
- // If we failed for any reason, free the new buffer
- if (result == IntPtr.Zero && ptr != IntPtr.Zero)
- {
- Interop.NtDll.ZeroMemory(ptr, (UIntPtr)(length * sizeof(char)));
- MarshalFree(ptr, globalAlloc);
- }
-
- if (bufferPtr != null)
- {
- _buffer.ReleasePointer();
- }
- }
- return result;
- }
-
- private void EnsureNotDisposed()
- {
- if (_buffer == null)
- {
- throw new ObjectDisposedException(GetType().Name);
- }
- }
-
- // -----------------------------
- // ---- PAL layer ends here ----
- // -----------------------------
-
- private const int BlockSize = (int)Interop.Crypt32.CRYPTPROTECTMEMORY_BLOCK_SIZE / sizeof(char);
- private SafeBSTRHandle _buffer;
- private bool _encrypted;
-
- private void AllocateBuffer(uint size)
- {
- _buffer = SafeBSTRHandle.Allocate(GetAlignedSize(size));
- }
-
- private static uint GetAlignedSize(uint size) =>
- size == 0 || size % BlockSize != 0 ?
- BlockSize + ((size / BlockSize) * BlockSize) :
- size;
-
- private void EnsureCapacity(int capacity)
- {
- if (capacity > MaxLength)
- {
- throw new ArgumentOutOfRangeException(nameof(capacity), SR.ArgumentOutOfRange_Capacity);
- }
-
- if (((uint)capacity * sizeof(char)) <= _buffer.ByteLength)
- {
- return;
- }
-
- var oldBuffer = _buffer;
- SafeBSTRHandle newBuffer = SafeBSTRHandle.Allocate(GetAlignedSize((uint)capacity));
- SafeBSTRHandle.Copy(oldBuffer, newBuffer, (uint)_decryptedLength * sizeof(char));
- _buffer = newBuffer;
- oldBuffer.Dispose();
- }
-
- private void ProtectMemory()
- {
- Debug.Assert(!_buffer.IsInvalid, "Invalid buffer!");
-
- if (_decryptedLength != 0 &&
- !_encrypted &&
- !Interop.Crypt32.CryptProtectMemory(_buffer, _buffer.Length * sizeof(char), Interop.Crypt32.CRYPTPROTECTMEMORY_SAME_PROCESS))
- {
- throw new CryptographicException(Marshal.GetLastWin32Error());
- }
-
- _encrypted = true;
- }
-
- private void UnprotectMemory()
- {
- Debug.Assert(!_buffer.IsInvalid, "Invalid buffer!");
-
- if (_decryptedLength != 0 &&
- _encrypted &&
- !Interop.Crypt32.CryptUnprotectMemory(_buffer, _buffer.Length * sizeof(char), Interop.Crypt32.CRYPTPROTECTMEMORY_SAME_PROCESS))
- {
- throw new CryptographicException(Marshal.GetLastWin32Error());
- }
-
- _encrypted = false;
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Security/SecureString.cs b/src/mscorlib/corefx/System/Security/SecureString.cs
deleted file mode 100644
index 9059f90e60..0000000000
--- a/src/mscorlib/corefx/System/Security/SecureString.cs
+++ /dev/null
@@ -1,189 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-namespace System.Security
-{
- public sealed partial class SecureString : IDisposable
- {
- private const int MaxLength = 65536;
- private readonly object _methodLock = new object();
- private bool _readOnly;
- private int _decryptedLength;
-
- public unsafe SecureString()
- {
- InitializeSecureString(null, 0);
- }
-
- [CLSCompliant(false)]
- public unsafe SecureString(char* value, int length)
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
- if (length < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_NeedNonNegNum);
- }
- if (length > MaxLength)
- {
- throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_Length);
- }
-
- InitializeSecureString(value, length);
- }
-
- public int Length
- {
- get
- {
- lock (_methodLock)
- {
- EnsureNotDisposed();
- return _decryptedLength;
- }
- }
- }
-
- public void AppendChar(char c)
- {
- lock (_methodLock)
- {
- EnsureNotDisposed();
- EnsureNotReadOnly();
- AppendCharCore(c);
- }
- }
-
- // clears the current contents. Only available if writable
- public void Clear()
- {
- lock (_methodLock)
- {
- EnsureNotDisposed();
- EnsureNotReadOnly();
- ClearCore();
- }
- }
-
- // Do a deep-copy of the SecureString
- public SecureString Copy()
- {
- lock (_methodLock)
- {
- EnsureNotDisposed();
- return new SecureString(this);
- }
- }
-
- public void Dispose()
- {
- lock (_methodLock)
- {
- DisposeCore();
- }
- }
-
- public void InsertAt(int index, char c)
- {
- lock (_methodLock)
- {
- if (index < 0 || index > _decryptedLength)
- {
- throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexString);
- }
-
- EnsureNotDisposed();
- EnsureNotReadOnly();
-
- InsertAtCore(index, c);
- }
- }
-
- public bool IsReadOnly()
- {
- lock (_methodLock)
- {
- EnsureNotDisposed();
- return _readOnly;
- }
- }
-
- public void MakeReadOnly()
- {
- lock (_methodLock)
- {
- EnsureNotDisposed();
- _readOnly = true;
- }
- }
-
- public void RemoveAt(int index)
- {
- lock (_methodLock)
- {
- EnsureNotDisposed();
- EnsureNotReadOnly();
-
- if (index < 0 || index >= _decryptedLength)
- {
- throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexString);
- }
-
- RemoveAtCore(index);
- }
- }
-
- public void SetAt(int index, char c)
- {
- lock (_methodLock)
- {
- if (index < 0 || index >= _decryptedLength)
- {
- throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexString);
- }
- Debug.Assert(index <= Int32.MaxValue / sizeof(char));
-
- EnsureNotDisposed();
- EnsureNotReadOnly();
-
- SetAtCore(index, c);
- }
- }
-
- private void EnsureNotReadOnly()
- {
- if (_readOnly)
- {
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- }
- }
-
- internal unsafe IntPtr MarshalToString(bool globalAlloc, bool unicode)
- {
- lock (_methodLock)
- {
- EnsureNotDisposed();
- return MarshalToStringCore(globalAlloc, unicode);
- }
- }
-
- private static void MarshalFree(IntPtr ptr, bool globalAlloc)
- {
- if (globalAlloc)
- {
- Marshal.FreeHGlobal(ptr);
- }
- else
- {
- Marshal.FreeCoTaskMem(ptr);
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Threading/ClrThreadPoolBoundHandle.cs b/src/mscorlib/corefx/System/Threading/ClrThreadPoolBoundHandle.cs
deleted file mode 100644
index d0cc5afbae..0000000000
--- a/src/mscorlib/corefx/System/Threading/ClrThreadPoolBoundHandle.cs
+++ /dev/null
@@ -1,319 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-namespace System.Threading
-{
- //
- // Implementation of ThreadPoolBoundHandle that sits on top of the CLR's ThreadPool and Overlapped infrastructure
- //
-
- /// <summary>
- /// Represents an I/O handle that is bound to the system thread pool and enables low-level
- /// components to receive notifications for asynchronous I/O operations.
- /// </summary>
- public sealed partial class ThreadPoolBoundHandle : IDisposable
- {
- private readonly SafeHandle _handle;
- private bool _isDisposed;
-
- private ThreadPoolBoundHandle(SafeHandle handle)
- {
- _handle = handle;
- }
-
- /// <summary>
- /// Gets the bound operating system handle.
- /// </summary>
- /// <value>
- /// A <see cref="SafeHandle"/> object that holds the bound operating system handle.
- /// </value>
- public SafeHandle Handle
- {
- get { return _handle; }
- }
-
- /// <summary>
- /// Returns a <see cref="ThreadPoolBoundHandle"/> for the specific handle,
- /// which is bound to the system thread pool.
- /// </summary>
- /// <param name="handle">
- /// A <see cref="SafeHandle"/> object that holds the operating system handle. The
- /// handle must have been opened for overlapped I/O on the unmanaged side.
- /// </param>
- /// <returns>
- /// <see cref="ThreadPoolBoundHandle"/> for <paramref name="handle"/>, which
- /// is bound to the system thread pool.
- /// </returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="handle"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="handle"/> has been disposed.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="handle"/> does not refer to a valid I/O handle.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="handle"/> refers to a handle that has not been opened
- /// for overlapped I/O.
- /// <para>
- /// -or-
- /// </para>
- /// <paramref name="handle"/> refers to a handle that has already been bound.
- /// </exception>
- /// <remarks>
- /// This method should be called once per handle.
- /// <para>
- /// -or-
- /// </para>
- /// <see cref="ThreadPoolBoundHandle"/> does not take ownership of <paramref name="handle"/>,
- /// it remains the responsibility of the caller to call <see cref="SafeHandle.Dispose"/>.
- /// </remarks>
- public static ThreadPoolBoundHandle BindHandle(SafeHandle handle)
- {
- if (handle == null)
- throw new ArgumentNullException(nameof(handle));
-
- if (handle.IsClosed || handle.IsInvalid)
- throw new ArgumentException(SR.Argument_InvalidHandle, nameof(handle));
-
- try
- {
- // ThreadPool.BindHandle will always return true, otherwise, it throws. See the underlying FCall
- // implementation in ThreadPoolNative::CorBindIoCompletionCallback to see the implementation.
- bool succeeded = ThreadPool.BindHandle(handle);
- Debug.Assert(succeeded);
- }
- catch (Exception ex)
- { // BindHandle throws ApplicationException on full CLR and Exception on CoreCLR.
- // We do not let either of these leak and convert them to ArgumentException to
- // indicate that the specified handles are invalid.
-
- if (ex.HResult == System.HResults.E_HANDLE) // Bad handle
- throw new ArgumentException(SR.Argument_InvalidHandle, nameof(handle));
-
- if (ex.HResult == System.HResults.E_INVALIDARG) // Handle already bound or sync handle
- throw new ArgumentException(SR.Argument_AlreadyBoundOrSyncHandle, nameof(handle));
-
- throw;
- }
-
- return new ThreadPoolBoundHandle(handle);
- }
-
- /// <summary>
- /// Returns an unmanaged pointer to a <see cref="NativeOverlapped"/> structure, specifying
- /// a delegate that is invoked when the asynchronous I/O operation is complete, a user-provided
- /// object providing context, and managed objects that serve as buffers.
- /// </summary>
- /// <param name="callback">
- /// An <see cref="IOCompletionCallback"/> delegate that represents the callback method
- /// invoked when the asynchronous I/O operation completes.
- /// </param>
- /// <param name="state">
- /// A user-provided object that distinguishes this <see cref="NativeOverlapped"/> from other
- /// <see cref="NativeOverlapped"/> instances. Can be <see langword="null"/>.
- /// </param>
- /// <param name="pinData">
- /// An object or array of objects representing the input or output buffer for the operation. Each
- /// object represents a buffer, for example an array of bytes. Can be <see langword="null"/>.
- /// </param>
- /// <returns>
- /// An unmanaged pointer to a <see cref="NativeOverlapped"/> structure.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The unmanaged pointer returned by this method can be passed to the operating system in
- /// overlapped I/O operations. The <see cref="NativeOverlapped"/> structure is fixed in
- /// physical memory until <see cref="FreeNativeOverlapped(NativeOverlapped*)"/> is called.
- /// </para>
- /// <para>
- /// The buffer or buffers specified in <paramref name="pinData"/> must be the same as those passed
- /// to the unmanaged operating system function that performs the asynchronous I/O.
- /// </para>
- /// <note>
- /// The buffers specified in <paramref name="pinData"/> are pinned for the duration of
- /// the I/O operation.
- /// </note>
- /// </remarks>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="callback"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// This method was called after the <see cref="ThreadPoolBoundHandle"/> was disposed.
- /// </exception>
- [CLSCompliant(false)]
- public unsafe NativeOverlapped* AllocateNativeOverlapped(IOCompletionCallback callback, object state, object pinData)
- {
- if (callback == null)
- throw new ArgumentNullException(nameof(callback));
-
- EnsureNotDisposed();
-
- ThreadPoolBoundHandleOverlapped overlapped = new ThreadPoolBoundHandleOverlapped(callback, state, pinData, preAllocated: null);
- overlapped._boundHandle = this;
- return overlapped._nativeOverlapped;
- }
-
- /// <summary>
- /// Returns an unmanaged pointer to a <see cref="NativeOverlapped"/> structure, using the callback,
- /// state, and buffers associated with the specified <see cref="PreAllocatedOverlapped"/> object.
- /// </summary>
- /// <param name="preAllocated">
- /// A <see cref="PreAllocatedOverlapped"/> object from which to create the NativeOverlapped pointer.
- /// </param>
- /// <returns>
- /// An unmanaged pointer to a <see cref="NativeOverlapped"/> structure.
- /// </returns>
- /// <remarks>
- /// <para>
- /// The unmanaged pointer returned by this method can be passed to the operating system in
- /// overlapped I/O operations. The <see cref="NativeOverlapped"/> structure is fixed in
- /// physical memory until <see cref="FreeNativeOverlapped(NativeOverlapped*)"/> is called.
- /// </para>
- /// </remarks>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="preAllocated"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ArgumentException">
- /// <paramref name="preAllocated"/> is currently in use for another I/O operation.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// This method was called after the <see cref="ThreadPoolBoundHandle"/> was disposed, or
- /// this method was called after <paramref name="preAllocated"/> was disposed.
- /// </exception>
- /// <seealso cref="PreAllocatedOverlapped"/>
- [CLSCompliant(false)]
- public unsafe NativeOverlapped* AllocateNativeOverlapped(PreAllocatedOverlapped preAllocated)
- {
- if (preAllocated == null)
- throw new ArgumentNullException(nameof(preAllocated));
-
- EnsureNotDisposed();
-
- preAllocated.AddRef();
- try
- {
- ThreadPoolBoundHandleOverlapped overlapped = preAllocated._overlapped;
-
- if (overlapped._boundHandle != null)
- throw new ArgumentException(SR.Argument_PreAllocatedAlreadyAllocated, nameof(preAllocated));
-
- overlapped._boundHandle = this;
-
- return overlapped._nativeOverlapped;
- }
- catch
- {
- preAllocated.Release();
- throw;
- }
- }
-
- /// <summary>
- /// Frees the unmanaged memory associated with a <see cref="NativeOverlapped"/> structure
- /// allocated by the <see cref="AllocateNativeOverlapped"/> method.
- /// </summary>
- /// <param name="overlapped">
- /// An unmanaged pointer to the <see cref="NativeOverlapped"/> structure to be freed.
- /// </param>
- /// <remarks>
- /// <note type="caution">
- /// You must call the <see cref="FreeNativeOverlapped(NativeOverlapped*)"/> method exactly once
- /// on every <see cref="NativeOverlapped"/> unmanaged pointer allocated using the
- /// <see cref="AllocateNativeOverlapped"/> method.
- /// If you do not call the <see cref="FreeNativeOverlapped(NativeOverlapped*)"/> method, you will
- /// leak memory. If you call the <see cref="FreeNativeOverlapped(NativeOverlapped*)"/> method more
- /// than once on the same <see cref="NativeOverlapped"/> unmanaged pointer, memory will be corrupted.
- /// </note>
- /// </remarks>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="overlapped"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// This method was called after the <see cref="ThreadPoolBoundHandle"/> was disposed.
- /// </exception>
- [CLSCompliant(false)]
- public unsafe void FreeNativeOverlapped(NativeOverlapped* overlapped)
- {
- if (overlapped == null)
- throw new ArgumentNullException(nameof(overlapped));
-
- // Note: we explicitly allow FreeNativeOverlapped calls after the ThreadPoolBoundHandle has been Disposed.
-
- ThreadPoolBoundHandleOverlapped wrapper = GetOverlappedWrapper(overlapped, this);
-
- if (wrapper._boundHandle != this)
- throw new ArgumentException(SR.Argument_NativeOverlappedWrongBoundHandle, nameof(overlapped));
-
- if (wrapper._preAllocated != null)
- wrapper._preAllocated.Release();
- else
- Overlapped.Free(overlapped);
- }
-
- /// <summary>
- /// Returns the user-provided object specified when the <see cref="NativeOverlapped"/> instance was
- /// allocated using the <see cref="AllocateNativeOverlapped(IOCompletionCallback, object, byte[])"/>.
- /// </summary>
- /// <param name="overlapped">
- /// An unmanaged pointer to the <see cref="NativeOverlapped"/> structure from which to return the
- /// asscociated user-provided object.
- /// </param>
- /// <returns>
- /// A user-provided object that distinguishes this <see cref="NativeOverlapped"/>
- /// from other <see cref="NativeOverlapped"/> instances, otherwise, <see langword="null"/> if one was
- /// not specified when the instance was allocated using <see cref="AllocateNativeOverlapped"/>.
- /// </returns>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="overlapped"/> is <see langword="null"/>.
- /// </exception>
- [CLSCompliant(false)]
- public unsafe static object GetNativeOverlappedState(NativeOverlapped* overlapped)
- {
- if (overlapped == null)
- throw new ArgumentNullException(nameof(overlapped));
-
- ThreadPoolBoundHandleOverlapped wrapper = GetOverlappedWrapper(overlapped, null);
- Debug.Assert(wrapper._boundHandle != null);
- return wrapper._userState;
- }
-
- private static unsafe ThreadPoolBoundHandleOverlapped GetOverlappedWrapper(NativeOverlapped* overlapped, ThreadPoolBoundHandle expectedBoundHandle)
- {
- ThreadPoolBoundHandleOverlapped wrapper;
- try
- {
- wrapper = (ThreadPoolBoundHandleOverlapped)Overlapped.Unpack(overlapped);
- }
- catch (NullReferenceException ex)
- {
- throw new ArgumentException(SR.Argument_NativeOverlappedAlreadyFree, nameof(overlapped), ex);
- }
-
- return wrapper;
- }
-
- public void Dispose()
- {
- // .NET Native's version of ThreadPoolBoundHandle that wraps the Win32 ThreadPool holds onto
- // native resources so it needs to be disposable. To match the contract, we are also disposable.
- // We also implement a disposable state to mimic behavior between this implementation and
- // .NET Native's version (code written against us, will also work against .NET Native's version).
- _isDisposed = true;
- }
-
-
- private void EnsureNotDisposed()
- {
- if (_isDisposed)
- throw new ObjectDisposedException(GetType().ToString());
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Threading/ClrThreadPoolBoundHandleOverlapped.cs b/src/mscorlib/corefx/System/Threading/ClrThreadPoolBoundHandleOverlapped.cs
deleted file mode 100644
index 1aea2a294b..0000000000
--- a/src/mscorlib/corefx/System/Threading/ClrThreadPoolBoundHandleOverlapped.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Threading
-{
- /// <summary>
- /// Overlapped subclass adding data needed by ThreadPoolBoundHandle.
- /// </summary>
- internal sealed class ThreadPoolBoundHandleOverlapped : Overlapped
- {
- private static readonly unsafe IOCompletionCallback s_completionCallback = CompletionCallback;
-
- private readonly IOCompletionCallback _userCallback;
- internal readonly object _userState;
- internal PreAllocatedOverlapped _preAllocated;
- internal unsafe NativeOverlapped* _nativeOverlapped;
- internal ThreadPoolBoundHandle _boundHandle;
- internal bool _completed;
-
- public unsafe ThreadPoolBoundHandleOverlapped(IOCompletionCallback callback, object state, object pinData, PreAllocatedOverlapped preAllocated)
- {
- _userCallback = callback;
- _userState = state;
- _preAllocated = preAllocated;
-
- _nativeOverlapped = Pack(s_completionCallback, pinData);
- _nativeOverlapped->OffsetLow = 0; // CLR reuses NativeOverlapped instances and does not reset these
- _nativeOverlapped->OffsetHigh = 0;
- }
-
- private unsafe static void CompletionCallback(uint errorCode, uint numBytes, NativeOverlapped* nativeOverlapped)
- {
- ThreadPoolBoundHandleOverlapped overlapped = (ThreadPoolBoundHandleOverlapped)Overlapped.Unpack(nativeOverlapped);
-
- //
- // The Win32 thread pool implementation of ThreadPoolBoundHandle does not permit reuse of NativeOverlapped
- // pointers without freeing them and allocating new a new one. We need to ensure that code using the CLR
- // ThreadPool implementation follows those rules.
- //
- if (overlapped._completed)
- throw new InvalidOperationException(SR.InvalidOperation_NativeOverlappedReused);
-
- overlapped._completed = true;
-
- if (overlapped._boundHandle == null)
- throw new InvalidOperationException(SR.Argument_NativeOverlappedAlreadyFree);
-
- overlapped._userCallback(errorCode, numBytes, nativeOverlapped);
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Threading/ClrThreadPoolPreAllocatedOverlapped.cs b/src/mscorlib/corefx/System/Threading/ClrThreadPoolPreAllocatedOverlapped.cs
deleted file mode 100644
index a42e0c7983..0000000000
--- a/src/mscorlib/corefx/System/Threading/ClrThreadPoolPreAllocatedOverlapped.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Threading
-{
- /// <summary>
- /// Represents pre-allocated state for native overlapped I/O operations.
- /// </summary>
- /// <seealso cref="ThreadPoolBoundHandle.AllocateNativeOverlapped(PreAllocatedOverlapped)"/>
- public sealed class PreAllocatedOverlapped : IDisposable, IDeferredDisposable
- {
- internal readonly ThreadPoolBoundHandleOverlapped _overlapped;
- private DeferredDisposableLifetime<PreAllocatedOverlapped> _lifetime;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PreAllocatedOverlapped"/> class, specifying
- /// a delegate that is invoked when each asynchronous I/O operation is complete, a user-provided
- /// object providing context, and managed objects that serve as buffers.
- /// </summary>
- /// <param name="callback">
- /// An <see cref="IOCompletionCallback"/> delegate that represents the callback method
- /// invoked when each asynchronous I/O operation completes.
- /// </param>
- /// <param name="state">
- /// A user-provided object that distinguishes <see cref="NativeOverlapped"/> instance produced from this
- /// object from other <see cref="NativeOverlapped"/> instances. Can be <see langword="null"/>.
- /// </param>
- /// <param name="pinData">
- /// An object or array of objects representing the input or output buffer for the operations. Each
- /// object represents a buffer, for example an array of bytes. Can be <see langword="null"/>.
- /// </param>
- /// <remarks>
- /// The new <see cref="PreAllocatedOverlapped"/> instance can be passed to
- /// <see cref="ThreadPoolBoundHandle.AllocateNativeOverlapped(PreAllocatedOverlapped)"/>, to produce
- /// a <see cref="NativeOverlapped"/> instance that can be passed to the operating system in overlapped
- /// I/O operations. A single <see cref="PreAllocatedOverlapped"/> instance can only be used for
- /// a single native I/O operation at a time. However, the state stored in the <see cref="PreAllocatedOverlapped"/>
- /// instance can be reused for subsequent native operations.
- /// <note>
- /// The buffers specified in <paramref name="pinData"/> are pinned until <see cref="Dispose"/> is called.
- /// </note>
- /// </remarks>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="callback"/> is <see langword="null"/>.
- /// </exception>
- /// <exception cref="ObjectDisposedException">
- /// This method was called after the <see cref="ThreadPoolBoundHandle"/> was disposed.
- /// </exception>
- [CLSCompliant(false)]
- public unsafe PreAllocatedOverlapped(IOCompletionCallback callback, object state, object pinData)
- {
- if (callback == null)
- throw new ArgumentNullException(nameof(callback));
-
- _overlapped = new ThreadPoolBoundHandleOverlapped(callback, state, pinData, this);
- }
-
- internal bool AddRef()
- {
- return _lifetime.AddRef(this);
- }
-
- internal void Release()
- {
- _lifetime.Release(this);
- }
-
- /// <summary>
- /// Frees the resources associated with this <see cref="PreAllocatedOverlapped"/> instance.
- /// </summary>
- public unsafe void Dispose()
- {
- _lifetime.Dispose(this);
- GC.SuppressFinalize(this);
- }
-
- ~PreAllocatedOverlapped()
- {
- //
- // During shutdown, don't automatically clean up, because this instance may still be
- // reachable/usable by other code.
- //
- if (!Environment.HasShutdownStarted)
- Dispose();
- }
-
- unsafe void IDeferredDisposable.OnFinalRelease(bool disposed)
- {
- if (_overlapped != null)
- {
- if (disposed)
- {
- Overlapped.Free(_overlapped._nativeOverlapped);
- }
- else
- {
- _overlapped._boundHandle = null;
- _overlapped._completed = false;
- *_overlapped._nativeOverlapped = default(NativeOverlapped);
- }
- }
- }
- }
-}
diff --git a/src/mscorlib/corefx/System/Threading/DeferredDisposableLifetime.cs b/src/mscorlib/corefx/System/Threading/DeferredDisposableLifetime.cs
deleted file mode 100644
index 89380fee60..0000000000
--- a/src/mscorlib/corefx/System/Threading/DeferredDisposableLifetime.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-
-namespace System.Threading
-{
- /// <summary>
- /// Provides callbacks to objects whose lifetime is managed by <see cref="DeferredDisposableLifetime{T}"/>.
- /// </summary>
- internal interface IDeferredDisposable
- {
- /// <summary>
- /// Called when the object's refcount reaches zero.
- /// </summary>
- /// <param name="disposed">
- /// Indicates whether the object has been disposed.
- /// </param>
- /// <remarks>
- /// If the refount reaches zero before the object is disposed, this method will be called with
- /// <paramref name="disposed"/> set to false. If the object is then disposed, this method will be
- /// called again, with <paramref name="disposed"/> set to true. If the refcount reaches zero
- /// after the object has already been disposed, this will be called a single time, with
- /// <paramref name="disposed"/> set to true.
- /// </remarks>
- void OnFinalRelease(bool disposed);
- }
-
- /// <summary>
- /// Manages the lifetime of an object which implements IDisposable, but which must defer the actual
- /// cleanup of state until all existing uses of the object are complete.
- /// </summary>
- /// <typeparam name="T">The type of object whose lifetime will be managed.</typeparam>
- /// <remarks>
- /// This type maintains a reference count, and tracks whether the object has been disposed. When
- /// Callbacks are made to <see cref="IDeferredDisposable.OnFinalRelease(bool)"/> when the refcount
- /// reaches zero. Objects that need to defer cleanup until they have been disposed *and* they have
- /// no more references can do so in <see cref="IDeferredDisposable.OnFinalRelease(bool)"/> when
- /// 'disposed' is true.
- /// </remarks>
- internal struct DeferredDisposableLifetime<T> where T : class, IDeferredDisposable
- {
- //
- // _count is positive until Dispose is called, after which it's (-1 - refcount).
- //
- private int _count;
-
- public bool AddRef(T obj)
- {
- while (true)
- {
- int oldCount = Volatile.Read(ref _count);
-
- // Have we been disposed?
- if (oldCount < 0)
- throw new ObjectDisposedException(typeof(T).ToString());
-
- int newCount = checked(oldCount + 1);
-
- if (Interlocked.CompareExchange(ref _count, newCount, oldCount) == oldCount)
- return true;
- }
- }
-
- public void Release(T obj)
- {
- while (true)
- {
- int oldCount = Volatile.Read(ref _count);
- if (oldCount > 0)
- {
- // We haven't been disposed. Decrement _count.
- int newCount = oldCount - 1;
- if (Interlocked.CompareExchange(ref _count, newCount, oldCount) == oldCount)
- {
- if (newCount == 0)
- obj.OnFinalRelease(disposed: false);
- return;
- }
- }
- else
- {
- Debug.Assert(oldCount != 0 && oldCount != -1);
-
- // We've been disposed. Increment _count.
- int newCount = oldCount + 1;
- if (Interlocked.CompareExchange(ref _count, newCount, oldCount) == oldCount)
- {
- if (newCount == -1)
- obj.OnFinalRelease(disposed: true);
- return;
- }
- }
- }
- }
-
- public void Dispose(T obj)
- {
- while (true)
- {
- int oldCount = Volatile.Read(ref _count);
- if (oldCount < 0)
- return; // already disposed
-
- int newCount = -1 - oldCount;
- if (Interlocked.CompareExchange(ref _count, newCount, oldCount) == oldCount)
- {
- if (newCount == -1)
- obj.OnFinalRelease(disposed: true);
- return;
- }
- }
- }
- }
-}