public KoreanCalendar()
 {
     try
     {
         new CultureInfo("ko-KR");
     }
     catch (ArgumentException e)
     {
         throw new TypeInitializationException(this.GetType().ToString(), e);
     }
     helper = new GregorianCalendarHelper(this, koreanEraInfo);
 }
Exemple #2
0
 public JapaneseCalendar()
 {
     try
     {
         new CultureInfo("ja-JP");
     }
     catch (ArgumentException e)
     {
         throw new TypeInitializationException(this.GetType().ToString(), e);
     }
     helper = new GregorianCalendarHelper(this, GetEraInfo());
 }
Exemple #3
0
 /// <summary>初始化 <see cref="T:System.Globalization.JapaneseCalendar" /> 类的新实例。</summary>
 /// <exception cref="T:System.TypeInitializationException">由于缺少区域性信息,所以无法初始化 <see cref="T:System.Globalization.JapaneseCalendar" /> 对象。</exception>
 public JapaneseCalendar()
 {
     try
     {
         CultureInfo cultureInfo = new CultureInfo("ja-JP");
     }
     catch (ArgumentException ex)
     {
         throw new TypeInitializationException(this.GetType().FullName, (Exception)ex);
     }
     this.helper = new GregorianCalendarHelper((Calendar)this, JapaneseCalendar.GetEraInfo());
 }
 public TaiwanCalendar()
 {
     try
     {
         new CultureInfo("zh-TW");
     }
     catch (ArgumentException exception)
     {
         throw new TypeInitializationException(base.GetType().FullName, exception);
     }
     this.helper = new GregorianCalendarHelper(this, taiwanEraInfo);
 }
Exemple #5
0
 /// <summary>初始化 <see cref="T:System.Globalization.KoreanCalendar" /> 类的新实例。</summary>
 /// <exception cref="T:System.TypeInitializationException">由于缺少区域性信息,所以无法初始化 <see cref="T:System.Globalization.KoreanCalendar" /> 对象。</exception>
 public KoreanCalendar()
 {
     try
     {
         CultureInfo cultureInfo = new CultureInfo("ko-KR");
     }
     catch (ArgumentException ex)
     {
         throw new TypeInitializationException(this.GetType().FullName, (Exception)ex);
     }
     this.helper = new GregorianCalendarHelper((Calendar)this, KoreanCalendar.koreanEraInfo);
 }
 public TaiwanCalendar()
 {
     try
     {
         new CultureInfo("zh-TW");
     }
     catch (ArgumentException exception)
     {
         throw new TypeInitializationException(base.GetType().FullName, exception);
     }
     this.helper = new GregorianCalendarHelper(this, taiwanEraInfo);
 }
Exemple #7
0
 public KoreanCalendar()
 {
     try
     {
         new CultureInfo("ko-KR");
     }
     catch (ArgumentException e)
     {
         throw new TypeInitializationException(this.GetType().ToString(), e);
     }
     helper = new GregorianCalendarHelper(this, koreanEraInfo);
 }
        public TaiwanCalendar()
        {
            try
            {
                new CultureInfo("zh-TW");
            }
            catch (ArgumentException e)
            {
                throw new TypeInitializationException(GetType().ToString(), e);
            }

            _helper = new GregorianCalendarHelper(this, s_taiwanEraInfo);
        }
        static KoreanCalendar()
        {
            m_EraInfo = new EraInfo[1];
            // Since
            //    Gregorian Year = Era Year + yearOffset
            // Gregorian Year 1 is Korean year 2334, so that
            //    1 = 2334 + yearOffset
            //  So yearOffset = -2333
            // Gregorian year 2001 is Korean year 4334.

            //m_EraInfo[0] = new EraInfo(1, new DateTime(1, 1, 1).Ticks, -2333, 2334, GregorianCalendar.MaxYear + 2333);
            m_EraInfo = GregorianCalendarHelper.InitEraInfo(Calendar.CAL_KOREA);
        }
        public DateTime AddMonths(DateTime time, int months)
        {
            if (months < -120000 || months > 120000)
            {
                throw new ArgumentOutOfRangeException("months", string.Format((IFormatProvider)CultureInfo.CurrentCulture, Environment.GetResourceString("ArgumentOutOfRange_Range"), (object)-120000, (object)120000));
            }
            this.CheckTicksRange(time.Ticks);
            int datePart1 = this.GetDatePart(time.Ticks, 0);
            int datePart2 = this.GetDatePart(time.Ticks, 2);
            int day       = this.GetDatePart(time.Ticks, 3);
            int num1      = datePart2 - 1 + months;
            int month;
            int year;

            if (num1 >= 0)
            {
                month = num1 % 12 + 1;
                year  = datePart1 + num1 / 12;
            }
            else
            {
                month = 12 + (num1 + 1) % 12;
                year  = datePart1 + (num1 - 11) / 12;
            }
            int[] numArray = year % 4 != 0 || year % 100 == 0 && year % 400 != 0 ? GregorianCalendarHelper.DaysToMonth365 : GregorianCalendarHelper.DaysToMonth366;
            int   num2     = numArray[month] - numArray[month - 1];

            if (day > num2)
            {
                day = num2;
            }
            long     ticks = GregorianCalendarHelper.DateToTicks(year, month, day) + time.Ticks % 864000000000L;
            DateTime supportedDateTime1 = this.m_Cal.MinSupportedDateTime;
            DateTime supportedDateTime2 = this.m_Cal.MaxSupportedDateTime;

            Calendar.CheckAddResult(ticks, supportedDateTime1, supportedDateTime2);
            return(new DateTime(ticks));
        }
 public ThaiBuddhistCalendar()
 {
     helper = new GregorianCalendarHelper(this, thaiBuddhistEraInfo);
 }
 // Construct an instance of JapaneseLunisolar calendar.
 public JapaneseLunisolarCalendar()
 {
     helper = new GregorianCalendarHelper(this, TrimEras(JapaneseCalendar.GetEraInfo()));
 }
 internal static long DateToTicks(int year, int month, int day)
 {
     return(GregorianCalendarHelper.GetAbsoluteDate(year, month, day) * 864000000000L);
 }
 /// <include file='doc\JapaneseCalendar.uex' path='docs/doc[@for="JapaneseCalendar.JapaneseCalendar"]/*' />
 public JapaneseCalendar()
 {
     helper = new GregorianCalendarHelper(this, m_EraInfo);
 }
        // The era value of the current era.

        static JapaneseCalendar()
        {
            m_EraInfo = GregorianCalendarHelper.InitEraInfo(Calendar.CAL_JAPAN);
        }
Exemple #16
0
 /// <summary>初始化 <see cref="T:System.Globalization.ThaiBuddhistCalendar" /> 类的新实例。</summary>
 public ThaiBuddhistCalendar()
 {
     this.helper = new GregorianCalendarHelper((Calendar)this, ThaiBuddhistCalendar.thaiBuddhistEraInfo);
 }
 public TaiwanCalendar() {
     helper = new GregorianCalendarHelper(this, m_EraInfo);
 }
        /*=================================GetDefaultInstance==========================
        **Action: Internal method to provide a default intance of TaiwanLunisolarCalendar.  Used by NLS+ implementation
        **       and other calendars.
        **Returns:
        **Arguments:
        **Exceptions:
        ============================================================================*/
        /*
        internal static Calendar GetDefaultInstance()
        {
            if (m_defaultInstance == null) {
                m_defaultInstance = new TaiwanLunisolarCalendar();
            }
            return (m_defaultInstance);
        }
        */

        // Construct an instance of TaiwanLunisolar calendar.

        public TaiwanLunisolarCalendar() {
            helper = new GregorianCalendarHelper(this, taiwanLunisolarEraInfo);
        }
 public JapaneseCalendar() {
     try {
         new CultureInfo("ja-JP");
     } catch (ArgumentException e) {
         throw new TypeInitializationException(this.GetType().FullName, e);
     }
     helper = new GregorianCalendarHelper(this, GetEraInfo());
 }
        /*=================================GetDefaultInstance==========================
        **Action: Internal method to provide a default intance of JapaneseLunisolarCalendar.  Used by NLS+ implementation
        **       and other calendars.
        **Returns:
        **Arguments:
        **Exceptions:
        ============================================================================*/
        /*
        internal static Calendar GetDefaultInstance()
        {
            if (m_defaultInstance == null) {
                m_defaultInstance = new JapaneseLunisolarCalendar();
            }
            return (m_defaultInstance);
        }
        */

        // Construct an instance of JapaneseLunisolar calendar.

        public JapaneseLunisolarCalendar() {
            helper = new GregorianCalendarHelper(this, m_EraInfo);
        }
 public ThaiBuddhistCalendar() {
     helper = new GregorianCalendarHelper(this, thaiBuddhistEraInfo);
 }
 public TaiwanLunisolarCalendar()
 {
     this.helper = new GregorianCalendarHelper(this, taiwanLunisolarEraInfo);
 }
 /// <include file='doc\KoreanCalendar.uex' path='docs/doc[@for="KoreanCalendar.KoreanCalendar1"]/*' />
 public KoreanCalendar()
 {
     helper = new GregorianCalendarHelper(this, m_EraInfo);
 }
 public JapaneseLunisolarCalendar()
 {
     this.helper = new GregorianCalendarHelper(this, TrimEras(JapaneseCalendar.GetEraInfo()));
 }