return null;
}
finalLength = this._checksum ? ((buffer2.Length + 2) + 1) : (buffer2.Length + 2);
return this.getPattern_c39(buffer2);
}
/// <summary>
/// 计算效验值
/// </summary>
/// <param name="data"></param>
/// <param name="len"></param>
/// <returns></returns>
private byte _checksum_c39(byte[] data, int len)
{
//0x2b 43
//字符值的总和除以合法字符集的个数43 取余数 余数在合法字符数组中对应的数值就是效验值
int num2 = 0;
for (int i = 1; i < len; i++)
{
num2 += this.valueFromCharacter(data[i]);
}
return this.c39_cw[num2 % 0x2b];
}
private char[] Code39_bitpattern(string dataToEncode)
{
int finalLength = 0;
return this._bitpattern_c39(dataToEncode, ref finalLength);
}
/// <summary>
/// 获得Code39条码图片
/// </summary>
/// <param name="resolution">DPI</param>
/// <returns></returns>
public Bitmap getBitmapImage(float resolution)
{
return Code39_createCode(resolution);
}
private Bitmap Code39_createCode(float resolution)
{
int num6;
int finalLength = 0;
char[] chArray = this._bitpattern_c39(DataToEncode, ref finalLength);
if (chArray == null)
{
return null;
}
float fontsize = this._humanReadable ? (0.3527778f * this._humanReadableSize) : 0f;
// float num3 = (7f * ModuleWidth) + ((3f * Ratio) * ModuleWidth);
float num3 = (7f * this._moduleWidth) + ((3f * this._ratio) * this._moduleWidth);
float width = (finalLength * num3) + (2f * this._marginX);