public int this[string key, bool returnInt = true] { get { var menu = ParseMenuNames.GetMenu(key); if (menu?[key] != null) { var type = menu[key].GetType(); switch (type.ToString()) { case "EloBuddy.SDK.Menu.Values.ComboBox": return(menu[key].Cast <ComboBox>().CurrentValue); case "EloBuddy.SDK.Menu.Values.Slider": return(menu[key].Cast <Slider>().CurrentValue); default: Logger.Error("Menu item : " + key + " is not oftype int."); break; } } Logger.Error("Menu item : " + key + " doesn't exists."); return(0); } set { var menu = ParseMenuNames.GetMenu(key); if (menu?[key] != null) { var type = menu[key].GetType(); switch (type.ToString()) { case "EloBuddy.SDK.Menu.Values.ComboBox": menu[key].Cast <ComboBox>().CurrentValue = value; break; case "EloBuddy.SDK.Menu.Values.Slider": menu[key].Cast <Slider>().CurrentValue = value; break; default: Logger.Error("Menu item : " + key + " is not oftype int."); break; } } else { Logger.Error("Menu item : " + key + " doesn't exists."); } } }
public bool this[string key] { get { var menu = ParseMenuNames.GetMenu(key); if (menu?[key] != null) { var type = menu[key].GetType(); switch (type.ToString()) { case "EloBuddy.SDK.Menu.Values.CheckBox": return(menu[key].Cast <CheckBox>().CurrentValue); case "EloBuddy.SDK.Menu.Values.KeyBind": return(menu[key].Cast <KeyBind>().CurrentValue); default: Logger.Error("Menu item : " + key + " is not oftype bool."); break; } } Logger.Error("Menu item : " + key + " doesn't exists."); return(false); } set { var menu = ParseMenuNames.GetMenu(key); if (menu?[key] != null) { var type = menu[key].GetType(); switch (type.ToString()) { case "EloBuddy.SDK.Menu.Values.CheckBox": menu[key].Cast <CheckBox>().CurrentValue = value; break; case "EloBuddy.SDK.Menu.Values.KeyBind": menu[key].Cast <KeyBind>().CurrentValue = value; break; default: Logger.Error("Menu item : " + key + " is not oftype bool."); break; } } Logger.Error("Menu item : " + key + " doesn't exists."); } }