Interface IGorgonFileSystemProviderFactory
A factory object used to create file system provider plug ins.
Namespace: Gorgon.IO.Providers
Assembly: Gorgon.FileSystem.dll
Syntax
public interface IGorgonFileSystemProviderFactory
Remarks
This will generate providers that will allow access to different types of file systems. For example, a user may create a file system provider that will open 7-zip files, but the IGorgonFileSystem will not know how to read those files without the appropriate provider. This object would be used to load that 7-zip provider, and add it to the file system object so that it will know how to mount those file types.
File system providers are plug ins, and should have their assemblies loaded by the GorgonMefPlugInCache before using this method and a IGorgonPlugInService should be created in order to pass it to this factory.
Examples
The following example shows how to use the provider factory:
// In a real world application, you would keep your cache for as long as you need your plug ins.
// Premature disposal can cause errors.
using (GorgonMefPlugInCache cache = new GorgonMefPlugInCache())
{
// Create the provider factory.
IGorgonFileSystemProviderFactory factory = new GorgonFileSystemProviderFactory(cache);
// Get our provider from the factory.
IGorgonFileSystemProvider provider = CreateProvider(@"C:\FileSystemProviders\Gorgon.FileSystem.7zip.dll", "Gorgon.FileSystem.SevenZipProvider");
// Mount the file system.
IGorgonFileSystem fileSystem = new GorgonFileSystem(provider);
fileSystem.Mount("c:\path\to\your\archive\file.7z");
// Do stuff...
}
Methods
| Edit this page View SourceCreateProvider(string, string)
Function to create a new file system provider.
Declaration
GorgonFileSystemProvider CreateProvider(string path, string providerPlugInName)
Parameters
Type | Name | Description |
---|---|---|
string | path | The path to the file system plug in assemblies. |
string | providerPlugInName | The fully qualified type name of the plugin that contains the file system provider. |
Returns
Type | Description |
---|---|
GorgonFileSystemProvider | The new file system provider object, or if it was previously created, the previously created instance. |
CreateProviders(string)
Function to retrieve all the file system providers from the available plugins in the plugin service.
Declaration
IReadOnlyList<GorgonFileSystemProvider> CreateProviders(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | The path to the file system plug in assemblies. |
Returns
Type | Description |
---|---|
IReadOnlyList<GorgonFileSystemProvider> | A list of file system providers |