Ram Search - implement searching by number of changes

This commit is contained in:
andres.delikat 2011-02-20 23:01:43 +00:00
parent 738c633096
commit da31963df5
3 changed files with 121 additions and 5 deletions

View File

@ -392,7 +392,7 @@
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton1.Name = "toolStripButton1"; this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(23, 22); this.toolStripButton1.Size = new System.Drawing.Size(23, 22);
this.toolStripButton1.Text = "toolStripButton1"; this.toolStripButton1.Text = "Search";
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click); this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
// //
// ClearChangeCountstoolStripButton // ClearChangeCountstoolStripButton

View File

@ -461,11 +461,49 @@ namespace BizHawk.MultiClient
private bool DoPreviousValue() private bool DoPreviousValue()
{ {
switch (GetOperator())
{
case SOperator.LESS:
break;
case SOperator.GREATER:
break;
case SOperator.LESSEQUAL:
break;
case SOperator.GREATEREQUAL:
break;
case SOperator.EQUAL:
break;
case SOperator.NOTEQUAL:
break;
case SOperator.DIFFBY:
break;
case SOperator.MODULUS:
break;
}
return false; return false;
} }
private bool DoSpecificValue() private bool DoSpecificValue()
{ {
switch (GetOperator())
{
case SOperator.LESS:
break;
case SOperator.GREATER:
break;
case SOperator.LESSEQUAL:
break;
case SOperator.GREATEREQUAL:
break;
case SOperator.EQUAL:
break;
case SOperator.NOTEQUAL:
break;
case SOperator.DIFFBY:
break;
case SOperator.MODULUS:
break;
}
return false; return false;
} }
@ -563,10 +601,88 @@ namespace BizHawk.MultiClient
return true; return true;
} }
private int GetSpecificChanges()
{
bool i = InputValidate.IsValidUnsignedNumber(NumberOfChangesBox.Text);
if (!i) return -1;
return int.Parse(NumberOfChangesBox.Text.ToUpper().Trim());
}
private bool DoNumberOfChanges() private bool DoNumberOfChanges()
{ {
int changes = GetSpecificChanges();
if (changes < 0)
{
MessageBox.Show("Missing or invalid number of changes", "Invalid number", MessageBoxButtons.OK, MessageBoxIcon.Error);
NumberOfChangesBox.Focus();
NumberOfChangesBox.SelectAll();
return false; return false;
} }
switch (GetOperator())
{
case SOperator.LESS:
for (int x = 0; x < searchList.Count; x++)
{
if (searchList[x].changecount < changes)
weededList.Add(searchList[x]);
}
break;
case SOperator.GREATER:
for (int x = 0; x < searchList.Count; x++)
{
if (searchList[x].changecount > changes)
weededList.Add(searchList[x]);
}
break;
case SOperator.LESSEQUAL:
for (int x = 0; x < searchList.Count; x++)
{
if (searchList[x].changecount <= changes)
weededList.Add(searchList[x]);
}
break;
case SOperator.GREATEREQUAL:
for (int x = 0; x < searchList.Count; x++)
{
if (searchList[x].changecount >= changes)
weededList.Add(searchList[x]);
}
break;
case SOperator.EQUAL:
for (int x = 0; x < searchList.Count; x++)
{
if (searchList[x].changecount == changes)
weededList.Add(searchList[x]);
}
break;
case SOperator.NOTEQUAL:
for (int x = 0; x < searchList.Count; x++)
{
if (searchList[x].changecount != changes)
weededList.Add(searchList[x]);
}
break;
case SOperator.DIFFBY:
int diff = GetDifferentBy();
if (diff < 0)
{
MessageBox.Show("Missing or invalid Different By value", "Invalid value", MessageBoxButtons.OK, MessageBoxIcon.Error);
DifferentByBox.Focus();
DifferentByBox.SelectAll();
return false;
}
for (int x = 0; x < searchList.Count; x++)
{
if (searchList[x].address == changes + diff || searchList[x].address == changes - diff)
weededList.Add(searchList[x]);
}
break;
case SOperator.MODULUS:
break;
}
return true;
}
private void signedToolStripMenuItem_Click(object sender, EventArgs e) private void signedToolStripMenuItem_Click(object sender, EventArgs e)
{ {

View File

@ -171,9 +171,6 @@
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>259, 17</value> <value>259, 17</value>
</metadata> </metadata>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>358, 17</value>
</metadata>
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -205,6 +202,9 @@
s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC
</value> </value>
</data> </data>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>358, 17</value>
</metadata>
<data name="DataSizetoolStripSplitButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="DataSizetoolStripSplitButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8