Use nameof instead of hardcoded strings in reflection calls.
This helps improve the safety of code the uses reflection when methods may get renamed, and helps navigating code as the nameof will show up when searching for references to members.
This commit is contained in:
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common
|
||||
|
||||
// HACK: We need to set HasRegisteredUriScheme to bypass the check that is done when calling SetPresence with a joinSecret.
|
||||
// DiscordRpc lib expect us to register uri handlers with RegisterUriScheme(), we are doing it ourselves in our installers/launchers.
|
||||
client.GetType().GetProperty("HasRegisteredUriScheme").SetValue(client, true);
|
||||
client.GetType().GetProperty(nameof(DiscordRpcClient.HasRegisteredUriScheme)).SetValue(client, true);
|
||||
|
||||
client.SetSubscription(EventType.Join | EventType.JoinRequest);
|
||||
client.Initialize();
|
||||
|
||||
Reference in New Issue
Block a user