示例#1
0
        public static SettingsData ReadFromFile(SettingCategory category, string file)
        {
            var data = new SettingsData(category)
            {
                Provenance = file
            };

            StringPropertyReader.ForFile(file).ReadProperties((key, value) => data[key] = value);

            return(data);
        }
        public void use_the_trimmed_thing_to_work()
        {
            var text = @"
first=0
     .second=1
            .third=2
";

            var props = StringPropertyReader.ForText(text).ReadProperties();

            props["first"].ShouldEqual("0");
            props["first.second"].ShouldEqual("1");
            props["first.second.third"].ShouldEqual("2");
        }
        public void read_simple_properties()
        {
            var text = @"
a=1
b=2
c=3
abcd=4
";

            var props = StringPropertyReader.ForText(text).ReadProperties();

            props["a"].ShouldEqual("1");
            props["b"].ShouldEqual("2");
            props["c"].ShouldEqual("3");
            props["abcd"].ShouldEqual("4");
        }
示例#4
0
 public void ReadData(string text)
 {
     StringPropertyReader.ForText(text).ReadProperties((key, value) => _values[key] = value);
 }
示例#5
0
 public static void ReadFromFile(string file, SettingsData data)
 {
     StringPropertyReader.ForFile(file).ReadProperties((key, value) => data[key] = value);
 }
示例#6
0
 public void Read(string text)
 {
     StringPropertyReader.ReadLine(text, (key, value) => this[key] = value);
 }