示例#1
0
        protected void MergeIFD(IFD other_tiff)
        {
            if (other_tiff?.subIFD.Count == 0)
            {
                return;
            }

            foreach (IFD i in other_tiff.subIFD)
            {
                subIFD.Add(i);
            }

            foreach (KeyValuePair <TagType, Tag> i in other_tiff.tags)
            {
                tags.Add(i.Key, i.Value);;
            }
        }
示例#2
0
        protected void Parse(ImageBinaryReader fileStream)
        {
            tagNumber = fileStream.ReadUInt16();
            Debug.Assert(tagNumber < UInt16.MaxValue);
            for (int i = 0; i < tagNumber; i++)
            {
                Tag temp = new Tag(fileStream, RelativeOffset);
                if (!tags.ContainsKey(temp.TagId))
                {
                    tags.Add(temp.TagId, temp);
                }
            }
            NextOffset = fileStream.ReadUInt32();

            foreach (Tag tag in tags.Values)
            {
                if (tag.TagId != TagType.MAKERNOTE && tag.TagId != TagType.MAKERNOTE_ALT)
                {
                    tag.ReadData(fileStream);
                }
            }

            foreach (Tag tag in tags.Values)
            {
                try
                {
                    //Special tag
                    switch (tag.TagId)
                    {
                    case TagType.DNGPRIVATEDATA:
                        IFD maker_ifd = ParseDngPrivateData(tag);
                        if (maker_ifd != null)
                        {
                            subIFD.Add(maker_ifd);
                            tag.data = null;
                        }
                        break;

                    case TagType.MAKERNOTE:
                    case TagType.MAKERNOTE_ALT:
                    case (TagType)288:
                        Makernote makernote = ParseMakerNote(fileStream, tag, endian);
                        if (makernote != null)
                        {
                            subIFD.Add(makernote);
                        }
                        break;

                    case TagType.OLYMPUSIMAGEPROCESSING:
                    case TagType.FUJI_RAW_IFD:
                    case TagType.NIKONTHUMB:
                    case TagType.SUBIFDS:
                    case TagType.EXIFIFDPOINTER:
                        for (Int32 k = 0; k < tag.dataCount; k++)
                        {
                            subIFD.Add(new IFD(IFDType.Plain, fileStream, tag.GetUInt(k), endian, Depth, RelativeOffset));
                        }
                        break;

                    case TagType.GPSINFOIFDPOINTER:
                        subIFD.Add(new IFD(IFDType.GPS, fileStream, tag.GetUInt(0), endian, Depth));
                        break;
                    }
                }
                catch (Exception) { }
            }
        }