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