这是我的代码,我只是想知道如何将 4bytes 拆分为 1byte-1byte-1byte-1byte
static int count;
private void SetClock_Click(object sender, EventArgs e)
{
count++;
label5.Text = count.ToString("X8");
DateTime time = DateTime.Now;
txtSend.Text = "4D-" + "1A-" + "2B-" + "3C-" +
(label5.Text.ToString()) + "-" + "03-" + "07-" + "00-" +
time.ToString("yy-MM-dd-") +
((int)time.DayOfWeek).ToString("00") +
time.ToString("-HH-mm-ss");
string[] allHaxValues = txtSend.Text.Split(new char[] { '-' });
int result = 0;
foreach (string haxValue in allHaxValues)
{
result = result ^ Convert.ToInt32(haxValue, 16);
}
//txtSend.Text = s;
txtSend.Text = txtSend.Text + ("-") + result.ToString("X2");
}
我在单击“00000001”时收到价值。我想像其他人一样得到它“00-00-00-01”谢谢