FileTorrent.h
资源名称:GGBT.rar [点击查看]
上传用户:lds876
上传日期:2013-05-25
资源大小:567k
文件大小:2k
源码类别:
P2P编程
开发平台:
Visual C++
- // FileTorrent.h: interface for the CFileTorrent class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_FILETORRENT_H__7982010F_5734_496B_B8F8_F0B5A82CC6A9__INCLUDED_)
- #define AFX_FILETORRENT_H__7982010F_5734_496B_B8F8_F0B5A82CC6A9__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "FileInfo.h"
- class CVal;
- #define WM_FILE_TORRENT_OPENED WM_USER + 1002
- class CFileTorrent
- {
- public:
- CFileTorrent();
- virtual ~CFileTorrent();
- long GetOpenIndex();
- bool IsBad();
- string GetBadMsg();
- void Close();
- bool IsOpen();
- bool OpenFileEx(string strFileName, string strSaveAs, HWND hWnd);
- bool OpenFile(string strFileName, string strSaveAs = "");
- bool CreateDir(string strSaveAs = "");
- bool QuerySubFiles(vector<CFileInfo>& vFiles, bool& bDir, BLONG & lTotalSize);
- bool QueryDir();
- CVal* GetResponse();
- CVal* GetInfo();
- memstream& GetInfohash();
- string GetInfohashString();
- memstream& GetMyId();
- vector<CFileInfo>& GetFileInfo();
- vector<char*>& GetPieces();
- string GetUrl();
- string GetComment();
- // call by gui.
- string GetTorrentFileName();
- string GetSaveName();
- BLONG GetFileLength();
- bool m_bDirectory;
- private:
- static DWORD WINAPI OpenFileExProc(void *pParam);
- void ExtractFile(long lOpenIndex);
- void ExtractFileData();
- string ChooseFile(string strDefaultName, unsigned long lsize, string strSaveas, bool bDir);
- bool MakeDir(string strFileName, bool bForceDir = false);
- long getpid();
- void MakeMyid();
- void MakeInfohash();
- void MakePieces();
- CVal* m_pResponse;
- vector<char*> m_vPieces;
- vector<CFileInfo> m_vFiles;
- memstream m_memMyid;
- memstream m_memInfohash;
- string m_strTorrentFileName;
- string m_strSaveName;
- BLONG m_lSize;
- bool m_bOpened;
- bool m_bBad;
- string m_strBad;
- HWND m_hWnd;
- HANDLE m_hCancel;
- HANDLE m_hFileOpenDone;
- long m_lOpenIndex;
- };
- #endif // !defined(AFX_FILETORRENT_H__7982010F_5734_496B_B8F8_F0B5A82CC6A9__INCLUDED_)