예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageService"/> class.
        /// </summary>
        /// <param name="loggerFactory">The logger factory.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="fileSystemStrategy">The file system strategy.</param>
        /// <param name="appInfoFactory">The application information factory.</param>
        /// <param name="jsonWriter">The JSON writer.</param>
        /// <param name="imageExtractor">The image extractor.</param>
        /// <param name="gifImageWriter">The GIF image writer.</param>
        /// <exception cref="ArgumentNullException">
        /// loggerFactory
        /// or
        /// configuration
        /// or
        /// fileSystemStrategy
        /// or
        /// appInfoFactory
        /// or
        /// jsonWriter
        /// or
        /// imageExtractor
        /// or
        /// gifImageWriter
        /// </exception>
        public ImageService(
            ILoggerFactory loggerFactory,
            IAmiConfigurationManager configuration,
            IFileSystemStrategy fileSystemStrategy,
            IAppInfoFactory appInfoFactory,
            IDefaultJsonWriter jsonWriter,
            IImageExtractor imageExtractor,
            IGifImageWriter gifImageWriter)
        {
            logger = loggerFactory?.CreateLogger <ImageService>();
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            this.configuration = configuration;
            if (this.configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            this.fileSystemStrategy = fileSystemStrategy;
            if (this.fileSystemStrategy == null)
            {
                throw new ArgumentNullException(nameof(fileSystemStrategy));
            }

            this.appInfoFactory = appInfoFactory;
            if (this.appInfoFactory == null)
            {
                throw new ArgumentNullException(nameof(appInfoFactory));
            }

            this.jsonWriter = jsonWriter;
            if (this.jsonWriter == null)
            {
                throw new ArgumentNullException(nameof(jsonWriter));
            }

            this.imageExtractor = imageExtractor;
            if (this.imageExtractor == null)
            {
                throw new ArgumentNullException(nameof(imageExtractor));
            }

            this.gifImageWriter = gifImageWriter;
            if (this.gifImageWriter == null)
            {
                throw new ArgumentNullException(nameof(gifImageWriter));
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageService"/> class.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="archiveReader">The archive reader.</param>
 /// <param name="archiveExtractor">The archive extractor.</param>
 /// <param name="fileSystemStrategy">The file system strategy.</param>
 /// <param name="appInfoFactory">The application information factory.</param>
 /// <param name="jsonWriter">The JSON writer.</param>
 /// <param name="imageExtractor">The image extractor.</param>
 /// <param name="gifImageWriter">The GIF image writer.</param>
 public ImageService(
     IAppConfiguration configuration,
     IArchiveReader archiveReader,
     IArchiveExtractor archiveExtractor,
     IFileSystemStrategy fileSystemStrategy,
     IAppInfoFactory appInfoFactory,
     IDefaultJsonWriter jsonWriter,
     IImageExtractor imageExtractor,
     IGifImageWriter gifImageWriter)
 {
     this.configuration      = configuration ?? throw new ArgumentNullException(nameof(configuration));
     this.archiveReader      = archiveReader ?? throw new ArgumentNullException(nameof(archiveReader));
     this.archiveExtractor   = archiveExtractor ?? throw new ArgumentNullException(nameof(archiveExtractor));
     this.fileSystemStrategy = fileSystemStrategy ?? throw new ArgumentNullException(nameof(fileSystemStrategy));
     this.appInfoFactory     = appInfoFactory ?? throw new ArgumentNullException(nameof(appInfoFactory));
     this.jsonWriter         = jsonWriter ?? throw new ArgumentNullException(nameof(jsonWriter));
     this.imageExtractor     = imageExtractor ?? throw new ArgumentNullException(nameof(imageExtractor));
     this.gifImageWriter     = gifImageWriter ?? throw new ArgumentNullException(nameof(gifImageWriter));
 }