/// <summary>
    ///
    /// Tries to get the card list for a given dictionary key. Generic so that the key can be suited for any of the constructed dictionaries
    ///
    /// </summary>
    public List <CardData> GetDictionaryList <T>(T key, CardFilter listFilter = null)
    {
        var dictionaryList = new List <CardData>();
        var type           = typeof(T);

        switch (type)
        {
        case Type _ when type == typeof(Tags):
            TagLookup.TryGetValue((Tags)(object)key, out dictionaryList);
            break;

        case Type _ when type == typeof(Synergies):
            SynergyLookup.TryGetValue((Synergies)(object)key, out dictionaryList);
            break;

        case Type _ when type == typeof(Classes.ClassList):
            ClassLookup.TryGetValue((Classes.ClassList)(object) key, out dictionaryList);
            break;

        case Type _ when type == typeof(ClassResources):
            ClassPlayableLookup.TryGetValue((ClassResources)(object)key, out dictionaryList);
            break;

        case Type _ when type == typeof(CardResources):
            ResourceLookup.TryGetValue((CardResources)(object)key, out dictionaryList);
            break;

        case Type _ when type == typeof(Sets):
            SetLookup.TryGetValue((Sets)(object)key, out dictionaryList);
            break;

        case Type _ when type == typeof(Rarity):
            RarityLookup.TryGetValue((Rarity)(object)key, out dictionaryList);
            break;

        case Type _ when type == typeof(CardTypes):
            TypeLookup.TryGetValue((CardTypes)(object)key, out dictionaryList);
            break;

        default:
            throw new Exception("Not a valid Dictionary Type");
        }

        if (dictionaryList != null)
        {
            if (listFilter != null)
            {
                return(FilterCardList(dictionaryList.OrderCardList(), listFilter));
            }
            else
            {
                return(dictionaryList.OrderCardList());
            }
        }
        else
        {
            return(new List <CardData>());
        }
    }
        public void StreamFromXml(IO.XmlStream s)
        {
            int    set_id   = -1;
            string set_name = null;

            s.ReadAttribute("key", 10, ref set_id);
            s.ReadAttributeOpt("value", ref set_name);

            Id   = set_id;
            Name = set_name ?? kDefaultName;

            InitializeSets(s.Cursor.ChildNodes.Count);

            foreach (System.Xml.XmlNode n in s.Cursor.ChildNodes)
            {
                if (n.Name != "entry")
                {
                    continue;
                }

                uint   val_id = 0;
                string val    = null;

                s.SaveCursor(n as System.Xml.XmlElement);
                s.ReadAttribute("key", 16, ref val_id);
                s.ReadAttributeOpt("value", ref val);
                s.RestoreCursor();

                // If the definition didn't specify the value, generate a generic value as a placeholder
                if (val == null)
                {
                    val = string.Format("{0}{1}", kDefaultValuePrefix, val_id.ToString("X8"));
                }

                StringId sid = new StringId(Definition.Description, val_id);

                Set.Add(sid, val);
                SetLookup.Add(val.GetHashCode(), sid);
            }
        }
 public void Add(StringId sid, string value)
 {
     Set.Add(sid, value);
     SetLookup.Add(value.GetHashCode(), sid);
 }