Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == -1)
            {
                LogRichTextBox.AppendText("请选择串口\n");
                return;
            }
            WriteInfo req  = new WriteInfo();
            writeInfo info = new writeInfo();//写入设备的信息
            string    temp = numericUpDown1.Value.ToString().PadLeft(3, '0');



            req.cfgInit(comboBox1.Items[comboBox1.SelectedIndex].ToString(), LogRichTextBox);
            info.action = 3;
            reinfo      = req.WriteInfoFunc(info);
            byte[] snData = reinfo.SN;
            info.encKey = AESHelper.AESEncrypt(snData, KEY);
            info.action = 1;
            info.ID     = textBox1.Text + textBox6.Text + textBox5.Text + temp;
            info.verson = textBox2.Text;
            LogRichTextBox.AppendText("ID: " + info.ID + ",硬件版本: " + info.verson + "\n开始烧写...\n");
            req.WriteInfoFunc(info);
            LogRichTextBox.AppendText("烧写成功\n");
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == -1)
            {
                LogRichTextBox.AppendText("请选择串口\n");
                return;
            }
            WriteInfo req   = new WriteInfo();
            writeInfo wInfo = new writeInfo();

            req.cfgInit(comboBox1.Items[comboBox1.SelectedIndex].ToString(), LogRichTextBox);
            wInfo.action = 2;
            string result = req.WriteInfoFunc(wInfo).ID;

            string[] info = result.Split(new char[3] {
                '/', '|', '/'
            }, StringSplitOptions.RemoveEmptyEntries);
            if (info.Count() == 0)
            {
                LogRichTextBox.AppendText("读取失败\n");
                return;
            }
            MessageBox.Show("ID:" + info[0]);
            LogRichTextBox.AppendText("ID: " + info[0] + ",硬件版本: " + info[1] + "\n");
        }