Ejemplo n.º 1
0
        public void Rescan()
        {
            var dir = Util.GetSampleDirectory("ScanDataFilesTest");

            // Generate the scan data files before initializing the engine
            var registry = GetRegistry(dir);

            registry.GenerateAddinScanDataFiles(new ConsoleProgressStatus(true), recursive: true);
            registry.Dispose();

            AddinEngine engine = new AddinEngine();

            engine.Initialize(Path.Combine(dir, "Config"), Path.Combine(dir, "UserAddins"), null, Path.Combine(dir, "App"));
            registry = engine.Registry;

            registry.Update(new ConsoleProgressStatus(false));

            engine.LoadAddin(null, "SimpleApp.Core,0.1.0");
            engine.LoadAddin(null, "SimpleApp.Ext2,0.1.0");

            File.Delete(Path.Combine(dir, "UserAddins", "SimpleAddin4.addin.xml"));

            registry.Update(new ConsoleProgressStatus(false));

            engine.Shutdown();
        }
Ejemplo n.º 2
0
        static void DoInitialize()
        {
            //var trustLevel = WebHelper.GetTrustLevel();

            if (_addinEngine != null)
            {
                return;
            }

            var fileSettings = new AddinFileSettings(AddinFileSettings.DefaultAddinDataDirectory, new[] { "bin" }, new[] { AddinFileSettings.DefaultAddinProbingDirectory });
            var addinOptions = AddinOptions.Create().WithAssemblyLoadPolicy(new MvcAssemblyLoadPolicy()).WithFileSettings(fileSettings);

            _addinEngine = new AddinEngine(addinOptions);

            _addinEngine.Initialize(true);

            var addins = _addinEngine.GetAllAddins();

            foreach (var addin in addins)
            {
                PrepareAddin(addin);
            }

            _addinEngine.Start();

            //addins = _addinEngine.GetStartedAddins();
            ////var probingPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;
            //foreach (var addin in addins)
            //{
            //    //probingPath += addin.File.BaseDirectory + ";";
            //    //var asms = addin.Runtime.LoadAssemblies();
            //    //foreach (var asm in asms)
            //    //    BuildManagerHelper.AddReferencedAssemblyNormally(asm);
            //}
            ////AppDomain.CurrentDomain.SetupInformation.PrivateBinPath = probingPath;

            //var menustrip = new MvcMenuStrip();
            //_addinEngine.LoadExtensionPoint(menustrip);
            //_addinEngine.Framework.SetProperty("MvcMenuStrip", menustrip);
        }