Replacing 'Assembly.GetExecutingAssembly()' with 'Type.Assembly' (#5545)

This commit is contained in:
Marco Carvalho 2023-09-07 09:10:58 -03:00 committed by GitHub
parent ddb6493896
commit 210f475484
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 9 deletions

View file

@ -23,14 +23,14 @@ namespace Ryujinx.HLE.HOS.Services
public IpcService(ServerBase server = null)
{
CmifCommands = Assembly.GetExecutingAssembly().GetTypes()
CmifCommands = typeof(IpcService).Assembly.GetTypes()
.Where(type => type == GetType())
.SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public))
.SelectMany(methodInfo => methodInfo.GetCustomAttributes(typeof(CommandCmifAttribute))
.Select(command => (((CommandCmifAttribute)command).Id, methodInfo)))
.ToDictionary(command => command.Id, command => command.methodInfo);
TipcCommands = Assembly.GetExecutingAssembly().GetTypes()
TipcCommands = typeof(IpcService).Assembly.GetTypes()
.Where(type => type == GetType())
.SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public))
.SelectMany(methodInfo => methodInfo.GetCustomAttributes(typeof(CommandTipcAttribute))

View file

@ -28,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Sm
static IUserInterface()
{
_services = Assembly.GetExecutingAssembly().GetTypes()
_services = typeof(IUserInterface).Assembly.GetTypes()
.SelectMany(type => type.GetCustomAttributes(typeof(ServiceAttribute), true)
.Select(service => (((ServiceAttribute)service).Name, type)))
.ToDictionary(service => service.Name, service => service.type);