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:
RoosterDragon
2022-04-04 16:08:55 +01:00
committed by abcdefg30
parent b254eb0f3d
commit ac0969d688
8 changed files with 9 additions and 9 deletions

View File

@@ -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();