主题:有人帮我看看哪里错了吗··应该怎么改呢?
string serial, str1;
string key;
int ebp;
int esi;
Encoding gb = Encoding.GetEncoding("gb2312");
serial = "";
ebp = 0;
esi = 1;
key = txtCompany.Text.ToUpper() + txtInstrument.Text.ToUpper();
if (gb.GetBytes(key).Length <12)
key = key + "123456789ABC";
byte[] bytes = gb.GetBytes(key);
for (int i = 0; i < bytes.Length; i++)
{
ebp = ebp + bytes;
}
for (int i = 0; i < bytes.Length; i++)
{
esi = esi * (ebp / bytes);
if (esi.ToString().Length > 10)
break;
}
esi = Math.Abs(esi + ebp);
str1 = esi.ToString();
for (int i = str1.Length - 1; i >= 0; i--)
{
serial = serial + str1.Substring(i, 1);
}
serial = serial.Substring(0, 5) + "-" + serial.Substring(5, 5);
txtSerial.Text = serial;
string key;
int ebp;
int esi;
Encoding gb = Encoding.GetEncoding("gb2312");
serial = "";
ebp = 0;
esi = 1;
key = txtCompany.Text.ToUpper() + txtInstrument.Text.ToUpper();
if (gb.GetBytes(key).Length <12)
key = key + "123456789ABC";
byte[] bytes = gb.GetBytes(key);
for (int i = 0; i < bytes.Length; i++)
{
ebp = ebp + bytes;
}
for (int i = 0; i < bytes.Length; i++)
{
esi = esi * (ebp / bytes);
if (esi.ToString().Length > 10)
break;
}
esi = Math.Abs(esi + ebp);
str1 = esi.ToString();
for (int i = str1.Length - 1; i >= 0; i--)
{
serial = serial + str1.Substring(i, 1);
}
serial = serial.Substring(0, 5) + "-" + serial.Substring(5, 5);
txtSerial.Text = serial;