Ram Search - make manually deleting items a lot faster, since it was taking many many minutes when user was manually deleting an absurd number at once
This commit is contained in:
parent
8362d078a4
commit
461b73f1df
|
@ -340,14 +340,30 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRange(IEnumerable<int> addresses)
|
/// <summary>
|
||||||
|
/// Remove a set of watches
|
||||||
|
/// However, this should not be used with large data sets (100k or more) as it uses a contains logic to perform the task
|
||||||
|
/// </summary>
|
||||||
|
public void RemoveSmallWatchRange(IEnumerable<Watch> watches)
|
||||||
{
|
{
|
||||||
if (_keepHistory)
|
if (_keepHistory)
|
||||||
{
|
{
|
||||||
_history.AddState(_watchList);
|
_history.AddState(_watchList);
|
||||||
}
|
}
|
||||||
|
|
||||||
_watchList = _watchList.Where(x => !addresses.Contains(x.Address)).ToList();
|
var addresses = watches.Select(x => x.Address ?? 0);
|
||||||
|
var removeList = _watchList.Where(x => !addresses.Contains(x.Address)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveRange(IEnumerable<int> indices)
|
||||||
|
{
|
||||||
|
if (_keepHistory)
|
||||||
|
{
|
||||||
|
_history.AddState(_watchList);
|
||||||
|
}
|
||||||
|
|
||||||
|
var removeList = indices.Select(i => _watchList[i]);
|
||||||
|
_watchList = _watchList.Except(removeList).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRange(List<int> addresses, bool append)
|
public void AddRange(List<int> addresses, bool append)
|
||||||
|
|
|
@ -783,9 +783,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (indices.Any())
|
if (indices.Any())
|
||||||
{
|
{
|
||||||
SetRemovedMessage(indices.Count);
|
SetRemovedMessage(indices.Count);
|
||||||
|
_searches.RemoveRange(indices);
|
||||||
var addresses = indices.Select(index => _searches[index].Address ?? 0).ToList();
|
|
||||||
_searches.RemoveRange(addresses);
|
|
||||||
|
|
||||||
WatchListView.ItemCount = _searches.Count;
|
WatchListView.ItemCount = _searches.Count;
|
||||||
SetTotal();
|
SetTotal();
|
||||||
|
@ -805,12 +803,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
var watches = new WatchList(_settings.Domain);
|
var watches = new WatchList(_settings.Domain);
|
||||||
watches.Load(file.FullName, append);
|
watches.Load(file.FullName, append);
|
||||||
var addresses = watches.Where(x => !x.IsSeparator).Select(x => x.Address ?? 0).ToList();
|
|
||||||
|
var watchList = watches.Where(x => !x.IsSeparator);
|
||||||
|
var addresses = watchList.Select(x => x.Address ?? 0).ToList();
|
||||||
|
|
||||||
if (truncate)
|
if (truncate)
|
||||||
{
|
{
|
||||||
SetRemovedMessage(addresses.Count);
|
SetRemovedMessage(addresses.Count);
|
||||||
_searches.RemoveRange(addresses);
|
_searches.RemoveSmallWatchRange(watchList);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -867,7 +867,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (GlobalWin.Tools.Has<RamWatch>())
|
if (GlobalWin.Tools.Has<RamWatch>())
|
||||||
{
|
{
|
||||||
_searches.RemoveRange(GlobalWin.Tools.RamWatch.AddressList);
|
_searches.RemoveSmallWatchRange(GlobalWin.Tools.RamWatch.Watches);
|
||||||
WatchListView.ItemCount = _searches.Count;
|
WatchListView.ItemCount = _searches.Count;
|
||||||
SetTotal();
|
SetTotal();
|
||||||
}
|
}
|
||||||
|
@ -1479,7 +1479,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
SetRemovedMessage(outOfRangeAddresses.Count);
|
SetRemovedMessage(outOfRangeAddresses.Count);
|
||||||
|
|
||||||
_searches.RemoveRange(outOfRangeAddresses);
|
//_searches.RemoveRange(outOfRangeAddresses); Remove TODO
|
||||||
|
|
||||||
WatchListView.ItemCount = _searches.Count;
|
WatchListView.ItemCount = _searches.Count;
|
||||||
SetTotal();
|
SetTotal();
|
||||||
|
|
|
@ -73,11 +73,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
public IEnumerable<int> AddressList
|
public IEnumerable<Watch> Watches
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _watches.Where(x => !x.IsSeparator).Select(x => x.Address ?? 0);
|
return _watches.Where(x => !x.IsSeparator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue