示例#1
0
        /// <summary>
        /// Create configuration object, which implements given Structure.
        /// Structure properties are parsed from file specified by configFilePath.
        /// </summary>
        /// <param name="configFilePath">Input file path from where configuration is parsed.</param>
        /// <param name="mode">Mode which is used for parsing input data.</param>
        /// <typeparam name="Structure">Interface which describes structure of configuration file.</typeparam>
        /// <returns>Configuration object.</returns>
        public static Structure CreateFromFile <Structure>(string configFilePath, ParsingMode mode = ParsingMode.Strict)
            where Structure : IConfiguration
        {
            var parser = ConfigParser.FromFile(configFilePath, mode);

            return(createConfig <Structure>(parser));
        }