Пример #1
0
        private void writeChipStripButton_Click(object sender, EventArgs e)
        {
            this.FormClosing += CRUM921Form_FormClosing;
            if (_programmer.IsBusy || (_programmer == null))
            {
                return;
            }

            Action <ProgrammingCompleteInfo> complete =
                delegate(ProgrammingCompleteInfo pcInfo)
            {
                if (pcInfo.error != null)
                {
                    infoPanel.SetErrorState(pcInfo.error.Message);
                }
                else
                {
                    infoPanel.SetOkState(pcInfo.Message);
                }

                this.FormClosing -= CRUM921Form_FormClosing;
            };



            infoPanel.SetInfoState("Starting process");
            MemoryRegion region = new MemoryRegion(0, 384, 1);

            region.WriteData(0, _dataBytes.GetBytes());
            _programmer.ProgramChip("Mode 0", region, complete, infoPanel.GetProgressDelegate());
        }
Пример #2
0
        private void SaveUserDataFileMenuItem_Click(object sender, EventArgs e)
        {
            saveFileDialog.Filter           = "hex files (*.hex)|*.hex|bin files (*.bin)|*.bin";
            saveFileDialog.FilterIndex      = 1;
            saveFileDialog.RestoreDirectory = false;
            saveFileDialog.FileName         = "";
            if (saveFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            MemoryRegion region = new MemoryRegion(0, 256, 0);

            region.WriteData(0, _userDataBytes.GetBytes());
            List <MemoryRegion> regions = new List <MemoryRegion>()
            {
                region
            };

            Action <FileWorkerIOCompleteInfo> complete =
                delegate(FileWorkerIOCompleteInfo info)
            {
                if (info.Error != null)
                {
                    infoPanel.SetErrorState(info.Error.Message);
                }
            };

            file.Write(saveFileDialog.FileName, regions, complete);
        }
Пример #3
0
 private void bSave_Click(object sender, EventArgs e)
 {
     Canceled   = false;
     result     = bytes.GetBytes();
     resultName = tbName.Text;
     Close();
 }
Пример #4
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            DynamicByteProvider BytePro = hexBox1.ByteProvider as DynamicByteProvider;

            try
            {
                strPipeMsgOut.sockid = int.Parse(txtSockID.Text, System.Globalization.NumberStyles.HexNumber);
            }
            catch
            {
                MessageBox.Show("Invalid socket ID.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtSockID.SelectAll();
                txtSockID.Focus();
                return;
            }

            bcBytes = BytePro.Bytes;
            strPipeMsgOut.command  = Glob.CMD_INJECT;
            strPipeMsgOut.function = Glob.FUNC_SEND;
            strPipeMsgOut.datasize = bcBytes.Count;

            for (int times = int.Parse(txtTimes.Text); times > 0; times--)
            {
                pipeOut.Write(Glob.RawSerializeEx(strPipeMsgOut), 0, Marshal.SizeOf(strPipeMsgOut));
                pipeOut.Write(bcBytes.GetBytes(), 0, strPipeMsgOut.datasize);
            }
        }
        private void btnSend_Click(object sender, EventArgs e)
        {
            DynamicByteProvider BytePro = hexBox1.ByteProvider as DynamicByteProvider;
            try
            {
                strPipeMsgOut.sockid = int.Parse(txtSockID.Text, System.Globalization.NumberStyles.HexNumber);
            }
            catch
            {
                MessageBox.Show("Invalid socket ID.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtSockID.SelectAll();
                txtSockID.Focus();
                return;
            }

            bcBytes = BytePro.Bytes;
            strPipeMsgOut.command = Glob.CMD_INJECT;
            strPipeMsgOut.function = Glob.FUNC_SEND;
            strPipeMsgOut.datasize = bcBytes.Count;

            for (int times = int.Parse(txtTimes.Text); times > 0; times--)
            {
                pipeOut.Write(Glob.RawSerializeEx(strPipeMsgOut), 0, Marshal.SizeOf(strPipeMsgOut));
                pipeOut.Write(bcBytes.GetBytes(), 0, strPipeMsgOut.datasize);
            }
        }
Пример #6
0
        private void writeChipStripButton_Click(object sender, EventArgs e)
        {
            this.FormClosing += Xerox0190Form_FormClosing;
            if (_programmer.IsBusy || (_programmer == null))
            {
                return;
            }

            Action <ProgrammingCompleteInfo> complete =
                delegate(ProgrammingCompleteInfo pcInfo)
            {
                if (pcInfo.error != null)
                {
                    if (pcInfo.error is VerificationException)
                    {
                        VerificationException ve = pcInfo.error as VerificationException;
                        infoPanel.SetErrorState(
                            "Verification error. At address: " + ve.ErrorAddress.ToString("X")
                            + " write: " + ve.WrittenByte.ToString("X")
                            + " read: " + ve.ReadByte.ToString("X"));
                    }
                    else
                    {
                        infoPanel.SetErrorState(pcInfo.error.Message);
                    }
                }
                else
                {
                    infoPanel.SetOkState("Write complete");
                }

                this.FormClosing -= Xerox0190Form_FormClosing;
            };



            infoPanel.SetProgressState("Writing");
            MemoryRegion region = new MemoryRegion(0, 256, 1);

            region.WriteData(0, _dataBytes.GetBytes());
            _programmer.ProgramChip("Mode 0", region, complete, infoPanel.GetProgressDelegate());
        }