📄 frmfileview.frm
字号:
itm.Selected = True
Else
'folder doesnt exist
Call RefreshClientView
End If
End If
End Sub
Private Sub ClientFileList_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
If ClientFileList.SelectedItem.Icon = "folder" Then
Call RenameFolder(ClientPath + ClientFileList.SelectedItem.Text, NewString)
Else
Call RenameFile(ClientPath + ClientFileList.SelectedItem.Text, NewString)
End If
End Sub
Private Sub ClientFileList_DblClick()
If ClientFileList.SelectedItem Is Nothing Then Exit Sub
If ClientFileList.SelectedItem.Icon = "folder" Then
'browse into this directory
Call ChowFromFolder(ClientFileList, ClientPath + ClientFileList.SelectedItem.Text + "\", "*.*")
Else
'upload this file
Call mnuUpload_Click
End If
End Sub
Private Sub ClientFileList_GotFocus()
ShowFocus "Client"
End Sub
Private Sub ClientFileList_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Set ClientFileList.SelectedItem = Nothing
End Sub
Private Sub ClientFileList_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 Then
For x = 1 To ClientFileList.ListItems.Count
If ClientFileList.ListItems(x).Selected = True Then n = n + 1
Next x
If n = 0 Then Exit Sub
If n > 1 Then
mnuRenameClientFile.Enabled = False
Else
mnuRenameClientFile.Enabled = True
End If
Call Me.PopupMenu(mnuClient)
End If
End Sub
Private Sub ClientFileList_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 = ClientFileList.HitTest(x, y)
If itm Is Nothing Then Exit Sub
If itm.Icon = "folder" Then
'item(s) dropped in folder
For x = 1 To Data.Files.Count
Select Case Source
Case "ClientFileList"
'dropped from client's list, so move the files
If Right(Data.Files(x), 1) = "\" Then
objFso.MoveFolder Left(Data.Files(x), Len(Data.Files(x)) - 1), ClientPath & itm.Text & "\"
Else
objFso.MoveFile Data.Files(x), ClientPath & itm.Text & "\" & objFso.GetFileName(Data.Files(x))
End If
RefreshClientView
End Select
Next x
End If
End Sub
Private Sub ClientFileList_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 = ClientFileList.HitTest(x, y)
If itm Is Nothing Then
For x = 1 To ClientFileList.ListItems.Count
ClientFileList.ListItems(x).Selected = False
DoEvents
Next x
Exit Sub
End If
If ClientFileList.SelectedItem = itm Then Exit Sub
For x = 1 To ClientFileList.ListItems.Count
ClientFileList.ListItems(x).Selected = False
DoEvents
Next x
If itm.Icon = "folder" Then
itm.Selected = True
Else
End If
End Sub
Private Sub ClientFileList_OLEStartDrag(Data As MSComctlLib.DataObject, AllowedEffects As Long)
Call Data.SetData(, vbCFFiles)
For x = 1 To ClientFileList.ListItems.Count
If ClientFileList.ListItems(x).Selected = True Then
If ClientFileList.ListItems(x).Icon = "folder" Then
Data.Files.Add (ClientPath + ClientFileList.ListItems(x).Text & "\")
Else
Data.Files.Add (ClientPath + ClientFileList.ListItems(x).Text)
End If
End If
Next x
Source = "ClientFileList"
End Sub
Private Sub ClientFiles_GotFocus()
Call ShowFocus("Client")
End Sub
Private Sub Form_Activate()
If FirstRun = True Then
'load client drive list
Dim fs As New FileSystemObject, d As Drive, dc As Drives, itm As ComboItem
Set dc = fs.Drives
For Each d In dc
S = d.DriveLetter
Set itm = ClientDrives.ComboItems.Add(, , S & ":\", "drive")
If d.DriveType = Fixed Then itm.Selected = True 'this will select the first fixed drive in the list
Next
lastfolder = ReadINI("Andromeda", "LastClientFolder", DLL())
If lastfolder <> "" Then
Set itm = ClientDrives.ComboItems.Add(, , lastfolder, "folder")
itm.Selected = True
End If
Call ChowFromFolder(ClientFileList, ClientDrives.Text, "*.*")
'Load server folders
FirstRun = False
Call frmMain.Winsock.SendData("SHAREDFOLDERS")
End If
End Sub
Sub StringToQue(theitems As String)
'this code will loop through the path and make sure each parent
'folder of the file exists. then, it will create any folders
'that need to be created. (used for downloading folders)
If theitems = "" Then Exit Sub
If Not Mid(theitems, Len(theitems), 1) = "|" Then
theitems = theitems & "|"
End If
Dim folders2create As New Collection
For DoList = 1 To Len(theitems)
thechars$ = thechars$ & Mid(theitems, DoList, 1)
If Mid(theitems, DoList, 1) = "|" Then
serverfile = Mid(thechars$, 1, Len(thechars$) - 1)
clientfile = ClientPath + Right(serverfile, Len(serverfile) - Len(ClientPath))
parentfld = objFso.GetParentFolderName(clientfile)
Call Que.AddFile(serverfile & ">" & parentfld + "\")
pf = objFso.GetParentFolderName(clientfile)
Do While pf <> "": DoEvents
If objFso.FolderExists(pf) = False Then
folders2create.Add pf
End If
pf = objFso.GetParentFolderName(pf)
Loop
thechars$ = ""
End If
Next DoList
'Create folders (if needed)
On Error Resume Next
For x = folders2create.Count To 1 Step -1
MkDir folders2create.item(x)
Next x
Set folders2create = Nothing
End Sub
Private Sub Form_Load()
SetParent Me.hwnd, MDI()
frmMain.Toolbar1.Buttons(3).Value = tbrPressed
FirstRun = True
Set Que = New FileQue
Set UpQue = New FileQue
End Sub
Private Sub Form_Resize()
On Error Resume Next
ClientFiles.Width = Me.Width / 2 - 100
ServerFiles.Width = Me.Width / 2 - 100
ClientDrives.Width = ClientFiles.Width - 300
ServerDrives.Width = ServerFiles.Width - 300
lblClientFiles.Width = ClientFiles.Width
lblServerFiles.Width = ServerFiles.Width
Toolbar1.Top = ClientDrives.Top + ClientDrives.Height + 25
Toolbar1.Width = ClientFiles.Width
Toolbar2.Top = ServerDrives.Top + ServerDrives.Height + 25
Toolbar2.Width = ServerFiles.Width
ClientFileList.Top = Toolbar1.Top + Toolbar1.Height + 25
ClientFileList.Height = ClientFiles.Height - ClientFileList.Top - 100
ClientFileList.Width = ClientFiles.Width - 75
ServerFileList.Top = Toolbar2.Top + Toolbar2.Height + 25
ServerFileList.Height = ServerFiles.Height - ServerFileList.Top - 100
ServerFileList.Width = ServerFiles.Width - 75
Status.Panels(1).Width = ClientFiles.Width - 20
Status.Panels(3).Width = ServerFiles.Width
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmMain.Toolbar1.Buttons(3).Value = tbrUnpressed
Set Que = Nothing
Set UpQue = Nothing
End Sub
Private Sub lblClientFiles_Click()
Call ShowFocus("Client")
End Sub
Private Sub lblServerFiles_Click()
Call ShowFocus("Server")
End Sub
Private Sub mnuClientMoveTo_Click()
On Error Resume Next
newpath = InputBox("Please enter the new path:", "Move")
If Trim(newpath) = "" Then Exit Sub
If Right(newpath, 1) <> "\" Then newpath = newpath + "\"
If objFso.FolderExists(newpath) = False Then
MsgBox "The specified path is invalid. Cannot move.", vbCritical, "Error"
Exit Sub
End If
For x = 1 To ClientFileList.ListItems.Count
If ClientFileList.ListItems(x).Selected = True Then
If ClientFileList.ListItems(x).Icon = "folder" Then
objFso.MoveFolder ClientPath + ClientFileList.ListItems(x).Text, newpath
Else
objFso.MoveFile ClientPath + ClientFileList.ListItems(x).Text, newpath + ClientFileList.ListItems(x).Text
End If
End If
Next x
RefreshClientView
End Sub
Private Sub mnuDelete_Click()
If Focus = "Client" Then
Call mnuDeleteClientFile_Click
ElseIf Focus = "Server" Then
Call mnuDeleteServerFile_Click
End If
End Sub
Private Sub mnuDeleteClientFile_Click()
On Error Resume Next
If ClientFileList.SelectedItem Is Nothing Then Exit Sub
For i = 1 To ClientFileList.ListItems.Count
If ClientFileList.ListItems(i).Selected = True Then fcount = fcount + 1
Next i
If MsgBox("Delete " & fcount & " selected file(s) or folder(s)?" & vbCrLf, vbYesNo + vbQuestion, "Delete?") = vbYes Then
Dim fs As New FileSystemObject
Dim f1 As File
Dim Fld As Folder
For x = 1 To ClientFileList.ListItems.Count
If ClientFileList.ListItems(x).Selected = True Then
If ClientFileList.ListItems(x).Icon = "folder" Then
Set Fld = fs.GetFolder(ClientPath + "\" + ClientFileList.ListItems(x) + "\")
Fld.Delete (True)
Else
Set f1 = fs.GetFile(ClientPath + "\" + ClientFileList.ListItems(x) + "\")
f1.Delete (True)
End If
End If
Next x
RefreshClientView
End If
End Sub
Private Sub mnuDeleteServerFile_Click()
If ServerFileList.SelectedItem Is Nothing Then Exit Sub
Dim str As String
Dim fcount As Integer
str = "DELETE="
With ServerFileList
For x = 1 To .ListItems.Count
If .ListItems(x).Selected = True Then
str = str & ServerPath & .ListItems(x).Text & "|"
fcount = fcount + 1
End If
Next x
retval = MsgBox("Delete " & fcount & " selected file(s) or folder(s)?" & vbCrLf, vbYesNo + vbQuestion, "Delete?")
If retval = vbYes Then
frmMain.Winsock.SendData (str)
End If
End With
End Sub
Private Sub mnuDownload_Click()
For x = 1 To ServerFileList.ListItems.Count
If ServerFileList.ListItems(x).Selected = True Then
selnum = selnum + 1
If ServerFileList.ListItems(x).Icon = "folder" Then
Call GetServerFilesFromFolder(ServerPath + ServerFileList.ListItems(x).Text)
Else
Call Que.AddFile(ServerPath + ServerFileList.ListItems(x).Text & ">" & ClientPath)
End If
End If
Next x
If selnum = 0 Then Exit Sub
If Que.IsDownloading = False Then
Call Que.BeginDownloading
End If
End Sub
Private Sub mnuExecuteServerProgram_Click()
frmMain.Winsock.SendData "SPROCESS=" & ServerPath & ServerFileList.SelectedItem.Text
End Sub
Private Sub mnuNewClientFolder_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
MkDir (ClientPath + NewFolder)
RefreshClientView
End Sub
Private Sub mnuRenameClientFile_Click()
Dim newname As String
oldname = ClientFileList.SelectedItem.Text
newname = InputBox("Enter the new name:", "Rename File: " & oldname, oldname)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -