Use RemoveAll where possible
This commit is contained in:
parent
6abcf7953c
commit
c847b8cdba
|
@ -89,17 +89,9 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
if (!Frozen)
|
if (!Frozen)
|
||||||
{
|
{
|
||||||
var removed = false;
|
var oldCount = recentlist.Count;
|
||||||
foreach (var recent in recentlist)
|
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;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -104,19 +104,7 @@ namespace BizHawk.Client.Common
|
||||||
List<PathEntry> entriesToRemove = new List<PathEntry>();
|
List<PathEntry> entriesToRemove = new List<PathEntry>();
|
||||||
|
|
||||||
// Remove entries that no longer exist in defaults
|
// Remove entries that no longer exist in defaults
|
||||||
foreach (PathEntry pathEntry in Paths)
|
Paths.RemoveAll(path => DefaultValues.All(p => p.System != path.System || p.Type != path.Type));
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add missing displaynames
|
// Add missing displaynames
|
||||||
foreach (var path in Paths.Where(p => p.SystemDisplayName == null))
|
foreach (var path in Paths.Where(p => p.SystemDisplayName == null))
|
||||||
|
|
|
@ -149,10 +149,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (control.Handle == ptr)
|
if (control.Handle == ptr)
|
||||||
{
|
{
|
||||||
foreach (var luaEvent in form.ControlEvents.Where(x => x.Control == ptr))
|
form.ControlEvents.RemoveAll(x => x.Control == ptr);
|
||||||
{
|
|
||||||
form.ControlEvents.Remove(luaEvent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void RamPoke_Load(object sender, EventArgs e)
|
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)
|
if (_watchList.Count == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,13 +90,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
||||||
|
|
||||||
public void DisableSource(ISoundProvider source)
|
public void DisableSource(ISoundProvider source)
|
||||||
{
|
{
|
||||||
var sp = SoundProviders.Where(a => a.SoundProvider == source);
|
SoundProviders.RemoveAll(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);
|
|
||||||
|
|
||||||
EqualizeVolumes();
|
EqualizeVolumes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,13 +90,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||||
|
|
||||||
public void DisableSource(ISoundProvider source)
|
public void DisableSource(ISoundProvider source)
|
||||||
{
|
{
|
||||||
var sp = SoundProviders.Where(a => a.SoundProvider == source);
|
SoundProviders.RemoveAll(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);
|
|
||||||
|
|
||||||
EqualizeVolumes();
|
EqualizeVolumes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue