SalQuickFTP
Namespace: PPJ.Runtime.Windows.QO
Assembly: PPJ.Runtime.50 (5.0.0.0)
Exposes FTP connection, listing, and transfers through a Quick Objects control.
- C#
- VB.NET
public class SalQuickFTP : SalCustomControl
Public Class SalQuickFTP
Inherits SalCustomControl
Example:
using PPJ.Runtime.Windows.QO;
var control = new SalQuickFTP();
control.ServerName = "ftp.example.com";
Constructors
SalQuickFTP()
Initializes the FTP compatibility control.
Properties
AppName
String: Gets or sets the application-name compatibility value. (Default: "")
SalQuickHTTP uses it as the user agent when its client is first created. SalQuickFTP stores it without applying it.
FtpClient
SalFtpClient: Gets the lazily created FTP client.
First access sends QOM_ControlCreate and attaches status-message forwarding.
Password
String: Gets or sets the stored FTP password. (Default: "")
Connect receives its own credentials and updates this value after success.
ServerName
String: Gets or sets the stored FTP server name. (Default: "")
Changing it does not connect or reconfigure an active client.
ServerPort
Int32: Gets or sets the stored FTP port. (Default: 21)
Connect receives its own port and updates this value after success.
UserName
String: Gets or sets the stored FTP login name. (Default: "")
Connect receives its own credentials and updates this value after success.
WindowsClassName
String: Gets the fixed native window-class name compatibility value. (Default: "")
Returns an empty string; assignments throw InvalidOperationException.
WindowsDLLName
String: Gets the fixed native library name compatibility value. (Default: "")
Returns an empty string; assignments throw InvalidOperationException.
WindowsExStyle
Int32: Gets the fixed extended native window style compatibility value. (Default: 0)
Returns zero; assignments throw InvalidOperationException.
WindowsStyle
Int32: Gets the fixed native window style compatibility value. (Default: 0)
Returns zero; assignments throw InvalidOperationException.
Methods
CloseFile(hFile)
Accepts the remote-file close compatibility request.
| Parameter | Type | Description |
|---|---|---|
| hFile | SalNumber | Reserved compatibility argument; ignored or unchanged. |
Returns: SalNumber. Zero.
Logs that the operation is unimplemented and leaves all outputs unchanged.
Connect(sServerName, nServerPort, sUserName, sPassword)
Connects and logs in to the requested FTP server.
| Parameter | Type | Description |
|---|---|---|
| sServerName | SalString | The FTP host name or address. |
| nServerPort | SalNumber | The port; nonpositive values select 21. |
| sUserName | SalString | The login name, or empty for anonymous. |
| sPassword | SalString | The password, or empty for the anonymous default. |
Returns: SalNumber. Zero on completion; the negated client error code when a client exception is handled. Cancellation with code zero also returns zero.
Empty credentials use the anonymous defaults. A nonpositive port selects port 21 on the client; stored properties retain supplied values.
CreateDirectory(sDirectory)
Creates a remote directory.
| Parameter | Type | Description |
|---|---|---|
| sDirectory | SalString | The remote directory path. |
Returns: SalNumber. Zero on completion; the negated client error code when a client exception is handled. Cancellation with code zero also returns zero.
Null or empty paths make no change.
DeleteFile(sRemoteFile)
Deletes a remote file.
| Parameter | Type | Description |
|---|---|---|
| sRemoteFile | SalString | The remote file path. |
Returns: SalNumber. Zero on completion; the negated client error code when a client exception is handled. Cancellation with code zero also returns zero.
Handled client errors are retained for the last-error getters.
Disconnect()
Closes the FTP control connection.
Returns: SalNumber. Zero after closing.
Client exceptions from Close propagate.
Dispose(disposing)
Disconnects the FTP client before releasing base control resources.
| Parameter | Type | Description |
|---|---|---|
| disposing | Boolean | Whether managed resources are being disposed. |
EnumDirectories(sSearch, sDirs)
Replaces the output array with matching remote directory names.
| Parameter | Type | Description |
|---|---|---|
| sSearch | SalString | The server-side listing pattern. |
| sDirs | SalArray<SalString> | Receives matching directories in a reset dynamic array. |
Returns: SalNumber. The directory count, or the negated client error code.
EnumFiles(sSearchFile, saFileNames)
Replaces the output array with names from an FTP NLST listing.
| Parameter | Type | Description |
|---|---|---|
| sSearchFile | SalString | The server-side listing pattern. |
| saFileNames | SalArray<SalString> | Receives names in a reset dynamic array. |
Returns: SalNumber. The returned-name count, or the negated client error code.
EnumFilesInfo(sSearchFile, saFileNames, naAttributes, dtaCreationTimes, dtaLastAccessTimes, dtaLastWriteTimes, naFileSizes)
Replaces parallel arrays with remote listing information.
| Parameter | Type | Description |
|---|---|---|
| sSearchFile | SalString | The server-side listing pattern. |
| saFileNames | SalArray<SalString> | Receives names in a reset dynamic array. |
| naAttributes | SalArray<SalNumber> | Receives directory or normal-file attributes. |
| dtaCreationTimes | SalArray<SalDateTime> | Receives DateTime.MinValue for each entry. |
| dtaLastAccessTimes | SalArray<SalDateTime> | Receives listed modification times. |
| dtaLastWriteTimes | SalArray<SalDateTime> | Receives listed modification times. |
| naFileSizes | SalArray<SalNumber> | Receives listed byte sizes. |
Returns: SalNumber. The entry count, or the negated client error code.
Creation times are DateTime.MinValue; access and write times both use the listing modification time. Attributes indicate only directory or normal file.
FindFirstFile(sSearchFile, sFileName)
Starts a listing and selects the first non-directory entry with positive size.
| Parameter | Type | Description |
|---|---|---|
| sSearchFile | SalString | The server-side listing pattern. |
| sFileName | SalString | Receives the matched name when an entry is available. |
Returns: SalNumber. Zero when the output contains a name; ERROR_NO_MORE_FILES if it remains empty; -1 when no eligible entry remains or a client error is handled.
An empty listing leaves the output unchanged; its existing length affects the result.
FindFirstFileInfo(sSearchFile, sFileName, nAttributes, dtCreationTime, dtLastAccessTime, dtLastWriteTime, nFileSize)
Starts a listing and returns its first entry.
| Parameter | Type | Description |
|---|---|---|
| sSearchFile | SalString | The server-side listing pattern. |
| sFileName | SalString | Receives the matched name when an entry is available. |
| nAttributes | SalNumber | Receives directory or normal-file attributes. |
| dtCreationTime | SalDateTime | Receives DateTime.MinValue. |
| dtLastAccessTime | SalDateTime | Receives the listing modification time. |
| dtLastWriteTime | SalDateTime | Receives the listing modification time. |
| nFileSize | SalNumber | Receives the listed byte size. |
Returns: SalNumber. Zero after retrieving the listing, including an empty listing; otherwise the negated client error code.
An empty listing leaves outputs unchanged.
FindNextFile(sFileName)
Returns the next non-directory name from the current listing.
| Parameter | Type | Description |
|---|---|---|
| sFileName | SalString | Receives the matched name when an entry is available. |
Returns: SalNumber. Zero for an entry, or -1 when exhausted.
Requires a listing initialized by FindFirst. Unlike FindFirstFile, zero-length files are not skipped.
FindNextFileInfo(sFileName, nAttributes, dtCreationTime, dtLastAccessTime, dtLastWriteTime, nFileSize)
Returns information for the next current-listing entry.
| Parameter | Type | Description |
|---|---|---|
| sFileName | SalString | Receives the matched name when an entry is available. |
| nAttributes | SalNumber | Receives directory or normal-file attributes. |
| dtCreationTime | SalDateTime | Receives DateTime.MinValue. |
| dtLastAccessTime | SalDateTime | Receives the listing modification time. |
| dtLastWriteTime | SalDateTime | Receives the listing modification time. |
| nFileSize | SalNumber | Receives the listed byte size. |
Returns: SalNumber. Zero for an entry, or -1 if no current entry exists.
GetCurrentDirectory(sDirectory)
Reads the current remote directory into the output string.
| Parameter | Type | Description |
|---|---|---|
| sDirectory | SalString | Receives the current remote directory on success. |
Returns: SalNumber. Zero on completion; the negated client error code when a client exception is handled. Cancellation with code zero also returns zero.
The output is unchanged on a handled client error.
GetFile(sRemoteFile, sLocalFile, bTransferBinary, nContext)
Downloads a remote file with resume enabled.
| Parameter | Type | Description |
|---|---|---|
| sRemoteFile | SalString | The remote file path. |
| sLocalFile | SalString | The local file path. |
| bTransferBinary | SalBoolean | True for binary mode; false for text mode. |
| nContext | SalNumber | Zero to wait; any nonzero value to start asynchronously. |
Returns: SalNumber. Zero on completion; the negated client error code when a client exception is handled. Cancellation with code zero also returns zero.
Sets the transfer mode. A nonzero context starts an asynchronous transfer and returns before completion.
GetLastErrorCode()
Reads the negated code from the last handled FTP exception.
Returns: SalNumber. The stored negated error code.
Successful calls do not clear it.
GetLastErrorMessage()
Reads the last handled FTP exception message.
Returns: SalString. The stored message.
Successful calls do not clear it.
OpenFile(sRemoteFile, nFlags, bFlags)
Accepts the remote-file open compatibility request.
| Parameter | Type | Description |
|---|---|---|
| sRemoteFile | SalString | Reserved compatibility argument; ignored or unchanged. |
| nFlags | SalNumber | Reserved compatibility argument; ignored or unchanged. |
| bFlags | SalBoolean | Reserved compatibility argument; ignored or unchanged. |
Returns: SalNumber. Zero.
Logs that the operation is unimplemented and leaves all outputs unchanged.
PutFile(sLocalFile, sRemoteFile, bBinaryTransfer, nContext)
Uploads a local file, optionally starting asynchronously.
| Parameter | Type | Description |
|---|---|---|
| sLocalFile | SalString | The local file path. |
| sRemoteFile | SalString | The remote file path. |
| bBinaryTransfer | SalBoolean | True for binary mode; false for text mode. |
| nContext | SalNumber | Zero to wait; any nonzero value to start asynchronously. |
Returns: SalNumber. Zero on completion; the negated client error code when a client exception is handled. Cancellation with code zero also returns zero.
Sets the transfer mode, uses the local base name for an empty remote name, and attempts to delete the remote file before upload. A nonzero context only selects asynchronous execution.
ReadFile(hFile, sBuffer, nBufferSize)
Accepts the remote-file read compatibility request.
| Parameter | Type | Description |
|---|---|---|
| hFile | SalNumber | Reserved compatibility argument; ignored or unchanged. |
| sBuffer | SalString | Reserved compatibility argument; ignored or unchanged. |
| nBufferSize | SalNumber | Reserved compatibility argument; ignored or unchanged. |
Returns: SalNumber. Zero.
Logs that the operation is unimplemented and leaves all outputs unchanged.
RemoveDirectory(sDirectory)
Removes a remote directory.
| Parameter | Type | Description |
|---|---|---|
| sDirectory | SalString | The remote directory path. |
Returns: SalNumber. Zero on completion; the negated client error code when a client exception is handled. Cancellation with code zero also returns zero.
Null or empty paths make no change.
RenameFile(sOldRemoteFile, sNewRemoteFile)
Renames a remote file.
| Parameter | Type | Description |
|---|---|---|
| sOldRemoteFile | SalString | The existing remote name. |
| sNewRemoteFile | SalString | The replacement remote name. |
Returns: SalNumber. Zero on completion; the negated client error code when a client exception is handled. Cancellation with code zero also returns zero.
Handled client errors are retained for the last-error getters.
SetBoundsCore(x, y, width, height, specified)
Applies the requested position while fixing the control size at 33 by 33 pixels.
| Parameter | Type | Description |
|---|---|---|
| x | Int32 | The left coordinate. |
| y | Int32 | The top coordinate. |
| width | Int32 | The requested width; replaced with 33. |
| height | Int32 | The requested height; replaced with 33. |
| specified | BoundsSpecified | The bounds components being changed. |
SetCurrentDirectory(sDirectory)
Changes the current remote directory.
| Parameter | Type | Description |
|---|---|---|
| sDirectory | SalString | The remote directory path. |
Returns: SalNumber. Zero on completion; the negated client error code when a client exception is handled. Cancellation with code zero also returns zero.
Null, empty, and dot paths make no change.
WriteFile(hFile, sBuffer, nBufferSize)
Accepts the remote-file write compatibility request.
| Parameter | Type | Description |
|---|---|---|
| hFile | SalNumber | Reserved compatibility argument; ignored or unchanged. |
| sBuffer | SalString | Reserved compatibility argument; ignored or unchanged. |
| nBufferSize | SalNumber | Reserved compatibility argument; ignored or unchanged. |
Returns: SalNumber. Zero.
Logs that the operation is unimplemented and leaves all outputs unchanged.
Implements
| Name | Description |
|---|---|
| ISalWindow | Exposes SAL message dispatch and runtime metadata for child controls, forms, dialogs, and MDI windows. |