CustomDataSetProxy.RegisterInfoProvider Methods
Register a custom dataset as a DataSetInfo provider for data files with a certain file extension.
Overload List
| Name | Description | |
|---|---|---|
| RegisterInfoProvider(System.String extension, ICustomDataSet provider) | Register a dummy instance of a custom dataset to serve as DataSetInfo provider for data files matching the given file extension. | |
| RegisterInfoProvider(System.String extension, CustomApi api, System.String libraryName, System.String className) | Register a custom-dataset class to serve as DataSetInfo provider for data files matching the given file extension. |
RegisterInfoProvider(System.String extension, ICustomDataSet provider)
Register a dummy instance of a custom dataset to serve as DataSetInfo provider for data files matching the given file extension.Syntax
public static void RegisterInfoProvider (
System.String extension,
ICustomDataSet provider
)Parameters
The file extension that the custom dataset will be registered as provider for. The extension may contain '*' and '?' wildcards. Case insensitive.
A dummy instance of a ICustomDataSetInfoProvider-implementing custom dataset, that will act as the DataSetInfo provider for the extension.
Remarks
The purpose of this method is to make it possible for custom datasets to handle calls to DataSetInfo.FromFile and DataSetInfo.FromDirectory.
Custom datasets that implement ICustomDataSetInfoProvider may be registered using this method as DataSetInfo providers for files matching a certain file extension. When a custom dataset has been registered for an extension, calls to DataSetInfo.FromFile on files that match the extension parameter will be forwarded to the registered custom-dataset instance's getInfo method.
The extension may contain wildcards in the form of asterisks (matching zero or more characters) and question marks (matching one character). For example, extension="a*c" will match all of "file1.ABC", "file2.axc", "file3.aabcc", and "file4.ac"; whereas extension="a?c" will only match "file1.ABC" and "file2.axc" out of all those examples.
If the files that the custom dataset can handle are not associated with a particular file extension, you can register it using only a wildcard as its extension parameter: extension="*". Then, implement the provider's ICustomDataSetInfoProvider.GetInfo method to detect if the file is relevant for the custom dataset, returning null otherwise.
DataSetInfo retrieval process
The process of getting the DataSetInfo for a file works like this:
First, if there is a custom dataset implementation registered with an extension exactly matching the file's extension, it is selected and the registered implementation's ICustomDataSetInfoProvider.GetInfo method is called.
If getInfo returned null, continue with the steps below. Otherwise, the process is done.
Repeat the above for all registered providers whose extension wildcard-matches the file's extension.
If none of the registered providers returned non-null, the process continues with Carmenta Engine's built-in datasets.
Registering the Custom Dataset
There are two overloads of this method: one takes as its parameter a custom-dataset instance, and the other takes the information needed to load the custom-dataset implementation from a library: api, libraryName, and className. You should use the overload of that corresponds to the way you provide the custom dataset to CustomDataSetProxy:
If you let Carmenta Engine load the custom dataset by setting the api, libraryName, and className properties on CustomDataSetProxy, then register the custom dataset implementation using the overload of RegisterInfoProvider that takes api, libraryName, and className.
If you have defined your custom dataset in your application code, and insert it into a CustomDataSetProxy by directly setting the customDataSet property, then construct a dummy instance of your custom dataset and register it using the overload of RegisterInfoProvider that takes a custom-dataset instance.
RegisterInfoProvider(System.String extension, CustomApi api, System.String libraryName, System.String className)
Register a custom-dataset class to serve as DataSetInfo provider for data files matching the given file extension.Syntax
public static void RegisterInfoProvider (
System.String extension,
CustomApi api,
System.String libraryName,
System.String className
)Parameters
The file extension that the custom dataset will be registered as provider for. May contain '*' and '?' wildcards. Case insensitive.
The API the custom dataset is implemented with.
The name of the library (DLL/assembly) containing the custom dataset. This may be a relative or absolute path. If it is a relative path, it will be interpreted as relative to the current working directory of the application.
The name of the class implementing the custom dataset.
Remarks
The purpose of this method is to make it possible for custom datasets to handle calls to DataSetInfo.FromFile and DataSetInfo.FromDirectory.
Custom datasets that implement ICustomDataSetInfoProvider may be registered using this method as DataSetInfo providers for files matching a certain file extension. When a custom dataset has been registered for an extension, calls to DataSetInfo.FromFile on files that match the extension parameter will be forwarded to the registered custom-dataset instance's getInfo method.
The extension may contain wildcards in the form of asterisks (matching zero or more characters) and question marks (matching one character). For example, extension="a*c" will match all of "file1.ABC", "file2.axc", "file3.aabcc", and "file4.ac"; whereas extension="a?c" will only match "file1.ABC" and "file2.axc" out of all those examples.
If the files that the custom dataset can handle are not associated with a particular file extension, you can register it using only a wildcard as its extension parameter: extension="*". Then, implement the provider's ICustomDataSetInfoProvider.GetInfo method to detect if the file is relevant for the custom dataset, returning null otherwise.
DataSetInfo retrieval process
The process of getting the DataSetInfo for a file works like this:
First, if there is a custom dataset implementation registered with an extension exactly matching the file's extension, it is selected and the registered implementation's ICustomDataSetInfoProvider.GetInfo method is called.
If getInfo returned null, continue with the steps below. Otherwise, the process is done.
Repeat the above for all registered providers whose extension wildcard-matches the file's extension.
If none of the registered providers returned non-null, the process continues with Carmenta Engine's built-in datasets.
Registering the Custom Dataset
There are two overloads of this method: one takes as its parameter a custom-dataset instance, and the other takes the information needed to load the custom-dataset implementation from a library: api, libraryName, and className. You should use the overload of that corresponds to the way you provide the custom dataset to CustomDataSetProxy:
If you let Carmenta Engine load the custom dataset by setting the api, libraryName, and className properties on CustomDataSetProxy, then register the custom dataset implementation using the overload of RegisterInfoProvider that takes api, libraryName, and className.
If you have defined your custom dataset in your application code, and insert it into a CustomDataSetProxy by directly setting the customDataSet property, then construct a dummy instance of your custom dataset and register it using the overload of RegisterInfoProvider that takes a custom-dataset instance.
Platforms
Windows, Linux, Android