Esempio n. 1
0
        public void DefaultCreate()
        {
            var cfg = new ConfigFile();

            Assert.AreEqual("", ConfigFile.GlobalSectionName, "If you changed the global section's name, you also have to update this unit test.");
            Assert.AreSame(cfg.GlobalSection, cfg[""]);
        }
Esempio n. 2
0
        public void InitializeFromConfigFile(ConfigFile cfg)
        {
            foreach (var opt in cfg["Windows"].Options)
            {
                var window = Element.Create(Root, opt.Key, opt.Value.AsConfigFile().GlobalSection) as Window;
                Debug.Assert(window != null,
                    "non-window in [Windows] section of user interface definition!");
                Windows.Add(window);
            }

            Game.Events["ui.show"].addListener(OnShowScreen);
            Game.Events["ui.hide"].addListener(OnHideScreen);
            Game.Events["ui.close"].addListener(OnClose);
        }
Esempio n. 3
0
 public ConfigFileParser()
 {
     ConfigFile = new ConfigFile();
 }
Esempio n. 4
0
 public ConfigFileParser(ConfigFile cfg)
 {
     ConfigFile = cfg;
 }
Esempio n. 5
0
 public static ConfigFile FromString(string content)
 {
     var cfg = new ConfigFile();
     var parser = new ConfigFileParser(cfg);
     parser.Parse(content);
     return cfg;
 }