protected static int s_C128QueryCharSet(int iStartCharSet, char[] acText, int cc, int ind, IntRef IndInPair) { int num = iStartCharSet; int num2 = num; int num3 = 0; int num4 = 0; bool flag = false; for (int i = 0; i < ind; i++) { if (i == cc) { return(-1); } num = num2; if (flag) { num2 = (num2 == 0) ? 1 : 0; } flag = false; num3 = num4; char ch = acText[i]; if ((ch & '\x0080') == 0) { switch (num) { case 2: if ((ch < '0') || (ch > '9')) { return(-1); } num4 = (num3 == 0) ? 1 : 0; break; } } else { ch &= (char)0xff7f; switch (num) { case 0: switch (ch) { case 'c': goto Label_00BB; case 'd': goto Label_00C1; case 'b': goto Label_00C5; } break; case 1: if (ch == 'b') { goto Label_00E8; } if (ch != 'c') { goto Label_00DE; } num2 = 2; num4 = 0; break; case 2: if (num3 != 0) { return(-1); } if (ch != 'd') { goto Label_00FC; } num2 = 1; break; } } continue; Label_00BB: num2 = 2; num4 = 0; continue; Label_00C1: num2 = 1; continue; Label_00C5: num2 = 1; flag = true; continue; Label_00DE: if (ch == 'e') { num2 = 0; } continue; Label_00E8: num2 = 0; flag = true; continue; Label_00FC: if (ch == 'e') { num2 = 0; } else { if (ch != 'f') { return(-1); } num4 = 0; num2 = 2; } } if (num2 == 2) { IndInPair.value = num4; return(num2); } IndInPair.value = 0; return(num2); }
public override char[] ValidateData(char[] data, int cc) { int num; IntRef indInPair = new IntRef(); switch (base.bdType) { case BarcodeType.EAN128A: case BarcodeType.CODE128A: num = 0; break; case BarcodeType.EAN128B: case BarcodeType.CODE128B: num = 1; break; case BarcodeType.EAN128C: case BarcodeType.CODE128C: num = 2; break; default: return(null); } for (int i = 0; i < cc; i++) { int num3; int index = s_C128QueryCharSet(num, data, cc, i, indInPair); char ch = data[i]; if ((ch & '\x0080') != 0) { ch &= (char)0xff7f; switch (index) { case 0: { if (((ch < '\0') || (ch > '\x001f')) && ((ch < '`') || (ch > 'f'))) { return(null); } continue; } case 1: { if ((ch != '\x007f') && ((ch < '`') || (ch > 'f'))) { return(null); } continue; } case 2: if (((ch >= 'd') && (ch <= 'f')) && (indInPair.value == 0)) { continue; } return(null); } return(null); } switch (index) { case 0: case 1: num3 = 0; goto Label_0136; case 2: goto Label_0142; default: return(null); } Label_011A: if (ch == base.bdCharset[index][5 + num3]._BCGETCHARCODE()) { goto Label_013B; } num3++; Label_0136: if (num3 < 0x60) { goto Label_011A; } Label_013B: if (num3 >= 0x60) { return(null); } continue; Label_0142: if ((indInPair.value == 0) && (i == (cc - 1))) { return(null); } if ((ch < '0') || (ch > '9')) { return(null); } } char[] chArray = new char[cc + 1]; Array.Copy(data, 0, chArray, 0, cc); chArray[cc] = this.CalcCheckChar(data, cc); return(chArray); }
protected static char s_C128CheckChar(int iStartCharSet, bool b2StartChars, char[] text, int cc) { int num = 0; IntRef indInPair = new IntRef(); if (iStartCharSet == 0) { num += 0x67; } else if (iStartCharSet == 1) { num += 0x68; } else if (iStartCharSet == 2) { num += 0x69; } int num2 = 1; if (b2StartChars) { num += 0x66 * num2; num2++; } for (int i = 0; i < cc; i++) { char ch = text[i]; if ((ch & '\x0080') != 0) { ch &= (char)0xff7f; num += ch * num2; num2++; } else { int num4 = s_C128QueryCharSet(iStartCharSet, text, text.Length, i, indInPair); if (num4 == 0) { if (ch <= '\x001f') { num += (ch + '@') * num2; } else if (ch <= '_') { num += (ch - ' ') * num2; } num2++; } else if (num4 == 1) { num += (ch - ' ') * num2; num2++; } else if ((num4 == 2) && (indInPair.value == 0)) { num += (((text[i] - '0') * 10) + (text[i + 1] - '0')) * num2; num2++; } } } return((char)((num % 0x67) + 0x80)); }