diff --git a/PB.Ex_FTP/PB.Ex_FTP.pb b/PB.Ex_FTP/PB.Ex_FTP.pb new file mode 100644 index 0000000..8f52634 --- /dev/null +++ b/PB.Ex_FTP/PB.Ex_FTP.pb @@ -0,0 +1,170 @@ +;1.0.4.0 + +EnableExplicit + +Global PBEx_FTP + +#PBEx_FTP_Version$ = "1.0.4.0" +#PBEx_FTP_Protocol_FTP = 1 +#PBEx_FTP_Protocol_SFTP = 2 +#PBEx_FTP_Protocol_FTPS_Implicit = 3 +#PBEx_FTP_Protocol_FTPS_Explicit = 4 + +CompilerIf #PB_Compiler_Processor = #PB_Processor_x86 + PBEx_FTP = OpenLibrary(#PB_Any, "PB.Ex_FTP_x86.dll") +CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64 + PBEx_FTP = OpenLibrary(#PB_Any, "PB.Ex_FTP_x64.dll") +CompilerEndIf + +If PBEx_FTP + Prototype OpenFTPEx(ID, Protocol, ServerName.p-Unicode, Port, User.p-Unicode, Password.p-Unicode, Charset, ErrorOutput) + Global OpenFTPEx.OpenFTPEx = GetFunction(PBEx_FTP, "OpenFTPEx") + Prototype CloseFTPEx(ID, ErrorOutput) + Global CloseFTPEx.CloseFTPEx = GetFunction(PBEx_FTP, "CloseFTPEx") + Prototype CheckFTPConnectionEx(ID, ErrorOutput) + Global CheckFTPConnectionEx.CheckFTPConnectionEx = GetFunction(PBEx_FTP, "CheckFTPConnectionEx") + Prototype IsFTPEx(ID, ErrorOutput) + Global IsFTPEx.IsFTPEx = GetFunction(PBEx_FTP, "IsFTPEx") + Prototype ExamineFTPDirectoryEx(ID, ErrorOutput) + Global ExamineFTPDirectoryEx.ExamineFTPDirectoryEx = GetFunction(PBEx_FTP, "ExamineFTPDirectoryEx") + Prototype FinishFTPDirectoryEx(ID, ErrorOutput) + Global FinishFTPDirectoryEx.FinishFTPDirectoryEx = GetFunction(PBEx_FTP, "FinishFTPDirectoryEx") + Prototype NextFTPDirectoryEntryEx(ID, ErrorOutput) + Global NextFTPDirectoryEntryEx.NextFTPDirectoryEntryEx = GetFunction(PBEx_FTP, "NextFTPDirectoryEntryEx") + Prototype FTPDirectoryEntryNameEx(ID, Output, ErrorOutput) + Global FTPDirectoryEntryNameEx.FTPDirectoryEntryNameEx = GetFunction(PBEx_FTP, "FTPDirectoryEntryNameEx") + Prototype FTPDirectoryEntrySizeEx(ID, ErrorOutput) + Global FTPDirectoryEntrySizeEx.FTPDirectoryEntrySizeEx = GetFunction(PBEx_FTP, "FTPDirectoryEntrySizeEx") + Prototype FTPDirectoryEntryTypeEx(ID, ErrorOutput) + Global FTPDirectoryEntryTypeEx.FTPDirectoryEntryTypeEx = GetFunction(PBEx_FTP, "FTPDirectoryEntryTypeEx") + Prototype FTPDirectoryEntryDateEx(ID, ErrorOutput) + Global FTPDirectoryEntryDateEx.FTPDirectoryEntryDateEx = GetFunction(PBEx_FTP, "FTPDirectoryEntryDateEx") + Prototype FTPDirectoryEntryAttributesEx(ID, ErrorOutput) + Global FTPDirectoryEntryAttributesEx.FTPDirectoryEntryAttributesEx = GetFunction(PBEx_FTP, "FTPDirectoryEntryAttributesEx") + Prototype GetFTPDirectoryEx(ID, Output, ErrorOutput) + Global GetFTPDirectoryEx.GetFTPDirectoryEx = GetFunction(PBEx_FTP, "GetFTPDirectoryEx") + Prototype SetFTPDirectoryEx(ID, DirectoryName.p-Unicode, ErrorOutput) + Global SetFTPDirectoryEx.SetFTPDirectoryEx = GetFunction(PBEx_FTP, "SetFTPDirectoryEx") + Prototype CreateFTPDirectoryEx(ID, DirectoryName.p-Unicode, ErrorOutput) + Global CreateFTPDirectoryEx.CreateFTPDirectoryEx = GetFunction(PBEx_FTP, "CreateFTPDirectoryEx") + Prototype DeleteFTPDirectoryEx(ID, DirectoryName.p-Unicode, ErrorOutput) + Global DeleteFTPDirectoryEx.DeleteFTPDirectoryEx = GetFunction(PBEx_FTP, "DeleteFTPDirectoryEx") + Prototype DeleteFTPFileEx(ID, FileName.p-Unicode, ErrorOutput) + Global DeleteFTPFileEx.DeleteFTPFileEx = GetFunction(PBEx_FTP, "DeleteFTPFileEx") + Prototype RenameFTPFileEx(ID, FileName.p-Unicode, NewFileName.p-Unicode, ErrorOutput) + Global RenameFTPFileEx.RenameFTPFileEx = GetFunction(PBEx_FTP, "RenameFTPFileEx") + Prototype ReceiveFTPFileEx(ID, RemoteFileName.p-Unicode, FileName.p-Unicode,IsAsynchron, ErrorOutput) + Global ReceiveFTPFileEx.ReceiveFTPFileEx = GetFunction(PBEx_FTP, "ReceiveFTPFileEx") + Prototype SendFTPFileEx(ID, FileName.p-Unicode, RemoteFileName.p-Unicode, IsAsynchron, ErrorOutput) + Global SendFTPFileEx.SendFTPFileEx = GetFunction(PBEx_FTP, "SendFTPFileEx") + Prototype FTPProgressEx(ID, PercentValue, TransferRate, EstimatedTime, ErrorOutput) + Global FTPProgressEx.FTPProgressEx = GetFunction(PBEx_FTP, "FTPProgressEx") + +EndIf + +Define ErrorOutput$ = Space(128) +Define FileName$ = Space(#MAX_PATH) + +Debug "SFTP..." + +If OpenFTPEx(1, #PBEx_FTP_Protocol_SFTP, "test.rebex.net", 22, "demo", "password", #PB_UTF8, @ErrorOutput$) + ;If OpenFTPEx(1, #PBEx_FTP_Protocol_SFTP, "demo.wftpserver.com", 2222, "demo-user", "demo-user", #PB_UTF8, @ErrorOutput$) + SetFTPDirectoryEx(1, "pub", @ErrorOutput$) + SetFTPDirectoryEx(1, "example", @ErrorOutput$) + ;SetFTPDirectoryEx(1, "download", @ErrorOutput$) + ;SetFTPDirectoryEx(1, "upload", @ErrorOutput$) + + If ExamineFTPDirectoryEx(1, @ErrorOutput$) + While NextFTPDirectoryEntryEx(1, @ErrorOutput$) + FTPDirectoryEntryNameEx(1, @FileName$, @ErrorOutput$) + Debug FileName$ + Wend + + EndIf + +; Define a +; Define PercentValue = 0 +; Define TransferRate = 0 +; Define EstimatedTime = 0 +; +; ReceiveFTPFileEx(1, "wftpserver-linux-64bit.tar.gz", "D:\wftpserver-linux-64bit.tar.gz", 1, @ErrorOutput$) +; +; For a=1 To 100 +; FTPProgressEx(1, @PercentValue, @TransferRate, @EstimatedTime, @ErrorOutput$) +; Debug PercentValue +; Debug TransferRate +; Debug EstimatedTime +; Debug "--------" +; Delay(100) +; Next +; +; Delay(10000) + + CloseFTPEx(1, @ErrorOutput$) +Else + Debug ErrorOutput$ +EndIf + +Debug "" +Debug "FTP..." + +If OpenFTPEx(1, #PBEx_FTP_Protocol_FTP, "rsbasic.de", 21, "webika3rg_qch3ai", "PureBasic!2016", #PB_UTF8, @ErrorOutput$) + If ExamineFTPDirectoryEx(1, @ErrorOutput$) + While NextFTPDirectoryEntryEx(1, @ErrorOutput$) + FTPDirectoryEntryNameEx(1, @FileName$, @ErrorOutput$) + Debug FileName$ + Wend + + EndIf + + CloseFTPEx(1, @ErrorOutput$) +Else + Debug ErrorOutput$ +EndIf + +Debug "" +Debug "FTPS explicit..." + +If OpenFTPEx(1, #PBEx_FTP_Protocol_FTPS_Explicit, "test.rebex.net", 21, "demo", "password", #PB_UTF8, @ErrorOutput$) + If ExamineFTPDirectoryEx(1, @ErrorOutput$) + While NextFTPDirectoryEntryEx(1, @ErrorOutput$) + FTPDirectoryEntryNameEx(1, @FileName$, @ErrorOutput$) + Debug FileName$ + Wend + + EndIf + + CloseFTPEx(1, @ErrorOutput$) +Else + Debug ErrorOutput$ +EndIf + +Debug "" +Debug "FTPS implicit..." + +If OpenFTPEx(1, #PBEx_FTP_Protocol_FTPS_Implicit, "test.rebex.net", 990, "demo", "password", #PB_UTF8, @ErrorOutput$) + If ExamineFTPDirectoryEx(1, @ErrorOutput$) + While NextFTPDirectoryEntryEx(1, @ErrorOutput$) + FTPDirectoryEntryNameEx(1, @FileName$, @ErrorOutput$) + Debug FileName$ + Wend + + EndIf + + CloseFTPEx(1, @ErrorOutput$) +Else + Debug ErrorOutput$ +EndIf + +CloseLibrary(PBEx_FTP) + +; IDE Options = PureBasic 5.60 (Windows - x64) +; CursorPosition = 74 +; FirstLine = 57 +; EnableXP +; EnableUser +; Executable = PB.Ex_MSSQL_x86.exe +; CompileSourceDirectory +; EnableCompileCount = 770 +; EnableBuildCount = 6 +; EnableUnicode \ No newline at end of file diff --git a/PB.Ex_FTP/PB.Ex_FTP.pbi b/PB.Ex_FTP/PB.Ex_FTP.pbi new file mode 100644 index 0000000..9e05f96 --- /dev/null +++ b/PB.Ex_FTP/PB.Ex_FTP.pbi @@ -0,0 +1,73 @@ +;1.0.4.0 + +EnableExplicit + +Global PBEx_FTP + +#PBEx_FTP_Version$ = "1.0.4.0" +#PBEx_FTP_Protocol_FTP = 1 +#PBEx_FTP_Protocol_SFTP = 2 +#PBEx_FTP_Protocol_FTPS_Implicit = 3 +#PBEx_FTP_Protocol_FTPS_Explicit = 4 + +CompilerIf #PB_Compiler_Processor = #PB_Processor_x86 + PBEx_FTP = OpenLibrary(#PB_Any, "PB.Ex_FTP_x86.dll") +CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64 + PBEx_FTP = OpenLibrary(#PB_Any, "PB.Ex_FTP_x64.dll") +CompilerEndIf + +If PBEx_FTP + Prototype OpenFTPEx(ID, Protocol, ServerName.p-Unicode, Port, User.p-Unicode, Password.p-Unicode, Charset, ErrorOutput) + Global OpenFTPEx.OpenFTPEx = GetFunction(PBEx_FTP, "OpenFTPEx") + Prototype CloseFTPEx(ID, ErrorOutput) + Global CloseFTPEx.CloseFTPEx = GetFunction(PBEx_FTP, "CloseFTPEx") + Prototype CheckFTPConnectionEx(ID, ErrorOutput) + Global CheckFTPConnectionEx.CheckFTPConnectionEx = GetFunction(PBEx_FTP, "CheckFTPConnectionEx") + Prototype IsFTPEx(ID, ErrorOutput) + Global IsFTPEx.IsFTPEx = GetFunction(PBEx_FTP, "IsFTPEx") + Prototype ExamineFTPDirectoryEx(ID, ErrorOutput) + Global ExamineFTPDirectoryEx.ExamineFTPDirectoryEx = GetFunction(PBEx_FTP, "ExamineFTPDirectoryEx") + Prototype FinishFTPDirectoryEx(ID, ErrorOutput) + Global FinishFTPDirectoryEx.FinishFTPDirectoryEx = GetFunction(PBEx_FTP, "FinishFTPDirectoryEx") + Prototype NextFTPDirectoryEntryEx(ID, ErrorOutput) + Global NextFTPDirectoryEntryEx.NextFTPDirectoryEntryEx = GetFunction(PBEx_FTP, "NextFTPDirectoryEntryEx") + Prototype FTPDirectoryEntryNameEx(ID, Output, ErrorOutput) + Global FTPDirectoryEntryNameEx.FTPDirectoryEntryNameEx = GetFunction(PBEx_FTP, "FTPDirectoryEntryNameEx") + Prototype FTPDirectoryEntrySizeEx(ID, ErrorOutput) + Global FTPDirectoryEntrySizeEx.FTPDirectoryEntrySizeEx = GetFunction(PBEx_FTP, "FTPDirectoryEntrySizeEx") + Prototype FTPDirectoryEntryTypeEx(ID, ErrorOutput) + Global FTPDirectoryEntryTypeEx.FTPDirectoryEntryTypeEx = GetFunction(PBEx_FTP, "FTPDirectoryEntryTypeEx") + Prototype FTPDirectoryEntryDateEx(ID, ErrorOutput) + Global FTPDirectoryEntryDateEx.FTPDirectoryEntryDateEx = GetFunction(PBEx_FTP, "FTPDirectoryEntryDateEx") + Prototype FTPDirectoryEntryAttributesEx(ID, ErrorOutput) + Global FTPDirectoryEntryAttributesEx.FTPDirectoryEntryAttributesEx = GetFunction(PBEx_FTP, "FTPDirectoryEntryAttributesEx") + Prototype GetFTPDirectoryEx(ID, Output, ErrorOutput) + Global GetFTPDirectoryEx.GetFTPDirectoryEx = GetFunction(PBEx_FTP, "GetFTPDirectoryEx") + Prototype SetFTPDirectoryEx(ID, DirectoryName.p-Unicode, ErrorOutput) + Global SetFTPDirectoryEx.SetFTPDirectoryEx = GetFunction(PBEx_FTP, "SetFTPDirectoryEx") + Prototype CreateFTPDirectoryEx(ID, DirectoryName.p-Unicode, ErrorOutput) + Global CreateFTPDirectoryEx.CreateFTPDirectoryEx = GetFunction(PBEx_FTP, "CreateFTPDirectoryEx") + Prototype DeleteFTPDirectoryEx(ID, DirectoryName.p-Unicode, ErrorOutput) + Global DeleteFTPDirectoryEx.DeleteFTPDirectoryEx = GetFunction(PBEx_FTP, "DeleteFTPDirectoryEx") + Prototype DeleteFTPFileEx(ID, FileName.p-Unicode, ErrorOutput) + Global DeleteFTPFileEx.DeleteFTPFileEx = GetFunction(PBEx_FTP, "DeleteFTPFileEx") + Prototype RenameFTPFileEx(ID, FileName.p-Unicode, NewFileName.p-Unicode, ErrorOutput) + Global RenameFTPFileEx.RenameFTPFileEx = GetFunction(PBEx_FTP, "RenameFTPFileEx") + Prototype ReceiveFTPFileEx(ID, RemoteFileName.p-Unicode, FileName.p-Unicode,IsAsynchron, ErrorOutput) + Global ReceiveFTPFileEx.ReceiveFTPFileEx = GetFunction(PBEx_FTP, "ReceiveFTPFileEx") + Prototype SendFTPFileEx(ID, FileName.p-Unicode, RemoteFileName.p-Unicode, IsAsynchron, ErrorOutput) + Global SendFTPFileEx.SendFTPFileEx = GetFunction(PBEx_FTP, "SendFTPFileEx") + Prototype FTPProgressEx(ID, PercentValue, TransferRate, EstimatedTime, ErrorOutput) + Global FTPProgressEx.FTPProgressEx = GetFunction(PBEx_FTP, "FTPProgressEx") + +EndIf +; IDE Options = PureBasic 5.60 (Windows - x64) +; CursorPosition = 17 +; FirstLine = 2 +; EnableXP +; EnableUser +; Executable = PB.Ex_MSSQL_x86.exe +; CompileSourceDirectory +; EnableCompileCount = 583 +; EnableBuildCount = 6 +; EnableUnicode \ No newline at end of file diff --git a/PB.Ex_FTP/PB.Ex_FTP_x64.dll b/PB.Ex_FTP/PB.Ex_FTP_x64.dll index c5249cb..ce4bcae 100644 Binary files a/PB.Ex_FTP/PB.Ex_FTP_x64.dll and b/PB.Ex_FTP/PB.Ex_FTP_x64.dll differ diff --git a/PB.Ex_FTP/PB.Ex_FTP_x86.dll b/PB.Ex_FTP/PB.Ex_FTP_x86.dll index 0751396..e80ddfb 100644 Binary files a/PB.Ex_FTP/PB.Ex_FTP_x86.dll and b/PB.Ex_FTP/PB.Ex_FTP_x86.dll differ