public string readConfig(configVar config)
 {
     string text = File.ReadAllText(_filePath, Encoding.UTF8);
     Match match = Regex.Match(text, "(?m)^" + config.ToString() + "(.+)$", RegexOptions.IgnoreCase);
     if (match.Success)
     {
         string result = match.Groups[1].Value.ToString(); //(?m) = multiline
         if (result.IndexOf("").Equals(0))
         { result = result.Remove(0, 1); }
         result = result.Replace("=", ""); //remove =
         return result.Trim();
     }
     return null;
 }
Esempio n. 2
0
        public string readConfig(configVar config)
        {
            string text  = File.ReadAllText(_filePath, Encoding.UTF8);
            Match  match = Regex.Match(text, "(?m)^" + config.ToString() + "(.+)$", RegexOptions.IgnoreCase);

            if (match.Success)
            {
                string result = match.Groups[1].Value.ToString(); //(?m) = multiline
                if (result.IndexOf("").Equals(0))
                {
                    result = result.Remove(0, 1);
                }
                result = result.Replace("=", ""); //remove =
                return(result.Trim());
            }
            return(null);
        }
Esempio n. 3
0
 public void writeConfig(configVar config, string value)
 {
     File.WriteAllText(_filePath, Regex.Replace(File.ReadAllText(_filePath),
                                                "(?m)^" + config.ToString() + "(=| .+|/ )$",
                                                config.ToString() + " = " + value));
 }
 public void writeConfig(configVar config, string value)
 {
     File.WriteAllText(_filePath, Regex.Replace(File.ReadAllText(_filePath),
         "(?m)^" + config.ToString() + "(=| .+|/ )$",
         config.ToString() + " = " + value));
 }