Remove old C# port before committing new one
[zxing.git] / csharp / MultiFormatReader.cs
diff --git a/csharp/MultiFormatReader.cs b/csharp/MultiFormatReader.cs
deleted file mode 100755 (executable)
index 74a04ed..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*\r
-* Licensed under the Apache License, Version 2.0 (the "License");\r
-* you may not use this file except in compliance with the License.\r
-* You may obtain a copy of the License at\r
-*\r
-*      http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-* Unless required by applicable law or agreed to in writing, software\r
-* distributed under the License is distributed on an "AS IS" BASIS,\r
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-* See the License for the specific language governing permissions and\r
-* limitations under the License.\r
-*/\r
-\r
-using System;\r
-using System.Collections;\r
-using com.google.zxing.qrcode;\r
-using com.google.zxing.oned;\r
-using com.google.zxing.datamatrix;\r
-\r
-namespace com.google.zxing\r
-{\r
-    public sealed class MultiFormatReader : Reader\r
-    { \r
-          private Hashtable hints;\r
-          private ArrayList readers;\r
-\r
-          /**\r
-           * This version of decode honors the intent of Reader.decode(MonochromeBitmapSource) in that it\r
-           * passes null as a hint to the decoders. However, that makes it inefficient to call repeatedly.\r
-           * Use setHints() followed by decodeWithState() for continuous scan applications.\r
-           *\r
-           * @param image The pixel data to decode\r
-           * @return The contents of the image\r
-           * @throws ReaderException Any errors which occurred\r
-           */\r
-          public Result decode(MonochromeBitmapSource image){\r
-              try{\r
-                setHints(null);\r
-                return decodeInternal(image);\r
-              }\r
-              catch(Exception e){\r
-                throw new ReaderException(e.Message);\r
-              }           \r
-          }\r
-\r
-          /**\r
-           * Decode an image using the hints provided. Does not honor existing state.\r
-           *\r
-           * @param image The pixel data to decode\r
-           * @param hints The hints to use, clearing the previous state.\r
-           * @return The contents of the image\r
-           * @throws ReaderException Any errors which occurred\r
-           */\r
-          public Result decode(MonochromeBitmapSource image, Hashtable hints){\r
-              try{\r
-                 setHints(hints);\r
-                 return decodeInternal(image);\r
-              }catch(Exception e){\r
-                throw new ReaderException (e.Message);\r
-              }           \r
-          }\r
-\r
-          /**\r
-           * Decode an image using the state set up by calling setHints() previously. Continuous scan\r
-           * clients will get a <b>large</b> speed increase by using this instead of decode().\r
-           *\r
-           * @param image The pixel data to decode\r
-           * @return The contents of the image\r
-           * @throws ReaderException Any errors which occurred\r
-           */\r
-          public Result decodeWithState(MonochromeBitmapSource image){\r
-              try{\r
-                // Make sure to set up the default state so we don't crash\r
-                if (readers == null) {\r
-                  setHints(null);\r
-                }\r
-                return decodeInternal(image);\r
-              }catch(Exception e){\r
-                throw new ReaderException(e.Message);\r
-              }            \r
-          }\r
-\r
-          /**\r
-           * This method adds state to the MultiFormatReader. By setting the hints once, subsequent calls\r
-           * to decodeWithState(image) can reuse the same set of readers without reallocating memory. This\r
-           * is important for performance in continuous scan clients.\r
-           *\r
-           * @param hints The set of hints to use for subsequent calls to decode(image)\r
-           */\r
-          public void setHints(Hashtable hints) {\r
-              this.hints = hints;\r
-\r
-              bool tryHarder = hints != null && hints.ContainsKey(DecodeHintType.TRY_HARDER);\r
-\r
-              ArrayList possibleFormats = hints == null ? null : (ArrayList)hints[(DecodeHintType.POSSIBLE_FORMATS)];\r
-              readers = new ArrayList();\r
-              if (possibleFormats != null)\r
-              {\r
-                  bool addOneDReader =\r
-                  possibleFormats.Contains(BarcodeFormat.UPC_A) ||\r
-                      possibleFormats.Contains(BarcodeFormat.UPC_E) ||\r
-                      possibleFormats.Contains(BarcodeFormat.EAN_13) ||\r
-                      possibleFormats.Contains(BarcodeFormat.EAN_8) ||\r
-                      possibleFormats.Contains(BarcodeFormat.CODE_39) ||\r
-                      possibleFormats.Contains(BarcodeFormat.CODE_128);\r
-                  // Put 1D readers upfront in "normal" mode\r
-\r
-                  if (addOneDReader && !tryHarder)\r
-                  {\r
-                      readers.Add(new MultiFormatOneDReader(hints));\r
-                  }\r
-\r
-                  if (possibleFormats.Contains(BarcodeFormat.QR_CODE))\r
-                  {\r
-                      readers.Add(new QRCodeReader());\r
-                  }\r
-                  // TODO re-enable once Data Matrix is ready\r
-                  if (possibleFormats.Contains(BarcodeFormat.DATAMATRIX)) {\r
-                    readers.Add(new DataMatrixReader());\r
-                  }\r
-                  // At end in "try harder" mode\r
-                  if (addOneDReader && tryHarder)\r
-                  {\r
-                      readers.Add(new MultiFormatOneDReader(hints));\r
-                  }\r
-              }\r
-\r
-              if (readers.Count == 0)\r
-              {\r
-                  if (!tryHarder)\r
-                  {\r
-                      readers.Add(new MultiFormatOneDReader(hints));\r
-                  }\r
-                  readers.Add(new QRCodeReader());\r
-                  // TODO re-enable once Data Matrix is ready\r
-                    readers.Add(new DataMatrixReader());\r
-                  if (tryHarder)\r
-                  {\r
-                      readers.Add(new MultiFormatOneDReader(hints));\r
-                  }\r
-              }\r
-          }\r
-\r
-          private Result decodeInternal(MonochromeBitmapSource image) {\r
-              try\r
-              {\r
-                  int size = readers.Count;\r
-                  for (int i = 0; i < size; i++)\r
-                  {\r
-                      Reader reader = (Reader)readers[i];\r
-                      try\r
-                      {\r
-                          return reader.decode(image, hints);\r
-                      }\r
-                      catch (ReaderException re)\r
-                      {\r
-                          // continue\r
-                      }\r
-                  }\r
-\r
-                  throw new ReaderException("");\r
-              }\r
-              catch (Exception e) {\r
-                  throw new ReaderException(e.Message);\r
-              }\r
-          }\r
-    \r
-    \r
-    }\r
-}
\ No newline at end of file