|
Cisco Packet Tracer Extensions API 8.1.0
API for communication between Cisco Packet Tracer application and its extension applications and modules.
|
SystemFileManager provides file IO to the local system. More...
Public Member Functions | |
| QString | getOpenFileName (QString, QString, QString) |
| Prompt the user to select a file to open. It blocks until the user has selected or canceled the dialog. More... | |
| vector< String > | getOpenFileNames (QString, QString, QString) |
| Prompt the user to select one or multiple files to open. It blocks until the user has selected or canceled the dialog. More... | |
| QString | getSelectedDirectory (QString, QString) |
| Prompt the user to select a folder. It blocks until the user has selected or canceled the dialog. More... | |
| QString | getSaveFileName (QString, QString, QString) |
| Prompt the user to select a file to save. It blocks until the user has selected or canceled the dialog. More... | |
| QString | getFileContents (QString) |
| Returns the content of a plain text file. More... | |
| QString | getFileBinaryContents (QString) |
| Returns the content of a binary file in base 64 format. More... | |
| bool | writeTextToFile (QString, QString) |
| Writes plain text content to a file using UTF-8 encoding. More... | |
| bool | writePlainTextToFile (QString, QString) |
| Writes plain text content to a file using UTF-8 encoding. More... | |
| bool | writeBinaryToFile (QString, QString) |
| Writes binary content to a file. More... | |
| int | getFileSize (QString) |
| Returns the size of a file in bytes. More... | |
| QString | getFileCheckSum (QString) |
| Returns the SHA-1 checksum of a file. More... | |
| long | getFileModificationTime (QString) |
| Returns the last modification time of a file in number of seconds that have passed since 1970-01-01T00:00:00 UTC. More... | |
| FilePermissions | getFilePermissions (QString) |
| Returns the permissions of a file. More... | |
| bool | setFilePermissions (QString, FilePermissions) |
| Sets the permissions of a file. More... | |
| bool | copySrcFileToDestFile (QString, QString) |
| Copies a file. More... | |
| bool | moveSrcFileToDestFile (QString, QString, bool) |
| Moves or renames a file. More... | |
| bool | copySrcDirectoryToDestDirectory (QString, QString, bool, FilePermissions) |
| Copies a directory. More... | |
| bool | moveSrcDirectoryToDestDirectory (QString, QString, bool) |
| Moves or renames a directory. More... | |
| bool | zipDirectory (QString) |
| Zips up a directory into a zip file with the same name. More... | |
| bool | zipDirectoryWithPassword (QString, QString) |
| bool | zipDirectoryTo (QString, QString) |
| Zips up a directory into a zip file. More... | |
| bool | zipDirectoryToWithPassword (QString, QString, QString) |
| bool | unzipFile (QString) |
| Unzips up a file in the same directory with the same name. More... | |
| bool | unzipFileWithPassword (QString, QString) |
| bool | unzipFileTo (QString, QString) |
| Unzips up a file in the same directory to a specified directory. More... | |
| bool | unzipFileToWithPassword (QString, QString, QString) |
| QString | encrypt (QString, QString) |
| FOR INTERNAL USE ONLY. Encrypts the string using password. Returns empty string if not internal script module or exapps. More... | |
| QString | decrypt (QString, QString) |
| FOR INTERNAL USE ONLY. Decrypts the data using password. Returns empty string if not internal script module or exapps. More... | |
| QString | encryptBinary (QString, QString) |
| FOR INTERNAL USE ONLY. Encrypts the binary data using password. Returns empty string if not internal script module or exapps. More... | |
| QString | decryptBinary (QString, QString) |
| FOR INTERNAL USE ONLY. Decrypts the data using password. Returns empty string if not internal script module or exapps. More... | |
| QString | getEncryptedFileContents (QString, QString) |
| FOR INTERNAL USE ONLY. Reads and decrypts the file content using password. Returns empty string if not internal script module or exapps. More... | |
| QString | getEncryptedFileBinaryContents (QString, QString) |
| FOR INTERNAL USE ONLY. Reads and decrypts the binary file content using password. Returns empty string if not internal script module or exapps. More... | |
| bool | writeTextToEncryptedFile (QString, QString, QString) |
| FOR INTERNAL USE ONLY. Encrypts the text content using password and writes to file. Returns false if not internal script module or exapps. More... | |
| bool | writeBinaryToEncryptedFile (QString, QString, QString) |
| FOR INTERNAL USE ONLY. Encrypts the binary content using password and writes to file. Returns false if not internal script module or exapps. More... | |
| bool | writeTextToEncryptedLogFile (QString, QString) |
| FOR INTERNAL USE ONLY. Encrypts the text content using same method as PT log file format and writes to file. Returns false if not internal script module or exapps. More... | |
| bool | encryptFile (QString, QString, QString) |
| FOR INTERNAL USE ONLY. Encrypts a file using password and writes to another file. Returns false if not internal script module or exapps. More... | |
| bool | decryptFile (QString, QString, QString) |
| FOR INTERNAL USE ONLY. Decrypts a file using password and writes to another file. Returns false if not internal script module or exapps. More... | |
| bool | makeDirectory (QString) |
| Creates a directory including all missing parents. More... | |
| bool | removeFile (QString) |
| Removes a file. More... | |
| bool | removeDirectory (QString) |
| Removes a directory recursively including all sub directories and files. More... | |
| bool | directoryExists (QString) |
| Returns whether a directory exists. More... | |
| bool | fileExists (QString) |
| Returns whether a file exists. More... | |
| QString | convertToNativeSeparators (QString) |
| Converts a path to native format with native separators. More... | |
| QString | convertFromNativeSeparators (QString) |
| Converts a path to Unix format with Unix separators. More... | |
| bool | isAbsolutePath (QString) |
| Returns whether the path is absolute. More... | |
| bool | isRelativePath (QString) |
| Returns whether the path is relative. More... | |
| QString | getRelativePath (QString, QString) |
| Returns path name of path2 relative to path1. More... | |
| QString | getAbsolutePath (QString) |
| Returns absolute path name. More... | |
| vector< QString > | getFilesInDirectory (QString) |
| Returns a list of files and directory names in a directory. More... | |
| SystemFileWatcher | getFileWatcher () |
| Returns the SystemFileWatcher instance for this Script Module. This is not available for ExApps and will return NULL. More... | |
SystemFileManager provides file IO to the local system.
| QString SystemFileManager::convertFromNativeSeparators | ( | QString | ) |
Converts a path to Unix format with Unix separators.
| path,a | path name |
| QString SystemFileManager::convertToNativeSeparators | ( | QString | ) |
Converts a path to native format with native separators.
| path,a | path name |
| bool SystemFileManager::copySrcDirectoryToDestDirectory | ( | QString | , |
| QString | , | ||
| bool | , | ||
| FilePermissions | |||
| ) |
Copies a directory.
| srcDir,the | full path of the source |
| destDir,the | full path of the destination |
| bReplace,true | if to replace, false otherwise |
| permissions,standard | Unix permissions format |
| bool SystemFileManager::copySrcFileToDestFile | ( | QString | , |
| QString | |||
| ) |
Copies a file.
| srcFile,the | full path of the source |
| destFile,the | full path of the destination |
| QString SystemFileManager::decrypt | ( | QString | , |
| QString | |||
| ) |
FOR INTERNAL USE ONLY. Decrypts the data using password. Returns empty string if not internal script module or exapps.
| data,the | data to be decrypted in base 64 format |
| password,the | password to use to decrypt |
| QString SystemFileManager::decryptBinary | ( | QString | , |
| QString | |||
| ) |
FOR INTERNAL USE ONLY. Decrypts the data using password. Returns empty string if not internal script module or exapps.
| data64,the | data to be decrypted in base 64 format |
| password,the | password to use to decrypt |
| bool SystemFileManager::decryptFile | ( | QString | , |
| QString | , | ||
| QString | |||
| ) |
FOR INTERNAL USE ONLY. Decrypts a file using password and writes to another file. Returns false if not internal script module or exapps.
| srcFile,the | full path to the source file |
| dstFile,the | full path of the destination file |
| password,the | password to use to decrypt |
| bool SystemFileManager::directoryExists | ( | QString | ) |
Returns whether a directory exists.
| path,the | full path of the directory |
| QString SystemFileManager::encrypt | ( | QString | , |
| QString | |||
| ) |
FOR INTERNAL USE ONLY. Encrypts the string using password. Returns empty string if not internal script module or exapps.
| data,the | string to be encrypted |
| password,the | password to use to encrypt |
| QString SystemFileManager::encryptBinary | ( | QString | , |
| QString | |||
| ) |
FOR INTERNAL USE ONLY. Encrypts the binary data using password. Returns empty string if not internal script module or exapps.
| data64,the | binary data to be encrypted in base 64 format |
| password,the | password to use to encrypt |
| bool SystemFileManager::encryptFile | ( | QString | , |
| QString | , | ||
| QString | |||
| ) |
FOR INTERNAL USE ONLY. Encrypts a file using password and writes to another file. Returns false if not internal script module or exapps.
| srcFile,the | full path to the source file |
| dstFile,the | full path of the destination file |
| password,the | password to use to encrypt |
| bool SystemFileManager::fileExists | ( | QString | ) |
Returns whether a file exists.
| path,the | full path of the file |
| QString SystemFileManager::getAbsolutePath | ( | QString | ) |
Returns absolute path name.
| path,a | path anme |
| QString SystemFileManager::getEncryptedFileBinaryContents | ( | QString | , |
| QString | |||
| ) |
FOR INTERNAL USE ONLY. Reads and decrypts the binary file content using password. Returns empty string if not internal script module or exapps.
| filename,the | full path to the file |
| password,the | password to use to decrypt |
| QString SystemFileManager::getEncryptedFileContents | ( | QString | , |
| QString | |||
| ) |
FOR INTERNAL USE ONLY. Reads and decrypts the file content using password. Returns empty string if not internal script module or exapps.
| filename,the | full path to the file |
| password,the | password to use to decrypt |
| QString SystemFileManager::getFileBinaryContents | ( | QString | ) |
Returns the content of a binary file in base 64 format.
| filename,the | full path of the file |
| QString SystemFileManager::getFileCheckSum | ( | QString | ) |
Returns the SHA-1 checksum of a file.
| path,the | full path of the file. |
| QString SystemFileManager::getFileContents | ( | QString | ) |
Returns the content of a plain text file.
| filename,the | full path of the file |
| long SystemFileManager::getFileModificationTime | ( | QString | ) |
Returns the last modification time of a file in number of seconds that have passed since 1970-01-01T00:00:00 UTC.
| path,the | full path of the file. |
| FilePermissions SystemFileManager::getFilePermissions | ( | QString | ) |
Returns the permissions of a file.
| path,the | full path of the file. |
| vector< QString > SystemFileManager::getFilesInDirectory | ( | QString | ) |
Returns a list of files and directory names in a directory.
| path,the | full path of the directory |
| int SystemFileManager::getFileSize | ( | QString | ) |
Returns the size of a file in bytes.
| path,the | full path of the file. |
| SystemFileWatcher SystemFileManager::getFileWatcher | ( | ) |
Returns the SystemFileWatcher instance for this Script Module. This is not available for ExApps and will return NULL.
| QString SystemFileManager::getOpenFileName | ( | QString | , |
| QString | , | ||
| QString | |||
| ) |
Prompt the user to select a file to open. It blocks until the user has selected or canceled the dialog.
| caption,the | title of the open dialog |
| path,the | default full path |
| filter,the | filter of files to show in open dialog in the following format: <filter>[;;<filter[...]]] where each <filter> is in the following format: <name>(*.<extension>[ *.<extension>[...]]) |
example: "Packet Tracer Activity Sequencer File (*.pks *.pksz);;Zip File (*.zip)"
| vector< String > SystemFileManager::getOpenFileNames | ( | QString | , |
| QString | , | ||
| QString | |||
| ) |
Prompt the user to select one or multiple files to open. It blocks until the user has selected or canceled the dialog.
| caption,the | title of the open dialog |
| path,the | default full path |
| filter,the | filter of files to show in open dialog in the following format: <filter>[;;<filter[...]]] where each <filter> is in the following format: <name>(*.<extension>[ *.<extension>[...]]) |
example: "Packet Tracer Activity Sequencer File (*.pks *.pksz);;Zip File (*.zip)"
| QString SystemFileManager::getRelativePath | ( | QString | , |
| QString | |||
| ) |
Returns path name of path2 relative to path1.
| path1,the | full base path name |
| path2,the | full sub path name |
| QString SystemFileManager::getSaveFileName | ( | QString | , |
| QString | , | ||
| QString | |||
| ) |
Prompt the user to select a file to save. It blocks until the user has selected or canceled the dialog.
| caption,the | title of the save dialog |
| path,the | default full path |
| filter,the | filter of files to show in save dialog in the following format: <filter>[;;<filter[...]]] where each <filter> is in the following format: <name>(*.<extension>[ *.<extension>[...]]) |
example: "Packet Tracer Activity Sequencer File (*.pks *.pksz);;Zip File (*.zip)"
| QString SystemFileManager::getSelectedDirectory | ( | QString | , |
| QString | |||
| ) |
Prompt the user to select a folder. It blocks until the user has selected or canceled the dialog.
| caption,the | title of the dialog |
| path,the | default full path |
| bool SystemFileManager::isAbsolutePath | ( | QString | ) |
Returns whether the path is absolute.
| path,a | path name |
| bool SystemFileManager::isRelativePath | ( | QString | ) |
Returns whether the path is relative.
| path,a | path name |
| bool SystemFileManager::makeDirectory | ( | QString | ) |
Creates a directory including all missing parents.
| path,the | full path of the directory |
| bool SystemFileManager::moveSrcDirectoryToDestDirectory | ( | QString | , |
| QString | , | ||
| bool | |||
| ) |
Moves or renames a directory.
| srcDir,the | full path of the source |
| destDir,the | full path of the destination |
| bReplace,true | if to replace, false otherwise |
| bool SystemFileManager::moveSrcFileToDestFile | ( | QString | , |
| QString | , | ||
| bool | |||
| ) |
Moves or renames a file.
| srcFile,the | full path of the source |
| destFile,the | full path of the destination |
| bReplace,true | if to replace, false otherwise |
| bool SystemFileManager::removeDirectory | ( | QString | ) |
Removes a directory recursively including all sub directories and files.
| path,the | full path of the directory |
| bool SystemFileManager::removeFile | ( | QString | ) |
Removes a file.
| path,the | full path of the file |
| bool SystemFileManager::setFilePermissions | ( | QString | , |
| FilePermissions | |||
| ) |
Sets the permissions of a file.
| path,the | full path of the file. |
| int,standard | Unix permissions format |
| bool SystemFileManager::unzipFile | ( | QString | ) |
Unzips up a file in the same directory with the same name.
| filePath,the | full path of the zip file |
| password,the | password to use to decrypt the encrypted zip |
| bool SystemFileManager::unzipFileTo | ( | QString | , |
| QString | |||
| ) |
Unzips up a file in the same directory to a specified directory.
| filePath,the | full path of the zip file |
| dstPath,the | full path of the destination directory |
| password,the | password to use to decrypt the encrypted zip |
| bool SystemFileManager::unzipFileToWithPassword | ( | QString | , |
| QString | , | ||
| QString | |||
| ) |
| bool SystemFileManager::unzipFileWithPassword | ( | QString | , |
| QString | |||
| ) |
| bool SystemFileManager::writeBinaryToEncryptedFile | ( | QString | , |
| QString | , | ||
| QString | |||
| ) |
FOR INTERNAL USE ONLY. Encrypts the binary content using password and writes to file. Returns false if not internal script module or exapps.
| filename,the | full path to the file |
| contents64,the | data in base 64 format |
| password,the | password to use to encrypt |
| bool SystemFileManager::writeBinaryToFile | ( | QString | , |
| QString | |||
| ) |
Writes binary content to a file.
| filename,the | full path of the file. |
| contents64,the | content in base 64 format |
| bool SystemFileManager::writePlainTextToFile | ( | QString | , |
| QString | |||
| ) |
Writes plain text content to a file using UTF-8 encoding.
| filename,the | full path of the file. |
| contents,the | contents |
| bool SystemFileManager::writeTextToEncryptedFile | ( | QString | , |
| QString | , | ||
| QString | |||
| ) |
FOR INTERNAL USE ONLY. Encrypts the text content using password and writes to file. Returns false if not internal script module or exapps.
| filename,the | full path to the file |
| contents,the | text content |
| password,the | password to use to encrypt |
| bool SystemFileManager::writeTextToEncryptedLogFile | ( | QString | , |
| QString | |||
| ) |
FOR INTERNAL USE ONLY. Encrypts the text content using same method as PT log file format and writes to file. Returns false if not internal script module or exapps.
| filename,the | full path to the file |
| contents,the | text content |
| bool SystemFileManager::writeTextToFile | ( | QString | , |
| QString | |||
| ) |
Writes plain text content to a file using UTF-8 encoding.
| filename,the | full path of the file. |
| contents64,the | content in base 64 format |
| bool SystemFileManager::zipDirectory | ( | QString | ) |
Zips up a directory into a zip file with the same name.
| path,the | full path of the directory |
| password,the | password to use to encrypt the zip |
| bool SystemFileManager::zipDirectoryTo | ( | QString | , |
| QString | |||
| ) |
Zips up a directory into a zip file.
| path,the | full path of the directory |
| dstFile,the | full path of the destination zip file |
| password,the | password to use to encrypt the zip |
| bool SystemFileManager::zipDirectoryToWithPassword | ( | QString | , |
| QString | , | ||
| QString | |||
| ) |
| bool SystemFileManager::zipDirectoryWithPassword | ( | QString | , |
| QString | |||
| ) |