Exemplo n.º 1
0
        /// <summary>
        /// Processes the App2 marker retrieving any stored ICC profile information
        /// </summary>
        /// <param name="remaining">The remaining bytes in the segment block.</param>
        private void ProcessApp2Marker(int remaining)
        {
            // Length is 14 though we only need to check 12.
            const int Icclength = 14;

            if (remaining < Icclength || this.IgnoreMetadata)
            {
                this.InputProcessor.Skip(remaining);
                return;
            }

            byte[] identifier = new byte[Icclength];
            this.InputProcessor.ReadFull(identifier, 0, Icclength);
            remaining -= Icclength; // We have read it by this point

            if (ProfileResolver.IsProfile(identifier, ProfileResolver.IccMarker))
            {
                byte[] profile = new byte[remaining];
                this.InputProcessor.ReadFull(profile, 0, remaining);

                if (this.MetaData.IccProfile == null)
                {
                    this.MetaData.IccProfile = new IccProfile(profile);
                }
                else
                {
                    this.MetaData.IccProfile.Extend(profile);
                }
            }
            else
            {
                // Not an ICC profile we can handle. Skip the remaining bytes so we can carry on and ignore this.
                this.InputProcessor.Skip(remaining);
            }
        }
Exemplo n.º 2
0
        static HomeController()
        {
            var profile = new ProfileResolver();

            var sampleProfile = new DataProfile<SampleItem>(() => new SampleItem())
            .ForMember(x => x.Name, new RandomStringValueCreator(4, 8))
            .ForMember(x => x.Group, new RandomStringValueCreator(4, 8))
            .Generate(profile, 2050);

            _demoItems = sampleProfile.ToList();
        }
Exemplo n.º 3
0
        static HomeController()
        {
            var profile = new ProfileResolver();

            var sampleProfile = new DataProfile <SampleItem>(() => new SampleItem())
                                .ForMember(x => x.Name, new RandomStringValueCreator(4, 8))
                                .ForMember(x => x.Group, new RandomStringValueCreator(4, 8))
                                .Generate(profile, 2050);

            _demoItems = sampleProfile.ToList();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Processes the App1 marker retrieving any stored metadata
        /// </summary>
        /// <param name="remaining">The remaining bytes in the segment block.</param>
        private void ProcessApp1Marker(int remaining)
        {
            if (remaining < 6 || this.IgnoreMetadata)
            {
                this.InputProcessor.Skip(remaining);
                return;
            }

            byte[] profile = new byte[remaining];
            this.InputProcessor.ReadFull(profile, 0, remaining);

            if (ProfileResolver.IsProfile(profile, ProfileResolver.ExifMarker))
            {
                this.isExif = true;
                this.MetaData.ExifProfile = new ExifProfile(profile);
            }
        }
Exemplo n.º 5
0
 public void ProfileResolverCanHandleIncorrectLength()
 {
     Assert.False(ProfileResolver.IsProfile(AdobeMarker, ProfileResolver.IccMarker));
 }
Exemplo n.º 6
0
 public void ProfileResolverCorrectlyReportsNonMarker()
 {
     Assert.False(ProfileResolver.IsProfile(IccMarker, ProfileResolver.AdobeMarker));
 }
Exemplo n.º 7
0
 public void ProfileResolverCanResolveAdobeMarker()
 {
     Assert.True(ProfileResolver.IsProfile(AdobeMarker, ProfileResolver.AdobeMarker));
 }
Exemplo n.º 8
0
 public void ProfileResolverCanResolveIccMarker()
 {
     Assert.True(ProfileResolver.IsProfile(IccMarker, ProfileResolver.IccMarker));
 }
Exemplo n.º 9
0
 public void ProfileResolverCanResolveExifMarker()
 {
     Assert.True(ProfileResolver.IsProfile(ExifMarker, ProfileResolver.ExifMarker));
 }
Exemplo n.º 10
0
 public FuncProfile(ProfileResolver innerProfile)
 {
     _innerProfile = innerProfile;
 }