Пример #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);
        }