/// <summary> /// 多项式CRC16 低位在前 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> //private void MS_CRCPolyL_Click(object sender, EventArgs e) //{ // Lib.CMD cmd = CMD_bytesBox.GetCMD(); // if (cmd != null) // { // frmPoly fpoly = new frmPoly(); // if (fpoly.ShowDialog() == DialogResult.OK) // { // AppendToContent(Lib.BytesCheck.GetCRC16ByPoly(cmd.Bytes, fpoly.Poly, false)); // } // } //} private void AppendToContent(byte[] check) { foreach (byte b in check) { CMD_bytesBox.AppendText(string.Format("{0:X2}", b)); } }
private void CMD_Save_btn_Click(object sender, EventArgs e) { NewCMD = CMD_bytesBox.GetCMD(); if (NewCMD != null) { this.DialogResult = DialogResult.OK; } }
/// <summary> /// 校验和 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MS_CheckSum_Click(object sender, EventArgs e) { Lib.CMD cmd = CMD_bytesBox.GetCMD(); if (cmd != null) { byte check = Lib.BytesCheck.GetXOR(cmd.Bytes); CMD_bytesBox.AppendText(Convert.ToString(check, 16).PadLeft(2, '0')); } }
public CmdForm(Lib.CMD cmd) { InitializeComponent(); CMD_bytesBox.SetCMD(cmd); SetType(CMD_bytesBox.EncodeType); }
/// <summary> /// 清空 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CM_Clear_Click(object sender, EventArgs e) { CMD_bytesBox.Clear(); }