public SettingsReader(string settingsFile, AppSettingsFileType appSettingsFileType, string[] args)
        {
            // Order is important here. We want the most general (environment) to be loaded first, and the most specific (command line args) to be loaded last.
            var settings = new ConfigurationBuilder()
                           .AddEnvironmentVariables();

            if (!string.IsNullOrWhiteSpace(settingsFile))
            {
                if (appSettingsFileType == AppSettingsFileType.NONE)
                {
                    var extension = System.IO.Path.GetExtension(settingsFile);
                    if (string.Compare(extension, ".json", true) == 0)
                    {
                        appSettingsFileType = AppSettingsFileType.JSON;
                    }
                    else if (string.Compare(extension, ".config", true) == 0)
                    {
                        appSettingsFileType = AppSettingsFileType.APP_CONFIG;
                    }
                    else if (string.Compare(extension, ".xml", true) == 0)
                    {
                        appSettingsFileType = AppSettingsFileType.XML;
                    }
                }

                if (appSettingsFileType == AppSettingsFileType.JSON)
                {
                    settings = settings.AddJsonFile(settingsFile);
                }
                else if (appSettingsFileType == AppSettingsFileType.XML)
                {
                    settings = settings.AddXmlFile(settingsFile);
                }
                else if (appSettingsFileType == AppSettingsFileType.APP_CONFIG)
                {
                    settings = settings.AddAppConfig(settingsFile);
                }
            }

            settings = settings.AddCommandLine(args);

            Configuration = settings.Build();
        }
 public SettingsReader(string settingsFile = null, AppSettingsFileType appSettingsFileType = AppSettingsFileType.NONE)
     : this(settingsFile, appSettingsFileType, Environment.GetCommandLineArgs().Skip(1).ToArray())
 {
 }