Esempio n. 1
0
            // NON-CONFIGURATION: private readonly VendorManager _vendorManager;
            // NON-CONFIGURATION: private readonly XmlElement _xmlElement;


            public ProfileSettingsSubMemento()
            {
                var currentProfile = ProfileManager.CurrentProfile;

                if (currentProfile != null)
                {
                    // NB: We can't use reflection, because not all data members are 'configuration items'.
                    // Of the configuration items, not all of them are mutable.  And of the mutable ones,
                    // some are directly mutable, and others are indirectly mutable. (So, different techniques
                    // must be used).
                    _aerialBlackspots     = new Dictionary <Tuple <uint, WoWFactionGroup>, List <Vector2[]> >(currentProfile.AerialBlackspots);
                    _avoidMobs            = currentProfile.AvoidMobs.Clone();
                    _blacklist            = new Dictionary <uint, BlacklistFlags>(currentProfile.Blacklist);
                    _blacklistQuestgivers = currentProfile.BlacklistedQuestgivers.Clone();
                    _blacklistedQuests    = currentProfile.BlacklistedQuests.Clone();
                    _blackspots           = new List <Blackspot>(currentProfile.Blackspots);
                    _factions             = new HashSet <uint>(currentProfile.Factions);
                    _forceMail            = currentProfile.ForceMail.Clone();
                    _lootMobs             = currentProfile.LootMobs;
                    _lootRadius           = currentProfile.LootRadius;
                    _mailQualities        = new List <WoWItemQuality>(currentProfile.MailQualities);
                    _protectedItems       = currentProfile.ProtectedItems.Clone();
                    _quests            = new List <QuestInfo>(currentProfile.Quests);
                    _subProfiles       = new List <Profile>(currentProfile.SubProfiles);
                    _targetingDistance = currentProfile.TargetingDistance;
                    _useMount          = currentProfile.UseMount;
                }
            }
        //*****
        // DualHashSet...
        public static DualHashSet <T1, T2> Clone <T1, T2>(this DualHashSet <T1, T2> source)
        {
            var result = new DualHashSet <T1, T2>();

            result.CopyFrom(source);
            return(result);
        }
        public static void CopyFrom <T1, T2>(this DualHashSet <T1, T2> destination, DualHashSet <T1, T2> source)
        {
            destination.HashSet1.Clear();
            destination.HashSet2.Clear();

            // Add elements of T1 type...
            foreach (var entry in source.HashSet1)
            {
                destination.Add(entry);
            }

            // Add elements of T2 type...
            foreach (var entry in source.HashSet2)
            {
                destination.Add(entry);
            }
        }