Example #1
0
 private static void Defaults(CoreConfigurationSection section)
 {
     section.Settings["Production"]    = "false";
     section.Settings["Debug"]         = "false";
     section.Settings["EventBot"]      = "true";
     section.Settings["WebAccounting"] = "true";
     section.Settings["AllowPlayers"]  = "true";
 }
Example #2
0
    private static Configuration Load()
    {
        string filename = Path.Combine(Core.BaseDirectory, "core.config");
        var    mapping  = new ExeConfigurationFileMap {
            ExeConfigFilename = filename
        };
        var config  = ConfigurationManager.OpenMappedExeConfiguration(mapping, ConfigurationUserLevel.None);
        var section = (CoreConfigurationSection)config.GetSection(_root);

        if (section == null)
        {
            Console.Write("Core: Building core.config...");
            section = new CoreConfigurationSection();
            config.Sections.Add(_root, section);
            Defaults(section);
            config.Save(ConfigurationSaveMode.Modified);

            Console.WriteLine("done");
        }
        return(config);
    }
Example #3
0
 public CoreModule(CoreConfigurationSection coreConfigurationSection)
 {
     this.coreConfigurationSection = coreConfigurationSection;
 }