00001 // 00002 // LibraryHistory.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_LIBRARYHISTORY_H__71D206EC_CDA8_46AD_9800_4A11C9EBAEA5__INCLUDED_) 00023 #define AFX_LIBRARYHISTORY_H__71D206EC_CDA8_46AD_9800_4A11C9EBAEA5__INCLUDED_ 00024 00025 #pragma once 00026 00027 class CLibraryRecent; 00028 class CLibraryFile; 00029 00030 00031 class CLibraryHistory 00032 { 00033 // Construction 00034 public: 00035 CLibraryHistory(); 00036 virtual ~CLibraryHistory(); 00037 00038 // Attributes 00039 protected: 00040 CPtrList m_pList; 00041 00042 public: 00043 struct sTorrentDetails 00044 { 00045 CString m_sName; 00046 CString m_sPath; 00047 SHA1 m_pBTH; 00048 DWORD m_tLastSeeded; 00049 QWORD m_nUploaded; 00050 QWORD m_nDownloaded; 00051 }; 00052 00053 sTorrentDetails LastSeededTorrent; // Most recently seeded torrent (for home page button) 00054 sTorrentDetails LastCompletedTorrent; // Most recently completed torrent that didn't reach 100% ratio 00055 00056 00057 // Operations 00058 public: 00059 POSITION GetIterator() const; 00060 CLibraryRecent* GetNext(POSITION& pos) const; 00061 int GetCount() const; 00062 void Clear(); 00063 public: 00064 BOOL Check(CLibraryRecent* pRecent, int nScope = 0) const; 00065 CLibraryRecent* GetByPath(LPCTSTR pszPath) const; 00066 CLibraryRecent* Add(LPCTSTR pszPath, const SHA1* pSHA1, const MD4* pED2K, LPCTSTR pszSources); 00067 BOOL Submit(CLibraryFile* pFile); 00068 void OnFileDelete(CLibraryFile* pFile); 00069 void ClearTodays(); 00070 int Prune(); 00071 void Serialize(CArchive& ar, int nVersion); 00072 00073 }; 00074 00075 00076 class CLibraryRecent 00077 { 00078 // Construction 00079 public: 00080 CLibraryRecent(); 00081 CLibraryRecent(LPCTSTR pszPath, const SHA1* pSHA1, const MD4* pED2K, LPCTSTR pszSources); 00082 virtual ~CLibraryRecent(); 00083 00084 // Attributes 00085 public: 00086 FILETIME m_tAdded; 00087 BOOL m_bToday; 00088 public: 00089 CLibraryFile* m_pFile; 00090 public: 00091 BOOL m_bSHA1; 00092 SHA1 m_pSHA1; 00093 BOOL m_bED2K; 00094 MD4 m_pED2K; 00095 CString m_sPath; 00096 CString m_sSources; 00097 00098 // Operations 00099 public: 00100 void RunVerify(CLibraryFile* pFile); 00101 void Serialize(CArchive& ar, int nVersion); 00102 00103 }; 00104 00105 extern CLibraryHistory LibraryHistory; 00106 00107 #endif // !defined(AFX_LIBRARYHISTORY_H__71D206EC_CDA8_46AD_9800_4A11C9EBAEA5__INCLUDED_)