public void StartupPluginLoaderTest()
        {
            CoreStartup start = new CoreStartup("TickZoomTest");

            start.StartCoreServices();
            start.RunInitialization();
            string addInConfig =
                @"<Plugin name        = ""LoaderTests""
       author      = ""Wayne Walter""
       url         = """"
       description = ""TODO: Put description here"">
	
	<Runtime>
		<Import assembly = ""TickZoomLoaderTests.dll""/>
	</Runtime>
	
	<Path name = ""/Tests/Loaders"">
		<Extension id=""MyLoader"" class=""TestLoader""/>
	</Path>
</Plugin>";
            var    reader = new StringReader(addInConfig);
            Plugin plugin = Plugin.Load(reader, ".");

            plugin.Enabled = true;
            PluginTree.InsertPlugin(plugin);
            ModelLoaderInterface loader = (ModelLoaderInterface)PluginTree.BuildItem("/Tests/Loaders/MyLoader", this);

            Assert.IsNotNull(loader);
        }
Пример #2
0
        public object BuildItem(object caller, Extension extension, ArrayList subItems)
        {
            string item = extension.Properties["item"];
            string path = extension.Properties["path"];

            if (item != null && item.Length > 0)
            {
                // include item
                return(PluginTree.BuildItem(item, caller));
            }
            else if (path != null && path.Length > 0)
            {
                // include path (=multiple items)
                return(new IncludeReturnItem(caller, path));
            }
            else
            {
                LoggingService.Error("<Include> requires the attribute 'item' (to include one item) or the attribute 'path' (to include multiple items)");
                return(null);
            }
        }