public override string[] GetValues(FileInfo file, Dictionary <Type, IFileCache> fileCaches, CancellationToken token)
        {
            BitmapFileCache cache = (BitmapFileCache)fileCaches[typeof(BitmapFileCache)];

            if (!cache.IsBitmap)
            {
                if (ColumnCount == 2)
                {
                    return(new string[] { "N/A", "N/A" });
                }
                return(new string[] { "N/A" });
            }
            Bitmap bitmap = cache.Bitmap;

            switch (m_Parameters.Dimension)
            {
            case MediaDimensionOrDimensions.Width:
                return(new string[] { bitmap.Width.ToString() });

            case MediaDimensionOrDimensions.Height:
                return(new string[] { bitmap.Height.ToString() });

            case MediaDimensionOrDimensions.WidthHeight:
                return(new string[] { bitmap.Width.ToString(), bitmap.Height.ToString() });

            case MediaDimensionOrDimensions.HeightWidth:
                return(new string[] { bitmap.Height.ToString(), bitmap.Width.ToString() });
            }
            return(new string[ColumnCount]);
        }
示例#2
0
        public override MatchResult Matches(FileInfo file, Dictionary <Type, IFileCache> fileCaches, CancellationToken token)
        {
            BitmapFileCache cache = fileCaches[typeof(BitmapFileCache)] as BitmapFileCache;

            if (cache == null || !cache.IsBitmap)
            {
                return(new MatchResult(MatchResultType.NotApplicable, "N/A"));
            }
            Bitmap          bitmap     = cache.Bitmap;
            int             imageSize  = m_Parameters.Dimension == MediaDimension.Height ? bitmap.Height : bitmap.Width;
            MatchResultType resultType = CompareUtil.Compare(imageSize, m_Parameters.ComparisonType, m_Parameters.Size);

            return(new MatchResult(resultType, imageSize.ToString()));
        }
示例#3
0
        public override MatchResult Matches(FileInfo file, Dictionary <Type, IFileCache> fileCaches, CancellationToken token)
        {
            BitmapFileCache cache = fileCaches[typeof(BitmapFileCache)] as BitmapFileCache;

            if (cache == null || !cache.IsBitmap)
            {
                return(new MatchResult(MatchResultType.NotApplicable, "N/A"));
            }
            Bitmap           bitmap   = cache.Bitmap;
            PositiveFraction val      = new PositiveFraction((uint)bitmap.Width, (uint)bitmap.Height);
            PositiveFraction paramVal = new PositiveFraction(m_Parameters.Width, m_Parameters.Height);

            if (paramVal.Denominator == 0)
            {
                return(new MatchResult(MatchResultType.NotApplicable, "N/A"));
            }
            MatchResultType resultType = CompareUtil.Compare(val, m_Parameters.ComparisonType, paramVal);

            return(new MatchResult(resultType, val.ToString()));
        }