Added code to sort by comparison type. Added code to compare based on comparison type selected

This commit is contained in:
Adam Sturge 2016-02-07 20:56:40 -08:00
parent f19333dd11
commit 992acd9e96
3 changed files with 69 additions and 5 deletions

View File

@ -253,10 +253,54 @@ namespace BizHawk.Client.Common
{
if (_compare.HasValue)
{
if (_compare.Value == _watch.ValueNoFreeze) // NOTE : THIS IS THE PLACE TO ADD DIFFERENT COMPARISON TYPES
switch (_comparisonType)
{
_watch.Poke(GetStringForPulse(_val));
case Cheat.COMPARISONTYPE.EQUAL:
if (_compare.Value == _watch.ValueNoFreeze)
{
_watch.Poke(GetStringForPulse(_val));
}
break;
case Cheat.COMPARISONTYPE.GREATER_THAN:
if (_compare.Value > _watch.ValueNoFreeze)
{
_watch.Poke(GetStringForPulse(_val));
}
break;
case Cheat.COMPARISONTYPE.GREATER_THAN_OR_EQUAL:
if (_compare.Value >= _watch.ValueNoFreeze)
{
_watch.Poke(GetStringForPulse(_val));
}
break;
case Cheat.COMPARISONTYPE.LESS_THAN:
if (_compare.Value < _watch.ValueNoFreeze)
{
_watch.Poke(GetStringForPulse(_val));
}
break;
case Cheat.COMPARISONTYPE.LESS_THAN_OR_EQUAL:
if (_compare.Value <= _watch.ValueNoFreeze)
{
_watch.Poke(GetStringForPulse(_val));
}
break;
case Cheat.COMPARISONTYPE.NOT_EQUAL:
if (_compare.Value != _watch.ValueNoFreeze)
{
_watch.Poke(GetStringForPulse(_val));
}
break;
default :
if (_compare.Value == _watch.ValueNoFreeze)
{
_watch.Poke(GetStringForPulse(_val));
}
break;
}
}
else
{

View File

@ -673,6 +673,25 @@ namespace BizHawk.Client.Common
.ToList();
}
break;
case COMPARISONTYPE:
if (reverse)
{
_cheatList = _cheatList
.OrderByDescending(x => x.ComparisonType)
.ThenBy(x => x.Name)
.ThenBy(x => x.Address ?? 0)
.ToList();
}
else
{
_cheatList = _cheatList
.OrderBy(x => x.ComparisonType)
.ThenBy(x => x.Name)
.ThenBy(x => x.Address ?? 0)
.ToList();
}
break;
}
}
@ -706,5 +725,6 @@ namespace BizHawk.Client.Common
public const string SIZE = "SizeColumn";
public const string ENDIAN = "EndianColumn";
public const string TYPE = "DisplayTypeColumn";
private const string COMPARISONTYPE = "ComparisonTypeColumn";
}
}

View File

@ -111,10 +111,10 @@
this.CheatListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.CheatName,
this.Address,
this.Value,
this.ComparisonType,
this.Value,
this.Compare,
this.On,
this.ComparisonType,
this.On,
this.Domain});
this.CheatListView.ContextMenuStrip = this.CheatsContextMenu;
this.CheatListView.FullRowSelect = true;