Gets the parent folder of the item in repository (null for the root of the repository).
public abstract class HierarchyItem : IHierarchyItem, ILock
{
protected FileSystemInfo fileSystemInfo;
public HierarchyItem(FileSystemInfo fileSystemInfo)
{
this.fileSystemInfo = fileSystemInfo;
}
public IFolder Parent
{
get
{
string storageRootFolder = ConfigurationManager.AppSettings["StorageRootFolder"].TrimEnd('\\');
string parentPath = fileSystemInfo.FullName.TrimEnd('\\');
int index = parentPath.LastIndexOf('\\');
if (index <= storageRootFolder.Length-1)
return null;
DirectoryInfo directory = new DirectoryInfo(parentPath.Remove(index));
return new Folder(directory);
}
}
...
}
IHierarchyItem Interface | ITHit.WebDAV.Server Namespace