コード例 #1
0
        private void writeCrumButton_Click(object sender, EventArgs e)
        {
            this.FormClosing += AT88DumpForm_FormClosing;
            if (_programmer.IsBusy || (_programmer == null))
            {
                return;
            }

            MemoryRegion udr = new MemoryRegion(0, 256, 1);

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

            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 -= AT88DumpForm_FormClosing;
            };



            infoPanel.SetProgressState("Writing");
            _programmer.ProgramChip(passwordSelectComboBox.SelectedItem.ToString(), regions, complete, infoPanel.GetProgressDelegate());
        }
コード例 #2
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());
        }
コード例 #3
0
        public void AT88Write(string subtype, string name, string serialnumtype, string templatefile)
        {
            if ((_programmer == null) || !(_programmer is IAT88Programmer))
            {
                SetAlarmText("Connect the compatible resetter");
                return;
            }
            IAT88Programmer prog = _programmer as IAT88Programmer;

            if (prog.IsBusy)
            {
                SetInfoText("Resetter is busy");
                return;
            }

            this.FormClosing += AutoForm_FormClosing;
            thisBusy          = true;

            List <MemoryRegion> regions = null;
            Action <ProgrammingCompleteInfo> programmComplete =
                delegate(ProgrammingCompleteInfo pcInfo)
            {
                progressBar.Value = progressBar.Minimum;
                if (pcInfo.error != null)
                {
                    if (pcInfo.error is VerificationException)
                    {
                        VerificationException ve = pcInfo.error as VerificationException;
                        SetAlarmText(
                            "Verification error At address: " + ve.ErrorAddress.ToString()
                            + " write: " + ve.WrittenByte.ToString()
                            + " read: " + ve.ReadByte.ToString());
                    }
                    else
                    {
                        SetAlarmText(pcInfo.error.Message);
                    }

                    thisBusy          = false;
                    this.FormClosing -= AutoForm_FormClosing;
                }
                else if (serialnumtype == "No")
                {
                    thisBusy          = false;
                    this.FormClosing -= AutoForm_FormClosing;
                    SetOkText(pcInfo.Message);
                }
                else
                {
                    Action <FileWorkerIOCompleteInfo> writeComplete =
                        delegate(FileWorkerIOCompleteInfo fwiocInfo)
                    {
                        SetOkText(pcInfo.Message);
                        thisBusy          = false;
                        this.FormClosing -= AutoForm_FormClosing;
                    };

                    _dumpCoprrectors[serialnumtype](regions[0].Data);
                    _fileWorker.Write(templatefile, regions, writeComplete);
                }
            };

            Action <FileWorkerIOCompleteInfo> readFileComplete =
                delegate(FileWorkerIOCompleteInfo fwiocInfo)
            {
                if (fwiocInfo.Error != null)
                {
                    thisBusy          = false;
                    this.FormClosing -= AutoForm_FormClosing;
                    SetAlarmText(fwiocInfo.Error.Message);
                }
                else
                {
                    if (prog.IsBusy)
                    {
                        thisBusy          = false;
                        this.FormClosing -= AutoForm_FormClosing;
                        SetInfoText("Resetter is busy");
                        return;
                    }
                    regions = fwiocInfo.Regions;
                    prog.ProgramChip(subtype, fwiocInfo.Regions, programmComplete, Progress);
                }
            };
            MemoryRegionInfo regionInfo = new MemoryRegionInfo()
            {
                Address = 0, Size = 256, Type = 1
            };

            _fileWorker.Read(templatefile, new List <MemoryRegionInfo>()
            {
                regionInfo
            }, readFileComplete);
        }