-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiskMonitor.h
85 lines (75 loc) · 4.29 KB
/
DiskMonitor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//---------------------------------------------------------------------------
#ifndef DiskMonitorH
#define DiskMonitorH
//---------------------------------------------------------------------------
#include <stdlib.h>
#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
#include <Filectrl.hpp>
#include "DiskMonitorWaitThread.h"
//---------------------------------------------------------------------------
typedef void __fastcall (__closure *TMonitorNotifyDirEvent)(System::TObject* Sender, AnsiString *Pathname);
typedef void __fastcall (__closure *TMonitorNotifyFileEvent)(System::TObject* Sender, AnsiString *Pathname);
typedef void __fastcall (__closure *TMonitorNotifyFileModifyEvent)(System::TObject* Sender, AnsiString *Pathname, int Attributes, long FileSize, TDateTime LastModified);
typedef void __fastcall (__closure *TMonitorNotifyFileRenameEvent)(System::TObject* Sender, AnsiString *OldPathname, AnsiString *NewPathname);
typedef void __fastcall (__closure *TMonitorNotifyAttrEvent)(System::TObject* Sender, AnsiString *Pathname, int Attributes);
typedef void __fastcall (__closure *TMonitorNotifySizeEvent)(System::TObject* Sender, AnsiString *Pathname, long Size);
typedef void __fastcall (__closure *TMonitorNotifyTimeEvent)(System::TObject* Sender, AnsiString *Pathname, TDateTime FileDateTime);
//---------------------------------------------------------------------------
class PACKAGE TDiskMonitor : public TComponent
{
private:
TMonitorNotifyDirEvent FOnDirEvent;
TMonitorNotifyFileEvent FOnFileCreated;
TMonitorNotifyFileEvent FOnFileDeleted;
TMonitorNotifyFileModifyEvent FOnFileModified;
TMonitorNotifyFileRenameEvent FOnFileRenamed;
TMonitorNotifyAttrEvent FOnAttributeChange;
TMonitorNotifySizeEvent FOnSizeChange;
TMonitorNotifyTimeEvent FOnModifiedTimeChange;
bool FActive;
bool FExcludeSysFiles;
long FReceivedEvents;
long FHandledEvents;
bool Suspended;
double CleanupProgress;
TStringList *Monitors;
AnsiString *MultiplexFile;
AnsiString *AuxiliaryFile;
protected:
void __fastcall SetActive(bool act);
void __fastcall SetExcludeSysFiles(bool esf);
int __fastcall GetMonitorCount();
void __fastcall CleanupMonitors();
// void __fastcall EventMultiplexer(AnsiString Dir, AnsiString Filename, AnsiString Oldname, TMonitorFileInfo *Info, TMonitorFileInfo *Oldinfo, TMonitorChangedItem Item);
void __fastcall EventMultiplexer();
bool __fastcall DirExists(AnsiString dir);
public:
__fastcall TDiskMonitor(TComponent* Owner);
__fastcall ~TDiskMonitor();
void __fastcall Open();
void __fastcall Close();
void __fastcall Suspend();
void __fastcall Resume();
void __fastcall AddMonitorPath(TFileName Pathname, bool WatchSubTree);
void __fastcall ResetCounters();
double __fastcall GetCleanupProgress();
__published:
__property bool Active = {read=FActive, write=SetActive, default=false};
__property bool ExcludeSysFiles = {read=FExcludeSysFiles, write=SetExcludeSysFiles, default=true};
__property int MonitorCount = {read=GetMonitorCount};
__property long ReceivedEvents = {read=FReceivedEvents};
__property long HandledEvents = {read=FHandledEvents};
__property TMonitorNotifyDirEvent OnDirEvent = {read=FOnDirEvent, write=FOnDirEvent};
__property TMonitorNotifyFileEvent OnFileCreated = {read=FOnFileCreated, write=FOnFileCreated};
__property TMonitorNotifyFileEvent OnFileDeleted = {read=FOnFileDeleted, write=FOnFileDeleted};
__property TMonitorNotifyFileModifyEvent OnFileModified = {read=FOnFileModified, write=FOnFileModified};
__property TMonitorNotifyFileRenameEvent OnFileRenamed = {read=FOnFileRenamed, write=FOnFileRenamed};
__property TMonitorNotifyAttrEvent OnAttributeChange = {read=FOnAttributeChange, write=FOnAttributeChange};
__property TMonitorNotifySizeEvent OnSizeChange = {read=FOnSizeChange, write=FOnSizeChange};
__property TMonitorNotifyTimeEvent OnModifiedTimeChange = {read=FOnModifiedTimeChange, write=FOnModifiedTimeChange};
};
//---------------------------------------------------------------------------
#endif