This project is read-only.
Types of Properties
Properties are defined as enum, they are registered to COFE via PropertyDictionary.RegisterProperties() method, or via the ICOFEPlugin, they can be used to represent metadata, resources and actions.

Because IFileSystemInfo, IEntryList and IEventLog implemented IPropertyHost<>, one can call it's GetProperty() method (e.g. entry.GetProperty(FileSystemInfoProperties.LastWriteTimeUtc).ValueAsDateTime) or cast it as dynamic and call the alias directly (e.g. entry.DynamicProperties.Time) to retrieve the value if it's supported.

Metadata
Metadata are a small piece of data, e.g. ParsePath of an entry, size and crc of a file, or subdirectory count of a directory. These metadata are stored in database if the type is supported.

All metadata properties are decorated with a metadata attribute, marking it as metadata also means they will be visible via COFEWS.
[PropertyType(PropertyTypeAttribute.DateTimeDefaultEnum.Min)]
[PrimaryProperty]
[Metadata(true)]
[Alias("Time")]
LastWriteTimeUtc,
...
[PropertyType("", typeof(string))]
[Metadata(false)]
[Alias(false)]
CRC,
The constructor parameter of the Metadata attribute specified if it's a major or minor metadata, major metadata display in the same element of an entry, where you have to call the metadata link to obtain the value of minor metadata.
<Entry xmlns:p1="http://cofews" xmlns="http://cofews" p1:ID="36630d64676c797815b7f86f35160460" BaseType="File">
<p1:Path>{TEMP}/Bug/Resources/DotNet2.png</p1:Path> *major*
<p1:Time>6/5/2011 8:46:56</p1:Time> *major*
<p1:Size>11924</p1:Size> *major*
...
<p1:Link MediaType="application/cofews.metadata+xml" Rel="Metadata" Uri="/entries/36630d64-676c-7978-15b7-f86f35160460/metadata"/> *minor metadata found here*
...
</Entry>
And it returns the following if metadata link is called:
<Metadata xmlns="http://cofews">
<Path>{TEMP}\Bug\Resources\DotNet2.png</Path>
<ParentPath>{TEMP}\Bug\Resources</ParentPath>
<Label>DotNet2.png</Label>
<FileSystemInfoProperties.IsExists>True</FileSystemInfoProperties.IsExists> *Alias not specified, so it uses full name*
<Time>6/5/2011 8:46:56</Time>
<Size>11924</Size>
<SecondaryId>TEMP</SecondaryId>
<CRC/> *CRC not cached*
<EntryTypeId>811fddc0-07a9-6b85-6eb5-67bac48a00ad</EntryTypeId>
</Metadata>
Resources
Resource property are data that require time to load, because of this they have to be loaded individually, they are available as an url in COFEWS:
<Entry xmlns:p1="http://cofews" xmlns="http://cofews" p1:ID="36630d64676c797815b7f86f35160460" BaseType="File">
<p1:Path>{TEMP}/Bug/Resources/DotNet2.png</p1:Path>
...
<p1:Link MediaType="application/cofews.resourcelist+xml" Rel="Thumbnail" Uri="/entries/36630d64-676c-7978-15b7-f86f35160460/thumbnail"/> *major resource*
</Entry>
Resources are marked with ResourceAttribute, noted that similar to Metadata, there is also minor and major resources, minor resource (e.g. SmallThumbnail) are not shown in the entry element, instead, one can define a major resource as ResourceList, and link the minor resource, for examples:
[PropertyType(typeof(IResourceList))]
[ResourceList(IconProperties.SmallThumbnail, IconProperties.MediumThumbnail, IconProperties.LargeThumbnail)]
[Resource(MediaType.ResourceList, true)]
[Alias("Thumbnail")]
Thumbnail,
...
[PropertyType(typeof(Bitmap))]
[BitmapSize(128, 96)]
[Resource(MediaType.Png, false)]
[Alias("SmallThumbnail")]
SmallThumbnail,

In this case, when a user call the resource list link, a resources element will be returned with the minor resources:
<Resources xmlns:p1="http://cofews" xmlns="http://cofews" p1:Type="thumbnail">
<p1:Link MediaType="image/png" Rel="SmallThumbnail" Uri="/entries/36630d64-676c-7978-15b7-f86f35160460/smallthumbnail"/> *minor resources*
<p1:Link MediaType="image/png" Rel="MediumThumbnail" Uri="/entries/36630d64-676c-7978-15b7-f86f35160460/mediumthumbnail"/>
<p1:Link MediaType="image/png" Rel="LargeThumbnail" Uri="/entries/36630d64-676c-7978-15b7-f86f35160460/largethumbnail"/>
</Resources>

Actions
Actions are actually Func<IEntryList, string, IWorkProgress, IEntryList> parameter, this allow user to run actions.
[Action(ActionParameters.None, ActionParameters.One)]
Parse = 1050,
[Alias(false)]
[Action(ActionParameters.None, ActionParameters.All)]
List,
...
[Action(ActionParameters.One, ActionParameters.One)] 
Rename,

The action attribute include input and output, for examples, the parse action require no input and create OneEntryList, the list action require no input and create an IEntryList that have multiple entries.

If you chain the Rename action after an List action, only the first entry is handled, the other entries will be discarded.

Action is not implemented in COFEWS yet.

Last edited Nov 26, 2012 at 7:17 PM by lycj, version 12

Comments

No comments yet.