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");
        }
Beispiel #4
0
 public void ReadData(string text)
 {
     StringPropertyReader.ForText(text).ReadProperties((key, value) => _values[key] = value);
 }
 public static void ReadFromFile(string file, SettingsData data)
 {
     StringPropertyReader.ForFile(file).ReadProperties((key, value) => data[key] = value);
 }
 public void Read(string text)
 {
     StringPropertyReader.ReadLine(text, (key, value) => this[key] = value);
 }