Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            // Set the add-ins discovery root directory to be the current directory
            string addinRoot = Environment.CurrentDirectory;

            // Rebuild the add-ins cache and pipeline components cache.
            AddInStore.Rebuild(addinRoot);

            // Get registerd add-ins of type SimpleAddInHostView
            Collection <AddInToken> addins = AddInStore.FindAddIns(typeof(SayHelloHostView), addinRoot);

            Console.WriteLine("Main AppDomain: " + AppDomain.CurrentDomain.FriendlyName);

            AddInProcess process = new AddInProcess();

            process.Start();

            Console.WriteLine("External AddIn ProcessID=" + process.ProcessId);

            foreach (AddInToken addinToken in addins)
            {
                // Activate the add-in
                //SayHelloHostView addinInstance = addinToken.Activate<SayHelloHostView>(AddInSecurityLevel.Host);
                SayHelloHostView addinInstance = addinToken.Activate <SayHelloHostView>(process, AddInSecurityLevel.Host);

                // Use the add-in
                Console.WriteLine();
                Console.WriteLine(String.Format("Add-in {0} Version {1}",
                                                addinToken.Name, addinToken.Version));

                Console.WriteLine(addinInstance.SayHello("Hello World from Plugin ;-)"));
            }

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Get add-in pipeline folder (the folder in which this application was launched from)
            string appPath = System.IO.Path.Combine(Environment.CurrentDirectory, "AddIns");

            //update must use the host root folder
            AddInStore.Update(Environment.CurrentDirectory);

            if (System.IO.Directory.Exists(appPath))
            {
                // Rebuild visual add-in pipeline
                string[] warnings = AddInStore.RebuildAddIns(appPath);
                if (warnings.Length > 0)
                {
                    string msg = "Could not rebuild pipeline:";
                    foreach (string warning in warnings)
                    {
                        msg += "\n" + warning;
                    }
                    MessageBox.Show(msg);
                    return;
                }
            }

            // Activate add-in with Internet zone security isolation
            Collection <AddInToken> addInTokens = AddInStore.FindAddIns(typeof(IWPFAddInHostView), PipelineStoreLocation.ApplicationBase, new string[] { appPath });

            lstAddIns.ItemsSource = addInTokens;
        }
Ejemplo n.º 3
0
        static void Main()
        {
            // Assume that the current directory is the application folder,
            // and that it contains the pipeline folder structure.
            //String addInRoot = Environment.CurrentDirectory + "\\Pipeline";
            const string addInRoot = @"..\..\..\Pipeline";

            // Update the cache files of the pipeline segments and add-ins.
            string[] warnings = AddInStore.Update(addInRoot);
            foreach (string warning in warnings)
            {
                Console.WriteLine(warning);
            }

            // Search for add-ins of type ICalculator (the host view of the add-in).
            Collection <AddInToken> tokens =
                AddInStore.FindAddIns(typeof(ICalculator), addInRoot);

            // Ask the user which add-in they would like to use.
            AddInToken calcToken = ChooseCalculator(tokens);

            // Activate the selected AddInToken in a new application domain
            // with the Internet trust level.
            ICalculator calc = calcToken.Activate <ICalculator>(AddInSecurityLevel.Internet);

            // Run the add-in.
            RunCalculator(calc);
        }
Ejemplo n.º 4
0
        void loadAddInUIMenuItem_Click(object sender, RoutedEventArgs e)
        {
// Get add-in pipeline folder (the folder in which this application was launched from)
            string appPath = Environment.CurrentDirectory;

// Rebuild visual add-in pipeline
            string[] warnings = AddInStore.Rebuild(appPath);
            if (warnings.Length > 0)
            {
                string msg = "Could not rebuild pipeline:";
                foreach (string warning in warnings)
                {
                    msg += "\n" + warning;
                }
                MessageBox.Show(msg);
                return;
            }

// Activate add-in with Internet zone security isolation
            Collection <AddInToken> addInTokens = AddInStore.FindAddIns(typeof(WPFAddInHostView), appPath);
            AddInToken wpfAddInToken            = addInTokens[0];

            this.wpfAddInHostView = wpfAddInToken.Activate <WPFAddInHostView>(AddInSecurityLevel.Internet);

// Display add-in UI
            FrameworkElement addInMainUI = this.wpfAddInHostView;

            this.addInUIHostGrid.Children.Add(addInMainUI);

// Get and display add-in status UI
            FrameworkElement addInStatusUI = this.wpfAddInHostView.GetAddInStatusUI();

            this.addInStatusBar.Items.Add(addInStatusUI);
        }
Ejemplo n.º 5
0
        private static void Main(string[] args)
        {
            // Assume that the current directory is the application folder,
            // and that it contains the pipeline folder structure.
            string addInRoot = Environment.CurrentDirectory + "\\Pipeline";

            // Update the cache files of the pipeline segments and add-ins.
            string[] warnings = AddInStore.Rebuild(addInRoot);
            foreach (string warning in warnings)
            {
                Console.WriteLine(warning);
            }

            // Search for add-ins of type ICalculator (the host view of the add-in).
            Collection <AddInToken> tokens = AddInStore.FindAddIns(typeof(IV2), addInRoot);

            AddInToken token = null;

            if (tokens.Count > 1)
            {
                Console.WriteLine("Select a version:");

                for (int i = 0; i < tokens.Count; i++)
                {
                    Console.WriteLine("{0}: {1}", i, tokens[i].Name);
                }

                var key = Console.ReadKey();
                Console.WriteLine();

                if (key.KeyChar == '0')
                {
                    token = tokens[0];
                }
                else
                {
                    token = tokens[1];
                }
            }

            if (token != null)
            {
                // Activate the selected AddInToken in a new application domain
                // with the Internet trust level.
                IV2 v2 = token.Activate <IV2>(AddInSecurityLevel.Internet);
                v2.OnEvent += (sender, message) => { Console.WriteLine("Event Fired: {0}", message); };
                v2.Initialize(new CallbackHandler());

                // Run the add-in.
                v2.WriteToConsole("Hello World From Host!");
                Console.WriteLine(v2.GetName());

                //var test = (Stopwatch)v2.GetSource();

                //Task.Delay(500).Wait();

                //test.Stop();
                //Console.WriteLine(test.ElapsedTicks);
            }
        }
Ejemplo n.º 6
0
        private void OnHostAppWindowLoaded(object sender, RoutedEventArgs e)
        {
            var addInPath = Environment.CurrentDirectory;

            AddInStore.Update(addInPath);
            IList <AddInToken> tokens = AddInStore.FindAddIns(typeof(ImageProcessorHostView), addInPath);

            AddInListBox.ItemsSource = tokens;
        }
Ejemplo n.º 7
0
        public static void Find()
        {
            string             path   = Environment.CurrentDirectory;
            IList <AddInToken> tokens = AddInStore.FindAddIns(typeof(ViewNodeHostView), path);

            var addin = tokens[0].Activate <ViewNodeHostView>(AddInSecurityLevel.Internet);

            addin.View();
        }
Ejemplo n.º 8
0
 private static IComponentScanner GetPipelineScanner(string xnaFrameworkVersion)
 {
     if (string.IsNullOrEmpty(xnaFrameworkVersion))
     {
         XBuilderWindowPane.WriteLine(Resources.PipelineAddInMissingVersionProperty, new object[0]);
     }
     else
     {
         string pipelineAddInRootPath = GetPipelineAddInRootPath();
         if (!string.IsNullOrEmpty(pipelineAddInRootPath))
         {
             try
             {
                 foreach (AddInToken token in AddInStore.FindAddIns(typeof(IComponentScanner), pipelineAddInRootPath, new string[0]))
                 {
                     string addInFrameworkVersion;
                     if (token.QualificationData[AddInSegmentType.AddIn].TryGetValue("XnaFrameworkVersion", out addInFrameworkVersion) &&
                         addInFrameworkVersion != null && addInFrameworkVersion == xnaFrameworkVersion)
                     {
                         try
                         {
                             return(token.Activate <IComponentScanner>(AppDomain.CurrentDomain));
                         }
                         catch (TargetInvocationException exception)
                         {
                             string message = string.Empty;
                             if (exception.InnerException != null)
                             {
                                 message = exception.InnerException.Message;
                             }
                             XBuilderWindowPane.WriteLine(
                                 "An error occurred while instantiating the content pipeline component scanner for version '{0}': {1}",
                                 new object[] { xnaFrameworkVersion, message });
                             continue;
                         }
                     }
                 }
                 XBuilderWindowPane.WriteLine(
                     "XNA Framework version '{0}' is not supported by this installation of XNA Game Studio, or a required component is missing.",
                     new object[] { xnaFrameworkVersion });
             }
             catch (InvalidOperationException ex)
             {
                 XBuilderWindowPane.WriteLine(Resources.PipelineAddInInvalidPipeline, new object[] { ex.Message });
             }
             catch (DirectoryNotFoundException ex)
             {
                 XBuilderWindowPane.WriteLine(Resources.PipelineAddInInvalidPipeline, new object[] { ex.Message });
             }
             catch (InvalidPipelineStoreException ex)
             {
                 XBuilderWindowPane.WriteLine(Resources.PipelineAddInInvalidPipeline, new object[] { ex.Message });
             }
         }
     }
     return(null);
 }
Ejemplo n.º 9
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string path = Environment.CurrentDirectory;

            AddInStore.Update(path);

            IList <AddInToken> tokens = AddInStore.FindAddIns(typeof(HostView.ImageProcessorHostView), path);

            lstAddIns.ItemsSource = tokens;
        }
Ejemplo n.º 10
0
        private static AddInToken getRemoteScriptManagerToken(string remoteScriptManagerName)
        {
            string addInRoot = Environment.CurrentDirectory;

            AddInStore.Rebuild(addInRoot);
            Collection <AddInToken> addInTokens = AddInStore.FindAddIns(typeof(IRemoteScriptManager), addInRoot);

            AddInToken token = addInTokens.First <AddInToken>(currentToken => currentToken.Name == remoteScriptManagerName);

            return(token);
        }
Ejemplo n.º 11
0
 void FindAddIns()
 {
     try
     {
         this.listAddIns.DataContext = AddInStore.FindAddIns(typeof(Calculator), Settings.Default.PipelinePath);
     }
     catch (DirectoryNotFoundException)
     {
         MessageBox.Show("Verify the pipeline directory in the config file");
         Application.Current.Shutdown();
     }
 }
Ejemplo n.º 12
0
        private void OnHostAppWindowLoaded(object sender, RoutedEventArgs e)
        {
            var path = Environment.CurrentDirectory;

            AddInStore.Update(path);

            IList <AddInToken> tokens = AddInStore.FindAddIns(typeof(ImageProcessorHostView), path);

            AddInListBox.ItemsSource = tokens;

            _automationHost = new AutomationHost(AddInProcessProgressBar);
        }
Ejemplo n.º 13
0
        private void AddInsInit()
        {
            string strAddInPath = Environment.CurrentDirectory;

            AddInStore.Update(strAddInPath);

            tokens = AddInStore.FindAddIns(typeof(HostView.KPICaculaterHostView), strAddInPath);
            AddInList.ItemsSource = tokens;
            if (tokens.Count > 0)
            {
                AddInList.SelectedIndex = 0;
            }
        }
Ejemplo n.º 14
0
        public static void UpdateInstalledModules()
        {
            AddInStore.Update(AddInPipelineRoot);
            var addins = AddInStore.FindAddIns(typeof(IModule), AddInPipelineRoot);

            foreach (var token in addins)
            {
                if (!Modules.Any(m => m._token.Equals(token)))
                {
                    Modules.Add(new Module(token));
                }
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Loads a list of all available AddIns
        /// </summary>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string path = Environment.CurrentDirectory;

            AddInStore.Update(path);

            string[] s = AddInStore.RebuildAddIns(path);

            IList <AddInToken> tokens = AddInStore.FindAddIns(typeof(HostView.NumberProcessorHostView), path);

            lstAddIns.ItemsSource = tokens;
            automationHost        = new AutomationHost(progressBar);
        }
Ejemplo n.º 16
0
        private void BuildListPlugins()
        {
            this.listPlugins.Items.Clear();
            foreach (var addIn in AddInStore.FindAddIns(typeof(DataPlugin), PipelineStoreLocation.ApplicationBase))
            {
                this.listPlugins.Items.Add(addIn);
            }

            if (this.listPlugins.Items.Count > 0)
            {
                this.listPlugins.SelectedItem = this.listPlugins.Items[0];
            }
        }
Ejemplo n.º 17
0
        static void Main(string[] args)
        {
            //Init pipline, create PipelineSegments.store and AddIns.store
            string path = Environment.CurrentDirectory;

            AddInStore.Update(path);

            //string[] warnings = AddInStore.Update(path);
            //foreach (var tmp in warnings)
            //{
            //    Console.WriteLine(tmp);
            //}

            //发现, used the host side view(without attribute)
            var tokens = AddInStore.FindAddIns(typeof(HostSideView.HostSideView), path);

            Console.WriteLine("当前共有{0}个插件可以选择。它们分别为:", tokens.Count);

            var index = 1;

            foreach (var tmp in tokens)
            {
                Console.WriteLine(string.Format("[{4}]名称:{0},描述:{1},版本:{2},发布者:{3}", tmp.Name, tmp.Description, tmp.Version, tmp.Publisher, index++));
            }

            //[[ find addin in the another folder
            string anotherAddInPath = @"C:\OutPutForAddIn\Test";

            AddInStore.RebuildAddIns(anotherAddInPath);

            //todo: why there find the addin in the fist folder????
            IList <AddInToken> PluginList = AddInStore.FindAddIns(typeof(HostSideView.HostSideView), PipelineStoreLocation.ApplicationBase, anotherAddInPath);
            //]]

            var token = ChooseCalculator(tokens);

            //隔离和激活插件
            AddInProcess process = new AddInProcess();//(Platform.X64);

            process.Start();

            var addin = token.Activate <HostSideView.HostSideView>(process, AddInSecurityLevel.FullTrust);

            Console.WriteLine("PID:{0}", process.ProcessId);

            //调用插件
            Console.WriteLine(addin.Say());

            Console.ReadKey();
        }
Ejemplo n.º 18
0
        public static Collection <AddInToken> GetAddInTokens(string addInRoot, string moduleName)
        {
            // rebuild the cache files of the pipeline segments and add-ins.
            string[] warnings = AddInStore.Rebuild(addInRoot);

            foreach (string warning in warnings)
            {
                Console.WriteLine(warning);
            }

            // Search for add-ins of type VModule
            Collection <AddInToken> tokens = AddInStore.FindAddIns(typeof(VModule), addInRoot);

            return(tokens);
        }
Ejemplo n.º 19
0
        private static AddInToken GetToken()
        {
            String addInRoot = Environment.CurrentDirectory;

            //Check to see if new AddIns have been installed
            AddInStore.Rebuild(addInRoot);

            //Look for Calculator AddIns in our root directory and store the results
            Collection <AddInToken> tokens = AddInStore.FindAddIns(typeof(Calculator), addInRoot);

            //Ask the user which AddIn they would like to use
            AddInToken calcToken = ChooseCalculator(tokens);

            return(calcToken);
        }
Ejemplo n.º 20
0
        public IList <T> ActivateAddIns <T>(Func <AddInFacade, AddInToken, Platform, T> factory, Func <AddInToken, bool> predicate)
        {
            var result  = new List <T>();
            var typeOfT = typeof(T);
            var tokens  = AddInStore.FindAddIns(typeOfT, _pipelineFolder.FullName);

            if (tokens.Count == 0)
            {
                const string template = "No Add-Ins of type '{0}' were found!";
                var          message  = String.Format(template, typeOfT.Name);
                Log.Warn(message);
            }
            foreach (var token in tokens)
            {
                if (predicate == null || predicate(token))
                {
                    var addInQualificationData = token.QualificationData[AddInSegmentType.AddIn];
                    var addInProcessPlatform   = Platform.Host;
                    if (addInQualificationData.ContainsKey(PlatformQualificationDataKey))
                    {
                        var potentialPlatform = addInQualificationData[PlatformQualificationDataKey];
                        if (!Enum.TryParse(potentialPlatform, true, out addInProcessPlatform))
                        {
                            // default to "Host" if the qualification data value couldn't be parsed
                            addInProcessPlatform = Platform.Host;
                        }
                    }
                    const string template =
                        "Add-in named '{0}', version {2}, published by '{1}' and described as '{3}' will be activated out-of-process under platform {4}.";
                    var message = String.Format(template, token.Name, token.Publisher, token.Version, token.Description, addInProcessPlatform);
                    Log.Info(message);

                    var currentToken = token;
                    T   addInOfT;
                    try
                    {
                        addInOfT = factory(this, currentToken, addInProcessPlatform);
                    }
                    catch (InvalidOperationException e)
                    {
                        Log.Error(e.Message, e);
                        continue;
                    }
                    result.Add(addInOfT);
                }
            }
            return(new ReadOnlyCollection <T>(result));
        }
Ejemplo n.º 21
0
        public IDriver GetDriverForImage(FirmwareImage image)
        {
            IDriver result = null;

            if (image != null)
            {
                var tokens      = AddInStore.FindAddIns(typeof(IDriver), _addInRoot);
                var driverToken = tokens.FirstOrDefault(x => x.Name == image.DriverName);
                if (driverToken != null)
                {
                    result = driverToken.Activate <IDriver>(AddInSecurityLevel.FullTrust);
                    // use AddInController.GetAddInController(result) to manage/unload/etc
                }
            }
            return(result);
        }
Ejemplo n.º 22
0
        public static void ActivatePlugins()
        {
            if (!File.Exists("PipelineSegments.store"))
            {
                Rebuild();
                return;
            }

            foreach (AddInToken addIn in AddInStore.FindAddIns(typeof(DataPlugin), PipelineStoreLocation.ApplicationBase))
            {
                AddInProcess process = new AddInProcess();
                process.KeepAlive = false;
                DataPlugin activeAddIn = addIn.Activate <DataPlugin>(process, AddInSecurityLevel.Host);
                plugins.Add(activeAddIn);
            }
        }
Ejemplo n.º 23
0
        private TPlugin LoadPlugin <TPlugin>() where TPlugin : class, IHostViewAddIn
        {
            Collection <AddInToken> tokens = AddInStore.FindAddIns(typeof(ISightstonePlugin), _addInRootPath);

            IList <PluginTokenBase> pluginTokens = tokens.OrderBy(p => p.Version).Select(p => (PluginTokenBase)(new PluginToken <TPlugin>(p))).ToList();

            _plugins[typeof(TPlugin)] = pluginTokens;

            var pluginToken = pluginTokens.FirstOrDefault() as PluginToken <TPlugin>;

            if (pluginToken == null)
            {
                throw new InvalidOperationException("The plugin has not been found");
            }

            return(pluginToken.Plugin);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Create AppDomains and controls in parallel
        /// </summary>
        private void Initialize()
        {
            var addIns = AddInStore.FindAddIns(typeof(IControlFactory), Environment.CurrentDirectory)
                         .AsParallel()
                         .WithExecutionMode(ParallelExecutionMode.ForceParallelism)
                         .WithMergeOptions(ParallelMergeOptions.AutoBuffered)
                         .Select(GetControlFromFactory)
                         .ToArray();

            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                foreach (var tuple in addIns)
                {
                    _factories.Add(tuple.Item1);
                    ((Panel)Content).Children.Add(tuple.Item2);
                }
            }));
        }
Ejemplo n.º 25
0
        public MainWindow()
        {
            InitializeComponent();

            _addInRoot = System.IO.Path.Combine(
                System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
                "Pipeline");


            string[] warnings = AddInStore.Update(_addInRoot);

            Collection <AddInToken> tokens = AddInStore.FindAddIns(typeof(IAccessComposition), _addInRoot);

            comboBoxProvider.ItemsSource   = tokens;
            comboBoxProvider.SelectedIndex = 0;

            //radioButtonLoad.IsChecked = true;
            radioButtonSave.IsChecked = true;
        }
Ejemplo n.º 26
0
        /// <summary>
        ///     Loads the plugins.
        /// </summary>
        /// <returns></returns>
        /// <exception cref="System.ArgumentException">Invalid assembly path.</exception>
        private static List <PluginWrapper> LoadPlugins( )
        {
            /////
            // Get the current path.
            /////
            string currentPath = Path.GetDirectoryName(Assembly.GetEntryAssembly( ).Location);

            if (currentPath == null)
            {
                throw new ArgumentException("Invalid assembly path.");
            }

            string addInRoot = Path.Combine(currentPath, "Pipeline");

            /////
            // Update the cache files of the pipeline segments and add-ins.
            /////
            string[] warnings = AddInStore.Update(addInRoot);

            foreach (string warning in warnings)
            {
                EventLog.Instance.WriteWarning(warning);
            }

            /////
            // Search for add-ins of type IPlugin (the host view of the add-in).
            /////
            List <AddInToken> tokens = AddInStore.FindAddIns(typeof(IPlugin), addInRoot).ToList( );

            var plugins = new List <PluginWrapper>( );

            foreach (AddInToken token in tokens)
            {
                EventLog.Instance.WriteTrace("Activating '{0}' from assembly '{1}'...", token.Name, token.AssemblyName);

                var plugin = token.Activate <IPlugin>(AddInSecurityLevel.FullTrust);

                plugins.Add(new PluginWrapper(token, plugin));
            }

            return(plugins);
        }
Ejemplo n.º 27
0
        private static async Task <IPlugin[]> LoadPlugins()
        {
            async Task <IPlugin> ActivePlugin(AddInToken token)
            {
                AppDomain pluginDomain = CreatePluginDomain(token);

                pluginDomain.SetData(WidgetConst.HANGFIRE, HANGFIRE);
                pluginDomain.DoCallBack(new CrossAppDomainDelegate(PluginCallBackAsync));
                return(await Task.Run(() => {
                    var plugin = token.Activate <IPlugin>(pluginDomain);
                    Logger.LogInformation(token.AddInFullName);
                    return plugin;
                }));
            }

            return(await Task.Run(() => {
                var tasks = new List <Task <IPlugin> >();
                try {
                    var pipeline = Path.Combine(
                        Environment.CurrentDirectory, ContainerConst.PLUGIN_PATH);
                    var warnings = AddInStore.Rebuild(pipeline);
                    var tokens = AddInStore.FindAddIns(typeof(IPlugin), pipeline);

                    foreach (var token in tokens)
                    {
                        tasks.Add(ActivePlugin(token));
                    }
                    Task.WaitAll(tasks.ToArray());

                    return tasks
                    .Select(t => t.Result)
                    .ToArray();
                }
                catch (AggregateException e) {
                    foreach (var ie in e.InnerExceptions)
                    {
                        Console.WriteLine(ie.ToString());
                    }
                    return new IPlugin[0];
                }
            }));
        }
Ejemplo n.º 28
0
        public void LoadPlugins()
        {
            // Set the add-ins discovery root directory to be the current directory
            string addinRoot = Environment.CurrentDirectory;

            // Rebuild the add-ins cache and pipeline components cache.
            AddInStore.Rebuild(addinRoot);

            // Get registerd add-ins of type SimpleAddInHostView
            Collection <AddInToken> addins = AddInStore.FindAddIns(typeof(WpfAddinHostView), addinRoot);

            foreach (AddInToken addinToken in addins)
            {
                // Activate the add-in
                WpfAddinHostView addinInstance = addinToken.Activate <WpfAddinHostView>(AddInSecurityLevel.FullTrust);

                FrameworkElement element = addinInstance.RegisterContent();
                m_DockPanel.Children.Add(element);
            }
        }
Ejemplo n.º 29
0
        public PluginLoader()
        {
            var directoryInfo = new DirectoryInfo(Assembly.GetExecutingAssembly().Location);
            var addInRootPath = Path.Combine(directoryInfo.Parent.FullName, "Plugin");

            string[] warnings = AddInStore.Update(addInRootPath);
            DisplayWarnings(warnings);

            Collection <AddInToken> tokens = AddInStore.FindAddIns(typeof(ISightstonePlugin), addInRootPath);

            DisplayTokens(tokens);

            foreach (AddInToken token in tokens)
            {
                var grantSet = new PermissionSet(PermissionState.None);
                grantSet.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
                grantSet.AddPermission(new FileIOPermission(FileIOPermissionAccess.AllAccess, Path.Combine(Assembly.GetExecutingAssembly().Location, "Plugin", token.AddInFullName)));
                grantSet.AddPermission(new ReflectionPermission(ReflectionPermissionFlag.MemberAccess));
                ISightstonePlugin calculatorPlugin = token.Activate <ISightstonePlugin>(AddInSecurityLevel.FullTrust);
            }
        }
Ejemplo n.º 30
0
        internal void load(string directory)
        {
            string fullpath = System.IO.Path.GetFullPath(directory);

            /* rebuild the plugin cache. */
            string[] errors = AddInStore.Rebuild(PipelineStoreLocation.ApplicationBase);              //fullpath);

            /* grab the list o' addins. */
            Collection <AddInToken> addins = AddInStore.FindAddIns(typeof(StarTree.Host.Database.Plugin), PipelineStoreLocation.ApplicationBase);

            //fullpath);

            foreach (AddInToken token in addins)
            {
                Plugin p = token.Activate <Plugin>(AddInSecurityLevel.Host);

                if (p != null)
                {
                    _plugins.Add(p);
                }
            }
        }