コード例 #1
0
ファイル: PingerService.cs プロジェクト: SheepReaper/Dexter
        public PingerService(IWritableOptions <TargetSettings> targetSettings, ILogger <PingerService> logger)
        {
            _logger = logger;

            //Test
            _options = targetSettings;
        }
コード例 #2
0
 public EntriesController(
     ILanguageManager languageManager,
     IPeriodManager periodManager,
     IWritableOptions <DefaultKeysOptions> defaultKeysOptions,
     IEntryRepository entryRepo,
     IEntryItemRepository entryItemRepo,
     IAccountRepository accountRepo,
     IAccountBalanceRepository accountBalanceRep,
     IAccountBalanceService accountBalanceService,
     ICostCenterRepository costCenterRepo,
     IBranchRepository branchRepo,
     ICurrencyRepository currencyRepo,
     IReportService reportService,
     IFinancialPeriodRepository financialPeriodRepo) : base(languageManager)
 {
     _periodManager         = periodManager;
     _defaultKeysOptions    = defaultKeysOptions;
     _entryRepo             = entryRepo;
     _entryItemRepo         = entryItemRepo;
     _accountRepo           = accountRepo;
     _accountBalanceRep     = accountBalanceRep;
     _accountBalanceService = accountBalanceService;
     _costCenterRepo        = costCenterRepo;
     _branchRepo            = branchRepo;
     _currencyRepo          = currencyRepo;
     _reportService         = reportService;
     _financialPeriodRepo   = financialPeriodRepo;
 }
コード例 #3
0
 public SyncController(IRestManager manager, IWritableOptions <Endpoints> options, IWritableOptions <ConnectionStrings> optionsb, IDbManager dbManager)
 {
     _manager   = manager;
     _options   = options;
     _optionsb  = optionsb;
     _dbManager = dbManager;
 }
コード例 #4
0
        /// <summary>
        /// Gets the web driver.
        /// </summary>
        /// <param name="contextManager">The object container.</param>
        /// <param name="options">The options.</param>
        /// <returns>The webdrivercontext object.</returns>
        public static WebDriverContext GetWebDriver(IContextManager contextManager, IWritableOptions <ConfigurationParameters> options)
        {
            var objectContainer = contextManager?.TestThreadContext.Get <IObjectContainer>("objectContainer");
            WebDriverContext webDriverContext = null;

            if (objectContainer.IsRegistered <WebDriverContext>())
            {
                webDriverContext = objectContainer.Resolve <WebDriverContext>();
            }

            if (options?.Value.BrowsersConfiguration.Browser == Browser.ChromeAndroid9)
            {
                AppiumLocalService = AndroidWebDriver.CreateAppiumLocalService();
                AppiumLocalService.Start();
            }

            if (webDriverContext?.WebDriver == null)
            {
                if (!objectContainer.IsRegistered <WebDriverContext>())
                {
                    objectContainer.RegisterTypeAs <WebDriverContext, WebDriverContext>();
                }
                objectContainer.Resolve <WebDriverContext>().CreateWebDriver();
                webDriverContext = objectContainer.Resolve <WebDriverContext>();
            }

            return(webDriverContext);
        }
コード例 #5
0
        public MyTestClass(IWritableOptions <CustomSettings> options)
        {
            _options = options;

            // BAD. see below: "old reference does NOT update via Value"
            _value = _options.Value;
        }
コード例 #6
0
 public BackgroundWorker(ICsvService csvService, ISmtpService smtpService,
                         IWritableOptions <SchedulerConfig> schedulerConfig)
 {
     _csvService      = csvService;
     _smtpService     = smtpService;
     _schedulerConfig = schedulerConfig;
 }
コード例 #7
0
 public ProductsController(QNZContext context, IMapper mapper, IConfiguration config, IWritableOptions <AdminProductSet> writableLocations)
 {
     _context           = context;
     _mapper            = mapper;
     _config            = config;
     _writableLocations = writableLocations;
 }
コード例 #8
0
        public forumController(
            IOptions <SiteConfiguration> settings,
            IMemoryCache memoryCache,
            ApplicationDbContext context,
            IStringLocalizer <GeneralResource> generalLocalizer,
            IWebHostEnvironment _environment,
            IHttpContextAccessor _httpContextAccessor,
            IWritableOptions <Jugnoon.Forums.Settings.General> general_options,
            IOptions <General> generalSettings,
            IOptions <Features> featureSettings,
            IOptions <Jugnoon.Forums.Settings.General> generalForumSettings
            )
        {
            // readable configuration settings
            Jugnoon.Settings.Configs.GeneralSettings = generalSettings.Value;
            Jugnoon.Settings.Configs.FeatureSettings = featureSettings.Value;
            // content specific settings
            Jugnoon.Forums.Configs.GeneralSettings = generalForumSettings.Value;

            // writable configuration settings
            _general_options  = general_options;
            SiteConfig.Config = settings.Value;
            SiteConfig.Cache  = memoryCache;
            _context          = context;

            SiteConfig.generalLocalizer    = generalLocalizer;
            SiteConfig.Environment         = _environment;
            SiteConfig.HttpContextAccessor = _httpContextAccessor;
        }
コード例 #9
0
 public OptionsStorageBase(IWritableOptions <TOptions> options,
                           TModel model)
 {
     _options = NamedNullException.Assert(options, nameof(options));
     _model   = NamedNullException.Assert(model, nameof(model));
     _model.PropertyChanged += OnModelPropertyChanged;
 }
コード例 #10
0
        public InstallWizardController(
            IOptions <ConnectionStrings> ConnectionStrings,
            UserManager <ApplicationUser> userManager,
            SignInManager <ApplicationUser> signInManager,
            IWritableOptions <ConnectionStrings> connectionString,
            IConfigurationRoot configRoot,
            IWebHostEnvironment hostEnvironment)
        {
            _DefaultConnection = ConnectionStrings.Value.DefaultConnection;
            _userManager       = userManager;
            _signInManager     = signInManager;
            _connectionString  = connectionString;
            _configRoot        = configRoot;
            _hostEnvironment   = hostEnvironment;

            // Set WebRootPath to wwwroot\Files directory
            _hostEnvironment.WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot").Replace(@"\", @"/");

            // We need to create a Files directory if none exists
            // This will be used if the Administrator does not set a Files directory
            // Set WebRootPath to wwwroot\Files directory
            _DefaultFilesPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "Files").Replace(@"\", @"/");

            // Create wwwroot\Files directory if needed
            if (!Directory.Exists(_DefaultFilesPath))
            {
                _ = Directory.CreateDirectory(_DefaultFilesPath);
            }
        }
コード例 #11
0
        public SetupService(
            ILogger <SetupService> logger,
            IOptionsMonitor <AppOptions> appOptions,
            GraphSharePointAppService graphSharePointAppService,
            IWritableOptions <AppOptions> writableOptions,
            IWritableOptions <DocumentIdActivatorConfiguration> documentIdActivatorConfigurationWritableOptions,
            GraphTeamsAppService graphTeamsAppService,
            GraphUserAppService graphUserAppService,
            IUserContext userContext,
            IAzureKeyVaultService azureKeyVaultService) : base(logger, appOptions)
        {
            Guard.Against.Null(graphSharePointAppService, nameof(graphSharePointAppService));
            Guard.Against.Null(writableOptions, nameof(writableOptions));
            Guard.Against.Null(graphTeamsAppService, nameof(graphTeamsAppService));
            Guard.Against.Null(graphUserAppService, nameof(graphUserAppService));
            Guard.Against.Null(userContext, nameof(userContext));
            Guard.Against.Null(azureKeyVaultService, nameof(azureKeyVaultService));

            _graphSharePointAppService = graphSharePointAppService;
            _writableOptions           = writableOptions;
            this.documentIdActivatorConfigurationWritableOptions = documentIdActivatorConfigurationWritableOptions;
            _graphTeamsAppService = graphTeamsAppService;
            _graphUserAppService  = graphUserAppService;
            _userContext          = userContext;
            _azureKeyVaultService = azureKeyVaultService;
        }
コード例 #12
0
        public CurrencyConverterViewModel(ICurrencyService currencyService, IWritableOptions <UserSettings> userSettings)
        {
            CurrencyService = currencyService;
            UserSettings    = userSettings;
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            Initialize();
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        }
コード例 #13
0
 public TargetUnpackerService(IWritableOptions <GlobalConfigCfg> configuration, IServiceProvider serviceProvider)
 {
     _configuration = configuration;
     _fileService   = serviceProvider.GetService <ITargetFileService>();
     // ReSharper disable once AsyncConverter.AsyncWait
     Task.Run(() => DownloadUnpackerAsync("RPGMakerDecrypter_1.0")).Wait();
     ExtractUnpackerAsync("RPGMakerDecrypter_1.0");
 }
コード例 #14
0
 public EmailSender(IWritableOptions <EmailSettingsViewModel> options)
 {
     if (options.Value == null)
     {
         throw new Exception("Email settings not register in appsettings file");
     }
     _options = options;
 }
コード例 #15
0
 public HomeController(IPostService postService, IOptionsSnapshot <AboutUsPageInfo> aboutUsPageInfo, IMailService mailService, IToastNotification toastNotification, IWritableOptions <AboutUsPageInfo> aboutUsPageWriter)
 {
     _postService       = postService;
     _mailService       = mailService;
     _toastNotification = toastNotification;
     _aboutUsPageWriter = aboutUsPageWriter;
     _aboutUsPageInfo   = aboutUsPageInfo.Value;
 }
コード例 #16
0
 // IOptions bizler için gerekli section'ı okuyor ve burada istemiş olduğumuz sınıfa bunları dolduruyor, appsettings.json dan veri okumak istenildiğinde bu her yerde kullanılabilir
 // Snapshottan alcak
 public HomeController(IArticleService articleService, IOptionsSnapshot <AboutUsPageInfo> aboutUsPageInfo, IMailService mailService, IToastNotification toastNotification, IWritableOptions <AboutUsPageInfo> aboutUsPageInfoWriterOptions)
 {
     _articleService        = articleService;
     _mailService           = mailService;
     _aboutUsPageInfo       = aboutUsPageInfo.Value;
     _toastNotification     = toastNotification;
     _aboutUsPageInfoWriter = aboutUsPageInfoWriterOptions;
 }
コード例 #17
0
 public ErrorLogsController(QNZContext context,
                            IMapper mapper, IConfiguration config, IWritableOptions <SiteLogSet> writableLocations)
 {
     _context           = context;
     _mapper            = mapper;
     _config            = config;
     _writableLocations = writableLocations;
 }
コード例 #18
0
 public ServiceSingleton(
     IWritableOptions <ServiceOptions> writableConfigOptions)
     : base()
 {
     this.writableConfigOptions = writableConfigOptions;
     configOptions = writableConfigOptions.Value;
     Setup();
 }
コード例 #19
0
        public Scheduler(IWritableOptions <AppSettings> settings,
                         ILogger <Scheduler> logger)
        {
            ItemsQueue = new ObservableCollection <QueueItem>();

            _appSettings = settings.Value;
            _logger      = logger;
        }
コード例 #20
0
        /// <summary>
        /// Creates the web driver.
        /// </summary>
        /// <param name="options">The options.</param>
        /// <returns>The webdriver.</returns>
        public static IWebDriver CreateWebDriver(IWritableOptions <ConfigurationParameters> options)
        {
            var driver = new RemoteWebDriver(
                new Uri("http://127.0.0.1:4723/wd/hub"),
                CreateAppiumOptions(options).ToCapabilities(),
                TimeSpan.FromSeconds(120));

            return(driver);
        }
コード例 #21
0
        /// <summary>
        /// Creates the firefox options.
        /// </summary>
        /// <param name="options">The options.</param>
        /// <returns>The firefox options.</returns>
        private static FirefoxOptions CreateFirefoxOptions(IWritableOptions <ConfigurationParameters> options)
        {
            var firefoxOptions = new FirefoxOptions
            {
                Profile = CreateFirefoxProfile(options),
            };

            return(firefoxOptions);
        }
コード例 #22
0
 public AppService(
     IWritableOptions <CredentialWritableOption> writableCredentials,
     IWritableOptions <AboutWritableOption> writableAbout,
     IWritableOptions <HeaderWritableOption> writableHeader)
 {
     this.writableCredential = writableCredentials;
     this.writableAbout      = writableAbout;
     this.writableHeader     = writableHeader;
 }
コード例 #23
0
        public async Task Invoke(HttpContext httpContext,
                                 IWritableOptions <Setup> setupOptions,
                                 IOptionsSnapshot <HttpServer> httpServerOptions,
                                 DataContext dataContext)
        {
            if (IsSafeEndpoint(httpContext))
            {
                await _next.Invoke(httpContext);

                return;
            }

            var setupRequested = httpContext.Request.Path.StartsWithSegments("/setup");

            if (setupRequested && setupOptions.Value.Finished)
            {
                // Setup is done, go to /
                httpContext.Response.Redirect("/");
                return;
            }

            string page = httpContext.Request.Path;

            if (!setupOptions.Value.Finished)
            {
                if (!CompletedAccountStep(dataContext))
                {
                    page = "/setup";
                }
                else if (!CompletedAcmeStep(dataContext))
                {
                    page = "/setup/acme";
                }
                else if (!CompletedServerSetup(dataContext, httpServerOptions.Value))
                {
                    page = "/setup/server";
                }
                else if (!CompletedCertificateStep(dataContext, httpServerOptions.Value))
                {
                    page = "/setup/certificate";
                }
                else
                {
                    page = "/setup/finished";
                }
            }

            if (httpContext.Request.Method != "POST" &&
                page != httpContext.Request.Path)
            {
                httpContext.Response.Redirect(page);
                return;
            }

            await _next(httpContext);
        }
コード例 #24
0
 public ServerModel(ILogger <IndexModel> logger,
                    DataContext dataContext,
                    IWritableOptions <HttpServer> httpServerOptions,
                    KeyGenerator keyGenerator)
 {
     _logger            = logger;
     _dataContext       = dataContext;
     _httpServerOptions = httpServerOptions;
     _keyGenerator      = keyGenerator;
 }
コード例 #25
0
 public CurrenciesController(
     ILanguageManager languageManager,
     ICurrencyRepository currencyRepo,
     IWritableOptions <DefaultKeysOptions> defaultKeysOptions,
     IModelFactory modelFactory) : base(languageManager)
 {
     _defaultKeysOptions = defaultKeysOptions;
     _currencyRepo       = currencyRepo;
     _modelFactory       = modelFactory;
 }
コード例 #26
0
        /// <summary>
        /// Creates the web driver.
        /// </summary>
        /// <param name="options">The options.</param>
        /// <returns>The webdriver.</returns>
        public static FirefoxDriver CreateWebDriver(IWritableOptions <ConfigurationParameters> options)
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            var driver = new FirefoxDriver(
                FirefoxDriverService.CreateDefaultService(options?.Value.BrowsersConfiguration.FirefoxDriverPath),
                CreateFirefoxOptions(options),
                TimeSpan.FromSeconds(options.Value.BrowsersConfiguration.CommandTimeout));

            return(driver);
        }
コード例 #27
0
ファイル: Index.cshtml.cs プロジェクト: nomailme/certera
 public IndexModel(ILogger <IndexModel> logger,
                   DataContext dataContext,
                   UserManager <ApplicationUser> userManager,
                   IWritableOptions <Options.Setup> setupOptions)
 {
     _logger       = logger;
     _dataContext  = dataContext;
     _userManager  = userManager;
     _setupOptions = setupOptions;
 }
コード例 #28
0
        /// <summary>
        /// Creates the web driver.
        /// </summary>
        /// <param name="options">The options.</param>
        /// <returns>The webdriver.</returns>
        public static InternetExplorerDriver CreateWebDriver(IWritableOptions <ConfigurationParameters> options)
        {
            CloseIEWebDriver();
            var driver = new InternetExplorerDriver(
                InternetExplorerDriverService.CreateDefaultService(options?.Value.BrowsersConfiguration.IeDriverPath),
                CreateIeOPtions(),
                TimeSpan.FromSeconds(options.Value.BrowsersConfiguration.CommandTimeout));

            return(driver);
        }
コード例 #29
0
        public configurationController(
            IApplicationLifetime applicationLifetime,
            IWritableOptions <General> general_options,
            IWritableOptions <Database> database_options,
            IWritableOptions <Smtp> smtp_options,
            IWritableOptions <Media> media_options,
            IWritableOptions <Features> features_options,
            IWritableOptions <Listing> listings_options,
            IWritableOptions <Authentication> authentication_options,
            IWritableOptions <Registration> registration_options,
            IWritableOptions <Aws> aws_options,
            IWritableOptions <Social> social_options,
            IWritableOptions <Contact> contact_options,
            IWritableOptions <Rechapcha> rechapcha_options,
            IOptions <General> generalSettings,
            IOptions <Smtp> smtpSettings,
            IOptions <Media> mediaSettings,
            IOptions <Features> featureSettings,
            IOptions <Listing> listingSettings,
            IOptions <Authentication> authenticationSettings,
            IOptions <Registration> registrationSettings,
            IOptions <Aws> awsSettings,
            IOptions <Social> socialSettings,
            IOptions <Contact> contactSettings,
            IOptions <Rechapcha> rechapchaSettings

            )
        {
            // writable injectors
            _database_options       = database_options;
            _general_options        = general_options;
            _smtp_options           = smtp_options;
            _media_options          = media_options;
            _features_options       = features_options;
            _listings_options       = listings_options;
            _authentication_options = authentication_options;
            _registration_options   = registration_options;
            _aws_options            = aws_options;
            _social_options         = social_options;
            _contact_options        = contact_options;
            _rechapcha_options      = rechapcha_options;
            ApplicationLifetime     = applicationLifetime;
            // readable injectors
            _generalSettings        = generalSettings.Value;
            _smtpSettings           = smtpSettings.Value;
            _mediaSettings          = mediaSettings.Value;
            _featureSettings        = featureSettings.Value;
            _listingSettings        = listingSettings.Value;
            _authenticationSettings = authenticationSettings.Value;
            _registrationSettings   = registrationSettings.Value;
            _awsSettings            = awsSettings.Value;
            _socialSettings         = socialSettings.Value;
            _contactSettings        = contactSettings.Value;
            _rechapchaSettings      = rechapchaSettings.Value;
        }
コード例 #30
0
        public MainWindow(IWritableOptions <WindowSettings> settings)
        {
            InitializeComponent();

            _settings   = settings;
            WindowState = _settings.Value.IsMaximized ? WindowState.Maximized : WindowState.Normal;
            Left        = _settings.Value.Left;
            Top         = _settings.Value.Top;
            Width       = _settings.Value.Width;
            Height      = _settings.Value.Height;
        }