Пример #1
0
        string GetAddinsAndExtensionPoints()
        {
            var addins = _addinEngine.GetAllAddins();

            var info = string.Empty;

            foreach (var addin in addins)
            {
                info += Environment.NewLine + "## Addin: " + addin.Header.AddinId.Guid
                        + "   [" + (addin.Header.Name == null
                            ? string.Empty
                            : addin.Header.Name) + "}"
                        + Environment.NewLine;
                info += "Status: " + addin.Enabled + "\tStarted: " + addin.Started + Environment.NewLine;

                var epDescs = addin.Extension.GetExtensionPointDescriptions();
                if (epDescs != null)
                {
                    info += "=======================================" + Environment.NewLine;
                    foreach (var epDesc in epDescs)
                    {
                        info += "@@ ExtensionPoint: " + epDesc.Name + "\tLoaded: " + epDesc.Loaded + "\tTypeName: " + epDesc.TypeName + Environment.NewLine;
                    }
                }
            }

            return(info);
        }
Пример #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);
        }