using System;
using System.IO;
using System.Runtime.InteropServices;
namespace System.Globalization
{
/// Represents the Hebrew calendar.
// Token: 0x02000188 RID: 392
[MonoTODO("Serialization format not compatible with.NET")]
[ComVisible(true)]
[Serializable]
public class HebrewCalendar : Calendar
{
/// Initializes a new instance of the class.
// Token: 0x06001359 RID: 4953 RVA: 0x0004B4A0 File Offset: 0x000496A0
public HebrewCalendar()
{
this.M_AbbrEraNames = new string[] { "A.M." };
this.M_EraNames = new string[] { "Anno Mundi" };
if (this.twoDigitYearMax == 99)
{
this.twoDigitYearMax = 5790;
}
}
// Token: 0x17000353 RID: 851
// (get) Token: 0x0600135B RID: 4955 RVA: 0x0004B52C File Offset: 0x0004972C
internal override int M_MaxYear
{
get
{
return 6000;
}
}
/// Gets the list of eras in the .
/// An array of integers that represents the eras in the type. The return value is always an array containing one element equal to .
// Token: 0x17000354 RID: 852
// (get) Token: 0x0600135C RID: 4956 RVA: 0x0004B534 File Offset: 0x00049734
public override int[] Eras
{
get
{
return new int[] { HebrewCalendar.HebrewEra };
}
}
/// 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.
/// The current object is read-only.
/// In a set operation, the Hebrew calendar year value is less than 5343 but is not 99, or the year value is greater than 5999.
///
///
///
///
// Token: 0x17000355 RID: 853
// (get) Token: 0x0600135D RID: 4957 RVA: 0x0004B544 File Offset: 0x00049744
// (set) Token: 0x0600135E RID: 4958 RVA: 0x0004B54C File Offset: 0x0004974C
public override int TwoDigitYearMax
{
get
{
return this.twoDigitYearMax;
}
set
{
base.CheckReadOnly();
base.M_ArgumentInRange("value", value, 5343, this.M_MaxYear);
this.twoDigitYearMax = value;
}
}
// Token: 0x0600135F RID: 4959 RVA: 0x0004B580 File Offset: 0x00049780
internal void M_CheckDateTime(DateTime time)
{
if (time.Ticks < 499147488000000000L || time.Ticks > 706783967999999999L)
{
throw new ArgumentOutOfRangeException("time", "Only hebrew years between 5343 and 6000, inclusive, are supported.");
}
}
// Token: 0x06001360 RID: 4960 RVA: 0x0004B5C8 File Offset: 0x000497C8
internal void M_CheckEra(ref int era)
{
if (era == 0)
{
era = HebrewCalendar.HebrewEra;
}
if (era != HebrewCalendar.HebrewEra)
{
throw new ArgumentException("Era value was not valid.");
}
}
// Token: 0x06001361 RID: 4961 RVA: 0x0004B5F0 File Offset: 0x000497F0
internal override void M_CheckYE(int year, ref int era)
{
this.M_CheckEra(ref era);
if (year < 5343 || year > this.M_MaxYear)
{
throw new ArgumentOutOfRangeException("year", "Only hebrew years between 5343 and 6000, inclusive, are supported.");
}
}
// Token: 0x06001362 RID: 4962 RVA: 0x0004B62C File Offset: 0x0004982C
internal void M_CheckYME(int year, int month, ref int era)
{
this.M_CheckYE(year, ref era);
int num = CCHebrewCalendar.last_month_of_year(year);
if (month < 1 || month > num)
{
StringWriter stringWriter = new StringWriter();
stringWriter.Write("Month must be between 1 and {0}.", num);
throw new ArgumentOutOfRangeException("month", stringWriter.ToString());
}
}
// Token: 0x06001363 RID: 4963 RVA: 0x0004B680 File Offset: 0x00049880
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, era));
}
/// Returns a that is the specified number of months away from the specified .
/// The that results from adding the specified number of months to the specified .
/// The to which to add .
/// The number of months to add.
/// The resulting is outside the supported range.
///
/// is less than -120,000 or greater than 120,000.
// Token: 0x06001364 RID: 4964 RVA: 0x0004B6B0 File Offset: 0x000498B0
public override DateTime AddMonths(DateTime time, int months)
{
DateTime dateTime;
if (months == 0)
{
dateTime = time;
}
else
{
int num = CCFixed.FromDateTime(time);
int num2;
int num3;
int num4;
CCHebrewCalendar.dmy_from_fixed(out num2, out num3, out num4, num);
num3 = this.M_Month(num3, num4);
if (months < 0)
{
while (months < 0)
{
if (num3 + months > 0)
{
num3 += months;
months = 0;
}
else
{
months += num3;
num4--;
num3 = this.GetMonthsInYear(num4);
}
}
}
else
{
while (months > 0)
{
int monthsInYear = this.GetMonthsInYear(num4);
if (num3 + months <= monthsInYear)
{
num3 += months;
months = 0;
}
else
{
months -= monthsInYear - num3 + 1;
num3 = 1;
num4++;
}
}
}
dateTime = this.ToDateTime(num4, num3, num2, 0, 0, 0, 0).Add(time.TimeOfDay);
}
this.M_CheckDateTime(dateTime);
return dateTime;
}
/// Returns a that is the specified number of years away from the specified .
/// The that results from adding the specified number of years to the specified .
/// The to which to add .
/// The number of years to add.
/// The resulting is outside the supported range.
// Token: 0x06001365 RID: 4965 RVA: 0x0004B788 File Offset: 0x00049988
public override DateTime AddYears(DateTime time, int years)
{
int num = CCFixed.FromDateTime(time);
int num2;
int num3;
int num4;
CCHebrewCalendar.dmy_from_fixed(out num2, out num3, out num4, num);
num4 += years;
num = CCHebrewCalendar.fixed_from_dmy(num2, num3, num4);
DateTime dateTime = CCFixed.ToDateTime(num).Add(time.TimeOfDay);
this.M_CheckDateTime(dateTime);
return dateTime;
}
/// Returns the day of the month in the specified .
/// An integer from 1 to 30 that represents the day of the month in the specified .
/// The to read.
// Token: 0x06001366 RID: 4966 RVA: 0x0004B7D8 File Offset: 0x000499D8
public override int GetDayOfMonth(DateTime time)
{
this.M_CheckDateTime(time);
int num = CCFixed.FromDateTime(time);
return CCHebrewCalendar.day_from_fixed(num);
}
/// Returns the day of the week in the specified .
/// A value that represents the day of the week in the specified .
/// The to read.
// Token: 0x06001367 RID: 4967 RVA: 0x0004B7FC File Offset: 0x000499FC
public override DayOfWeek GetDayOfWeek(DateTime time)
{
this.M_CheckDateTime(time);
int num = CCFixed.FromDateTime(time);
return CCFixed.day_of_week(num);
}
/// Returns the day of the year in the specified .
/// An integer from 1 to 385 that represents the day of the year in the specified .
/// The to read.
///
/// is earlier than September 17, 1583 in the Gregorian calendar, or greater than .
// Token: 0x06001368 RID: 4968 RVA: 0x0004B820 File Offset: 0x00049A20
public override int GetDayOfYear(DateTime time)
{
this.M_CheckDateTime(time);
int num = CCFixed.FromDateTime(time);
int num2 = CCHebrewCalendar.year_from_fixed(num);
int num3 = CCHebrewCalendar.fixed_from_dmy(1, 7, num2);
return num - num3 + 1;
}
// Token: 0x06001369 RID: 4969 RVA: 0x0004B850 File Offset: 0x00049A50
internal int M_CCMonth(int month, int year)
{
if (month <= 6)
{
return 6 + month;
}
int num = CCHebrewCalendar.last_month_of_year(year);
if (num == 12)
{
return month - 6;
}
return (month > 7) ? (month - 7) : (6 + month);
}
// Token: 0x0600136A RID: 4970 RVA: 0x0004B890 File Offset: 0x00049A90
internal int M_Month(int ccmonth, int year)
{
if (ccmonth >= 7)
{
return ccmonth - 6;
}
int num = CCHebrewCalendar.last_month_of_year(year);
return ccmonth + ((num != 12) ? 7 : 6);
}
/// Returns the number of days in the specified month in the specified year in the specified era.
/// The number of days in the specified month in the specified year in the specified era.
/// An integer that represents the year.
/// An integer from 1 to 13 that represents the month.
/// An integer that represents the era. Specify either or .
///
/// , , or is outside the range supported by the current object.
// Token: 0x0600136B RID: 4971 RVA: 0x0004B8C0 File Offset: 0x00049AC0
public override int GetDaysInMonth(int year, int month, int era)
{
this.M_CheckYME(year, month, ref era);
int num = this.M_CCMonth(month, year);
return CCHebrewCalendar.last_day_of_month(num, year);
}
/// Returns the number of days in the specified year in the specified era.
/// The number of days in the specified year in the specified era.
/// An integer that represents the year.
/// An integer that represents the era. Specify either or .
///
/// or is outside the range supported by the current object.
// Token: 0x0600136C RID: 4972 RVA: 0x0004B8E8 File Offset: 0x00049AE8
public override int GetDaysInYear(int year, int era)
{
this.M_CheckYE(year, ref era);
int num = CCHebrewCalendar.fixed_from_dmy(1, 7, year);
int num2 = CCHebrewCalendar.fixed_from_dmy(1, 7, year + 1);
return num2 - num;
}
/// Returns the era in the specified .
/// An integer that represents the era in the specified . The return value is always .
/// The to read.
// Token: 0x0600136D RID: 4973 RVA: 0x0004B918 File Offset: 0x00049B18
public override int GetEra(DateTime time)
{
this.M_CheckDateTime(time);
return HebrewCalendar.HebrewEra;
}
/// Calculates the leap month for a specified year and era.
/// A positive integer that indicates the leap month in the specified year and era. The return value is 7 if the and parameters specify a leap year, or 0 if the year is not a leap year.
/// A year.
/// An era. Specify either or .
///
/// is not or .-or- is less than the Hebrew calendar year 5343 or greater than the Hebrew calendar year 5999.
// Token: 0x0600136E RID: 4974 RVA: 0x0004B928 File Offset: 0x00049B28
public override int GetLeapMonth(int year, int era)
{
return (!this.IsLeapMonth(year, 7, era)) ? 0 : 7;
}
/// Returns the month in the specified .
/// An integer from 1 to 13 that represents the month in the specified .
/// The to read.
///
/// is less than or greater than .
// Token: 0x0600136F RID: 4975 RVA: 0x0004B940 File Offset: 0x00049B40
public override int GetMonth(DateTime time)
{
this.M_CheckDateTime(time);
int num = CCFixed.FromDateTime(time);
int num2;
int num3;
CCHebrewCalendar.my_from_fixed(out num2, out num3, num);
return this.M_Month(num2, num3);
}
/// Returns the number of months in the specified year in the specified era.
/// The number of months in the specified year in the specified era. The return value is either 12 in a common year, or 13 in a leap year.
/// An integer that represents the year.
/// An integer that represents the era. Specify either or .
///
/// or is outside the range supported by the current object.
// Token: 0x06001370 RID: 4976 RVA: 0x0004B970 File Offset: 0x00049B70
public override int GetMonthsInYear(int year, int era)
{
this.M_CheckYE(year, ref era);
return CCHebrewCalendar.last_month_of_year(year);
}
/// Returns the year in the specified value.
/// An integer that represents the year in the specified value.
/// The to read.
///
/// is outside the range supported by the current object.
// Token: 0x06001371 RID: 4977 RVA: 0x0004B984 File Offset: 0x00049B84
public override int GetYear(DateTime time)
{
this.M_CheckDateTime(time);
int num = CCFixed.FromDateTime(time);
return CCHebrewCalendar.year_from_fixed(num);
}
/// Determines whether the specified date in the specified era is a leap day.
/// true if the specified day is a leap day; otherwise, false.
/// An integer that represents the year.
/// An integer from 1 to 13 that represents the month.
/// An integer from 1 to 30 that represents the day.
/// An integer that represents the era. Specify either or .
///
/// , , , or is outside the range supported by this calendar.
// Token: 0x06001372 RID: 4978 RVA: 0x0004B9A8 File Offset: 0x00049BA8
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 == 7 || (month == 6 && day == 30));
}
/// Determines whether the specified month in the specified year in the specified era is a leap month.
/// true if the specified month is a leap month; otherwise, false.
/// An integer that represents the year.
/// An integer from 1 to 13 that represents the month.
/// An integer that represents the era. Specify either or .
///
/// , , or is outside the range supported by this calendar.
// Token: 0x06001373 RID: 4979 RVA: 0x0004B9E8 File Offset: 0x00049BE8
public override bool IsLeapMonth(int year, int month, int era)
{
this.M_CheckYME(year, month, ref era);
return this.IsLeapYear(year) && month == 7;
}
/// Determines whether the specified year in the specified era is a leap year.
/// true if the specified year is a leap year; otherwise, false.
/// An integer that represents the year.
/// An integer that represents the era. Specify either or .
///
/// or is outside the range supported by this calendar.
// Token: 0x06001374 RID: 4980 RVA: 0x0004BA08 File Offset: 0x00049C08
public override bool IsLeapYear(int year, int era)
{
this.M_CheckYE(year, ref era);
return CCHebrewCalendar.is_leap_year(year);
}
/// Returns a that is set to the specified date and time in the specified era.
/// The that is set to the specified date and time in the current era.
/// An integer that represents the year.
/// An integer from 1 to 13 that represents the month.
/// An integer from 1 to 30 that represents the day.
/// An integer from 0 to 23 that represents the hour.
/// An integer from 0 to 59 that represents the minute.
/// An integer from 0 to 59 that represents the second.
/// An integer from 0 to 999 that represents the millisecond.
/// An integer that represents the era. Specify either or .
///
/// , , or is outside the range supported by the current object.-or- is less than 0 or greater than 23.-or- is less than 0 or greater than 59.-or- is less than 0 or greater than 59.-or- is less than 0 or greater than 999.
// Token: 0x06001375 RID: 4981 RVA: 0x0004BA1C File Offset: 0x00049C1C
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 = this.M_CCMonth(month, year);
int num2 = CCHebrewCalendar.fixed_from_dmy(day, num, year);
return CCFixed.ToDateTime(num2, hour, minute, second, (double)millisecond);
}
/// Converts the specified year to a 4-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 Hebrew calendar year from 5343 through 5999.
///
/// is less than 0.-or- is less than or greater than .
// Token: 0x06001376 RID: 4982 RVA: 0x0004BA64 File Offset: 0x00049C64
public override int ToFourDigitYear(int year)
{
base.M_ArgumentInRange("year", year, 0, this.M_MaxYear - 1);
int num = this.twoDigitYearMax % 100;
int num2 = this.twoDigitYearMax - num;
if (year >= 100)
{
return year;
}
if (year <= num)
{
return num2 + year;
}
return num2 + year - 100;
}
/// Gets the earliest date and time supported by the type.
/// The earliest date and time supported by the type, which is equivalent to the first moment of January, 1, 1583 C.E. in the Gregorian calendar.
// Token: 0x17000356 RID: 854
// (get) Token: 0x06001377 RID: 4983 RVA: 0x0004BAB4 File Offset: 0x00049CB4
public override DateTime MinSupportedDateTime
{
get
{
return HebrewCalendar.Min;
}
}
/// Gets the latest date and time supported by the type.
/// The latest date and time supported by the type, which is equivalent to the last moment of September, 29, 2239 C.E. in the Gregorian calendar.
// Token: 0x17000357 RID: 855
// (get) Token: 0x06001378 RID: 4984 RVA: 0x0004BABC File Offset: 0x00049CBC
public override DateTime MaxSupportedDateTime
{
get
{
return HebrewCalendar.Max;
}
}
// Token: 0x04000565 RID: 1381
internal const long M_MinTicks = 499147488000000000L;
// Token: 0x04000566 RID: 1382
internal const long M_MaxTicks = 706783967999999999L;
// Token: 0x04000567 RID: 1383
internal const int M_MinYear = 5343;
/// Represents the current era. This field is constant.
// Token: 0x04000568 RID: 1384
public static readonly int HebrewEra = 1;
// Token: 0x04000569 RID: 1385
private static DateTime Min = new DateTime(1583, 1, 1, 0, 0, 0);
// Token: 0x0400056A RID: 1386
private static DateTime Max = new DateTime(2239, 9, 29, 11, 59, 59);
}
}