Пример #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[""]);
        }
Пример #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);
        }
Пример #3
0
 public ConfigFileParser()
 {
     ConfigFile = new ConfigFile();
 }
Пример #4
0
 public ConfigFileParser(ConfigFile cfg)
 {
     ConfigFile = cfg;
 }
Пример #5
0
 public static ConfigFile FromString(string content)
 {
     var cfg = new ConfigFile();
     var parser = new ConfigFileParser(cfg);
     parser.Parse(content);
     return cfg;
 }