From c8a0ddb6d3d4a12184f4dab3616cdf85d93f435d Mon Sep 17 00:00:00 2001 From: MichalPetryka <35800402+MichalPetryka@users.noreply.github.com> Date: Wed, 2 Jan 2019 19:19:24 +0100 Subject: [PATCH] Weaver - first switch (#224) --- Mirror/Weaver/Weaver.cs | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/Mirror/Weaver/Weaver.cs b/Mirror/Weaver/Weaver.cs index 2d0cc0588..2ca474fbe 100644 --- a/Mirror/Weaver/Weaver.cs +++ b/Mirror/Weaver/Weaver.cs @@ -909,21 +909,20 @@ static void ProcessSiteMethod(ModuleDefinition moduleDef, TypeDefinition td, Met { foreach (CustomAttribute attr in md.CustomAttributes) { - if (attr.Constructor.DeclaringType.ToString() == "Mirror.ServerAttribute") + switch (attr.Constructor.DeclaringType.ToString()) { - InjectServerGuard(moduleDef, td, md, true); - } - else if (attr.Constructor.DeclaringType.ToString() == "Mirror.ServerCallbackAttribute") - { - InjectServerGuard(moduleDef, td, md, false); - } - else if (attr.Constructor.DeclaringType.ToString() == "Mirror.ClientAttribute") - { - InjectClientGuard(moduleDef, td, md, true); - } - else if (attr.Constructor.DeclaringType.ToString() == "Mirror.ClientCallbackAttribute") - { - InjectClientGuard(moduleDef, td, md, false); + case "Mirror.ServerAttribute": + InjectServerGuard(moduleDef, td, md, true); + break; + case "Mirror.ServerCallbackAttribute": + InjectServerGuard(moduleDef, td, md, false); + break; + case "Mirror.ClientAttribute": + InjectClientGuard(moduleDef, td, md, true); + break; + case "Mirror.ClientCallbackAttribute": + InjectClientGuard(moduleDef, td, md, false); + break; } }