public static byte[] GetBarsCode39(string text) {
text = "*" + text + "*";
byte[] bars = new byte[text.Length * 10 - 1];
for (int k = 0; k < text.Length; ++k) {
int idx = CHARS.IndexOf(text[k]);
if (idx < 0)
throw new ArgumentException("The character '" + text[k] + "' is illegal in code 39.");
Array.Copy(BARS[idx], 0, bars, k * 10, 9);
}
return bars;
}