public void LoadDetour(MethodInfo method) { // Setup variables DetourAttribute attribute = (DetourAttribute)Attribute.GetCustomAttribute(method, typeof(DetourAttribute)); // Do checks if (attribute == null) { return; } if (!attribute.MethodFound) { return; } if (Detours.Count(a => a.Key.Method == attribute.Method) > 0) { return; } try { DetourWrapper wrapper = new DetourWrapper(attribute.Method, method, attribute); wrapper.Detour(); Detours.Add(attribute, wrapper); } catch (Exception ex) { PointBlankLogging.LogError("Error detouring: " + method.Name, ex); } }