예제 #1
0
        private void AddAssemblyUnsafe(Broker b, AssemblyVersionPackage a)
        {
            Assembly assembly = null;

            if (a.Version.FileSymbols != null)
            {
                assembly = Assembly.Load(a.ExtractLibrary(), a.ExtractLibrarySymbols());
            }
            else
            {
                assembly = Assembly.Load(a.ExtractLibrary());
            }

            string       assemblyName = assembly.GetName().Name;
            AssemblyCard card         = new AssemblyCard()
            {
                assembly     = assembly,
                AssemblyName = assemblyName
            };
            var type  = typeof(IMod);
            var types = assembly.GetTypes().Where(p => type.IsAssignableFrom(p) && !p.IsInterface);

            foreach (Type item in types)
            {
                b.Modules.RegisterInterface(item, assemblyName);
                b.RegisterSelfValuedModule(item);
            }
            card.Interfaces = (from t in types
                               select t.FullName).ToArray();

            loadedAssemblys.Add(assemblyName, card);
        }
예제 #2
0
        private void AddAssemblyUnsafe(Broker b, AssemblyVersionPackage a)
        {
            Assembly assembly = null;
            if (a.Version.FileSymbols != null)
                assembly = Assembly.Load(a.ExtractLibrary(), a.ExtractLibrarySymbols());
            else assembly = Assembly.Load(a.ExtractLibrary());

            string assemblyName = assembly.GetName().Name;
            AssemblyCard card = new AssemblyCard()
            {
                assembly = assembly,
                AssemblyName = assemblyName
            };
            var type = typeof(IMod);
            var types = assembly.GetTypes().Where(p => type.IsAssignableFrom(p) && !p.IsInterface);

            foreach (Type item in types)
            {
                b.Modules.RegisterInterface(item, assemblyName);
                b.RegisterSelfValuedModule(item);
            }
            card.Interfaces = (from t in types
                               select t.FullName).ToArray();

            loadedAssemblys.Add(assemblyName, card);
        }