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_LIBRARYBUILDER_H__B2779061_437E_4C10_AC9F_1E2AC7885C40__INCLUDED_)
00023 #define AFX_LIBRARYBUILDER_H__B2779061_437E_4C10_AC9F_1E2AC7885C40__INCLUDED_
00024
00025 #pragma once
00026
00027 class CLibraryFile;
00028 class CXMLElement;
00029 class CLibraryBuilderInternals;
00030 class CLibraryBuilderPlugins;
00031
00032
00033 class CLibraryBuilder
00034 {
00035
00036 public:
00037 CLibraryBuilder();
00038 virtual ~CLibraryBuilder();
00039
00040
00041 protected:
00042 CCriticalSection m_pSection;
00043 CPtrList m_pFiles;
00044 CStringList m_pPriority;
00045 HANDLE m_hThread;
00046 BOOL m_bThread;
00047 BOOL m_bPriority;
00048 DWORD m_nHashSleep;
00049 DWORD m_nIndex;
00050 CString m_sPath;
00051 DWORD m_tActive;
00052 BYTE* m_pBuffer;
00053 protected:
00054 CLibraryBuilderInternals* m_pInternals;
00055 CLibraryBuilderPlugins* m_pPlugins;
00056
00057
00058 public:
00059 void Add(CLibraryFile* pFile);
00060 void Remove(CLibraryFile* pFile);
00061 int GetRemaining();
00062 CString GetCurrentFile();
00063 void RequestPriority(LPCTSTR pszPath);
00064 void Clear();
00065 BOOL StartThread();
00066 void StopThread();
00067 void BoostPriority(BOOL bPriority);
00068 BOOL GetBoostPriority();
00069
00070 void UpdateStatus(CString* pStr, int* pRemaining );
00071 protected:
00072 static UINT ThreadStart(LPVOID pParam);
00073 void OnRun();
00074 BOOL HashFile(HANDLE hFile, BOOL bPriority, SHA1* pSHA1);
00075 BOOL SubmitMetadata(LPCTSTR pszSchemaURI, CXMLElement*& pXML);
00076 BOOL SubmitCorrupted();
00077 BOOL DetectVirtualFile(HANDLE hFile, QWORD& nOffset, QWORD& nLength);
00078 BOOL DetectVirtualID3v1(HANDLE hFile, QWORD& nOffset, QWORD& nLength);
00079 BOOL DetectVirtualID3v2(HANDLE hFile, QWORD& nOffset, QWORD& nLength);
00080
00081 friend class CLibraryBuilderInternals;
00082 friend class CLibraryBuilderPlugins;
00083
00084 };
00085
00086 extern CLibraryBuilder LibraryBuilder;
00087
00088 #endif // !defined(AFX_LIBRARYBUILDER_H__B2779061_437E_4C10_AC9F_1E2AC7885C40__INCLUDED_)