GetDefaultInstance() static private méthode

static private GetDefaultInstance ( ) : Calendar
Résultat Calendar
Exemple #1
0
        internal DateTime LunarToTime(DateTime time, int year, int month, int day)
        {
            int gy = 0; int gm = 0; int gd = 0;

            LunarToGregorian(year, month, day, ref gy, ref gm, ref gd);
            return(GregorianCalendar.GetDefaultInstance().ToDateTime(gy, gm, gd, time.Hour, time.Minute, time.Second, time.Millisecond));
        }
        //This function exists as a hack to prevent us from loading all of the non-gregorian
        //calendars unless they're required.
        internal Calendar GetCalendarInstanceRare(int calType)
        {
            BCLDebug.Assert(calType != Calendar.CAL_GREGORIAN, "calType!=Calendar.CAL_GREGORIAN");

            switch (calType)
            {
            case Calendar.CAL_GREGORIAN_US:                   // Gregorian (U.S.) calendar
            case Calendar.CAL_GREGORIAN_ME_FRENCH:            // Gregorian Middle East French calendar
            case Calendar.CAL_GREGORIAN_ARABIC:               // Gregorian Arabic calendar
            case Calendar.CAL_GREGORIAN_XLIT_ENGLISH:         // Gregorian Transliterated English calendar
            case Calendar.CAL_GREGORIAN_XLIT_FRENCH:          // Gregorian Transliterated French calendar
                return(new GregorianCalendar((GregorianCalendarTypes)calType));

            case Calendar.CAL_TAIWAN:                         // Taiwan Era calendar
                return(TaiwanCalendar.GetDefaultInstance());

            case Calendar.CAL_JAPAN:                          // Japanese Emperor Era calendar
                return(JapaneseCalendar.GetDefaultInstance());

            case Calendar.CAL_KOREA:                          // Korean Tangun Era calendar
                return(KoreanCalendar.GetDefaultInstance());

            case Calendar.CAL_HIJRI:                          // Hijri (Arabic Lunar) calendar
                return(HijriCalendar.GetDefaultInstance());

            case Calendar.CAL_THAI:                           // Thai calendar
                return(ThaiBuddhistCalendar.GetDefaultInstance());

            case Calendar.CAL_HEBREW:                         // Hebrew (Lunar) calendar
                return(HebrewCalendar.GetDefaultInstance());
            }
            return(GregorianCalendar.GetDefaultInstance());
        }
 public virtual int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
 {
     CheckTicksRange(time.Ticks);
     // Use GregorianCalendar to get around the problem that the implmentation in Calendar.GetWeekOfYear()
     // can call GetYear() that exceeds the supported range of the Gregorian-based calendars.
     return(GregorianCalendar.GetDefaultInstance().GetWeekOfYear(time, rule, firstDayOfWeek));
 }
 /*=================================GetCalendarInstance==========================
  **Action: Map a Win32 CALID to an instance of supported calendar.
  **Returns: An instance of calendar.
  **Arguments: calType    The Win32 CALID
  **Exceptions:
  **      Shouldn't throw exception since the calType value is from our data table or from Win32 registry.
  **      If we are in trouble (like getting a weird value from Win32 registry), just return the GregorianCalendar.
  **============================================================================*/
 internal Calendar GetCalendarInstance(int calType)
 {
     if (calType == Calendar.CAL_GREGORIAN)
     {
         return(GregorianCalendar.GetDefaultInstance());
     }
     return(GetCalendarInstanceRare(calType));
 }
        internal DateTime LunarToTime(DateTime time, int year, int month, int day)
        {
            int nSolarYear  = 0;
            int nSolarMonth = 0;
            int nSolarDay   = 0;

            this.LunarToGregorian(year, month, day, ref nSolarYear, ref nSolarMonth, ref nSolarDay);
            return(GregorianCalendar.GetDefaultInstance().ToDateTime(nSolarYear, nSolarMonth, nSolarDay, time.Hour, time.Minute, time.Second, time.Millisecond));
        }
Exemple #6
0
        // Token: 0x06002F19 RID: 12057 RVA: 0x000B4AF4 File Offset: 0x000B2CF4
        internal void TimeToLunar(DateTime time, ref int year, ref int month, ref int day)
        {
            Calendar defaultInstance = GregorianCalendar.GetDefaultInstance();
            int      year2           = defaultInstance.GetYear(time);
            int      month2          = defaultInstance.GetMonth(time);
            int      dayOfMonth      = defaultInstance.GetDayOfMonth(time);

            this.GregorianToLunar(year2, month2, dayOfMonth, ref year, ref month, ref day);
        }
Exemple #7
0
        // Token: 0x06002F18 RID: 12056 RVA: 0x000B4AA4 File Offset: 0x000B2CA4
        internal DateTime LunarToTime(DateTime time, int year, int month, int day)
        {
            int year2  = 0;
            int month2 = 0;
            int day2   = 0;

            this.LunarToGregorian(year, month, day, ref year2, ref month2, ref day2);
            return(GregorianCalendar.GetDefaultInstance().ToDateTime(year2, month2, day2, time.Hour, time.Minute, time.Second, time.Millisecond));
        }
Exemple #8
0
        internal void TimeToLunar(DateTime time, ref int year, ref int month, ref int day)
        {
            int gy = 0; int gm = 0; int gd = 0;

            Calendar Greg = GregorianCalendar.GetDefaultInstance();

            gy = Greg.GetYear(time);
            gm = Greg.GetMonth(time);
            gd = Greg.GetDayOfMonth(time);

            GregorianToLunar(gy, gm, gd, ref year, ref month, ref day);
        }
        internal void TimeToLunar(DateTime time, ref int year, ref int month, ref int day)
        {
            int      nSYear          = 0;
            int      nSMonth         = 0;
            int      nSDate          = 0;
            Calendar defaultInstance = GregorianCalendar.GetDefaultInstance();

            nSYear  = defaultInstance.GetYear(time);
            nSMonth = defaultInstance.GetMonth(time);
            nSDate  = defaultInstance.GetDayOfMonth(time);
            this.GregorianToLunar(nSYear, nSMonth, nSDate, ref year, ref month, ref day);
        }
        internal void TimeToLunar(DateTime time, ref int year, ref int month, ref int day)
        {
            Calendar defaultInstance = GregorianCalendar.GetDefaultInstance();
            DateTime time1           = time;
            int      year1           = defaultInstance.GetYear(time1);
            DateTime time2           = time;
            int      month1          = defaultInstance.GetMonth(time2);
            DateTime time3           = time;
            int      dayOfMonth      = defaultInstance.GetDayOfMonth(time3);

            this.GregorianToLunar(year1, month1, dayOfMonth, ref year, ref month, ref day);
        }
Exemple #11
0
 public virtual int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
 {
     this.CheckTicksRange(time.Ticks);
     return(GregorianCalendar.GetDefaultInstance().GetWeekOfYear(time, rule, firstDayOfWeek));
 }