File system domain |
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 directoriesYou can access the file system domain through the Controller object property FileSystem .
FileSystem aFileSystem = aController.FileSystem;
Private aFileSystem As FileSystem = aController.FileSystem
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.
string remoteDir = aController.FileSystem.RemoteDirectory; string localDir = aController.FileSystem.LocalDirectory;
Dim remoteDir As String = aController.FileSystem.RemoteDirectory Dim localDir As String = aController.FileSystem.LocalDirectory
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.
aController.FileSystem.GetFile(remoteFilePath, localFilePath);
aController.FileSystem.FileSystem.GetFile(remoteFilePath, localFilePath)
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.
aController.FileSystem.PutFile(localFilePath, remoteFilePath);
aController.FileSystem.PutFile(localFilePath, remoteFilePath)
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.
ControllerFileSystemInfo[] anArray; ControllerFileSystemInfo info; anArray = aController.FileSystem.GetFilesAndDirectories("search pattern"); for (int i=0;i<anArray.Length;i++) { info = anArray[i] ...... }
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
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 |
![]() |
---|
For more information on classes, methods and properties, see FileSystemDomain in the Reference Manual FlexPendant SDK. |