Beispiel #1
0
        /// <summary>
        /// Creates the presto instance housed in assembly with the given name.
        /// </summary>
        /// <param name="assemblyName">The full name of the assembly that the Presto object resides in.</param>
        private void createPrestoInstance(string assemblyName)
        {
            //do not create an instance if one already exists
            if (moduleInstance != null)
            {
                return;
            }

            Assembly assembly = assemblies[assemblyName];

            //get all types housed in the assembly
            Type[] assemblyTypes = assembly.GetTypes();
            //create an instance of the PrestoModule
            PrestoModule module = null;

            foreach (Type type in assemblyTypes)
            {
                if (type.IsSubclassOf(typeof(PrestoModule)))
                {
                    module = (PrestoModule)Activator.CreateInstance(type);
                    module.Init();
                    break;
                }
            }
            moduleInstance = module;
        }
Beispiel #2
0
        /// <summary>
        /// Creates the presto instance housed in assembly with the given name.
        /// </summary>
        /// <param name="assemblyName">The full name of the assembly that the Presto object resides in.</param>
        private void createPrestoInstance(string assemblyName)
        {
            //do not create an instance if one already exists
            if (moduleInstance != null)
            {
                return;
            }

            Assembly assembly = assemblies[assemblyName];
            //get all types housed in the assembly
            Type[] assemblyTypes = assembly.GetTypes();
            //create an instance of the PrestoModule
            PrestoModule module = null;
            foreach (Type type in assemblyTypes) {
                if (type.IsSubclassOf(typeof(PrestoModule))) {
                    module = (PrestoModule)Activator.CreateInstance(type);
                    module.Init();
                    break;
                }
            }
            moduleInstance = module;
        }