Exemplo n.º 1
0
        /// <summary>
        /// Reads a profile description
        /// </summary>
        /// <returns>the profile description</returns>
        public IccProfileDescription ReadProfileDescription()
        {
            uint manufacturer   = this.ReadUInt32();
            uint model          = this.ReadUInt32();
            var  attributes     = (IccDeviceAttribute)this.ReadInt64();
            var  technologyInfo = (IccProfileTag)this.ReadUInt32();

            IccMultiLocalizedUnicodeTagDataEntry manufacturerInfo = ReadText();
            IccMultiLocalizedUnicodeTagDataEntry modelInfo        = ReadText();

            return(new IccProfileDescription(
                       manufacturer,
                       model,
                       attributes,
                       technologyInfo,
                       manufacturerInfo.Texts,
                       modelInfo.Texts));

            IccMultiLocalizedUnicodeTagDataEntry ReadText()
            {
                IccTypeSignature type = this.ReadTagDataEntryHeader();

                switch (type)
                {
                case IccTypeSignature.MultiLocalizedUnicode:
                    return(this.ReadMultiLocalizedUnicodeTagDataEntry());

                case IccTypeSignature.TextDescription:
                    return((IccMultiLocalizedUnicodeTagDataEntry)this.ReadTextDescriptionTagDataEntry());

                default:
                    throw new InvalidIccProfileException("Profile description can only have multi-localized Unicode or text description entries");
                }
            }
        }
        /// <summary>
        /// Reads a <see cref="IccProfileSequenceIdentifierTagDataEntry"/>
        /// </summary>
        /// <returns>The read entry</returns>
        public IccProfileSequenceIdentifierTagDataEntry ReadProfileSequenceIdentifierTagDataEntry()
        {
            int  start = this.currentIndex - 8; // 8 is the tag header size
            uint count = this.ReadUInt32();
            var  table = new IccPositionNumber[count];

            for (int i = 0; i < count; i++)
            {
                table[i] = this.ReadPositionNumber();
            }

            var entries = new IccProfileSequenceIdentifier[count];

            for (int i = 0; i < count; i++)
            {
                this.currentIndex = (int)(start + table[i].Offset);
                IccProfileId id = this.ReadProfileId();
                this.ReadCheckTagDataEntryHeader(IccTypeSignature.MultiLocalizedUnicode);
                IccMultiLocalizedUnicodeTagDataEntry description = this.ReadMultiLocalizedUnicodeTagDataEntry();
                entries[i] = new IccProfileSequenceIdentifier(id, description.Texts);
            }

            return(new IccProfileSequenceIdentifierTagDataEntry(entries));
        }