📄 filetransfer.h
字号:
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2002 Ultr@VNC Team Members. All Rights Reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
//
// If the source code for the program is not available from the place from
// which you received this file, check
// http://www.teamviewer.com/
//
////////////////////////////////////////////////////////////////////////////
#ifndef FILETRANSFER_H__
#define FILETRANSFER_H__
#pragma once
#define CONFIRM_YES 1
#define CONFIRM_YESALL 2
#define CONFIRM_NO 3
#define CONFIRM_NOALL 4
struct FTInfo
{
public:
int id;
string sourceFile;
string destFile;
};
struct FTGetFilesItem
{
public:
string source;
string dest;
};
//typedef std::list<int> FilesList; // List of files indexes to be sent or received
typedef std::list<FTInfo> FilesList;
typedef std::list<FTGetFilesItem> GetFilesList;
class ClientConnection;
class VNCviewerApp;
class FileTransfer
{
public:
// Props
VNCviewerApp *m_pApp;
ClientConnection *m_pCC;
HWND hWnd;
HWND hParent;
bool m_fAbort;
bool m_fAborted; // Async Reception file only
int m_nDeleteCount; // Grouped file deletion trick
FilesList m_FilesList; // List of files indexes to be sent or received
FilesList::iterator m_iFile;
GetFilesList m_GetFiles;
int m_nFilesToTransfer;
int m_nFilesTransfered;
bool m_fFileCommandPending;
bool m_fFileTransferRunning;
bool m_fVisible;
bool m_fFTAllowed;
int m_timer;
bool m_fFocusLocal;
char m_szFTParamTitle[128];
char m_szFTParamComment[64];
char m_szFTParam[248];
char m_szFTConfirmTitle[128];
char m_szFTConfirmComment[364];
int m_nConfirmAnswer;
bool m_fApplyToAll;
bool m_fShowApplyToAll;
char m_szDeleteButtonLabel[64];
char m_szNewFolderButtonLabel[64];
char m_szRenameButtonLabel[64];
__int64 m_nnFileSize;
DWORD m_dwCurrentValue;
DWORD m_dwCurrentPercent;
// File Sending (upload)
HANDLE m_hSrcFile;
DWORD m_dwNbBytesRead;
__int64 m_dwTotalNbBytesRead;
bool m_fEof;
bool m_fFileUploadError;
bool m_fFileUploadRunning;
bool m_fSendFileChunk;
bool m_fCompress;
char* m_lpCSBuffer;
int m_nCSOffset;
int m_nCSBufferSize;
// Directory list reception
WIN32_FIND_DATA m_fd;
int m_nFileCount;
bool m_fDirectoryReceptionRunning;
char m_szFileSpec[MAX_PATH + 64];
char m_szLastRemoteDirVisit[MAX_PATH + 64];
// File reception (download)
HANDLE m_hDestFile;
DWORD m_dwNbReceivedPackets;
DWORD m_dwNbBytesWritten;
__int64 m_dwTotalNbBytesWritten;
__int64 m_dwTotalNbBytesNotReallyWritten;
int m_nPacketCount;
bool m_fPacketCompressed;
bool m_fFileDownloadRunning;
bool m_fFileDownloadError;
char m_szIncomingFileTime[18];
bool m_fOldFTProtocole;
int m_nBlockSize;
int m_nNotSent;
DWORD m_dwLastChunkTime;
MMRESULT m_mmRes;
bool m_fCreateDirPending;
bool m_fInGetFilesRecursive;
bool m_fGetFilesFirstResponse;
// Methods
FileTransfer(VNCviewerApp *pApp, ClientConnection *pCC);
int DoDialog(HWND parent);
virtual ~FileTransfer();
static BOOL CALLBACK FileTransferDlgProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam);
static BOOL CALLBACK LFBWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK RFBWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
int DoFTParamDialog(LPSTR szTitle, LPSTR szComment);
static BOOL CALLBACK FTParamDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
int DoFTConfirmDialog(LPSTR szTitle, LPSTR szComment);
static BOOL CALLBACK FTConfirmDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
void KillDialog();
void DisableButtons(HWND hWnd);
void EnableButtons(HWND hWnd);
bool SendFile(long lSize, int nLen);
bool SendFileChunk();
bool FinishFileReception();
//int UnzipPossibleDirectory(LPSTR szFileName);
bool SendFiles(long lSize, int nLen);
bool OfferNextFile();
void ListRemoteDrives(HWND hWnd, int nLen);
void ProcessFileTransferMsg(void);
void RequestPermission();
bool TestPermission(long lSize, int nVersion);
void AddFileToFileList(HWND hWnd, int nListId, WIN32_FIND_DATA& fd, bool fLocalSide);
void RequestRemoteDirectoryContent(HWND hWnd, LPSTR szPath);
void RequestRemoteDrives();
void RequestRemoteFile();
bool OfferLocalFile();
bool ReceiveFile(unsigned long lSize, int nLen);
bool ReceiveFileChunk(int nLen, int nSize);
bool FinishFileSending();
bool AbortFileReception();
bool ReceiveFiles(unsigned long lSize, int nLen);
bool RequestNextFile();
bool ReceiveDestinationFileChecksums(int nSize, int nLen);
void HighlightTransferedFiles(HWND hSrcList, HWND hDstList);
void PopulateRemoteListBox(HWND hWnd, int nLen);
void ReceiveDirectoryItem(HWND hWnd, int nLen);
void FinishDirectoryReception();
bool IsShortcutFolder(LPSTR szPath);
bool ResolvePossibleShortcutFolder(HWND hWnd, LPSTR szFolder);
void PopulateLocalListBox(HWND hWnd, LPSTR szPath);
void ListDrives(HWND hWnd);
void CreateOrDeleteRemoteDirectory(LPSTR szDir, bool doDelete);
void CreateRemoteDirectory(LPSTR szDir);
void DeleteRemoteDirectory(LPSTR szDir);
void DeleteRemoteFile(LPSTR szFile);
bool CreateRemoteDirectoryFeedback(long lSize, int nLen);
bool DeleteRemoteFileFeedback(long lSize, int nLen);
void RenameRemoteFileOrDirectory(LPSTR szCurrentName, LPSTR szNewName);
bool RenameRemoteFileOrDirectoryFeedback(long lSize, int nLen);
int GenerateFileChecksums(HANDLE hFile, char* lpCSBuffer, int nCSBufferSize);
void SetTotalSize(HWND hwnd,DWORD dwTotalSize);
void SetGauge(HWND hwnd,__int64 dwCount);
void SetGlobalCount();
void SetStatus(LPSTR szStatus);
void ShowFileTransferWindow(bool fVisible);
bool IsDirectoryGetIt(char* szName);
void GetFriendlyFileSizeString(__int64 Size, char* szText);
bool MyGetFileSize(char* szFilePath, ULARGE_INTEGER* n2FileSize);
void InitListViewImagesList(HWND hListView);
void FileTransfer::InitFTTimer();
void FileTransfer::KillFTTimer();
static void CALLBACK fpTimer(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2);
void FinishRequestFiles();
void PutFilesRecursive(string source, string dest);
void GetFilesRecursive();
void GetFilesRecursiveResponse(int nLen);
};
#endif // FILETRANSFER_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -