00001 // 00002 // DlgTorrentSeed.h 00003 // 00004 // Copyright (c) Shareaza Development Team, 2002-2005. 00005 // This file is part of SHAREAZA (www.shareaza.com) 00006 // 00007 // Shareaza is free software; you can redistribute it 00008 // and/or modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 2 of 00010 // the License, or (at your option) any later version. 00011 // 00012 // Shareaza is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with Shareaza; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 // 00021 00022 #pragma once 00023 00024 #include "DlgSkinDialog.h" 00025 #include "BTInfo.h" 00026 00027 00028 class CTorrentSeedDlg : public CSkinDialog 00029 { 00030 // Construction 00031 public: 00032 CTorrentSeedDlg(LPCTSTR pszTorrent, BOOL bForceSeed = FALSE, CWnd* pParent = NULL); 00033 virtual ~CTorrentSeedDlg(); 00034 00035 DECLARE_DYNAMIC(CTorrentSeedDlg) 00036 enum { IDD = IDD_TORRENT_SEED }; 00037 00038 // Dialog Data 00039 protected: 00040 CProgressCtrl m_wndProgress; 00041 CButton m_wndDownload; 00042 CButton m_wndSeed; 00043 protected: 00044 HANDLE m_hThread; 00045 BOOL m_bCancel; 00046 CString m_sTorrent; 00047 BOOL m_bForceSeed; 00048 CString m_sTarget; 00049 CBTInfo m_pInfo; 00050 DWORD m_nBlockNumber; 00051 DWORD m_nBlockLength; 00052 protected: 00053 CString m_sMessage; 00054 QWORD m_nVolume; 00055 QWORD m_nTotal; 00056 int m_nScaled; 00057 int m_nOldScaled; 00058 00059 // Implementation 00060 protected: 00061 static UINT ThreadStart(LPVOID pParam); 00062 void OnRun(); 00063 void RunSingleFile(); 00064 void RunMultiFile(); 00065 BOOL VerifySingle(); 00066 HANDLE CreateTarget(); 00067 BOOL BuildFiles(HANDLE hTarget); 00068 CString FindFile(LPVOID pVoid); 00069 BOOL CopyFile(HANDLE hTarget, HANDLE hSource, QWORD nLength, LPCTSTR pszPath); 00070 BOOL VerifyData(BYTE* pBuffer, DWORD nLength, LPCTSTR pszPath); 00071 BOOL CreateDownload(); 00072 00073 // Message Map 00074 protected: 00075 DECLARE_MESSAGE_MAP() 00076 virtual void DoDataExchange(CDataExchange* pDX); 00077 virtual BOOL OnInitDialog(); 00078 afx_msg void OnDownload(); 00079 afx_msg void OnSeed(); 00080 virtual void OnCancel(); 00081 afx_msg void OnDestroy(); 00082 afx_msg void OnTimer(UINT nIDEvent); 00083 };