private List <AppService> GetAppComponentService(String path, String file, String targetDic) { List <AppService> list = new List <AppService>(); ZipFile.ExtractToDirectory(file, path); List <String> fileList = Directory.GetFiles(path + @"\" + targetDic).ToList(); String controllFile = fileList.ToList().FindLast(f => f.Contains("Controller.dll")); if (String.IsNullOrEmpty(controllFile)) { return(list); } Assembly assembly = Assembly.LoadFrom(controllFile); List <Type> typeList = assembly.GetTypes().ToList(); typeList.ForEach(t => { AppService appService = new AppService() { AppFunctions = new List <AppFunction>() }; list.Add(appService); if (t.Name.Contains("Controller")) { appService.Name = t.Name; appService.Title = t.Name; t.GetMethods().ToList().ForEach(m => { DescAttribute desc = m.GetCustomAttribute(typeof(DescAttribute)) as DescAttribute; if (desc != null) { appService.AppFunctions.Add(new AppFunction() { Title = desc.Title, FunctionName = m.Name, PathName = m.Name.ToLower() }); } }); } }); return(list); }
static public string getFieldDesc(FieldInfo t) { string desc = ""; object[] descAttrs = t.GetCustomAttributes(gDescAttributeType, false); if (descAttrs != null) { foreach (var attr in descAttrs) { DescAttribute descAttr = attr as DescAttribute; desc += descAttr.description; } } if (string.IsNullOrEmpty(desc)) { desc = t.Name; } return(desc); }