Ram Search - if invalid specific address entered by user, don't do the search anyway! Also, highlight the invalid data for the user.

This commit is contained in:
andres.delikat 2011-02-20 20:12:17 +00:00
parent 86f3538800
commit 5172f9e397
1 changed files with 26 additions and 23 deletions

View File

@ -392,11 +392,14 @@ namespace BizHawk.MultiClient
private void toolStripButton1_Click(object sender, EventArgs e) private void toolStripButton1_Click(object sender, EventArgs e)
{ {
GenerateWeedOutList(); if (GenerateWeedOutList())
SaveUndo(); {
OutputLabel.Text = (searchList.Count - weedOutList.Count).ToString() + " addresses removed"; //TODO: address if only 1 SaveUndo();
ReplaceSearchListWithWeedOutList(); OutputLabel.Text = (searchList.Count - weedOutList.Count).ToString() + " addresses removed"; //TODO: address if only 1
DisplaySearchList(); ReplaceSearchListWithWeedOutList();
DisplaySearchList();
}
//TODO: else notify the user something went wrong?
} }
@ -441,7 +444,7 @@ namespace BizHawk.MultiClient
return SOperator.LESS; //Just in case return SOperator.LESS; //Just in case
} }
private void GenerateWeedOutList() private bool GenerateWeedOutList()
{ {
//Switch based on user criteria //Switch based on user criteria
//Generate search list //Generate search list
@ -449,28 +452,26 @@ namespace BizHawk.MultiClient
switch (GetCompareTo()) switch (GetCompareTo())
{ {
case SCompareTo.PREV: case SCompareTo.PREV:
DoPreviousValue(); return DoPreviousValue();
break;
case SCompareTo.VALUE: case SCompareTo.VALUE:
DoSpecificValue(); return DoSpecificValue();
break;
case SCompareTo.ADDRESS: case SCompareTo.ADDRESS:
DoSpecificAddress(); return DoSpecificAddress();
break;
case SCompareTo.CHANGES: case SCompareTo.CHANGES:
DoNumberOfChanges(); return DoNumberOfChanges();
break; default:
return false;
} }
} }
private void DoPreviousValue() private bool DoPreviousValue()
{ {
return false;
} }
private void DoSpecificValue() private bool DoSpecificValue()
{ {
return false;
} }
private int GetSpecificAddress() private int GetSpecificAddress()
@ -484,13 +485,15 @@ namespace BizHawk.MultiClient
return x; return x;
} }
private void DoSpecificAddress() private bool DoSpecificAddress()
{ {
int address = GetSpecificAddress(); int address = GetSpecificAddress();
if (address < 0) if (address < 0)
{ {
MessageBox.Show("Missing or invalid address", "Invalid address", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Missing or invalid address", "Invalid address", MessageBoxButtons.OK, MessageBoxIcon.Error);
return; SpecificAddressBox.Focus();
SpecificAddressBox.SelectAll();
return false;
} }
switch (GetOperator()) switch (GetOperator())
{ {
@ -509,7 +512,6 @@ namespace BizHawk.MultiClient
if (searchList[x].address == address) if (searchList[x].address == address)
weedOutList.Add(searchList[x]); weedOutList.Add(searchList[x]);
} }
break; break;
case SOperator.NOTEQUAL: case SOperator.NOTEQUAL:
break; break;
@ -518,11 +520,12 @@ namespace BizHawk.MultiClient
case SOperator.MODULUS: case SOperator.MODULUS:
break; break;
} }
return true;
} }
private void DoNumberOfChanges() private bool DoNumberOfChanges()
{ {
return false;
} }
private void signedToolStripMenuItem_Click(object sender, EventArgs e) private void signedToolStripMenuItem_Click(object sender, EventArgs e)