public GenerateBinaryOperation(GenerateBinaryOperationOptions arguments, ILoggerFactory loggerFactory)
        {
            _loggerFactory = loggerFactory ?? throw new ArgumentOutOfRangeException(nameof(loggerFactory));
            _logger        = _loggerFactory.CreateLogger <GenerateBinaryOperation>();
            _arguments     = arguments;

            _generator = new BinaryGenerator(loggerFactory);
        }
Exemple #2
0
        public Binary GenerateBinary(GenerateBinaryOperationOptions arguments)
        {
            _logger.LogInformation($"Loading file: '{arguments.Path}'.");

            var bytes = File.ReadAllBytes(arguments.Path.Path);

            return(new Binary
            {
                Id = arguments?.Id,
                ContentType = arguments?.ContentType,
                SecurityContext = new ResourceReference
                {
                    Reference = arguments?.SecurityContext
                },
                Data = bytes
            });
        }
 private void Validate(GenerateBinaryOperationOptions arguments)
 {
     arguments.Path.Validate(nameof(arguments.Path));
 }