FolderInfo.dll: Updated to new API and code cosmetics

This commit is contained in:
Birunthan Mohanathas
2012-03-17 14:27:20 +02:00
parent e09085137d
commit 0a632ea749
4 changed files with 274 additions and 363 deletions

View File

@ -1,88 +1,68 @@
/*
Copyright (C) 2010 Elestel
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#pragma once
#include <string>
#include <vector>
#include <windows.h>
#include "../../Library/RawString.h"
#include "../../Library/pcre-8.10/config.h"
#include "../../Library/pcre-8.10/pcre.h"
namespace PluginFolderInfo {
struct FileInfo
class CFolderInfo
{
std::wstring Name;
bool IsFolder;
UINT64 Size;
public:
CFolderInfo(LPCWSTR path);
~CFolderInfo();
FileInfo()
{
IsFolder = false;
Size = 0;
}
};
void AddInstance();
void RemoveInstance();
class FolderInfo
{
private:
bool mySubFolderFlag;
bool myHiddenFileFlag;
bool mySystemFileFlag;
std::wstring myPath;
UINT64 mySize;
unsigned int myFileCount;
unsigned int myFolderCount;
pcre* myRegExpFilter;
pcre_extra* myRegExpFilterExtra;
DWORD myLastUpdateTime;
DWORD GetLastUpdateTime() { return m_LastUpdateTime; }
void SetRegExpFilter(LPCWSTR filter);
void IncludeSubFolders(bool flag) { m_IncludeSubFolders = flag; }
void IncludeHiddenFiles(bool flag) { m_IncludeHiddenFiles = flag; }
void IncludeSystemFiles(bool flag) { m_IncludeSystemFiles = flag; }
LPCWSTR GetPath() { return m_Path.c_str(); }
UINT64 GetSize() { return m_Size; }
int GetFileCount() { return m_FileCount; }
int GetFolderCount() { return m_FolderCount; }
void Update();
private:
void Clear();
void FreePcre();
void CalculateSize();
void SetPath(const wchar_t* aPath, const wchar_t* aIniPath);
public:
DWORD GetLastUpdateTime()
{
return myLastUpdateTime;
}
UINT m_InstanceCount;
void SetRegExpFilter(const wchar_t* aFilter);
void IncludeSubFolders(bool aFlag)
{
mySubFolderFlag = aFlag;
}
void IncludeHiddenFiles(bool aFlag)
{
myHiddenFileFlag = aFlag;
}
void IncludeSystemFiles(bool aFlag)
{
mySystemFileFlag = aFlag;
}
UINT64 GetSize()
{
return mySize;
}
int GetFileCount()
{
return myFileCount;
}
int GetFolderCount()
{
return myFolderCount;
}
FolderInfo(const wchar_t* aPath, const wchar_t* aIniPath);
~FolderInfo();
void Update();
}; // class FolderInfo
} // namespace PluginFolderInfo
CRawString m_Path;
bool m_IncludeSubFolders;
bool m_IncludeHiddenFiles;
bool m_IncludeSystemFiles;
UINT64 m_Size;
UINT m_FileCount;
UINT m_FolderCount;
pcre* m_RegExpFilter;
DWORD m_LastUpdateTime;
};