public void InitializeFromFile() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "XML Files (*.xml)|*.xml|All Files (*.*)|*.*"; ofd.FilterIndex = 0; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ImmutableMultiton <int, Ability> .Initialize(ofd.FileName); } }
public WorldGenerator() { ImmutableMultiton <int, Ability> .Initialize(MagicArts.GetEnumerator()); ImmutableMultiton <int, Ability> .Initialize(Abilities.GetEnumerator()); // read out values in multiton foreach (int i in ImmutableMultiton <int, Ability> .GetKeys()) { Ability ability = ImmutableMultiton <int, Ability> .GetInstance(i); if (ability.AbilityName == "Latin") { _latin = ability; } else if (ability.AbilityName == "Magic Theory") { _magicTheory = ability; } else if (ability.AbilityName == "Artes Liberales") { _artLib = ability; } else if (ability.AbilityName == "Area Lore") { _areaLore = ability; } } InitializeComponent(); foreach (Magus founder in Founders.GetEnumerator()) { _magusArray[_magusCount] = founder; _magusCount++; } lstMembers.DataSource = _magusArray.Take(_magusCount).ToList(); _log = new List <string>(); lstAdvance.DataSource = _log; }