Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter      = "Binary files|*.bin";
            ofd.Multiselect = false;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                // verify checksums..
                if (!Checksum_Volvo_ME7(ofd.FileName, true))
                {
                    DialogResult dr = MessageBox.Show("The checksums of this file seem to be incorrect. Do you want to update them?", "Attention!", MessageBoxButtons.YesNoCancel);
                    if (dr == DialogResult.Cancel)
                    {
                        return;
                    }
                    if (dr == DialogResult.Yes)
                    {
                        Checksum_Volvo_ME7(ofd.FileName, false);
                    }
                }
                if (Checksum_Volvo_ME7(ofd.FileName, true))
                {
                    AddToLogItem("Checksums ok.");
                }
                else
                {
                    AddToLogItem("Checksums failed.");
                }
                _cancomms.ProgramECU(ofd.FileName);
            }
        }