Click or drag to resize

EngineGetFileSystemItemAsync Method

IT Hit User File System
Gets file or folder object corresponding to path in user file system.

Namespace:  ITHit.FileSystem
Assembly:  ITHit.FileSystem (in ITHit.FileSystem.dll) Version: 1.4.4298.0
Syntax
public abstract Task<IFileSystemItem> GetFileSystemItemAsync(
	string path
)

Parameters

path
Type: SystemString
Path for which your will return a file or a folder.

Return Value

Type: TaskIFileSystemItem
File or folder object that corresponds to path.
Remarks

This is a factory method that returns files and folders in your user file system. In your implementation you will return file or folder object that corresponds to provided path parameter. Your file must implement IFile interface. Your folder must implement IFolder interface.

The Engine will then call IFile and IFolder methods to get the required information and pass it to 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.

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