GetDayOfWeek() private static method

private static GetDayOfWeek ( int year, int month, int targetDayOfWeek, int numberOfSunday, int hour, int minute, int second, int millisecond ) : System.DateTime
year int
month int
targetDayOfWeek int
numberOfSunday int
hour int
minute int
second int
millisecond int
return System.DateTime
Example #1
0
        public override DaylightTime GetDaylightChanges(int year)
        {
            if (year < 1 || year > 9999)
            {
                throw new ArgumentOutOfRangeException("year", Environment.GetResourceString("ArgumentOutOfRange_Range", (object)1, (object)9999));
            }
            object key = (object)year;

            if (!this.m_CachedDaylightChanges.Contains(key))
            {
                lock (CurrentSystemTimeZone.InternalSyncObject)
                {
                    if (!this.m_CachedDaylightChanges.Contains(key))
                    {
                        short[] local_3 = CurrentSystemTimeZone.nativeGetDaylightChanges(year);
                        if (local_3 == null)
                        {
                            this.m_CachedDaylightChanges.Add(key, (object)new DaylightTime(DateTime.MinValue, DateTime.MinValue, TimeSpan.Zero));
                        }
                        else
                        {
                            DateTime     temp_65  = CurrentSystemTimeZone.GetDayOfWeek(year, (uint)local_3[0] > 0U, (int)local_3[1], (int)local_3[2], (int)local_3[3], (int)local_3[4], (int)local_3[5], (int)local_3[6], (int)local_3[7]);
                            DateTime     local_4  = CurrentSystemTimeZone.GetDayOfWeek(year, (uint)local_3[8] > 0U, (int)local_3[9], (int)local_3[10], (int)local_3[11], (int)local_3[12], (int)local_3[13], (int)local_3[14], (int)local_3[15]);
                            TimeSpan     local_5  = new TimeSpan((long)local_3[16] * 600000000L);
                            DateTime     temp_102 = local_4;
                            TimeSpan     temp_103 = local_5;
                            DaylightTime local_6  = new DaylightTime(temp_65, temp_102, temp_103);
                            this.m_CachedDaylightChanges.Add(key, (object)local_6);
                        }
                    }
                }
            }
            return((DaylightTime)this.m_CachedDaylightChanges[key]);
        }
Example #2
0
        public override DaylightTime GetDaylightChanges(int year)
        {
            if (year < 1 || year > 9999)
            {
                throw new ArgumentOutOfRangeException("year", Environment.GetResourceString("ArgumentOutOfRange_Range", new object[]
                {
                    1,
                    9999
                }));
            }
            object key = year;

            if (!this.m_CachedDaylightChanges.Contains(key))
            {
                object internalSyncObject = CurrentSystemTimeZone.InternalSyncObject;
                lock (internalSyncObject)
                {
                    if (!this.m_CachedDaylightChanges.Contains(key))
                    {
                        short[] array = CurrentSystemTimeZone.nativeGetDaylightChanges(year);
                        if (array == null)
                        {
                            this.m_CachedDaylightChanges.Add(key, new DaylightTime(DateTime.MinValue, DateTime.MinValue, TimeSpan.Zero));
                        }
                        else
                        {
                            DateTime     dayOfWeek  = CurrentSystemTimeZone.GetDayOfWeek(year, array[0] != 0, (int)array[1], (int)array[2], (int)array[3], (int)array[4], (int)array[5], (int)array[6], (int)array[7]);
                            DateTime     dayOfWeek2 = CurrentSystemTimeZone.GetDayOfWeek(year, array[8] != 0, (int)array[9], (int)array[10], (int)array[11], (int)array[12], (int)array[13], (int)array[14], (int)array[15]);
                            TimeSpan     delta      = new TimeSpan((long)array[16] * 600000000L);
                            DaylightTime value      = new DaylightTime(dayOfWeek, dayOfWeek2, delta);
                            this.m_CachedDaylightChanges.Add(key, value);
                        }
                    }
                }
            }
            return((DaylightTime)this.m_CachedDaylightChanges[key]);
        }