Sandboxie/SandboxiePlus/SandMan/BoxMonitor.h

57 lines
987 B
C
Raw Normal View History

2022-05-16 20:30:40 +01:00
#pragma once
#include "Helpers/ReadDirectoryChanges.h"
#include "SbiePlusAPI.h"
class CBoxMonitor : public QThread, public CReadDirectoryChanges
{
Q_OBJECT
public:
CBoxMonitor();
~CBoxMonitor();
2022-09-29 17:28:48 +01:00
virtual void Notify(const std::wstring& strDirectory);
2022-05-16 20:30:40 +01:00
virtual void run();
2022-06-13 19:12:53 +01:00
void WatchBox(CSandBoxPlus* pBox);
void ScanBox(CSandBoxPlus* pBox);
void CloseBox(CSandBoxPlus* pBox);
void RemoveBox(CSandBoxPlus* pBox);
bool IsScanPending(const CSandBoxPlus* pBox);
void Stop();
2022-05-16 20:30:40 +01:00
private slots:
void UpdateBox(const QString& Path);
protected:
struct SBox
{
SBox() {
2022-06-13 19:12:53 +01:00
ForceUpdate = false;
2022-05-16 20:30:40 +01:00
Changed = false;
2022-06-13 19:12:53 +01:00
IsWatched = false;
2022-05-16 20:30:40 +01:00
LastScan = 0;
ScanDuration = 0;
TotalSize = 0;
}
QPointer<CSandBoxPlus> pBox;
2022-06-13 19:12:53 +01:00
bool ForceUpdate;
2022-05-16 20:30:40 +01:00
bool Changed;
2022-06-13 19:12:53 +01:00
bool IsWatched;
2022-05-16 20:30:40 +01:00
quint64 LastScan;
quint64 ScanDuration;
quint64 TotalSize;
};
quint64 CounDirSize(const QString& Dir, SBox* Box);
QMutex m_Mutex;
QMap<QString, SBox> m_Boxes;
bool m_bTerminate;
};