コード例 #1
0
    public FSpot.Iptc.IptcFile GetIptc()
    {
        string name = PhotoshopSignature.Name;

        JpegHeader.Marker marker = FindMarker(PhotoshopSignature);
        if (marker != null)
        {
            int len = name.Length;
            using (System.IO.Stream bimstream = new System.IO.MemoryStream(marker.Data, len,
                                                                           marker.Data.Length - len, false)) {
                FSpot.Bim.BimFile bim;
                try {
                    bim = new FSpot.Bim.BimFile(bimstream);
                } catch {
                    // Bim entry with marker "PHUT" is not handled by Bim.cs
                    return(null);
                }

                // FIXME: What about EntryType.XMP ?
                FSpot.Bim.Entry iptc_entry = bim.FindEntry(FSpot.Bim.EntryType.IPTCNAA);
                if (iptc_entry == null)
                {
                    return(null);
                }

                using (System.IO.Stream iptcstream = new System.IO.MemoryStream(iptc_entry.Data)) {
                    FSpot.Iptc.IptcFile iptc = new FSpot.Iptc.IptcFile(iptcstream);
                    return(iptc);
                }
            }
        }
        return(null);
    }
コード例 #2
0
ファイル: JpegHeader.cs プロジェクト: ArsenShnurkov/beagle-1
	public FSpot.Iptc.IptcFile GetIptc ()
	{
		string name = PhotoshopSignature.Name;
		JpegHeader.Marker marker = FindMarker (PhotoshopSignature);
		if (marker != null) {
			int len = name.Length;
			using (System.IO.Stream bimstream = new System.IO.MemoryStream (marker.Data, len,
											marker.Data.Length - len, false)) {

				FSpot.Bim.BimFile bim;
				try {
					bim = new FSpot.Bim.BimFile (bimstream);
				} catch {
					// Bim entry with marker "PHUT" is not handled by Bim.cs
					return null;
				}

				// FIXME: What about EntryType.XMP ?
				FSpot.Bim.Entry iptc_entry = bim.FindEntry (FSpot.Bim.EntryType.IPTCNAA);
				if (iptc_entry == null)
					return null;

				using (System.IO.Stream iptcstream = new System.IO.MemoryStream (iptc_entry.Data)) {
					FSpot.Iptc.IptcFile iptc = new FSpot.Iptc.IptcFile (iptcstream);
					return iptc;
				}
			}
		}
		return null;
	}