Example #1
0
        public IBlobService CreateDataLakeService(string container, string basePath)
        {
            var connectionString = _connectionStringInfo.DataLakeConnectionString;
            var blobService      = new AzureBlobStorageService(connectionString, container, basePath);

            return(blobService);
        }
Example #2
0
 /// <summary>
 /// Creates a new instance of <see cref="ImageController"/>
 /// </summary>
 /// <param name="azureBlobStorageService"></param>
 /// <param name="dataStorageConfiguration"></param>
 /// <param name="blazorRestaurantDbContext"></param>
 public ImageController(AzureBlobStorageService azureBlobStorageService,
                        DataStorageConfiguration dataStorageConfiguration, BlazorRestaurantDbContext blazorRestaurantDbContext)
 {
     this.AzureBlobStorageService   = azureBlobStorageService;
     this.DataStorageConfiguration  = dataStorageConfiguration;
     this.BlazorRestaurantDbContext = blazorRestaurantDbContext;
 }
Example #3
0
        public void Setup()
        {
            fakeScsStorageService = A.Fake <ISalesCatalogueStorageService>();
            fakeStorageConfig     = Options.Create(new EssFulfilmentStorageConfiguration()
            {
                QueueName                    = "",
                StorageAccountKey            = "",
                StorageAccountName           = "",
                StorageContainerName         = "",
                DynamicQueueName             = "ess-{0}-test",
                LargeExchangeSetAccountKey   = "LargeExchangeSetAccountKey",
                LargeExchangeSetAccountName  = "LargeExchangeSetAccountName",
                LargeExchangeSetInstance     = 2,
                LargeExchangeSetSizeInMB     = 300,
                MediumExchangeSetAccountKey  = "MediumExchangeSetAccountKey",
                MediumExchangeSetAccountName = "MediumExchangeSetAccountName",
                MediumExchangeSetInstance    = 3,
                SmallExchangeSetAccountKey   = "SmallExchangeSetAccountKey",
                SmallExchangeSetAccountName  = "SmallExchangeSetAccountName",
                SmallExchangeSetInstance     = 2,
                SmallExchangeSetSizeInMB     = 50
            });

            fakeAzureMessageQueueHelper = A.Fake <IAzureMessageQueueHelper>();
            fakeLogger = A.Fake <ILogger <AzureBlobStorageService> >();
            fakeAzureBlobStorageClient    = A.Fake <IAzureBlobStorageClient>();
            fakeSmallExchangeSetInstance  = A.Fake <ISmallExchangeSetInstance>();
            fakeMediumExchangeSetInstance = A.Fake <IMediumExchangeSetInstance>();
            fakeLargeExchangeSetInstance  = A.Fake <ILargeExchangeSetInstance>();

            azureBlobStorageService = new AzureBlobStorageService(fakeScsStorageService, fakeStorageConfig,
                                                                  fakeAzureMessageQueueHelper, fakeLogger, fakeAzureBlobStorageClient, fakeSmallExchangeSetInstance,
                                                                  fakeMediumExchangeSetInstance, fakeLargeExchangeSetInstance);
        }
        public void Verify([FromBody] VerifyImageDataRequestViewModel request)
        {
            IOcrService         ocrService  = new GoogleVisionService();
            string              serviceName = ocrService.Service;
            IFileStorageService fsService   = new AzureBlobStorageService(serviceName);

            fsService.MoveToSubFolderAsync(request.ScanId, request.Status.ToString());
        }
        public async Task <IBlobService> CreateBlobServiceAsync(string container, string basePath)
        {
            var connectionString = await _configurationReaderService.GetValueAsync(SystemKeys.ConfigurationKeys.StoragePrimaryConnectionString);

            var blobService = new AzureBlobStorageService(connectionString, container, basePath);

            return(blobService);
        }
Example #6
0
        private static AzureBlobStorageService InstantiateStorageService()
        {
            var storageService = new AzureBlobStorageService(
                new AzureBlobStorageServiceArgs
            {
                ConnectionString = Environment.GetEnvironmentVariable("AzureWebJobsStorage"),
                ContainerName    = Environment.GetEnvironmentVariable("ContainerName")
            });

            return(storageService);
        }
 /// <summary>
 /// Initializes <see cref="FilesaveController"/>
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="azureBlobStorageService"></param>
 /// <param name="dataStorageConfiguration"></param>
 /// <param name="currentUserProvider"></param>
 public FilesaveController(
     ILogger <FilesaveController> logger,
     AzureBlobStorageService azureBlobStorageService,
     DataStorageConfiguration dataStorageConfiguration,
     ICurrentUserProvider currentUserProvider)
 {
     this.logger = logger;
     this.AzureBlobStorageService  = azureBlobStorageService;
     this.DataStorageConfiguration = dataStorageConfiguration;
     this.CurrentUserProvider      = currentUserProvider;
 }
        public async Task <ScanResultViewModel> Passport()
        {
            Byte[] frontImageBytes = null, backImageBytes = null;
            string fileName        = string.Empty;

            try
            {
                if (Request.HttpContext.Request.Form.Files["frontside"].FileName != null)
                {
                    var imageFrontStream = Request.HttpContext.Request.Form.Files["frontside"].OpenReadStream();
                    fileName = Request.HttpContext.Request.Form.Files["frontside"].FileName;
                    Int32 forntLength = imageFrontStream.Length > Int32.MaxValue ? Int32.MaxValue : Convert.ToInt32(imageFrontStream.Length);
                    frontImageBytes = new Byte[forntLength];
                    imageFrontStream.Read(frontImageBytes, 0, forntLength);
                }
            }
            catch (Exception) { }

            try
            {
                if (Request.HttpContext.Request.Form.Files["backside"].FileName != null)
                {
                    var   imageBackStream = Request.HttpContext.Request.Form.Files["backside"].OpenReadStream();
                    Int32 backLength      = imageBackStream.Length > Int32.MaxValue ? Int32.MaxValue : Convert.ToInt32(imageBackStream.Length);
                    backImageBytes = new Byte[backLength];
                    imageBackStream.Read(backImageBytes, 0, backLength);
                }
            }
            catch (Exception) { }

            IOcrService ocrService  = new GoogleVisionService();
            string      serviceName = ocrService.Service;

            IFileStorageService fsService  = new AzureBlobStorageService(serviceName);
            ScanResultViewModel scanResult = new ScanResultViewModel();

            scanResult.ScanId = await fsService.StoreImageAsync(frontImageBytes, backImageBytes);

            scanResult.Data = await ocrService.ScanPassportAsync(frontImageBytes, backImageBytes, fileName);

            return(scanResult);
        }
Example #9
0
 public VideoService(AzureVideoIndexerService azureVideoIndexerService, AzureBlobStorageService azureBlobStorageService,
                     DataStorageConfiguration dataStorageConfiguration, ICurrentUserProvider currentUserProvider,
                     FairplaytubeDatabaseContext fairplaytubeDatabaseContext,
                     AzureVideoIndexerConfiguration azureVideoIndexerConfiguration,
                     CustomHttpClient customHttpClient,
                     IHubContext <NotificationHub, INotificationHub> hubContext,
                     EmailService emailService,
                     IConfiguration configuration)
 {
     this.AzureVideoIndexerService       = azureVideoIndexerService;
     this.AzureBlobStorageService        = azureBlobStorageService;
     this.DataStorageConfiguration       = dataStorageConfiguration;
     this.CurrentUserProvider            = currentUserProvider;
     this.FairplaytubeDatabaseContext    = fairplaytubeDatabaseContext;
     this.AzureVideoIndexerConfiguration = azureVideoIndexerConfiguration;
     this.CustomHttpClient = customHttpClient;
     this.HubContext       = hubContext;
     this.EmailService     = emailService;
     this.Configuration    = configuration;
 }
Example #10
0
 public ProfilePictureBot(PhotoProcessorService photoProcessorService, AzureBlobStorageService azureBlobStorageService, IHttpClientFactory httpClientFactory)
 {
     _photoProcessorService   = photoProcessorService;
     _azureBlobStorageService = azureBlobStorageService;
     _httpClient = httpClientFactory.CreateClient();
 }