00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(AFX_LIBRARY_H__28EBDAFA_BD15_4BBF_874D_1B6116B0E603__INCLUDED_)
00023 #define AFX_LIBRARY_H__28EBDAFA_BD15_4BBF_874D_1B6116B0E603__INCLUDED_
00024
00025 #pragma once
00026
00027 class CQuerySearch;
00028 class CLibraryFile;
00029 class CLibraryFolder;
00030 class CAlbumFolder;
00031
00032
00033 class CLibrary : public CComObject
00034 {
00035
00036 public:
00037 CLibrary();
00038 virtual ~CLibrary();
00039
00040 DECLARE_DYNAMIC(CLibrary)
00041
00042
00043 public:
00044 CMutex m_pSection;
00045 DWORD m_nUpdateCookie;
00046 DWORD m_nScanCount;
00047 protected:
00048 DWORD m_nScanCookie;
00049 DWORD m_nUpdateSaved;
00050 int m_nFileSwitch;
00051 DWORD m_nInhibit;
00052 protected:
00053 HANDLE m_hThread;
00054 BOOL m_bThread;
00055 CEvent m_pWakeup;
00056 public:
00057 HINSTANCE m_hKernel;
00058 BOOL (WINAPI* m_pfnGFAEW)(LPCWSTR, GET_FILEEX_INFO_LEVELS, LPVOID);
00059 BOOL (WINAPI* m_pfnGFAEA)(LPCSTR, GET_FILEEX_INFO_LEVELS, LPVOID);
00060
00061
00062 public:
00063 void Update()
00064 {
00065 CQuickLock oLock( m_pSection );
00066 m_nUpdateCookie = GetTickCount();
00067 }
00068 void Inhibit(BOOL bInhibit);
00069
00070
00071 public:
00072 CLibraryFile* LookupFile(DWORD nIndex, BOOL bSharedOnly = FALSE, BOOL bAvailableOnly = FALSE);
00073 CAlbumFolder* GetAlbumRoot();
00074 protected:
00075 void AddFile(CLibraryFile* pFile);
00076 void RemoveFile(CLibraryFile* pFile);
00077 void OnFileDelete(CLibraryFile* pFile);
00078
00079
00080 public:
00081 CPtrList* Search(CQuerySearch* pSearch, int nMaximum = 0, BOOL bLocal = FALSE);
00082 void Clear();
00083 BOOL Load();
00084 void Save();
00085 void StartThread();
00086 void StopThread();
00087 protected:
00088 void Serialize(CArchive& ar);
00089 private:
00090 static UINT ThreadStart(LPVOID pParam);
00091 void OnRun();
00092 BOOL ThreadScan();
00093
00094 friend class CLibraryFolder;
00095 friend class CLibraryFile;
00096 friend class CLibraryBuilder;
00097
00098
00099 protected:
00100 BEGIN_INTERFACE_PART(Library, ILibrary)
00101 DECLARE_DISPATCH()
00102 STDMETHOD(get_Application)(IApplication FAR* FAR* ppApplication);
00103 STDMETHOD(get_Library)(ILibrary FAR* FAR* ppLibrary);
00104 STDMETHOD(get_Folders)(ILibraryFolders FAR* FAR* ppFolders);
00105 STDMETHOD(get_Albums)(IUnknown FAR* FAR* ppAlbums);
00106 STDMETHOD(get_Files)(ILibraryFiles FAR* FAR* ppFiles);
00107 STDMETHOD(FindByName)(BSTR sName, ILibraryFile FAR* FAR* ppFile);
00108 STDMETHOD(FindByPath)(BSTR sPath, ILibraryFile FAR* FAR* ppFile);
00109 STDMETHOD(FindByURN)(BSTR sURN, ILibraryFile FAR* FAR* ppFile);
00110 STDMETHOD(FindByIndex)(LONG nIndex, ILibraryFile FAR* FAR* ppFile);
00111 END_INTERFACE_PART(Library)
00112
00113 DECLARE_INTERFACE_MAP()
00114
00115 };
00116
00117 extern CLibrary Library;
00118
00119 #include "LibraryList.h"
00120 #include "LibraryMaps.h"
00121
00122 #endif