Проекты

File List Plugin Provider

If you want to specify exact plugins to load or you application required fixed plugins to load you can use current plugin provider, where you can specify xml file with a list of plugins an instances to load. The have to implement IPlugin interface.

Of the plugins is stored elsewhere you can specify plugins path by command argument SAL_Path and separate by «;» if you want to specify more than one path.

In each specified folder plugin will search for file Plugins.List.xml. File must contains root element Plugins, witch will contain a list of Plugin elements. Each Plugin element, must contains at least one attribute Assembly and array of child Instance elements:

  1. Assembly — File name with extension in current folder
  2. Instance — Full class name with namespace, witch implement interface IPlugin.

XML (Example)


<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Plugins>
	<Plugin Assembly="Kernel.Empty.dll">
		<Instance>Kernel.Empty.PluginWindows</Instance>
	</Plugin>
	<Plugin Assembly="Plugin.Autorun.dll">
		<Instance>Plugin.Autorun.PluginWindows</Instance>
	</Plugin>
</Plugins>

XSD


<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Plugins" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:attribute name="Assembly">
		<xs:simpleType>
			<xs:restriction base="xs:string">
				<xs:minLength value="1"/>
			</xs:restriction>
		</xs:simpleType>
	</xs:attribute>
	
	<xs:element name="Plugins">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="Plugin" minOccurs="1" maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Instance" minOccurs="1" maxOccurs="unbounded">
								<xs:simpleType>
									<xs:restriction base="xs:string">
										<xs:whiteSpace value="replace"/>
										<xs:minLength value="1"/>
									</xs:restriction>
								</xs:simpleType>
							</xs:element>
						</xs:sequence>
						<xs:attribute ref="Assembly" use="required"/>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>

Теги:

Скачать

Родительские файлы