示例#1
0
        public override Result decodeRow(int rowNumber, BitArray row, System.Collections.Hashtable hints)
        {
            // Compute this location once and reuse it on multiple implementations
            int[] startGuardPattern = AbstractUPCEANReader.findStartGuardPattern(row);
            int   size = readers.Count;

            for (int i = 0; i < size; i++)
            {
                UPCEANReader reader = (UPCEANReader)readers[i];
                Result       result;
                try {
                    result = reader.decodeRow(rowNumber, row, startGuardPattern);
                } catch (ReaderException re) {
                    continue;
                }
                // Special case: a 12-digit code encoded in UPC-A is identical to a "0"
                // followed by those 12 digits encoded as EAN-13. Each will recognize such a code,
                // UPC-A as a 12-digit string and EAN-13 as a 13-digit string starting with "0".
                // Individually these are correct and their readers will both read such a code
                // and correctly call it EAN-13, or UPC-A, respectively.
                //
                // In this case, if we've been looking for both types, we'd like to call it
                // a UPC-A code. But for efficiency we only run the EAN-13 decoder to also read
                // UPC-A. So we special case it here, and convert an EAN-13 result to a UPC-A
                // result if appropriate.
                if (result.getBarcodeFormat().Equals(BarcodeFormat.EAN_13) && result.getText()[0] == '0')
                {
                    return(new Result(result.getText().Substring(1), null, result.getResultPoints(), BarcodeFormat.UPC_A));
                }
                return(result);
            }

            throw new ReaderException();
        }
示例#2
0
文件: UPCAReader.cs 项目: whuacn/CJia
 public override Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange, Dictionary <object, object> hints)
 {
     return(maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, startGuardRange, hints)));
 }
示例#3
0
 // public override Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange, System.Collections.Hashtable hints) // commented by .net follower (http://dotnetfollower.com)
 public override Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange, System.Collections.Generic.Dictionary <Object, Object> hints) // added by .net follower (http://dotnetfollower.com)
 {
     return(maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, startGuardRange, hints)));
 }
示例#4
0
 public override Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange, System.Collections.Hashtable hints)
 {
     return(maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, startGuardRange, hints)));
 }
示例#5
0
 public Result decodeRow(int rowNumber, BitArray row, int[] startGuardRange)
 {
     return(maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, startGuardRange)));
 }