public InternalDomain ToInternal(this PublicDomain e)
 {
     return((InternalDomain)e);
 }
Пример #2
0
 private static int SortZonesComparison(PublicDomain.TzDatabase.TzZone x, PublicDomain.TzDatabase.TzZone y)
 {
     return x.CompareTo(y);
 }
Пример #3
0
        private static string SortZones(string zonesArray, PublicDomain.TzDatabase.TzZone[] zones)
        {
            if (zones.Length > 0)
            {
                // First remove any duplicates
                List<PublicDomain.TzDatabase.TzZone> tempZones = new List<PublicDomain.TzDatabase.TzZone>(zones);
                ArrayUtilities.RemoveDuplicates<PublicDomain.TzDatabase.TzZone>(tempZones);

                tempZones.Sort(SortZonesComparison);

                foreach (PublicDomain.TzDatabase.TzZone zoneData in tempZones)
                {
                    if (zonesArray.Length > 0)
                    {
                        zonesArray += ",";
                    }
                    zonesArray += zoneData.GetObjectString();
                }
                zonesArray = "new List<PublicDomain.TzDatabase.TzZone>(new PublicDomain.TzDatabase.TzZone[] {" + zonesArray + "})";
            }
            else
            {
                zonesArray = "null";
            }
            return zonesArray;
        }
Пример #4
0
        private static string SortRules(string rulesArray, PublicDomain.TzDatabase.TzRule[] rules)
        {
            if (rules.Length > 0)
            {
                // First remove any duplicates
                List<PublicDomain.TzDatabase.TzRule> tempRules = new List<PublicDomain.TzDatabase.TzRule>(rules);
                ArrayUtilities.RemoveDuplicates<PublicDomain.TzDatabase.TzRule>(tempRules);

                // Next, sort the items
                tempRules.Sort(SortRulesComparison);

                foreach (PublicDomain.TzDatabase.TzRule rule in tempRules)
                {
                    if (rulesArray.Length > 0)
                    {
                        rulesArray += ",";
                    }
                    rulesArray += rule.GetObjectString();
                }
                rulesArray = "new List<PublicDomain.TzDatabase.TzRule>(new PublicDomain.TzDatabase.TzRule[] {" + rulesArray + "})";
            }
            else
            {
                rulesArray = "null";
            }
            return rulesArray;
        }
Пример #5
0
        private void PrepOffset(ref DateTime time, ref TimeSpan result, PublicDomain.TzDatabase.TzZone zone)
        {
            // First, figure out which zone we're in
            DateTime point = new DateTime(time.Year, 1, 1);

            PublicDomain.TzDatabase.TzRule one;
            PublicDomain.TzDatabase.TzRule two;
            DaylightTime daylightTime;

            GetDaylightChangeRules(ref point, zone, DateTimeKind.Local, out one, out two, out daylightTime);

            if (daylightTime != null && daylightTime.Start < daylightTime.End && time >= daylightTime.Start && time < daylightTime.End)
            {
                result += one.SaveTime;
            }
            else if (daylightTime != null && daylightTime.Start > daylightTime.End && (time <= daylightTime.Start || time > daylightTime.End))
            {
                result += one.SaveTime;
            }
        }
Пример #6
0
 private PublicDomain.TzDatabase.TzRule GetCompanionRule(TzDatabase.TzZone zone, PublicDomain.TzDatabase.TzRule rule, int ruleIndex, DateTime point)
 {
     TzDatabase.TzRule result = null;
     int companionIndex = FindRuleIndex(zone, point, rule.Modifier, rule.Modifier == TzDatabase.NotApplicableValue ? ruleIndex : -1, false);
     if (companionIndex != -1)
     {
         result = m_info.Rules[companionIndex];
     }
     return result;
 }