Sort services by name in `Help` > `Features...`
This commit is contained in:
parent
ab587289a8
commit
0e3d786c70
|
@ -5,6 +5,7 @@ using System.Windows.Forms;
|
|||
using System.Reflection;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Common.CollectionExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores;
|
||||
|
||||
|
@ -24,27 +25,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
CoreName = emu.Attributes().CoreName;
|
||||
Released = emu.Attributes().Released;
|
||||
Services = new Dictionary<string, ServiceInfo>();
|
||||
var ser = emu.ServiceProvider;
|
||||
foreach (Type t in ser.AvailableServices.Where(type => type != emu.GetType()))
|
||||
{
|
||||
var si = new ServiceInfo(t, ser.GetService(t));
|
||||
Services.Add(si.TypeName, si);
|
||||
}
|
||||
|
||||
Services = ser.AvailableServices.Except([ emu.GetType() ])
|
||||
.Select(t => new ServiceInfo(t, ser.GetService(t)))
|
||||
.OrderBy(si => si.TypeName)
|
||||
.ToDictionary(static si => si.TypeName);
|
||||
var notApplicableAttribute = ((ServiceNotApplicableAttribute)Attribute
|
||||
.GetCustomAttribute(emu.GetType(), typeof(ServiceNotApplicableAttribute)));
|
||||
|
||||
if (notApplicableAttribute != null)
|
||||
{
|
||||
NotApplicableTypes = notApplicableAttribute.NotApplicableTypes
|
||||
.Select(x => x.ToString())
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
NotApplicableTypes = new List<string>();
|
||||
}
|
||||
NotApplicableTypes = (notApplicableAttribute?.NotApplicableTypes ?? [ ])
|
||||
.Select(static x => x.ToString()).Order().ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue