Ram Poke - input validation on Address & Value boxes

This commit is contained in:
andres.delikat 2011-02-21 14:45:18 +00:00
parent 7c512a3f7e
commit 89eb17a468
3 changed files with 47 additions and 2 deletions

View File

@ -63,11 +63,14 @@
//
// AddressBox
//
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AddressBox.Location = new System.Drawing.Point(68, 30);
this.AddressBox.MaxLength = 8;
this.AddressBox.Name = "AddressBox";
this.AddressBox.Size = new System.Drawing.Size(100, 20);
this.AddressBox.Size = new System.Drawing.Size(80, 20);
this.AddressBox.TabIndex = 2;
this.AddressBox.Text = "0000";
this.AddressBox.Leave += new System.EventHandler(this.AddressBox_Leave);
//
// DataTypeGroupBox
//
@ -232,10 +235,12 @@
// ValueBox
//
this.ValueBox.Location = new System.Drawing.Point(68, 57);
this.ValueBox.MaxLength = 9;
this.ValueBox.Name = "ValueBox";
this.ValueBox.Size = new System.Drawing.Size(100, 20);
this.ValueBox.Size = new System.Drawing.Size(80, 20);
this.ValueBox.TabIndex = 11;
this.ValueBox.Text = "0000";
this.ValueBox.Leave += new System.EventHandler(this.ValueBox_Leave);
//
// RamPoke
//

View File

@ -195,5 +195,29 @@ namespace BizHawk.MultiClient
//TODO: format value based on watch.type
OutputLabel.Text = watch.value.ToString() + " written to " + String.Format("{0:X}", watch.address);
}
private void AddressBox_Leave(object sender, EventArgs e)
{
AddressBox.Text = AddressBox.Text.Replace(" ", "");
if (!InputValidate.IsValidHexNumber(AddressBox.Text))
{
AddressBox.Focus();
AddressBox.SelectAll();
ToolTip t = new ToolTip();
t.Show("Must be a valid hexadecimal value", AddressBox, 5000);
}
}
private void ValueBox_Leave(object sender, EventArgs e)
{
ValueBox.Text = ValueBox.Text.Replace(" ", "");
if (!InputValidate.IsValidUnsignedNumber(ValueBox.Text))
{
ValueBox.Focus();
ValueBox.SelectAll();
ToolTip t = new ToolTip();
t.Show("Must be a valid unsigned decimal value", ValueBox, 5000);
}
}
}
}

View File

@ -161,5 +161,21 @@ namespace BizHawk.MultiClient
break;
}
}
public void PokeAddress(MemoryDomain domain)
{
if (type == atype.SEPARATOR)
return;
switch (type)
{
case atype.BYTE:
break;
case atype.WORD:
break;
case atype.DWORD:
break;
}
}
}
}