Ejemplo n.º 1
0
        //----------------------------------------------------------------------
        // Handle data break section
        //----------------------------------------------------------------------
        #region Data break section

        private void btDataBreakAdd_Click(object sender, System.EventArgs e)
        {
            DataBreak db    = new DataBreak();
            bool      valid = true;

            // Get address from form
            try
            {
                db.address = Convert.ToUInt16(txtDataBreakAddr.Text.Trim(), 16);
            }
            catch
            {
                MessageBox.Show("Invalid address.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, 0);
                valid = false;
            }

            // Get data from form
            if (txtDataBreakData.Text.Trim() == "")
            {
                db.data    = 0;
                db.anydata = true;
            }
            else
            {
                try
                {
                    db.data = Convert.ToByte(txtDataBreakData.Text.Trim(), 16);
                }
                catch
                {
                    MessageBox.Show("Invalid data.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, 0);
                    valid = false;
                }
            }

            // Get read write
            if (rbRead.Checked)
            {
                db.readwrite = 'R';
            }
            else
            {
                db.readwrite = 'W';
            }

            // Add it to the list box
            if (valid)
            {
                AddDataBreak(db);
                txtDataBreakData.Text = "";
                txtDataBreakAddr.Text = "";
            }
        }
Ejemplo n.º 2
0
        /*---------------------------------------------------------------------------
         * AddDateBreak(addr, readwrite, data, anydata)
         *	Function: Adds a new data break
         *	Parameters: addr = address
         *				readwrite: R = read/W = write
         *				data: Data to look for
         *				anydata: true = look for any data
         *---------------------------------------------------------------------------*/

        public void AddDataBreak(UInt16 addr, char readwrite, Byte data, bool anydata)
        {
            DataBreak db = new DataBreak
            {
                address   = addr,
                readwrite = readwrite,
                data      = data,
                anydata   = anydata
            };

            DataBreak.Add(db.key(), db);
        }
Ejemplo n.º 3
0
 private void AddDataBreak(DataBreak db)
 {
     lbDataBreak.Items.Add(db);
 }