diff options
Diffstat (limited to 'src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs')
-rw-r--r-- | src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs b/src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs index 1116722fe9..997c5f2316 100644 --- a/src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs +++ b/src/mscorlib/corefx/System/Globalization/UmAlQuraCalendar.cs @@ -2,7 +2,7 @@ // 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.Contracts; namespace System.Globalization @@ -270,6 +270,14 @@ namespace System.Globalization } } + public override CalendarAlgorithmType AlgorithmType + { + get + { + return CalendarAlgorithmType.LunarCalendar; + } + } + public UmAlQuraCalendar() { } @@ -309,9 +317,9 @@ namespace System.Globalization =========================ConvertHijriToGregorian============================*/ private static void ConvertHijriToGregorian(int HijriYear, int HijriMonth, int HijriDay, ref int yg, ref int mg, ref int dg) { - Contract.Assert((HijriYear >= MinCalendarYear) && (HijriYear <= MaxCalendarYear), "Hijri year is out of range."); - Contract.Assert(HijriMonth >= 1, "Hijri month is out of range."); - Contract.Assert(HijriDay >= 1, "Hijri day is out of range."); + 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; @@ -368,7 +376,7 @@ namespace System.Globalization { if (era != CurrentEra && era != UmAlQuraEra) { - throw new ArgumentOutOfRangeException("era", SR.ArgumentOutOfRange_InvalidEraValue); + throw new ArgumentOutOfRangeException(nameof(era), SR.ArgumentOutOfRange_InvalidEraValue); } } @@ -378,7 +386,7 @@ namespace System.Globalization if (year < MinCalendarYear || year > MaxCalendarYear) { throw new ArgumentOutOfRangeException( - "year", + nameof(year), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Range, @@ -392,7 +400,7 @@ namespace System.Globalization CheckYearRange(year, era); if (month < 1 || month > 12) { - throw new ArgumentOutOfRangeException("month", SR.ArgumentOutOfRange_Month); + throw new ArgumentOutOfRangeException(nameof(month), SR.ArgumentOutOfRange_Month); } } @@ -409,7 +417,7 @@ namespace System.Globalization TimeSpan ts; int yh1 = 0, mh1 = 0, dh1 = 0; - Contract.Assert((time.Ticks >= minDate.Ticks) && (time.Ticks <= maxDate.Ticks), "Gregorian date is out of range."); + 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. @@ -510,7 +518,7 @@ namespace System.Globalization if (months < -120000 || months > 120000) { throw new ArgumentOutOfRangeException( - "months", + nameof(months), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Range, @@ -622,7 +630,7 @@ namespace System.Globalization { int days = 0, b; - Contract.Assert((year >= MinCalendarYear) && (year <= MaxCalendarYear), "Hijri year is out of range."); + Debug.Assert((year >= MinCalendarYear) && (year <= MaxCalendarYear), "Hijri year is out of range."); b = s_hijriYearInfo[year - MinCalendarYear].HijriMonthsLengthFlags; @@ -631,7 +639,7 @@ namespace System.Globalization days = days + 29 + (b & 1); /* Add the months lengths before mh */ b = b >> 1; } - Contract.Assert((days == 354) || (days == 355), "Hijri year has to be 354 or 355 days."); + Debug.Assert((days == 354) || (days == 355), "Hijri year has to be 354 or 355 days."); return days; } @@ -711,7 +719,7 @@ namespace System.Globalization if (day < 1 || day > daysInMonth) { throw new ArgumentOutOfRangeException( - "day", + nameof(day), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Day, @@ -775,7 +783,7 @@ namespace System.Globalization if (day < 1 || day > daysInMonth) { throw new ArgumentOutOfRangeException( - "day", + nameof(day), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Day, @@ -815,7 +823,7 @@ namespace System.Globalization if (value != 99 && (value < MinCalendarYear || value > MaxCalendarYear)) { throw new ArgumentOutOfRangeException( - "value", + nameof(value), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Range, @@ -835,7 +843,7 @@ namespace System.Globalization { if (year < 0) { - throw new ArgumentOutOfRangeException("year", + throw new ArgumentOutOfRangeException(nameof(year), SR.ArgumentOutOfRange_NeedNonNegNum); } Contract.EndContractBlock(); @@ -848,7 +856,7 @@ namespace System.Globalization if ((year < MinCalendarYear) || (year > MaxCalendarYear)) { throw new ArgumentOutOfRangeException( - "year", + nameof(year), String.Format( CultureInfo.CurrentCulture, SR.ArgumentOutOfRange_Range, |