using System;
using System.Runtime.InteropServices;
namespace System.Globalization
{
/// Represents the Julian calendar.
// Token: 0x0200018F RID: 399
[MonoTODO("Serialization format not compatible with .NET")]
[ComVisible(true)]
[Serializable]
public class JulianCalendar : Calendar
{
/// Initializes a new instance of the class.
// Token: 0x060013DF RID: 5087 RVA: 0x0004D30C File Offset: 0x0004B50C
public JulianCalendar()
{
this.M_AbbrEraNames = new string[] { "C.E." };
this.M_EraNames = new string[] { "Common Era" };
if (this.twoDigitYearMax == 99)
{
this.twoDigitYearMax = 2029;
}
}
/// Gets the list of eras in the .
/// An array of integers that represents the eras in the .
// Token: 0x17000368 RID: 872
// (get) Token: 0x060013E1 RID: 5089 RVA: 0x0004D394 File Offset: 0x0004B594
public override int[] Eras
{
get
{
return new int[] { JulianCalendar.JulianEra };
}
}
/// 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: 0x17000369 RID: 873
// (get) Token: 0x060013E2 RID: 5090 RVA: 0x0004D3A4 File Offset: 0x0004B5A4
// (set) Token: 0x060013E3 RID: 5091 RVA: 0x0004D3AC File Offset: 0x0004B5AC
public override int TwoDigitYearMax
{
get
{
return this.twoDigitYearMax;
}
set
{
base.CheckReadOnly();
base.M_ArgumentInRange("value", value, 100, this.M_MaxYear);
this.twoDigitYearMax = value;
}
}
// Token: 0x060013E4 RID: 5092 RVA: 0x0004D3DC File Offset: 0x0004B5DC
internal void M_CheckEra(ref int era)
{
if (era == 0)
{
era = JulianCalendar.JulianEra;
}
if (era != JulianCalendar.JulianEra)
{
throw new ArgumentException("Era value was not valid.");
}
}
// Token: 0x060013E5 RID: 5093 RVA: 0x0004D404 File Offset: 0x0004B604
internal override void M_CheckYE(int year, ref int era)
{
this.M_CheckEra(ref era);
base.M_ArgumentInRange("year", year, 1, 9999);
}
// Token: 0x060013E6 RID: 5094 RVA: 0x0004D42C File Offset: 0x0004B62C
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: 0x060013E7 RID: 5095 RVA: 0x0004D458 File Offset: 0x0004B658
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));
if (year == 9999 && ((month == 10 && day > 19) || month > 10))
{
throw new ArgumentOutOfRangeException("The maximum Julian date is 19. 10. 9999.");
}
}
/// 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: 0x060013E8 RID: 5096 RVA: 0x0004D4B8 File Offset: 0x0004B6B8
public override DateTime AddMonths(DateTime time, int months)
{
int num = CCFixed.FromDateTime(time);
int num2;
int num3;
int num4;
CCJulianCalendar.dmy_from_fixed(out num2, out num3, out num4, num);
num3 += months;
num4 += CCMath.div_mod(out num3, num3, 12);
num = CCJulianCalendar.fixed_from_dmy(num2, num3, num4);
return CCFixed.ToDateTime(num).Add(time.TimeOfDay);
}
/// 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: 0x060013E9 RID: 5097 RVA: 0x0004D508 File Offset: 0x0004B708
public override DateTime AddYears(DateTime time, int years)
{
int num = CCFixed.FromDateTime(time);
int num2;
int num3;
int num4;
CCJulianCalendar.dmy_from_fixed(out num2, out num3, out num4, num);
num4 += years;
num = CCJulianCalendar.fixed_from_dmy(num2, num3, num4);
return CCFixed.ToDateTime(num).Add(time.TimeOfDay);
}
/// 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: 0x060013EA RID: 5098 RVA: 0x0004D54C File Offset: 0x0004B74C
public override int GetDayOfMonth(DateTime time)
{
int num = CCFixed.FromDateTime(time);
return CCJulianCalendar.day_from_fixed(num);
}
/// Returns the day of the week in the specified .
/// A value that represents the day of the week in .
/// The to read.
// Token: 0x060013EB RID: 5099 RVA: 0x0004D568 File Offset: 0x0004B768
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: 0x060013EC RID: 5100 RVA: 0x0004D584 File Offset: 0x0004B784
public override int GetDayOfYear(DateTime time)
{
int num = CCFixed.FromDateTime(time);
int num2 = CCJulianCalendar.year_from_fixed(num);
int num3 = CCJulianCalendar.fixed_from_dmy(1, 1, num2);
return num - num3 + 1;
}
/// 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: 0x060013ED RID: 5101 RVA: 0x0004D5B0 File Offset: 0x0004B7B0
public override int GetDaysInMonth(int year, int month, int era)
{
this.M_CheckYME(year, month, ref era);
int num = CCJulianCalendar.fixed_from_dmy(1, month, year);
int num2 = CCJulianCalendar.fixed_from_dmy(1, month + 1, year);
return num2 - num;
}
/// 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: 0x060013EE RID: 5102 RVA: 0x0004D5E0 File Offset: 0x0004B7E0
public override int GetDaysInYear(int year, int era)
{
this.M_CheckYE(year, ref era);
int num = CCJulianCalendar.fixed_from_dmy(1, 1, year);
int num2 = CCJulianCalendar.fixed_from_dmy(1, 1, year + 1);
return num2 - num;
}
/// Returns the era in the specified .
/// An integer that represents the era in .
/// The to read.
// Token: 0x060013EF RID: 5103 RVA: 0x0004D610 File Offset: 0x0004B810
public override int GetEra(DateTime time)
{
return JulianCalendar.JulianEra;
}
/// Calculates the leap month for a specified year and era.
/// A positive integer that indicates the leap month in the specified year and era. Alternatively, this method returns zero if the calendar does not support a leap month, or if and do not specify a leap year.
/// An integer that represents the year.
/// An integer that represents the era.
// Token: 0x060013F0 RID: 5104 RVA: 0x0004D618 File Offset: 0x0004B818
[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: 0x060013F1 RID: 5105 RVA: 0x0004D61C File Offset: 0x0004B81C
public override int GetMonth(DateTime time)
{
int num = CCFixed.FromDateTime(time);
return CCJulianCalendar.month_from_fixed(num);
}
/// 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: 0x060013F2 RID: 5106 RVA: 0x0004D638 File Offset: 0x0004B838
public override int GetMonthsInYear(int year, int era)
{
this.M_CheckYE(year, ref era);
return 12;
}
/// Returns the year in the specified .
/// An integer that represents the year in .
/// The to read.
// Token: 0x060013F3 RID: 5107 RVA: 0x0004D648 File Offset: 0x0004B848
public override int GetYear(DateTime time)
{
int num = CCFixed.FromDateTime(time);
return CCJulianCalendar.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 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: 0x060013F4 RID: 5108 RVA: 0x0004D664 File Offset: 0x0004B864
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 == 2 && day == 29;
}
/// 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: 0x060013F5 RID: 5109 RVA: 0x0004D698 File Offset: 0x0004B898
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: 0x060013F6 RID: 5110 RVA: 0x0004D6A8 File Offset: 0x0004B8A8
public override bool IsLeapYear(int year, int era)
{
this.M_CheckYE(year, ref era);
return CCJulianCalendar.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 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. -or- is outside the range supported by the calendar.
// Token: 0x060013F7 RID: 5111 RVA: 0x0004D6BC File Offset: 0x0004B8BC
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 = CCJulianCalendar.fixed_from_dmy(day, month, year);
return CCFixed.ToDateTime(num, hour, minute, second, (double)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: 0x060013F8 RID: 5112 RVA: 0x0004D6FC File Offset: 0x0004B8FC
public override int ToFourDigitYear(int year)
{
return base.ToFourDigitYear(year);
}
/// Gets a value that indicates whether the current calendar is solar-based, lunar-based, or a combination of both.
/// Always returns the type.
// Token: 0x1700036A RID: 874
// (get) Token: 0x060013F9 RID: 5113 RVA: 0x0004D708 File Offset: 0x0004B908
[ComVisible(false)]
public override CalendarAlgorithmType AlgorithmType
{
get
{
return CalendarAlgorithmType.SolarCalendar;
}
}
/// Gets the earliest date and time supported by the class.
/// The earliest date and time supported by the class, which is equivalent to the first moment of January 1, 0001 C.E. in the Gregorian calendar.
// Token: 0x1700036B RID: 875
// (get) Token: 0x060013FA RID: 5114 RVA: 0x0004D70C File Offset: 0x0004B90C
[ComVisible(false)]
public override DateTime MinSupportedDateTime
{
get
{
return JulianCalendar.JulianMin;
}
}
/// Gets the latest date and time supported by the class.
/// The latest date and time supported by the class, which is equivalent to the last moment of December 31, 9999 C.E. in the Gregorian calendar.
// Token: 0x1700036C RID: 876
// (get) Token: 0x060013FB RID: 5115 RVA: 0x0004D714 File Offset: 0x0004B914
[ComVisible(false)]
public override DateTime MaxSupportedDateTime
{
get
{
return JulianCalendar.JulianMax;
}
}
/// Represents the current era. This field is constant.
// Token: 0x04000583 RID: 1411
public static readonly int JulianEra = 1;
// Token: 0x04000584 RID: 1412
private static DateTime JulianMin = new DateTime(1, 1, 1, 0, 0, 0);
// Token: 0x04000585 RID: 1413
private static DateTime JulianMax = new DateTime(9999, 12, 31, 11, 59, 59);
}
}