arkhan 11 Posted July 11, 2017 Share Posted July 11, 2017 Hi, I'm making a FC in c# with the exemple there Everythink is ok except for settings when i click on settings, the box show settings but without default settings an when i try to save settings it only save the last data. [Serializable] public class ShamanSettings : Settings { [Setting] [DefaultValue(true)] [Category("GHOST WOLF SETTINGS")] [DisplayName("Ghost Wolf")] [Description("Use Ghost Wolf")] public bool UGW { get; set; } [Setting] [DefaultValue(4)] [Category("GHOST WOLF SETTINGS")] [DisplayName("Use after X secondes")] [Description("Use Ghost Wolf after X secondes out of combat")] public int TGW { get; set; } [Setting] [DefaultValue(50)] [Category("GHOST WOLF SETTINGS")] [DisplayName("Mana required")] [Description("Use Ghost Wolf only if mana is superior or equal")] public int MGW { get; set; } private ShamanSettings() { ConfigWinForm(new System.Drawing.Point(400, 400), "Shaman " + Translate.Get("Settings")); } public static ShamanSettings CurrentSetting { get; set; } public bool Save() { try { return Save(AdviserFilePathAndName("CustomClass-Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName)); } catch (Exception e) { Logging.WriteError("ShamanSettings > Save(): " + e); return false; } } public static bool Load() { try { if (File.Exists(AdviserFilePathAndName("CustomClass-Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName))) { CurrentSetting = Load<ShamanSettings>(AdviserFilePathAndName("CustomClass-Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName)); return true; } CurrentSetting = new ShamanSettings(); } catch (Exception e) { Logging.WriteError("ShamanSettings > Load(): " + e); } return false; } } there is the full c# file if somoene can help me to figure this out Arkhan-ShamEnh.cs Link to comment https://wrobot.eu/forums/topic/6446-fc-settings-bug/ Share on other sites More sharing options...
arkhan 11 Posted July 12, 2017 Author Share Posted July 12, 2017 Bump, anyone can help me ? Link to comment https://wrobot.eu/forums/topic/6446-fc-settings-bug/#findComment-29218 Share on other sites More sharing options...
reapler 154 Posted July 12, 2017 Share Posted July 12, 2017 Hello @arkhan, i've re-created it: public void ShowConfiguration() { CustomClass_ShamanSettings.Load(); CustomClass_ShamanSettings.CurrentSetting.ToForm(); CustomClass_ShamanSettings.CurrentSetting.Save(); } public class CustomClass_ShamanSettings : Settings { public static CustomClass_ShamanSettings CurrentSetting { get; set; } public bool Save() { try { return Save(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName)); } catch (Exception e) { Logging.WriteError("CustomClass_ShamanSettings > Save(): " + e); return false; } } public static bool Load() { try { if (File.Exists(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName))) { CurrentSetting = Load<CustomClass_ShamanSettings>(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName)); return true; } CurrentSetting = new CustomClass_ShamanSettings { UGW = true, TGW = 4, MGW = 50 }; } catch (Exception e) { Logging.WriteError("CustomClass_ShamanSettings > Load(): " + e); } return false; } [Setting] [Category("GHOST WOLF SETTINGS")] [DisplayName("Ghost Wolf")] [Description("Use Ghost Wolf")] public bool UGW { get; set; } [Setting] [Category("GHOST WOLF SETTINGS")] [DisplayName("Use after X secondes")] [Description("Use Ghost Wolf after X secondes out of combat")] public int TGW { get; set; } [Setting] [Category("GHOST WOLF SETTINGS")] [DisplayName("Mana required")] [Description("Use Ghost Wolf only if mana is superior or equal")] public int MGW { get; set; } } arkhan 1 Link to comment https://wrobot.eu/forums/topic/6446-fc-settings-bug/#findComment-29223 Share on other sites More sharing options...
arkhan 11 Posted July 13, 2017 Author Share Posted July 13, 2017 Thank you for giving your time, it works like a charm. Link to comment https://wrobot.eu/forums/topic/6446-fc-settings-bug/#findComment-29236 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now