/// <summary> /// Initializes a new instance of the <see cref="BarCode"/> class. /// </summary> /// <param name="text"></param> /// <param name="size"></param> /// <param name="direction"></param> public BarCode(string text, XSize size, CodeDirection direction) : base(text, size, direction) { Text = text; Size = size; Direction = direction; }
/// <summary> /// Initializes a new instance of the <see cref="BarCode"/> class. /// </summary> /// <param name="text"></param> /// <param name="size"></param> /// <param name="direction"></param> public BarCode(string text, XSize size, CodeDirection direction) : base(text, size, direction) { this.text = text; this.size = size; this.direction = direction; }
/// <summary>Constructor</summary> /// <param name="text">String - The text to be coded</param> /// <param name="size">XSize - The size of the bar code</param> /// <param name="direction">CodeDirection - Indicates the direction to draw the bar code</param> /// <param name="code128Code">Code_128_Code_Types - Indicates which of the codes to use when rendering the bar code. /// <param name="isUCC">Set barcode to GS1 EAN/UCC</param> /// The options are A, B, or buffer.</param> public Code128(string text, XSize size, CodeDirection direction, Code128CodeType code128Code, bool isUCC) : base(text, size, direction) { if (Patterns == null) { Load(); } this.Code128Code = code128Code; this.Text = text; text = isUCC ? PrepareGS1Text(text) : text; if (Code128Code == Code128CodeType.CodeC) { // Ensure that the text is an even length //if ((text.Length % 2) == 1) throw new ArgumentOutOfRangeException("Parameter text (string) must have an even length for Code 128 - Code C"); if ((text.Length % 2) == 1) { text = "0" + text; } } BarCode = ParseTextToBarCode(text); CheckValues(); }
/// <summary> /// Creates a bar code from the specified code type. /// </summary> public static BarCode FromType(CodeType type, string text, XSize size, CodeDirection direction) { switch (type) { case CodeType.Code2of5Interleaved: return(new Code2of5Interleaved(text, size, direction)); case CodeType.Code3of9Standard: return(new Code3of9Standard(text, size, direction)); default: throw new InvalidEnumArgumentException("type", (int)type, typeof(CodeType)); } }
/// <summary>Constructor</summary> /// <param name="values">byte[] - The values to be rendered</param> /// <param name="size">XSize - The size of the bar code</param> /// <param name="direction">CodeDirection - Indicates the direction to draw the bar code</param> /// <param name="code128Code">Code_128_Code_Types - Indicates which of the codes to use when rendering the bar code. /// The options are A, B, or buffer.</param> public Code128(byte[] values, XSize size, CodeDirection direction, Code_128_Code_Types code128Code) : base(null, size, direction) { if (!Enum.IsDefined(typeof(Code_128_Code_Types), code128Code)) { throw new ArgumentOutOfRangeException("Parameter code128Code (Code_128_Code_Types) is invalid"); } if (Patterns == null) { Load(); } Code128Code = code128Code; Values = values; }
/// <summary> /// Creates a bar code from the specified code type. /// </summary> public static BarCode FromType(CodeType type, string text, XSize size, CodeDirection direction) { switch (type) { case CodeType.Code2of5Interleaved: return new Code2of5Interleaved(text, size, direction); case CodeType.Code3of9Standard: return new Code3of9Standard(text, size, direction); default: throw new InvalidEnumArgumentException("type", (int)type, typeof(CodeType)); } }
/// <summary> /// Creates a bar code from the specified code type. /// </summary> public static BarCode FromType(CodeType type, string text, XSize size, CodeDirection direction) { switch (type) { case CodeType.Code2of5Interleaved: return(new Code2of5Interleaved(text, size, direction)); case CodeType.Code3of9Standard: return(new Code3of9Standard(text, size, direction)); case CodeType.Ean13: return(new Ean13(text, size, direction)); default: #if !SILVERLIGHT throw new InvalidEnumArgumentException("type", (int)type, typeof(CodeType)); #else throw new ArgumentException("type", type.ToString()); #endif } }
/// <summary> /// Initializes a new instance of EAN13. /// </summary> public Ean13(string code, XSize size, CodeDirection direction) : base(code, size, direction) { }
/// <summary>Constructor</summary> /// <param name="text">String - The text to be coded</param> /// <param name="size">XSize - The size of the bar code</param> /// <param name="direction">CodeDirection - Indicates the direction to draw the bar code</param> /// <param name="code128Code">Code_128_Code_Types - Indicates which of the codes to use when rendering the bar code.</param> public Code128(string text, XSize size, CodeDirection direction, Code128CodeType code128Code) : this(text, size, direction, code128Code, false) { }
/// <summary>Constructor</summary> /// <param name="text">String - The text to be coded</param> /// <param name="size">XSize - The size of the bar code</param> /// <param name="direction">CodeDirection - Indicates the direction to draw the bar code</param> public Code128(string text, XSize size, CodeDirection direction) : this(text, size, direction, Code_128_Code_Types.CodeB) { }
/// <summary> /// Initializes a new instance of the <see cref="ThickThinBarCode"/> class. /// </summary> public ThickThinBarCode(string code, XSize size, CodeDirection direction) : base(code, size, direction) { }
/// <summary>Constructor</summary> /// <param name="text">String - The text to be coded</param> /// <param name="size">XSize - The size of the bar code</param> /// <param name="direction">CodeDirection - Indicates the direction to draw the bar code</param> /// <param name="code128Code">Code_128_Code_Types - Indicates which of the codes to use when rendering the bar code. /// The options are A, B, or buffer.</param> public Code128(string text, XSize size, CodeDirection direction, Code_128_Code_Types code128Code) : this((byte[])null, size, direction, code128Code) { this.Text = text; // Create the array to hold the values to be rendered if (Code128Code == Code_128_Code_Types.CodeC) { // Ensure that the text is an even length if ((text.Length % 2) == 1) { throw new ArgumentOutOfRangeException("Parameter text (string) must have an even length for Code 128 - Code C"); } Values = new byte[text.Length / 2]; } else { Values = new byte[text.Length]; } String buffer = ""; for (int x = 0; x < text.Length; x++) { switch (Code128Code) { case Code_128_Code_Types.CodeA: if (text[x] < 32) { Values[x] = (byte)(text[x] + 64); } else if ((text[x] >= 32) && (text[x] < 64)) { Values[x] = (byte)(text[x] - 32); } else { Values[x] = (byte)text[x]; } break; case Code_128_Code_Types.CodeB: Values[x] = (byte)(text[x] - 32); break; case Code_128_Code_Types.CodeC: if ((text[x] >= '0') && (text[x] <= '9')) { buffer += text[x]; if (buffer.Length == 2) { Values[x / 2] = byte.Parse(buffer); buffer = ""; } } else { throw new ArgumentOutOfRangeException("Parameter text (string) can only contain numeric characters for Code 128 - Code C"); } break; } } CheckValues(); }
/// <summary> /// Initializes a new instance of the <see cref="CodeBase"/> class. /// </summary> public CodeBase(string text, XSize size, CodeDirection direction) { _text = text; _size = size; _direction = direction; }
/// <summary> /// initializes a new OmrCode with the given data. /// </summary> public CodeOmr(string text, XSize size, CodeDirection direction) : base(text, size, direction) { }
/// <summary> /// Initializes a new instance of Standard3of9. /// </summary> public Code3of9Standard(string code, XSize size, CodeDirection direction) : base(code, size, direction) { }
/// <summary> /// Initializes a new instance of the <see cref="CodeBase"/> class. /// </summary> public CodeBase(string text, XSize size, CodeDirection direction) { this.text = text; this.size = size; this.direction = direction; }
/// <summary>Constructor</summary> /// <param name="text">String - The text to be coded</param> /// <param name="size">XSize - The size of the bar code</param> /// <param name="direction">CodeDirection - Indicates the direction to draw the bar code</param> /// <param name="isUCC">Set barcode to GS1 EAN/UCC</param> public Code128(string text, XSize size, CodeDirection direction, bool isUCC) : this(text, size, direction, Code128CodeType.Auto, isUCC) { }
/// <summary> /// Initializes a new instance of Interleaved2of5. /// </summary> public Code2of5Interleaved(string code, XSize size, CodeDirection direction) : base(code, size, direction) { }