Example #1
0
        public IPTC_NAA(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            reader.ReadByte();
            reader.ReadUInt16();
            reader.ReadUInt16();
            reader.ReadUInt16();

            this.Entries = new List <IPTCEntry>();
            while (reader.BytesToEnd > 0)
            {
                byte starter = reader.ReadByte();
                if (starter != 0x1c)
                {
                    throw new Exception("IPTC error");
                }

                IPTCEntry entry = new IPTCEntry();
                entry.Id = (TypeId)reader.ReadUInt16();
                reader.ReadByte();
                entry.Name = reader.ReadPascalStringUnpadded();
                this.Entries.Add(entry);
            }

            reader.Close();
        }