示例#1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public com.google.zxing.common.DetectorResult[] detectMulti(java.util.Map<com.google.zxing.DecodeHintType,?> hints) throws com.google.zxing.NotFoundException
        public DetectorResult[] detectMulti(IDictionary <DecodeHintType, object> hints)
        {
            BitMatrix image = Image;
            //ResultPointCallback resultPointCallback = hints == null ? null : (ResultPointCallback) hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK];
            ResultPointCallback resultPointCallback = null;

            if (hints != null && hints.ContainsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK))
            {
                resultPointCallback = (ResultPointCallback)hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK];
            }

            MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);

            FinderPatternInfo[] infos = finder.findMulti(hints);

            if (infos.Length == 0)
            {
                throw NotFoundException.NotFoundInstance;
            }

            List <DetectorResult> result = new List <DetectorResult>();

            foreach (FinderPatternInfo info in infos)
            {
                try
                {
                    result.Add(processFinderPatternInfo(info));
                }
                catch (ReaderException e)
                {
                    // ignore
                }
            }
            if (result.Count == 0)
            {
                return(EMPTY_DETECTOR_RESULTS);
            }
            else
            {
                return(result.ToArray());
            }
        }
示例#2
0
        public DetectorResult[] detectMulti(Dictionary <object, object> hints)
        {
            BitMatrix image = Image;
            MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image);

            FinderPatternInfo[] info = finder.findMulti(hints);

            if (info == null || info.Length == 0)
            {
                throw ReaderException.Instance;
            }

            List <object> result = new List <object>();

            for (int i = 0; i < info.Length; i++)
            {
                try
                {
                    result.Add(processFinderPatternInfo(info[i]));
                }
                catch (ReaderException)
                {
                    // ignore
                }
            }
            if ((result.Count == 0))
            {
                return(EMPTY_DETECTOR_RESULTS);
            }
            else
            {
                DetectorResult[] resultArray = new DetectorResult[result.Count];
                for (int i = 0; i < result.Count; i++)
                {
                    resultArray[i] = (DetectorResult)result[i];
                }
                return(resultArray);
            }
        }
示例#3
0
        public DetectorResult[] detectMulti(Dictionary<object, object> hints)
        {
            BitMatrix image = Image;
            MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image);
            FinderPatternInfo[] info = finder.findMulti(hints);

            if (info == null || info.Length == 0)
            {
                throw new Exception("ReaderException");
            }

            ArrayList result = new ArrayList();
            for (int i = 0; i < info.Length; i++)
            {
                try
                {
                    result.Add(processFinderPatternInfo(info[i]));
                }
                catch (Exception e)
                {
                    if (e.Message.IndexOf("ReaderException") < 0)
                        throw e;
                    // ignore
                }
            }
            if ((result.Count == 0))
            {
                return EMPTY_DETECTOR_RESULTS;
            }
            else
            {
                DetectorResult[] resultArray = new DetectorResult[result.Count];
                for (int i = 0; i < result.Count; i++)
                {
                    resultArray[i] = (DetectorResult) result[i];
                }
                return resultArray;
            }
        }
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public com.google.zxing.common.DetectorResult[] detectMulti(java.util.Map<com.google.zxing.DecodeHintType,?> hints) throws com.google.zxing.NotFoundException
        public DetectorResult[] detectMulti(IDictionary<DecodeHintType, object> hints)
        {
            BitMatrix image = Image;
            //ResultPointCallback resultPointCallback = hints == null ? null : (ResultPointCallback) hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK];
            ResultPointCallback resultPointCallback = null;
            if (hints !=null && hints.ContainsKey(DecodeHintType.NEED_RESULT_POINT_CALLBACK))
            {
            resultPointCallback = (ResultPointCallback) hints[DecodeHintType.NEED_RESULT_POINT_CALLBACK];
            }

            MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);
            FinderPatternInfo[] infos = finder.findMulti(hints);

            if (infos.Length == 0)
            {
              throw NotFoundException.NotFoundInstance;
            }

            List<DetectorResult> result = new List<DetectorResult>();
            foreach (FinderPatternInfo info in infos)
            {
              try
              {
            result.Add(processFinderPatternInfo(info));
              }
              catch (ReaderException e)
              {
            // ignore
              }
            }
            if (result.Count == 0)
            {
              return EMPTY_DETECTOR_RESULTS;
            }
            else
            {
              return result.ToArray();
            }
        }
        // public DetectorResult[] detectMulti(System.Collections.Hashtable hints) // commented by .net follower (http://dotnetfollower.com)
        public DetectorResult[] detectMulti(System.Collections.Generic.Dictionary <Object, Object> hints) // added by .net follower (http://dotnetfollower.com)
        {
            BitMatrix image = Image;
            MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image);

            FinderPatternInfo[] info = finder.findMulti(hints);

            if (info == null || info.Length == 0)
            {
                throw ReaderException.Instance;
            }

            // System.Collections.ArrayList result = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10)); // commented by .net follower (http://dotnetfollower.com)
            System.Collections.Generic.List <Object> result = new System.Collections.Generic.List <Object>(10); // added by .net follower (http://dotnetfollower.com)
            for (int i = 0; i < info.Length; i++)
            {
                try
                {
                    result.Add(processFinderPatternInfo(info[i]));
                }
                catch (ReaderException e)
                {
                    // ignore
                }
            }
            if ((result.Count == 0))
            {
                return(EMPTY_DETECTOR_RESULTS);
            }
            else
            {
                DetectorResult[] resultArray = new DetectorResult[result.Count];
                for (int i = 0; i < result.Count; i++)
                {
                    resultArray[i] = (DetectorResult)result[i];
                }
                return(resultArray);
            }
        }
        public DetectorResult[] detectMulti(System.Collections.Hashtable hints)
        {
            BitMatrix image = Image;
            MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image);

            FinderPatternInfo[] info = finder.findMulti(hints);

            if (info == null || info.Length == 0)
            {
                throw ReaderException.Instance;
            }

            System.Collections.ArrayList result = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            for (int i = 0; i < info.Length; i++)
            {
                try
                {
                    result.Add(processFinderPatternInfo(info[i]));
                }
                catch (ReaderException e)
                {
                    // ignore
                }
            }
            if ((result.Count == 0))
            {
                return(EMPTY_DETECTOR_RESULTS);
            }
            else
            {
                DetectorResult[] resultArray = new DetectorResult[result.Count];
                for (int i = 0; i < result.Count; i++)
                {
                    resultArray[i] = (DetectorResult)result[i];
                }
                return(resultArray);
            }
        }
示例#7
0
        // added by .net follower (http://dotnetfollower.com)
        // public DetectorResult[] detectMulti(System.Collections.Hashtable hints) // commented by .net follower (http://dotnetfollower.com)
        public DetectorResult[] detectMulti(System.Collections.Generic.Dictionary<Object, Object> hints)
        {
            BitMatrix image = Image;
            MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image);
            FinderPatternInfo[] info = finder.findMulti(hints);

            if (info == null || info.Length == 0)
            {
                throw ReaderException.Instance;
            }

            // System.Collections.ArrayList result = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10)); // commented by .net follower (http://dotnetfollower.com)
            System.Collections.Generic.List<Object> result = new System.Collections.Generic.List<Object>(10); // added by .net follower (http://dotnetfollower.com)
            for (int i = 0; i < info.Length; i++)
            {
                try
                {
                    result.Add(processFinderPatternInfo(info[i]));
                }
                catch (ReaderException e)
                {
                    // ignore
                }
            }
            if ((result.Count == 0))
            {
                return EMPTY_DETECTOR_RESULTS;
            }
            else
            {
                DetectorResult[] resultArray = new DetectorResult[result.Count];
                for (int i = 0; i < result.Count; i++)
                {
                    resultArray[i] = (DetectorResult) result[i];
                }
                return resultArray;
            }
        }
        public DetectorResult[] detectMulti(System.Collections.Hashtable hints)
        {
            BitMatrix image = Image;
            MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image);
            FinderPatternInfo[] info = finder.findMulti(hints);

            if (info == null || info.Length == 0)
            {
                throw ReaderException.Instance;
            }

            System.Collections.ArrayList result = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            for (int i = 0; i < info.Length; i++)
            {
                try
                {
                    result.Add(processFinderPatternInfo(info[i]));
                }
                catch (ReaderException e)
                {
                    // ignore
                }
            }
            if ((result.Count == 0))
            {
                return EMPTY_DETECTOR_RESULTS;
            }
            else
            {
                DetectorResult[] resultArray = new DetectorResult[result.Count];
                for (int i = 0; i < result.Count; i++)
                {
                    resultArray[i] = (DetectorResult) result[i];
                }
                return resultArray;
            }
        }