Enable MA0029 and fix noncompliance
"Combine LINQ methods"
This commit is contained in:
parent
26b6a1c4a9
commit
b1ad34839a
|
@ -198,7 +198,7 @@
|
||||||
<Rule Id="MA0028" Action="Hidden" />
|
<Rule Id="MA0028" Action="Hidden" />
|
||||||
|
|
||||||
<!-- Combine LINQ methods -->
|
<!-- Combine LINQ methods -->
|
||||||
<Rule Id="MA0029" Action="Hidden" />
|
<Rule Id="MA0029" Action="Error" />
|
||||||
|
|
||||||
<!-- Remove useless OrderBy call -->
|
<!-- Remove useless OrderBy call -->
|
||||||
<Rule Id="MA0030" Action="Error" />
|
<Rule Id="MA0030" Action="Error" />
|
||||||
|
|
|
@ -153,19 +153,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
ret.Nodes.Add(serviceNode);
|
ret.Nodes.Add(serviceNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var service in Emulation.Common.ReflectionCache.Types.Where(t => t.IsInterface
|
||||||
var knownServices = Emulation.Common.ReflectionCache.Types
|
&& typeof(IEmulatorService).IsAssignableFrom(t) && !typeof(ISpecializedEmulatorService).IsAssignableFrom(t) // don't show ISpecializedEmulatorService subinterfaces as "missing" as there's no expectation that they'll be implemented eventually
|
||||||
.Where(t => typeof(IEmulatorService).IsAssignableFrom(t))
|
&& t != typeof(IEmulatorService) && t != typeof(ITextStatable) // denylisting ITextStatable is a hack for now, eventually we can get merge it into IStatable w/ default interface methods
|
||||||
.Where(t => t != typeof(IEmulatorService))
|
&& !ci.Services.ContainsKey(t.ToString()) && !ci.NotApplicableTypes.Contains(t.ToString())))
|
||||||
.Where(t => t != typeof(ITextStatable)) // Hack for now, eventually we can get rid of this interface in favor of a default implementation
|
|
||||||
.Where(t => t.IsInterface);
|
|
||||||
|
|
||||||
var additionalServices = knownServices
|
|
||||||
.Where(t => !ci.Services.ContainsKey(t.ToString()))
|
|
||||||
.Where(t => !ci.NotApplicableTypes.Contains(t.ToString()))
|
|
||||||
.Where(t => !typeof(ISpecializedEmulatorService).IsAssignableFrom(t)); // We don't want to show these as unimplemented, they aren't expected services
|
|
||||||
|
|
||||||
foreach (Type service in additionalServices)
|
|
||||||
{
|
{
|
||||||
string img = "Bad";
|
string img = "Bad";
|
||||||
var serviceNode = new TreeNode
|
var serviceNode = new TreeNode
|
||||||
|
|
|
@ -33,8 +33,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
visibleColumns = _columns.VisibleColumns
|
visibleColumns = _columns.VisibleColumns
|
||||||
.Where(c => c.Right > _hBar.Value)
|
.Where(c => c.Right > _hBar.Value && c.Left - _hBar.Value < e.ClipRectangle.Width)
|
||||||
.Where(c => c.Left - _hBar.Value < e.ClipRectangle.Width)
|
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2070,8 +2070,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly IList<Type> SpecializedTools = ReflectionCache.Types
|
private static readonly IList<Type> SpecializedTools = ReflectionCache.Types
|
||||||
.Where(t => typeof(IToolForm).IsAssignableFrom(t) && !t.IsAbstract)
|
.Where(static t => !t.IsAbstract && typeof(IToolForm).IsAssignableFrom(t)
|
||||||
.Where(t => t.GetCustomAttribute<SpecializedToolAttribute>() != null)
|
&& t.GetCustomAttribute<SpecializedToolAttribute>() is not null)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
private ISet<char> _availableAccelerators;
|
private ISet<char> _availableAccelerators;
|
||||||
|
|
|
@ -1218,8 +1218,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
ColumnsSubMenu.DropDownItems.Clear();
|
ColumnsSubMenu.DropDownItems.Clear();
|
||||||
|
|
||||||
var columns = TasView.AllColumns
|
var columns = TasView.AllColumns
|
||||||
.Where(c => !string.IsNullOrWhiteSpace(c.Text))
|
.Where(static c => !string.IsNullOrWhiteSpace(c.Text) && c.Name is not "FrameColumn")
|
||||||
.Where(c => c.Name != "FrameColumn")
|
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
int workingHeight = Screen.FromControl(this).WorkingArea.Height;
|
int workingHeight = Screen.FromControl(this).WorkingArea.Height;
|
||||||
|
|
|
@ -45,11 +45,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
ToolBoxStrip.Items.Clear();
|
ToolBoxStrip.Items.Clear();
|
||||||
|
|
||||||
var tools = EmuHawk.ReflectionCache.Types
|
var tools = EmuHawk.ReflectionCache.Types
|
||||||
.Where(t => typeof(IToolForm).IsAssignableFrom(t))
|
.Where(t => typeof(IToolForm).IsAssignableFrom(t) && typeof(Form).IsAssignableFrom(t)
|
||||||
.Where(t => typeof(Form).IsAssignableFrom(t))
|
&& !typeof(ToolBox).IsAssignableFrom(t)
|
||||||
.Where(t => !typeof(ToolBox).IsAssignableFrom(t))
|
&& ServiceInjector.IsAvailable(Emulator.ServiceProvider, t)
|
||||||
.Where(t => ServiceInjector.IsAvailable(Emulator.ServiceProvider, t))
|
&& (VersionInfo.DeveloperBuild || !t.GetCustomAttributes(false).OfType<ToolAttribute>().Any(static a => !a.Released)));
|
||||||
.Where(t => VersionInfo.DeveloperBuild || !t.GetCustomAttributes(false).OfType<ToolAttribute>().Any(a => !a.Released));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for (int i = 0; i < tools.Count(); i++)
|
for (int i = 0; i < tools.Count(); i++)
|
||||||
|
|
|
@ -490,9 +490,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Type> AvailableTools => EmuHawk.ReflectionCache.Types
|
public IEnumerable<Type> AvailableTools => EmuHawk.ReflectionCache.Types
|
||||||
.Where(t => typeof(IToolForm).IsAssignableFrom(t))
|
.Where(t => !t.IsInterface && typeof(IToolForm).IsAssignableFrom(t) && IsAvailable(t));
|
||||||
.Where(t => !t.IsInterface)
|
|
||||||
.Where(IsAvailable);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calls UpdateValues() on an instance of T, if it exists
|
/// Calls UpdateValues() on an instance of T, if it exists
|
||||||
|
|
|
@ -570,7 +570,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorIconButton.Visible = _watches.Where(watch => !watch.IsSeparator).Any(watch => !watch.IsValid);
|
ErrorIconButton.Visible = _watches.Any(static watch => !watch.IsSeparator && !watch.IsValid);
|
||||||
|
|
||||||
MessageLabel.Text = message;
|
MessageLabel.Text = message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,8 @@ namespace BizHawk.Emulation.Common
|
||||||
// this also fully allows services that are not IEmulatorService
|
// this also fully allows services that are not IEmulatorService
|
||||||
Type coreType = core.GetType();
|
Type coreType = core.GetType();
|
||||||
|
|
||||||
var services = coreType.GetInterfaces()
|
foreach (var service in coreType.GetInterfaces().Where(static t => typeof(IEmulatorService).IsAssignableFrom(t)
|
||||||
.Where(t => typeof(IEmulatorService).IsAssignableFrom(t))
|
&& t != typeof(IEmulatorService) && t != typeof(ISpecializedEmulatorService)))
|
||||||
.Where(t => t != typeof(IEmulatorService) && t != typeof(ISpecializedEmulatorService));
|
|
||||||
|
|
||||||
foreach (Type service in services)
|
|
||||||
{
|
{
|
||||||
_services.Add(service, core);
|
_services.Add(service, core);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,9 +69,7 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
var memoryDomains = _memoryAreas.Select(a => WaterboxMemoryDomain.Create(a, _exe)).ToList();
|
var memoryDomains = _memoryAreas.Select(a => WaterboxMemoryDomain.Create(a, _exe)).ToList();
|
||||||
var primaryDomain = memoryDomains
|
var primaryDomain = memoryDomains.Single(static md => md.Definition.Flags.HasFlag(LibWaterboxCore.MemoryDomainFlags.Primary));
|
||||||
.Where(md => md.Definition.Flags.HasFlag(LibWaterboxCore.MemoryDomainFlags.Primary))
|
|
||||||
.Single();
|
|
||||||
|
|
||||||
var mdl = new MemoryDomainList(
|
var mdl = new MemoryDomainList(
|
||||||
memoryDomains.Cast<MemoryDomain>()
|
memoryDomains.Cast<MemoryDomain>()
|
||||||
|
|
Loading…
Reference in New Issue