Load() private method

private Load ( string configFile ) : bool
configFile string
return bool
コード例 #1
0
ファイル: Engine.cs プロジェクト: tmpreston/DocNet
        public Config LoadConfig()
        {
            if(string.IsNullOrWhiteSpace(_input.StartFolder))
            {
                Console.WriteLine("[ERROR] Nothing to do, no start folder specified");
                return null;
            }

            var configFile = Path.Combine(_input.StartFolder, "docnet.json");
            if(!File.Exists(configFile))
            {
                Console.WriteLine("[ERROR] {0} not found.", configFile);
                return null;
            }

            var config = new Config();
            if(!config.Load(configFile))
            {
                Console.WriteLine("Errors occurred, can't continue!");
                return null;
            }
            if(config.Pages.IndexElement == null)
            {
                Console.WriteLine("[ERROR] Root __index not found. The root navigationlevel is required to have an __index element");
                return null;
            }
            return config;
        }