#nullable disable using System; using System.Reflection; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Controllers; namespace StardewModdingAPI.Web.Framework { /// Discovers controllers with support for non-public controllers. internal class InternalControllerFeatureProvider : ControllerFeatureProvider { /********* ** Public methods *********/ /// Determines if a given type is a controller. /// The candidate. /// true if the type is a controller; otherwise false. protected override bool IsController(TypeInfo type) { return type.IsClass && !type.IsAbstract && (/*type.IsPublic &&*/ !type.ContainsGenericParameters) && (!type.IsDefined(typeof(NonControllerAttribute)) && (type.Name.EndsWith("Controller", StringComparison.OrdinalIgnoreCase) || type.IsDefined(typeof(ControllerAttribute)))); } } }