You've already forked linux-packaging-mono
Imported Upstream version 4.0.0~alpha1
Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,308 +0,0 @@
|
||||
//
|
||||
// System.Globalization.CharUnicodeInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// (C)2005 Novell Inc,
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
using System;
|
||||
|
||||
namespace System.Globalization
|
||||
{
|
||||
public static class CharUnicodeInfo
|
||||
{
|
||||
public static int GetDecimalDigitValue (char ch)
|
||||
{
|
||||
int i = (int) ch;
|
||||
switch (i) {
|
||||
// They are not decimal digits but are regarded as they were.
|
||||
case 178:
|
||||
return 2;
|
||||
case 179:
|
||||
return 3;
|
||||
case 185:
|
||||
return 1;
|
||||
case 8304:
|
||||
return 0;
|
||||
}
|
||||
|
||||
// They are not decimal digits but are regarded as they were.
|
||||
if (8308 <= i && i < 8314)
|
||||
return i - 8304;
|
||||
if (8320 <= i && i < 8330)
|
||||
return i - 8320;
|
||||
|
||||
if (!Char.IsDigit (ch))
|
||||
return -1;
|
||||
|
||||
if (i < 58)
|
||||
return i - 48;
|
||||
|
||||
if (i < 1642)
|
||||
return i - 1632;
|
||||
if (i < 1786)
|
||||
return i - 1776;
|
||||
if (i < 2416)
|
||||
return i - 2406;
|
||||
if (i < 2544)
|
||||
return i - 2534;
|
||||
if (i < 2672)
|
||||
return i - 2662;
|
||||
if (i < 2800)
|
||||
return i - 2790;
|
||||
if (i < 2928)
|
||||
return i - 2918;
|
||||
if (i < 3056)
|
||||
return i - 3046;
|
||||
if (i < 3184)
|
||||
return i - 3174;
|
||||
if (i < 3312)
|
||||
return i - 3302;
|
||||
if (i < 3440)
|
||||
return i - 3430;
|
||||
if (i < 3674)
|
||||
return i - 3664;
|
||||
if (i < 3802)
|
||||
return i - 3792;
|
||||
if (i < 3882)
|
||||
return i - 3872;
|
||||
if (i < 4170)
|
||||
return i - 4160;
|
||||
if (i < 4978)
|
||||
return i - 4968;
|
||||
if (i < 6122)
|
||||
return i - 6112;
|
||||
if (i < 6170)
|
||||
return i - 6160;
|
||||
if (i < 8314)
|
||||
return i - 8304;
|
||||
if (i < 8330)
|
||||
return i - 8320;
|
||||
if (i < 65296)
|
||||
return -1;
|
||||
if (i < 65306)
|
||||
return i - 65296;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int GetDecimalDigitValue (string s, int index)
|
||||
{
|
||||
if (s == null)
|
||||
throw new ArgumentNullException ("s");
|
||||
return GetDecimalDigitValue (s [index]);
|
||||
}
|
||||
|
||||
public static int GetDigitValue (char ch)
|
||||
{
|
||||
int i = GetDecimalDigitValue (ch);
|
||||
|
||||
if (i >= 0)
|
||||
return i;
|
||||
i = (int) ch;
|
||||
|
||||
if (i == 9450)
|
||||
return 0;
|
||||
|
||||
// They are False in Char.IsDigit(), but returns a digit
|
||||
if (i >= 9312 && i < 9321)
|
||||
return i - 9311;
|
||||
if (i >= 9332 && i < 9341)
|
||||
return i - 9331;
|
||||
if (i >= 9352 && i < 9361)
|
||||
return i - 9351;
|
||||
if (i >= 9461 && i < 9470)
|
||||
return i - 9460;
|
||||
if (i >= 10102 && i < 10111)
|
||||
return i - 10101;
|
||||
if (i >= 10112 && i < 10121)
|
||||
return i - 10111;
|
||||
if (i >= 10122 && i < 10131)
|
||||
return i - 10121;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int GetDigitValue (string s, int index)
|
||||
{
|
||||
if (s == null)
|
||||
throw new ArgumentNullException ("s");
|
||||
return GetDigitValue (s [index]);
|
||||
}
|
||||
|
||||
public static double GetNumericValue (char ch)
|
||||
{
|
||||
int i = GetDigitValue (ch);
|
||||
if (i >= 0)
|
||||
return i;
|
||||
|
||||
i = (int) ch;
|
||||
|
||||
switch (i) {
|
||||
case 188:
|
||||
return 0.25;
|
||||
case 189:
|
||||
return 0.5;
|
||||
case 190:
|
||||
return 0.75;
|
||||
case 2548:
|
||||
return 1;
|
||||
case 2549:
|
||||
return 2;
|
||||
case 2550:
|
||||
return 3;
|
||||
case 2551:
|
||||
return 4;
|
||||
case 2553:
|
||||
return 16;
|
||||
case 3056:
|
||||
return 10;
|
||||
case 3057:
|
||||
return 100;
|
||||
case 3058:
|
||||
return 1000;
|
||||
case 4988:
|
||||
return 10000;
|
||||
case 5870:
|
||||
return 17;
|
||||
case 5871:
|
||||
return 18;
|
||||
case 5872:
|
||||
return 19;
|
||||
case 8531:
|
||||
return 1.0 / 3;
|
||||
case 8532:
|
||||
return 2.0 / 3;
|
||||
case 8537:
|
||||
return 1.0 / 6;
|
||||
case 8538:
|
||||
return 5.0 / 6;
|
||||
case 8539:
|
||||
return 1.0 / 8;
|
||||
case 8540:
|
||||
return 3.0 / 8;
|
||||
case 8541:
|
||||
return 5.0 / 8;
|
||||
case 8542:
|
||||
return 7.0 / 8;
|
||||
case 8543:
|
||||
return 1;
|
||||
case 8556:
|
||||
return 50;
|
||||
case 8557:
|
||||
return 100;
|
||||
case 8558:
|
||||
return 500;
|
||||
case 8559:
|
||||
return 1000;
|
||||
case 8572:
|
||||
return 50;
|
||||
case 8573:
|
||||
return 100;
|
||||
case 8574:
|
||||
return 500;
|
||||
case 8575:
|
||||
return 1000;
|
||||
case 8576:
|
||||
return 1000;
|
||||
case 8577:
|
||||
return 5000;
|
||||
case 8578:
|
||||
return 10000;
|
||||
case 9470: // IsNumber(c) is False BTW.
|
||||
case 10111:
|
||||
case 10121:
|
||||
case 10131:
|
||||
return 10;
|
||||
case 12295:
|
||||
return 0;
|
||||
case 12344:
|
||||
return 10;
|
||||
case 12345:
|
||||
return 20;
|
||||
case 12346:
|
||||
return 30;
|
||||
}
|
||||
|
||||
// They are not True by IsNumber() but regarded as they were.
|
||||
if (9451 <= i && i < 9461)
|
||||
return i - 9440;
|
||||
if (12321 <= i && i < 12330)
|
||||
return i - 12320;
|
||||
if (12881 <= i && i < 12896)
|
||||
return i - 12860;
|
||||
if (12977 <= i && i < 12992)
|
||||
return i - 12941;
|
||||
|
||||
if (!char.IsNumber (ch))
|
||||
return -1;
|
||||
|
||||
if (i < 3891)
|
||||
return 0.5 + i - 3882;
|
||||
if (i < 4988)
|
||||
return (i - 4977) * 10;
|
||||
if (i < 8537)
|
||||
return 0.2 * (i - 8532);
|
||||
if (i < 8556)
|
||||
return i - 8543;
|
||||
if (i < 8572)
|
||||
return i - 8559;
|
||||
if (i < 9332)
|
||||
return i - 9311;
|
||||
if (i < 9352)
|
||||
return i - 9331;
|
||||
if (i < 9372)
|
||||
return i - 9351;
|
||||
if (i < 12694)
|
||||
return i - 12689;
|
||||
if (i < 12842)
|
||||
return i - 12831;
|
||||
if (i < 12938)
|
||||
return i - 12927;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static double GetNumericValue (string s, int index)
|
||||
{
|
||||
if (s == null)
|
||||
throw new ArgumentNullException ("s");
|
||||
return GetNumericValue (s [index]);
|
||||
}
|
||||
|
||||
public static UnicodeCategory GetUnicodeCategory (char ch)
|
||||
{
|
||||
return Char.GetUnicodeCategory (ch);
|
||||
}
|
||||
|
||||
public static UnicodeCategory GetUnicodeCategory (string s, int index)
|
||||
{
|
||||
if (s == null)
|
||||
throw new ArgumentNullException ("s");
|
||||
return Char.GetUnicodeCategory (s, index);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
//
|
||||
// ChineseLunisolarCalendar.cs
|
||||
//
|
||||
// Author
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2007 Novell, Inc. http://www.novell.com
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[Serializable]
|
||||
public class ChineseLunisolarCalendar : EastAsianLunisolarCalendar {
|
||||
internal static readonly CCEastAsianLunisolarEraHandler era_handler;
|
||||
|
||||
static ChineseLunisolarCalendar ()
|
||||
{
|
||||
era_handler = new CCEastAsianLunisolarEraHandler ();
|
||||
era_handler.appendEra (ChineseEra, CCFixed.FromDateTime (new DateTime (1, 1, 1)));
|
||||
}
|
||||
|
||||
public const int ChineseEra = 1;
|
||||
|
||||
[MonoTODO]
|
||||
public ChineseLunisolarCalendar ()
|
||||
: base (era_handler)
|
||||
{
|
||||
}
|
||||
|
||||
[ComVisible (false)]
|
||||
public override int [] Eras {
|
||||
get {
|
||||
return (int []) era_handler.Eras.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
[ComVisible (false)]
|
||||
public override int GetEra (DateTime time) {
|
||||
// M_CheckDateTime not needed, because EraYear does the
|
||||
// right thing.
|
||||
int rd = CCFixed.FromDateTime(time);
|
||||
int era;
|
||||
era_handler.EraYear(out era, rd);
|
||||
return era;
|
||||
}
|
||||
|
||||
static DateTime ChineseMin = new DateTime (1901, 2, 19);
|
||||
// looks like this valus is related to Lunar equation; Current
|
||||
// epact compulation is valid only from 1900 to 2100.
|
||||
static DateTime ChineseMax = new DateTime (2101, 1, 28, 23, 59, 59, 999);
|
||||
|
||||
[ComVisible (false)]
|
||||
public override DateTime MinSupportedDateTime {
|
||||
get {
|
||||
return ChineseMin;
|
||||
}
|
||||
}
|
||||
|
||||
[ComVisible (false)]
|
||||
public override DateTime MaxSupportedDateTime {
|
||||
get {
|
||||
return ChineseMax;
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
protected override int DaysInYearBeforeMinSupportedYear {
|
||||
get{
|
||||
return 384;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
//
|
||||
// System.Globalization.CodePageDataItem.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornél Pál <http://www.kornelpal.hu/>
|
||||
//
|
||||
// Copyright (C) 2006 Kornél Pál
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
//
|
||||
// .NET Framework 1.x serializes encoding properties using this class and
|
||||
// .NET Framework 2.0 can deserialize it but drops the properties.
|
||||
// This class supports serialization compatibility.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace System.Globalization
|
||||
{
|
||||
[Serializable]
|
||||
internal sealed class CodePageDataItem
|
||||
{
|
||||
#pragma warning disable 169
|
||||
private string m_bodyName;
|
||||
private int m_codePage;
|
||||
private int m_dataIndex;
|
||||
private string m_description;
|
||||
private uint m_flags;
|
||||
private string m_headerName;
|
||||
private int m_uiFamilyCodePage;
|
||||
private string m_webName;
|
||||
|
||||
private CodePageDataItem ()
|
||||
{
|
||||
}
|
||||
#pragma warning disable 169
|
||||
}
|
||||
}
|
@ -384,6 +384,11 @@ namespace System.Globalization
|
||||
{
|
||||
return(LCID);
|
||||
}
|
||||
|
||||
internal int GetHashCodeOfString (string source, CompareOptions options)
|
||||
{
|
||||
return GetSortKey (source, options).GetHashCode ();
|
||||
}
|
||||
|
||||
public virtual SortKey GetSortKey(string source)
|
||||
{
|
||||
|
@ -34,6 +34,7 @@ using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace System.Globalization
|
||||
{
|
||||
@ -60,7 +61,7 @@ namespace System.Globalization
|
||||
bool m_useUserOverride;
|
||||
[NonSerialized]
|
||||
volatile NumberFormatInfo numInfo;
|
||||
volatile DateTimeFormatInfo dateTimeInfo;
|
||||
internal volatile DateTimeFormatInfo dateTimeInfo;
|
||||
volatile TextInfo textInfo;
|
||||
private string m_name;
|
||||
|
||||
@ -98,6 +99,9 @@ namespace System.Globalization
|
||||
[NonSerialized]
|
||||
// Used by Thread.set_CurrentCulture
|
||||
internal byte[] cached_serialized_form;
|
||||
|
||||
[NonSerialized]internal CultureData m_cultureData;
|
||||
[NonSerialized]internal bool m_isInherited;
|
||||
|
||||
internal const int InvariantCultureId = 0x7F;
|
||||
const int CalendarTypeBits = 8;
|
||||
@ -299,7 +303,8 @@ namespace System.Globalization
|
||||
//
|
||||
if (parent_lcid == 0x7C04 && EnglishName [EnglishName.Length - 1] == 'y')
|
||||
return parent_culture = new CultureInfo ("zh-Hant");
|
||||
|
||||
else if (parent_lcid == 0x0004 && EnglishName [EnglishName.Length -1] == 'y')
|
||||
return parent_culture = new CultureInfo ("zh-Hans");
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -377,9 +382,7 @@ namespace System.Globalization
|
||||
|
||||
RegionInfo.ClearCachedData ();
|
||||
TimeZone.ClearCachedData ();
|
||||
#if NET_4_5
|
||||
TimeZoneInfo.ClearCachedData ();
|
||||
#endif
|
||||
}
|
||||
|
||||
public virtual object Clone()
|
||||
@ -418,6 +421,11 @@ namespace System.Globalization
|
||||
infos [0] = (CultureInfo) InvariantCulture.Clone ();
|
||||
}
|
||||
|
||||
for (int i = 1; i < infos.Length; ++i) {
|
||||
var ci = infos [i];
|
||||
infos [i].m_cultureData = CultureData.GetCultureData (ci.m_name, false, ci.datetime_index, ci.CalendarType, ci.iso2lang);
|
||||
}
|
||||
|
||||
return infos;
|
||||
}
|
||||
|
||||
@ -482,14 +490,6 @@ namespace System.Globalization
|
||||
|
||||
internal void CheckNeutral ()
|
||||
{
|
||||
#if !NET_4_0
|
||||
if (IsNeutralCulture) {
|
||||
throw new NotSupportedException ("Culture \"" + m_name + "\" is " +
|
||||
"a neutral culture. It can not be used in formatting " +
|
||||
"and parsing and therefore cannot be set as the thread's " +
|
||||
"current culture.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public virtual NumberFormatInfo NumberFormat {
|
||||
@ -527,17 +527,10 @@ namespace System.Globalization
|
||||
if (!constructed) Construct ();
|
||||
CheckNeutral ();
|
||||
|
||||
// TODO: Have to lock because construct_datetime_format is not atomic
|
||||
lock (this) {
|
||||
if (cultureID == InvariantCultureId && m_isReadOnly)
|
||||
dateTimeInfo = DateTimeFormatInfo.InvariantInfo;
|
||||
else if (dateTimeInfo == null) {
|
||||
dateTimeInfo = new DateTimeFormatInfo (this, m_isReadOnly);
|
||||
if (cultureID != InvariantCultureId)
|
||||
construct_datetime_format ();
|
||||
}
|
||||
}
|
||||
|
||||
var temp = new DateTimeFormatInfo (m_cultureData, Calendar);
|
||||
temp.m_isReadOnly = m_isReadOnly;
|
||||
System.Threading.Thread.MemoryBarrier();
|
||||
dateTimeInfo = temp;
|
||||
return dateTimeInfo;
|
||||
}
|
||||
|
||||
@ -612,9 +605,6 @@ namespace System.Globalization
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private extern static CultureInfo [] internal_get_cultures (bool neutral, bool specific, bool installed);
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private extern void construct_datetime_format ();
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private extern void construct_number_format ();
|
||||
|
||||
@ -637,7 +627,7 @@ namespace System.Globalization
|
||||
iso3lang="IVL";
|
||||
iso2lang="iv";
|
||||
win3lang="IVL";
|
||||
default_calendar_type = 1 << CalendarTypeBits;
|
||||
default_calendar_type = 1 << CalendarTypeBits | (int) GregorianCalendarTypes.Localized;
|
||||
}
|
||||
|
||||
private unsafe TextInfo CreateTextInfo (bool readOnly)
|
||||
@ -663,6 +653,7 @@ namespace System.Globalization
|
||||
if (culture == InvariantCultureId) {
|
||||
/* Short circuit the invariant culture */
|
||||
ConstructInvariant (read_only);
|
||||
m_cultureData = CultureData.Invariant;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -670,13 +661,11 @@ namespace System.Globalization
|
||||
//
|
||||
// Be careful not to cause recursive CultureInfo initialization
|
||||
//
|
||||
var msg = string.Format (InvariantCulture, "Culture ID {0} (0x{0:X4}) is not a supported culture.", culture.ToString (InvariantCulture));
|
||||
#if NET_4_0
|
||||
var msg = string.Format (InvariantCulture, "Culture ID {0} (0x{1}) is not a supported culture.", culture.ToString (InvariantCulture), culture.ToString ("X4", InvariantCulture));
|
||||
throw new CultureNotFoundException ("culture", msg);
|
||||
#else
|
||||
throw new ArgumentException (msg, "culture");
|
||||
#endif
|
||||
}
|
||||
|
||||
m_cultureData = CultureData.GetCultureData (m_name, m_useUserOverride, datetime_index, CalendarType, iso2lang);
|
||||
}
|
||||
|
||||
public CultureInfo (string name) : this (name, true) {}
|
||||
@ -692,16 +681,20 @@ namespace System.Globalization
|
||||
constructed = true;
|
||||
m_isReadOnly = read_only;
|
||||
m_useUserOverride = useUserOverride;
|
||||
m_isInherited = GetType() != typeof(System.Globalization.CultureInfo);
|
||||
|
||||
if (name.Length == 0) {
|
||||
/* Short circuit the invariant culture */
|
||||
ConstructInvariant (read_only);
|
||||
m_cultureData = CultureData.Invariant;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!construct_internal_locale_from_name (name.ToLowerInvariant ())) {
|
||||
throw CreateNotFoundException (name);
|
||||
}
|
||||
|
||||
m_cultureData = CultureData.GetCultureData (m_name, useUserOverride, datetime_index, CalendarType, iso2lang);
|
||||
}
|
||||
|
||||
// This is used when creating by specific name and creating by
|
||||
@ -818,6 +811,7 @@ namespace System.Globalization
|
||||
if (ci.IsNeutralCulture)
|
||||
ci = CreateSpecificCultureFromNeutral (ci.Name);
|
||||
|
||||
ci.m_cultureData = CultureData.GetCultureData (ci.m_name, false, ci.datetime_index, ci.CalendarType, ci.iso2lang);
|
||||
return ci;
|
||||
}
|
||||
|
||||
@ -991,6 +985,23 @@ namespace System.Globalization
|
||||
return new CultureInfo (id);
|
||||
}
|
||||
|
||||
internal int CalendarType {
|
||||
get {
|
||||
switch (default_calendar_type >> CalendarTypeBits) {
|
||||
case 1:
|
||||
return Calendar.CAL_GREGORIAN;
|
||||
case 2:
|
||||
return Calendar.CAL_THAI;
|
||||
case 3:
|
||||
return Calendar.CAL_UMALQURA;
|
||||
case 4:
|
||||
return Calendar.CAL_HIJRI;
|
||||
default:
|
||||
throw new NotImplementedException ("CalendarType");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Calendar CreateCalendar (int calendarType)
|
||||
{
|
||||
string name = null;
|
||||
@ -1014,20 +1025,15 @@ namespace System.Globalization
|
||||
|
||||
Type type = Type.GetType (name, false);
|
||||
if (type == null)
|
||||
return CreateCalendar (1 << CalendarTypeBits); // return invariant calandar if not found
|
||||
return new GregorianCalendar (GregorianCalendarTypes.Localized); // return invariant calendar if not found
|
||||
return (Calendar) Activator.CreateInstance (type);
|
||||
}
|
||||
|
||||
static Exception CreateNotFoundException (string name)
|
||||
{
|
||||
#if NET_4_0
|
||||
return new CultureNotFoundException ("name", "Culture name " + name + " is not supported.");
|
||||
#else
|
||||
return new ArgumentException ("Culture name " + name + " is not supported.", "name");
|
||||
#endif
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
public static CultureInfo DefaultThreadCurrentCulture {
|
||||
get {
|
||||
return Thread.default_culture;
|
||||
@ -1045,6 +1051,30 @@ namespace System.Globalization
|
||||
Thread.default_ui_culture = value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#region reference sources
|
||||
// TODO:
|
||||
internal static readonly bool IsTaiwanSku;
|
||||
|
||||
//
|
||||
// CheckDomainSafetyObject throw if the object is customized object which cannot be attached to
|
||||
// other object (like CultureInfo or DateTimeFormatInfo).
|
||||
//
|
||||
|
||||
internal static void CheckDomainSafetyObject(Object obj, Object container)
|
||||
{
|
||||
if (obj.GetType().Assembly != typeof(System.Globalization.CultureInfo).Assembly) {
|
||||
|
||||
throw new InvalidOperationException(
|
||||
String.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
Environment.GetResourceString("InvalidOperation_SubclassedObject"),
|
||||
obj.GetType(),
|
||||
container.GetType()));
|
||||
}
|
||||
Contract.EndContractBlock();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#if NET_4_0
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
@ -118,5 +117,4 @@ namespace System.Globalization {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -48,13 +48,9 @@ namespace System.Globalization {
|
||||
AllCultures = 7,
|
||||
UserCustomCulture = 8,
|
||||
ReplacementCultures = 16,
|
||||
#if NET_4_0
|
||||
[Obsolete]
|
||||
#endif
|
||||
WindowsOnlyCultures = 32,
|
||||
#if NET_4_0
|
||||
[Obsolete]
|
||||
#endif
|
||||
FrameworkCultures = 64,
|
||||
} // CultureTypes
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,70 +0,0 @@
|
||||
//
|
||||
// System.Globalization.DaylightTime
|
||||
//
|
||||
// Author:
|
||||
// Chris Hynes (chrish@assistedsolutions.com)
|
||||
//
|
||||
// (C) 2001 Chris Hynes
|
||||
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
namespace System.Globalization
|
||||
{
|
||||
[System.Runtime.InteropServices.ComVisible (true)]
|
||||
[Serializable]
|
||||
public class DaylightTime
|
||||
{
|
||||
DateTime m_start, m_end;
|
||||
TimeSpan m_delta;
|
||||
|
||||
public DaylightTime(DateTime start, DateTime end, TimeSpan delta)
|
||||
{
|
||||
m_start = start;
|
||||
m_end = end;
|
||||
m_delta = delta;
|
||||
}
|
||||
|
||||
public DateTime Start
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_start;
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime End
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_end;
|
||||
}
|
||||
}
|
||||
|
||||
public TimeSpan Delta
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,242 +0,0 @@
|
||||
//
|
||||
// System.Globalization.EastAsianLunisolarCalendar.cs
|
||||
//
|
||||
// Author
|
||||
// Ulrich Kunitz 2002
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// (C) Ulrich Kunitz 2002
|
||||
// Copyright (C) 2007 Novell, Inc. http://www.novell.com
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
using System;
|
||||
|
||||
[Serializable]
|
||||
[System.Runtime.InteropServices.ComVisible (true)]
|
||||
public abstract class EastAsianLunisolarCalendar : Calendar {
|
||||
// FIXME: This is ok and it does not have to be something like
|
||||
// CCEastAsianLunisolarEraHandler since it does not depend on
|
||||
// any lunisolar stuff.
|
||||
internal readonly CCEastAsianLunisolarEraHandler M_EraHandler;
|
||||
|
||||
internal EastAsianLunisolarCalendar (CCEastAsianLunisolarEraHandler eraHandler)
|
||||
{
|
||||
M_EraHandler = eraHandler;
|
||||
}
|
||||
|
||||
public override int TwoDigitYearMax
|
||||
{
|
||||
get {
|
||||
return twoDigitYearMax;
|
||||
}
|
||||
set {
|
||||
CheckReadOnly ();
|
||||
M_ArgumentInRange ("value", value, 100, M_MaxYear);
|
||||
|
||||
twoDigitYearMax = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal void M_CheckDateTime(DateTime time) {
|
||||
M_EraHandler.CheckDateTime(time);
|
||||
}
|
||||
|
||||
internal virtual int ActualCurrentEra {
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
internal void M_CheckEra(ref int era) {
|
||||
if (era == CurrentEra)
|
||||
era = ActualCurrentEra;
|
||||
if (!M_EraHandler.ValidEra(era))
|
||||
throw new ArgumentException("Era value was not valid.");
|
||||
}
|
||||
|
||||
internal int M_CheckYEG(int year, ref int era) {
|
||||
M_CheckEra(ref era);
|
||||
return M_EraHandler.GregorianYear(year, era);
|
||||
}
|
||||
|
||||
internal override void M_CheckYE(int year, ref int era) {
|
||||
M_CheckYEG(year, ref era);
|
||||
}
|
||||
|
||||
internal int M_CheckYMEG(int year, int month, ref int era) {
|
||||
int gregorianYear = M_CheckYEG(year, ref era);
|
||||
if (month < 1 || month > 12)
|
||||
throw new ArgumentOutOfRangeException("month",
|
||||
"Month must be between one and twelve.");
|
||||
return gregorianYear;
|
||||
}
|
||||
|
||||
internal int M_CheckYMDEG(int year, int month, int day, ref int era)
|
||||
{
|
||||
int gregorianYear = M_CheckYMEG(year, month, ref era);
|
||||
M_ArgumentInRange("day", day, 1, GetDaysInMonth(year, month, era));
|
||||
return gregorianYear;
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override DateTime AddMonths(DateTime time, int months) {
|
||||
DateTime t = CCEastAsianLunisolarCalendar.AddMonths(time, months);
|
||||
M_CheckDateTime(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override DateTime AddYears(DateTime time, int years) {
|
||||
DateTime t = CCEastAsianLunisolarCalendar.AddYears(time, years);
|
||||
M_CheckDateTime(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override int GetDayOfMonth(DateTime time) {
|
||||
M_CheckDateTime(time);
|
||||
return CCEastAsianLunisolarCalendar.GetDayOfMonth(time);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override DayOfWeek GetDayOfWeek(DateTime time) {
|
||||
M_CheckDateTime(time);
|
||||
int rd = CCFixed.FromDateTime(time);
|
||||
return (DayOfWeek)CCFixed.day_of_week(rd);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override int GetDayOfYear(DateTime time) {
|
||||
M_CheckDateTime(time);
|
||||
return CCEastAsianLunisolarCalendar.GetDayOfYear(time);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override int GetDaysInMonth(int year, int month, int era) {
|
||||
int gregorianYear = M_CheckYMEG(year, month, ref era);
|
||||
return CCEastAsianLunisolarCalendar.GetDaysInMonth(gregorianYear, month);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override int GetDaysInYear(int year, int era) {
|
||||
int gregorianYear = M_CheckYEG(year, ref era);
|
||||
return CCEastAsianLunisolarCalendar.GetDaysInYear(gregorianYear);
|
||||
}
|
||||
|
||||
|
||||
[MonoTODO]
|
||||
public override int GetLeapMonth(int year, int era)
|
||||
{
|
||||
return base.GetLeapMonth(year, era);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override int GetMonth(DateTime time) {
|
||||
M_CheckDateTime(time);
|
||||
return CCEastAsianLunisolarCalendar.GetMonth(time);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override int GetMonthsInYear(int year, int era) {
|
||||
M_CheckYE(year, ref era);
|
||||
return IsLeapYear (year, era) ? 13: 12;
|
||||
}
|
||||
|
||||
public override int GetYear(DateTime time) {
|
||||
// M_CheckDateTime not needed, because EraYeat does the
|
||||
// right thing.
|
||||
int rd = CCFixed.FromDateTime(time);
|
||||
int era;
|
||||
return M_EraHandler.EraYear(out era, rd);
|
||||
}
|
||||
|
||||
public override bool IsLeapDay(int year, int month, int day, int era)
|
||||
{
|
||||
int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
|
||||
// every day in LeapMonth is a LeapDay.
|
||||
return CCEastAsianLunisolarCalendar.IsLeapMonth (gregorianYear, month);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override bool IsLeapMonth(int year, int month, int era) {
|
||||
int gregorianYear = M_CheckYMEG(year, month, ref era);
|
||||
return CCEastAsianLunisolarCalendar.IsLeapMonth(gregorianYear, month);
|
||||
}
|
||||
|
||||
public override bool IsLeapYear(int year, int era) {
|
||||
int gregorianYear = M_CheckYEG(year, ref era);
|
||||
return CCEastAsianLunisolarCalendar.IsLeapYear (gregorianYear);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override DateTime ToDateTime(int year, int month, int day,
|
||||
int hour, int minute, int second, int millisecond,
|
||||
int era)
|
||||
{
|
||||
int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
|
||||
M_CheckHMSM(hour, minute, second, millisecond);
|
||||
return CCGregorianCalendar.ToDateTime(
|
||||
gregorianYear, month, day,
|
||||
hour, minute, second, millisecond);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override int ToFourDigitYear(int year) {
|
||||
if (year < 0)
|
||||
throw new ArgumentOutOfRangeException(
|
||||
"year", "Non-negative number required.");
|
||||
int era = CurrentEra;
|
||||
M_CheckYE(year, ref era);
|
||||
return year;
|
||||
}
|
||||
|
||||
public override CalendarAlgorithmType AlgorithmType {
|
||||
get {
|
||||
return CalendarAlgorithmType.LunisolarCalendar;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region celestial/terrestial thingy
|
||||
public int GetCelestialStem (int sexagenaryYear)
|
||||
{
|
||||
if (sexagenaryYear < 1 || 60 < sexagenaryYear)
|
||||
throw new ArgumentOutOfRangeException ("sexagendaryYear is less than 0 or greater than 60");
|
||||
return (sexagenaryYear - 1) % 10 + 1;
|
||||
}
|
||||
|
||||
public virtual int GetSexagenaryYear (DateTime time)
|
||||
{
|
||||
return (GetYear (time) - 1900) % 60;
|
||||
}
|
||||
|
||||
public int GetTerrestrialBranch (int sexagenaryYear)
|
||||
{
|
||||
if (sexagenaryYear < 1 || 60 < sexagenaryYear)
|
||||
throw new ArgumentOutOfRangeException ("sexagendaryYear is less than 0 or greater than 60");
|
||||
return (sexagenaryYear - 1) % 12 + 1;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,103 +0,0 @@
|
||||
//
|
||||
// JapaneseLunisolarCalendar.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2007 Novell, Inc. http://www.novell.com
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[Serializable]
|
||||
public class JapaneseLunisolarCalendar : EastAsianLunisolarCalendar {
|
||||
internal static readonly CCEastAsianLunisolarEraHandler era_handler;
|
||||
|
||||
static JapaneseLunisolarCalendar ()
|
||||
{
|
||||
era_handler = new CCEastAsianLunisolarEraHandler ();
|
||||
// I keep using Gregorian here, just to make them consistent
|
||||
// with JapaneseCalendar.
|
||||
era_handler.appendEra(3,
|
||||
CCGregorianCalendar.fixed_from_dmy(25, 12, 1926),
|
||||
CCGregorianCalendar.fixed_from_dmy(7, 1, 1989));
|
||||
era_handler.appendEra(4,
|
||||
CCGregorianCalendar.fixed_from_dmy(8, 1, 1989));
|
||||
}
|
||||
|
||||
public const int JapaneseEra = 1;
|
||||
|
||||
internal override int ActualCurrentEra {
|
||||
get { return 4; }
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public JapaneseLunisolarCalendar ()
|
||||
: base (era_handler)
|
||||
{
|
||||
}
|
||||
|
||||
public override int [] Eras {
|
||||
get {
|
||||
return (int []) era_handler.Eras.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetEra (DateTime time) {
|
||||
// M_CheckDateTime not needed, because EraYear does the
|
||||
// right thing.
|
||||
int rd = CCFixed.FromDateTime(time);
|
||||
int era;
|
||||
era_handler.EraYear(out era, rd);
|
||||
return era;
|
||||
}
|
||||
|
||||
static DateTime JapanMin = new DateTime (1960, 1, 28, 0, 0, 0);
|
||||
static DateTime JapanMax = new DateTime (2050, 1, 22, 23, 59, 59);
|
||||
|
||||
public override DateTime MinSupportedDateTime {
|
||||
get {
|
||||
return JapanMin;
|
||||
}
|
||||
}
|
||||
|
||||
public override DateTime MaxSupportedDateTime {
|
||||
get {
|
||||
return JapanMax;
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
protected override int DaysInYearBeforeMinSupportedYear {
|
||||
get{
|
||||
return 354;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,93 +0,0 @@
|
||||
//
|
||||
// KoreanLunisolarCalendar.cs
|
||||
//
|
||||
// Author:
|
||||
// Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2007 Novell, Inc. http://www.novell.com
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
namespace System.Globalization {
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[Serializable]
|
||||
public class KoreanLunisolarCalendar : EastAsianLunisolarCalendar {
|
||||
internal static readonly CCEastAsianLunisolarEraHandler era_handler;
|
||||
|
||||
static KoreanLunisolarCalendar ()
|
||||
{
|
||||
era_handler = new CCEastAsianLunisolarEraHandler ();
|
||||
era_handler.appendEra (GregorianEra, CCFixed.FromDateTime (new DateTime (1, 1, 1)));
|
||||
}
|
||||
|
||||
public const int GregorianEra = 1;
|
||||
|
||||
[MonoTODO]
|
||||
public KoreanLunisolarCalendar ()
|
||||
: base (era_handler)
|
||||
{
|
||||
}
|
||||
|
||||
public override int [] Eras {
|
||||
get {
|
||||
return (int []) era_handler.Eras.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetEra (DateTime time) {
|
||||
// M_CheckDateTime not needed, because EraYear does the
|
||||
// right thing.
|
||||
int rd = CCFixed.FromDateTime(time);
|
||||
int era;
|
||||
era_handler.EraYear(out era, rd);
|
||||
return era;
|
||||
}
|
||||
|
||||
static DateTime KoreanMin = new DateTime (918, 2, 14, 0, 0, 0);
|
||||
static DateTime KoreanMax = new DateTime (2051, 2, 10, 23, 59, 59);
|
||||
|
||||
public override DateTime MinSupportedDateTime {
|
||||
get {
|
||||
return KoreanMin;
|
||||
}
|
||||
}
|
||||
|
||||
public override DateTime MaxSupportedDateTime {
|
||||
get {
|
||||
return KoreanMax;
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
protected override int DaysInYearBeforeMinSupportedYear {
|
||||
get{
|
||||
return 384;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user