using System; using System.IO; namespace System.Globalization { /// Represents the Saudi Hijri (Um Al Qura) calendar. // Token: 0x0200019D RID: 413 [MonoTODO("Serialization format not compatible with .NET")] [Serializable] public class UmAlQuraCalendar : Calendar { /// Initializes a new instance of the class. // Token: 0x0600150C RID: 5388 RVA: 0x00050E04 File Offset: 0x0004F004 public UmAlQuraCalendar() { this.M_AbbrEraNames = new string[] { "A.H." }; this.M_EraNames = new string[] { "Anno Hegirae" }; if (this.twoDigitYearMax == 99) { this.twoDigitYearMax = 1451; } } /// Gets a list of the eras that are supported by the current . /// An array that consists of a single element having a value that is . // Token: 0x170003BE RID: 958 // (get) Token: 0x0600150E RID: 5390 RVA: 0x00050EB4 File Offset: 0x0004F0B4 public override int[] Eras { get { return new int[] { 1 }; } } /// Gets or sets the last year of a 100-year range that can be represented by a 2-digit year. /// The last year of a 100-year range that can be represented by a 2-digit year. /// This calendar is read-only. /// In a set operation, the Um Al Qura calendar year value is less than 1318 but not 99, or is greater than 1450. /// /// /// /// // Token: 0x170003BF RID: 959 // (get) Token: 0x0600150F RID: 5391 RVA: 0x00050EC0 File Offset: 0x0004F0C0 // (set) Token: 0x06001510 RID: 5392 RVA: 0x00050EC8 File Offset: 0x0004F0C8 public override int TwoDigitYearMax { get { return this.twoDigitYearMax; } set { base.CheckReadOnly(); base.M_ArgumentInRange("value", value, 100, this.M_MaxYear); this.twoDigitYearMax = value; } } // Token: 0x170003C0 RID: 960 // (get) Token: 0x06001511 RID: 5393 RVA: 0x00050EF8 File Offset: 0x0004F0F8 // (set) Token: 0x06001512 RID: 5394 RVA: 0x00050F00 File Offset: 0x0004F100 internal virtual int AddHijriDate { get { return this.M_AddHijriDate; } set { base.CheckReadOnly(); if (value < -3 && value > 3) { throw new ArgumentOutOfRangeException("AddHijriDate", "Value should be between -3 and 3."); } this.M_AddHijriDate = value; } } // Token: 0x06001513 RID: 5395 RVA: 0x00050F3C File Offset: 0x0004F13C internal void M_CheckFixedHijri(string param, int rdHijri) { if (rdHijri < UmAlQuraCalendar.M_MinFixed || rdHijri > UmAlQuraCalendar.M_MaxFixed - this.AddHijriDate) { StringWriter stringWriter = new StringWriter(); int num; int num2; int num3; CCHijriCalendar.dmy_from_fixed(out num, out num2, out num3, UmAlQuraCalendar.M_MaxFixed - this.AddHijriDate); if (this.AddHijriDate != 0) { stringWriter.Write("This HijriCalendar (AddHijriDate {0}) allows dates from 1. 1. 1 to {1}. {2}. {3}.", new object[] { this.AddHijriDate, num, num2, num3 }); } else { stringWriter.Write("HijriCalendar allows dates from 1.1.1 to {0}.{1}.{2}.", num, num2, num3); } throw new ArgumentOutOfRangeException(param, stringWriter.ToString()); } } // Token: 0x06001514 RID: 5396 RVA: 0x00050FF8 File Offset: 0x0004F1F8 internal void M_CheckDateTime(DateTime time) { int num = CCFixed.FromDateTime(time) - this.AddHijriDate; this.M_CheckFixedHijri("time", num); } // Token: 0x06001515 RID: 5397 RVA: 0x00051020 File Offset: 0x0004F220 internal int M_FromDateTime(DateTime time) { return CCFixed.FromDateTime(time) - this.AddHijriDate; } // Token: 0x06001516 RID: 5398 RVA: 0x00051030 File Offset: 0x0004F230 internal DateTime M_ToDateTime(int rd) { return CCFixed.ToDateTime(rd + this.AddHijriDate); } // Token: 0x06001517 RID: 5399 RVA: 0x00051040 File Offset: 0x0004F240 internal DateTime M_ToDateTime(int date, int hour, int minute, int second, int milliseconds) { return CCFixed.ToDateTime(date + this.AddHijriDate, hour, minute, second, (double)milliseconds); } // Token: 0x06001518 RID: 5400 RVA: 0x00051058 File Offset: 0x0004F258 internal void M_CheckEra(ref int era) { if (era == 0) { era = 1; } if (era != 1) { throw new ArgumentException("Era value was not valid."); } } // Token: 0x06001519 RID: 5401 RVA: 0x00051078 File Offset: 0x0004F278 internal override void M_CheckYE(int year, ref int era) { this.M_CheckEra(ref era); base.M_ArgumentInRange("year", year, 1, 9666); } // Token: 0x0600151A RID: 5402 RVA: 0x000510A0 File Offset: 0x0004F2A0 internal void M_CheckYME(int year, int month, ref int era) { this.M_CheckYE(year, ref era); if (month < 1 || month > 12) { throw new ArgumentOutOfRangeException("month", "Month must be between one and twelve."); } if (year == 9666) { int num = CCHijriCalendar.fixed_from_dmy(1, month, year); this.M_CheckFixedHijri("month", num); } } // Token: 0x0600151B RID: 5403 RVA: 0x000510F4 File Offset: 0x0004F2F4 internal void M_CheckYMDE(int year, int month, int day, ref int era) { this.M_CheckYME(year, month, ref era); base.M_ArgumentInRange("day", day, 1, this.GetDaysInMonth(year, month, 1)); if (year == 9666) { int num = CCHijriCalendar.fixed_from_dmy(day, month, year); this.M_CheckFixedHijri("day", num); } } /// Calculates a date that is a specified number of months away from a specified initial date. /// A that represents the date yielded by adding the number of months specified by the parameter to the date specified by the parameter. /// The to which to add months. The class supports only dates from 04/30/1900 00.00.00 (Gregorian date) through 05/13/2029 23:59:59 (Gregorian date). /// The positive or negative number of months to add. /// The resulting date is outside the range supported by the class. /// /// is less than -120,000 or greater than 120,000. -or- is outside the range supported by this calendar. // Token: 0x0600151C RID: 5404 RVA: 0x00051144 File Offset: 0x0004F344 public override DateTime AddMonths(DateTime time, int months) { int num = this.M_FromDateTime(time); int num2; int num3; int num4; CCHijriCalendar.dmy_from_fixed(out num2, out num3, out num4, num); num3 += months; num4 += CCMath.div_mod(out num3, num3, 12); num = CCHijriCalendar.fixed_from_dmy(num2, num3, num4); this.M_CheckFixedHijri("time", num); return this.M_ToDateTime(num).Add(time.TimeOfDay); } /// Calculates a date that is a specified number of years away from a specified initial date. /// A that represents the date yielded by adding the number of years specified by the parameter to the date specified by the parameter. /// The to which to add years. The class supports only dates from 04/30/1900 00.00.00 (Gregorian date) through 05/13/2029 23:59:59 (Gregorian date). /// The positive or negative number of years to add. /// The resulting date is outside the range supported by the class. /// /// is less than -10,000 or greater than 10,000. -or- is outside the range supported by this calendar. // Token: 0x0600151D RID: 5405 RVA: 0x000511A4 File Offset: 0x0004F3A4 public override DateTime AddYears(DateTime time, int years) { int num = this.M_FromDateTime(time); int num2; int num3; int num4; CCHijriCalendar.dmy_from_fixed(out num2, out num3, out num4, num); num4 += years; num = CCHijriCalendar.fixed_from_dmy(num2, num3, num4); this.M_CheckFixedHijri("time", num); return this.M_ToDateTime(num).Add(time.TimeOfDay); } /// Calculates on which day of the month a specified date occurs. /// An integer from 1 through 30 that represents the day of the month specified by the parameter. /// The to read. The class supports only dates from 04/30/1900 00.00.00 (Gregorian date) through 05/13/2029 23:59:59 (Gregorian date). /// /// is outside the range supported by this calendar. // Token: 0x0600151E RID: 5406 RVA: 0x000511F8 File Offset: 0x0004F3F8 public override int GetDayOfMonth(DateTime time) { int num = this.M_FromDateTime(time); this.M_CheckFixedHijri("time", num); return CCHijriCalendar.day_from_fixed(num); } /// Calculates on which day of the week a specified date occurs. /// A value that represents the day of the week specified by the parameter. /// The to read. The class supports only dates from 04/30/1900 00.00.00 (Gregorian date) through 05/13/2029 23:59:59 (Gregorian date). /// /// is outside the range supported by this calendar. // Token: 0x0600151F RID: 5407 RVA: 0x00051220 File Offset: 0x0004F420 public override DayOfWeek GetDayOfWeek(DateTime time) { int num = this.M_FromDateTime(time); this.M_CheckFixedHijri("time", num); return CCFixed.day_of_week(num); } /// Calculates on which day of the year a specified date occurs. /// An integer from 1 through 355 that represents the day of the year specified by the parameter. /// The to read. The class supports only dates from 04/30/1900 00.00.00 (Gregorian date) through 05/13/2029 23:59:59 (Gregorian date). /// /// is outside the range supported by this calendar. // Token: 0x06001520 RID: 5408 RVA: 0x00051248 File Offset: 0x0004F448 public override int GetDayOfYear(DateTime time) { int num = this.M_FromDateTime(time); this.M_CheckFixedHijri("time", num); int num2 = CCHijriCalendar.year_from_fixed(num); int num3 = CCHijriCalendar.fixed_from_dmy(1, 1, num2); return num - num3 + 1; } /// Calculates the number of days in the specified month of the specified year and era. /// The number of days in the specified month in the specified year and era. The return value is 29 in a common year and 30 in a leap year. /// A year. /// An integer from 1 through 12 that represents a month. /// An era. Specify UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra] or . /// /// , , or is outside the range supported by the class. // Token: 0x06001521 RID: 5409 RVA: 0x00051280 File Offset: 0x0004F480 public override int GetDaysInMonth(int year, int month, int era) { this.M_CheckYME(year, month, ref era); int num = CCHijriCalendar.fixed_from_dmy(1, month, year); int num2 = CCHijriCalendar.fixed_from_dmy(1, month + 1, year); return num2 - num; } /// Calculates the number of days in the specified year of the specified era. /// The number of days in the specified year and era. The number of days is 354 in a common year or 355 in a leap year. /// A year. /// An era. Specify UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra] or . /// /// or is outside the range supported by the class. // Token: 0x06001522 RID: 5410 RVA: 0x000512B0 File Offset: 0x0004F4B0 public override int GetDaysInYear(int year, int era) { this.M_CheckYE(year, ref era); int num = CCHijriCalendar.fixed_from_dmy(1, 1, year); int num2 = CCHijriCalendar.fixed_from_dmy(1, 1, year + 1); return num2 - num; } /// Calculates in which era a specified date occurs. /// Always returns the value. /// The to read. The class supports only dates from 04/30/1900 00.00.00 (Gregorian date) through 05/13/2029 23:59:59 (Gregorian date). /// /// is outside the range supported by this calendar. // Token: 0x06001523 RID: 5411 RVA: 0x000512E0 File Offset: 0x0004F4E0 public override int GetEra(DateTime time) { this.M_CheckDateTime(time); return 1; } /// Calculates the leap month for a specified year and era. /// Always 0 because the class does not support leap months. /// A year. /// An era. Specify UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra] or . /// /// is less than 1318 or greater than 1450.-or- is not UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra] or . // Token: 0x06001524 RID: 5412 RVA: 0x000512EC File Offset: 0x0004F4EC public override int GetLeapMonth(int year, int era) { return 0; } /// Calculates the month in which a specified date occurs. /// An integer from 1 through 12 that represents the month in the date specified by the parameter. /// The to read. The class supports only dates from 04/30/1900 00.00.00 (Gregorian date) through 05/13/2029 23:59:59 (Gregorian date). /// /// is outside the range supported by this calendar. // Token: 0x06001525 RID: 5413 RVA: 0x000512F0 File Offset: 0x0004F4F0 public override int GetMonth(DateTime time) { int num = this.M_FromDateTime(time); this.M_CheckFixedHijri("time", num); return CCHijriCalendar.month_from_fixed(num); } /// Calculates the number of months in the specified year of the specified era. /// The return value is always 12. /// A year. /// An era. Specify UmAlQuaraCalendar.Eras[UmAlQuraCalendar.CurrentEra] or . /// /// is outside the range supported by this calendar. /// /// is outside the range supported by this calendar. // Token: 0x06001526 RID: 5414 RVA: 0x00051318 File Offset: 0x0004F518 public override int GetMonthsInYear(int year, int era) { this.M_CheckYE(year, ref era); return 12; } /// Calculates the year of a date represented by a specified . /// An integer that represents the year specified by the parameter. /// The to read. The class supports only dates from 04/30/1900 00.00.00 (Gregorian date) through 05/13/2029 23:59:59 (Gregorian date). /// /// is outside the range supported by this calendar. // Token: 0x06001527 RID: 5415 RVA: 0x00051328 File Offset: 0x0004F528 public override int GetYear(DateTime time) { int num = this.M_FromDateTime(time); this.M_CheckFixedHijri("time", num); return CCHijriCalendar.year_from_fixed(num); } /// Determines whether the specified date is a leap day. /// true if the specified day is a leap day; otherwise, false. The return value is always false because the class does not support the notion of a leap day. /// A year. /// An integer from 1 through 12 that represents a month. /// An integer from 1 through 30 that represents a day. /// An era. Specify UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra] or . /// /// , , , or is outside the range supported by the class. // Token: 0x06001528 RID: 5416 RVA: 0x00051350 File Offset: 0x0004F550 public override bool IsLeapDay(int year, int month, int day, int era) { this.M_CheckYMDE(year, month, day, ref era); return this.IsLeapYear(year) && month == 12 && day == 30; } /// Determines whether the specified month in the specified year and era is a leap month. /// Always false because the class does not support leap months. /// A year. /// An integer from 1 through 12 that represents a month. /// An era. Specify UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra] or . /// /// , , or is outside the range supported by the class. // Token: 0x06001529 RID: 5417 RVA: 0x0005137C File Offset: 0x0004F57C public override bool IsLeapMonth(int year, int month, int era) { this.M_CheckYME(year, month, ref era); return false; } /// Determines whether the specified year in the specified era is a leap year. /// true if the specified year is a leap year; otherwise, false. /// A year. /// An era. Specify UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra] or . /// /// or is outside the range supported by the class. // Token: 0x0600152A RID: 5418 RVA: 0x0005138C File Offset: 0x0004F58C public override bool IsLeapYear(int year, int era) { this.M_CheckYE(year, ref era); return CCHijriCalendar.is_leap_year(year); } /// Returns a that is set to the specified date, time, and era. /// The that is set to the specified date and time in the current era. /// A year. /// An integer from 1 through 12 that represents a month. /// An integer from 1 through 29 that represents a day. /// An integer from 0 through 23 that represents an hour. /// An integer from 0 through 59 that represents a minute. /// An integer from 0 through 59 that represents a second. /// An integer from 0 through 999 that represents a millisecond. /// An era. Specify UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra] or . /// /// , , , or is outside the range supported by the class.-or- is less than zero or greater than 23.-or- is less than zero or greater than 59.-or- is less than zero or greater than 59.-or- is less than zero or greater than 999. // Token: 0x0600152B RID: 5419 RVA: 0x000513A0 File Offset: 0x0004F5A0 public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { this.M_CheckYMDE(year, month, day, ref era); base.M_CheckHMSM(hour, minute, second, millisecond); int num = CCHijriCalendar.fixed_from_dmy(day, month, year); return this.M_ToDateTime(num, hour, minute, second, millisecond); } /// Converts the specified year to a four-digit year by using the property to determine the appropriate century. /// If the parameter is a 2-digit year, the return value is the corresponding 4-digit year. If the parameter is a 4-digit year, the return value is the unchanged parameter. /// A 2-digit year from 0 through 99, or a 4-digit Um Al Qura calendar year from 1318 through 1450. /// /// is outside the range supported by this calendar. // Token: 0x0600152C RID: 5420 RVA: 0x000513E0 File Offset: 0x0004F5E0 public override int ToFourDigitYear(int year) { return base.ToFourDigitYear(year); } /// Gets the earliest date and time supported by this calendar. /// The earliest date and time supported by the class, which is equivalent to the first moment of April 30, 1900 C.E. in the Gregorian calendar. // Token: 0x170003C1 RID: 961 // (get) Token: 0x0600152D RID: 5421 RVA: 0x000513EC File Offset: 0x0004F5EC public override DateTime MinSupportedDateTime { get { return UmAlQuraCalendar.Min; } } /// Gets the latest date and time supported by this calendar. /// The latest date and time supported by the class, which is equivalent to the last moment of May 13, 2029 C.E. in the Gregorian calendar. // Token: 0x170003C2 RID: 962 // (get) Token: 0x0600152E RID: 5422 RVA: 0x000513F4 File Offset: 0x0004F5F4 public override DateTime MaxSupportedDateTime { get { return UmAlQuraCalendar.Max; } } /// Represents the current era. This field is constant. // Token: 0x040005F8 RID: 1528 public const int UmAlQuraEra = 1; // Token: 0x040005F9 RID: 1529 internal static readonly int M_MinFixed = CCHijriCalendar.fixed_from_dmy(1, 1, 1); // Token: 0x040005FA RID: 1530 internal static readonly int M_MaxFixed = CCGregorianCalendar.fixed_from_dmy(31, 12, 9999); // Token: 0x040005FB RID: 1531 internal int M_AddHijriDate; // Token: 0x040005FC RID: 1532 private static DateTime Min = new DateTime(622, 7, 18, 0, 0, 0); // Token: 0x040005FD RID: 1533 private static DateTime Max = new DateTime(9999, 12, 31, 11, 59, 59); } }