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

DownloadWithFile.h

Go to the documentation of this file.
00001 //
00002 // DownloadWithFile.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_DOWNLOADWITHFILE_H__79FE6B65_04DF_4CD5_A1BC_9AF8429664DC__INCLUDED_)
00023 #define AFX_DOWNLOADWITHFILE_H__79FE6B65_04DF_4CD5_A1BC_9AF8429664DC__INCLUDED_
00024 
00025 #pragma once
00026 
00027 #include "DownloadWithTransfers.h"
00028 #include "FileFragments.hpp"
00029 
00030 class CFragmentedFile;
00031 
00032 class CDownloadWithFile : public CDownloadWithTransfers
00033 {
00034 // Construction
00035 public:
00036         CDownloadWithFile();
00037         virtual ~CDownloadWithFile();
00038 
00039 // Attributes
00040 public:
00041         CFragmentedFile*        m_pFile;
00042         DWORD                           m_tReceived;
00043         BOOL                            m_bDiskFull;
00044 
00045 // Operations
00046 public:
00047         float                   GetProgress() const;
00048         QWORD                   GetVolumeComplete() const;
00049         QWORD                   GetVolumeRemaining() const;
00050         DWORD                   GetTimeRemaining() const;
00051         CString                 GetDisplayName() const;
00052 public:
00053     const FF::SimpleFragmentList& GetEmptyFragmentList() const;
00054     FF::SimpleFragmentList GetPossibleFragments(const FF::SimpleFragmentList& oAvailable, FF::SimpleFragment& oLargest);
00055         BOOL                    GetFragment(CDownloadTransfer* pTransfer);
00056         BOOL                    IsPositionEmpty(QWORD nOffset);
00057     BOOL            AreRangesUseful(const FF::SimpleFragmentList& oAvailable);
00058         BOOL                    IsRangeUseful(QWORD nOffset, QWORD nLength);
00059         BOOL                    IsRangeUsefulEnough(CDownloadTransfer* pTransfer, QWORD nOffset, QWORD nLength);
00060         virtual CString GetAvailableRanges() const;
00061         BOOL                    ClipUploadRange(QWORD nOffset, QWORD& nLength) const;
00062         BOOL                    GetRandomRange(QWORD& nOffset, QWORD& nLength) const;
00063         BOOL                    PrepareFile();
00064         BOOL                    SubmitData(QWORD nOffset, LPBYTE pData, QWORD nLength);
00065         QWORD                   EraseRange(QWORD nOffset, QWORD nLength);
00066         BOOL                    MakeComplete();
00067 protected:
00068         BOOL                    OpenFile();
00069         void                    CloseFile();
00070         void                    DeleteFile(BOOL bForce = FALSE);
00071         BOOL                    RunFile(DWORD tNow);
00072         BOOL                    WriteMetadata(LPCTSTR pszPath);
00073         BOOL                    AppendMetadata();
00074         BOOL                    AppendMetadataID3v1(HANDLE hFile, CXMLElement* pXML);
00075 protected:
00076         virtual void    Serialize(CArchive& ar, int nVersion);
00077 
00078         friend class CDownloadTransfer;
00079 };
00080 
00081 #endif // !defined(AFX_DOWNLOADWITHFILE_H__79FE6B65_04DF_4CD5_A1BC_9AF8429664DC__INCLUDED_)

Generated on Thu Dec 15 10:39:41 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2