コード例 #1
0
 public CommonCache(ILogger <CommonCache> log, ICoreConfiguration config, IMemoryCache cache)
 {
     _syncLock = new object();
     _log      = log;
     _config   = config;
     _cache    = cache;
 }
コード例 #2
0
        public BoxDestination(
            ICoreConfiguration coreConfiguration,
            IGreenshotLanguage greenshotLanguage,
            IBoxConfiguration boxConfiguration,
            IBoxLanguage boxLanguage,
            Func <CancellationTokenSource, Owned <PleaseWaitForm> > pleaseWaitFormFactory,
            INetworkConfiguration networkConfiguration,
            IResourceProvider resourceProvider) : base(coreConfiguration, greenshotLanguage)
        {
            _boxConfiguration      = boxConfiguration;
            _boxLanguage           = boxLanguage;
            _pleaseWaitFormFactory = pleaseWaitFormFactory;
            _networkConfiguration  = networkConfiguration;
            _resourceProvider      = resourceProvider;

            _oauth2Settings = new OAuth2Settings
            {
                AuthorizationUri = new Uri("https://app.box.com").
                                   AppendSegments("api", "oauth2", "authorize").
                                   ExtendQuery(new Dictionary <string, string>
                {
                    { "response_type", "code" },
                    { "client_id", "{ClientId}" },
                    { "redirect_uri", "{RedirectUrl}" },
                    { "state", "{State}" }
                }),
                TokenUrl         = new Uri("https://api.box.com/oauth2/token"),
                CloudServiceName = "Box",
                ClientId         = boxConfiguration.ClientId,
                ClientSecret     = boxConfiguration.ClientSecret,
                RedirectUrl      = "https://www.box.com/home/",
                AuthorizeMode    = AuthorizeModes.EmbeddedBrowser,
                Token            = boxConfiguration
            };
        }
コード例 #3
0
 public ForgotPasswordCommandHandler(IMediator mediator, ICoreConfiguration coreConfiguration, IRedisContext redisContext, IEmailService emailService)
 {
     _mediator          = mediator;
     _coreConfiguration = coreConfiguration;
     _redisContext      = redisContext;
     _emailService      = emailService;
 }
コード例 #4
0
 /// <summary>
 ///     Validate the OutputFilePath, and if this is not correct it will be set to the default
 ///     Added for BUG-1992, reset the OutputFilePath / OutputFileAsFullpath if they don't exist (e.g. the configuration is
 ///     used on a different PC)
 /// </summary>
 public static void ValidateAndCorrectOutputFilePath(this ICoreConfiguration coreConfiguration)
 {
     if (!Directory.Exists(coreConfiguration.OutputFilePath))
     {
         coreConfiguration.RestoreToDefault("OutputFilePath");
     }
 }
コード例 #5
0
 public JiraPlugin(IGreenshotHost greenshotHost, ICoreConfiguration coreConfiguration, JiraConnector jiraConnector)
 {
     _greenshotHost     = greenshotHost;
     _coreConfiguration = coreConfiguration;
     _jiraConnector     = jiraConnector;
     Instance           = this;
 }
コード例 #6
0
 protected OneNoteDestination(OneNotePage page,
                              ICoreConfiguration coreConfiguration,
                              IGreenshotLanguage greenshotLanguage
                              ) : this(coreConfiguration, greenshotLanguage)
 {
     _page = page;
 }
コード例 #7
0
 protected ExcelDestination(string workbookName,
                            ICoreConfiguration coreConfiguration,
                            IGreenshotLanguage greenshotLanguage
                            ) : this(coreConfiguration, greenshotLanguage)
 {
     _workbookName = workbookName;
 }
コード例 #8
0
 static GreenshotForm()
 {
     if (!IsInDesignMode)
     {
         coreConfiguration = IniConfig.Current.Get <ICoreConfiguration>();
     }
 }
 public GetAccountListQueryHandler(IDocumentContext documentContext, ICoreConfiguration coreConfiguration, IMediator mediator, IMapper mapper)
 {
     _mediator          = mediator;
     _mapper            = mapper;
     _coreConfiguration = coreConfiguration;
     _documentContext   = documentContext;
 }
コード例 #10
0
 public UpdateEmailCommandHandler(IMediator mediator, IDocumentContext documentContext, ICoreConfiguration coreConfiguration, IEmailService emailService)
 {
     _mediator          = mediator;
     _coreConfiguration = coreConfiguration;
     _documentContext   = documentContext;
     _emailService      = emailService;
 }
コード例 #11
0
 public ResetPasswordCommandHandler(IMediator mediator, ICoreConfiguration coreConfiguration, IRedisContext redisContext, IDocumentContext documentContext)
 {
     _mediator          = mediator;
     _coreConfiguration = coreConfiguration;
     _redisContext      = redisContext;
     _documentContext   = documentContext;
 }
コード例 #12
0
 public AuthenticateUserCommandHandler(IMediator mediator, IDocumentContext documentContext, IRedisContext redisContext, ICoreConfiguration coreConfiguration)
 {
     _mediator          = mediator;
     _coreConfiguration = coreConfiguration;
     _documentContext   = documentContext;
     _redisContext      = redisContext;
 }
コード例 #13
0
 public GreenshotServerAction(ICoreConfiguration coreConfiguration, MainForm mainForm, HotkeyHandler hotkeyHandler, [ImportMany] IEnumerable <IDestination> destinations)
 {
     _coreConfiguration = coreConfiguration;
     _mainForm          = mainForm;
     _hotkeyHandler     = hotkeyHandler;
     _destinations      = destinations;
 }
コード例 #14
0
 public CreateAccountCommandHandler(IMediator mediator, IDocumentContext documentContext, ICoreConfiguration coreConfiguration, IEmailService emailService, IMapper mapper)
 {
     _mediator          = mediator;
     _coreConfiguration = coreConfiguration;
     _documentContext   = documentContext;
     _emailService      = emailService;
     _mapper            = mapper;
 }
コード例 #15
0
 public FileConfigPartViewModel(
     ICoreConfiguration coreConfiguration,
     IGreenshotLanguage greenshotLanguage
     )
 {
     CoreConfiguration = coreConfiguration;
     GreenshotLanguage = greenshotLanguage;
 }
コード例 #16
0
 protected PrinterDestination(
     ICoreConfiguration coreConfiguration,
     IGreenshotLanguage greenshotLanguage,
     Func <ISurface, ICaptureDetails, Owned <PrintHelper> > printHelperFactory,
     string printerName) : this(coreConfiguration, greenshotLanguage, printHelperFactory)
 {
     _printerName = printerName;
 }
コード例 #17
0
 public PrinterDestination(ICoreConfiguration coreConfiguration,
                           IGreenshotLanguage greenshotLanguage,
                           Func <ISurface, ICaptureDetails, Owned <PrintHelper> > printHelperFactory
                           ) : base(coreConfiguration, greenshotLanguage)
 {
     _greenshotLanguage  = greenshotLanguage;
     _printHelperFactory = printHelperFactory;
 }
コード例 #18
0
 public PickerDestination(
     DestinationHolder destinationHolder,
     ICoreConfiguration coreConfiguration,
     IGreenshotLanguage greenshotLanguage
     ) : base(coreConfiguration, greenshotLanguage)
 {
     _destinationHolder = destinationHolder;
 }
コード例 #19
0
 public CaptureConfigViewModel(ICoreConfiguration coreConfiguration,
                               IConfigTranslations configTranslations,
                               IGreenshotLanguage greenshotLanguage)
 {
     CoreConfiguration  = coreConfiguration;
     ConfigTranslations = configTranslations;
     GreenshotLanguage  = greenshotLanguage;
 }
コード例 #20
0
        public ApiKeyAuthenticationMiddleware(RequestDelegate next, ICoreConfiguration coreConfiguraton)
        {
            this.next = next;

            _primaryApiKey       = coreConfiguraton.Security.PrimaryApiKey;
            _secondaryApiKey     = coreConfiguraton.Security.SecondaryApiKey;
            _forceSecureApiCalls = coreConfiguraton.Security.ForceSecureApiCalls;
        }
コード例 #21
0
        public GetUserByEmailQueryHandler(IDocumentContext documentContext, ICoreConfiguration coreConfiguration, IMediator mediator)
        {
            _mediator          = mediator;
            _coreConfiguration = coreConfiguration;
            _documentContext   = documentContext;

            //Log Activity, Check Authorization, Etc...
        }
コード例 #22
0
 public ValuesController(ILoggerFactory log, ICoreConfiguration config, Settings settings, IBusinessLogic logic, ITest test)
 {
     _log      = log.CreateLogger <ValuesController>();
     _config   = config;
     _settings = settings;
     _logic    = logic;
     _test     = test;
 }
コード例 #23
0
 public PrintConfigViewModel(
     ICoreConfiguration coreConfiguration,
     IGreenshotLanguage greenshotLanguage
     )
 {
     CoreConfiguration = coreConfiguration;
     GreenshotLanguage = greenshotLanguage;
 }
コード例 #24
0
 /// <summary>
 /// Constructor with dependencies
 /// </summary>
 /// <param name="coreConfiguration">ICoreConfiguration</param>
 /// <param name="greenshotLanguage">IGreenshotLanguage</param>
 public UpdateService(
     ICoreConfiguration coreConfiguration,
     IGreenshotLanguage greenshotLanguage)
 {
     _coreConfiguration = coreConfiguration;
     _greenshotLanguage = greenshotLanguage;
     LatestVersion      = CurrentVersion = GetType().Assembly.GetName().Version;
     _coreConfiguration.LastSaveWithVersion = CurrentVersion.ToString();
 }
コード例 #25
0
 public OutputConfigViewModel(
     ICoreConfiguration coreConfiguration,
     IGreenshotLanguage greenshotLanguage,
     FileConfigPartViewModel fileConfigPartViewModel)
 {
     CoreConfiguration       = coreConfiguration;
     GreenshotLanguage       = greenshotLanguage;
     FileConfigPartViewModel = fileConfigPartViewModel;
 }
コード例 #26
0
 public ExternalCommandDestinationProvider(
     IExternalCommandConfiguration externalCommandConfiguration,
     ICoreConfiguration coreConfiguration,
     IGreenshotLanguage greenshotLanguage)
 {
     _externalCommandConfig = externalCommandConfiguration;
     _coreConfiguration     = coreConfiguration;
     _greenshotLanguage     = greenshotLanguage;
 }
コード例 #27
0
        /// <summary>
        ///     Supply values we can't put as defaults
        /// </summary>
        /// <param name="property">The property to return a default for</param>
        /// <returns>object with the default value for the supplied property</returns>
        public static object GetDefault(this ICoreConfiguration coreConfiguration, string property)
        {
            switch (property)
            {
            case "OutputFileAsFullpath":
                if (coreConfiguration.IsPortable)
                {
                    return(Path.Combine(Application.StartupPath, @"..\..\Documents\Pictures\Greenshots\dummy.png"));
                }
                return(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "dummy.png"));

            case "OutputFilePath":
                if (!coreConfiguration.IsPortable)
                {
                    return(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
                }

                var pafOutputFilePath = Path.Combine(Application.StartupPath, @"..\..\Documents\Pictures\Greenshots");
                if (!Directory.Exists(pafOutputFilePath))
                {
                    try
                    {
                        Directory.CreateDirectory(pafOutputFilePath);
                        return(pafOutputFilePath);
                    }
                    catch (Exception ex)
                    {
                        Log.Warn().WriteLine(ex);
                        // Problem creating directory, fallback to Desktop
                    }
                }
                else
                {
                    return(pafOutputFilePath);
                }
                return(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));

            case "DWMBackgroundColor":
                return(Color.Transparent);

            case "ActiveTitleFixes":
                return(new List <string> {
                    "Firefox", "IE", "Chrome"
                });

            case "TitleFixMatcher":
                return(new Dictionary <string, string> {
                    { "Firefox", " - Mozilla Firefox.*" }, { "IE", " - (Microsoft|Windows) Internet Explorer.*" }, { "Chrome", " - Google Chrome.*" }
                });

            case "TitleFixReplacer":
                return(new Dictionary <string, string> {
                    { "Firefox", "" }, { "IE", "" }, { "Chrome", "" }
                });
            }
            return(null);
        }
        public GetAccountDetailsQueryHandler(IDocumentContext documentContext, ICoreConfiguration coreConfiguration, IMediator mediator, IMapper mapper)
        {
            _mediator          = mediator;
            _mapper            = mapper;
            _coreConfiguration = coreConfiguration;
            _documentContext   = documentContext;

            //Log Activity, Check Authorization, Etc...
        }
コード例 #29
0
        /// <summary>
        ///     Validate the OutputFileAsFullpath, and if this is not correct it will be set to the default
        ///     Added for BUG-1992, reset the OutputFilePath / OutputFileAsFullpath if they don't exist (e.g. the configuration is
        ///     used on a different PC)
        /// </summary>
        public static void ValidateAndCorrectOutputFileAsFullpath(this ICoreConfiguration coreConfiguration)
        {
            var outputFilePath = Path.GetDirectoryName(coreConfiguration.OutputFileAsFullpath);

            if (outputFilePath == null || !File.Exists(coreConfiguration.OutputFileAsFullpath) && !Directory.Exists(outputFilePath))
            {
                coreConfiguration.RestoreToDefault("OutputFileAsFullpath");
            }
        }
コード例 #30
0
 public ExternalCommandDestination(ExternalCommandDefinition defintion,
                                   IExternalCommandConfiguration externalCommandConfiguration,
                                   ICoreConfiguration coreConfiguration,
                                   IGreenshotLanguage greenshotLanguage
                                   ) : base(coreConfiguration, greenshotLanguage)
 {
     _externalCommandDefinition    = defintion;
     _externalCommandConfiguration = externalCommandConfiguration;
 }
 public Widget(ICoreConfiguration configuration)
 {
     this.configuration = configuration;
 }