示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }