📄 frmfileview.frm
字号:
If Trim(newname) = "" Then Exit Sub
If IsValidFileName(newname) = False Then
MsgBox "New name contains illegal characters!", vbCritical, "Error"
Exit Sub
End If
If ClientFileList.SelectedItem.Icon = "folder" Then
Call RenameFolder(ClientPath + ClientFileList.SelectedItem.Text, newname)
Else
Call RenameFile(ClientPath + ClientFileList.SelectedItem.Text, newname)
End If
Call RefreshClientView
End Sub
Private Sub mnuServerMoveTo_Click()
If ServerFileList.SelectedItem Is Nothing Then Exit Sub
svrpath = InputBox("Please enter to directory to move this file to:", "Move File")
If svrpath = "" Then Exit Sub
If Right(svrpath, 1) <> "\" Then svrpath = svrpath + "\"
For x = 1 To ServerFileList.ListItems.Count
If ServerFileList.ListItems(x).Selected = True Then
If ServerFileList.ListItems(x).Icon = "folder" Then
frmMain.Winsock.SendData ("MOVE=" & ServerPath & ServerFileList.ListItems(x) & "\" & "|" & svrpath)
WaitForMove = True
While WaitForMove = True: DoEvents: Wend 'wait for server to move folder
Else
frmMain.Winsock.SendData ("MOVE=" & ServerPath & ServerFileList.ListItems(x) & "|" & svrpath)
WaitForMove = True
While WaitForMove = True: DoEvents: Wend 'wait for server to move file
End If
End If
Next x
Call RefreshServerView
End Sub
Private Sub mnuNewFolder_Click()
Dim NewFolder As String
NewFolder = InputBox("Enter the new folder's name:", "New Folder", "NewFolder")
If NewFolder = "" Then Exit Sub
If IsValidFileName(NewFolder) = False Then
MsgBox "The new folder name contains invalid characters.", vbCritical, "Invalid Folder Name"
Exit Sub
End If
Call frmMain.Winsock.SendData("NEWFOLDER=" & ServerPath & NewFolder)
WaitForFolder = True
While WaitForFolder = True: DoEvents: Wend
RefreshServerView
End Sub
Private Sub mnuRenameServerFile_Click()
Dim filename As String
Dim new_fileName As String
If ServerFileList.SelectedItem Is Nothing Then Exit Sub
filename = ServerFileList.SelectedItem.Text
new_fileName = InputBox("Enter the new file name.", "Rename file", filename)
If Trim(new_fileName) = "" Then Exit Sub
If IsValidFileName(new_fileName) = False Then
MsgBox "New file name contains illegal characters!", vbCritical, "Error"
Exit Sub
End If
Call frmMain.Winsock.SendData("RENAME=" & ServerPath & filename & "|" & new_fileName)
End Sub
Private Sub mnuUpload_Click()
Dim item As String
For x = 1 To ClientFileList.ListItems.Count
If ClientFileList.ListItems(x).Selected = True Then
selnum = selnum + 1
item = ClientFileList.ListItems(x).Text
If ClientFileList.ListItems(x).Icon = "folder" Then
Call AddFolderToQue(ClientPath + item, ServerPath + item + "\", UpQue)
Else
UpQue.AddFile (ClientPath + item + ">" + ServerPath)
End If
End If
Next x
If selnum = 0 Then Exit Sub
If UpQue.IsUploading = False Then
UpQue.BeginUploading
End If
End Sub
Private Sub mnuDetails_Click()
ClientFileList.View = lvwReport
ServerFileList.View = lvwReport
mnuSmallIcons.Checked = False
mnuLargeIcons.Checked = False
mnuList.Checked = False
mnuDetails.Checked = True
End Sub
Private Sub mnuLargeIcons_Click()
ClientFileList.View = lvwIcon
ServerFileList.View = lvwIcon
mnuSmallIcons.Checked = False
mnuLargeIcons.Checked = True
mnuList.Checked = False
mnuDetails.Checked = False
End Sub
Private Sub mnuList_Click()
ClientFileList.View = lvwList
ServerFileList.View = lvwList
mnuSmallIcons.Checked = False
mnuLargeIcons.Checked = False
mnuList.Checked = True
mnuDetails.Checked = False
End Sub
Private Sub mnuViewRefresh_Click()
Call ChowFromFolder(ClientFileList, ClientPath, "*.*")
Call frmMain.Winsock.SendData("DIR " + ServerPath)
ServerFileList.MousePointer = 13
End Sub
Private Sub mnuSmallIcons_Click()
ClientFileList.View = lvwSmallIcon
ServerFileList.View = lvwSmallIcon
mnuSmallIcons.Checked = True
mnuLargeIcons.Checked = False
mnuList.Checked = False
mnuDetails.Checked = False
End Sub
Private Sub Que_DownloadsComplete(NumFiles As Integer)
If frmDownload.CloseWhenDone.Value = 1 Then
Unload frmDownload
End If
RefreshClientView
End Sub
Private Sub ServerDrives_Click()
Path = ServerDrives.SelectedItem.Text
If Path = "" Then Exit Sub
If Right(Path, 1) <> "\" Then Path = Path + "\"
Call frmMain.Winsock.SendData("DIR " + Path)
ServerFileList.MousePointer = 13
ServerFileList.SetFocus
End Sub
Private Sub ServerDrives_GotFocus()
ShowFocus "Server"
End Sub
Private Sub ServerDrives_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Path = ServerDrives.Text
If Path = "" Then Exit Sub
If Right(Path, 1) <> "\" Then Path = Path + "\"
Call frmMain.Winsock.SendData("DIR " + Path)
ServerFileList.MousePointer = 13
ServerFileList.SetFocus
End If
End Sub
Private Sub ServerFileList_AfterLabelEdit(Cancel As Integer, NewString As String)
If IsValidFileName(NewString) = False Then
MsgBox "New file name contains illegal characters!", vbCritical, "Error"
Cancel = 1
Exit Sub
End If
Call frmMain.Winsock.SendData("RENAME=" & ServerPath & ServerFileList.SelectedItem.Text & "|" & Trim(NewString))
End Sub
Private Sub ServerFileList_DblClick()
If ServerFileList.SelectedItem Is Nothing Then Exit Sub
If ServerFileList.SelectedItem.Icon = "folder" Then
frmMain.Winsock.SendData ("DIR " + ServerPath + ServerFileList.SelectedItem.Text + "\")
skipit:
Else
Call mnuDownload_Click
End If
End Sub
Private Sub ServerFileList_GotFocus()
ShowFocus "Server"
End Sub
Private Sub ServerFileList_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Set ServerFileList.SelectedItem = Nothing
End Sub
Private Sub ServerFileList_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 Then
For x = 1 To ServerFileList.ListItems.Count
If ServerFileList.ListItems(x).Selected = True Then n = n + 1
Next x
If n = 0 Then Exit Sub
If n > 1 Then
mnuRenameServerFile.Enabled = False
Else
mnuRenameServerFile.Enabled = True
End If
On Error Resume Next
If objFso.GetExtensionName(ServerFileList.SelectedItem.Text) = "exe" Then
mnuExecuteServerProgram.Enabled = True
Else
mnuExecuteServerProgram.Enabled = False
End If
Call Me.PopupMenu(mnuServer)
End If
End Sub
Private Sub ServerFileList_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim itm As ListItem
Set itm = ServerFileList.HitTest(x, y)
If itm Is Nothing Then Exit Sub
If itm.Icon = "folder" Then
'item(s) dropped in folder
Select Case Source
Case "ServerFileList"
'dropped from server's list, so send the "MOVE" command
For x = 1 To Data.Files.Count
frmMain.Winsock.SendData ("MOVE=" & ServerPath & Data.Files(x) & "|" & ServerPath & itm.Text & "\") ' & Data.Files(x))
WaitForMove = True
While WaitForMove = True: DoEvents: Wend 'wait for server to move file
Next x
Call RefreshServerView
End Select
End If
End Sub
Private Sub ServerFileList_OLEDragOver(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As Integer)
On Error Resume Next
Dim itm As ListItem
Set itm = ServerFileList.HitTest(x, y)
If itm Is Nothing Then
For x = 1 To ServerFileList.ListItems.Count
ServerFileList.ListItems(x).Selected = False
DoEvents
Next x
Exit Sub
End If
If ServerFileList.SelectedItem = itm Then Exit Sub
For x = 1 To ServerFileList.ListItems.Count
ServerFileList.ListItems(x).Selected = False
DoEvents
Next x
If itm.Icon = "folder" Then
itm.Selected = True
Else
End If
End Sub
Private Sub ServerFileList_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long)
Call Data.SetData(, vbCFFiles)
For x = 1 To ServerFileList.ListItems.Count
If ServerFileList.ListItems(x).Selected = True Then
If ServerFileList.ListItems(x).Icon = "folder" Then
Data.Files.Add (ServerFileList.ListItems(x) & "\")
Else
Data.Files.Add (ServerFileList.ListItems(x).Text)
End If
End If
Next x
Source = "ServerFileList"
End Sub
Private Sub ServerFiles_Click()
Call ShowFocus("Server")
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Call ShowFocus("Client")
Select Case Button.index
Case 1
'Go Up
Me.MousePointer = 13
Set f = New FileSystemObject
p$ = f.GetParentFolderName(ClientPath)
If p$ = "" Then Exit Sub
Call ChowFromFolder(ClientFileList, p$ + "\", "*.*")
Me.MousePointer = 0
Case 3
'Delete
Call mnuDeleteClientFile_Click
Case 4
'Upload
Call mnuUpload_Click
Case 6
'Large Icons
Call mnuLargeIcons_Click
Case 7
'Small Icons
Call mnuSmallIcons_Click
Case 8
'List
Call mnuList_Click
Case 9
'Details
Call mnuDetails_Click
Case 11
'New Folder
Call mnuNewClientFolder_Click
End Select
End Sub
Private Sub Toolbar2_ButtonClick(ByVal Button As MSComctlLib.Button)
Call ShowFocus("Server")
Select Case Button.index
Case 1
'Go Up
Me.MousePointer = 13
Set f = New FileSystemObject
p$ = f.GetParentFolderName(ServerPath)
If p$ = "" Then Exit Sub
If Right(p$, 1) <> "\" Then p$ = p$ + "\"
Call frmMain.Winsock.SendData("DIR " + p$)
skip:
Me.MousePointer = 0
ServerFileList.MousePointer = 0
Case 3
'Delete files
Call mnuDeleteServerFile_Click
Case 4
'Upload
Call mnuUpload_Click
Case 6
'Large Icons
Call mnuLargeIcons_Click
Case 7
'Small Icons
Call mnuSmallIcons_Click
Case 8
'List
Call mnuList_Click
Case 9
'Details
Call mnuDetails_Click
Case 11
'New Folder
Call mnuNewFolder_Click
End Select
End Sub
Private Sub UpQue_UploadsComplete(NumFiles As Integer)
If frmUpload.CloseWhenDone.Value = 1 Then
Unload frmUpload
End If
RefreshServerView
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -