mirror of
https://github.com/yuanyuanxiang/SimpleRemoter.git
synced 2026-02-19 04:43:09 +08:00
- Client: threaded recursive search with wildcard matching, 2-second buffer flush for real-time progress, max depth 32 / max results 10000 - Server: local search with collect-all-then-display pattern, worker thread, time-based progress updates, partial results on stop - Toolbar: Desktop/Downloads/Home navigation buttons for both sides - Button state management via OnUpdate handlers during search - Stop vs navigate semantics with separate flags for proper cleanup - Expand environment variables in remote paths (%USERPROFILE% etc.) - i18n: add search-related strings to en_US and zh_TW language files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
64 lines
2.2 KiB
C++
64 lines
2.2 KiB
C++
// FileManager.h: interface for the CFileManager class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
#include "IOCPClient.h"
|
|
#include "common.h"
|
|
typedef IOCPClient CClientSocket;
|
|
|
|
#if !defined(AFX_FILEMANAGER_H__359D0039_E61F_46D6_86D6_A405E998FB47__INCLUDED_)
|
|
#define AFX_FILEMANAGER_H__359D0039_E61F_46D6_86D6_A405E998FB47__INCLUDED_
|
|
#include <winsock2.h>
|
|
#include <list>
|
|
#include <string>
|
|
|
|
#include "Manager.h"
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
typedef struct {
|
|
UINT nFileSize; // 文件大小
|
|
UINT nSendSize; // 已发送大小
|
|
} SENDFILEPROGRESS, *PSENDFILEPROGRESS;
|
|
|
|
|
|
class CFileManager : public CManager
|
|
{
|
|
public:
|
|
virtual void OnReceive(PBYTE lpBuffer, ULONG nSize);
|
|
UINT SendDriveList();
|
|
CFileManager(CClientSocket *pClient, int h = 0, void* user=nullptr);
|
|
virtual ~CFileManager();
|
|
private:
|
|
std::list <std::string> m_UploadList;
|
|
UINT m_nTransferMode;
|
|
char m_strCurrentProcessFileName[MAX_PATH]; // 当前正在处理的文件
|
|
__int64 m_nCurrentProcessFileLength; // 当前正在处理的文件的长度
|
|
bool MakeSureDirectoryPathExists(LPCTSTR pszDirPath);
|
|
bool UploadToRemote(LPBYTE lpBuffer);
|
|
bool FixedUploadList(LPCTSTR lpszDirectory);
|
|
void StopTransfer();
|
|
UINT SendFilesList(LPCTSTR lpszDirectory);
|
|
bool DeleteDirectory(LPCTSTR lpszDirectory);
|
|
UINT SendFileSize(LPCTSTR lpszFileName);
|
|
UINT SendFileData(LPBYTE lpBuffer);
|
|
void CreateFolder(LPBYTE lpBuffer);
|
|
void Rename(LPBYTE lpBuffer);
|
|
int SendToken(BYTE bToken);
|
|
|
|
void CreateLocalRecvFile(LPBYTE lpBuffer);
|
|
void SetTransferMode(LPBYTE lpBuffer);
|
|
void GetFileData();
|
|
void WriteLocalRecvFile(LPBYTE lpBuffer, UINT nSize);
|
|
void UploadNext();
|
|
bool OpenFile(LPCTSTR lpFile, INT nShowCmd);
|
|
void SearchFiles(LPCTSTR lpszSearchPath, LPCTSTR lpszSearchName);
|
|
void SearchFilesRecursive(LPCTSTR lpszDirectory, LPCTSTR lpszPattern, LPBYTE &lpList, DWORD &dwOffset, DWORD &nBufferSize, int nDepth, DWORD &nResultCount, DWORD &dwLastSendTime);
|
|
static DWORD WINAPI SearchThreadProc(LPVOID lpParam);
|
|
HANDLE m_hSearchThread;
|
|
volatile bool m_bSearching;
|
|
};
|
|
|
|
#endif // !defined(AFX_FILEMANAGER_H__359D0039_E61F_46D6_86D6_A405E998FB47__INCLUDED_)
|