-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathtgputtycbsftpclient.h
141 lines (124 loc) · 7 KB
/
tgputtycbsftpclient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//---------------------------------------------------------------------------
#ifndef tgputtycbsftpclientH
#define tgputtycbsftpclientH
//---------------------------------------------------------------------------
#include <System.SysUtils.hpp>
#include <System.Classes.hpp>
#ifndef SUPPORTDELPHISTREAMS
#define SUPPORTDELPHISTREAMS
#endif
#include "ctgputtylib.h"
#include "tgputtylibcbclass.h"
//---------------------------------------------------------------------------
struct TSFTPItem
{
public:
System::UnicodeString filename;
System::UnicodeString longname;
fxp_attrs attrs;
};
class TSFTPItems : public TObject
{
public:
System::DynamicArray<TSFTPItem> SFTPItems;
};
class TSFTPProgressInfo : public TObject
{
public:
__int64 bytescopied;
bool isupload;
};
typedef void __fastcall (__closure *TOnSFTPMessage)(System::TObject* Sender, const System::UnicodeString Msg, const bool isstderr);
typedef bool __fastcall (__closure *TOnSFTPProgress)(System::TObject* Sender, const TSFTPProgressInfo *ProgressInfo);
typedef bool __fastcall (__closure *TOnSFTPListing)(System::TObject* Sender, const TSFTPItems *Items);
typedef bool __fastcall (__closure *TOnSFTPGetInput)(System::TObject* Sender, System::UnicodeString &AnInput);
typedef bool __fastcall (__closure *TOnSFTPVerifyHostKey)(System::TObject* Sender, const System::UnicodeString host, const int port, const System::UnicodeString fingerprint, const int verificationstatus, bool &storehostkey);
class PACKAGE TTGPuttyCBSFTPClient : public TComponent
{
private:
TTGPuttySFTP *FTGPuttySFTP;
TOnSFTPMessage FOnSFTPMessage;
TOnSFTPListing FOnSFTPListing;
TOnSFTPGetInput FOnSFTPGetInput;
TOnSFTPProgress FOnSFTPProgress;
TOnSFTPVerifyHostKey FOnSFTPVerifyHostKey;
bool DoVerifyHostKey(const char* host, const int port,
const char * fingerprint, const int verificationstatus,
bool &storehostkey);
void DoMessage(const char* Msg, const bool isstderr);
bool DoProgress(const __int64 bytescopied, const bool isupload);
bool DoListing(const struct fxp_names* names);
bool DoGetInput(char* linebuf, const int maxchars);
bool __fastcall GetConnected();
int __fastcall GetErrorCode();
System::UnicodeString __fastcall GetErrorMessage();
System::UnicodeString __fastcall GetHomeDir();
System::UnicodeString __fastcall GetHostName();
System::UnicodeString __fastcall GetKeyPassword();
System::UnicodeString __fastcall GetLastMessages();
System::UnicodeString __fastcall GetLibVersion();
System::UnicodeString __fastcall GetPassword();
int __fastcall GetPort();
System::UnicodeString __fastcall GetUserName();
bool __fastcall GetVerbose();
System::UnicodeString __fastcall GetWorkDir();
void __fastcall SetHostName(const System::UnicodeString Value);
void __fastcall SetKeyfile(const System::UnicodeString Value);
void __fastcall SetKeyPassword(const System::UnicodeString Value);
void __fastcall SetLastMessages(const System::UnicodeString Value);
void __fastcall SetPassword(const System::UnicodeString Value);
void __fastcall Set_Port(const int Value);
void __fastcall SetUserName(const System::UnicodeString Value);
void __fastcall SetVerbose(const bool Value);
int __fastcall GetTimeoutTicks() { return FTGPuttySFTP->TimeoutTicks; }
void __fastcall SetTimeoutTicks(const int Value) { FTGPuttySFTP->TimeoutTicks=Value; }
int __fastcall GetConnectionTimeoutTicks() { return FTGPuttySFTP->ConnectionTimeoutTicks; }
void __fastcall SetConnectionTimeoutTicks(const int Value) { FTGPuttySFTP->ConnectionTimeoutTicks=Value; }
bool __fastcall GetAborted() { return FTGPuttySFTP->Aborted; }
void __fastcall SetAborted(const bool Value) { FTGPuttySFTP->Aborted=Value; }
protected:
public:
__fastcall TTGPuttyCBSFTPClient(TComponent* Owner);
__fastcall virtual ~TTGPuttyCBSFTPClient();
void __fastcall Connect();
void __fastcall Disconnect();
void __fastcall ChangeDir(const System::UnicodeString ADirectory);
void __fastcall MakeDir(const System::UnicodeString ADirectory);
void __fastcall RemoveDir(const System::UnicodeString ADirectory);
void __fastcall ListDir(const System::UnicodeString ADirectory);
void __fastcall GetStat(const System::UnicodeString AFileName, fxp_attrs &Attrs);
void __fastcall SetStat(const System::UnicodeString AFileName, fxp_attrs &Attrs);
void __fastcall SetModifiedDate(const System::UnicodeString AFileName, const System::TDateTime ATimestamp, const bool isUTC);
void __fastcall SetFileSize(const System::UnicodeString AFileName, const __int64 ASize);
void __fastcall Move(const System::UnicodeString AFromName, const System::UnicodeString AToName);
void __fastcall Delete_File(const System::UnicodeString AName);
void __fastcall UploadFile(const System::UnicodeString ALocalFilename, const System::UnicodeString ARemoteFilename, const bool anAppend);
void __fastcall DownloadFile(const System::UnicodeString ARemoteFilename, const System::UnicodeString ALocalFilename, const bool anAppend);
void __fastcall UploadStream(const System::UnicodeString ARemoteFilename, System::Classes::TStream* const AStream, const bool anAppend);
void __fastcall DownloadStream(const System::UnicodeString ARemoteFilename, System::Classes::TStream* const AStream, const bool anAppend);
__property System::UnicodeString HomeDir = {read=GetHomeDir};
__property System::UnicodeString WorkDir = {read=GetWorkDir};
__property System::UnicodeString LibVersion = {read=GetLibVersion};
__property bool Connected = {read=GetConnected, nodefault};
__property System::UnicodeString Keyfile = {write=SetKeyfile};
__property System::UnicodeString LastMessages = {read=GetLastMessages, write=SetLastMessages};
__property int ErrorCode = {read=GetErrorCode, nodefault};
__property System::UnicodeString ErrorMessage = {read=GetErrorMessage};
__property bool Aborted = {read=GetAborted, write=SetAborted};
__published:
__property System::UnicodeString HostName = {read=GetHostName, write=SetHostName};
__property System::UnicodeString UserName = {read=GetUserName, write=SetUserName};
__property int Port = {read=GetPort, write=Set_Port, nodefault};
__property System::UnicodeString Password = {read=GetPassword, write=SetPassword};
__property System::UnicodeString KeyPassword = {read=GetKeyPassword, write=SetKeyPassword};
__property bool Verbose = {read=GetVerbose, write=SetVerbose, nodefault};
__property TOnSFTPMessage OnSFTPMessage = {read=FOnSFTPMessage, write=FOnSFTPMessage};
__property TOnSFTPProgress OnSFTPProgress = {read=FOnSFTPProgress, write=FOnSFTPProgress};
__property TOnSFTPListing OnSFTPListing = {read=FOnSFTPListing, write=FOnSFTPListing};
__property TOnSFTPGetInput OnSFTPGetInput = {read=FOnSFTPGetInput, write=FOnSFTPGetInput};
__property TOnSFTPVerifyHostKey OnSFTPVerifyHostKey = {read=FOnSFTPVerifyHostKey, write=FOnSFTPVerifyHostKey};
__property int TimeoutTicks = {read=GetTimeoutTicks, write=SetTimeoutTicks};
__property int ConnectionTimeoutTicks = {read=GetConnectionTimeoutTicks, write=SetConnectionTimeoutTicks};
};
//---------------------------------------------------------------------------
#endif