Here is an example of class I use :
public class PriestSettings : Settings { [Setting] [DefaultValue(true)] [Category("Movements")] [DisplayName("Follow Mode")] [Description("Follow the party Leader. Only working when in party")] public bool FollowMode { get; set; } [Setting] [DefaultValue(80)] [Category("Heal")] [DisplayName("Lesser Heal Treshold")] [Description("Limit of Life under which bot trigger LesserHeal.In percent")] public double LesserHealTreshold { get; set; } private PriestSettings() { ConfigWinForm(new System.Drawing.Point(400, 400), "Priest " + Translate.Get("Settings")); } public static PriestSettings CurrentSetting { get; set; } public bool Save() { try { return Save(AdviserFilePathAndName("McRo-Priest", ObjectManager.Me.Name + "." + Usefuls.RealmName)); } catch (Exception e) { Logging.WriteError("PriestSettings > Save(): " + e); return false; } } public static bool Load() { try { if (File.Exists(AdviserFilePathAndName("McRo-Priest", ObjectManager.Me.Name + "." + Usefuls.RealmName))) { CurrentSetting = Load<PriestSettings>(AdviserFilePathAndName("McRo-Priest", ObjectManager.Me.Name + "." + Usefuls.RealmName)); return true; } CurrentSetting = new PriestSettings(); } catch (Exception e) { Logging.WriteError("PriestSettings > Load(): " + e); } return false; } }
When trying to change a value, in the resulting XML:
- the value changed is never saved. If it existed in the file it is totaly deleted
- the value non targeted by the change may be delete also (randomly)
Recommended Comments
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