00001 // 00002 // DownloadWithTransfers.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_DOWNLOADWITHTRANSFERS_H__B2CEC922_899C_412E_93B6_953073B992DB__INCLUDED_) 00023 #define AFX_DOWNLOADWITHTRANSFERS_H__B2CEC922_899C_412E_93B6_953073B992DB__INCLUDED_ 00024 00025 #pragma once 00026 00027 #include "DownloadWithSources.h" 00028 00029 class CDownloadTransfer; 00030 class CConnection; 00031 class CEDClient; 00032 00033 00034 class CDownloadWithTransfers : public CDownloadWithSources 00035 { 00036 // Construction 00037 public: 00038 CDownloadWithTransfers(); 00039 virtual ~CDownloadWithTransfers(); 00040 00041 // Attributes 00042 protected: 00043 CDownloadTransfer* m_pTransferFirst; 00044 CDownloadTransfer* m_pTransferLast; 00045 int m_nTransferCount; 00046 DWORD m_tTransferStart; 00047 00048 // Operations 00049 public: 00050 int GetTransferCount() const; 00051 int GetTransferCount(int nState, IN_ADDR* pAddress = NULL) const; 00052 QWORD GetAmountDownloadedFrom(IN_ADDR* pAddress) const; 00053 BOOL CanStartTransfers(DWORD tNow = 0); 00054 BOOL StartTransfersIfNeeded(DWORD tNow = 0); 00055 BOOL StartNewTransfer(DWORD tNow = 0); 00056 void CloseTransfers(); 00057 public: 00058 DWORD GetAverageSpeed() const; 00059 DWORD GetMeasuredSpeed() const; 00060 BOOL OnAcceptPush(GGUID* pClientID, CConnection* pConnection); 00061 BOOL OnDonkeyCallback(CEDClient* pClient, CDownloadSource* pExcept = NULL); 00062 void AddTransfer(CDownloadTransfer* pTransfer); 00063 void RemoveTransfer(CDownloadTransfer* pTransfer); 00064 00065 // Inlines 00066 public: 00067 inline CDownloadTransfer* GetFirstTransfer() const 00068 { 00069 return m_pTransferFirst; 00070 } 00071 00072 friend class CDownloadTransfer; 00073 }; 00074 00075 #endif // !defined(AFX_DOWNLOADWITHTRANSFERS_H__B2CEC922_899C_412E_93B6_953073B992DB__INCLUDED_)