public static string GetRawText(string text, bool ucc) {
String outs = "";
int tLen = text.Length;
if (tLen == 0) {
outs += START_B;
if (ucc)
outs += FNC1_INDEX;
return outs;
}
int c = 0;
for (int k = 0; k < tLen; ++k) {
c = text[k];
if (c > 127 && c != FNC1)
throw new ArgumentException("There are illegal characters for barcode 128 in '" + text + "'.");
}
c = text[0];
char currentCode = START_B;
int index = 0;
if (IsNextDigits(text, index, 2)) {
currentCode = START_C;
outs += currentCode;
if (ucc)
outs += FNC1_INDEX;
String out2 = GetPackedRawDigits(text, index, 2);
index += (int)out2[0];
outs += out2.Substring(1);
}
else if (c < ' ') {
currentCode = START_A;
outs += currentCode;
if (ucc)
outs += FNC1_INDEX;
outs += (char)(c + 64);
++index;
}
else {
outs += currentCode;
if (ucc)
outs += FNC1_INDEX;
if (c == FNC1)
outs += FNC1_INDEX;
else
outs += (char)(c - ' ');
++index;
}
while (index < tLen) {
switch (currentCode) {
case START_A:
{
if (IsNextDigits(text, index, 4)) {
currentCode = START_C;
outs += CODE_AB_TO_C;
String out2 = GetPackedRawDigits(text, index, 4);
index += (int)out2[0];
outs += out2.Substring(1);
}
else {
c = text[index++];
if (c == FNC1)
outs += FNC1_INDEX;
else if (c > '_') {
currentCode = START_B;
outs += CODE_AC_TO_B;
outs += (char)(c - ' ');
}
else if (c < ' ')
outs += (char)(c + 64);
else
outs += (char)(c - ' ');
}
}
break;
case START_B:
{
if (IsNextDigits(text, index, 4)) {
currentCode = START_C;
outs += CODE_AB_TO_C;
String out2 = GetPackedRawDigits(text, index, 4);
index += (int)out2[0];
outs += out2.Substring(1);
}
else {
c = text[index++];
if (c == FNC1)
outs += FNC1_INDEX;
else if (c < ' ') {
currentCode = START_A;
outs += CODE_BC_TO_A;
outs += (char)(c + 64);
}
else {
outs += (char)(c - ' ');
}
}
}
break;
case START_C:
{
if (IsNextDigits(text, index, 2)) {
String out2 = GetPackedRawDigits(text, index, 2);
index += (int)out2[0];
outs += out2.Substring(1);
}
else {
c = text[index++];
if (c == FNC1)
outs += FNC1_INDEX;
else if (c < ' ') {
currentCode = START_A;
outs += CODE_BC_TO_A;
outs += (char)(c + 64);
}
else {
currentCode = START_B;
outs += CODE_AC_TO_B;
outs += (char)(c - ' ');
}
}
}
break;
}
}
return outs;
}