public ConfigLine ReadLine(string line) { if (line.IndexOf("user_pref", 0, StringComparison.Ordinal) != 0) { return new ConfigLine { Comment = true } } ; var data = line.Substring(10, line.Length - 12); int del = data.IndexOf(','); if (del < 0 || del - 2 <= 0) { return(new ConfigLine()); } string key = data.Substring(1, del - 2); if (key.Length == 0) { return(new ConfigLine()); } var value = new ConfigFileValue { Value = data.Substring(del + 2, data.Length - del - 2) }; return(new ConfigLine { Key = key, Value = value }); }
public string GetLine(string key, ConfigFileValue value) { if (!value.Valid) { return(""); } string v = value.Comma ? "\"" + value.Value + "\"" : value.Value; return(String.Format("user_pref(\"{0}\", {1});", key, v)); }
public ConfigLine() { Key = ""; Value = new ConfigFileValue(); }
public ConfigLine ReadLine(string line) { if (line.IndexOf("user_pref", 0, StringComparison.Ordinal) != 0) return new ConfigLine {Comment = true}; var data = line.Substring(10, line.Length - 12); int del = data.IndexOf(','); if (del < 0 || del - 2 <= 0) return new ConfigLine(); string key = data.Substring(1, del - 2); if (key.Length == 0) return new ConfigLine(); var value = new ConfigFileValue { Value = data.Substring(del + 2, data.Length - del - 2) }; return new ConfigLine {Key = key, Value = value}; }
public string GetLine(string key, ConfigFileValue value) { if (!value.Valid) return ""; string v = value.Comma ? "\"" + value.Value + "\"" : value.Value; return String.Format("user_pref(\"{0}\", {1});", key, v); }