public void InitDB() { if (_DBLoader == null) { _DBLoader = new DBLoader <Monster>("bestiary.db"); } }
public static void LoadFeats() { List <Feat> set = XmlListLoader <Feat> .Load("Feats.xml"); featMap = new Dictionary <string, Feat>(); altFeatMap = new Dictionary <string, string>(); types = new SortedDictionary <String, String>(); foreach (Feat feat in set) { bool changed; string commaName = CMStringUtilities.DecommaText(feat.Name, out changed); if (changed) { feat.AltName = feat.Name; feat.Name = commaName; altFeatMap.Add(feat.AltName, feat.Name); } featMap[feat.Name] = feat; //add to types list foreach (string type in feat.Types) { types[type] = type; } if (feat.Types.Count == 0) { Debug.WriteLine(feat.Name); } feats = new ObservableCollection <Feat>(); foreach (Feat f in Feat.FeatMap.Values) { feats.Add(f); } } if (DBSettings.UseDB) { _FeatsDB = new DBLoader <Feat>("feats.db"); foreach (Feat f in _FeatsDB.Items) { feats.Add(f); if (!FeatMap.ContainsKey(f.Name)) { FeatMap[f.Name] = f; } } } _FeatsLoaded = true; }
public void Dispose() { _DBLoader.Dispose(); _DBLoader = null; }