Пример #1
0
 public void readcfg()
 {
     cf = JsonConfig.Config.Default;
     if (System.IO.File.Exists(CFG_FILE_NAME))
     {
         cf.ApplyJson(System.IO.File.ReadAllText(CFG_FILE_NAME));
     }
 }
Пример #2
0
        public void CastConfigObjectToBool()
        {
            // if a ConfigObject has nested members, we wan't to be able to do
            // a fast check for non null in if statements:
            //
            // if (config.SomeMember) { ... }

            string conf = @"{ SomeMember: { Foo: 42 } }";
            dynamic c = new ConfigObject();
            c.ApplyJson(conf);

            bool t = (bool) c.SomeMember;
            Assert.AreEqual(true, t);

            bool f = (bool) c.NonExistantMember;
            Assert.AreEqual (f, false);
        }
Пример #3
0
        public void CastConfigObjectToBool()
        {
            // if a ConfigObject has nested members, we wan't to be able to do
            // a fast check for non null in if statements:
            //
            // if (config.SomeMember) { ... }

            string  conf = @"{ SomeMember: { Foo: 42 } }";
            dynamic c    = new ConfigObject();

            c.ApplyJson(conf);

            bool t = (bool)c.SomeMember;

            Assert.AreEqual(true, t);

            bool f = (bool)c.NonExistantMember;

            Assert.AreEqual(f, false);
        }
Пример #4
0
 public void readcfg()
 {
     cf = JsonConfig.Config.Default;
     if(System.IO.File.Exists(CFG_FILE_NAME))
     {
         cf.ApplyJson(System.IO.File.ReadAllText(CFG_FILE_NAME));
     }
 }