Ejemplo n.º 1
0
        public bool IsMatching(MediaFile src)
        {
            if (this.IsEmpty)
            {
                return(true);
            }
            if (src.MediaType != MediaTypes.Image)
            {
                return(false);
            }
            string     fpath = src.GetFullPath();
            ExifReader xrf   = null;
            ImageDim   dm    = null;
            UInt32?    unz;

            try {
                xrf = new ExifReader(fpath);
                if (this.IsVerticalImg.HasValue)
                {
                    dm = MediaUtil.GetImgDim(xrf);
                    if (this.IsVerticalImg.Value != dm.IsVert)
                    {
                        return(false);
                    }
                }
                if (!IsoFilter.IsEmpty)
                {
                    if (null != (unz = MediaUtil.GetIso(xrf)))
                    {
                        if (!this.IsoFilter.IsMatch(unz.Value))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception x) {
                x.Data["target"] = fpath;
                AppContext.Current.LogTechError(x.ToShortMsg("Read EXIF"), x);
            }
            finally {
                if (xrf != null)
                {
                    xrf.Dispose();
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
        public static KeyValuePairXCol <string, string> GetMetadata(Stream imgStream)
        {
            KeyValuePairXCol <string, string> rz;
            ExifReader xrf = null;

            try {
                imgStream.Seek(0, SeekOrigin.Begin);
                xrf = new ExifReader(imgStream);
                rz  = GetMetadata(xrf);
            }
            finally {
                xrf.Dispose();
            }
            return(rz);
        }
Ejemplo n.º 3
0
        public static KeyValuePairXCol <string, string> GetMetadata(ImageFile mf)
        {
            KeyValuePairXCol <string, string> rz;
            ExifReader xrf = null;

            try {
                xrf = new ExifReader(mf.GetFullPath());
                rz  = GetMetadata(xrf, mf);
                mf.UpdateTechDescription();
            }
            finally {
                xrf.Dispose();
            }
            return(rz);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get Metadata via ExifReader.
        // XC 20170610: this is real metadata shown on UI
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public static KeyValuePairXCol <string, string> GetMetadata(string filePath)
        {
            KeyValuePairXCol <string, string> rz;
            ExifReader xrf = null;

            try {
                xrf = new ExifReader(filePath);
                rz  = GetMetadata(xrf);
            }
            finally {
                if (xrf != null)
                {
                    xrf.Dispose();
                }
            }
            return(rz);
        }