Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, _
ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal _
HelpContext As Long, CancelDisplay As Boolean)
Winsock1.Close
Winsock1.Listen
ProgressBar1 = 0
End Sub
Private Sub Winsock1_SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining _
As Long)
ProgressBar1.Max = bytesSent + bytesRemaining
ProgressBar1 = bytesSent
End Sub
Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
Winsock2.GetData ServerRespond
End Sub
Function GrabChunk(ByVal FileID As Integer, ByVal Start, ByVal Lenght)
Dim GrabRequest(4) As Variant
ServerRespond = ""
GrabRequest(Flag.fCommand) = Request.rGrab
GrabRequest(Flag.fFileID) = FileID
GrabRequest(Flag.fRequestStart) = Start
GrabRequest(Flag.fRequestLength) = Lenght
Winsock2.SendData BuildMessage(GrabRequest)
Do
DoEvents
Loop Until Len(ServerRespond) <> 0
'Expand For Security in Connection Break
RespondFlag = Split(Mid(ServerRespond, InStr(1, ServerRespond, Chr(0)) + _
1), Chr(1))
'Expand For Syntax Security
If RespondFlag(Flag.fFileID) = FileID Then
GrabChunk = RespondFlag(Flag.fFileContent)
End If
End Function
Function BuildMessage(Flags)
Dim FlagID As Integer
BuildMessage = Chr(0) & Flags(0)
For FlagID = 1 To UBound(Flags)
BuildMessage = BuildMessage & Chr(1) & Flags(FlagID)
Next
End Function
Function ReadFile(ByVal Path As String, Optional ByVal Start = 0, Optional _
ByVal Lenght As Integer = 0)
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set fileTextStream = oFSO.OpenTextFile(Path, 1, False, 0)
If Start <> 0 Then
fileTextStream.Skip (Start)
End If
If Lenght = 0 Then
Set oFile = oFSO.GetFile(Path)
Lenght = oFile.Size - Start
End If
ReadFile = fileTextStream.Read(Lenght)
End Function
Function FileSize(ByVal Path As String)
Set oFSO = CreateObject("Scripting.FileSystemObject")
FileSize = oFSO.GetFile(App.Path & "\" & Path).Size
End Function
Function ListPath(ByVal Path As String)
Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim oFolder
Set oFolder = oFSO.GetFolder(App.Path & "\" & Path)
ListPath = Path
For Each oFile In oFolder.Files
ListPath = ListPath & "|" & oFile.Name & "*F*" & oFile.Size
Next
For Each oSubFolder In oFolder.SubFolders
ListPath = ListPath & "|" & oSubFolder.Name & "*D*" & oSubFolder.Size
Next
End Function
Public Function FileExists(ByVal Path As String) As Boolean
Const NotFile = vbDirectory Or vbVolume
On Error Resume Next
FileExists = (GetAttr(Path) And NotFile) = 0
On Error GoTo 0
End Function würde mich sehr freuen wenn mir jemand helfen würde - sonst müsste ich mich in java reinarbeiten und dazu hab ich im moment keine Zeit... |