public void updateConfig(ref ObjectInfo oi)
        {
            string        uN = escape(oi.userName);
            CustomSection cs = ConfigurationManager.GetSection(uN) as CustomSection;

            if (cs == null)
            {
                return;
            }
            oi.bAttack    = cs.bAttack;
            oi.bPickUP    = cs.bPickUP;
            oi.enableWork = cs.enableWork;
        }
        public void savetoConfig(IList <ObjectInfo> objlist)
        {
            Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);


            foreach (ObjectInfo oi in objlist)
            {
                CustomSection cs = new CustomSection();
                cs.enableWork = oi.enableWork;
                cs.bAttack    = oi.bAttack;
                cs.bPickUP    = oi.bPickUP;
                cs.userName   = oi.userName;
                string uN = escape(oi.userName);
                cfa.Sections.Remove(uN);
                cfa.Sections.Add(uN, cs);
            }

            Func <string, string, bool> gw1 = (key, value) => {
                cfa.AppSettings.Settings.Remove(key);
                cfa.AppSettings.Settings.Add(key, value);
                return(true);
            };

            gw1("trackBar_H", step_H.ToString());
            gw1("trackBar_W", step_W.ToString());
            for (int i = 0; i < 6; i++)
            {
                gw1("keyPress_NP" + i.ToString(), keyPress_NP[i].ToString());
                gw1("keyPress_SP" + i.ToString(), keyPress_SP[i].ToString());
                gw1("keyPress_HP" + i.ToString(), keyPress_HP[i].ToString());
            }

            gw1(("HPPercent"), HPPercent.ToString());
            gw1(("SPPercent"), SPPercent.ToString());
            gw1(("NPPercent"), NPPercent.ToString());

            foreach (var obj in objlist)
            {
                //cfa.AppSettings.Settings.Add(obj.userName,);
            }
            cfa.Save();
        }