Files
2026-06-04 11:42:34 +02:00

376 lines
20 KiB
C#

using System;
using System.Runtime.InteropServices;
namespace System.Globalization
{
/// <summary>Represents the Korean calendar.</summary>
// Token: 0x02000190 RID: 400
[MonoTODO("Serialization format not compatible with .NET")]
[ComVisible(true)]
[Serializable]
public class KoreanCalendar : Calendar
{
/// <summary>Initializes a new instance of the <see cref="T:System.Globalization.KoreanCalendar" /> class.</summary>
// Token: 0x060013FC RID: 5116 RVA: 0x0004D71C File Offset: 0x0004B91C
public KoreanCalendar()
{
this.M_AbbrEraNames = new string[] { "K.C.E." };
this.M_EraNames = new string[] { "Korean Current Era" };
if (this.twoDigitYearMax == 99)
{
this.twoDigitYearMax = 4362;
}
}
// Token: 0x060013FD RID: 5117 RVA: 0x0004D770 File Offset: 0x0004B970
static KoreanCalendar()
{
KoreanCalendar.M_EraHandler.appendEra(1, CCGregorianCalendar.fixed_from_dmy(1, 1, -2332));
}
/// <summary>Gets the list of eras in the <see cref="T:System.Globalization.KoreanCalendar" />.</summary>
/// <returns>An array of integers that represents the eras in the <see cref="T:System.Globalization.KoreanCalendar" />.</returns>
// Token: 0x1700036D RID: 877
// (get) Token: 0x060013FE RID: 5118 RVA: 0x0004D7C8 File Offset: 0x0004B9C8
public override int[] Eras
{
get
{
return (int[])KoreanCalendar.M_EraHandler.Eras.Clone();
}
}
/// <summary>Gets or sets the last year of a 100-year range that can be represented by a 2-digit year.</summary>
/// <returns>The last year of a 100-year range that can be represented by a 2-digit year.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.RegistryPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x1700036E RID: 878
// (get) Token: 0x060013FF RID: 5119 RVA: 0x0004D7E0 File Offset: 0x0004B9E0
// (set) Token: 0x06001400 RID: 5120 RVA: 0x0004D7E8 File Offset: 0x0004B9E8
public override int TwoDigitYearMax
{
get
{
return this.twoDigitYearMax;
}
set
{
base.CheckReadOnly();
base.M_ArgumentInRange("value", value, 100, this.M_MaxYear);
this.twoDigitYearMax = value;
}
}
// Token: 0x06001401 RID: 5121 RVA: 0x0004D818 File Offset: 0x0004BA18
internal void M_CheckEra(ref int era)
{
if (era == 0)
{
era = 1;
}
if (!KoreanCalendar.M_EraHandler.ValidEra(era))
{
throw new ArgumentException("Era value was not valid.");
}
}
// Token: 0x06001402 RID: 5122 RVA: 0x0004D84C File Offset: 0x0004BA4C
internal int M_CheckYEG(int year, ref int era)
{
this.M_CheckEra(ref era);
return KoreanCalendar.M_EraHandler.GregorianYear(year, era);
}
// Token: 0x06001403 RID: 5123 RVA: 0x0004D864 File Offset: 0x0004BA64
internal override void M_CheckYE(int year, ref int era)
{
this.M_CheckYEG(year, ref era);
}
// Token: 0x06001404 RID: 5124 RVA: 0x0004D870 File Offset: 0x0004BA70
internal int M_CheckYMEG(int year, int month, ref int era)
{
int num = this.M_CheckYEG(year, ref era);
if (month < 1 || month > 12)
{
throw new ArgumentOutOfRangeException("month", "Month must be between one and twelve.");
}
return num;
}
// Token: 0x06001405 RID: 5125 RVA: 0x0004D8A8 File Offset: 0x0004BAA8
internal int M_CheckYMDEG(int year, int month, int day, ref int era)
{
int num = this.M_CheckYMEG(year, month, ref era);
base.M_ArgumentInRange("day", day, 1, this.GetDaysInMonth(year, month, era));
return num;
}
/// <summary>Returns a <see cref="T:System.DateTime" /> that is the specified number of months away from the specified <see cref="T:System.DateTime" />.</summary>
/// <returns>The <see cref="T:System.DateTime" /> that results from adding the specified number of months to the specified <see cref="T:System.DateTime" />.</returns>
/// <param name="time">The <see cref="T:System.DateTime" /> to which to add months. </param>
/// <param name="months">The number of months to add. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="months" /> is less than -120000.-or- <paramref name="months" /> is greater than 120000. </exception>
// Token: 0x06001406 RID: 5126 RVA: 0x0004D8DC File Offset: 0x0004BADC
public override DateTime AddMonths(DateTime time, int months)
{
return CCGregorianCalendar.AddMonths(time, months);
}
/// <summary>Returns a <see cref="T:System.DateTime" /> that is the specified number of years away from the specified <see cref="T:System.DateTime" />.</summary>
/// <returns>The <see cref="T:System.DateTime" /> that results from adding the specified number of years to the specified <see cref="T:System.DateTime" />.</returns>
/// <param name="time">The <see cref="T:System.DateTime" /> to which to add years. </param>
/// <param name="years">The number of years to add. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="years" /> or <paramref name="time" /> is out of range.</exception>
// Token: 0x06001407 RID: 5127 RVA: 0x0004D8E8 File Offset: 0x0004BAE8
public override DateTime AddYears(DateTime time, int years)
{
return CCGregorianCalendar.AddYears(time, years);
}
/// <summary>Returns the day of the month in the specified <see cref="T:System.DateTime" />.</summary>
/// <returns>An integer from 1 to 31 that represents the day of the month in the specified <see cref="T:System.DateTime" />.</returns>
/// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
// Token: 0x06001408 RID: 5128 RVA: 0x0004D8F4 File Offset: 0x0004BAF4
public override int GetDayOfMonth(DateTime time)
{
return CCGregorianCalendar.GetDayOfMonth(time);
}
/// <summary>Returns the day of the week in the specified <see cref="T:System.DateTime" />.</summary>
/// <returns>A <see cref="T:System.DayOfWeek" /> value that represents the day of the week in the specified <see cref="T:System.DateTime" />.</returns>
/// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
// Token: 0x06001409 RID: 5129 RVA: 0x0004D8FC File Offset: 0x0004BAFC
public override DayOfWeek GetDayOfWeek(DateTime time)
{
int num = CCFixed.FromDateTime(time);
return CCFixed.day_of_week(num);
}
/// <summary>Returns the day of the year in the specified <see cref="T:System.DateTime" />.</summary>
/// <returns>An integer from 1 to 366 that represents the day of the year in the specified <see cref="T:System.DateTime" />.</returns>
/// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
// Token: 0x0600140A RID: 5130 RVA: 0x0004D918 File Offset: 0x0004BB18
public override int GetDayOfYear(DateTime time)
{
return CCGregorianCalendar.GetDayOfYear(time);
}
/// <summary>Returns the number of days in the specified month in the specified year in the specified era.</summary>
/// <returns>The number of days in the specified month in the specified year in the specified era.</returns>
/// <param name="year">An integer that represents the year. </param>
/// <param name="month">An integer from 1 to 12 that represents the month. </param>
/// <param name="era">An integer that represents the era. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="year" /> is outside the range supported by the calendar.-or- <paramref name="month" /> is outside the range supported by the calendar.-or- <paramref name="era" /> is outside the range supported by the calendar. </exception>
// Token: 0x0600140B RID: 5131 RVA: 0x0004D920 File Offset: 0x0004BB20
public override int GetDaysInMonth(int year, int month, int era)
{
int num = this.M_CheckYMEG(year, month, ref era);
return CCGregorianCalendar.GetDaysInMonth(num, month);
}
/// <summary>Returns the number of days in the specified year in the specified era.</summary>
/// <returns>The number of days in the specified year in the specified era.</returns>
/// <param name="year">An integer that represents the year. </param>
/// <param name="era">An integer that represents the era. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="year" /> is outside the range supported by the calendar.-or- <paramref name="era" /> is outside the range supported by the calendar. </exception>
// Token: 0x0600140C RID: 5132 RVA: 0x0004D940 File Offset: 0x0004BB40
public override int GetDaysInYear(int year, int era)
{
int num = this.M_CheckYEG(year, ref era);
return CCGregorianCalendar.GetDaysInYear(num);
}
/// <summary>Returns the era in the specified <see cref="T:System.DateTime" />.</summary>
/// <returns>An integer that represents the era in the specified <see cref="T:System.DateTime" />.</returns>
/// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
// Token: 0x0600140D RID: 5133 RVA: 0x0004D960 File Offset: 0x0004BB60
public override int GetEra(DateTime time)
{
int num = CCFixed.FromDateTime(time);
int num2;
KoreanCalendar.M_EraHandler.EraYear(out num2, num);
return num2;
}
/// <summary>Calculates the leap month for a specified year and era.</summary>
/// <returns>The return value is always 0 because the <see cref="T:System.Globalization.KoreanCalendar" /> class does not support the notion of a leap month.</returns>
/// <param name="year">A year.</param>
/// <param name="era">An era.</param>
// Token: 0x0600140E RID: 5134 RVA: 0x0004D984 File Offset: 0x0004BB84
[ComVisible(false)]
public override int GetLeapMonth(int year, int era)
{
return 0;
}
/// <summary>Returns the month in the specified <see cref="T:System.DateTime" />.</summary>
/// <returns>An integer from 1 to 12 that represents the month in the specified <see cref="T:System.DateTime" />.</returns>
/// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
// Token: 0x0600140F RID: 5135 RVA: 0x0004D988 File Offset: 0x0004BB88
public override int GetMonth(DateTime time)
{
return CCGregorianCalendar.GetMonth(time);
}
/// <summary>Returns the number of months in the specified year in the specified era.</summary>
/// <returns>The number of months in the specified year in the specified era.</returns>
/// <param name="year">An integer that represents the year. </param>
/// <param name="era">An integer that represents the era. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="year" /> is outside the range supported by the calendar.-or- <paramref name="era" /> is outside the range supported by the calendar. </exception>
// Token: 0x06001410 RID: 5136 RVA: 0x0004D990 File Offset: 0x0004BB90
public override int GetMonthsInYear(int year, int era)
{
this.M_CheckYEG(year, ref era);
return 12;
}
/// <summary>Returns the week of the year that includes the date in the specified <see cref="T:System.DateTime" />.</summary>
/// <returns>A 1-based integer that represents the week of the year that includes the date in the <paramref name="time" /> parameter.</returns>
/// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
/// <param name="rule">One of the <see cref="T:System.Globalization.CalendarWeekRule" /> values that defines a calendar week. </param>
/// <param name="firstDayOfWeek">One of the <see cref="T:System.DayOfWeek" /> values that represents the first day of the week. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="time" /> or <paramref name="firstDayOfWeek" /> is outside the range supported by the calendar.-or- <paramref name="rule" /> is not a valid <see cref="T:System.Globalization.CalendarWeekRule" /> value. </exception>
// Token: 0x06001411 RID: 5137 RVA: 0x0004D9A0 File Offset: 0x0004BBA0
[ComVisible(false)]
public override int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
{
return base.GetWeekOfYear(time, rule, firstDayOfWeek);
}
/// <summary>Returns the year in the specified <see cref="T:System.DateTime" />.</summary>
/// <returns>An integer that represents the year in the specified <see cref="T:System.DateTime" />.</returns>
/// <param name="time">The <see cref="T:System.DateTime" /> to read. </param>
// Token: 0x06001412 RID: 5138 RVA: 0x0004D9AC File Offset: 0x0004BBAC
public override int GetYear(DateTime time)
{
int num = CCFixed.FromDateTime(time);
int num2;
return KoreanCalendar.M_EraHandler.EraYear(out num2, num);
}
/// <summary>Determines whether the specified date in the specified era is a leap day.</summary>
/// <returns>true if the specified day is a leap day; otherwise, false.</returns>
/// <param name="year">An integer that represents the year. </param>
/// <param name="month">An integer from 1 to 12 that represents the month. </param>
/// <param name="day">An integer from 1 to 31 that represents the day. </param>
/// <param name="era">An integer that represents the era. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="year" /> is outside the range supported by the calendar.-or- <paramref name="month" /> is outside the range supported by the calendar.-or- <paramref name="day" /> is outside the range supported by the calendar.-or- <paramref name="era" /> is outside the range supported by the calendar. </exception>
// Token: 0x06001413 RID: 5139 RVA: 0x0004D9D0 File Offset: 0x0004BBD0
public override bool IsLeapDay(int year, int month, int day, int era)
{
int num = this.M_CheckYMDEG(year, month, day, ref era);
return CCGregorianCalendar.IsLeapDay(num, month, day);
}
/// <summary>Determines whether the specified month in the specified year in the specified era is a leap month.</summary>
/// <returns>This method always returns false, unless overridden by a derived class.</returns>
/// <param name="year">An integer that represents the year. </param>
/// <param name="month">An integer from 1 to 12 that represents the month. </param>
/// <param name="era">An integer that represents the era. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="year" /> is outside the range supported by the calendar.-or- <paramref name="month" /> is outside the range supported by the calendar.-or- <paramref name="era" /> is outside the range supported by the calendar. </exception>
// Token: 0x06001414 RID: 5140 RVA: 0x0004D9F4 File Offset: 0x0004BBF4
public override bool IsLeapMonth(int year, int month, int era)
{
this.M_CheckYMEG(year, month, ref era);
return false;
}
/// <summary>Determines whether the specified year in the specified era is a leap year.</summary>
/// <returns>true if the specified year is a leap year; otherwise, false.</returns>
/// <param name="year">An integer that represents the year. </param>
/// <param name="era">An integer that represents the era. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="year" /> is outside the range supported by the calendar.-or- <paramref name="era" /> is outside the range supported by the calendar. </exception>
// Token: 0x06001415 RID: 5141 RVA: 0x0004DA04 File Offset: 0x0004BC04
public override bool IsLeapYear(int year, int era)
{
int num = this.M_CheckYEG(year, ref era);
return CCGregorianCalendar.is_leap_year(num);
}
/// <summary>Returns a <see cref="T:System.DateTime" /> that is set to the specified date and time in the specified era.</summary>
/// <returns>The <see cref="T:System.DateTime" /> that is set to the specified date and time in the current era.</returns>
/// <param name="year">An integer that represents the year. </param>
/// <param name="month">An integer from 1 to 12 that represents the month. </param>
/// <param name="day">An integer from 1 to 31 that represents the day. </param>
/// <param name="hour">An integer from 0 to 23 that represents the hour. </param>
/// <param name="minute">An integer from 0 to 59 that represents the minute. </param>
/// <param name="second">An integer from 0 to 59 that represents the second. </param>
/// <param name="millisecond">An integer from 0 to 999 that represents the millisecond. </param>
/// <param name="era">An integer that represents the era. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="year" /> is outside the range supported by the calendar.-or- <paramref name="month" /> is outside the range supported by the calendar.-or- <paramref name="day" /> is outside the range supported by the calendar.-or- <paramref name="hour" /> is less than zero or greater than 23.-or- <paramref name="minute" /> is less than zero or greater than 59.-or- <paramref name="second" /> is less than zero or greater than 59.-or- <paramref name="millisecond" /> is less than zero or greater than 999.-or- <paramref name="era" /> is outside the range supported by the calendar. </exception>
// Token: 0x06001416 RID: 5142 RVA: 0x0004DA24 File Offset: 0x0004BC24
public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
{
int num = this.M_CheckYMDEG(year, month, day, ref era);
base.M_CheckHMSM(hour, minute, second, millisecond);
return CCGregorianCalendar.ToDateTime(num, month, day, hour, minute, second, millisecond);
}
/// <summary>Converts the specified year to a four-digit year by using the <see cref="P:System.Globalization.KoreanCalendar.TwoDigitYearMax" /> property to determine the appropriate century.</summary>
/// <returns>An integer that contains the four-digit representation of <paramref name="year" />.</returns>
/// <param name="year">A two-digit or four-digit integer that represents the year to convert. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="year" /> is outside the range supported by the calendar. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.RegistryPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="\" />
/// </PermissionSet>
// Token: 0x06001417 RID: 5143 RVA: 0x0004DA5C File Offset: 0x0004BC5C
public override int ToFourDigitYear(int year)
{
return base.ToFourDigitYear(year);
}
/// <summary>Gets the earliest date and time supported by the <see cref="T:System.Globalization.KoreanCalendar" /> class.</summary>
/// <returns>The earliest date and time supported by the <see cref="T:System.Globalization.KoreanCalendar" /> class, which is equivalent to the first moment of January 1, 0001 C.E. in the Gregorian calendar.</returns>
// Token: 0x1700036F RID: 879
// (get) Token: 0x06001418 RID: 5144 RVA: 0x0004DA68 File Offset: 0x0004BC68
[ComVisible(false)]
public override DateTime MinSupportedDateTime
{
get
{
return KoreanCalendar.KoreanMin;
}
}
/// <summary>Gets the latest date and time supported by the <see cref="T:System.Globalization.KoreanCalendar" /> class.</summary>
/// <returns>The latest date and time supported by the <see cref="T:System.Globalization.KoreanCalendar" /> class, which is equivalent to the last moment of December 31, 9999 C.E. in the Gregorian calendar.</returns>
// Token: 0x17000370 RID: 880
// (get) Token: 0x06001419 RID: 5145 RVA: 0x0004DA70 File Offset: 0x0004BC70
[ComVisible(false)]
public override DateTime MaxSupportedDateTime
{
get
{
return KoreanCalendar.KoreanMax;
}
}
/// <summary>Represents the current era. This field is constant.</summary>
// Token: 0x04000586 RID: 1414
public const int KoreanEra = 1;
// Token: 0x04000587 RID: 1415
internal static readonly CCGregorianEraHandler M_EraHandler = new CCGregorianEraHandler();
// Token: 0x04000588 RID: 1416
private static DateTime KoreanMin = new DateTime(1, 1, 1, 0, 0, 0);
// Token: 0x04000589 RID: 1417
private static DateTime KoreanMax = new DateTime(9999, 12, 31, 11, 59, 59);
}
}