385 lines
20 KiB
C#
385 lines
20 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace System.Globalization
|
|
{
|
|
/// <summary>the Taiwan calendar.</summary>
|
|
// Token: 0x02000197 RID: 407
|
|
[ComVisible(true)]
|
|
[MonoTODO("Serialization format not compatible with.NET")]
|
|
[Serializable]
|
|
public class TaiwanCalendar : Calendar
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Globalization.TaiwanCalendar" /> class.</summary>
|
|
// Token: 0x060014AB RID: 5291 RVA: 0x0004FAD4 File Offset: 0x0004DCD4
|
|
public TaiwanCalendar()
|
|
{
|
|
this.M_AbbrEraNames = new string[] { "T.C.E." };
|
|
this.M_EraNames = new string[] { "Taiwan current era" };
|
|
}
|
|
|
|
// Token: 0x060014AC RID: 5292 RVA: 0x0004FB10 File Offset: 0x0004DD10
|
|
static TaiwanCalendar()
|
|
{
|
|
TaiwanCalendar.M_EraHandler.appendEra(1, CCGregorianCalendar.fixed_from_dmy(1, 1, 1912));
|
|
}
|
|
|
|
/// <summary>Gets the list of eras in the <see cref="T:System.Globalization.TaiwanCalendar" />.</summary>
|
|
/// <returns>An array that consists of a single element for which the value is always the current era.</returns>
|
|
// Token: 0x170003A8 RID: 936
|
|
// (get) Token: 0x060014AD RID: 5293 RVA: 0x0004FB6C File Offset: 0x0004DD6C
|
|
public override int[] Eras
|
|
{
|
|
get
|
|
{
|
|
return (int[])TaiwanCalendar.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: 0x170003A9 RID: 937
|
|
// (get) Token: 0x060014AE RID: 5294 RVA: 0x0004FB84 File Offset: 0x0004DD84
|
|
// (set) Token: 0x060014AF RID: 5295 RVA: 0x0004FB8C File Offset: 0x0004DD8C
|
|
public override int TwoDigitYearMax
|
|
{
|
|
get
|
|
{
|
|
return this.twoDigitYearMax;
|
|
}
|
|
set
|
|
{
|
|
base.CheckReadOnly();
|
|
base.M_ArgumentInRange("value", value, 100, this.M_MaxYear);
|
|
this.twoDigitYearMax = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060014B0 RID: 5296 RVA: 0x0004FBBC File Offset: 0x0004DDBC
|
|
internal void M_CheckDateTime(DateTime time)
|
|
{
|
|
TaiwanCalendar.M_EraHandler.CheckDateTime(time);
|
|
}
|
|
|
|
// Token: 0x060014B1 RID: 5297 RVA: 0x0004FBCC File Offset: 0x0004DDCC
|
|
internal void M_CheckEra(ref int era)
|
|
{
|
|
if (era == 0)
|
|
{
|
|
era = 1;
|
|
}
|
|
if (!TaiwanCalendar.M_EraHandler.ValidEra(era))
|
|
{
|
|
throw new ArgumentException("Era value was not valid.");
|
|
}
|
|
}
|
|
|
|
// Token: 0x060014B2 RID: 5298 RVA: 0x0004FC00 File Offset: 0x0004DE00
|
|
internal int M_CheckYEG(int year, ref int era)
|
|
{
|
|
this.M_CheckEra(ref era);
|
|
return TaiwanCalendar.M_EraHandler.GregorianYear(year, era);
|
|
}
|
|
|
|
// Token: 0x060014B3 RID: 5299 RVA: 0x0004FC18 File Offset: 0x0004DE18
|
|
internal override void M_CheckYE(int year, ref int era)
|
|
{
|
|
this.M_CheckYEG(year, ref era);
|
|
}
|
|
|
|
// Token: 0x060014B4 RID: 5300 RVA: 0x0004FC24 File Offset: 0x0004DE24
|
|
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: 0x060014B5 RID: 5301 RVA: 0x0004FC5C File Offset: 0x0004DE5C
|
|
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.ArgumentException">The resulting <see cref="T:System.DateTime" /> is outside the supported range. </exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="months" /> is less than -120000.-or- <paramref name="months" /> is greater than 120000. </exception>
|
|
// Token: 0x060014B6 RID: 5302 RVA: 0x0004FC90 File Offset: 0x0004DE90
|
|
public override DateTime AddMonths(DateTime time, int months)
|
|
{
|
|
DateTime dateTime = CCGregorianCalendar.AddMonths(time, months);
|
|
this.M_CheckDateTime(dateTime);
|
|
return dateTime;
|
|
}
|
|
|
|
/// <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.ArgumentException">The resulting <see cref="T:System.DateTime" /> is outside the supported range. </exception>
|
|
// Token: 0x060014B7 RID: 5303 RVA: 0x0004FCB0 File Offset: 0x0004DEB0
|
|
public override DateTime AddYears(DateTime time, int years)
|
|
{
|
|
DateTime dateTime = CCGregorianCalendar.AddYears(time, years);
|
|
this.M_CheckDateTime(dateTime);
|
|
return dateTime;
|
|
}
|
|
|
|
/// <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: 0x060014B8 RID: 5304 RVA: 0x0004FCD0 File Offset: 0x0004DED0
|
|
public override int GetDayOfMonth(DateTime time)
|
|
{
|
|
this.M_CheckDateTime(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: 0x060014B9 RID: 5305 RVA: 0x0004FCE0 File Offset: 0x0004DEE0
|
|
public override DayOfWeek GetDayOfWeek(DateTime time)
|
|
{
|
|
this.M_CheckDateTime(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: 0x060014BA RID: 5306 RVA: 0x0004FD04 File Offset: 0x0004DF04
|
|
public override int GetDayOfYear(DateTime time)
|
|
{
|
|
this.M_CheckDateTime(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: 0x060014BB RID: 5307 RVA: 0x0004FD14 File Offset: 0x0004DF14
|
|
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: 0x060014BC RID: 5308 RVA: 0x0004FD34 File Offset: 0x0004DF34
|
|
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: 0x060014BD RID: 5309 RVA: 0x0004FD54 File Offset: 0x0004DF54
|
|
public override int GetEra(DateTime time)
|
|
{
|
|
int num = CCFixed.FromDateTime(time);
|
|
int num2;
|
|
TaiwanCalendar.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.TaiwanCalendar" /> class does not support the notion of a leap month.</returns>
|
|
/// <param name="year">A year.</param>
|
|
/// <param name="era">An era.</param>
|
|
// Token: 0x060014BE RID: 5310 RVA: 0x0004FD78 File Offset: 0x0004DF78
|
|
[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: 0x060014BF RID: 5311 RVA: 0x0004FD7C File Offset: 0x0004DF7C
|
|
public override int GetMonth(DateTime time)
|
|
{
|
|
this.M_CheckDateTime(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: 0x060014C0 RID: 5312 RVA: 0x0004FD8C File Offset: 0x0004DF8C
|
|
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 positive 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: 0x060014C1 RID: 5313 RVA: 0x0004FD9C File Offset: 0x0004DF9C
|
|
[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: 0x060014C2 RID: 5314 RVA: 0x0004FDA8 File Offset: 0x0004DFA8
|
|
public override int GetYear(DateTime time)
|
|
{
|
|
int num = CCFixed.FromDateTime(time);
|
|
int num2;
|
|
return TaiwanCalendar.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: 0x060014C3 RID: 5315 RVA: 0x0004FDCC File Offset: 0x0004DFCC
|
|
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: 0x060014C4 RID: 5316 RVA: 0x0004FDF0 File Offset: 0x0004DFF0
|
|
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: 0x060014C5 RID: 5317 RVA: 0x0004FE00 File Offset: 0x0004E000
|
|
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: 0x060014C6 RID: 5318 RVA: 0x0004FE20 File Offset: 0x0004E020
|
|
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.TaiwanCalendar.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>
|
|
// Token: 0x060014C7 RID: 5319 RVA: 0x0004FE58 File Offset: 0x0004E058
|
|
public override int ToFourDigitYear(int year)
|
|
{
|
|
if (year < 0)
|
|
{
|
|
throw new ArgumentOutOfRangeException("year", "Non-negative number required.");
|
|
}
|
|
int num = 0;
|
|
this.M_CheckYE(year, ref num);
|
|
return year;
|
|
}
|
|
|
|
/// <summary>Gets the earliest date and time supported by the <see cref="T:System.Globalization.TaiwanCalendar" /> class.</summary>
|
|
/// <returns>The earliest date and time supported by the <see cref="T:System.Globalization.TaiwanCalendar" /> class, which is equivalent to the first moment of January 1, 1912 C.E. in the Gregorian calendar.</returns>
|
|
// Token: 0x170003AA RID: 938
|
|
// (get) Token: 0x060014C8 RID: 5320 RVA: 0x0004FE88 File Offset: 0x0004E088
|
|
[ComVisible(false)]
|
|
public override DateTime MinSupportedDateTime
|
|
{
|
|
get
|
|
{
|
|
return TaiwanCalendar.TaiwanMin;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the latest date and time supported by the <see cref="T:System.Globalization.TaiwanCalendar" /> class.</summary>
|
|
/// <returns>The latest date and time supported by the <see cref="T:System.Globalization.TaiwanCalendar" /> class, which is equivalent to the last moment of December 31, 9999 C.E. in the Gregorian calendar.</returns>
|
|
// Token: 0x170003AB RID: 939
|
|
// (get) Token: 0x060014C9 RID: 5321 RVA: 0x0004FE90 File Offset: 0x0004E090
|
|
[ComVisible(false)]
|
|
public override DateTime MaxSupportedDateTime
|
|
{
|
|
get
|
|
{
|
|
return TaiwanCalendar.TaiwanMax;
|
|
}
|
|
}
|
|
|
|
// Token: 0x040005DA RID: 1498
|
|
internal static readonly CCGregorianEraHandler M_EraHandler = new CCGregorianEraHandler();
|
|
|
|
// Token: 0x040005DB RID: 1499
|
|
private static DateTime TaiwanMin = new DateTime(1912, 1, 1, 0, 0, 0);
|
|
|
|
// Token: 0x040005DC RID: 1500
|
|
private static DateTime TaiwanMax = new DateTime(9999, 12, 31, 11, 59, 59);
|
|
}
|
|
}
|