Sim;lify CheatList

This commit is contained in:
adelikat 2020-06-06 10:52:43 -05:00
parent 89606523ba
commit 554052f660
1 changed files with 95 additions and 111 deletions

View File

@ -176,11 +176,6 @@ namespace BizHawk.Client.Common
return _cheatList.Any(c => c == cheat);
}
public bool Contains(MemoryDomain domain, long address)
{
return _cheatList.Any(c => c.Domain == domain && c.Address == address);
}
public void CopyTo(Cheat[] array, int arrayIndex)
{
_cheatList.CopyTo(array, arrayIndex);
@ -220,12 +215,6 @@ namespace BizHawk.Client.Common
Changes = true;
}
public void EnableAll()
{
_cheatList.ForEach(c => c.Enable(false));
Changes = true;
}
public bool IsActive(MemoryDomain domain, long address)
{
return _cheatList.Any(cheat =>
@ -272,8 +261,6 @@ namespace BizHawk.Client.Common
file.Directory.Create();
}
using (var sw = new StreamWriter(path))
{
var sb = new StringBuilder();
foreach (var cheat in _cheatList)
@ -303,12 +290,10 @@ namespace BizHawk.Client.Common
.AppendLine();
cheat.SetType(tempCheatType);
}
}
sw.WriteLine(sb.ToString());
}
File.WriteAllText(path, sb.ToString());
CurrentFileName = path;
Global.Config.RecentCheats.Add(CurrentFileName);
@ -334,8 +319,8 @@ namespace BizHawk.Client.Common
CurrentFileName = path;
}
using (var sr = file.OpenText())
{
using var sr = file.OpenText();
if (!append)
{
Clear();
@ -356,7 +341,7 @@ namespace BizHawk.Client.Common
var size = WatchSize.Byte;
var type = DisplayType.Hex;
var bigEndian = false;
Cheat.CompareType comparisonType = Cheat.CompareType.None;
var comparisonType = Cheat.CompareType.None;
if (s.Length < 6)
{
@ -413,7 +398,6 @@ namespace BizHawk.Client.Common
continue;
}
}
}
Changes = false;
return true;