Click or drag to resize

IEngineGetFileSystemItemAsync Method

IT Hit User File System
Gets file or folder item corresponding to the user file system path or item ID.

Namespace:  ITHit.FileSystem
Assembly:  ITHit.FileSystem (in ITHit.FileSystem.dll) Version: 3.3.9602.0
Syntax
Task<IFileSystemItem> GetFileSystemItemAsync(
	string userFileSystemPath,
	FileSystemItemType itemType,
	byte[] itemId = null
)

Parameters

userFileSystemPath
Type: SystemString
Path in the user file system for which your will return a file or a folder.
itemType
Type: ITHit.FileSystemFileSystemItemType
Item type - file or folder.
itemId (Optional)
Type: SystemByte
Item ID or null for root folder or if the remote storage did not provide item ID. See ItemId description for more details.

Return Value

Type: TaskIFileSystemItem
File or folder item that corresponds to the userFileSystemPath or itemId.
Remarks

This is a factory method that returns file and folder items. In your implementation you will return file or folder item that corresponds to the provided userFileSystemPath or itemId parameters. Your file must implement IFile interface. Your folder must implement IFolder interface.

The Engine will then call IFile and IFolder methods to execute operations requested by the platform.

Note that this method may be called for files that does not exist in the user file system, for example when a file handle is closed after the file has been deleted.

In case of macOS platform, there is no access to the local file system. You should NOT try to determine item type or read local files/folders on macOS.

Examples

The code below is part of 'VirtualFileSystem' C# sample provided with the SDK.

C#
public override async Task<IFileSystemItem> GetFileSystemItemAsync(string path)
{
    if(File.Exists(path))
    {
        return new VfsFile(path, this, this);
    }
    if(Directory.Exists(path))
    {
        return new VfsFolder(path, this, this);
    }

    // When a file handle is being closed during delete, the file does not exist, return null.
    return null; 
}
See Also