Moxiecode.MXI.Image.ExifParser.init C# (CSharp) Метод

init() публичный Метод

public init ( Stream segment ) : bool
segment Stream
Результат bool
        public bool init(Stream segment)
        {
            // Reset internal data
            offsets = new Dictionary<string, long>() {
                { "tiffHeader", 10 }
            };

            if (segment == null || segment.Length == 0) {
                return false;
            }

            data = new BinaryReader(segment);

            // Check if that"s APP1 and that it has EXIF
            if (data.SHORT(0) == 0xFFE1 && data.STRING(4, 4).ToUpper() == "EXIF") {
                return getIFDOffsets();
            }
            return false;
        }

Same methods

ExifParser::init ( byte buffer ) : bool

Usage Example

Пример #1
0
        public Dictionary <string, object> metaInfo()
        {
            ExifParser exifParser;
            Dictionary <string, object> tiff, exif, gps, thumb, meta;

            List <byte[]> headers = getHeaders("app1");

            meta = new Dictionary <string, object>();

            try
            {
                if (headers.Count != 0)
                {
                    exifParser = new ExifParser();
                    if (exifParser.init(headers[0]))
                    {
                        tiff = exifParser.TIFF();
                        if (tiff != null)
                        {
                            meta.Add("tiff", tiff);
                        }

                        exif = exifParser.EXIF();
                        if (exif != null)
                        {
                            meta.Add("exif", exif);
                        }

                        gps = exifParser.GPS();
                        if (gps != null)
                        {
                            meta.Add("gps", gps);
                        }

                        thumb = getThumb(exifParser);
                        if (thumb != null)
                        {
                            if (!thumb.ContainsKey("keys"))
                            {
                                string[] keys = new string[thumb.Keys.Count];
                                thumb.Keys.CopyTo(keys, 0);
                                thumb.Add("keys", keys);
                            }

                            meta.Add("thumb", thumb);
                        }

                        exifParser.purge();
                    }
                }
            } catch (Exception ex) {}
            return(meta);
        }
All Usage Examples Of Moxiecode.MXI.Image.ExifParser::init