public ActiveXServers(ActiveXServerContext context)
        {
            try
            {
                _context = context;

                string extensionLocation = ConfigurationManager.AppSettings["ActiveXServerPlugins:Location"];
                //// An aggregate catalog that combines multiple catalogs
                var catalog = new AggregateCatalog();
                //catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
                catalog.Catalogs.Add(new DirectoryCatalog(extensionLocation));
                //// Create the CompositionContainer with the parts in the catalog
                this._container = new CompositionContainer(catalog, true);
                //// Fill the imports of this object
                try
                {
                    this._container.ComposeParts(this);
                }
                catch (CompositionException)
                {
                    throw;
                }
            }
            catch (ConfigurationErrorsException)
            {
                throw;
            }
        }
示例#2
0
        static void Main(string[] cmdLine)
        {
            ActiveXServerContext activeXContext = new ActiveXServerContext();

            if (cmdLine != null && cmdLine.Length > 0)
            {
                bool isRegister = false;
                //Condition Order is important
                if (cmdLine.Contains("/unregserver") || (isRegister = cmdLine.Contains("/regserver")))
                {
                    activeXContext.RegisterPlugins(!isRegister);
                    return;
                }
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            activeXContext.Run();
        }