Example #1
0
 /// <summary>
 /// New instance
 /// </summary>
 /// <param name="work"></param>
 /// <param name="fileSaver"></param>
 /// <param name="fileRetriever"></param>
 public ProgramsController(IProgramsUnitOfWork work, IFileSaver fileSaver, IFileRetriever fileRetriever)
 {
     this.fileSaver       = fileSaver;
     this.fileRetriever   = fileRetriever;
     this.telemetryClient = new TelemetryClient();
     this.Work            = work;
 }
Example #2
0
 /// <summary>
 /// New instance
 /// </summary>
 /// <param name="work"></param>
 /// <param name="fileSaver"></param>
 /// <param name="fileRetriever"></param>
 public UpdatePackagesController(IProgramsUnitOfWork work, IFileSaver fileSaver, IFileRetriever fileRetriever, IFileRemover fileRemover)
 {
     this.FileRetriever = fileRetriever;
     this.work          = work;
     this.fileSaver     = fileSaver;
     this.fileRemover   = fileRemover;
 }
Example #3
0
 public CategoryController(UserManager <IdentityUser> userManager,
                           IWebHostEnvironment appEnvironment,
                           IFileSaver fileSaver) : base(userManager)
 {
     _appEnvironment = appEnvironment;
     _fileSaver      = fileSaver;
 }
Example #4
0
 public ImageSaverController(IFileSaver fileSaver, IFileMover fileMover, IFileDeleter fileDeleter, ILogger <ImageSaverController> logger)
 {
     _fileSaver   = fileSaver;
     _fileMover   = fileMover;
     _fileDeleter = fileDeleter;
     _logger      = logger;
 }
Example #5
0
 public ReportDownloader(ISerializer serializer, IFileSaver fileSaver, IReportBuilder reportBuilder, string filePath)
 {
     _serializer    = serializer;
     _fileSaver     = fileSaver;
     _reportBuilder = reportBuilder;
     _filePath      = filePath;
 }
        public static IServiceProvider Initialize(
            IServiceCollection services,
            string connectionString,
            ICacheStore cacheStore,
            IEmailSender emailSender,
            IFileSaver fileSaver,
            EmailsSettings emailsSettings,
            AzureBlobStorageSettings azureBlobStorageSettings,
            ILogger logger,
            IExecutionContextAccessor executionContextAccessor,
            IUserAuthIdProvider userAuthIdProvider,
            bool runQuartz = true)
        {
            if (runQuartz)
            {
                StartQuartz(connectionString, emailsSettings, azureBlobStorageSettings, logger, executionContextAccessor, userAuthIdProvider);
            }

            services.AddSingleton(cacheStore);

            var serviceProvider = CreateAutofacServiceProvider(
                services,
                connectionString,
                emailSender,
                fileSaver,
                emailsSettings,
                azureBlobStorageSettings,
                logger,
                executionContextAccessor,
                userAuthIdProvider);

            return(serviceProvider);
        }
        public async Task <IActionResult> Post(
            [FromServices] IFileSaver fileSaver,
            [FromServices] IConfiguration configuration,
            [FromForm] ProductAddCommand command,
            ApiVersion version
            )
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (command.Photo != null && command.Photo.Length > 0)
            {
                command.PhotoName = await fileSaver.SaveAsync(command.Photo, configuration["Settings:ProductPhotoDirectory"]);
            }

            var id = await _mediator.Send(command);

            await _unitOfWork.CommitAsync();

            return(CreatedAtAction(nameof(Get), new { id, Version = $"{version}" }, new ProductDto {
                Id = id
            }));
        }
Example #8
0
        /// <summary>
        /// Creates a new instance of <see cref="PluginManager"/>.
        /// </summary>
        /// <param name="progress">The progress context for plugin processes.</param>
        /// <param name="dialogManager">The dialog manager for plugin processes.</param>
        /// <param name="pluginPaths">The paths to search for plugins.</param>
        public PluginManager(IProgressContext progress, IDialogManager dialogManager, params string[] pluginPaths)
        {
            ContractAssertions.IsNotNull(progress, nameof(progress));
            ContractAssertions.IsNotNull(dialogManager, nameof(dialogManager));

            // 1. Setup all necessary instances
            _filePluginLoaders  = new IPluginLoader <IFilePlugin>[] { new CsFilePluginLoader(pluginPaths) };
            _gameAdapterLoaders = new IPluginLoader <IGameAdapter>[] { new CsGamePluginLoader(pluginPaths) };

            _progress      = progress;
            _dialogManager = dialogManager;

            LoadErrors = _filePluginLoaders.SelectMany(pl => pl.LoadErrors ?? Array.Empty <PluginLoadError>())
                         .Concat(_gameAdapterLoaders.SelectMany(pl => pl.LoadErrors ?? Array.Empty <PluginLoadError>()))
                         .DistinctBy(e => e.AssemblyPath)
                         .ToList();

            _streamMonitor = new StreamMonitor();

            _fileLoader = new FileLoader(_filePluginLoaders);
            _fileSaver  = new FileSaver(_streamMonitor, dialogManager);

            _fileLoader.OnManualSelection += FileLoader_OnManualSelection;

            _loadedFiles = new List <IStateInfo>();
        }
Example #9
0
 public GymSessionScheduleService(
     IGymSessionScheduleRepository gymSessionScheduleRepository,
     IFileSaver fileSaver
     )
 {
     _gymSessionScheduleRepository = gymSessionScheduleRepository;
     _fileSaver = fileSaver;
 }
 /// <summary>
 /// New instance
 /// </summary>
 /// <param name="work"></param>
 /// <param name="fileSaver"></param>
 /// <param name="fileRetriever"></param>
 public UpdatePackagesController(IProgramsUnitOfWork work, IFileSaver fileSaver, IFileRetriever fileRetriever, IFileRemover fileRemover, TelemetryClient telemetryClient)
 {
     this.FileRetriever   = fileRetriever;
     this.work            = work;
     this.fileSaver       = fileSaver;
     this.fileRemover     = fileRemover;
     this.telemetryClient = telemetryClient;
 }
Example #11
0
 public ParsingManager(IParser parser, IFileReder fileReder, IFileSaver fileSaver, List <IParsingRule> parsingRulList, List <IDeleteRule> DeleteRuleList)
 {
     this.parser         = parser;
     this.fileReder      = fileReder;
     this.fileSaver      = fileSaver;
     this.parsingRulList = parsingRulList;
     deleteRuleList      = DeleteRuleList;
 }
Example #12
0
 public ArticleController(UserManager <IdentityUser> userManager,
                          RoleManager <IdentityRole> roleManager,
                          IFileSaver fileSaver,
                          IWebHostEnvironment appEnvironment) : base(userManager)
 {
     _roleManager    = roleManager;
     _fileSaver      = fileSaver;
     _appEnvironment = appEnvironment;
 }
Example #13
0
 public TestFileGenerator(ILogger <TestFileGenerator> logger, ITestDataGenerator testDataGenerator,
                          IFileSaver fileSaver, IFilenameGenerator filenameGenerator, IOptionsSnapshot <GeneratorConfiguration> options)
 {
     _logger                 = logger;
     _testDataGenerator      = testDataGenerator;
     _fileSaver              = fileSaver;
     _filenameGenerator      = filenameGenerator;
     _generatorConfiguration = options.Value;
 }
Example #14
0
 protected AbstractResource(IResourceLoader resourceLoader, 
     IFileSaver fileSaver, 
     Uri uri, 
     IResourceLocationManager resourceLocationManager)
 {
     _resourceLocationManager = resourceLocationManager;
     _resourceLoader = resourceLoader;
     _fileSaver = fileSaver;
     Uri = uri;
 }
Example #15
0
        /// <summary>
        /// Internal constructor for testing.
        /// </summary>
        /// <param name="pluginLoaders">The plugin loaders for this instance.</param>
        /// <param name="fileLoader">The file loader for this instance.</param>
        /// <param name="fileSaver">The file saver for this instance.</param>
        internal PluginManager(IPluginLoader[] pluginLoaders, IFileLoader fileLoader, IFileSaver fileSaver)
        {
            _filePluginLoaders = pluginLoaders.Where(x => x is IPluginLoader <IFilePlugin>)
                                 .Cast <IPluginLoader <IFilePlugin> >().ToArray();

            _fileLoader = fileLoader;
            _fileSaver  = fileSaver;

            _loadedFiles = new List <IStateInfo>();
        }
Example #16
0
 public void SetUp()
 {
     textReader            = A.Fake <ITextReader>();
     wordsFilter           = A.Fake <IWordsFilter>();
     wordsCounter          = A.Fake <IWordsCounter>();
     wordsToSizesConverter = A.Fake <IWordsToSizesConverter>();
     ccl        = A.Fake <ICloudLayouter>();
     visualiser = A.Fake <IVisualiser>();
     imageSaver = A.Fake <IFileSaver>();
 }
Example #17
0
        public SaveNoteCommand([NotNull] INotebook notebook, [NotNull] IUserFileInput userFileInput,
                               [NotNull] IFileSaver fileSaver)
        {
            ThrowIf.Variable.IsNull(notebook, nameof(notebook));
            ThrowIf.Variable.IsNull(userFileInput, nameof(userFileInput));
            ThrowIf.Variable.IsNull(fileSaver, nameof(fileSaver));

            _notebook      = notebook;
            _userFileInput = userFileInput;
            _fileSaver     = fileSaver;
        }
Example #18
0
        //Given a directory with images, SaveImages() copies them to another directory
        //has multiframe capability
        public void FileSaver_SaveImages(IFileSaver fileSaver)
        {
            fileSaver.SourceFilePath = @"c:\testImage\Source\OneColorTiff\";
            fileSaver.TargetFilePath = @"c:\testImage\Target\OneGrayScaleTiff\";

            foreach (var file in fileSaver.FilesToProcess)
            {
                Bitmap bitMap = (Bitmap)Image.FromFile(file);
                fileSaver.TargetFileName = Path.GetFileName(file);
                fileSaver.SaveImages(bitMap);
            }
        }
Example #19
0
 public RimsController(
     IRimsService rimsService,
     IFileSaver fileSaver, IIdentifierProvider identifierProvider,
     IStatisticsHubCorresponder statisticsHubCorresponder,
     IStatisticsService statisticsService)
 {
     this.rimsService               = rimsService;
     this.fileSaver                 = fileSaver;
     this.identifierProvider        = identifierProvider;
     this.statisticsHubCorresponder = statisticsHubCorresponder;
     this.statisticsService         = statisticsService;
 }
Example #20
0
 public FilesController(
     IContextService contextService,
     IDocumentRender documentRender,
     IFilesStorage filesStorage,
     IFileSaver fileSaver,
     IFilesOperationService filesOperationService)
 {
     _contextService        = contextService;
     _documentRender        = documentRender;
     _filesStorage          = filesStorage;
     _fileSaver             = fileSaver;
     _filesOperationService = filesOperationService;
 }
Example #21
0
 public TiresController(
     ITiresService tiresService,
     IFileSaver fileSaver,
     IIdentifierProvider identifierProvider,
     IStatisticsHubCorresponder statisticsHubCorresponder,
     IStatisticsService statisticsService
     )
 {
     this.tiresService              = tiresService;
     this.fileSaver                 = fileSaver;
     this.identifierProvider        = identifierProvider;
     this.statisticsHubCorresponder = statisticsHubCorresponder;
     this.statisticsService         = statisticsService;
 }
Example #22
0
 public SiteDownloader(ILinkParser linkParser, IFileSaver fileSaver, ISaver saver, IDownloader downloader, ILogger logger, DownloadOptions options)
 {
     _linkParser     = linkParser;
     _fileSaver      = fileSaver;
     _saver          = saver;
     _downloader     = downloader;
     _logger         = logger;
     _startUri       = new Uri(options.StartUri);
     _downloadPath   = options.DownloadPath;
     _referenceDepth = options.ReferenceDepth;
     _extensions     = GetExtensionsFromString(options.ExtensionRestriction);
     _transferType   = options.DomainTransfer;
     _linksMapping   = new Dictionary <string, string>();
 }
        public AddReviewPresenter(IAddReviewView view, IUsersService usersService, IFileSaver fileSaver) : base(view)
        {
            if (usersService == null)
            {
                throw new ArgumentNullException(nameof(usersService));
            }

            if (fileSaver == null)
            {
                throw new ArgumentNullException(nameof(fileSaver));
            }

            this.usersService     = usersService;
            this.fileSaver        = fileSaver;
            this.View.SaveReview += View_SaveReview;
        }
        public ManageAvatarPresenter(IManageAvatarView view, IUsersService usersService, IFileSaver fileSaver)
            : base(view)
        {
            if (usersService == null)
            {
                throw new ArgumentNullException(nameof(usersService));
            }

            if (fileSaver == null)
            {
                throw new ArgumentNullException(nameof(fileSaver));
            }
            this.usersService         = usersService;
            this.fileSaver            = fileSaver;
            this.View.GetCurrentUser += View_MyInit;
            this.View.SetNewAvatar   += View_SetNewAvatar;
        }
        private static IServiceProvider CreateAutofacServiceProvider(
            IServiceCollection services,
            string connectionString,
            IEmailSender emailSender,
            IFileSaver fileSaver,
            EmailsSettings emailsSettings,
            AzureBlobStorageSettings azureBlobStorageSettings,
            ILogger logger,
            IExecutionContextAccessor executionContextAccessor,
            IUserAuthIdProvider userAuthIdProvider)
        {
            var container = new ContainerBuilder();

            container.Populate(services);

            container.RegisterModule(new LoggingModule(logger));
            container.RegisterModule(new DataAccessModule(connectionString));
            container.RegisterModule(new MediatorModule());
            container.RegisterModule(new DomainModule());
            container.RegisterModule(new GedcomXToDomainModule());
            container.RegisterModule(new AuthenticationModule(userAuthIdProvider));
            container.RegisterModule(new AzureBlobStorageModule(azureBlobStorageSettings, fileSaver));

            if (emailSender != null)
            {
                container.RegisterModule(new EmailModule(emailSender, emailsSettings));
            }
            else
            {
                container.RegisterModule(new EmailModule(emailsSettings));
            }

            container.RegisterModule(new ProcessingModule());

            container.RegisterInstance(executionContextAccessor);

            var buildContainer = container.Build();

            ServiceLocator.SetLocatorProvider(() => new AutofacServiceLocator(buildContainer));

            var serviceProvider = new AutofacServiceProvider(buildContainer);

            CompositionRoot.SetContainer(buildContainer);

            return(serviceProvider);
        }
Example #26
0
 public TagsCloudContainer(ITextReader textReader, IWordsFilter wordsFilter, IWordsCounter wordsCounter,
                           IWordsToSizesConverter wordsToSizesConverter,
                           ICloudLayouter ccl, IVisualiser visualiser, IFileSaver fileSaver,
                           string output,
                           string input
                           )
 {
     this.textReader            = textReader;
     this.wordsFilter           = wordsFilter;
     this.wordsCounter          = wordsCounter;
     this.wordsToSizesConverter = wordsToSizesConverter;
     CCL             = ccl;
     this.visualiser = visualiser;
     outputFile      = output;
     inputFile       = input;
     imageSaver      = fileSaver;
 }
Example #27
0
 public FilesController(
     IContextService contextService,
     IDocumentRender documentRender,
     IFilesStorage filesStorage,
     IFileSaver fileSaver,
     IFilesOperationService filesOperationService,
     IFileStorageProvider fileStorageProvider,
     IOptions <AppSettings> options)
 {
     _contextService        = contextService;
     _documentRender        = documentRender;
     _fileStorageProvider   = fileStorageProvider;
     _options               = options;
     _filesStorage          = filesStorage;
     _fileSaver             = fileSaver;
     _filesOperationService = filesOperationService;
 }
Example #28
0
        /// <summary>
        /// Creates a new instance of <see cref="PluginManager"/>.
        /// </summary>
        /// <param name="pluginLoaders">The plugin loaders for this manager.</param>
        public PluginManager(params IPluginLoader[] pluginLoaders)
        {
            _filePluginLoaders  = pluginLoaders.Where(x => x is IPluginLoader <IFilePlugin>).Cast <IPluginLoader <IFilePlugin> >().ToArray();
            _gameAdapterLoaders = pluginLoaders.Where(x => x is IPluginLoader <IGameAdapter>).Cast <IPluginLoader <IGameAdapter> >().ToArray();

            LoadErrors = pluginLoaders.SelectMany(pl => pl.LoadErrors ?? Array.Empty <PluginLoadError>())
                         .DistinctBy(e => e.AssemblyPath)
                         .ToList();

            _streamMonitor = new StreamMonitor();

            _fileLoader = new FileLoader(_filePluginLoaders);
            _fileSaver  = new FileSaver(_streamMonitor);

            _fileLoader.OnManualSelection += FileLoader_OnManualSelection;

            _loadedFiles = new List <IStateInfo>();
        }
Example #29
0
        /// <summary>
        /// Creates a new instance of <see cref="PluginManager"/>.
        /// </summary>
        /// <param name="pluginPaths">The paths to search for plugins.</param>
        public PluginManager(params string[] pluginPaths)
        {
            // 1. Setup all necessary instances
            _filePluginLoaders  = new IPluginLoader <IFilePlugin>[] { new CsFilePluginLoader(pluginPaths) };
            _gameAdapterLoaders = new IPluginLoader <IGameAdapter>[] { new CsGamePluginLoader(pluginPaths) };

            LoadErrors = _filePluginLoaders.SelectMany(pl => pl.LoadErrors ?? Array.Empty <PluginLoadError>())
                         .Concat(_gameAdapterLoaders.SelectMany(pl => pl.LoadErrors ?? Array.Empty <PluginLoadError>()))
                         .DistinctBy(e => e.AssemblyPath)
                         .ToList();

            _streamMonitor = new StreamMonitor();

            _fileLoader = new FileLoader(_filePluginLoaders);
            _fileSaver  = new FileSaver(_streamMonitor);

            _fileLoader.OnManualSelection += FileLoader_OnManualSelection;

            _loadedFiles = new List <IStateInfo>();
        }
Example #30
0
        private void InitializeTestHelper(OperationMode.WhichOperation operation)
        {
            kernel = new StandardKernel(new RunnerModule());

            fileSaver  = kernel.Get <FileSaver>();
            fileGetter = kernel.Get <FileGetter>();

            atalasoftGrayscaleTransformer   = kernel.Get <AtalasoftGrayscaleTransformer>();
            dotNetGrayscaleTransformer      = kernel.Get <DotnetGrayscaleTransformer>();
            leadToolsGrayscaleTransformer   = kernel.Get <LeadtoolsGrayscaleTransformer>();
            imageMagickGrayscaleTransformer = kernel.Get <ImageMagickGrayscaleTransformer>();

            leadToolsTifPdfTransformer = kernel.Get <ITifPdfTransformer>();

            leadToolsDpiTransformer = kernel.Get <LeadtoolsDpiTransformer>();

            //dotNetImageTransformer = kernel.Get<DotnetImageTransformer>();
            //leadToolsImageTransformer = kernel.Get<ILeadToolsImageTransformer>();

            _operation = operation;
        }
Example #31
0
 public ResourceFactory(IResourceLoader resourceLoader, 
     IFileSaver fileSaver,
     //NMB easily change place
     IResourceLocationManager resourceLocationManagerForUnprocessableResources, 
     IResourceLocationManager resourceLocationManagerForPages, 
     //NMB easily change place 2
     IRelativePathProducer relativePathProducerForUnprocessableResources, 
     IRelativePathProducer pageRelativePathProducerForPages, 
     Uri initialHostUri, 
     bool loadOtherOrigins, 
     IResourcesStack resourcesStack)
 {
     _initialHostUri = initialHostUri;
     _resourceLoader = resourceLoader;
     _fileSaver = fileSaver;
     _resourceLocationManagerForUnprocessableResources = resourceLocationManagerForUnprocessableResources;
     _resourceLocationManagerForPages = resourceLocationManagerForPages;
     _relativePathProducerForUnprocessableResources = relativePathProducerForUnprocessableResources;
     _pageRelativePathProducerForPages = pageRelativePathProducerForPages;
     _loadOtherOrigins = loadOtherOrigins;
     _resourcesStack = resourcesStack;
 }
Example #32
0
        public PluginManager(IProgressContext progress, IDialogManager dialogManager, params IPluginLoader[] pluginLoaders)
        {
            ContractAssertions.IsNotNull(progress, nameof(progress));
            ContractAssertions.IsNotNull(dialogManager, nameof(dialogManager));

            _filePluginLoaders  = pluginLoaders.Where(x => x is IPluginLoader <IFilePlugin>).Cast <IPluginLoader <IFilePlugin> >().ToArray();
            _gameAdapterLoaders = pluginLoaders.Where(x => x is IPluginLoader <IGameAdapter>).Cast <IPluginLoader <IGameAdapter> >().ToArray();

            _progress      = progress;
            _dialogManager = dialogManager;

            LoadErrors = pluginLoaders.SelectMany(pl => pl.LoadErrors ?? Array.Empty <PluginLoadError>())
                         .DistinctBy(e => e.AssemblyPath)
                         .ToList();

            _streamMonitor = new StreamMonitor();

            _fileLoader = new FileLoader(_filePluginLoaders);
            _fileSaver  = new FileSaver(_streamMonitor, dialogManager);

            _fileLoader.OnManualSelection += FileLoader_OnManualSelection;

            _loadedFiles = new List <IStateInfo>();
        }
 public void Save(ref ps.Document doc, IFileSaver fileSaver, FileInfo file)
 {
     _def.Save(ref doc, fileSaver, file);
 }
Example #34
0
 public void SetUp()
 {
     _rootFolder = ConfigurationManager.AppSettings["PathToTestFolder"];
     _fileSaver = new FileSaver();
 }
Example #35
0
 public PageResource(IResourceLocationManager resourceLocationManager, IResourceLoader resourceLoader, IFileSaver fileSaver, Uri uri, IPageResourceProcessor pageProcessors)
     : base(resourceLoader, fileSaver, uri, resourceLocationManager)
 {
     _pageProcessors = pageProcessors;
 }
Example #36
0
 public MultUploadHandler(IFileSaver getfilesaver)
 {
     FileSaver = getfilesaver;
 }
 public UnprocessableResource(IResourceLocationManager resourceLocatioManager, IResourceLoader resourceLoader, IFileSaver fileSaver, Uri uri)
     : base(resourceLoader, fileSaver, uri, resourceLocatioManager)
 {
 }