This project is read-only.

Property Provider

PropertyProvider is a class that implements IPropertyProvider, which aims to provide Property value to an entry or entry list if they're supported.

There are two form of PropertyProvider, Primary and Secondary.
Type Interface Description
Primary IPropertyProvider assigned by DirectoryLister when Parsing or Listing
Secondary ISecondaryPropertyProvider<T> where T : IFileSystemInfo or IEntryList registered via ICOFEPlugin.EntryListPropertyProviders or EntryPropertyProviders


Primary Property Provider is assigned by DirectoryLister to return main properties (#1) of an entry, by calling EntryConstructor.CreateEntry() method.

#1 - FullName, FullParseName, Name, Label, IsExists, IsFileSystem, FileAttributes, COFEAttributes, CreationTimeUtc, LastAccessTimeUtc, LastWriteTimeUtc, Length, DirectoryType and IsFileBasedFS

Secondary Property Provider is used to provide additional properties for an Entry (IFileSystemInfo) or EntryList (IEntryList).

Both implements methods like GetSupportedProperty(), GetProperty() and SetProperty(),

Add new Property by writing Property Provider

Find an available property id
1. One property id is allowed for one property only, so please make sure it's unique.
A list of Known Properties
2. Define the new property set
 public enum NewProperties : int
{
  [PropertyType(typeof(string))]
  NewProperty = 10101
} 

3. Before a property can be used it have to be registered in PropertyDictionary, the int value registered can not be overlapped.
COFEShared.PropertyDictionary.RegisterProperties<NewProperties>();
or
registerProperties<NewProperties>();
4. Construct your property provider, which inherits from ISecondaryPropertyProvider<IFileSystemInfo>.
public class NewPropertyProvider : ISecondaryPropertyProvider<IFileSystemInfo>
{
  public object[] GetSupportedProperty(IFileSystemInfo sourceObj) { 
    return new object[] { NewProperties.NewProperty }; }
   public PropertyPair GetProperty(IFileSystemInfo sourceObj, object property) {
    return new PropertyPair(property, "stringValue"); }
} 

5. Register your property provider using COFEPlugin.

Last edited Jul 8, 2012 at 6:20 PM by lycj, version 5

Comments

No comments yet.