-
-
Notifications
You must be signed in to change notification settings - Fork 222
/
Copy pathClipEditThread.h
34 lines (27 loc) · 857 Bytes
/
ClipEditThread.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
#pragma once
#include "EventThread.h"
#include "Path.h"
class CClipEditThread : public CEventThread
{
public:
CClipEditThread();
virtual ~CClipEditThread();
void Close();
void StartWatchingFolderForChanges();
void WatchFile(CString filePath);
private:
void OnEvent(int eventId, void* param) override;
void OnFileChanged();
void OnTimeOut(void* param) override;
bool ReadFile(CString filePath, bool& unicode, CString& unicodeText, CStringA& utf8Text);
BOOL GetTextFromRTF(CStringA rtf, CString& unicodeText);
void RefreshWatch();
bool SaveToClip(CString filePath, int id);
HANDLE m_folderHandle;
FILE_NOTIFY_INFORMATION m_fileChangeBuffer[10000];
OVERLAPPED m_overlapped;
std::map<CString, bool> m_filesToSave;
std::map<CString, int> m_newClipIds;
CCriticalSection m_fileEditsLock;
std::map<CString, CTime> m_fileEditStarts;
};