We need you! We're working hard on the next version of Developer Fusion -
Let us know what you think we should be up to!
-
Expand
Microsoft.Win32
-
Expand
Microsoft.Win32.SafeHandles
-
Expand
System
-
Expand
System.Runtime.Hosting
-
Expand
System.Runtime.InteropServices
-
Expand
System.Runtime.CompilerServices
-
Expand
System.Collections
-
Expand
System.Collections.Generic
-
Expand
System.Collections.ObjectModel
-
Expand
System.Configuration.Assemblies
-
Expand
System.Diagnostics
-
Expand
System.Diagnostics.CodeAnalysis
-
Expand
System.Diagnostics.SymbolStore
-
Expand
System.Globalization
-
Expand
__DateBuffer
-
Expand
BaseInfoTable
-
Expand
BidiCategory
-
Expand
Calendar
-
Expand
CalendarAlgorithmType
-
Expand
CalendarId
-
Expand
CalendarTable
-
Expand
CalendarTableData
-
Expand
CalendarWeekRule
-
Expand
CharUnicodeInfo
-
Expand
ChineseLunisolarCalendar
-
Expand
CodePageDataItem
-
Expand
CompareInfo
-
Expand
CompareOptions
-
Expand
CultureData
-
Expand
CultureFlags
-
Expand
CultureInfo
-
Expand
CultureNameOffsetItem
-
Expand
CultureTable
-
Expand
CultureTableData
-
Expand
CultureTableHeader
-
Expand
CultureTableItem
-
Expand
CultureTableRecord
-
Expand
CultureTypes
-
Expand
DateMapping
-
Expand
DateTimeFormatFlags
-
Expand
DateTimeFormatInfo
-
Expand
DateTimeFormatInfoScanner
-
Expand
DateTimeStyles
-
Expand
DaylightTime
-
Expand
DigitShapes
-
Expand
DigitValues
-
Expand
DTFIUserOverrideValues
-
Expand
EastAsianLunisolarCalendar
-
Expand
EncodingTable
-
Expand
EndianessHeader
-
Expand
EraInfo
-
Expand
ExceptionTableItem
-
Expand
FORMATFLAGS
-
Expand
FoundDatePattern
-
Expand
GlobalizationAssembly
-
Expand
GregorianCalendar
-
Expand
GregorianCalendarHelper
-
AddMonths(DateTime, int)
-
AddYears(DateTime, int)
-
CheckTicksRange(long)
-
DateToTicks(int, int, int)
-
Eras()
-
GetAbsoluteDate(int, int, int)
-
GetDatePart(long, int)
-
GetDayOfMonth(DateTime)
-
GetDayOfWeek(DateTime)
-
GetDayOfYear(DateTime)
-
GetDaysInMonth(int, int, int)
-
GetDaysInYear(int, int)
-
GetEra(DateTime)
-
GetGregorianYear(int, int)
-
GetLeapMonth(int, int)
-
GetMonth(DateTime)
-
GetMonthsInYear(int, int)
-
GetWeekOfYear(DateTime, CalendarWeekRule, DayOfWeek)
-
GetYear(DateTime)
-
GetYear(int, DateTime)
-
GregorianCalendarHelper(Calendar, EraInfo)
-
InitEraInfo(int)
-
IsLeapDay(int, int, int, int)
-
IsLeapMonth(int, int, int)
-
IsLeapYear(int, int)
-
IsValidYear(int, int)
-
MaxYear()
-
TimeToTicks(int, int, int, int)
-
ToDateTime(int, int, int, int, int, int, int, int)
-
ToFourDigitYear(int, int)
-
Expand
GregorianCalendarTypes
-
Expand
HebrewCalendar
-
Expand
HebrewNumber
-
Expand
HebrewNumberParsingContext
-
Expand
HebrewNumberParsingState
-
Expand
HebrewToken
-
Expand
HebrewValue
-
Expand
HijriCalendar
-
Expand
HS
-
Expand
IdnMapping
-
Expand
IDOffsetItem
-
Expand
IetfNameOffsetItem
-
Expand
InternalCodePageDataItem
-
Expand
InternalEncodingDataItem
-
Expand
JapaneseCalendar
-
Expand
JapaneseLunisolarCalendar
-
Expand
JulianCalendar
-
Expand
KoreanCalendar
-
Expand
KoreanLunisolarCalendar
-
Expand
MemoryMapFile
-
Expand
MonthNameStyles
-
Expand
NumberFormatInfo
-
Expand
NumberStyles
-
Expand
PersianCalendar
-
Expand
RegionInfo
-
Expand
RegionNameOffsetItem
-
Expand
SortKey
-
Expand
StringInfo
-
Expand
TaiwanCalendar
-
Expand
TaiwanLunisolarCalendar
-
Expand
TextElementEnumerator
-
Expand
TextInfo
-
Expand
TextInfoDataHeader
-
Expand
ThaiBuddhistCalendar
-
Expand
TokenHashValue
-
Expand
UmAlQuraCalendar
-
Expand
UnicodeCategory
-
Expand
UnicodeDataHeader
-
Expand
System.IO
-
Expand
System.IO.IsolatedStorage
-
Expand
System.Reflection
-
Expand
System.Reflection.Cache
-
Expand
System.Reflection.Emit
-
Expand
System.Resources
-
Expand
System.Runtime
-
Expand
System.Runtime.InteropServices.Expando
-
Expand
System.Runtime.ConstrainedExecution
-
Expand
System.Runtime.Remoting.Activation
-
Expand
System.Runtime.Remoting.Messaging
-
Expand
System.Runtime.Remoting.Channels
-
Expand
System.Runtime.Remoting.Lifetime
-
Expand
System.Runtime.Remoting
-
Expand
System.Runtime.Remoting.Contexts
-
Expand
System.Runtime.Remoting.Proxies
-
Expand
System.Runtime.Remoting.Metadata
-
Expand
System.Runtime.Remoting.Metadata.W3cXsd2001
-
Expand
System.Runtime.Remoting.Services
-
Expand
System.Runtime.Serialization
-
Expand
System.Runtime.Serialization.Formatters
-
Expand
System.Runtime.Serialization.Formatters.Binary
-
Expand
System.Runtime.Versioning
-
Expand
System.Security
-
Expand
System.Security.Cryptography
-
Expand
System.Security.Cryptography.X509Certificates
-
Expand
System.Security.Permissions
-
Expand
System.Security.Policy
-
Expand
System.Security.Principal
-
Expand
System.Security.Util
-
Expand
System.Text
-
Expand
System.Threading
-
Expand
System.Runtime.Remoting.Channels.Http
-
Expand
System.Runtime.Remoting.Channels.Tcp
-
Expand
System.Runtime.Remoting.MetadataServices
-
Expand
System.Runtime.Serialization.Formatters.Soap.Xml
-
Expand
System.Runtime.Serialization.Formatters.Soap
-
Expand
Microsoft.Tools.Caspol
-
Expand
Microsoft.Tools.Build
-
Expand
Microsoft.CSharp
-
Expand
System.CodeDom
-
Expand
System.CodeDom.Compiler
-
Expand
System.Collections.Specialized
-
Expand
System.ComponentModel
-
Expand
System.ComponentModel.Design
-
Expand
System.ComponentModel.Design.Serialization
-
Expand
System.Configuration
-
Expand
System.Web
-
Expand
System.Configuration.Provider
-
Expand
System.Configuration.Internal
-
Expand
System.Internal
-
Expand
System.Windows.Forms
-
Expand
System.Net
-
Expand
System.Net.Sockets
-
Expand
System.Net.NetworkInformation
-
Expand
System.Net.ComImports
-
Expand
System.Net.Security
-
Expand
System.Net.Cache
-
Expand
System.Net.Configuration
-
Expand
System.Text.RegularExpressions
-
Expand
System.Tools
-
Expand
System.IO.Compression
-
Expand
System.IO.Ports
-
Expand
System.Security.AccessControl
-
Expand
System.Xml
-
Expand
System.Xml.XPath.DataBinding
-
Expand
System.Xml.Schema
-
Expand
System.Xml.Serialization
-
Expand
System.Xml.Serialization.Advanced
-
Expand
System.Xml.Serialization.Configuration
-
Expand
System.Xml.XPath
-
Expand
System.Xml.Xsl
-
Expand
System.Xml.Xsl.IlGen
-
Expand
System.Xml.Xsl.Qil
-
Expand
System.Xml.Xsl.Runtime
-
Expand
System.Xml.Xsl.XPath
-
Expand
System.Xml.Xsl.Xslt
-
Expand
System.Xml.Xsl.XsltOld
-
Expand
System.Xml.Xsl.XsltOld.Debugger
-
Expand
Microsoft.JScript
-
Expand
Microsoft.Vsa
-
Expand
Microsoft.JScript.Vsa
- namespace System.Globalization
- {
- using System.Threading;
- using System;
-
-
- [Serializable()]
- internal class EraInfo
- {
- internal int era;
-
- internal long ticks;
-
- internal int yearOffset;
-
-
-
- internal int minEraYear;
-
-
- internal int maxEraYear;
-
- internal EraInfo(int era, long ticks, int yearOffset, int minEraYear, int maxEraYear)
- {
- this.era = era;
- this.ticks = ticks;
- this.yearOffset = yearOffset;
- this.minEraYear = minEraYear;
- this.maxEraYear = maxEraYear;
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [Serializable()]
- internal class GregorianCalendarHelper
- {
-
-
-
- internal const long TicksPerMillisecond = 10000;
- internal const long TicksPerSecond = TicksPerMillisecond * 1000;
- internal const long TicksPerMinute = TicksPerSecond * 60;
- internal const long TicksPerHour = TicksPerMinute * 60;
- internal const long TicksPerDay = TicksPerHour * 24;
-
-
- internal const int MillisPerSecond = 1000;
- internal const int MillisPerMinute = MillisPerSecond * 60;
- internal const int MillisPerHour = MillisPerMinute * 60;
- internal const int MillisPerDay = MillisPerHour * 24;
-
-
- internal const int DaysPerYear = 365;
-
- internal const int DaysPer4Years = DaysPerYear * 4 + 1;
-
- internal const int DaysPer100Years = DaysPer4Years * 25 - 1;
-
- internal const int DaysPer400Years = DaysPer100Years * 4 + 1;
-
-
- internal const int DaysTo10000 = DaysPer400Years * 25 - 366;
-
- internal const long MaxMillis = (long)DaysTo10000 * MillisPerDay;
-
- internal const int DatePartYear = 0;
- internal const int DatePartDayOfYear = 1;
- internal const int DatePartMonth = 2;
- internal const int DatePartDay = 3;
-
-
-
-
-
- internal int MaxYear {
- get { return (m_maxYear); }
- }
-
- static internal readonly int[] DaysToMonth365 = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273,
- 304, 334, 365};
-
- static internal readonly int[] DaysToMonth366 = {0, 31, 60, 91, 121, 152, 182, 213, 244, 274,
- 305, 335, 366};
-
- internal int m_maxYear = 9999;
- internal int m_minYear;
- internal Calendar m_Cal;
- internal EraInfo[] m_EraInfo;
- internal int[] m_eras = null;
-
-
-
- internal DateTime m_minDate;
-
-
- static internal EraInfo[] InitEraInfo(int calID)
- {
-
-
-
-
-
-
- BCLDebug.Assert(calID > 0, "[GregorianCalendarHelper.InitEraInfo] Expected calID > 0");
- int[][] eraRanges = CalendarTable.Default.SERARANGES(calID);
- EraInfo[] eraInfo = new EraInfo[eraRanges.Length];
- int maxEraYear = GregorianCalendar.MaxYear;
- for (int i = 0; i < eraRanges.Length; i++) {
-
-
-
-
-
-
-
-
-
- BCLDebug.Assert(eraRanges[i].Length == 6, "[GregorianCalendarHelper.InitEraInfo] Expected 6 SERARANGE elements (0-5), not " + eraRanges[i].Length);
- eraInfo[i] = new EraInfo(eraRanges[i][0], new DateTime(eraRanges[i][1], eraRanges[i][2], eraRanges[i][3]).Ticks, eraRanges[i][4], eraRanges[i][5], maxEraYear - eraRanges[i][4]);
- maxEraYear = eraRanges[i][1];
- }
- return (eraInfo);
- }
-
-
- internal GregorianCalendarHelper(Calendar cal, EraInfo[] eraInfo)
- {
- m_Cal = cal;
- m_EraInfo = eraInfo;
-
-
- m_minDate = m_Cal.MinSupportedDateTime;
- m_maxYear = m_EraInfo[0].maxEraYear;
- m_minYear = m_EraInfo[0].minEraYear;
- ;
- }
-
-
-
- internal int GetGregorianYear(int year, int era)
- {
- if (year < 0) {
- throw new ArgumentOutOfRangeException("year", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
- }
-
- if (era == Calendar.CurrentEra) {
- era = m_Cal.CurrentEraValue;
- }
-
- for (int i = 0; i < m_EraInfo.Length; i++) {
- if (era == m_EraInfo[i].era) {
- if (year < m_EraInfo[i].minEraYear || year > m_EraInfo[i].maxEraYear) {
- throw new ArgumentOutOfRangeException("year", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), m_EraInfo[i].minEraYear, m_EraInfo[i].maxEraYear));
- }
- return (m_EraInfo[i].yearOffset + year);
- }
- }
- throw new ArgumentOutOfRangeException("era", Environment.GetResourceString("ArgumentOutOfRange_InvalidEraValue"));
- }
-
- internal bool IsValidYear(int year, int era)
- {
- if (year < 0) {
- return false;
- }
-
- if (era == Calendar.CurrentEra) {
- era = m_Cal.CurrentEraValue;
- }
-
- for (int i = 0; i < m_EraInfo.Length; i++) {
- if (era == m_EraInfo[i].era) {
- if (year < m_EraInfo[i].minEraYear || year > m_EraInfo[i].maxEraYear) {
- return false;
- }
- return true;
- }
- }
- return false;
- }
-
-
-
-
- internal virtual int GetDatePart(long ticks, int part)
- {
- CheckTicksRange(ticks);
-
- int n = (int)(ticks / TicksPerDay);
-
- int y400 = n / DaysPer400Years;
-
- n -= y400 * DaysPer400Years;
-
- int y100 = n / DaysPer100Years;
-
- if (y100 == 4)
- y100 = 3;
-
- n -= y100 * DaysPer100Years;
-
- int y4 = n / DaysPer4Years;
-
- n -= y4 * DaysPer4Years;
-
- int y1 = n / DaysPerYear;
-
- if (y1 == 4)
- y1 = 3;
-
- if (part == DatePartYear) {
- return (y400 * 400 + y100 * 100 + y4 * 4 + y1 + 1);
- }
-
- n -= y1 * DaysPerYear;
-
- if (part == DatePartDayOfYear) {
- return (n + 1);
- }
-
-
- bool leapYear = (y1 == 3 && (y4 != 24 || y100 == 3));
- int[] days = leapYear ? DaysToMonth366 : DaysToMonth365;
-
-
- int m = n >> 5 + 1;
-
- while (n >= days[m])
- m++;
-
- if (part == DatePartMonth)
- return (m);
-
- return (n - days[m - 1] + 1);
- }
-
-
-
- static internal long GetAbsoluteDate(int year, int month, int day)
- {
- if (year >= 1 && year <= 9999 && month >= 1 && month <= 12) {
- int[] days = ((year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))) ? DaysToMonth366 : DaysToMonth365;
- if (day >= 1 && (day <= days[month] - days[month - 1])) {
- int y = year - 1;
- int absoluteDate = y * 365 + y / 4 - y / 100 + y / 400 + days[month - 1] + day - 1;
- return (absoluteDate);
- }
- }
- throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_BadYearMonthDay"));
- }
-
-
-
- static internal long DateToTicks(int year, int month, int day)
- {
- return (GetAbsoluteDate(year, month, day) * TicksPerDay);
- }
-
-
-
- static internal long TimeToTicks(int hour, int minute, int second, int millisecond)
- {
-
-
- if (hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >= 0 && second < 60) {
- if (millisecond < 0 || millisecond >= MillisPerSecond) {
- throw new ArgumentOutOfRangeException("millisecond", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), 0, MillisPerSecond - 1));
- }
- return (TimeSpan.TimeToTicks(hour, minute, second) + millisecond * TicksPerMillisecond);
- ;
- }
- throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_BadHourMinuteSecond"));
- }
-
-
- internal void CheckTicksRange(long ticks)
- {
- if (ticks < m_Cal.MinSupportedDateTime.Ticks || ticks > m_Cal.MaxSupportedDateTime.Ticks) {
- throw new ArgumentOutOfRangeException("time", String.Format(CultureInfo.InvariantCulture, Environment.GetResourceString("ArgumentOutOfRange_CalendarRange"), m_Cal.MinSupportedDateTime, m_Cal.MaxSupportedDateTime));
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public DateTime AddMonths(DateTime time, int months)
- {
- CheckTicksRange(time.Ticks);
- if (months < -120000 || months > 120000) {
- throw new ArgumentOutOfRangeException("months", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), -120000, 120000));
- }
- int y = GetDatePart(time.Ticks, DatePartYear);
- int m = GetDatePart(time.Ticks, DatePartMonth);
- int d = GetDatePart(time.Ticks, DatePartDay);
- int i = m - 1 + months;
- if (i >= 0) {
- m = i % 12 + 1;
- y = y + i / 12;
- }
- else {
- m = 12 + (i + 1) % 12;
- y = y + (i - 11) / 12;
- }
- int[] daysArray = (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)) ? DaysToMonth366 : DaysToMonth365;
- int days = (daysArray[m] - daysArray[m - 1]);
-
- if (d > days) {
- d = days;
- }
- long ticks = DateToTicks(y, m, d) + (time.Ticks % TicksPerDay);
- Calendar.CheckAddResult(ticks, m_Cal.MinSupportedDateTime, m_Cal.MaxSupportedDateTime);
- return (new DateTime(ticks));
- }
-
-
-
-
-
-
-
-
-
- public DateTime AddYears(DateTime time, int years)
- {
- return (AddMonths(time, years * 12));
- }
-
-
-
-
- public int GetDayOfMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDay));
- }
-
-
-
-
-
-
- public DayOfWeek GetDayOfWeek(DateTime time)
- {
- CheckTicksRange(time.Ticks);
- return ((DayOfWeek)((time.Ticks / TicksPerDay + 1) % 7));
- }
-
-
-
-
- public int GetDayOfYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDayOfYear));
- }
-
-
-
-
- public int GetDaysInMonth(int year, int month, int era)
- {
-
-
-
- year = GetGregorianYear(year, era);
- if (month < 1 || month > 12) {
- throw new ArgumentOutOfRangeException("month", Environment.GetResourceString("ArgumentOutOfRange_Month"));
- }
- int[] days = ((year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? DaysToMonth366 : DaysToMonth365);
- return (days[month] - days[month - 1]);
- }
-
-
-
-
- public int GetDaysInYear(int year, int era)
- {
-
-
-
- year = GetGregorianYear(year, era);
- return ((year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) ? 366 : 365);
- }
-
-
- public int GetEra(DateTime time)
- {
- long ticks = time.Ticks;
-
- for (int i = 0; i < m_EraInfo.Length; i++) {
- if (ticks >= m_EraInfo[i].ticks) {
- return (m_EraInfo[i].era);
- }
- }
- throw new ArgumentOutOfRangeException(Environment.GetResourceString("ArgumentOutOfRange_Era"));
- }
-
-
- public int[] Eras {
- get {
- if (m_eras == null) {
- m_eras = new int[m_EraInfo.Length];
- for (int i = 0; i < m_EraInfo.Length; i++) {
- m_eras[i] = m_EraInfo[i].era;
- }
- }
- return ((int[])m_eras.Clone());
- }
- }
-
-
-
-
- public int GetMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartMonth));
- }
-
-
- public int GetMonthsInYear(int year, int era)
- {
- year = GetGregorianYear(year, era);
- return (12);
- }
-
-
-
-
- public int GetYear(DateTime time)
- {
- long ticks = time.Ticks;
- int year = GetDatePart(ticks, DatePartYear);
- for (int i = 0; i < m_EraInfo.Length; i++) {
- if (ticks >= m_EraInfo[i].ticks) {
- return (year - m_EraInfo[i].yearOffset);
- }
- }
- throw new ArgumentException(Environment.GetResourceString("Argument_NoEra"));
- }
-
-
-
-
- public int GetYear(int year, DateTime time)
- {
- long ticks = time.Ticks;
- for (int i = 0; i < m_EraInfo.Length; i++) {
- if (ticks >= m_EraInfo[i].ticks) {
- return (year - m_EraInfo[i].yearOffset);
- }
- }
- throw new ArgumentException(Environment.GetResourceString("Argument_NoEra"));
- }
-
-
-
-
- public bool IsLeapDay(int year, int month, int day, int era)
- {
-
- if (day < 1 || day > GetDaysInMonth(year, month, era)) {
- throw new ArgumentOutOfRangeException("day", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), 1, GetDaysInMonth(year, month, era)));
- }
-
- if (!IsLeapYear(year, era)) {
- return (false);
- }
-
- if (month == 2 && day == 29) {
- return (true);
- }
-
- return (false);
- }
-
-
-
-
- public int GetLeapMonth(int year, int era)
- {
- year = GetGregorianYear(year, era);
- return (0);
- }
-
-
-
-
- public bool IsLeapMonth(int year, int month, int era)
- {
- year = GetGregorianYear(year, era);
- if (month < 1 || month > 12) {
- throw new ArgumentOutOfRangeException("month", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), 1, 12));
- }
- return (false);
- }
-
-
-
-
- public bool IsLeapYear(int year, int era)
- {
- year = GetGregorianYear(year, era);
- return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
- }
-
-
-
- public DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- year = GetGregorianYear(year, era);
- long ticks = DateToTicks(year, month, day) + TimeToTicks(hour, minute, second, millisecond);
- CheckTicksRange(ticks);
- return (new DateTime(ticks));
- }
-
- public virtual int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
- {
- CheckTicksRange(time.Ticks);
-
-
- return (GregorianCalendar.GetDefaultInstance().GetWeekOfYear(time, rule, firstDayOfWeek));
- }
-
-
- public int ToFourDigitYear(int year, int twoDigitYearMax)
- {
- if (year < 0) {
- throw new ArgumentOutOfRangeException("year", Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
- }
-
- if (year < 100) {
- int y = year % 100;
- return ((twoDigitYearMax / 100 - (y > twoDigitYearMax % 100 ? 1 : 0)) * 100 + y);
- }
-
- if (year < m_minYear || year > m_maxYear) {
- throw new ArgumentOutOfRangeException("year", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), m_minYear, m_maxYear));
- }
-
-
- return (year);
- }
- }
- }