Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

CDownloadWithFile Class Reference

#include <DownloadWithFile.h>

Inheritance diagram for CDownloadWithFile:

CDownloadWithTransfers CDownloadWithSources CDownloadBase CDownloadWithTorrent CDownloadWithTiger CDownloadWithSearch CDownloadWithExtras CDownload List of all members.

Public Member Functions

 CDownloadWithFile ()
virtual ~CDownloadWithFile ()
float GetProgress () const
QWORD GetVolumeComplete () const
QWORD GetVolumeRemaining () const
DWORD GetTimeRemaining () const
CString GetDisplayName () const
const FF::SimpleFragmentListGetEmptyFragmentList () const
FF::SimpleFragmentList GetPossibleFragments (const FF::SimpleFragmentList &oAvailable, FF::SimpleFragment &oLargest)
BOOL GetFragment (CDownloadTransfer *pTransfer)
BOOL IsPositionEmpty (QWORD nOffset)
BOOL AreRangesUseful (const FF::SimpleFragmentList &oAvailable)
BOOL IsRangeUseful (QWORD nOffset, QWORD nLength)
BOOL IsRangeUsefulEnough (CDownloadTransfer *pTransfer, QWORD nOffset, QWORD nLength)
virtual CString GetAvailableRanges () const
BOOL ClipUploadRange (QWORD nOffset, QWORD &nLength) const
BOOL GetRandomRange (QWORD &nOffset, QWORD &nLength) const
BOOL PrepareFile ()
BOOL SubmitData (QWORD nOffset, LPBYTE pData, QWORD nLength)
QWORD EraseRange (QWORD nOffset, QWORD nLength)
BOOL MakeComplete ()

Public Attributes

CFragmentedFilem_pFile
DWORD m_tReceived
BOOL m_bDiskFull

Protected Member Functions

BOOL OpenFile ()
void CloseFile ()
void DeleteFile (BOOL bForce=FALSE)
BOOL RunFile (DWORD tNow)
BOOL WriteMetadata (LPCTSTR pszPath)
BOOL AppendMetadata ()
BOOL AppendMetadataID3v1 (HANDLE hFile, CXMLElement *pXML)
virtual void Serialize (CArchive &ar, int nVersion)

Friends

class CDownloadTransfer

Constructor & Destructor Documentation

CDownloadWithFile::CDownloadWithFile  ) 
 

Definition at line 49 of file DownloadWithFile.cpp.

References m_bDiskFull, m_pFile, and m_tReceived.

CDownloadWithFile::~CDownloadWithFile  )  [virtual]
 

Definition at line 56 of file DownloadWithFile.cpp.

References m_pFile, and NULL.


Member Function Documentation

BOOL CDownloadWithFile::AppendMetadata  )  [protected]
 

Definition at line 579 of file DownloadWithFile.cpp.

References _tcsistr(), AppendMetadataID3v1(), CXMLElement::GetAttributeValue(), CXMLElement::GetFirstElement(), CSettings::Library, CDownloadWithSources::m_pXML, CDownloadBase::m_sLocalName, NULL, CXMLAttribute::schemaName, Settings, CSchema::uriAudio, and CSettings::sLibrary::VirtualFiles.

Referenced by CDownload::OnDownloaded().

BOOL CDownloadWithFile::AppendMetadataID3v1 HANDLE  hFile,
CXMLElement pXML
[protected]
 

Definition at line 607 of file DownloadWithFile.cpp.

References CXMLElement::GetAttributeValue(), ID3_GENRES, ID3V1_TAG, ID3V2_TAG, NULL, and CLibraryBuilderInternals::pszID3Genre.

Referenced by AppendMetadata().

BOOL CDownloadWithFile::AreRangesUseful const FF::SimpleFragmentList oAvailable  ) 
 

Definition at line 381 of file DownloadWithFile.cpp.

References CFragmentedFile::GetEmptyFragmentList(), CFragmentedFile::IsValid(), m_pFile, NULL, and detail::overlaps().

Referenced by CDownloadSource::HasUsefulRanges().

BOOL CDownloadWithFile::ClipUploadRange QWORD  nOffset,
QWORD nLength
const
 

Definition at line 444 of file DownloadWithFile.cpp.

References CFragmentedFile::GetEmptyFragmentList(), CFragmentedFile::IsPositionRemaining(), CFragmentedFile::IsValid(), CDownloadBase::m_nSize, m_pFile, and NULL.

Referenced by CUploadTransferHTTP::RequestPartialFile().

void CDownloadWithFile::CloseFile  )  [protected]
 

Definition at line 122 of file DownloadWithFile.cpp.

References CFragmentedFile::Close(), m_pFile, and NULL.

Referenced by CDownload::Remove(), and CDownload::StopTrying().

void CDownloadWithFile::DeleteFile BOOL  bForce = FALSE  )  [protected]
 

Definition at line 138 of file DownloadWithFile.cpp.

References GetVolumeComplete(), CFragmentedFile::IsValid(), m_pFile, CDownloadBase::m_sLocalName, NULL, CUploads::OnRename(), CDownloadBase::SetModified(), theApp, and Uploads.

Referenced by CDownloadWithExtras::DeletePreviews(), CDownload::OnMoved(), CDownload::Remove(), CDownload::Save(), CDownloadWithTorrent::SeedTorrent(), and CDownload::~CDownload().

QWORD CDownloadWithFile::EraseRange QWORD  nOffset,
QWORD  nLength
 

Definition at line 507 of file DownloadWithFile.cpp.

References CFragmentedFile::InvalidateRange(), m_pFile, NULL, and CDownloadBase::SetModified().

Referenced by CDownloadEditDlg::OnErase().

CString CDownloadWithFile::GetAvailableRanges  )  const [virtual]
 

Reimplemented in CDownloadWithTiger.

Definition at line 414 of file DownloadWithFile.cpp.

References detail::List< FragmentT, ContainerT >::begin(), detail::List< FragmentT, ContainerT >::end(), CFragmentedFile::GetEmptyFragmentList(), detail::inverse(), CFragmentedFile::IsValid(), m_pFile, and NULL.

Referenced by CDownloadWithTiger::GetAvailableRanges().

CString CDownloadWithFile::GetDisplayName  )  const
 

Definition at line 220 of file DownloadWithFile.cpp.

References CSHA::HashToString(), CDownloadBase::m_bSHA1, CDownloadBase::m_pSHA1, and CDownloadBase::m_sRemoteName.

Referenced by CDownloadTransferHTTP::AcceptPush(), CDownloads::Add(), CDownload::Boost(), CDownloadsCtrl::BubbleSortDownloads(), CDownloadTransferHTTP::Initiate(), CDownloadTransferFTP::Initiate(), CDownloadTransferED2K::OnCompressedPart(), CDownload::OnDownloaded(), CDownloadTransferED2K::OnDropped(), CDownloadTransferED2K::OnFileNotFound(), CDownloadTransferED2K::OnFileStatus(), CDownloadTransferHTTP::OnHeaderLine(), CDownloadTransferFTP::OnHeaderLine(), CDownloadTransferHTTP::OnHeadersComplete(), CDownload::OnMoved(), CBTClient::OnOnline(), CDownloadTransferED2K::OnSendingPart(), CDownload::Pause(), CBTTrackerRequest::Process(), CDownload::Remove(), CDownload::Resume(), CDownloadTransferED2K::RunQueued(), CDownloadTransferED2K::SendFragmentRequests(), CDownloadTransferBT::SendRequests(), CDownloadWithTiger::SetHashset(), CDownloadWithTiger::SetTigerTree(), CDownloadTransferHTTP::StartNextFragment(), CDownloadTransferFTP::StartNextFragment(), and CHomeDownloadsBox::Update().

const FF::SimpleFragmentList & CDownloadWithFile::GetEmptyFragmentList  )  const
 

Definition at line 237 of file DownloadWithFile.cpp.

References CFragmentedFile::GetEmptyFragmentList(), and m_pFile.

Referenced by CFragmentBar::DrawDownload(), CDownloadTransferED2K::SendFragmentRequests(), CDownloadTransferBT::SendRequests(), CFilePreviewDlg::SetDownload(), and CDownloadTransferBT::ShowInterest().

BOOL CDownloadWithFile::GetFragment CDownloadTransfer pTransfer  ) 
 

Definition at line 280 of file DownloadWithFile.cpp.

References detail::List< FragmentT, ContainerT >::begin(), FF::detail::Fragment< Payload, OffsetType >::begin(), detail::List< FragmentT, ContainerT >::empty(), FF::detail::Fragment< Payload, OffsetType >::end(), CDownloadTransfer::GetAverageSpeed(), CDownloadWithTransfers::GetFirstTransfer(), GetPossibleFragments(), FF::detail::Fragment< Payload, OffsetType >::length(), CDownloadTransfer::m_bRecvBackwards, NULL, PrepareFile(), detail::randomFragment(), and SIZE_UNKNOWN.

Referenced by CDownloadTransferHTTP::OnHeaderLine(), CDownloadTransferHTTP::OnHeadersComplete(), CDownloadTransferHTTP::StartNextFragment(), and CDownloadTransferFTP::StartNextFragment().

FF::SimpleFragmentList CDownloadWithFile::GetPossibleFragments const FF::SimpleFragmentList oAvailable,
FF::SimpleFragment oLargest
 

Definition at line 246 of file DownloadWithFile.cpp.

References detail::List< FragmentT, ContainerT >::begin(), detail::List< FragmentT, ContainerT >::empty(), detail::List< FragmentT, ContainerT >::end(), detail::List< FragmentT, ContainerT >::erase(), CFragmentedFile::GetEmptyFragmentList(), CDownloadWithTransfers::GetFirstTransfer(), detail::inverse(), detail::largestFragment(), detail::List< FragmentT, ContainerT >::limit(), m_pFile, and PrepareFile().

Referenced by GetFragment().

float CDownloadWithFile::GetProgress  )  const
 

Definition at line 178 of file DownloadWithFile.cpp.

References GetVolumeComplete(), CDownloadBase::m_nSize, and SIZE_UNKNOWN.

Referenced by CDownloadsCtrl::BubbleSortDownloads(), CDownloadsCtrl::GetDownloadStatus(), CDownloadsWnd::OnDownloadsHelp(), CDownloadTipCtrl::OnPaint(), CDownloadMonitorDlg::OnTimer(), and CDownloadTransferBT::SendRequests().

BOOL CDownloadWithFile::GetRandomRange QWORD nOffset,
QWORD nLength
const
 

Definition at line 470 of file DownloadWithFile.cpp.

References CFragmentedFile::GetEmptyFragmentList(), detail::inverse(), CFragmentedFile::IsValid(), m_pFile, NULL, and detail::randomFragment().

Referenced by CUploadTransferHTTP::RequestPartialFile().

DWORD CDownloadWithFile::GetTimeRemaining  )  const
 

Definition at line 212 of file DownloadWithFile.cpp.

References CDownloadWithTransfers::GetAverageSpeed(), and GetVolumeRemaining().

Referenced by CDownloadsCtrl::GetDownloadStatus(), CDownloadTipCtrl::OnPaint(), and CDownloadMonitorDlg::OnTimer().

QWORD CDownloadWithFile::GetVolumeComplete  )  const
 

Definition at line 184 of file DownloadWithFile.cpp.

References CFragmentedFile::GetCompleted(), CFragmentedFile::IsValid(), CDownloadBase::m_nSize, m_pFile, and NULL.

Referenced by CLocalSearch::AddHit(), CDownloadsCtrl::BubbleSortDownloads(), CDownloadWithTorrent::CheckTorrentRatio(), CDownloadTransfer::ChunkifyRequest(), DeleteFile(), CFragmentBar::DrawDownload(), CFragmentBar::DrawDownloadSimple(), GetProgress(), CDownload::IsStarted(), CDownloadTipCtrl::OnPaint(), CDownloadMonitorDlg::OnTimer(), CDownloadTransferED2K::SendFragmentRequests(), and CHomeDownloadsBox::Update().

QWORD CDownloadWithFile::GetVolumeRemaining  )  const
 

Definition at line 199 of file DownloadWithFile.cpp.

References CFragmentedFile::GetRemaining(), CFragmentedFile::IsValid(), CDownloadBase::m_nSize, m_pFile, NULL, and SIZE_UNKNOWN.

Referenced by GetTimeRemaining(), and CDownloadTransferED2K::SendFragmentRequests().

BOOL CDownloadWithFile::IsPositionEmpty QWORD  nOffset  ) 
 

Definition at line 372 of file DownloadWithFile.cpp.

References CFragmentedFile::IsPositionRemaining(), CFragmentedFile::IsValid(), m_pFile, and NULL.

Referenced by CDownloadTransferHTTP::OnHeaderLine(), and CDownloadTransferHTTP::OnHeadersComplete().

BOOL CDownloadWithFile::IsRangeUseful QWORD  nOffset,
QWORD  nLength
 

Definition at line 387 of file DownloadWithFile.cpp.

References CFragmentedFile::GetEmptyFragmentList(), CFragmentedFile::IsValid(), m_pFile, NULL, and detail::overlaps().

Referenced by CDownloadSource::HasUsefulRanges(), and CEDClient::WritePartStatus().

BOOL CDownloadWithFile::IsRangeUsefulEnough CDownloadTransfer pTransfer,
QWORD  nOffset,
QWORD  nLength
 

Definition at line 396 of file DownloadWithFile.cpp.

References CDownloadTransfer::GetAverageSpeed(), CFragmentedFile::GetEmptyFragmentList(), CFragmentedFile::IsValid(), CDownloadTransfer::m_bRecvBackwards, m_pFile, NULL, and detail::overlaps().

Referenced by CDownloadTransferHTTP::ReadContent().

BOOL CDownloadWithFile::MakeComplete  ) 
 

Definition at line 518 of file DownloadWithFile.cpp.

References m_pFile, CDownloadBase::m_sLocalName, CFragmentedFile::MakeComplete(), and PrepareFile().

Referenced by CDownloadEditDlg::OnLButtonUp().

BOOL CDownloadWithFile::OpenFile  )  [protected]
 

Definition at line 64 of file DownloadWithFile.cpp.

References CFragmentedFile::Create(), CDownloads::dlPathIncomplete, Downloads, CDownloadBase::GenerateLocalName(), IDS_DOWNLOAD_DISK_SPACE, IDS_DOWNLOAD_FILE_CREATE, IDS_DOWNLOAD_FILE_CREATE_ERROR, IDS_DOWNLOAD_FILE_OPEN_ERROR, CFragmentedFile::IsOpen(), CDownloads::IsSpaceAvailable(), CFragmentedFile::IsValid(), m_bDiskFull, CDownloadBase::m_nSize, m_pFile, CDownloadBase::m_sLocalName, CDownloadBase::m_sRemoteName, CShareazaApp::Message(), MSG_DEFAULT, MSG_ERROR, NULL, CFragmentedFile::Open(), CDownloadBase::SetModified(), Settings, SIZE_UNKNOWN, CSettings::SmartVolume(), and theApp.

Referenced by PrepareFile(), and CDownloadWithTiger::RunValidation().

BOOL CDownloadWithFile::PrepareFile  ) 
 

Definition at line 130 of file DownloadWithFile.cpp.

References CFragmentedFile::GetRemaining(), m_pFile, and OpenFile().

Referenced by GetFragment(), GetPossibleFragments(), MakeComplete(), CDownloadTransferBT::OnConnected(), CDownloadWithTorrent::RunTorrent(), and CDownloadTransferED2K::SendSecondaryRequest().

BOOL CDownloadWithFile::RunFile DWORD  tNow  )  [protected]
 

Definition at line 528 of file DownloadWithFile.cpp.

References CFragmentedFile::GetRemaining(), CFragmentedFile::IsOpen(), and m_pFile.

Referenced by CDownload::OnRun().

void CDownloadWithFile::Serialize CArchive &  ar,
int  nVersion
[protected, virtual]
 

Reimplemented from CDownloadWithSources.

Reimplemented in CDownload, CDownloadWithExtras, CDownloadWithTiger, and CDownloadWithTorrent.

Definition at line 656 of file DownloadWithFile.cpp.

References CDownloadBase::GenerateLocalName(), m_pFile, CDownloadBase::m_sLocalName, NULL, CFragmentedFile::Serialize(), and CDownloadWithSources::Serialize().

Referenced by CDownloadWithTorrent::Serialize().

BOOL CDownloadWithFile::SubmitData QWORD  nOffset,
LPBYTE  pData,
QWORD  nLength
 

Definition at line 488 of file DownloadWithFile.cpp.

References CDownloadWithTransfers::GetFirstTransfer(), CDownloadBase::m_bBTH, m_pFile, m_tReceived, NULL, PROTOCOL_BT, CDownloadBase::SetModified(), and CFragmentedFile::WriteRange().

Referenced by CDownloadTransferED2K::OnCompressedPart(), CDownloadTransferBT::OnPiece(), CDownloadTransferFTP::CFTPRETR::OnRead(), CDownloadTransferED2K::OnSendingPart(), and CDownloadTransferHTTP::ReadContent().

BOOL CDownloadWithFile::WriteMetadata LPCTSTR  pszPath  )  [protected]
 

Definition at line 541 of file DownloadWithFile.cpp.

References CDownloadWithSources::m_pXML, CDownloadBase::m_sLocalName, NULL, and CXMLElement::ToString().

Referenced by CDownload::OnMoved().


Friends And Related Function Documentation

friend class CDownloadTransfer [friend]
 

Reimplemented from CDownloadWithTransfers.

Reimplemented in CDownload.

Definition at line 78 of file DownloadWithFile.h.


Member Data Documentation

BOOL CDownloadWithFile::m_bDiskFull
 

Definition at line 43 of file DownloadWithFile.h.

Referenced by CDownloadWithFile(), CDownloadsCtrl::GetDownloadStatus(), CDownloadsWnd::OnDownloadsHelp(), CDownload::OnMoved(), CDownload::OnRun(), OpenFile(), CDownload::Resume(), and CDownloadWithTorrent::RunTorrent().

CFragmentedFile* CDownloadWithFile::m_pFile
 

Definition at line 41 of file DownloadWithFile.h.

Referenced by AreRangesUseful(), CDownload::Boost(), CDownloadWithSearch::CanSearch(), CDownloadWithFile(), ClipUploadRange(), CloseFile(), CDownloadWithTiger::ContinueValidation(), DeleteFile(), EraseRange(), CDownloadWithTorrent::FindMoreSources(), CDownloadWithTiger::FindNewValidationBlock(), CDownloadWithTiger::FinishValidation(), GetAvailableRanges(), GetEmptyFragmentList(), GetPossibleFragments(), GetRandomRange(), GetVolumeComplete(), GetVolumeRemaining(), CEDPartImporter::ImportFile(), CDownload::IsMoving(), IsPositionEmpty(), IsRangeUseful(), IsRangeUsefulEnough(), MakeComplete(), CDownload::OnDownloaded(), CDownload::OnMoved(), CDownload::OnRun(), CDownload::OnVerify(), OpenFile(), PrepareFile(), CDownload::Resume(), RunFile(), CDownloadWithTorrent::RunTorrent(), CDownloadWithTiger::RunValidation(), CDownloadWithTorrent::SeedTorrent(), Serialize(), CDownload::SerializeOld(), SubmitData(), and ~CDownloadWithFile().

DWORD CDownloadWithFile::m_tReceived
 

Definition at line 42 of file DownloadWithFile.h.

Referenced by CDownloadWithFile(), CDownload::OnRun(), CDownload::Resume(), CDownloadWithSearch::RunSearch(), SubmitData(), and CQuerySearch::WriteHashesToEDPacket().


The documentation for this class was generated from the following files:
Generated on Thu Dec 15 10:40:06 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2