Rest of cosmetic changes -- simpler, black theme with easier-to-touch buttons and...
[zxing.git] / csharp / MultiFormatWriter.cs
index 42f244c..160c453 100755 (executable)
@@ -1,4 +1,6 @@
-/*\r
+/*\r
+* Copyright 2008 ZXing authors\r
+*\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
 * 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.common;\r
-\r
+using ByteMatrix = com.google.zxing.common.ByteMatrix;\r
+using EAN13Writer = com.google.zxing.oned.EAN13Writer;\r
+using EAN8Writer = com.google.zxing.oned.EAN8Writer;\r
+using QRCodeWriter = com.google.zxing.qrcode.QRCodeWriter;\r
 namespace com.google.zxing\r
 {\r
-    public sealed class MultiFormatWriter : Writer\r
-    { \r
-        public ByteMatrix encode(String contents, BarcodeFormat format, int width,int height) {\r
-            return encode(contents, format, width, height,null);\r
-        }\r
-\r
-        public ByteMatrix encode(String contents, BarcodeFormat format, int width, int height,Hashtable hints){\r
-            if (format == BarcodeFormat.QR_CODE) {\r
-              return new QRCodeWriter().encode(contents, format, width, height, hints);\r
-            } else {\r
-              throw new ArgumentException("No encoder available for format " + format);\r
-            }\r
-        }   \r
-    }\r
-}\r
-\r
-\r
+       \r
+       /// <summary> This is a factory class which finds the appropriate Writer subclass for the BarcodeFormat\r
+       /// requested and encodes the barcode with the supplied contents.\r
+       /// \r
+       /// </summary>\r
+       /// <author>  dswitkin@google.com (Daniel Switkin)\r
+       /// </author>\r
+       /// <author>www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source \r
+       /// </author>\r
 \r
+       public sealed class MultiFormatWriter : Writer\r
+       {\r
+               \r
+               public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height)\r
+               {\r
+                       \r
+                       return encode(contents, format, width, height, null);\r
+               }\r
+               \r
+               public ByteMatrix encode(System.String contents, BarcodeFormat format, int width, int height, System.Collections.Hashtable hints)\r
+               {\r
+                       \r
+                       if (format == BarcodeFormat.EAN_8)\r
+                       {\r
+                               return new EAN8Writer().encode(contents, format, width, height, hints);\r
+                       }\r
+                       else if (format == BarcodeFormat.EAN_13)\r
+                       {\r
+                               return new EAN13Writer().encode(contents, format, width, height, hints);\r
+                       }\r
+                       else if (format == BarcodeFormat.QR_CODE)\r
+                       {\r
+                               return new QRCodeWriter().encode(contents, format, width, height, hints);\r
+                       }\r
+                       else\r
+                       {\r
+                               throw new System.ArgumentException("No encoder available for format " + format);\r
+                       }\r
+               }\r
+       }\r
+}
\ No newline at end of file