Use RemoveAll where possible
This commit is contained in:
parent
6abcf7953c
commit
c847b8cdba
|
@ -89,17 +89,9 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
if (!Frozen)
|
||||
{
|
||||
var removed = false;
|
||||
foreach (var recent in recentlist)
|
||||
{
|
||||
if (string.Compare(newFile, recent, StringComparison.CurrentCultureIgnoreCase) == 0)
|
||||
{
|
||||
recentlist.Remove(newFile); // intentionally keeps iterating after this to remove duplicate instances, though those should never exist in the first place
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return removed;
|
||||
var oldCount = recentlist.Count;
|
||||
recentlist.RemoveAll(recent => string.Equals(newFile, recent, StringComparison.CurrentCultureIgnoreCase)); // removes duplicate instances, though those should never exist in the first place
|
||||
return recentlist.Count != oldCount;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -104,19 +104,7 @@ namespace BizHawk.Client.Common
|
|||
List<PathEntry> entriesToRemove = new List<PathEntry>();
|
||||
|
||||
// Remove entries that no longer exist in defaults
|
||||
foreach (PathEntry pathEntry in Paths)
|
||||
{
|
||||
var path = DefaultValues.FirstOrDefault(p => p.System == pathEntry.System && p.Type == pathEntry.Type);
|
||||
if (path == null)
|
||||
{
|
||||
entriesToRemove.Add(pathEntry);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PathEntry entry in entriesToRemove)
|
||||
{
|
||||
Paths.Remove(entry);
|
||||
}
|
||||
Paths.RemoveAll(path => DefaultValues.All(p => p.System != path.System || p.Type != path.Type));
|
||||
|
||||
// Add missing displaynames
|
||||
foreach (var path in Paths.Where(p => p.SystemDisplayName == null))
|
||||
|
|
|
@ -149,10 +149,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (control.Handle == ptr)
|
||||
{
|
||||
foreach (var luaEvent in form.ControlEvents.Where(x => x.Control == ptr))
|
||||
{
|
||||
form.ControlEvents.Remove(luaEvent);
|
||||
}
|
||||
form.ControlEvents.RemoveAll(x => x.Control == ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void RamPoke_Load(object sender, EventArgs e)
|
||||
{
|
||||
_watchList = _watchList.Where(x => !x.IsSeparator).ToList(); // Weed out separators just in case
|
||||
_watchList.RemoveAll(x => x.IsSeparator); // just in case
|
||||
|
||||
if (_watchList.Count == 0)
|
||||
{
|
||||
|
|
|
@ -90,13 +90,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
|
||||
public void DisableSource(ISoundProvider source)
|
||||
{
|
||||
var sp = SoundProviders.Where(a => a.SoundProvider == source);
|
||||
if (sp.Count() == 1)
|
||||
SoundProviders.Remove(sp.First());
|
||||
else if (sp.Count() > 1)
|
||||
foreach (var s in sp)
|
||||
SoundProviders.Remove(s);
|
||||
|
||||
SoundProviders.RemoveAll(a => a.SoundProvider == source);
|
||||
EqualizeVolumes();
|
||||
}
|
||||
|
||||
|
|
|
@ -90,13 +90,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
|
||||
public void DisableSource(ISoundProvider source)
|
||||
{
|
||||
var sp = SoundProviders.Where(a => a.SoundProvider == source);
|
||||
if (sp.Count() == 1)
|
||||
SoundProviders.Remove(sp.First());
|
||||
else if (sp.Count() > 1)
|
||||
foreach (var s in sp)
|
||||
SoundProviders.Remove(s);
|
||||
|
||||
SoundProviders.RemoveAll(a => a.SoundProvider == source);
|
||||
EqualizeVolumes();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue