Example #1
0
        public static INVBase NVBaseObject(string url)
        {
            DllPlusInfo pe  = null /* TODO Change to default(_) if this is not a reference type */;
            INVBase     obj = null /* TODO Change to default(_) if this is not a reference type */;

            if (string.IsNullOrEmpty(url))
            {
                return(obj);
            }
            string reg = @"(\w+\.){2}\w+";
            Match  m   = Regex.Match(url, reg);

            if (m.Success)
            {
                var pl = (from p in NVHelper.DllPlusList
                          where p.WebName == m.Value
                          select p);
                if (pl.Count() > 0)
                {
                    if (pl.Count() == 1)
                    {
                        pe = pl.FirstOrDefault();
                    }
                    else
                    {
                    }
                }
                if (pe != null)
                {
                    obj = (INVBase)GetInstance(pe.Type);
                }
            }
            return(obj);
        }
Example #2
0
 /// <summary>
 /// 获取插件信息
 /// </summary>
 /// <param name="filePath"></param>
 public static void LoadDllPlusInfo(string filePath)
 {
     if (File.Exists(filePath))
     {
         Assembly ably  = Assembly.LoadFile(filePath);
         Type[]   types = ably.GetTypes();
         foreach (var t in types)
         {
             if (t.IsClass && typeof(BaseLibrary.INVBase).IsAssignableFrom(t))
             {
                 BaseLibrary.INVBase obj = (BaseLibrary.INVBase)Activator.CreateInstance(t);
                 DllPlusInfo         pb  = new DllPlusInfo()
                 {
                     WebName = obj.GetWebName(), Type = t
                 };
                 _dllPlusList.Add(pb);
             }
         }
     }
 }