Пример #1
0
        public static void ChangeConfigValue(string property, string value)
        {
            bool   success       = false;
            string propertyLower = property.ToLower();

            Plugin.Log("Config Change Attempt: " + property + " " + value);

            object inifile = Plugin.ConfigSettings.GetField <object>("_instance");

            IniParser.Model.IniData data = inifile.GetField <IniParser.Model.IniData>("data");

            foreach (var section in data.Sections)
            {
                if (success)
                {
                    break;
                }
                foreach (var key in section.Keys)
                {
                    if (key.KeyName.ToLower() == propertyLower && !data.Sections[section.SectionName].ContainsKey("ChargeCost"))
                    {
                        inifile.InvokeMethod("IniWriteValue", section.SectionName, property, value);
                        ChatMessageHandler.TryAsyncMessage("Changed Value");
                        Config.Load();
                        success = true;
                        break;
                    }
                }
            }
        }
Пример #2
0
        public static void ChangeConfigValue(string command, string property, string value)
        {
            Plugin.Log("Config Change Attempt: " + command + " " + property + " " + value);
            object inifile = Plugin.ConfigSettings.GetField <object>("_instance");

            IniParser.Model.IniData data = inifile.GetField <IniParser.Model.IniData>("data");
            if (data.Sections.ContainsSection(command))
            {
                if (data.Sections[command].ContainsKey(property))
                {
                    inifile.InvokeMethod("IniWriteValue", command, property, value);
                    ChatMessageHandler.TryAsyncMessage("Changed Value");
                    Config.Load();
                }
            }
        }