using System;
using System.Runtime.InteropServices;
namespace System.Globalization
{
/// Represents the Gregorian calendar.
// Token: 0x02000186 RID: 390
[ComVisible(true)]
[MonoTODO("Serialization format not compatible with .NET")]
[Serializable]
public class GregorianCalendar : Calendar
{
/// Initializes a new instance of the class using the specified value.
/// The value that denotes which language version of the calendar to create.
// Token: 0x0600133A RID: 4922 RVA: 0x0004B188 File Offset: 0x00049388
public GregorianCalendar(GregorianCalendarTypes type)
{
this.CalendarType = type;
this.M_AbbrEraNames = new string[] { "AD" };
this.M_EraNames = new string[] { "A.D." };
if (this.twoDigitYearMax == 99)
{
this.twoDigitYearMax = 2029;
}
}
/// Initializes a new instance of the class using the default value.
// Token: 0x0600133B RID: 4923 RVA: 0x0004B1E4 File Offset: 0x000493E4
public GregorianCalendar()
: this(GregorianCalendarTypes.Localized)
{
}
/// Gets the list of eras in the .
/// An array of integers that represents the eras in the .
// Token: 0x1700034E RID: 846
// (get) Token: 0x0600133C RID: 4924 RVA: 0x0004B1F0 File Offset: 0x000493F0
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.
///
///
///
///
// Token: 0x1700034F RID: 847
// (get) Token: 0x0600133D RID: 4925 RVA: 0x0004B1FC File Offset: 0x000493FC
// (set) Token: 0x0600133E RID: 4926 RVA: 0x0004B204 File Offset: 0x00049404
public override int TwoDigitYearMax
{
get
{
return this.twoDigitYearMax;
}
set
{
base.CheckReadOnly();
base.M_ArgumentInRange("value", value, 100, this.M_MaxYear);
this.twoDigitYearMax = value;
}
}
/// Gets or sets the value that denotes the language version of the current .
/// A value that denotes the language version of the current .
// Token: 0x17000350 RID: 848
// (get) Token: 0x0600133F RID: 4927 RVA: 0x0004B234 File Offset: 0x00049434
// (set) Token: 0x06001340 RID: 4928 RVA: 0x0004B23C File Offset: 0x0004943C
public virtual GregorianCalendarTypes CalendarType
{
get
{
return this.m_type;
}
set
{
base.CheckReadOnly();
this.m_type = value;
}
}
// Token: 0x06001341 RID: 4929 RVA: 0x0004B24C File Offset: 0x0004944C
internal void M_CheckEra(ref int era)
{
if (era == 0)
{
era = 1;
}
if (era != 1)
{
throw new ArgumentException("Era value was not valid.");
}
}
// Token: 0x06001342 RID: 4930 RVA: 0x0004B26C File Offset: 0x0004946C
internal override void M_CheckYE(int year, ref int era)
{
this.M_CheckEra(ref era);
base.M_ArgumentInRange("year", year, 1, 9999);
}
// Token: 0x06001343 RID: 4931 RVA: 0x0004B294 File Offset: 0x00049494
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.");
}
}
// Token: 0x06001344 RID: 4932 RVA: 0x0004B2C0 File Offset: 0x000494C0
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 months.
/// The number of months to add.
/// The resulting is outside the supported range.
///
/// is less than -120000.-or- is greater than 120000.
// Token: 0x06001345 RID: 4933 RVA: 0x0004B2F0 File Offset: 0x000494F0
public override DateTime AddMonths(DateTime time, int months)
{
return CCGregorianCalendar.AddMonths(time, months);
}
/// 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 years.
/// The number of years to add.
/// The resulting is outside the supported range.
// Token: 0x06001346 RID: 4934 RVA: 0x0004B2FC File Offset: 0x000494FC
public override DateTime AddYears(DateTime time, int years)
{
return CCGregorianCalendar.AddYears(time, years);
}
/// Returns the day of the month in the specified .
/// An integer from 1 to 31 that represents the day of the month in .
/// The to read.
// Token: 0x06001347 RID: 4935 RVA: 0x0004B308 File Offset: 0x00049508
public override int GetDayOfMonth(DateTime time)
{
return CCGregorianCalendar.GetDayOfMonth(time);
}
/// Returns the day of the week in the specified .
/// A value that represents the day of the week in .
/// The to read.
// Token: 0x06001348 RID: 4936 RVA: 0x0004B310 File Offset: 0x00049510
public override DayOfWeek GetDayOfWeek(DateTime 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 366 that represents the day of the year in .
/// The to read.
// Token: 0x06001349 RID: 4937 RVA: 0x0004B32C File Offset: 0x0004952C
public override int GetDayOfYear(DateTime time)
{
return CCGregorianCalendar.GetDayOfYear(time);
}
/// 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 12 that represents the month.
/// An integer that represents the era.
///
/// is outside the range supported by the calendar.-or- is outside the range supported by the calendar.-or- is outside the range supported by the calendar.
// Token: 0x0600134A RID: 4938 RVA: 0x0004B334 File Offset: 0x00049534
public override int GetDaysInMonth(int year, int month, int era)
{
this.M_CheckYME(year, month, ref era);
return CCGregorianCalendar.GetDaysInMonth(year, month);
}
/// 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.
///
/// is outside the range supported by the calendar.-or- is outside the range supported by the calendar.
// Token: 0x0600134B RID: 4939 RVA: 0x0004B348 File Offset: 0x00049548
public override int GetDaysInYear(int year, int era)
{
this.M_CheckYE(year, ref era);
return CCGregorianCalendar.GetDaysInYear(year);
}
/// Returns the era in the specified .
/// An integer that represents the era in .
/// The to read.
// Token: 0x0600134C RID: 4940 RVA: 0x0004B35C File Offset: 0x0004955C
public override int GetEra(DateTime time)
{
return 1;
}
/// Calculates the leap month for a specified year and era.
/// Always 0 because the type does not recognize leap months.
/// A year.
/// An era. Specify either or GregorianCalendar.Eras[Calendar.CurrentEra].
///
/// is less than the Gregorian calendar year 1 or greater than the Gregorian calendar year 9999.-or- is not or GregorianCalendar.Eras[Calendar.CurrentEra].
// Token: 0x0600134D RID: 4941 RVA: 0x0004B360 File Offset: 0x00049560
[ComVisible(false)]
public override int GetLeapMonth(int year, int era)
{
return 0;
}
/// Returns the month in the specified .
/// An integer from 1 to 12 that represents the month in .
/// The to read.
// Token: 0x0600134E RID: 4942 RVA: 0x0004B364 File Offset: 0x00049564
public override int GetMonth(DateTime time)
{
return CCGregorianCalendar.GetMonth(time);
}
/// 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.
/// An integer that represents the year.
/// An integer that represents the era.
///
/// is outside the range supported by the calendar.-or- is outside the range supported by the calendar.
// Token: 0x0600134F RID: 4943 RVA: 0x0004B36C File Offset: 0x0004956C
public override int GetMonthsInYear(int year, int era)
{
this.M_CheckYE(year, ref era);
return 12;
}
/// Returns the week of the year that includes the date in the specified object.
/// A 1-based integer that represents the week of the year that includes the date in the parameter.
/// The object to read.
/// One of the values that defines a calendar week.
/// One of the values that represents the first day of the week.
///
/// is outside the range supported by the calendar.-or- is not a valid value.
// Token: 0x06001350 RID: 4944 RVA: 0x0004B37C File Offset: 0x0004957C
[ComVisible(false)]
public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
{
return base.GetWeekOfYear(time, rule, firstDayOfWeek);
}
/// Returns the year in the specified .
/// An integer that represents the year in .
/// The to read.
// Token: 0x06001351 RID: 4945 RVA: 0x0004B388 File Offset: 0x00049588
public override int GetYear(DateTime time)
{
return CCGregorianCalendar.GetYear(time);
}
/// 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 12 that represents the month.
/// An integer from 1 to 31 that represents the day.
/// An integer that represents the era.
///
/// is outside the range supported by the calendar. -or- is outside the range supported by the calendar.-or- is outside the range supported by the calendar.-or- is outside the range supported by the calendar.
// Token: 0x06001352 RID: 4946 RVA: 0x0004B390 File Offset: 0x00049590
public override bool IsLeapDay(int year, int month, int day, int era)
{
this.M_CheckYMDE(year, month, day, ref era);
return CCGregorianCalendar.IsLeapDay(year, month, day);
}
/// Determines whether the specified month in the specified year in the specified era is a leap month.
/// This method always returns false, unless overridden by a derived class.
/// An integer that represents the year.
/// An integer from 1 to 12 that represents the month.
/// An integer that represents the era.
///
/// is outside the range supported by the calendar.-or- is outside the range supported by the calendar.-or- is outside the range supported by the calendar.
// Token: 0x06001353 RID: 4947 RVA: 0x0004B3A8 File Offset: 0x000495A8
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.
/// An integer that represents the year.
/// An integer that represents the era.
///
/// is outside the range supported by the calendar.-or- is outside the range supported by the calendar.
// Token: 0x06001354 RID: 4948 RVA: 0x0004B3B8 File Offset: 0x000495B8
public override bool IsLeapYear(int year, int era)
{
this.M_CheckYE(year, ref era);
return CCGregorianCalendar.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 12 that represents the month.
/// An integer from 1 to 31 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.
///
/// is outside the range supported by the calendar.-or- is outside the range supported by the calendar.-or- is outside the range supported by the calendar.-or- is outside the range supported by the calendar.-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: 0x06001355 RID: 4949 RVA: 0x0004B3CC File Offset: 0x000495CC
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);
return CCGregorianCalendar.ToDateTime(year, month, day, hour, minute, second, millisecond);
}
/// Converts the specified year to a four-digit year by using the property to determine the appropriate century.
/// An integer that contains the four-digit representation of .
/// A two-digit or four-digit integer that represents the year to convert.
///
/// is outside the range supported by the calendar.
// Token: 0x06001356 RID: 4950 RVA: 0x0004B404 File Offset: 0x00049604
public override int ToFourDigitYear(int year)
{
return base.ToFourDigitYear(year);
}
/// Gets the earliest date and time supported by the type.
/// The earliest date and time supported by the type, which is the first moment of January 1, 0001 C.E. and is equivalent to .
// Token: 0x17000351 RID: 849
// (get) Token: 0x06001357 RID: 4951 RVA: 0x0004B410 File Offset: 0x00049610
[ComVisible(false)]
public override DateTime MinSupportedDateTime
{
get
{
DateTime? min = GregorianCalendar.Min;
if (min == null)
{
GregorianCalendar.Min = new DateTime?(new DateTime(1, 1, 1, 0, 0, 0));
}
return GregorianCalendar.Min.Value;
}
}
/// Gets the latest date and time supported by the type.
/// The latest date and time supported by the type, which is the last moment of December 31, 9999 C.E. and is equivalent to .
// Token: 0x17000352 RID: 850
// (get) Token: 0x06001358 RID: 4952 RVA: 0x0004B454 File Offset: 0x00049654
[ComVisible(false)]
public override DateTime MaxSupportedDateTime
{
get
{
DateTime? max = GregorianCalendar.Max;
if (max == null)
{
GregorianCalendar.Max = new DateTime?(new DateTime(9999, 12, 31, 11, 59, 59));
}
return GregorianCalendar.Max.Value;
}
}
/// Represents the current era. This field is constant.
// Token: 0x0400055A RID: 1370
public const int ADEra = 1;
// Token: 0x0400055B RID: 1371
[NonSerialized]
internal GregorianCalendarTypes m_type;
// Token: 0x0400055C RID: 1372
private static DateTime? Min;
// Token: 0x0400055D RID: 1373
private static DateTime? Max;
}
}