Ejemplo n.º 1
0
 public static List <DllInfo> DllPaths()
 {
     if (AllDllInfo == null || AllDllInfo.Count == 0)
     {
         var rs = new List <DllInfo>();
         foreach (var r in System.Configuration.ConfigurationManager.AppSettings.AllKeys)
         {
             if (r.Contains("DllPath"))
             {
                 var dllinfo = new DllInfo(System.Configuration.ConfigurationManager.AppSettings[r] as string);
                 rs.Add(dllinfo);
             }
         }
         AllDllInfo = rs;
     }
     return(AllDllInfo);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 反射加载程序集
        /// </summary>
        public static List <Api> GetApis(DllInfo info)
        {
            var assembly = Assembly.LoadFrom(info.Path);
            var rs       = new List <Api>();

            foreach (var t in (assembly.GetTypes()))
            {
                foreach (var m in t.GetMethods())
                {
                    var find = GetOpenApiAttribute(m);
                    if (find != null)
                    {
                        rs.Add(new Api()
                        {
                            Method = m, OpenDll = info, ID = Guid.NewGuid().ToString()
                        });
                    }
                }
            }
            return(rs);
        }