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
-
Expand
GregorianCalendarTypes
-
Expand
HebrewCalendar
-
Expand
HebrewNumber
-
Expand
HebrewNumberParsingContext
-
Expand
HebrewNumberParsingState
-
Expand
HebrewToken
-
Expand
HebrewValue
-
Expand
HijriCalendar
-
AddMonths(DateTime, int)
-
AddYears(DateTime, int)
-
AlgorithmType()
-
CheckEraRange(int)
-
CheckTicksRange(long)
-
CheckYearMonthRange(int, int, int)
-
CheckYearRange(int, int)
-
DaysUpToHijriYear(int)
-
Eras()
-
GetAbsoluteDateHijri(int, int, int)
-
GetAdvanceHijriDate()
-
GetDatePart(long, int)
-
GetDayOfMonth(DateTime)
-
GetDayOfWeek(DateTime)
-
GetDayOfYear(DateTime)
-
GetDaysInMonth(int, int, int)
-
GetDaysInYear(int, int)
-
GetEra(DateTime)
-
GetLeapMonth(int, int)
-
GetMonth(DateTime)
-
GetMonthsInYear(int, int)
-
GetYear(DateTime)
-
HijriAdjustment()
-
HijriCalendar()
-
ID()
-
IsLeapDay(int, int, int, int)
-
IsLeapMonth(int, int, int)
-
IsLeapYear(int, int)
-
MaxSupportedDateTime()
-
MinSupportedDateTime()
-
ToDateTime(int, int, int, int, int, int, int, int)
-
ToFourDigitYear(int)
-
TwoDigitYearMax()
-
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;
- using System.Runtime.Versioning;
- using System.Text;
- using Microsoft.Win32;
-
- ////////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- //////////////////////////////////////////////////////////////////////////// </STRIP>
-
-
- [Serializable()]
- [System.Runtime.InteropServices.ComVisible(true)]
- public class HijriCalendar : Calendar
- {
-
-
- public static readonly int HijriEra = 1;
-
- internal const int DatePartYear = 0;
- internal const int DatePartDayOfYear = 1;
- internal const int DatePartMonth = 2;
- internal const int DatePartDay = 3;
-
- internal const int MinAdvancedHijri = -2;
- internal const int MaxAdvancedHijri = 2;
-
- static internal readonly int[] HijriMonthDays = {0, 30, 59, 89, 118, 148, 177, 207, 236, 266,
- 295, 325, 355};
-
-
-
- private static string m_HijriAdvanceRegKeyEntry = "AddHijriDate";
-
- private int m_HijriAdvance = Int32.MinValue;
-
-
- internal const int MaxCalendarYear = 9666;
- internal const int MaxCalendarMonth = 4;
- internal const int MaxCalendarDay = 3;
-
-
- static internal readonly DateTime calendarMinValue = new DateTime(622, 7, 18);
- static internal readonly DateTime calendarMaxValue = DateTime.MaxValue;
-
-
- [System.Runtime.InteropServices.ComVisible(false)]
- public override DateTime MinSupportedDateTime {
- get { return (calendarMinValue); }
- }
-
-
- [System.Runtime.InteropServices.ComVisible(false)]
- public override DateTime MaxSupportedDateTime {
- get { return (calendarMaxValue); }
- }
-
-
-
-
- [System.Runtime.InteropServices.ComVisible(false)]
- public override CalendarAlgorithmType AlgorithmType {
- get { return CalendarAlgorithmType.LunarCalendar; }
- }
-
-
-
-
-
-
- public HijriCalendar()
- {
- }
-
- internal override int ID {
- get { return (CAL_HIJRI); }
- }
-
-
-
- long GetAbsoluteDateHijri(int y, int m, int d)
- {
- return (long)(DaysUpToHijriYear(y) + HijriMonthDays[m - 1] + d - 1 - HijriAdjustment);
- }
-
-
-
- long DaysUpToHijriYear(int HijriYear)
- {
- long NumDays;
-
- int NumYear30;
-
- int NumYearsLeft;
-
-
-
-
- NumYear30 = ((HijriYear - 1) / 30) * 30;
-
-
-
-
-
- NumYearsLeft = HijriYear - NumYear30 - 1;
-
-
-
-
- NumDays = ((NumYear30 * 10631l) / 30l) + 227013l;
- while (NumYearsLeft > 0) {
-
- NumDays += 354 + (IsLeapYear(NumYearsLeft, CurrentEra) ? 1 : 0);
- NumYearsLeft--;
- }
-
-
-
-
- return (NumDays);
- }
-
-
- public int HijriAdjustment {
- get {
- if (m_HijriAdvance == Int32.MinValue) {
-
- m_HijriAdvance = GetAdvanceHijriDate();
- }
- return (m_HijriAdvance);
- }
-
- set {
- VerifyWritable();
-
-
- if (value < MinAdvancedHijri || value > MaxAdvancedHijri) {
- throw new ArgumentOutOfRangeException("HijriAdjustment", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Bounds_Lower_Upper"), MinAdvancedHijri, MaxAdvancedHijri));
- }
- m_HijriAdvance = value;
- }
- }
-
-
- [ResourceExposure(ResourceScope.None)]
- [ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
- int GetAdvanceHijriDate()
- {
-
- int hijriAdvance = 0;
-
- const int parameterValueLength = 255;
- StringBuilder parameterValue = new StringBuilder(parameterValueLength);
- bool rc = Win32Native.FetchConfigurationString(true, m_HijriAdvanceRegKeyEntry, parameterValue, parameterValueLength);
- if (rc) {
- string str = parameterValue.ToString();
- if (String.Compare(str, 0, m_HijriAdvanceRegKeyEntry, 0, m_HijriAdvanceRegKeyEntry.Length, true, CultureInfo.InvariantCulture) == 0) {
- if (str.Length == m_HijriAdvanceRegKeyEntry.Length)
- hijriAdvance = -1;
- else {
- str = str.Substring(m_HijriAdvanceRegKeyEntry.Length);
- try {
- int advance = Int32.Parse(str.ToString(), CultureInfo.InvariantCulture);
- if ((advance >= MinAdvancedHijri) && (advance <= MaxAdvancedHijri)) {
- hijriAdvance = advance;
- }
- }
-
-
- catch (ArgumentException) {
- }
- catch (FormatException) {
- }
- catch (OverflowException) {
- }
- }
- }
- }
-
- return (hijriAdvance);
- }
-
- internal void CheckTicksRange(long ticks)
- {
- if (ticks < calendarMinValue.Ticks || ticks > calendarMaxValue.Ticks) {
- throw new ArgumentOutOfRangeException("time", String.Format(CultureInfo.InvariantCulture, Environment.GetResourceString("ArgumentOutOfRange_CalendarRange"), calendarMinValue, calendarMaxValue));
- }
- }
-
- internal void CheckEraRange(int era)
- {
- if (era != CurrentEra && era != HijriEra) {
- throw new ArgumentOutOfRangeException("era", Environment.GetResourceString("ArgumentOutOfRange_InvalidEraValue"));
- }
- }
-
- internal void CheckYearRange(int year, int era)
- {
- CheckEraRange(era);
- if (year < 1 || year > MaxCalendarYear) {
- throw new ArgumentOutOfRangeException("year", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), 1, MaxCalendarYear));
- }
- }
-
- internal void CheckYearMonthRange(int year, int month, int era)
- {
- CheckYearRange(year, era);
- if (year == MaxCalendarYear) {
- if (month > MaxCalendarMonth) {
- throw new ArgumentOutOfRangeException("month", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), 1, MaxCalendarMonth));
- }
- }
-
- if (month < 1 || month > 12) {
- throw new ArgumentOutOfRangeException("month", Environment.GetResourceString("ArgumentOutOfRange_Month"));
- }
- }
-
-
-
- internal virtual int GetDatePart(long ticks, int part)
- {
- int HijriYear;
-
- int HijriMonth;
-
- int HijriDay;
-
- long NumDays;
-
- CheckTicksRange(ticks);
-
-
-
-
-
- NumDays = ticks / GregorianCalendar.TicksPerDay + 1;
-
-
-
-
- NumDays += HijriAdjustment;
-
-
-
-
- HijriYear = (int)(((NumDays - 227013) * 30) / 10631) + 1;
-
- long daysToHijriYear = DaysUpToHijriYear(HijriYear);
-
- long daysOfHijriYear = GetDaysInYear(HijriYear, CurrentEra);
-
- if (NumDays < daysToHijriYear) {
- daysToHijriYear -= daysOfHijriYear;
- HijriYear--;
- }
- else if (NumDays == daysToHijriYear) {
- HijriYear--;
- daysToHijriYear -= GetDaysInYear(HijriYear, CurrentEra);
- }
- else {
- if (NumDays > daysToHijriYear + daysOfHijriYear) {
- daysToHijriYear += daysOfHijriYear;
- HijriYear++;
- }
- }
- if (part == DatePartYear) {
- return (HijriYear);
- }
-
-
-
-
-
- HijriMonth = 1;
- NumDays -= daysToHijriYear;
-
- if (part == DatePartDayOfYear) {
- return ((int)NumDays);
- }
-
- while ((HijriMonth <= 12) && (NumDays > HijriMonthDays[HijriMonth - 1])) {
- HijriMonth++;
- }
- HijriMonth--;
-
- if (part == DatePartMonth) {
- return (HijriMonth);
- }
-
-
-
-
- HijriDay = (int)(NumDays - HijriMonthDays[HijriMonth - 1]);
-
- if (part == DatePartDay) {
- return (HijriDay);
- }
-
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_DateTimeParsing"));
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public override DateTime AddMonths(DateTime time, int months)
- {
- 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 days = GetDaysInMonth(y, m);
- if (d > days) {
- d = days;
- }
- long ticks = GetAbsoluteDateHijri(y, m, d) * TicksPerDay + (time.Ticks % TicksPerDay);
- Calendar.CheckAddResult(ticks, MinSupportedDateTime, MaxSupportedDateTime);
- return (new DateTime(ticks));
- }
-
-
-
-
-
-
-
-
-
-
- public override DateTime AddYears(DateTime time, int years)
- {
- return (AddMonths(time, years * 12));
- }
-
-
-
-
-
- public override int GetDayOfMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDay));
- }
-
-
-
-
-
-
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- return ((DayOfWeek)((int)(time.Ticks / TicksPerDay + 1) % 7));
- }
-
-
-
-
-
- public override int GetDayOfYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartDayOfYear));
- }
-
-
-
-
-
- public override int GetDaysInMonth(int year, int month, int era)
- {
- CheckYearMonthRange(year, month, era);
- if (month == 12) {
-
- return (IsLeapYear(year, CurrentEra) ? 30 : 29);
- }
-
- return (((month % 2) == 1) ? 30 : 29);
- }
-
-
-
-
- public override int GetDaysInYear(int year, int era)
- {
- CheckYearRange(year, era);
-
- return (IsLeapYear(year, CurrentEra) ? 355 : 354);
- }
-
-
-
- public override int GetEra(DateTime time)
- {
- CheckTicksRange(time.Ticks);
- return (HijriEra);
- }
-
-
- public override int[] Eras {
- get { return (new int[] {HijriEra}); }
- }
-
-
-
-
-
- public override int GetMonth(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartMonth));
- }
-
-
-
- public override int GetMonthsInYear(int year, int era)
- {
- CheckYearRange(year, era);
- return (12);
- }
-
-
-
-
-
- public override int GetYear(DateTime time)
- {
- return (GetDatePart(time.Ticks, DatePartYear));
- }
-
-
-
-
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
-
- int daysInMonth = GetDaysInMonth(year, month, era);
- if (day < 1 || day > daysInMonth) {
- throw new ArgumentOutOfRangeException("day", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Day"), daysInMonth, month));
- }
- return (IsLeapYear(year, era) && month == 12 && day == 30);
- }
-
-
-
-
-
- [System.Runtime.InteropServices.ComVisible(false)]
- public override int GetLeapMonth(int year, int era)
- {
- CheckYearRange(year, era);
- return (0);
- }
-
-
-
-
-
- public override bool IsLeapMonth(int year, int month, int era)
- {
- CheckYearMonthRange(year, month, era);
- return (false);
- }
-
-
-
-
-
- public override bool IsLeapYear(int year, int era)
- {
- CheckYearRange(year, era);
- return ((((year * 11) + 14) % 30) < 11);
- }
-
-
-
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
-
- int daysInMonth = GetDaysInMonth(year, month, era);
- if (day < 1 || day > daysInMonth) {
- BCLDebug.Log("year = " + year + ", month = " + month + ", day = " + day);
- throw new ArgumentOutOfRangeException("day", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Day"), daysInMonth, month));
- }
-
- long lDate = GetAbsoluteDateHijri(year, month, day);
-
- if (lDate >= 0) {
- return (new DateTime(lDate * GregorianCalendar.TicksPerDay + TimeToTicks(hour, minute, second, millisecond)));
- }
- else {
- throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_BadYearMonthDay"));
- }
- }
-
- private const int DEFAULT_TWO_DIGIT_YEAR_MAX = 1451;
-
-
- public override int TwoDigitYearMax {
- get {
- if (twoDigitYearMax == -1) {
- twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
- }
- return (twoDigitYearMax);
- }
-
- set {
- VerifyWritable();
- if (value < 99 || value > MaxCalendarYear) {
- throw new ArgumentOutOfRangeException("value", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), 99, MaxCalendarYear));
-
- }
- twoDigitYearMax = value;
- }
- }
-
-
- public override int ToFourDigitYear(int year)
- {
- if (year < 100) {
- return (base.ToFourDigitYear(year));
- }
-
- if (year > MaxCalendarYear) {
- throw new ArgumentOutOfRangeException("year", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), 1, MaxCalendarYear));
- }
- return (year);
- }
-
- }
- }