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
-
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
-
AddMonths(DateTime, int)
-
AddYears(DateTime, int)
-
AlgorithmType()
-
BaseCalendarID()
-
CheckEraRange(int)
-
CheckTicksRange(long)
-
CheckYearMonthRange(int, int, int)
-
CheckYearRange(int, int)
-
ConvertGregorianToHijri(DateTime, int, int, int)
-
ConvertHijriToGregorian(int, int, int, int, int, int)
-
Eras()
-
GetAbsoluteDateUmAlQura(int, int, int)
-
GetDatePart(DateTime, 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)
-
ID()
-
IsLeapDay(int, int, int, int)
-
IsLeapMonth(int, int, int)
-
IsLeapYear(int, int)
-
MaxSupportedDateTime()
-
MinSupportedDateTime()
-
RealGetDaysInYear(int)
-
ToDateTime(int, int, int, int, int, int, int, int)
-
ToFourDigitYear(int)
-
TwoDigitYearMax()
-
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;
-
-
- ////////////////////////////////////////////////////////////////////////////
-
-
-
- ////////////////////////////////////////////////////////////////////////////
-
-
- [Serializable()]
- public class UmAlQuraCalendar : Calendar
- {
-
- internal const int MinCalendarYear = 1318;
- internal const int MaxCalendarYear = 1450;
-
- internal struct DateMapping
- {
- internal DateMapping(int MonthsLengthFlags, int GYear, int GMonth, int GDay)
- {
- HijriMonthsLengthFlags = MonthsLengthFlags;
- GregorianDate = new DateTime(GYear, GMonth, GDay);
- }
- internal int HijriMonthsLengthFlags;
- internal DateTime GregorianDate;
- }
-
-
- static readonly DateMapping[] HijriYearInfo = {new DateMapping(746, 1900, 4, 30), new DateMapping(1769, 1901, 4, 19), new DateMapping(3794, 1902, 4, 9), new DateMapping(3748, 1903, 3, 30), new DateMapping(3402, 1904, 3, 18), new DateMapping(2710, 1905, 3, 7), new DateMapping(1334, 1906, 2, 24), new DateMapping(2741, 1907, 2, 13), new DateMapping(3498, 1908, 2, 3), new DateMapping(2980, 1909, 1, 23),
- new DateMapping(2889, 1910, 1, 12), new DateMapping(2707, 1911, 1, 1), new DateMapping(1323, 1911, 12, 21), new DateMapping(2647, 1912, 12, 9), new DateMapping(1206, 1913, 11, 29), new DateMapping(2741, 1914, 11, 18), new DateMapping(1450, 1915, 11, 8), new DateMapping(3413, 1916, 10, 27), new DateMapping(3370, 1917, 10, 17), new DateMapping(2646, 1918, 10, 6),
- new DateMapping(1198, 1919, 9, 25), new DateMapping(2397, 1920, 9, 13), new DateMapping(748, 1921, 9, 3), new DateMapping(1749, 1922, 8, 23), new DateMapping(1706, 1923, 8, 13), new DateMapping(1365, 1924, 8, 1), new DateMapping(1195, 1925, 7, 21), new DateMapping(2395, 1926, 7, 10), new DateMapping(698, 1927, 6, 30), new DateMapping(1397, 1928, 6, 18),
- new DateMapping(2994, 1929, 6, 8), new DateMapping(1892, 1930, 5, 29), new DateMapping(1865, 1931, 5, 18), new DateMapping(1621, 1932, 5, 6), new DateMapping(683, 1933, 4, 25), new DateMapping(1371, 1934, 4, 14), new DateMapping(2778, 1935, 4, 4), new DateMapping(1748, 1936, 3, 24), new DateMapping(3785, 1937, 3, 13), new DateMapping(3474, 1938, 3, 3),
- new DateMapping(3365, 1939, 2, 20), new DateMapping(2637, 1940, 2, 9), new DateMapping(685, 1941, 1, 28), new DateMapping(1389, 1942, 1, 17), new DateMapping(2922, 1943, 1, 7), new DateMapping(2898, 1943, 12, 28), new DateMapping(2725, 1944, 12, 16), new DateMapping(2635, 1945, 12, 5), new DateMapping(1175, 1946, 11, 24), new DateMapping(2359, 1947, 11, 13),
- new DateMapping(694, 1948, 11, 2), new DateMapping(1397, 1949, 10, 22), new DateMapping(3434, 1950, 10, 12), new DateMapping(3410, 1951, 10, 2), new DateMapping(2710, 1952, 9, 20), new DateMapping(2349, 1953, 9, 9), new DateMapping(605, 1954, 8, 29), new DateMapping(1245, 1955, 8, 18), new DateMapping(2778, 1956, 8, 7), new DateMapping(1492, 1957, 7, 28),
- new DateMapping(3497, 1958, 7, 17), new DateMapping(3410, 1959, 7, 7), new DateMapping(2730, 1960, 6, 25), new DateMapping(1238, 1961, 6, 14), new DateMapping(2486, 1962, 6, 3), new DateMapping(884, 1963, 5, 24), new DateMapping(1897, 1964, 5, 12), new DateMapping(1874, 1965, 5, 2), new DateMapping(1701, 1966, 4, 21), new DateMapping(1355, 1967, 4, 10),
- new DateMapping(2731, 1968, 3, 29), new DateMapping(1370, 1969, 3, 19), new DateMapping(2773, 1970, 3, 8), new DateMapping(3538, 1971, 2, 26), new DateMapping(3492, 1972, 2, 16), new DateMapping(3401, 1973, 2, 4), new DateMapping(2709, 1974, 1, 24), new DateMapping(1325, 1975, 1, 13), new DateMapping(2653, 1976, 1, 2), new DateMapping(1370, 1976, 12, 22),
- new DateMapping(2773, 1977, 12, 11), new DateMapping(1706, 1978, 12, 1), new DateMapping(1685, 1979, 11, 20), new DateMapping(1323, 1980, 11, 8), new DateMapping(2647, 1981, 10, 28), new DateMapping(1198, 1982, 10, 18), new DateMapping(2422, 1983, 10, 7), new DateMapping(1388, 1984, 9, 26), new DateMapping(2901, 1985, 9, 15), new DateMapping(2730, 1986, 9, 5),
- new DateMapping(2645, 1987, 8, 25), new DateMapping(1197, 1988, 8, 13), new DateMapping(2397, 1989, 8, 2), new DateMapping(730, 1990, 7, 23), new DateMapping(1497, 1991, 7, 12), new DateMapping(3506, 1992, 7, 1), new DateMapping(2980, 1993, 6, 21), new DateMapping(2890, 1994, 6, 10), new DateMapping(2645, 1995, 5, 30), new DateMapping(693, 1996, 5, 18),
- new DateMapping(1397, 1997, 5, 7), new DateMapping(2922, 1998, 4, 27), new DateMapping(3026, 1999, 4, 17), new DateMapping(3012, 2000, 4, 6), new DateMapping(2953, 2001, 3, 26), new DateMapping(2709, 2002, 3, 15), new DateMapping(1325, 2003, 3, 4), new DateMapping(1453, 2004, 2, 21), new DateMapping(2922, 2005, 2, 10), new DateMapping(1748, 2006, 1, 31),
- new DateMapping(3529, 2007, 1, 20), new DateMapping(3474, 2008, 1, 10), new DateMapping(2726, 2008, 12, 29), new DateMapping(2390, 2009, 12, 18), new DateMapping(686, 2010, 12, 7), new DateMapping(1389, 2011, 11, 26), new DateMapping(874, 2012, 11, 15), new DateMapping(2901, 2013, 11, 4), new DateMapping(2730, 2014, 10, 25), new DateMapping(2381, 2015, 10, 14),
- new DateMapping(1181, 2016, 10, 2), new DateMapping(2397, 2017, 9, 21), new DateMapping(698, 2018, 9, 11), new DateMapping(1461, 2019, 8, 31), new DateMapping(1450, 2020, 8, 20), new DateMapping(3413, 2021, 8, 9), new DateMapping(2714, 2022, 7, 30), new DateMapping(2350, 2023, 7, 19), new DateMapping(622, 2024, 7, 7), new DateMapping(1373, 2025, 6, 26),
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- new DateMapping(2778, 2026, 6, 16), new DateMapping(1748, 2027, 6, 6), new DateMapping(1701, 2028, 5, 25), new DateMapping(0, 2029, 5, 14)};
-
- public const int UmAlQuraEra = 1;
-
- internal const int DateCycle = 30;
- internal const int DatePartYear = 0;
- internal const int DatePartDayOfYear = 1;
- internal const int DatePartMonth = 2;
- internal const int DatePartDay = 3;
-
- static internal short[] gmonth = {31, 31, 28, 31, 30, 31, 30, 31, 31, 30,
- 31, 30, 31, 31};
-
-
-
-
-
- static internal DateTime minDate = new DateTime(1900, 4, 30);
- static internal DateTime maxDate = new DateTime((new DateTime(2029, 5, 13, 23, 59, 59, 999)).Ticks + 9999);
-
-
-
-
-
-
- public override DateTime MinSupportedDateTime {
- get { return (minDate); }
- }
-
-
- public override DateTime MaxSupportedDateTime {
- get { return (maxDate); }
- }
-
-
-
-
-
-
- public override CalendarAlgorithmType AlgorithmType {
- get { return CalendarAlgorithmType.LunarCalendar; }
- }
-
-
-
- public UmAlQuraCalendar()
- {
- }
-
- internal override int BaseCalendarID {
- get { return (CAL_HIJRI); }
- }
-
- internal override int ID {
- get { return (CAL_UMALQURA); }
- }
-
- void ConvertHijriToGregorian(int HijriYear, int HijriMonth, int HijriDay, ref int yg, ref int mg, ref int dg)
- {
- BCLDebug.Assert((HijriYear >= MinCalendarYear) && (HijriYear <= MaxCalendarYear), "Hijri year is out of range.");
- BCLDebug.Assert(HijriMonth >= 1, "Hijri month is out of range.");
- BCLDebug.Assert(HijriDay >= 1, "Hijri day is out of range.");
- int index;
- int b;
- int nDays = HijriDay - 1;
- DateTime dt;
-
-
- index = HijriYear - MinCalendarYear;
- dt = HijriYearInfo[index].GregorianDate;
-
-
- b = HijriYearInfo[index].HijriMonthsLengthFlags;
-
- for (int m = 1; m < HijriMonth; m++) {
- nDays = nDays + 29 + (b & 1);
- b = b >> 1;
- }
-
- dt = dt.AddDays(nDays);
- yg = dt.Year;
- mg = dt.Month;
- dg = dt.Day;
- }
-
-
- long GetAbsoluteDateUmAlQura(int year, int month, int day)
- {
-
-
- int yg = 0;
- int mg = 0;
- int dg = 0;
- ConvertHijriToGregorian(year, month, day, ref yg, ref mg, ref dg);
- return GregorianCalendar.GetAbsoluteDate(yg, mg, dg);
- }
-
- internal void CheckTicksRange(long ticks)
- {
- if (ticks < minDate.Ticks || ticks > maxDate.Ticks) {
- throw new ArgumentOutOfRangeException("time", String.Format(CultureInfo.InvariantCulture, Environment.GetResourceString("ArgumentOutOfRange_CalendarRange"), minDate, maxDate));
- }
- }
-
- internal void CheckEraRange(int era)
- {
- if (era != CurrentEra && era != UmAlQuraEra) {
- throw new ArgumentOutOfRangeException("era", Environment.GetResourceString("ArgumentOutOfRange_InvalidEraValue"));
- }
- }
-
- internal void CheckYearRange(int year, int era)
- {
- CheckEraRange(era);
- if (year < MinCalendarYear || year > MaxCalendarYear) {
- throw new ArgumentOutOfRangeException("year", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), MinCalendarYear, MaxCalendarYear));
- }
- }
-
- internal void CheckYearMonthRange(int year, int month, int era)
- {
- CheckYearRange(year, era);
- if (month < 1 || month > 12) {
- throw new ArgumentOutOfRangeException("month", Environment.GetResourceString("ArgumentOutOfRange_Month"));
- }
- }
-
-
- void ConvertGregorianToHijri(DateTime time, ref int HijriYear, ref int HijriMonth, ref int HijriDay)
- {
-
- int index;
- int b;
- int DaysPerThisMonth;
- double nDays;
- TimeSpan ts;
- int yh1 = 0;
- int mh1 = 0;
- int dh1 = 0;
-
- BCLDebug.Assert((time.Ticks >= minDate.Ticks) && (time.Ticks <= maxDate.Ticks), "Gregorian date is out of range.");
-
-
-
-
- index = (int)((time.Ticks - minDate.Ticks) / Calendar.TicksPerDay) / 355;
- do {
- }
- while (time.CompareTo(HijriYearInfo[++index].GregorianDate) > 0);
-
- if (time.CompareTo(HijriYearInfo[index].GregorianDate) != 0) {
- index--;
- }
-
- ts = time.Subtract(HijriYearInfo[index].GregorianDate);
- yh1 = index + MinCalendarYear;
-
- mh1 = 1;
- dh1 = 1;
- nDays = ts.TotalDays;
- b = HijriYearInfo[index].HijriMonthsLengthFlags;
- DaysPerThisMonth = 29 + (b & 1);
-
- while (nDays >= DaysPerThisMonth) {
- nDays -= DaysPerThisMonth;
- b = b >> 1;
- DaysPerThisMonth = 29 + (b & 1);
- mh1++;
- }
- dh1 += (int)nDays;
-
- HijriDay = dh1;
- HijriMonth = mh1;
- HijriYear = yh1;
- }
-
-
-
- internal virtual int GetDatePart(DateTime time, int part)
- {
- int UmAlQuraYear = 0;
-
- int UmAlQuraMonth = 0;
-
- int UmAlQuraDay = 0;
-
- long ticks = time.Ticks;
- CheckTicksRange(ticks);
-
- ConvertGregorianToHijri(time, ref UmAlQuraYear, ref UmAlQuraMonth, ref UmAlQuraDay);
-
- if (part == DatePartYear)
- return (UmAlQuraYear);
-
- if (part == DatePartMonth)
- return (UmAlQuraMonth);
-
- if (part == DatePartDay)
- return (UmAlQuraDay);
-
- if (part == DatePartDayOfYear)
- return (int)(GetAbsoluteDateUmAlQura(UmAlQuraYear, UmAlQuraMonth, UmAlQuraDay) - GetAbsoluteDateUmAlQura(UmAlQuraYear, 1, 1) + 1);
-
-
- 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, DatePartYear);
- int m = GetDatePart(time, DatePartMonth);
- int d = GetDatePart(time, 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;
- }
-
- if (d > 29) {
- int days = GetDaysInMonth(y, m);
- if (d > days) {
- d = days;
- }
- }
- CheckYearRange(y, UmAlQuraEra);
- DateTime dt = new DateTime(GetAbsoluteDateUmAlQura(y, m, d) * TicksPerDay + time.Ticks % TicksPerDay);
- Calendar.CheckAddResult(dt.Ticks, MinSupportedDateTime, MaxSupportedDateTime);
- return (dt);
- }
-
-
-
-
-
-
-
-
-
-
-
- public override DateTime AddYears(DateTime time, int years)
- {
- return (AddMonths(time, years * 12));
- }
-
-
-
-
-
-
- public override int GetDayOfMonth(DateTime time)
- {
- return (GetDatePart(time, DatePartDay));
- }
-
-
-
-
-
-
-
-
- public override DayOfWeek GetDayOfWeek(DateTime time)
- {
- return ((DayOfWeek)((int)(time.Ticks / TicksPerDay + 1) % 7));
- }
-
-
-
-
-
-
- public override int GetDayOfYear(DateTime time)
- {
- return (GetDatePart(time, DatePartDayOfYear));
- }
-
-
-
-
-
-
-
-
- public override int GetDaysInMonth(int year, int month, int era)
- {
- CheckYearMonthRange(year, month, era);
-
- if ((HijriYearInfo[year - MinCalendarYear].HijriMonthsLengthFlags & (1 << month - 1)) == 0)
- return 29;
- else
- return 30;
- }
-
- internal int RealGetDaysInYear(int year)
- {
- int days = 0;
- int b;
-
- BCLDebug.Assert((year >= MinCalendarYear) && (year <= MaxCalendarYear), "Hijri year is out of range.");
-
- b = HijriYearInfo[year - MinCalendarYear].HijriMonthsLengthFlags;
-
- for (int m = 1; m <= 12; m++) {
- days = days + 29 + (b & 1);
- b = b >> 1;
- }
- BCLDebug.Assert((days == 354) || (days == 355), "Hijri year has to be 354 or 355 days.");
- return days;
- }
-
-
-
-
-
- public override int GetDaysInYear(int year, int era)
- {
- CheckYearRange(year, era);
- return (RealGetDaysInYear(year));
- }
-
-
-
-
- public override int GetEra(DateTime time)
- {
- CheckTicksRange(time.Ticks);
- return (UmAlQuraEra);
- }
-
-
-
- public override int[] Eras {
- get { return (new int[] {UmAlQuraEra}); }
- }
-
-
-
-
-
-
- public override int GetMonth(DateTime time)
- {
- return (GetDatePart(time, DatePartMonth));
- }
-
-
-
-
- public override int GetMonthsInYear(int year, int era)
- {
- CheckYearRange(year, era);
- return (12);
- }
-
-
-
-
-
-
- public override int GetYear(DateTime time)
- {
- return (GetDatePart(time, DatePartYear));
- }
-
-
-
-
-
-
- public override bool IsLeapDay(int year, int month, int day, int era)
- {
- if (day >= 1 && day <= 29) {
- CheckYearMonthRange(year, month, era);
- return (false);
- }
-
-
- 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 (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);
- if (RealGetDaysInYear(year) == 355)
- return true;
- else
- return false;
- }
-
-
-
-
-
- public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
- {
- if (day >= 1 && day <= 29) {
- CheckYearMonthRange(year, month, era);
- goto DayInRang;
- }
-
-
- 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));
- }
- DayInRang:
- long lDate = GetAbsoluteDateUmAlQura(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 < MinCalendarYear || value > MaxCalendarYear)) {
- throw new ArgumentOutOfRangeException("value", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), MinCalendarYear, MaxCalendarYear));
- }
-
- twoDigitYearMax = value;
- }
- }
-
-
-
- public override int ToFourDigitYear(int year)
- {
- if (year < 100) {
- return (base.ToFourDigitYear(year));
- }
-
- if ((year < MinCalendarYear) || (year > MaxCalendarYear)) {
- throw new ArgumentOutOfRangeException("year", String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), MinCalendarYear, MaxCalendarYear));
- }
- return (year);
- }
- }
- }