static void Init()
        {
            Console.OutputEncoding = System.Text.Encoding.UTF8;
            CustomConsole.SetConsolePosition();
            Tools.Tools.InitFolders();
            EntitiesManager.Instance.InitCharactersTypes();

            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddUserSecrets <Program>()
                          .AddEnvironmentVariables();

            IConfigurationRoot configuration = builder.Build();
            var mySettingsConfig             = new MySettingsConfig();

            configuration.GetSection("MySettings").Bind(mySettingsConfig);

            Console.WriteLine("Setting from appsettings.json: " + mySettingsConfig.AccountName);
            Console.WriteLine("Setting from secrets.json: " + mySettingsConfig.ApiSecret);
            Console.WriteLine("Connection string: " + configuration.GetConnectionString("DefaultConnection"));
            BDDManager.Instance.connexionstring = configuration.GetConnectionString("DefaultConnection");
            Console.WriteLine("Enter key to continue ...");
            Console.ReadKey();
        }
Ejemplo n.º 2
0
 protected PrintTemplate(IOptions <MySettingsConfig> appConfig, IViewRenderService viewRenderService, string name)
 {
     _mySettingsConfig  = appConfig.Value;
     _viewRenderService = viewRenderService;
     TemplateName       = name;
 }
Ejemplo n.º 3
0
 public PrinterSender(IOptions <MySettingsConfig> mySettingsConfig)
 {
     _mySettingsConfig = mySettingsConfig.Value;
 }