Files
Dec2017-Script-Dump/mscorlib/System/Globalization/ThaiBuddhistCalendar.cs
T
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 Thai Buddhist calendar.</summary>
// Token: 0x0200019C RID: 412
[MonoTODO("Serialization format not compatible with.NET")]
[ComVisible(true)]
[Serializable]
public class ThaiBuddhistCalendar : Calendar
{
/// <summary>Initializes a new instance of the <see cref="T:System.Globalization.ThaiBuddhistCalendar" /> class.</summary>
// Token: 0x060014EE RID: 5358 RVA: 0x00050AA8 File Offset: 0x0004ECA8
public ThaiBuddhistCalendar()
{
this.M_AbbrEraNames = new string[] { "T.B.C.E." };
this.M_EraNames = new string[] { "ThaiBuddhist current era" };
if (this.twoDigitYearMax == 99)
{
this.twoDigitYearMax = 2572;
}
}
// Token: 0x060014EF RID: 5359 RVA: 0x00050AFC File Offset: 0x0004ECFC
static ThaiBuddhistCalendar()
{
ThaiBuddhistCalendar.M_EraHandler.appendEra(1, CCGregorianCalendar.fixed_from_dmy(1, 1, -542));
}
/// <summary>Gets the list of eras in the <see cref="T:System.Globalization.ThaiBuddhistCalendar" /> class.</summary>
/// <returns>An array that consists of a single element having a value that is always the current era.</returns>
// Token: 0x170003BA RID: 954
// (get) Token: 0x060014F0 RID: 5360 RVA: 0x00050B54 File Offset: 0x0004ED54
public override int[] Eras
{
get
{
return (int[])ThaiBuddhistCalendar.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: 0x170003BB RID: 955
// (get) Token: 0x060014F1 RID: 5361 RVA: 0x00050B6C File Offset: 0x0004ED6C
// (set) Token: 0x060014F2 RID: 5362 RVA: 0x00050B74 File Offset: 0x0004ED74
public override int TwoDigitYearMax
{
get
{
return this.twoDigitYearMax;
}
set
{
base.CheckReadOnly();
base.M_ArgumentInRange("value", value, 100, this.M_MaxYear);
this.twoDigitYearMax = value;
}
}
// Token: 0x060014F3 RID: 5363 RVA: 0x00050BA4 File Offset: 0x0004EDA4
internal void M_CheckEra(ref int era)
{
if (era == 0)
{
era = 1;
}
if (!ThaiBuddhistCalendar.M_EraHandler.ValidEra(era))
{
throw new ArgumentException("Era value was not valid.");
}
}
// Token: 0x060014F4 RID: 5364 RVA: 0x00050BD8 File Offset: 0x0004EDD8
internal int M_CheckYEG(int year, ref int era)
{
this.M_CheckEra(ref era);
return ThaiBuddhistCalendar.M_EraHandler.GregorianYear(year, era);
}
// Token: 0x060014F5 RID: 5365 RVA: 0x00050BF0 File Offset: 0x0004EDF0
internal override void M_CheckYE(int year, ref int era)
{
this.M_CheckYEG(year, ref era);
}
// Token: 0x060014F6 RID: 5366 RVA: 0x00050BFC File Offset: 0x0004EDFC
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: 0x060014F7 RID: 5367 RVA: 0x00050C34 File Offset: 0x0004EE34
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: 0x060014F8 RID: 5368 RVA: 0x00050C68 File Offset: 0x0004EE68
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.ArgumentException">The resulting <see cref="T:System.DateTime" /> is outside the supported range. </exception>
// Token: 0x060014F9 RID: 5369 RVA: 0x00050C74 File Offset: 0x0004EE74
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: 0x060014FA RID: 5370 RVA: 0x00050C80 File Offset: 0x0004EE80
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: 0x060014FB RID: 5371 RVA: 0x00050C88 File Offset: 0x0004EE88
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: 0x060014FC RID: 5372 RVA: 0x00050CA4 File Offset: 0x0004EEA4
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: 0x060014FD RID: 5373 RVA: 0x00050CAC File Offset: 0x0004EEAC
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: 0x060014FE RID: 5374 RVA: 0x00050CCC File Offset: 0x0004EECC
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: 0x060014FF RID: 5375 RVA: 0x00050CEC File Offset: 0x0004EEEC
public override int GetEra(DateTime time)
{
int num = CCFixed.FromDateTime(time);
int num2;
ThaiBuddhistCalendar.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.ThaiBuddhistCalendar" /> class does not support the notion of a leap month.</returns>
/// <param name="year">A year.</param>
/// <param name="era">An era.</param>
// Token: 0x06001500 RID: 5376 RVA: 0x00050D10 File Offset: 0x0004EF10
[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: 0x06001501 RID: 5377 RVA: 0x00050D14 File Offset: 0x0004EF14
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: 0x06001502 RID: 5378 RVA: 0x00050D1C File Offset: 0x0004EF1C
public override int GetMonthsInYear(int year, int era)
{
this.M_CheckYE(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 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: 0x06001503 RID: 5379 RVA: 0x00050D2C File Offset: 0x0004EF2C
[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: 0x06001504 RID: 5380 RVA: 0x00050D38 File Offset: 0x0004EF38
public override int GetYear(DateTime time)
{
int num = CCFixed.FromDateTime(time);
int num2;
return ThaiBuddhistCalendar.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: 0x06001505 RID: 5381 RVA: 0x00050D5C File Offset: 0x0004EF5C
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: 0x06001506 RID: 5382 RVA: 0x00050D80 File Offset: 0x0004EF80
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: 0x06001507 RID: 5383 RVA: 0x00050D90 File Offset: 0x0004EF90
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: 0x06001508 RID: 5384 RVA: 0x00050DB0 File Offset: 0x0004EFB0
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.ThaiBuddhistCalendar.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: 0x06001509 RID: 5385 RVA: 0x00050DE8 File Offset: 0x0004EFE8
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.ThaiBuddhistCalendar" /> class.</summary>
/// <returns>The earliest date and time supported by the <see cref="T:System.Globalization.ThaiBuddhistCalendar" /> class, which is equivalent to the first moment of January 1, 0001 C.E. in the Gregorian calendar.</returns>
// Token: 0x170003BC RID: 956
// (get) Token: 0x0600150A RID: 5386 RVA: 0x00050DF4 File Offset: 0x0004EFF4
[ComVisible(false)]
public override DateTime MinSupportedDateTime
{
get
{
return ThaiBuddhistCalendar.ThaiMin;
}
}
/// <summary>Gets the latest date and time supported by the <see cref="T:System.Globalization.ThaiBuddhistCalendar" /> class.</summary>
/// <returns>The latest date and time supported by the <see cref="T:System.Globalization.ThaiBuddhistCalendar" /> class, which is equivalent to the last moment of December 31, 9999 C.E. in the Gregorian calendar.</returns>
// Token: 0x170003BD RID: 957
// (get) Token: 0x0600150B RID: 5387 RVA: 0x00050DFC File Offset: 0x0004EFFC
[ComVisible(false)]
public override DateTime MaxSupportedDateTime
{
get
{
return ThaiBuddhistCalendar.ThaiMax;
}
}
/// <summary>Represents the current era. This field is constant.</summary>
// Token: 0x040005F4 RID: 1524
public const int ThaiBuddhistEra = 1;
// Token: 0x040005F5 RID: 1525
internal static readonly CCGregorianEraHandler M_EraHandler = new CCGregorianEraHandler();
// Token: 0x040005F6 RID: 1526
private static DateTime ThaiMin = new DateTime(1, 1, 1, 0, 0, 0);
// Token: 0x040005F7 RID: 1527
private static DateTime ThaiMax = new DateTime(9999, 12, 31, 11, 59, 59);
}
}