public List <HelpTopicAttribute> GetHelpTopics(PluginBaseController controller) { if (dic.ContainsKey(controller.GetType())) { return(dic[controller.GetType()]); } var _helpTopics = Build(controller); dic.TryAdd(controller.GetType(), _helpTopics); return(_helpTopics); }
public static List <HelpTopicAttribute> Build(PluginBaseController controller) { var ret = new List <HelpTopicAttribute>(); var conrollerType = controller.GetType(); var att = conrollerType.GetCustomAttribute(typeof(HelpTopicAttribute)); if (att is HelpTopicAttribute conthelpAtt) { //controller class has the suffix "Controller", so we remove this to get the controller actual name. if (conthelpAtt.Title.Contains("[Controller]")) { conthelpAtt.Title = conrollerType.Name.Replace("Controller", ""); } conthelpAtt.ID = conrollerType.FullName; ret.Add(conthelpAtt); BuildControllerParts(conthelpAtt, conrollerType, ret); } return(ret); }