示例#1
0
        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
            });
        }
示例#2
0
        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));
        }
示例#3
0
 public ConfigLine()
 {
     Key = "";
     Value = new ConfigFileValue();
 }
示例#4
0
        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};
        }
示例#5
0
 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);
 }
示例#6
0
 public ConfigLine()
 {
     Key   = "";
     Value = new ConfigFileValue();
 }