Gets or sets the attributes of the item. If your custom folder does not support attributes, override the DoHasAttributes property and return false. This will prevent the DoAttributes method from being called needlessly.
Gets or sets the creation date and time of the item. If your custom folder does not support having a creation date and time, override the DoHasCreationDateTime property and return false. This will prevent the DoCreationDateTime method from being called needlessly.
Gets or sets the modification date and time of the item. If your custom folder does not support having a last write date and time, override the DoHasLastWriteDateTime property and return false. This will prevent the DoLastWriteDateTime method from being called needlessly.
Gets or sets the last access date and time of the item. If your custom folder does not support having a last access date and time, override the DoHasLastAccessDateTime property and return false. This will prevent the DoLastAccessDateTime method from being called needlessly.
Returns a boolean value indicating if the path passed is rooted in the environment of the FileSystemItem object we are dealing with.
Each of the overridden abstract "Do" methods and properties are called by their corresponding public counterparts and are responsible for executing the actual operation. The public method simply validates the parameters. It is the "Do" implementation that must make sure that the required conditions are met. For example, in order to call delete on an item, it must first exist. This means that your implementation of DoDelete must throw an ItemDoesNotExistException if the item does not exist.
Template
The following example demonstrates the minimum implementation required for a class that derives from the AbstractFile class.
VB.NET
Copy Code
Imports System.IO Imports Xceed.FileSystem
Namespace Xceed.FileSystem.Samples
Public Class CustomFolder Inherits AbstractFolder
Protected Overrides Function DoGetChildItems(ByVal session As FileSystemEventsSession) As FileSystemItem() Return Nothing End Function
Protected Overrides Function DoGetFile(ByVal session As FileSystemEventsSession, ByVal fileName As String) As AbstractFile Return Nothing End Function
Protected Overrides Function DoGetFolder(ByVal session As FileSystemEventsSession, ByVal folderName As String) As AbstractFolder Return Nothing End Function
Protected Overrides Property DoName() As String Get Return Nothing End Get Set(ByVal Value As String) End Set End Property
Protected Overrides ReadOnly Property DoFullName() As String Get Return Nothing End Get End Property
Protected Overrides Property DoAttributes() As FileAttributes Get Return New FileAttributes() End Get Set(ByVal Value As FileAttributes) End Set End Property
Protected Overrides Property DoCreationDateTime() As DateTime Get Return New DateTime() End Get Set(ByVal Value As DateTime) End Set End Property
Protected Overrides Property DoLastWriteDateTime() As DateTime Get Return New System.DateTime() End Get Set(ByVal Value As DateTime) End Set End Property
Protected Overrides Property DoLastAccessDateTime() As DateTime Get Return New DateTime() End Get Set(ByVal Value As DateTime) End Set End Property
Protected Overrides ReadOnly Property DoParentFolder() As AbstractFolder Get Return Nothing End Get End Property
Protected Overrides ReadOnly Property DoRootFolder() As AbstractFolder Get Return Nothing End Get End Property
Protected Overrides ReadOnly Property DoExists() As Boolean Get Return True End Get End Property
Protected Overrides Sub DoRefresh(ByVal session As FileSystemEventsSession) End Sub
Protected Overrides Sub DoCreate(ByVal session As FileSystemEventsSession) End Sub
Protected Overrides Sub DoDelete(ByVal session As FileSystemEventsSession) End Sub
Protected Overrides Function IsSameAs(ByVal target As FileSystemItem) As Boolean Return True End Function
Protected Overrides Function IsPathRooted(ByVal path As String) As Boolean Return True End Function
End Class End Namespace
C#
Copy Code
using System; using System.IO; using Xceed.FileSystem;
namespace Xceed.FileSystem.Samples { public class CustomFolder : AbstractFolder { public CustomFolder() { }