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

SharedFile.h

Go to the documentation of this file.
00001 //
00002 // SharedFile.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_SHAREDFILE_H__8FFCC311_D43C_445D_BAEB_575AE2AE8E99__INCLUDED_)
00023 #define AFX_SHAREDFILE_H__8FFCC311_D43C_445D_BAEB_575AE2AE8E99__INCLUDED_
00024 
00025 #pragma once
00026 
00027 class CLibraryFolder;
00028 class CSharedSource;
00029 class CSchema;
00030 class CXMLElement;
00031 class CQuerySearch;
00032 class CLibraryDownload;
00033 class CTigerTree;
00034 class CED2K;
00035 
00036 
00037 class CLibraryFile : public CComObject
00038 {
00039 // Construction
00040 public:
00041         CLibraryFile(CLibraryFolder* pFolder, LPCTSTR pszName = NULL);
00042         virtual ~CLibraryFile();
00043         
00044         DECLARE_DYNAMIC(CLibraryFile)
00045         
00046 // Attributes
00047 public:
00048         CLibraryFile*   m_pNextSHA1;
00049         CLibraryFile*   m_pNextTiger;
00050         CLibraryFile*   m_pNextED2K;
00051         DWORD                   m_nScanCookie;
00052         DWORD                   m_nUpdateCookie;
00053         DWORD                   m_nSelectCookie;
00054         DWORD                   m_nListCookie;
00055 public:
00056         CLibraryFolder* m_pFolder;
00057         CString                 m_sName;
00058         DWORD                   m_nIndex;
00059         QWORD                   m_nSize;
00060         FILETIME                m_pTime;
00061         TRISTATE                m_bShared;
00062         QWORD                   m_nVirtualBase;
00063         QWORD                   m_nVirtualSize;
00064 public:
00065         BOOL                    m_bSHA1;
00066         SHA1                    m_pSHA1;
00067         BOOL                    m_bTiger;
00068         TIGEROOT                m_pTiger;
00069         BOOL                    m_bMD5;
00070         MD5                             m_pMD5;
00071         BOOL                    m_bED2K;
00072         MD4                             m_pED2K;
00073         TRISTATE                m_bVerify;
00074 public:
00075         CSchema*                m_pSchema;
00076         CXMLElement*    m_pMetadata;
00077         BOOL                    m_bMetadataAuto;
00078         FILETIME                m_pMetadataTime;
00079         int                             m_nRating;
00080         CString                 m_sComments;
00081         CString                 m_sShareTags;
00082 public:
00083         DWORD                   m_nHitsToday;
00084         DWORD                   m_nHitsTotal;
00085         DWORD                   m_nUploadsToday;
00086         DWORD                   m_nUploadsTotal;
00087         BOOL                    m_bCachedPreview;
00088         BOOL                    m_bBogus;
00089         CPtrList                m_pSources;
00090 public:
00091         DWORD                   m_nSearchCookie;
00092         DWORD                   m_nSearchWords;
00093         CLibraryFile*   m_pNextHit;
00094         DWORD                   m_nCollIndex;
00095         int                             m_nIcon16;
00096         
00097 // Operations
00098 public:
00099         CString                 GetPath() const;
00100         CString                 GetSearchName() const;
00101         BOOL                    IsShared() const;
00102         inline BOOL             IsGhost() const { return m_pFolder == NULL; }
00103         inline BOOL             IsAvailable() const { return m_pFolder != NULL; }
00104         BOOL                    IsSchemaURI(LPCTSTR pszURI) const;
00105 public:
00106         BOOL                    Rebuild();
00107         BOOL                    Rename(LPCTSTR pszName);
00108         BOOL                    Delete();
00109         BOOL                    SetMetadata(CXMLElement* pXML);
00110         CString                 GetMetadataWords() const;
00111         BOOL                    SaveMetadata();
00112         CTigerTree*             GetTigerTree();
00113         CED2K*                  GetED2K();
00114 public:
00115         CSharedSource*  AddAlternateSource(LPCTSTR pszURL, BOOL bForce = TRUE);
00116         CSharedSource*  AddAlternateSources(LPCTSTR pszURL);
00117         CString                 GetAlternateSources(CStringList* pState, int nMaximum, PROTOCOLID nProtocol);
00118 protected:
00119         void                    Serialize(CArchive& ar, int nVersion);
00120         BOOL                    ThreadScan(CSingleLock& pLock, DWORD nScanCookie, QWORD nSize, FILETIME* pTime, LPCTSTR pszMetaData);
00121         BOOL                    LoadMetadata(HANDLE hFile);
00122         void                    OnDelete();
00123         void                    Ghost();
00124         BOOL                    OnVerifyDownload(const SHA1* pSHA1, const MD4* pED2K, LPCTSTR pszSources);
00125         
00126 // Inlines
00127 public:
00128         inline CString GetNameLC() const
00129         {
00130                 CString str = m_sName;
00131                 CharLower( str.GetBuffer() );
00132                 str.ReleaseBuffer();
00133                 return str;
00134         }
00135         
00136         inline QWORD GetSize() const
00137         {
00138                 return ( m_nVirtualSize > 0 ) ? m_nVirtualSize : m_nSize;
00139         }
00140         
00141 // Friends
00142 public:
00143         friend class CLibrary;
00144         friend class CLibraryFolder;
00145         friend class CLibraryMaps;
00146         friend class CLibraryRecent;
00147         friend class CDeleteFileDlg;
00148         
00149 // Automation
00150 protected:
00151         BEGIN_INTERFACE_PART(LibraryFile, ILibraryFile)
00152                 DECLARE_DISPATCH()
00153                 STDMETHOD(get_Application)(IApplication FAR* FAR* ppApplication);
00154                 STDMETHOD(get_Library)(ILibrary FAR* FAR* ppLibrary);
00155                 STDMETHOD(get_Folder)(ILibraryFolder FAR* FAR* ppFolder);
00156                 STDMETHOD(get_Path)(BSTR FAR* psPath);
00157                 STDMETHOD(get_Name)(BSTR FAR* psPath);
00158                 STDMETHOD(get_Shared)(STRISTATE FAR* pnValue);
00159                 STDMETHOD(put_Shared)(STRISTATE nValue);
00160                 STDMETHOD(get_EffectiveShared)(VARIANT_BOOL FAR* pbValue);
00161                 STDMETHOD(get_Size)(LONG FAR* pnSize);
00162                 STDMETHOD(get_Index)(LONG FAR* pnIndex);
00163                 STDMETHOD(get_URN)(BSTR sURN, BSTR FAR* psURN);
00164                 STDMETHOD(get_MetadataAuto)(VARIANT_BOOL FAR* pbValue);
00165                 STDMETHOD(get_Metadata)(ISXMLElement FAR* FAR* ppXML);
00166                 STDMETHOD(put_Metadata)(ISXMLElement FAR* pXML);
00167                 STDMETHOD(Execute)();
00168                 STDMETHOD(SmartExecute)();
00169                 STDMETHOD(Delete)();
00170                 STDMETHOD(Rename)(BSTR sNewName);
00171                 STDMETHOD(Copy)(BSTR sNewPath);
00172                 STDMETHOD(Move)(BSTR sNewPath);
00173         END_INTERFACE_PART(LibraryFile)
00174         
00175         DECLARE_INTERFACE_MAP()
00176         
00177 };
00178 
00179 
00180 class CSharedSource
00181 {
00182 // Construction
00183 public:
00184         CSharedSource(LPCTSTR pszURL = NULL, FILETIME* pTime = NULL);
00185 
00186 // Attributes
00187 public:
00188         CString         m_sURL;                                                                 // The URL
00189         FILETIME        m_pTime;                                                                // Time last seen
00190 
00191 // Operations
00192 public:
00193         void    Serialize(CArchive& ar, int nVersion);
00194         void    Freshen(FILETIME* pTime = NULL);
00195         BOOL    IsExpired(FILETIME& tNow);
00196 
00197 };
00198 
00199 
00200 #endif // !defined(AFX_SHAREDFILE_H__8FFCC311_D43C_445D_BAEB_575AE2AE8E99__INCLUDED_)

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