00001 // 00002 // BitziDownloader.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 #if !defined(AFX_BITZIDOWNLOADER_H__08C21C98_E7E8_4E32_B3E9_2E149A72CE69__INCLUDED_) 00023 #define AFX_BITZIDOWNLOADER_H__08C21C98_E7E8_4E32_B3E9_2E149A72CE69__INCLUDED_ 00024 00025 #pragma once 00026 00027 class CSchema; 00028 class CXMLElement; 00029 class CBitziDownloadDlg; 00030 00031 00032 class CBitziDownloader 00033 { 00034 // Construction 00035 public: 00036 CBitziDownloader(); 00037 virtual ~CBitziDownloader(); 00038 00039 // Attributes 00040 protected: 00041 CPtrList m_pFiles; 00042 CCriticalSection m_pSection; 00043 CBitziDownloadDlg* m_pDlg; 00044 protected: 00045 HANDLE m_hThread; 00046 HINTERNET m_hInternet; 00047 HINTERNET m_hSession; 00048 HINTERNET m_hRequest; 00049 BOOL m_bFinished; 00050 DWORD m_nDelay; 00051 DWORD m_nFailures; 00052 protected: 00053 DWORD m_nFileIndex; 00054 CString m_sFileName; 00055 CString m_sFileHash; 00056 CString m_sURL; 00057 CString m_sResponse; 00058 CXMLElement* m_pXML; 00059 00060 // Operations 00061 public: 00062 void AddFile(DWORD nIndex); 00063 int GetFileCount(); 00064 BOOL Start(CBitziDownloadDlg* pDlg = NULL); 00065 void Stop(); 00066 BOOL IsWorking(); 00067 protected: 00068 static UINT ThreadStart(LPVOID pParam); 00069 void OnRun(); 00070 BOOL BuildRequest(); 00071 BOOL ExecuteRequest(); 00072 BOOL DecodeResponse(); 00073 CString LookupValue(LPCTSTR pszPath); 00074 CXMLElement* ImportData(CSchema* pSchema); 00075 BOOL SubmitMetaData(CXMLElement* pXML); 00076 BOOL MergeMetaData(CXMLElement* pOutput, CXMLElement* pInput); 00077 00078 }; 00079 00080 #endif // !defined(AFX_BITZIDOWNLOADER_H__08C21C98_E7E8_4E32_B3E9_2E149A72CE69__INCLUDED_)