New C# port from Suraj Supekar
[zxing.git] / csharp / common / ECI.cs
diff --git a/csharp/common/ECI.cs b/csharp/common/ECI.cs
new file mode 100755 (executable)
index 0000000..27ff679
--- /dev/null
@@ -0,0 +1,66 @@
+/*\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
+*\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
+using System;\r
+namespace com.google.zxing.common\r
+{\r
+       \r
+       /// <summary> Superclass of classes encapsulating types ECIs, according to "Extended Channel Interpretations"\r
+       /// 5.3 of ISO 18004.\r
+       /// \r
+       /// </summary>\r
+       /// <author>  Sean Owen\r
+       /// </author>\r
+       /// <author>www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source \r
+       /// </author>\r
+       public abstract class ECI\r
+       {\r
+               virtual public int Value\r
+               {\r
+                       get\r
+                       {\r
+                               return value_Renamed;\r
+                       }\r
+                       \r
+               }\r
+               \r
+               //UPGRADE_NOTE: Final was removed from the declaration of 'value '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"\r
+               private int value_Renamed;\r
+               \r
+               internal ECI(int value_Renamed)\r
+               {\r
+                       this.value_Renamed = value_Renamed;\r
+               }\r
+               \r
+               /// <param name="value">ECI value\r
+               /// </param>\r
+               /// <returns> {@link ECI} representing ECI of given value, or null if it is legal but unsupported\r
+               /// </returns>\r
+               /// <throws>  IllegalArgumentException if ECI value is invalid </throws>\r
+               public static ECI getECIByValue(int value_Renamed)\r
+               {\r
+                       if (value_Renamed < 0 || value_Renamed > 999999)\r
+                       {\r
+                               throw new System.ArgumentException("Bad ECI value: " + value_Renamed);\r
+                       }\r
+                       if (value_Renamed < 900)\r
+                       {\r
+                               // Character set ECIs use 000000 - 000899\r
+                               return CharacterSetECI.getCharacterSetECIByValue(value_Renamed);\r
+                       }\r
+                       return null;\r
+               }\r
+       }\r
+}
\ No newline at end of file