Ejemplo n.º 1
0
 private void SetAssamblyInitialization()
 {
     AssamblyList.ToList().ForEach(
         a =>
     {
         InitializationAttribute attribute =
             (InitializationAttribute)Attribute.GetCustomAttribute(a.Value, typeof(InitializationAttribute));
         if (attribute != null)
         {
             AssamblyInitialization.Add(a.Key, attribute);
         }
     }
         );
 }
Ejemplo n.º 2
0
        private void GetByDomin()
        {
            // Dictionary<string, Assembly> loaded = new Dictionary<string, Assembly>();
            AppDomain domain = AppDomain.CurrentDomain;

            Assembly[] assemblies = domain.GetAssemblies();

            foreach (Assembly ass in assemblies)
            {
                string name = ass.FullName;
                if (!AssamblyList.ContainsKey(name))
                {
                    AssamblyList.Add(name, ass);
                }
            }
        }
Ejemplo n.º 3
0
 private void RegistIoc()
 {
     AssamblyList.ToList().ForEach(
         a =>
     {
         Assembly list = AssamblyList[a.Key];
         var types     = list.GetTypes();
         foreach (var t in types)
         {
             // Type baseType = t.BaseType;
             var code = Attribute.GetCustomAttribute(t, typeof(CodePlugAttribute)) as CodePlugAttribute;
             if (code != null)
             {
                 // AtawIocContext.Current.PlugInModelList[];
                 AtawIocContext.Current.RegisterPlugIn(t, code);
             }
         }
     }
         );
 }
Ejemplo n.º 4
0
 public void GetByCodePath()
 {
     string[] files = Directory.GetFiles(CodePath, "*.dll", SearchOption.TopDirectoryOnly);
     foreach (string file in files)
     {
         AssemblyName assemblyName;
         assemblyName = AssemblyName.GetAssemblyName(file);
         Assembly assembly;
         string   name = assemblyName.FullName;
         if (AssamblyList.ContainsKey(name))
         {
             assembly = AssamblyList[name];
         }
         else
         {
             assembly = Assembly.Load(assemblyName);
             AssamblyList.Add(name, assembly);
         }
     }
 }