コード例 #1
0
 internal ExifToolDownload(IHttpClientHelper httpClientHelper, AppSettings appSettings, IWebLogger logger, IStorage storage)
 {
     _httpClientHelper      = httpClientHelper;
     _appSettings           = appSettings;
     _hostFileSystemStorage = storage;
     _logger = logger;
 }
コード例 #2
0
        public static void EncapsulateExceptions(this IApplicationBuilder app, string product, string layer, string defMessage)
        {
            app.UseExceptionHandler(eApp =>
            {
                eApp.Run(async context =>
                {
                    context.Response.StatusCode  = 500;
                    context.Response.ContentType = "application/json";
                    IWebLogger logger            = (IWebLogger)context.RequestServices.GetService(typeof(IWebLogger));
                    var errorCtx = context.Features.Get <IExceptionHandlerFeature>();
                    if (errorCtx != null)
                    {
                        var ex = errorCtx.Error;

                        logger.LogException(product, layer, null, ex, null, context);

                        var errorId      = Activity.Current?.Id ?? context.TraceIdentifier;
                        var jsonResponse = JsonConvert.SerializeObject(new CustomErrorResponse
                        {
                            ErrorId = errorId,
                            Message = defMessage
                        });
                        await context.Response.WriteAsync(jsonResponse, Encoding.UTF8);
                    }
                });
            });
        }
コード例 #3
0
 public PackageTelemetry(IHttpClientHelper httpClientHelper, AppSettings appSettings, IWebLogger logger, IQuery query)
 {
     _httpClientHelper = httpClientHelper;
     _appSettings      = appSettings;
     _logger           = logger;
     _query            = query;
 }
コード例 #4
0
ファイル: ExifTool.cs プロジェクト: qdraw/starsky
 public ExifTool(IStorage sourceStorage, IStorage thumbnailStorage, AppSettings appSettings, IWebLogger logger)
 {
     _appSettings      = appSettings;
     _iStorage         = sourceStorage;
     _thumbnailStorage = thumbnailStorage;
     _logger           = logger;
 }
コード例 #5
0
        private const string ExiftoolDownloadBasePathMirror = "https://qdraw.nl/special/mirror/exiftool/"; // with slash at the end

        public ExifToolDownload(IHttpClientHelper httpClientHelper, AppSettings appSettings, IWebLogger logger)
        {
            _httpClientHelper      = httpClientHelper;
            _appSettings           = appSettings;
            _hostFileSystemStorage = new StorageHostFullPathFilesystem(logger);
            _logger = logger;
        }
コード例 #6
0
ファイル: ImportQueryFactory.cs プロジェクト: qdraw/starsky
 public ImportQueryFactory(SetupDatabaseTypes setupDatabaseTypes, IImportQuery importQuery, IConsole console, IWebLogger logger)
 {
     _setupDatabaseTypes = setupDatabaseTypes;
     _importQuery        = importQuery;
     _console            = console;
     _logger             = logger;
 }
コード例 #7
0
        public static IWebLogger GetWebLogger()
        {
            lock (typeof(WebLoggers))
            {
                if (webLogger == null)
                {
                    var webLoggerType = ConfigurationManager.Get(WebLoggerConfigurations.Group, WebLoggerConfigurations.Type);
                    if (String.Equals(webLoggerType, FileWebLoggerType, StringComparison.OrdinalIgnoreCase))
                    {
                        webLogger = CreateFileWebLogger();
                    }
                    //else if (String.Equals(webLoggerType, RabbitMqWebLoggerType, StringComparison.OrdinalIgnoreCase))
                    //{
                    //}

                    var regObject = webLogger as IRegisteredObject;
                    if (regObject != null)
                    {
                        HostingEnvironment.RegisterObject(regObject);
                    }
                }

                return(webLogger);
            }
        }
コード例 #8
0
ファイル: Import.cs プロジェクト: qdraw/starsky
        public Import(
            ISelectorStorage selectorStorage,
            AppSettings appSettings,
            IImportQuery importQuery,
            IExifTool exifTool,
            IQuery query,
            IConsole console,
            IMetaExifThumbnailService metaExifThumbnailService,
            IWebLogger logger,
            IMemoryCache?memoryCache = null)
        {
            _importQuery = importQuery;

            _filesystemStorage = selectorStorage.Get(SelectorStorage.StorageServices.HostFilesystem);
            _subPathStorage    = selectorStorage.Get(SelectorStorage.StorageServices.SubPath);
            _thumbnailStorage  = selectorStorage.Get(SelectorStorage.StorageServices.Thumbnail);

            _appSettings                 = appSettings;
            _readMetaHost                = new ReadMeta(_filesystemStorage, appSettings);
            _exifTool                    = exifTool;
            _query                       = query;
            _console                     = console;
            _metaExifThumbnailService    = metaExifThumbnailService;
            _memoryCache                 = memoryCache;
            _logger                      = logger;
            _updateImportTransformations = new UpdateImportTransformations(logger, _exifTool, selectorStorage, appSettings);
        }
コード例 #9
0
 public DownloadPhotoController(IQuery query, ISelectorStorage selectorStorage, IWebLogger logger)
 {
     _query            = query;
     _iStorage         = selectorStorage.Get(SelectorStorage.StorageServices.SubPath);
     _thumbnailStorage = selectorStorage.Get(SelectorStorage.StorageServices.Thumbnail);
     _logger           = logger;
 }
コード例 #10
0
ファイル: ThumbnailService.cs プロジェクト: qdraw/starsky
        public ThumbnailService(ISelectorStorage selectorStorage, IWebLogger logger)
        {
            var iStorage         = selectorStorage.Get(SelectorStorage.StorageServices.SubPath);
            var thumbnailStorage = selectorStorage.Get(SelectorStorage.StorageServices.Thumbnail);

            _thumbnail = new Thumbnail(iStorage, thumbnailStorage, logger);
        }
コード例 #11
0
 public ThumbnailGenerationController(ISelectorStorage selectorStorage,
                                      IQuery query, IWebLogger logger, IWebSocketConnectionsService connectionsService)
 {
     _selectorStorage    = selectorStorage;
     _query              = query;
     _logger             = logger;
     _connectionsService = connectionsService;
 }
コード例 #12
0
 internal DiskWatcher(
     IFileSystemWatcherWrapper fileSystemWatcherWrapper,
     IWebLogger logger, IQueueProcessor queueProcessor)
 {
     _fileSystemWatcherWrapper = fileSystemWatcherWrapper;
     _webLogger      = logger;
     _queueProcessor = queueProcessor;
 }
コード例 #13
0
 public SearchSuggestionsInflateHostedService(IServiceScopeFactory scopeFactory,
                                              IMemoryCache memoryCache, IWebLogger logger, AppSettings appSettings = null)
 {
     _scopeFactory = scopeFactory;
     _memoryCache  = memoryCache;
     _logger       = logger;
     _appSettings  = appSettings;
 }
コード例 #14
0
 public SyncSingleFile(AppSettings appSettings, IQuery query, IStorage subPathStorage, IWebLogger logger)
 {
     _appSettings    = appSettings;
     _subPathStorage = subPathStorage;
     _query          = query;
     _newItem        = new NewItem(_subPathStorage, new ReadMeta(_subPathStorage, appSettings));
     _logger         = logger;
 }
コード例 #15
0
 public SyncRemove(AppSettings appSettings, IQuery query, IMemoryCache memoryCache, IWebLogger logger)
 {
     _appSettings        = appSettings;
     _setupDatabaseTypes = new SetupDatabaseTypes(appSettings);
     _memoryCache        = memoryCache;
     _logger             = logger;
     _query = query;
 }
コード例 #16
0
        public ExifToolHostStorageService(ISelectorStorage selectorStorage, AppSettings appSettings, IWebLogger webLogger)
        {
            var iStorage         = selectorStorage.Get(SelectorStorage.StorageServices.HostFilesystem);
            var thumbnailStorage = selectorStorage.Get(SelectorStorage.StorageServices.Thumbnail);

            _exifTool  = new ExifTool(iStorage, thumbnailStorage, appSettings, _webLogger);
            _webLogger = webLogger;
        }
コード例 #17
0
 public UpdateImportTransformations(IWebLogger logger,
                                    IExifTool exifTool, ISelectorStorage selectorStorage, AppSettings appSettings)
 {
     _logger           = logger;
     _exifTool         = exifTool;
     _subPathStorage   = selectorStorage.Get(SelectorStorage.StorageServices.SubPath);
     _thumbnailStorage = selectorStorage.Get(SelectorStorage.StorageServices.Thumbnail);
     _appSettings      = appSettings;
 }
コード例 #18
0
ファイル: ImportQuery.cs プロジェクト: qdraw/starsky
        /// <summary>
        /// Query Already imported Database
        /// inject a scope to:
        /// @see: https://docs.microsoft.com/nl-nl/ef/core/miscellaneous/configuring-dbcontext#avoiding-dbcontext-threading-issues
        /// </summary>
        /// <param name="scopeFactory">to avoid threading issues with DbContext</param>
        /// <param name="console">console output</param>
        /// <param name="dbContext"></param>
        public ImportQuery(IServiceScopeFactory scopeFactory, IConsole console, IWebLogger logger, ApplicationDbContext dbContext = null)
        {
            _scopeFactory = scopeFactory;

            _console      = console;
            _logger       = logger;
            _dbContext    = dbContext;
            _isConnection = TestConnection();
        }
コード例 #19
0
 public MetaReplaceController(IMetaReplaceService metaReplaceService, IUpdateBackgroundTaskQueue queue,
                              IRealtimeConnectionsService connectionsService, IWebLogger logger, IServiceScopeFactory scopeFactory)
 {
     _scopeFactory       = scopeFactory;
     _metaReplaceService = metaReplaceService;
     _bgTaskQueue        = queue;
     _connectionsService = connectionsService;
     _logger             = logger;
 }
コード例 #20
0
 /// <summary>Replace meta content</summary>
 /// <param name="query">Starsky IQuery interface to do calls on the database</param>
 /// <param name="appSettings">Settings of the application</param>
 /// <param name="selectorStorage">storage abstraction</param>
 /// <param name="logger">web logger</param>
 public MetaReplaceService(IQuery query, AppSettings appSettings, ISelectorStorage selectorStorage, IWebLogger logger)
 {
     _query       = query;
     _appSettings = appSettings;
     if (selectorStorage != null)
     {
         _iStorage = selectorStorage.Get(SelectorStorage.StorageServices.SubPath);
     }
     _logger = logger;
 }
コード例 #21
0
 public ExportService(IQuery query, AppSettings appSettings,
                      ISelectorStorage selectorStorage, IWebLogger logger)
 {
     _appSettings           = appSettings;
     _query                 = query;
     _iStorage              = selectorStorage.Get(SelectorStorage.StorageServices.SubPath);
     _thumbnailStorage      = selectorStorage.Get(SelectorStorage.StorageServices.Thumbnail);
     _hostFileSystemStorage = selectorStorage.Get(SelectorStorage.StorageServices.HostFilesystem);
     _logger                = logger;
 }
コード例 #22
0
ファイル: GeoController.cs プロジェクト: qdraw/starsky
 public GeoController(IUpdateBackgroundTaskQueue queue,
                      ISelectorStorage selectorStorage,
                      IMemoryCache memoryCache, IWebLogger logger, IServiceScopeFactory serviceScopeFactory)
 {
     _bgTaskQueue         = queue;
     _iStorage            = selectorStorage.Get(SelectorStorage.StorageServices.SubPath);
     _cache               = memoryCache;
     _serviceScopeFactory = serviceScopeFactory;
     _logger              = logger;
 }
コード例 #23
0
ファイル: Query.cs プロジェクト: qdraw/starsky
 public Query(ApplicationDbContext context,
              AppSettings appSettings,
              IServiceScopeFactory scopeFactory,
              IWebLogger logger, IMemoryCache memoryCache = null)
 {
     _context      = context;
     _cache        = memoryCache;
     _appSettings  = appSettings;
     _scopeFactory = scopeFactory;
     _logger       = logger;
 }
コード例 #24
0
ファイル: SearchService.cs プロジェクト: qdraw/starsky
 public SearchService(
     ApplicationDbContext context,
     IMemoryCache memoryCache = null,
     AppSettings appSettings  = null,
     IWebLogger logger        = null)
 {
     _context     = context;
     _cache       = memoryCache;
     _appSettings = appSettings;
     _logger      = logger;
 }
コード例 #25
0
        public DiskWatcher(IFileSystemWatcherWrapper fileSystemWatcherWrapper,
                           IServiceScopeFactory scopeFactory)
        {
            _fileSystemWatcherWrapper = fileSystemWatcherWrapper;
            var serviceProvider = scopeFactory.CreateScope().ServiceProvider;

            _webLogger = serviceProvider.GetService <IWebLogger>();
            var memoryCache = serviceProvider.GetService <IMemoryCache>();

            _queueProcessor = new QueueProcessor(scopeFactory, new SyncWatcherConnector(scopeFactory).Sync, memoryCache);
        }
コード例 #26
0
 public MetaExifThumbnailService(AppSettings appSettings, ISelectorStorage selectorStorage,
                                 IOffsetDataMetaExifThumbnail offsetDataMetaExifThumbnail,
                                 IWriteMetaThumbnailService writeMetaThumbnailService, IWebLogger logger)
 {
     _appSettings                 = appSettings;
     _iStorage                    = selectorStorage.Get(SelectorStorage.StorageServices.SubPath);
     _thumbnailStorage            = selectorStorage.Get(SelectorStorage.StorageServices.Thumbnail);
     _offsetDataMetaExifThumbnail = offsetDataMetaExifThumbnail;
     _writeMetaThumbnailService   = writeMetaThumbnailService;
     _logger = logger;
 }
コード例 #27
0
ファイル: PublishController.cs プロジェクト: qdraw/starsky
 public PublishController(AppSettings appSettings, IPublishPreflight publishPreflight,
                          IWebHtmlPublishService publishService, IMetaInfo metaInfo, ISelectorStorage selectorStorage,
                          IUpdateBackgroundTaskQueue queue, IWebLogger webLogger)
 {
     _appSettings      = appSettings;
     _publishPreflight = publishPreflight;
     _publishService   = publishService;
     _metaInfo         = metaInfo;
     _hostStorage      = selectorStorage.Get(SelectorStorage.StorageServices.HostFilesystem);
     _bgTaskQueue      = queue;
     _webLogger        = webLogger;
 }
コード例 #28
0
ファイル: MetaUpdateController.cs プロジェクト: qdraw/starsky
 public MetaUpdateController(IMetaPreflight metaPreflight,
                             IMetaUpdateService metaUpdateService,
                             IUpdateBackgroundTaskQueue queue,
                             IWebLogger logger,
                             IServiceScopeFactory scopeFactory)
 {
     _metaPreflight     = metaPreflight;
     _scopeFactory      = scopeFactory;
     _metaUpdateService = metaUpdateService;
     _bgTaskQueue       = queue;
     _logger            = logger;
 }
コード例 #29
0
 public GeoBackgroundTask(AppSettings appSettings, ISelectorStorage selectorStorage,
                          IGeoLocationWrite geoLocationWrite, IMemoryCache memoryCache,
                          IWebLogger logger, IGeoReverseLookup geoReverseLookup)
 {
     _appSettings      = appSettings;
     _iStorage         = selectorStorage.Get(SelectorStorage.StorageServices.SubPath);
     _thumbnailStorage = selectorStorage.Get(SelectorStorage.StorageServices.Thumbnail);
     _readMeta         = new ReadMeta(_iStorage);
     _geoLocationWrite = geoLocationWrite;
     _logger           = logger;
     _geoIndexGpx      = new GeoIndexGpx(_appSettings, _iStorage, memoryCache);
     _geoReverseLookup = geoReverseLookup;
 }
コード例 #30
0
 public ManualBackgroundSyncService(ISynchronize synchronize, IQuery query,
                                    IWebSocketConnectionsService connectionsService,
                                    IMemoryCache cache, IWebLogger logger, IUpdateBackgroundTaskQueue bgTaskQueue,
                                    IServiceScopeFactory scopeFactory)
 {
     _synchronize        = synchronize;
     _connectionsService = connectionsService;
     _query        = query;
     _cache        = cache;
     _logger       = logger;
     _bgTaskQueue  = bgTaskQueue;
     _scopeFactory = scopeFactory;
 }
コード例 #31
0
 public WebLoggerModule()
 {
     webLogger = WebLoggers.GetWebLogger();
 }