public static void AddKeyValue(string path, KeyValue kv)
 {
     if (!ConfigReaderManager.KeyValueExistsFile(path, kv.name))
     {
         List<KeyValue> kvs = ConfigReaderManager.ReadFileKeyValues(path);
         kvs.Add(kv);
         WriteConfigFile(path, kvs);
     }
 }
 public static List<KeyValue> ReadStringKeyValues(string contents)
 {
     List<KeyValue> ret = new List<KeyValue>();
     string regex = "[\\t ]+?\"(.+?)\"[\\t ]+?\"(.+?)\"";
     Regex matcher = new Regex(regex);
     MatchCollection mc = matcher.Matches(contents);
     foreach (Match m in mc)
     {
         KeyValue kv = new KeyValue(m.Groups[1].Value, m.Groups[2].Value);
         ret.Add(kv);
     }
     return ret;
 }
        public static List<KeyValue> AddKeyValue(List<KeyValue> listKV, KeyValue key)
        {
            List<KeyValue> kvs = listKV;
            bool exists = false;
            foreach (KeyValue kv in kvs)
            {
                if (kv.name == key.name)
                {
                    exists = true;
                }
            }

            if (!exists)
            {
                kvs.Add(key);
            }
            return kvs;
        }
        public static void ChangeKeyValue(string path, string name, string newValue)
        {
            if (ConfigReaderManager.KeyValueExistsFile(path, name))
            {
                List<KeyValue> kvs = ConfigReaderManager.ReadFileKeyValues(path);
                List<KeyValue> NewKVs = new List<KeyValue>();

                foreach (KeyValue kv in kvs)
                {
                    KeyValue k = new KeyValue(kv.name, kv.value);
                    if (k.name == name)
                    {
                        k.value = newValue;
                    }
                    NewKVs.Add(k);
                }
                WriteConfigFile(path, NewKVs);
            }
        }
 public static List<KeyValue> ChangeKeyValue(List<KeyValue> listKV, string name, string newValue)
 {
     List<KeyValue> kvs = new List<KeyValue>();
     foreach (KeyValue kv in listKV)
     {
         KeyValue k = new KeyValue();
         if (kv.name == name)
         {
             k.value = newValue;
             k.name = name;
         }
         else
         {
             k.value = kv.value;
             k.name = kv.name;
         }
         kvs.Add(k);
     }
     return kvs;
 }