Beispiel #1
0
 private IDictionary <int, BossData> LoadBossData()
 {
     try
     {
         if (File.Exists(Bosses.JsonFileLocation))
         {
             return(Bosses.FromJsonFile($@"{ApplicationSettings.LocalDir}\boss_data.json"));
         }
         return(Bosses.GetDefaultSettingsForBossesAsDictionary());
     }
     catch
     {
         return(Bosses.GetDefaultSettingsForBossesAsDictionary());
     }
 }
Beispiel #2
0
 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
         });
     }
 }
Beispiel #3
0
        private void ButtonResetSettings_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure you want to reset all the bosses?\nThis will undo all Discord webhook icon and Twitch messages settings and reset them to their default state.", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result.Equals(DialogResult.Yes))
            {
                listViewBosses.Items.Clear();
                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
                    });
                }
            }
        }