public FormBossData() { templateLink = new FormTemplateBossData(); InitializeComponent(); Icon = Properties.Resources.AppIcon; allBosses = LoadBossData(); bossesIdsKey = allBosses.Count; foreach (var boss in allBosses) { listViewBosses.Items.Add(new ListViewItem() { Name = boss.Key.ToString(), Text = boss.Value.UIName }); } }
public FormBossData(FormMain mainLink) { this.mainLink = mainLink; templateLink = new FormTemplateBossData(); InitializeComponent(); Icon = Properties.Resources.AppIcon; if (File.Exists($@"{mainLink.LocalDir}\boss_data.txt")) { try { allBosses = Bosses.FromFile($@"{mainLink.LocalDir}\boss_data.txt"); bossesIdsKey = allBosses.Count; } catch { allBosses.Clear(); foreach (KeyValuePair <int, BossData> keyPair in Bosses.GetDefaultSettingsForBossesAsDictionary()) { allBosses.Add(keyPair.Key, keyPair.Value); } bossesIdsKey = allBosses.Count; } } else { allBosses.Clear(); foreach (KeyValuePair <int, BossData> keyPair in Bosses.GetDefaultSettingsForBossesAsDictionary()) { allBosses.Add(keyPair.Key, keyPair.Value); } bossesIdsKey = allBosses.Count; } foreach (int key in allBosses.Keys) { listViewBosses.Items.Add(new ListViewItem() { Name = key.ToString(), Text = allBosses[key].Name }); } }