Save, load and delete job files. Also, lists and counts files.
Parameter RS7 must be set to 2 to allow these functions outside of REMOTE mode.
Name | Description |
---|---|
LoadToControllerFromString | Load a job file to the controller from a string. |
LoadToControllerFromPath | Load a job file to the controller from a file path. |
SaveFromControllerToFile | Save a job file from the controller to a file path. |
SaveFromControllerToString | Save a job file from the controller to a string. |
DeleteJobFile | Delete a job file from the controller. |
GetFileCount | Get the number of files on the controller. |
ListFiles | List the files on the controller. |
Load a file to the controller from a string.
Parameter RS7 must be set to 2 to allow this function outside of REMOTE mode.
Load a file to the controller from a file path.
The following file types are writable...
StatusInfo LoadToControllerFromString(string fileName, string contentsToLoad);
fileName
[in] The name of the file to load.
contentsToLoad
[in] A string containing the contents for the file.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.Files.LoadToControllerFromString("FILENAME.JBI", "FILE CONTENTS");
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
Load a file to the controller from a file path.
The following file types are writable...
StatusInfo LoadToControllerFromPath(string filePath);
filePath
[in] The file path on your system to the file to load.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.Files.LoadToControllerFromPath("path\\to\\file");
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo SaveFromControllerToFile(string fileName, string destinationFile, bool overwriteFlag = false);
fileName
[in] The name of the file to save.
destinationFile
[in] The file path on your system to save the file to.
overwriteFlag
[in] If true, the file will be overwritten if it already exists.
If false and the file exists, the function will fail.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.Files.SaveFromControllerToFile("TESTJOB.JBI", "PATH\\TO\\FILE");
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
Save a file from the controller to a string.
StatusInfo SaveFromControllerToString(string fileName, out string fileContents);
fileName
[in] The name of the file to save.
fileContents
[out] A string containing the contents of the file.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.Files.SaveFromControllerToString("TESTJOB.JBI", out string jobContents);
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo DeleteJobFile(string fileName);
fileName
[in] The name of the file to delete.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.Files.DeleteJobFile("TESTJOB.JBI");
Console.WriteLine(status);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
StatusInfo GetFileCount(FileType fileType, out Int32 fileCount);
fileType
[in] The type of file to count. See FileType.
fileCount
[out] The number of files on the controller.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.Files.GetFileCount(FileType.Job_JBI, out Int32 count);
Console.WriteLine(status);
Console.WriteLine(count);
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Output
Code (0): OK
5
StatusInfo ListFiles(FileType fileType, out List<string> fileNames, bool sorted);
fileType
[in] The type of file to list. See FileType.
fileNames
[out] A vector of strings containing the file names.
sorted
[in] If true, the file names will be sorted alphabetically.
A StatusInfo object indicating if the operation was successful.
//`c` is a MotomanController object that has been created with ` YMConnect.OpenConnection`
status = c.Files.ListFiles(FileType.Job_JBI, out List<string> fileList, true);
Console.WriteLine(status);
foreach (string file in fileList)
{
Console.WriteLine(file);
}
//be sure to close `c` with `YMConnect.CloseConnection` when the application is done
Code (0): OK
MASTER.JBI
TEST1.JBI
TEST2.JBI
TEST3.JBI
TEST4.JBI