unit Chilkat.Scp;

{
  Pascal wrapper for Chilkat Scp.
  Auto-generated by PascalWrapperGenerator -- do not edit manually.
}

{$IFDEF FPC}
  {$MODE DELPHI}
{$ENDIF}

interface

uses
  SysUtils,
  Chilkat.Base;

type

  { TScp wraps CkScp via the C bridge layer. }
  TScp = class(TChilkatBase)
  private
    FOnAbortCheck: TChilkatAbortCheckEvent;
    FOnPercentDone: TChilkatPercentDoneEvent;
    FOnProgressInfo: TChilkatProgressInfoEvent;
    function  GetLastErrorHtml: string;
    function  GetLastErrorText: string;
    function  GetLastErrorXml: string;
    function  GetVersion: string;
    function  GetDebugLogFilePath: string;
    procedure SetDebugLogFilePath(AValue: string);
    function  GetVerboseLogging: Boolean;
    procedure SetVerboseLogging(AValue: Boolean);
    function  GetLastMethodSuccess: Boolean;
    procedure SetLastMethodSuccess(AValue: Boolean);
    function  GetAbortCurrent: Boolean;
    procedure SetAbortCurrent(AValue: Boolean);
    function  GetHeartbeatMs: Integer;
    procedure SetHeartbeatMs(AValue: Integer);
    function  GetPercentDoneScale: Integer;
    procedure SetPercentDoneScale(AValue: Integer);
    function  GetSyncMustMatch: string;
    procedure SetSyncMustMatch(AValue: string);
    function  GetSyncMustMatchDir: string;
    procedure SetSyncMustMatchDir(AValue: string);
    function  GetSyncMustNotMatch: string;
    procedure SetSyncMustNotMatch(AValue: string);
    function  GetSyncMustNotMatchDir: string;
    procedure SetSyncMustNotMatchDir(AValue: string);
    function  GetSyncedFiles: string;
    procedure SetSyncedFiles(AValue: string);
    function  GetUnixPermOverride: string;
    procedure SetUnixPermOverride(AValue: string);
    function  GetUncommonOptions: string;
    procedure SetUncommonOptions(AValue: string);
    function  GetSendEnv: string;
    procedure SetSendEnv(AValue: string);
    procedure SetOnAbortCheck(AValue: TChilkatAbortCheckEvent);
    procedure SetOnPercentDone(AValue: TChilkatPercentDoneEvent);
    procedure SetOnProgressInfo(AValue: TChilkatProgressInfoEvent);
  public
    constructor Create;
    destructor  Destroy; override;

    property LastErrorHtml: string read GetLastErrorHtml;
    property LastErrorText: string read GetLastErrorText;
    property LastErrorXml: string read GetLastErrorXml;
    property Version: string read GetVersion;
    property DebugLogFilePath: string read GetDebugLogFilePath write SetDebugLogFilePath;
    property VerboseLogging: Boolean read GetVerboseLogging write SetVerboseLogging;
    property LastMethodSuccess: Boolean read GetLastMethodSuccess write SetLastMethodSuccess;
    property AbortCurrent: Boolean read GetAbortCurrent write SetAbortCurrent;
    property HeartbeatMs: Integer read GetHeartbeatMs write SetHeartbeatMs;
    property PercentDoneScale: Integer read GetPercentDoneScale write SetPercentDoneScale;
    property SyncMustMatch: string read GetSyncMustMatch write SetSyncMustMatch;
    property SyncMustMatchDir: string read GetSyncMustMatchDir write SetSyncMustMatchDir;
    property SyncMustNotMatch: string read GetSyncMustNotMatch write SetSyncMustNotMatch;
    property SyncMustNotMatchDir: string read GetSyncMustNotMatchDir write SetSyncMustNotMatchDir;
    property SyncedFiles: string read GetSyncedFiles write SetSyncedFiles;
    property UnixPermOverride: string read GetUnixPermOverride write SetUnixPermOverride;
    property UncommonOptions: string read GetUncommonOptions write SetUncommonOptions;
    property SendEnv: string read GetSendEnv write SetSendEnv;

    { Event callbacks.  Return True from OnAbortCheck / OnPercentDone
      to abort the running method.  Callbacks are invoked on the
      thread that called the Chilkat method.  The HeartbeatMs
      property controls the AbortCheck frequency. }
    property OnAbortCheck: TChilkatAbortCheckEvent read FOnAbortCheck write SetOnAbortCheck;
    property OnPercentDone: TChilkatPercentDoneEvent read FOnPercentDone write SetOnPercentDone;
    property OnProgressInfo: TChilkatProgressInfoEvent read FOnProgressInfo write SetOnProgressInfo;

    function  DownloadBinaryEncoded(const remotePath: string; const encoding: string): string;
    function  DownloadFile(const remotePath: string; const localPath: string): Boolean;
    function  DownloadString(const remotePath: string; const charset: string): string;
    function  SyncTreeDownload(const remoteRoot: string; const localRoot: string; mode: Integer; bRecurse: Boolean): Boolean;
    function  SyncTreeUpload(const localBaseDir: string; const remoteBaseDir: string; mode: Integer; bRecurse: Boolean): Boolean;
    function  UploadBinaryEncoded(const remotePath: string; const encodedData: string; const encoding: string): Boolean;
    function  UploadFile(const localPath: string; const remotePath: string): Boolean;
    function  UploadString(const remotePath: string; const textData: string; const charset: string): Boolean;
    function  UseSsh(sshConnection: TChilkatBase): Boolean;
    function  DownloadBd(const remotePath: string; bd: TChilkatBase): Boolean;
    function  UploadBd(const remotePath: string; bd: TChilkatBase): Boolean;
  end;

implementation

uses
  CkDllLoader,
  Chilkat.Utils;

{ ---- C bridge function pointer types ---- }
type
  TCkScp_Create  = function(): Pointer; cdecl;
  TCkScp_Dispose = procedure(handle: Pointer); cdecl;
  TCkBridgeAbortCheckCb   = function(userData: Pointer): Integer; cdecl;
  TCkBridgePercentDoneCb  = function(pctDone: Integer; userData: Pointer): Integer; cdecl;
  TCkBridgeProgressInfoCb = procedure(name: PAnsiChar; value: PAnsiChar; userData: Pointer); cdecl;
  TCkScp_SetAbortCheckCallback   = procedure(handle: Pointer; cb: TCkBridgeAbortCheckCb; userData: Pointer); cdecl;
  TCkScp_SetPercentDoneCallback  = procedure(handle: Pointer; cb: TCkBridgePercentDoneCb; userData: Pointer); cdecl;
  TCkScp_SetProgressInfoCallback = procedure(handle: Pointer; cb: TCkBridgeProgressInfoCb; userData: Pointer); cdecl;
  TCkScp_get_LastErrorHtml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_get_LastErrorText = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_get_LastErrorXml = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_get_Version = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_get_DebugLogFilePath = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_put_DebugLogFilePath = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkScp_get_VerboseLogging = function(handle: Pointer): LongBool; cdecl;
  TCkScp_put_VerboseLogging = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkScp_get_LastMethodSuccess = function(handle: Pointer): LongBool; cdecl;
  TCkScp_put_LastMethodSuccess = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkScp_get_AbortCurrent = function(handle: Pointer): LongBool; cdecl;
  TCkScp_put_AbortCurrent = procedure(handle: Pointer; value: LongBool); cdecl;
  TCkScp_get_HeartbeatMs = function(handle: Pointer): Integer; cdecl;
  TCkScp_put_HeartbeatMs = procedure(handle: Pointer; value: Integer); cdecl;
  TCkScp_get_PercentDoneScale = function(handle: Pointer): Integer; cdecl;
  TCkScp_put_PercentDoneScale = procedure(handle: Pointer; value: Integer); cdecl;
  TCkScp_get_SyncMustMatch = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_put_SyncMustMatch = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkScp_get_SyncMustMatchDir = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_put_SyncMustMatchDir = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkScp_get_SyncMustNotMatch = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_put_SyncMustNotMatch = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkScp_get_SyncMustNotMatchDir = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_put_SyncMustNotMatchDir = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkScp_get_SyncedFiles = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_put_SyncedFiles = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkScp_get_UnixPermOverride = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_put_UnixPermOverride = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkScp_get_UncommonOptions = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_put_UncommonOptions = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkScp_get_SendEnv = function(handle: Pointer): PAnsiChar; cdecl;
  TCkScp_put_SendEnv = procedure(handle: Pointer; value: PAnsiChar); cdecl;
  TCkScp_DownloadBinaryEncoded = function(handle: Pointer; remotePath: PAnsiChar; encoding: PAnsiChar): PAnsiChar; cdecl;
  TCkScp_DownloadFile = function(handle: Pointer; remotePath: PAnsiChar; localPath: PAnsiChar): LongBool; cdecl;
  TCkScp_DownloadString = function(handle: Pointer; remotePath: PAnsiChar; charset: PAnsiChar): PAnsiChar; cdecl;
  TCkScp_SyncTreeDownload = function(handle: Pointer; remoteRoot: PAnsiChar; localRoot: PAnsiChar; mode: Integer; bRecurse: LongBool): LongBool; cdecl;
  TCkScp_SyncTreeUpload = function(handle: Pointer; localBaseDir: PAnsiChar; remoteBaseDir: PAnsiChar; mode: Integer; bRecurse: LongBool): LongBool; cdecl;
  TCkScp_UploadBinaryEncoded = function(handle: Pointer; remotePath: PAnsiChar; encodedData: PAnsiChar; encoding: PAnsiChar): LongBool; cdecl;
  TCkScp_UploadFile = function(handle: Pointer; localPath: PAnsiChar; remotePath: PAnsiChar): LongBool; cdecl;
  TCkScp_UploadString = function(handle: Pointer; remotePath: PAnsiChar; textData: PAnsiChar; charset: PAnsiChar): LongBool; cdecl;
  TCkScp_UseSsh = function(handle: Pointer; sshConnection: Pointer): LongBool; cdecl;
  TCkScp_DownloadBd = function(handle: Pointer; remotePath: PAnsiChar; bd: Pointer): LongBool; cdecl;
  TCkScp_UploadBd = function(handle: Pointer; remotePath: PAnsiChar; bd: Pointer): LongBool; cdecl;

{ ---- C bridge function pointer variables ---- }
var
  CkScp_Create:  TCkScp_Create  = nil;
  CkScp_Dispose: TCkScp_Dispose = nil;
  CkScp_SetAbortCheckCallback:   TCkScp_SetAbortCheckCallback   = nil;
  CkScp_SetPercentDoneCallback:  TCkScp_SetPercentDoneCallback  = nil;
  CkScp_SetProgressInfoCallback: TCkScp_SetProgressInfoCallback = nil;
  CkScp_get_LastErrorHtml: TCkScp_get_LastErrorHtml = nil;
  CkScp_get_LastErrorText: TCkScp_get_LastErrorText = nil;
  CkScp_get_LastErrorXml: TCkScp_get_LastErrorXml = nil;
  CkScp_get_Version: TCkScp_get_Version = nil;
  CkScp_get_DebugLogFilePath: TCkScp_get_DebugLogFilePath = nil;
  CkScp_put_DebugLogFilePath: TCkScp_put_DebugLogFilePath = nil;
  CkScp_get_VerboseLogging: TCkScp_get_VerboseLogging = nil;
  CkScp_put_VerboseLogging: TCkScp_put_VerboseLogging = nil;
  CkScp_get_LastMethodSuccess: TCkScp_get_LastMethodSuccess = nil;
  CkScp_put_LastMethodSuccess: TCkScp_put_LastMethodSuccess = nil;
  CkScp_get_AbortCurrent: TCkScp_get_AbortCurrent = nil;
  CkScp_put_AbortCurrent: TCkScp_put_AbortCurrent = nil;
  CkScp_get_HeartbeatMs: TCkScp_get_HeartbeatMs = nil;
  CkScp_put_HeartbeatMs: TCkScp_put_HeartbeatMs = nil;
  CkScp_get_PercentDoneScale: TCkScp_get_PercentDoneScale = nil;
  CkScp_put_PercentDoneScale: TCkScp_put_PercentDoneScale = nil;
  CkScp_get_SyncMustMatch: TCkScp_get_SyncMustMatch = nil;
  CkScp_put_SyncMustMatch: TCkScp_put_SyncMustMatch = nil;
  CkScp_get_SyncMustMatchDir: TCkScp_get_SyncMustMatchDir = nil;
  CkScp_put_SyncMustMatchDir: TCkScp_put_SyncMustMatchDir = nil;
  CkScp_get_SyncMustNotMatch: TCkScp_get_SyncMustNotMatch = nil;
  CkScp_put_SyncMustNotMatch: TCkScp_put_SyncMustNotMatch = nil;
  CkScp_get_SyncMustNotMatchDir: TCkScp_get_SyncMustNotMatchDir = nil;
  CkScp_put_SyncMustNotMatchDir: TCkScp_put_SyncMustNotMatchDir = nil;
  CkScp_get_SyncedFiles: TCkScp_get_SyncedFiles = nil;
  CkScp_put_SyncedFiles: TCkScp_put_SyncedFiles = nil;
  CkScp_get_UnixPermOverride: TCkScp_get_UnixPermOverride = nil;
  CkScp_put_UnixPermOverride: TCkScp_put_UnixPermOverride = nil;
  CkScp_get_UncommonOptions: TCkScp_get_UncommonOptions = nil;
  CkScp_put_UncommonOptions: TCkScp_put_UncommonOptions = nil;
  CkScp_get_SendEnv: TCkScp_get_SendEnv = nil;
  CkScp_put_SendEnv: TCkScp_put_SendEnv = nil;
  CkScp_DownloadBinaryEncoded: TCkScp_DownloadBinaryEncoded = nil;
  CkScp_DownloadFile: TCkScp_DownloadFile = nil;
  CkScp_DownloadString: TCkScp_DownloadString = nil;
  CkScp_SyncTreeDownload: TCkScp_SyncTreeDownload = nil;
  CkScp_SyncTreeUpload: TCkScp_SyncTreeUpload = nil;
  CkScp_UploadBinaryEncoded: TCkScp_UploadBinaryEncoded = nil;
  CkScp_UploadFile: TCkScp_UploadFile = nil;
  CkScp_UploadString: TCkScp_UploadString = nil;
  CkScp_UseSsh: TCkScp_UseSsh = nil;
  CkScp_DownloadBd: TCkScp_DownloadBd = nil;
  CkScp_UploadBd: TCkScp_UploadBd = nil;

constructor TScp.Create;
begin
  inherited Create;
  FHandle := CkScp_Create();
end;

destructor TScp.Destroy;
begin
  if FHandle <> nil then
    CkScp_Dispose(FHandle);
  FHandle := nil;
  inherited;
end;

{ ---- Event callback thunks ---- }
{ Standalone cdecl functions registered with the C bridge.  The bridge
  passes back the userData pointer, which carries the Pascal object
  instance.  A non-zero return value aborts the running method. }

function TScp_AbortCheckThunk(userData: Pointer): Integer; cdecl;
var
  obj: TScp;
begin
  Result := 0;
  obj := TScp(userData);
  if Assigned(obj) and Assigned(obj.FOnAbortCheck) then
    if obj.FOnAbortCheck(obj) then Result := 1;
end;

function TScp_PercentDoneThunk(pctDone: Integer; userData: Pointer): Integer; cdecl;
var
  obj: TScp;
begin
  Result := 0;
  obj := TScp(userData);
  if Assigned(obj) and Assigned(obj.FOnPercentDone) then
    if obj.FOnPercentDone(obj, pctDone) then Result := 1;
end;

procedure TScp_ProgressInfoThunk(name: PAnsiChar; value: PAnsiChar; userData: Pointer); cdecl;
var
  obj: TScp;
begin
  obj := TScp(userData);
  if Assigned(obj) and Assigned(obj.FOnProgressInfo) then
    obj.FOnProgressInfo(obj, CkToStr(name), CkToStr(value));
end;

procedure TScp.SetOnAbortCheck(AValue: TChilkatAbortCheckEvent);
begin
  FOnAbortCheck := AValue;
  if Assigned(AValue) then
    CkScp_SetAbortCheckCallback(FHandle, @TScp_AbortCheckThunk, Self)
  else
    CkScp_SetAbortCheckCallback(FHandle, nil, nil);
end;

procedure TScp.SetOnPercentDone(AValue: TChilkatPercentDoneEvent);
begin
  FOnPercentDone := AValue;
  if Assigned(AValue) then
    CkScp_SetPercentDoneCallback(FHandle, @TScp_PercentDoneThunk, Self)
  else
    CkScp_SetPercentDoneCallback(FHandle, nil, nil);
end;

procedure TScp.SetOnProgressInfo(AValue: TChilkatProgressInfoEvent);
begin
  FOnProgressInfo := AValue;
  if Assigned(AValue) then
    CkScp_SetProgressInfoCallback(FHandle, @TScp_ProgressInfoThunk, Self)
  else
    CkScp_SetProgressInfoCallback(FHandle, nil, nil);
end;

function TScp.GetLastErrorHtml: string;
begin
  Result := CkToStr(CkScp_get_LastErrorHtml(FHandle));
end;

function TScp.GetLastErrorText: string;
begin
  Result := CkToStr(CkScp_get_LastErrorText(FHandle));
end;

function TScp.GetLastErrorXml: string;
begin
  Result := CkToStr(CkScp_get_LastErrorXml(FHandle));
end;

function TScp.GetVersion: string;
begin
  Result := CkToStr(CkScp_get_Version(FHandle));
end;

function TScp.GetDebugLogFilePath: string;
begin
  Result := CkToStr(CkScp_get_DebugLogFilePath(FHandle));
end;

procedure TScp.SetDebugLogFilePath(AValue: string);
begin
  CkScp_put_DebugLogFilePath(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TScp.GetVerboseLogging: Boolean;
begin
  Result := Boolean(CkScp_get_VerboseLogging(FHandle));
end;

procedure TScp.SetVerboseLogging(AValue: Boolean);
begin
  CkScp_put_VerboseLogging(FHandle, LongBool(AValue));
end;

function TScp.GetLastMethodSuccess: Boolean;
begin
  Result := Boolean(CkScp_get_LastMethodSuccess(FHandle));
end;

procedure TScp.SetLastMethodSuccess(AValue: Boolean);
begin
  CkScp_put_LastMethodSuccess(FHandle, LongBool(AValue));
end;

function TScp.GetAbortCurrent: Boolean;
begin
  Result := Boolean(CkScp_get_AbortCurrent(FHandle));
end;

procedure TScp.SetAbortCurrent(AValue: Boolean);
begin
  CkScp_put_AbortCurrent(FHandle, LongBool(AValue));
end;

function TScp.GetHeartbeatMs: Integer;
begin
  Result := CkScp_get_HeartbeatMs(FHandle);
end;

procedure TScp.SetHeartbeatMs(AValue: Integer);
begin
  CkScp_put_HeartbeatMs(FHandle, AValue);
end;

function TScp.GetPercentDoneScale: Integer;
begin
  Result := CkScp_get_PercentDoneScale(FHandle);
end;

procedure TScp.SetPercentDoneScale(AValue: Integer);
begin
  CkScp_put_PercentDoneScale(FHandle, AValue);
end;

function TScp.GetSyncMustMatch: string;
begin
  Result := CkToStr(CkScp_get_SyncMustMatch(FHandle));
end;

procedure TScp.SetSyncMustMatch(AValue: string);
begin
  CkScp_put_SyncMustMatch(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TScp.GetSyncMustMatchDir: string;
begin
  Result := CkToStr(CkScp_get_SyncMustMatchDir(FHandle));
end;

procedure TScp.SetSyncMustMatchDir(AValue: string);
begin
  CkScp_put_SyncMustMatchDir(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TScp.GetSyncMustNotMatch: string;
begin
  Result := CkToStr(CkScp_get_SyncMustNotMatch(FHandle));
end;

procedure TScp.SetSyncMustNotMatch(AValue: string);
begin
  CkScp_put_SyncMustNotMatch(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TScp.GetSyncMustNotMatchDir: string;
begin
  Result := CkToStr(CkScp_get_SyncMustNotMatchDir(FHandle));
end;

procedure TScp.SetSyncMustNotMatchDir(AValue: string);
begin
  CkScp_put_SyncMustNotMatchDir(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TScp.GetSyncedFiles: string;
begin
  Result := CkToStr(CkScp_get_SyncedFiles(FHandle));
end;

procedure TScp.SetSyncedFiles(AValue: string);
begin
  CkScp_put_SyncedFiles(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TScp.GetUnixPermOverride: string;
begin
  Result := CkToStr(CkScp_get_UnixPermOverride(FHandle));
end;

procedure TScp.SetUnixPermOverride(AValue: string);
begin
  CkScp_put_UnixPermOverride(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TScp.GetUncommonOptions: string;
begin
  Result := CkToStr(CkScp_get_UncommonOptions(FHandle));
end;

procedure TScp.SetUncommonOptions(AValue: string);
begin
  CkScp_put_UncommonOptions(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TScp.GetSendEnv: string;
begin
  Result := CkToStr(CkScp_get_SendEnv(FHandle));
end;

procedure TScp.SetSendEnv(AValue: string);
begin
  CkScp_put_SendEnv(FHandle, PAnsiChar(StrToCk(AValue)));
end;

function TScp.DownloadBinaryEncoded(const remotePath: string; const encoding: string): string;
begin
  Result := CkToStr(CkScp_DownloadBinaryEncoded(FHandle, PAnsiChar(StrToCk(remotePath)), PAnsiChar(StrToCk(encoding))));
end;

function TScp.DownloadFile(const remotePath: string; const localPath: string): Boolean;
begin
  Result := Boolean(CkScp_DownloadFile(FHandle, PAnsiChar(StrToCk(remotePath)), PAnsiChar(StrToCk(localPath))));
end;

function TScp.DownloadString(const remotePath: string; const charset: string): string;
begin
  Result := CkToStr(CkScp_DownloadString(FHandle, PAnsiChar(StrToCk(remotePath)), PAnsiChar(StrToCk(charset))));
end;

function TScp.SyncTreeDownload(const remoteRoot: string; const localRoot: string; mode: Integer; bRecurse: Boolean): Boolean;
begin
  Result := Boolean(CkScp_SyncTreeDownload(FHandle, PAnsiChar(StrToCk(remoteRoot)), PAnsiChar(StrToCk(localRoot)), mode, LongBool(bRecurse)));
end;

function TScp.SyncTreeUpload(const localBaseDir: string; const remoteBaseDir: string; mode: Integer; bRecurse: Boolean): Boolean;
begin
  Result := Boolean(CkScp_SyncTreeUpload(FHandle, PAnsiChar(StrToCk(localBaseDir)), PAnsiChar(StrToCk(remoteBaseDir)), mode, LongBool(bRecurse)));
end;

function TScp.UploadBinaryEncoded(const remotePath: string; const encodedData: string; const encoding: string): Boolean;
begin
  Result := Boolean(CkScp_UploadBinaryEncoded(FHandle, PAnsiChar(StrToCk(remotePath)), PAnsiChar(StrToCk(encodedData)), PAnsiChar(StrToCk(encoding))));
end;

function TScp.UploadFile(const localPath: string; const remotePath: string): Boolean;
begin
  Result := Boolean(CkScp_UploadFile(FHandle, PAnsiChar(StrToCk(localPath)), PAnsiChar(StrToCk(remotePath))));
end;

function TScp.UploadString(const remotePath: string; const textData: string; const charset: string): Boolean;
begin
  Result := Boolean(CkScp_UploadString(FHandle, PAnsiChar(StrToCk(remotePath)), PAnsiChar(StrToCk(textData)), PAnsiChar(StrToCk(charset))));
end;

function TScp.UseSsh(sshConnection: TChilkatBase): Boolean;
begin
  Result := Boolean(CkScp_UseSsh(FHandle, sshConnection.Handle));
end;

function TScp.DownloadBd(const remotePath: string; bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkScp_DownloadBd(FHandle, PAnsiChar(StrToCk(remotePath)), bd.Handle));
end;

function TScp.UploadBd(const remotePath: string; bd: TChilkatBase): Boolean;
begin
  Result := Boolean(CkScp_UploadBd(FHandle, PAnsiChar(StrToCk(remotePath)), bd.Handle));
end;

initialization
  Chilkat_GetProcedureAddress(CkScp_Create,  'CkScp_Create');
  Chilkat_GetProcedureAddress(CkScp_Dispose, 'CkScp_Dispose');
  Chilkat_GetProcedureAddress(CkScp_SetAbortCheckCallback, 'CkScp_SetAbortCheckCallback');
  Chilkat_GetProcedureAddress(CkScp_SetPercentDoneCallback, 'CkScp_SetPercentDoneCallback');
  Chilkat_GetProcedureAddress(CkScp_SetProgressInfoCallback, 'CkScp_SetProgressInfoCallback');
  Chilkat_GetProcedureAddress(CkScp_get_LastErrorHtml, 'CkScp_get_LastErrorHtml');
  Chilkat_GetProcedureAddress(CkScp_get_LastErrorText, 'CkScp_get_LastErrorText');
  Chilkat_GetProcedureAddress(CkScp_get_LastErrorXml, 'CkScp_get_LastErrorXml');
  Chilkat_GetProcedureAddress(CkScp_get_Version, 'CkScp_get_Version');
  Chilkat_GetProcedureAddress(CkScp_get_DebugLogFilePath, 'CkScp_get_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkScp_put_DebugLogFilePath, 'CkScp_put_DebugLogFilePath');
  Chilkat_GetProcedureAddress(CkScp_get_VerboseLogging, 'CkScp_get_VerboseLogging');
  Chilkat_GetProcedureAddress(CkScp_put_VerboseLogging, 'CkScp_put_VerboseLogging');
  Chilkat_GetProcedureAddress(CkScp_get_LastMethodSuccess, 'CkScp_get_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkScp_put_LastMethodSuccess, 'CkScp_put_LastMethodSuccess');
  Chilkat_GetProcedureAddress(CkScp_get_AbortCurrent, 'CkScp_get_AbortCurrent');
  Chilkat_GetProcedureAddress(CkScp_put_AbortCurrent, 'CkScp_put_AbortCurrent');
  Chilkat_GetProcedureAddress(CkScp_get_HeartbeatMs, 'CkScp_get_HeartbeatMs');
  Chilkat_GetProcedureAddress(CkScp_put_HeartbeatMs, 'CkScp_put_HeartbeatMs');
  Chilkat_GetProcedureAddress(CkScp_get_PercentDoneScale, 'CkScp_get_PercentDoneScale');
  Chilkat_GetProcedureAddress(CkScp_put_PercentDoneScale, 'CkScp_put_PercentDoneScale');
  Chilkat_GetProcedureAddress(CkScp_get_SyncMustMatch, 'CkScp_get_SyncMustMatch');
  Chilkat_GetProcedureAddress(CkScp_put_SyncMustMatch, 'CkScp_put_SyncMustMatch');
  Chilkat_GetProcedureAddress(CkScp_get_SyncMustMatchDir, 'CkScp_get_SyncMustMatchDir');
  Chilkat_GetProcedureAddress(CkScp_put_SyncMustMatchDir, 'CkScp_put_SyncMustMatchDir');
  Chilkat_GetProcedureAddress(CkScp_get_SyncMustNotMatch, 'CkScp_get_SyncMustNotMatch');
  Chilkat_GetProcedureAddress(CkScp_put_SyncMustNotMatch, 'CkScp_put_SyncMustNotMatch');
  Chilkat_GetProcedureAddress(CkScp_get_SyncMustNotMatchDir, 'CkScp_get_SyncMustNotMatchDir');
  Chilkat_GetProcedureAddress(CkScp_put_SyncMustNotMatchDir, 'CkScp_put_SyncMustNotMatchDir');
  Chilkat_GetProcedureAddress(CkScp_get_SyncedFiles, 'CkScp_get_SyncedFiles');
  Chilkat_GetProcedureAddress(CkScp_put_SyncedFiles, 'CkScp_put_SyncedFiles');
  Chilkat_GetProcedureAddress(CkScp_get_UnixPermOverride, 'CkScp_get_UnixPermOverride');
  Chilkat_GetProcedureAddress(CkScp_put_UnixPermOverride, 'CkScp_put_UnixPermOverride');
  Chilkat_GetProcedureAddress(CkScp_get_UncommonOptions, 'CkScp_get_UncommonOptions');
  Chilkat_GetProcedureAddress(CkScp_put_UncommonOptions, 'CkScp_put_UncommonOptions');
  Chilkat_GetProcedureAddress(CkScp_get_SendEnv, 'CkScp_get_SendEnv');
  Chilkat_GetProcedureAddress(CkScp_put_SendEnv, 'CkScp_put_SendEnv');
  Chilkat_GetProcedureAddress(CkScp_DownloadBinaryEncoded, 'CkScp_DownloadBinaryEncoded');
  Chilkat_GetProcedureAddress(CkScp_DownloadFile, 'CkScp_DownloadFile');
  Chilkat_GetProcedureAddress(CkScp_DownloadString, 'CkScp_DownloadString');
  Chilkat_GetProcedureAddress(CkScp_SyncTreeDownload, 'CkScp_SyncTreeDownload');
  Chilkat_GetProcedureAddress(CkScp_SyncTreeUpload, 'CkScp_SyncTreeUpload');
  Chilkat_GetProcedureAddress(CkScp_UploadBinaryEncoded, 'CkScp_UploadBinaryEncoded');
  Chilkat_GetProcedureAddress(CkScp_UploadFile, 'CkScp_UploadFile');
  Chilkat_GetProcedureAddress(CkScp_UploadString, 'CkScp_UploadString');
  Chilkat_GetProcedureAddress(CkScp_UseSsh, 'CkScp_UseSsh');
  Chilkat_GetProcedureAddress(CkScp_DownloadBd, 'CkScp_DownloadBd');
  Chilkat_GetProcedureAddress(CkScp_UploadBd, 'CkScp_UploadBd');

end.
