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

DownloadTask.h

Go to the documentation of this file.
00001 //
00002 // DownloadTask.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_DOWNLOADTASK_H__F90D6932_4D5C_4670_AA6D_9C8316A0172A__INCLUDED_)
00023 #define AFX_DOWNLOADTASK_H__F90D6932_4D5C_4670_AA6D_9C8316A0172A__INCLUDED_
00024 
00025 #pragma once
00026 
00027 #include "BTInfo.h"
00028 
00029 class CDownload;
00030 
00031 
00032 class CDownloadTask : public CWinThread
00033 {
00034 // Construction
00035 public:
00036         CDownloadTask(CDownload* pDownload, int nTask);
00037         virtual ~CDownloadTask();
00038 
00039         DECLARE_DYNAMIC(CDownloadTask)
00040 
00041 // Attributes
00042 public:
00043         int                     m_nTask;
00044         CDownload*      m_pDownload;
00045         BOOL            m_bSuccess;
00046 private:
00047         int                     m_nTorrentFile;
00048 public:
00049         QWORD           m_nSize;
00050         CString         m_sName;
00051         CString         m_sFilename;
00052         CString         m_sPath;
00053         CBTInfo         m_pTorrent;
00054 protected:
00055         CEvent*         m_pEvent;
00056 
00057 // Enumerations
00058 public:
00059         enum { dtaskAllocate, dtaskCopySimple, dtaskCopyTorrent };
00060 
00061 // Operations
00062 public:
00063         void    Abort();
00064         BOOL    WasAborted();
00065 protected:
00066         void    RunAllocate();
00067         void    RunCopySimple();
00068         void    RunCopyTorrent();
00069         BOOL    CopyFile(HANDLE hSource, LPCTSTR pszTarget, QWORD nLength);
00070         void    CreatePathForFile(const CString& strBase, const CString& strPath);
00071 
00072 // Utilities
00073 public:
00074         static CString SafeFilename(LPCTSTR pszName);
00075 
00076 // Overrides
00077 public:
00078         //{{AFX_VIRTUAL(CDownloadTask)
00079         public:
00080         virtual BOOL InitInstance();
00081         virtual int Run();
00082         //}}AFX_VIRTUAL
00083 
00084 // Implementation
00085 protected:
00086         //{{AFX_MSG(CDownloadTask)
00087         //}}AFX_MSG
00088 
00089         DECLARE_MESSAGE_MAP()
00090 };
00091 
00092 //{{AFX_INSERT_LOCATION}}
00093 
00094 #endif // !defined(AFX_DOWNLOADTASK_H__F90D6932_4D5C_4670_AA6D_9C8316A0172A__INCLUDED_)

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