public CallBackController(IOptions <MyAppSettings> settings, ILogger <CallBackController> logger, ILoginsRepository loginsRepository, ITrueLayerAuthApi trueLayerAuthApi) { this.logger = logger; this.loginsRepository = loginsRepository; this.trueLayerAuthApi = trueLayerAuthApi; this.settings = settings.Value; }
private static void WriteUserSettings(XmlElement settingsNode, string configFile, bool encrypt) { XmlDocument doc; XmlNode MyAppSettings; if (encrypt) { var provider = new RsaProtectedConfigurationProvider(); provider.Initialize("userSettings", new NameValueCollection()); XmlNode encryptedSettings = provider.Encrypt(settingsNode); doc = encryptedSettings.OwnerDocument; MyAppSettings = doc.CreateElement("MyApp.Properties.Settings").AppendNewAttribute("configProtectionProvider", provider.GetType().Name); MyAppSettings.AppendChild(encryptedSettings); } else { doc = settingsNode.OwnerDocument; MyAppSettings = settingsNode; } doc.RemoveAll(); doc.AppendNewElement("configuration") .AppendNewElement("userSettings") .AppendChild(MyAppSettings); using (var writer = new XmlTextWriter(configFile, Encoding.UTF8) { Formatting = Formatting.Indented, Indentation = 4 }) doc.Save(writer); }
private void method_1(object sender, RoutedEventArgs e) { MyAppSettings appSettings = MySettings.Instance.AppSettings; string defaultDirectory = this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.DefaultDirectory; appSettings.LocalDir = defaultDirectory; int num1 = this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.StatsUsageAnonymous ? 1 : 0; appSettings.AnonymousUsage = num1 != 0; string proxyPassword = this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.ProxyPassword; appSettings.ProxyPassword = proxyPassword; string proxyUrl = this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.ProxyURL; appSettings.ProxyUrl = proxyUrl; string proxyUsername = this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.ProxyUsername; appSettings.ProxyUsername = proxyUsername; int num2 = this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.ProxyUse ? 1 : 0; appSettings.UseProxy = num2 != 0; int num3 = this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.ProxyUseAuth ? 1 : 0; appSettings.ProxyUseAuth = num3 != 0; MySettings.Instance.SaveSettings(); ((Window)this).Close(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceCollection services) { // We can use that //ILogger logger1 = loggerFactory.CreateLogger<Startup>(); //ILogger logger2 = loggerFactory.CreateLogger("Startup"); //logger1.LogInformation("Application starting1"); //logger2.LogInformation("Application starting2"); // Or we can use that, I prefer that _logger.LogInformation("Application starting3"); _logger.LogInformation("The app is starting at {0:t}", DateTime.Now); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.Run(async ctx => { // Request an IConfigurationRoot object to the IoC container //var config = ctx.RequestServices.GetService<IConfigurationRoot>(); //var title = config["title"]; //await ctx.Response.WriteAsync($"Title: {title}"); // Type access to the configuration var options = ctx.RequestServices.GetService <IOptions <MyAppSettings> >(); MyAppSettings settings = options.Value; var title = settings.Title; var stringOption = settings.Options.StringOption; await ctx.Response.WriteAsync($"Title: {title}, Options>StringOption: {stringOption}"); }); }
static void Main() { BrewingProcessHandler brewingProcessHandler = BrewingProcessHandler.GetInstance(); //brewingProcessHandler.StartNewBrew("09/09/2018", "Maltina", "258"); //ApplicationSettings appsettings = new ApplicationSettings(); MyAppSettings appSettings = MyAppSettings.GetInstance(); //string connectionString = appsettings.ConnectionString; //string templateFilePath = appsettings.TemplateFilePath; string connectionString = appSettings.ConnectionString; string periodTemplateFilePath = appSettings.PeriodTemplateFilePath; //string templateFilePath = $"{AppDomain.CurrentDomain.BaseDirectory}period_template.xlsx"; // Setup Datasource Handler Datasource datasource = new XlDatasource(connectionString, periodTemplateFilePath); DatasourceHandler datasourceHandler = DatasourceHandler.GetInstance(datasource); // Gui Thread ThreadStart guiRef = new ThreadStart(StartGui); Thread guiThread = new Thread(guiRef); guiThread.Start(); // Main thread //BrewMonitorTimer brewMonitorTimer = BrewMonitorTimer.GetInstance(); //BrewMonitorTimer.Startup(); StartBrewMonitor(); //TestDataSource(); }
public XlReportGenerator() { MyAppSettings appSettings = MyAppSettings.GetInstance(); string connectionString = appSettings.ConnectionString; string templatePath = appSettings.PeriodTemplateFilePath; Datasource xlDatasource = new XlDatasource(connectionString, templatePath); datasourceHandler = DatasourceHandler.GetInstance(xlDatasource); }
public SimplestNetStrategy(IbClient wrapper, MyAppSettings settings) { this.wrapper = wrapper; this.settings = settings; InitialiseClients(); GetInstrumentAndContract(); }
static string ReturnSettings(KeyValueConfigurationCollection settings, MyAppSettings settingKey) { if (settings[settingKey.Value] != null && settings[settingKey.Value].Value.Trim().Length != 0) { return(settings[settingKey.Value].Value.Trim()); } else { return(string.Empty); } }
public AuthController(INotificador notificador, SignInManager <IdentityUser> signInManager, UserManager <IdentityUser> userManager, IOptions <MyAppSettings> myAppSettings, IUser user, ILogger <AuthController> logger) : base(notificador, user) { _userManager = userManager ?? throw new ArgumentNullException(nameof(userManager)); _signInManager = signInManager ?? throw new ArgumentNullException(nameof(signInManager)); _myAppSettings = myAppSettings.Value ?? throw new ArgumentNullException(nameof(myAppSettings)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public static IServiceCollection AddIdentityConfiguration(this IServiceCollection services, IConfiguration configuration) { //Config context udentity services.AddDbContext <ApplicationDbContext>(options => { options.UseSqlServer(configuration.GetConnectionString("DefaultConnection")); }); //Config identity (necessario instalar o pacote Microsoft.AspNetCore.Identity.UI) services.AddDefaultIdentity <IdentityUser>() .AddRoles <IdentityRole>() .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders() .AddErrorDescriber <IdentityMessagesPortugues>(); #region === JWT ======================================================================= //Carregando valores de appsettings.json e disponibilizando para a aplicacao var appSettingsSection = configuration.GetSection("AppSettings"); services.Configure <MyAppSettings>(appSettingsSection); //Lendo valores de configuracao carregados MyAppSettings appSettings = appSettingsSection.Get <MyAppSettings>(); var key = Encoding.ASCII.GetBytes(appSettings.Secret); //Indicando que autenticacao se dara via token services.AddAuthentication(config => { config.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; config.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }).AddJwtBearer(jwtConfig => { //Disable just in development. Se true, forca que o cliente venha de https jwtConfig.RequireHttpsMetadata = false; jwtConfig.SaveToken = true; jwtConfig.TokenValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(key), ValidateIssuer = true, ValidateAudience = true, ValidAudience = appSettings.ValidoEm, ValidIssuer = appSettings.Emissor }; }); #endregion return(services); } //AddIdentityConfiguration
public FUBBlEfCteGiEUOpeldksiHKigIo() { base.\u002Ector(); this.InitializeComponent(); this.rskINpIpUjZYynMcjmeZRkGlmWbw_0 = ((FrameworkElement)this).DataContext as RskINpIpUjZYynMcjmeZRkGlmWbw; MyAppSettings appSettings = MySettings.Instance.AppSettings; this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.DefaultDirectory = appSettings.LocalDir; this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.ProxyPassword = appSettings.ProxyPassword; this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.ProxyURL = appSettings.ProxyUrl; this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.ProxyUsername = appSettings.ProxyUsername; this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.ProxyUse = appSettings.UseProxy; this.rskINpIpUjZYynMcjmeZRkGlmWbw_0.StatsUsageAnonymous = appSettings.AnonymousUsage; }
public CompanyService(MyAppSettings appSettings, CautionemContext cautionemContext) { this.myAppSettings = appSettings; this.cautionemContext = cautionemContext; }
public HomeController(IOptions <MyAppSettings> settings, ILogger <HomeController> logger) { _settings = settings.Value; _logger = logger; }
public CustomExceptionFilter(IOptions <MyAppSettings> appSettings, IHostingEnvironment env) : base() { _appSettings = appSettings.Value; _env = env; }
public EmployeesController(IOptions <MyAppSettings> appSettings) { _appSettings = appSettings.Value; }
public PaymentTypeService(MyAppSettings appSettings, CautionemContext cautionemContext) { this.myAppSettings = appSettings; this.cautionemContext = cautionemContext; }
public ValuesController(ILogger <ValuesController> logger, IOptions <MyAppSettings> settings) { this.logger = logger; //this.configuration = configuration; this.settings = settings.Value; }
public ClientUserController(IOptions <MyAppSettings> appSettings, CoreAPI.DatabaseModels.MyDbContext context) { _appSettings = appSettings.Value; _context = context; }
public CustomAuthorization(IOptions <MyAppSettings> appSettings) : base() { _appSettings = appSettings.Value; }
public HomeController(IOptionsSnapshot <MyAppSettings> settings) { _settings = settings?.Value ?? throw new ArgumentNullException(nameof(settings)); }
public UsersController(IUserService userService, IMapper mapper, IOptions <MyAppSettings> appSettings) { _userService = userService; _mapper = mapper; _appSettings = appSettings.Value; }
public HomeController(IOptions <MyAppSettings> options) { myAppSettings = options.Value; }