コード例 #1
0
        /// <summary>
        /// (re)loads settings
        /// </summary>
        public void LoadSettings(bool constructor)
        {
            _currentSpec = null;
            BlacklistedInventoryItems.Clear();
            NextPulse = DateTime.Now + TimeSpan.FromSeconds(1);
            //
            try
            {
                base.LoadFromXML(XElement.Load(GetSettingsPath(SettingsType.Settings, UsePVP)));
            }
            catch (Exception) { }
            var _path = GetSettingsPath(SettingsType.Weights, UsePVP);

            EquipMe.Log("Loading weights from: {0}", _path);
            var newset = EquipMe.LoadWeightSetFromXML(_path);

            if (newset != null)
            {
                WeightSet_Current = newset;
            }
            else
            {
                SaveSettings();
            }
        }
コード例 #2
0
        /// <summary>
        /// saves settings
        /// </summary>
        public void SaveSettings()
        {
            _currentSpec = null;
            BlacklistedInventoryItems.Clear();
            NextPulse = DateTime.Now + TimeSpan.FromSeconds(1);
            //
            base.SaveToFile(GetSettingsPath(SettingsType.Settings, UsePVP));
            var      _path   = GetSettingsPath(SettingsType.Weights, UsePVP);
            XElement saveElm = File.Exists(_path) ? XElement.Load(_path) : new XElement("WeightSet");

            saveElm.SetAttributeValue("Name", WeightSet_Current.Name);
            foreach (KeyValuePair <Stat, float> setval in WeightSet_Current.Weights)
            {
                saveElm.SetElementValue(setval.Key.ToString(), setval.Value);
            }
            saveElm.Save(_path);
        }