private void GetHbData()
 {
     _HbData = new HealbotData(Settings.Default.WindowerPath);
     foreach (var blist in _HbData.BuffLists)
     {
         foreach (KeyValuePair <string, List <string> > ilist in blist.List)
         {
             var key = ilist.Key == "me" ? _ELITEAPI != null ? _ELITEAPI.Player.Name : ilist.Key : ilist.Key;
             Select_BuffList.Items.Add(blist.Name + " " + key);
         }
     }
 }
        private void Button_SaveBuffs_Click(object sender, RoutedEventArgs e)
        {
            if (_HbData == null)
            {
                return;
            }

            var inputDialog = new CustomInputDialog("Buff list name:", "mybuffs");

            if (inputDialog.ShowDialog() == true)
            {
                var bufflistname = inputDialog.DialogValue;
                if (!string.IsNullOrEmpty(bufflistname))
                {
                    bufflistname = bufflistname.ToLower().Trim();

                    // handle duplicate list names automatically
                    var check = _HbData.BuffLists.Where(x => x.Name.ToLower() == bufflistname).FirstOrDefault();
                    if (check != null)
                    {
                        int i = 1;
                        while (check != null)
                        {
                            i++;
                            var temp = bufflistname + i.ToString();
                            check = _HbData.BuffLists.Where(x => x.Name.ToLower() == temp).FirstOrDefault();
                        }
                    }

                    var buffs = new List <string>();
                    foreach (var item in Lb_Buffs.Items)
                    {
                        if (item.ToString().Contains(_ELITEAPI.Player.Name))
                        {
                            buffs.Add(item.ToString().Replace(_ELITEAPI.Player.Name + " ", "").Trim());
                        }
                    }

                    var bufflist = new BuffList
                    {
                        Name = bufflistname,
                        List = new Dictionary <string, List <string> > {
                            { "me", buffs }
                        }
                    };

                    var msg = new CustomMessageDialog("Saved!", "Buff List: '" + bufflistname + "' has been saved to [..healbot\\data\\buffLists.lua]");
                    if (_HbData.SaveBuffList(bufflist))
                    {
                        _HbData = new HealbotData(Settings.Default.WindowerPath);                         // reload the settings
                    }
                    else
                    {
                        msg = new CustomMessageDialog("ERROR", "An error occured while trying to save the set of buffs!" + Environment.NewLine + Environment.NewLine + "Buff list name: '" + bufflistname + "'");
                    }

                    msg.ShowDialog();
                }
            }
            else
            {
                var msg = new CustomMessageDialog("ERROR", "A name must be provided in order to save the buffs as a list in [..healbot\\data\\buffLists.lua]");
                msg.ShowDialog();
            }
        }