Click or drag to resize

File system domain

Overview

Using the FlexPendant SDK FileSystemDomain you can create, save, load, rename, and delete files on the controller. You can also create and delete directories.

Accessing files and directories

You can access the file system domain through the Controller object property FileSystem .

C#
FileSystem aFileSystem = aController.FileSystem;
VB
Private aFileSystem As FileSystem = aController.FileSystem
Controller and FlexPendant file system

You can find and set the remote directory on the controller and the local directory on the FlexPendant device by using the RemoteDirectory and LocalDirectory properties.

C#
string remoteDir = aController.FileSystem.RemoteDirectory;
 string localDir = aController.FileSystem.LocalDirectory;
VB
Dim remoteDir As String = aController.FileSystem.RemoteDirectory
Dim localDir As String = aController.FileSystem.LocalDirectory
Loading controller files

You can load a file from the controller to the FlexPendant using the GetFile method. An exception is thrown if the operation fails. The arguments are complete paths including filenames.

C#
aController.FileSystem.GetFile(remoteFilePath, localFilePath);
VB
aController.FileSystem.FileSystem.GetFile(remoteFilePath, localFilePath)
Saving files

You can save a file to the controller file system by using the PutFile method. An exception is thrown if the operation fails. The arguments are complete paths including filenames.

C#
aController.FileSystem.PutFile(localFilePath, remoteFilePath);
VB
aController.FileSystem.PutFile(localFilePath, remoteFilePath)
Getting multiple files and directories

The FileSystem class has a method called GetFilesAndDirectories. It can be used to retrieve an array of ControllerFileSystemInfo objects with information about individual files and directories. The ControllerFileSystemInfo object can then be cast to either a ControllerFileInfo object or a ControllerDirectoryInfo object.

The following example uses search pattern to limit the search.

C#
ControllerFileSystemInfo[] anArray;
ControllerFileSystemInfo info;
anArray = aController.FileSystem.GetFilesAndDirectories("search pattern");
for (int i=0;i<anArray.Length;i++)
{

info = anArray[i]
......
}
VB
Dim anArray As ControllerFileSystemInfo()

Dim info As ControllerFileSystemInfo

anArray = aController.FileSystem.GetFilesAndDirectories("search pattern")

Dim I As Integer

For I = 0 To array.Length -1

info = anArray(I)

......

Next
Using search patterns

As seen in the preceding example, you can use search patterns to locate files and directories using the GetFilesAndDirectories method. The matching process uses the Wildcard pattern matching of Visual Studio. The following is a brief summary:

Character in pattern

Matches in string

?

Any single character

*

Zero or more characters

#

Any single digit (0–9)

[]

Any single character in

[!]

Any single character not in

Tip Tip
For more information on classes, methods and properties, see FileSystemDomain in the Reference Manual FlexPendant SDK.