Пример #1
0
        public T ReadSection([NotNull] PhotoshopFileReader reader, [NotNull] PhotoshopFile file)
        {
            Assert.NotNull(reader, nameof(reader));
            Assert.NotNull(file, nameof(file));
            var value = _readingStrategy.Read(reader, file);

            _validationStrategy?.Validate(value);
            return(value);
        }
Пример #2
0
        private PhotoshopFile(
            [NotNull] Stream stream,
            [NotNull] PhotoshopFileSectionReader <HeaderSection> headerSectionReader,
            [NotNull] PhotoshopFileSectionReader <ColorModeDataSection> colorModeDataSectionReader,
            [NotNull] PhotoshopFileSectionReader <ImageResourcesSection> imageResourcesSectionReader,
            [NotNull] PhotoshopFileSectionReader <LayerMaskInformationSection> layerMaskInformationSectionReader,
            [NotNull] PhotoshopFileSectionReader <ImageDataSection> imageDataSectionReader)
        {
            Assert.NotNull(stream, nameof(stream));
            Assert.NotNull(headerSectionReader, nameof(headerSectionReader));
            Assert.NotNull(colorModeDataSectionReader, nameof(colorModeDataSectionReader));
            Assert.NotNull(imageResourcesSectionReader, nameof(imageResourcesSectionReader));
            Assert.NotNull(layerMaskInformationSectionReader, nameof(layerMaskInformationSectionReader));
            Assert.NotNull(imageDataSectionReader, nameof(imageDataSectionReader));

            _stream = stream;
            _reader = new PhotoshopFileReader(stream);

            _headerSection               = headerSectionReader.ReadSection(_reader, this);
            _colorModeDataSection        = colorModeDataSectionReader.ReadSection(_reader, this);
            _imageResourcesSection       = imageResourcesSectionReader.ReadSection(_reader, this);
            _layerMaskInformationSection = layerMaskInformationSectionReader.ReadSection(_reader, this);
            _imageDataSection            = imageDataSectionReader.ReadSection(_reader, this);
        }