Refactored previous parameter in CompareTo and ComparePrevious from strings to enums.
This commit is contained in:
parent
b2c9171b90
commit
2580489986
|
@ -2193,20 +2193,7 @@ namespace BizHawk.MultiClient
|
|||
string columnName = SearchListView.Columns[columnToOrder].Text;
|
||||
if (sortedCol.CompareTo(columnName) != 0)
|
||||
sortReverse = false;
|
||||
string previous = "Last Frame";
|
||||
switch (Global.Config.RamSearchPreviousAs)
|
||||
{
|
||||
case 0:
|
||||
previous = "Last Search";
|
||||
break;
|
||||
case 1:
|
||||
previous = "Original";
|
||||
break;
|
||||
case 3:
|
||||
previous = "Last Change";
|
||||
break;
|
||||
}
|
||||
searchList.Sort((x, y) => x.CompareTo(y, columnName, previous) * (sortReverse ? -1 : 1));
|
||||
searchList.Sort((x, y) => x.CompareTo(y, columnName, (prevDef)Global.Config.RamSearchPreviousAs) * (sortReverse ? -1 : 1));
|
||||
sortedCol = columnName;
|
||||
sortReverse = !(sortReverse);
|
||||
SearchListView.Refresh();
|
||||
|
|
|
@ -1336,7 +1336,7 @@ namespace BizHawk.MultiClient
|
|||
string columnName = WatchListView.Columns[columnToOrder].Text;
|
||||
if (sortedCol.CompareTo(columnName) != 0)
|
||||
sortReverse = false;
|
||||
watchList.Sort((x, y) => x.CompareTo(y, columnName, "Last Frame") * (sortReverse ? -1 : 1));
|
||||
watchList.Sort((x, y) => x.CompareTo(y, columnName, prevDef.LASTFRAME) * (sortReverse ? -1 : 1));
|
||||
sortedCol = columnName;
|
||||
sortReverse = !(sortReverse);
|
||||
WatchListView.Refresh();
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
public enum atype { BYTE, WORD, DWORD, SEPARATOR }; //TODO: more custom types too like 12.4 and 24.12 fixed point
|
||||
public enum asigned { SIGNED, UNSIGNED, HEX };
|
||||
public enum prevDef { LASTSEARCH, ORIGINAL, LASTFRAME, LASTCHANGE };
|
||||
|
||||
/// <summary>
|
||||
/// An object that represent a ram address and related properties
|
||||
|
@ -338,18 +339,18 @@ namespace BizHawk.MultiClient
|
|||
return ValToString(lastsearch);
|
||||
}
|
||||
|
||||
private int ComparePrevious(Watch Other, string previous)
|
||||
private int ComparePrevious(Watch Other, prevDef previous)
|
||||
{
|
||||
switch (previous)
|
||||
{
|
||||
case "Last Search":
|
||||
case prevDef.LASTSEARCH:
|
||||
return CompareLastSearch(Other);
|
||||
case "Original":
|
||||
case prevDef.ORIGINAL:
|
||||
return CompareOriginal(Other);
|
||||
default:
|
||||
case "Last Frame":
|
||||
case prevDef.LASTFRAME:
|
||||
return ComparePrev(Other);
|
||||
case "Last Change":
|
||||
case prevDef.LASTCHANGE:
|
||||
return CompareLastChange(Other);
|
||||
}
|
||||
}
|
||||
|
@ -481,7 +482,7 @@ namespace BizHawk.MultiClient
|
|||
return this.notes.CompareTo(Other.notes);
|
||||
}
|
||||
|
||||
public int CompareTo(Watch Other, string parameter, string previous)
|
||||
public int CompareTo(Watch Other, string parameter, prevDef previous)
|
||||
{
|
||||
int compare = 0;
|
||||
if (parameter == "Address")
|
||||
|
|
Loading…
Reference in New Issue