00001 // 00002 // Download.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_DOWNLOAD_H__156689EC_D090_4285_BB8C_9AD058024BB5__INCLUDED_) 00023 #define AFX_DOWNLOAD_H__156689EC_D090_4285_BB8C_9AD058024BB5__INCLUDED_ 00024 00025 #pragma once 00026 00027 #include "DownloadWithExtras.h" 00028 00029 00030 class CDownload : public CDownloadWithExtras 00031 { 00032 // Construction 00033 public: 00034 CDownload(); 00035 virtual ~CDownload(); 00036 00037 // Attributes 00038 public: 00039 DWORD m_nSerID; 00040 BOOL m_bExpanded; 00041 BOOL m_bSelected; 00042 TRISTATE m_bVerify; 00043 DWORD m_tCompleted; 00044 int m_nRunCookie; 00045 int m_nSaveCookie; 00046 int m_nGroupCookie; 00047 protected: 00048 BOOL m_bPaused; 00049 BOOL m_bBoosted; 00050 BOOL m_bShared; 00051 BOOL m_bComplete; 00052 DWORD m_tSaved; 00053 DWORD m_tBegan; // The time when this download began trying to download (Started 00054 // searching, etc). 0 means has not tried this session. 00055 BOOL m_bDownloading; // This is used to store if a download is downloading. (Performance tweak) 00056 // You should count the transfers if you need a 100% current answer. 00057 // Operations 00058 public: 00059 virtual void Pause(); 00060 virtual void Resume(); 00061 virtual void Remove(BOOL bDelete = FALSE); 00062 virtual void Boost(); 00063 virtual void Share(BOOL bShared); 00064 virtual BOOL Rename(LPCTSTR pszName); 00065 virtual void StopTrying(); 00066 virtual void SetStartTimer(); 00067 virtual DWORD GetStartTimer() const; 00068 public: 00069 virtual BOOL IsStarted() const; //Has the download actually downloaded anything? 00070 virtual BOOL IsPaused() const; 00071 virtual BOOL IsDownloading() const; //Is the download receiving data? 00072 virtual BOOL IsMoving() const; 00073 virtual BOOL IsCompleted() const; 00074 virtual BOOL IsBoosted() const; 00075 virtual BOOL IsShared() const; 00076 virtual BOOL IsTrying() const; //Is the download currently trying to download? 00077 public: 00078 BOOL Load(LPCTSTR pszPath); 00079 BOOL Save(BOOL bFlush = FALSE); 00080 virtual void Serialize(CArchive& ar, int nVersion); 00081 public: 00082 void OnRun(); 00083 void OnTaskComplete(CDownloadTask* pTask); 00084 BOOL OnVerify(LPCTSTR pszPath, BOOL bVerified); 00085 protected: 00086 void OnDownloaded(); 00087 void OnMoved(CDownloadTask* pTask); 00088 void SerializeOld(CArchive& ar, int nVersion); 00089 00090 friend class CDownloadTask; 00091 friend class CDownloadTransfer; 00092 friend class CDownloadWithTorrent; 00093 }; 00094 00095 00096 #endif // !defined(AFX_DOWNLOAD_H__156689EC_D090_4285_BB8C_9AD058024BB5__INCLUDED_)