forked from Public-Mirror/Textractor
add prefilter
This commit is contained in:
parent
5f74684b46
commit
0b7db9e5ca
@ -144,6 +144,7 @@ namespace Host
|
|||||||
void Start(ProcessEventCallback onAttach, ProcessEventCallback onDetach, ThreadEventCallback onCreate, ThreadEventCallback onRemove)
|
void Start(ProcessEventCallback onAttach, ProcessEventCallback onDetach, ThreadEventCallback onCreate, ThreadEventCallback onRemove)
|
||||||
{
|
{
|
||||||
OnAttach = onAttach; OnDetach = onDetach; OnCreate = onCreate; OnRemove = onRemove;
|
OnAttach = onAttach; OnDetach = onDetach; OnCreate = onCreate; OnRemove = onRemove;
|
||||||
|
TextThread::Prefilter = (int(*)(wchar_t*, const wchar_t*))GetProcAddress(LoadLibraryW(L"0_Prefilter.dll"), "OnNewData");
|
||||||
OnCreate(textThreadsByParams[CONSOLE] = new TextThread(CONSOLE, USING_UNICODE));
|
OnCreate(textThreadsByParams[CONSOLE] = new TextThread(CONSOLE, USING_UNICODE));
|
||||||
StartPipe();
|
StartPipe();
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ void TextThread::AddText(const BYTE* data, int len)
|
|||||||
? std::wstring((wchar_t*)data, len / 2)
|
? std::wstring((wchar_t*)data, len / 2)
|
||||||
: StringToWideString(std::string((char*)data, len), status & USING_UTF8 ? CP_UTF8 : SHIFT_JIS);
|
: StringToWideString(std::string((char*)data, len), status & USING_UTF8 ? CP_UTF8 : SHIFT_JIS);
|
||||||
LOCK(ttMutex);
|
LOCK(ttMutex);
|
||||||
|
if (Prefilter) wData.resize(Prefilter(wData.data(), storage.c_str()));
|
||||||
buffer.append(wData);
|
buffer.append(wData);
|
||||||
timestamp = GetTickCount();
|
timestamp = GetTickCount();
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ public:
|
|||||||
const std::wstring name;
|
const std::wstring name;
|
||||||
const ThreadParam tp;
|
const ThreadParam tp;
|
||||||
|
|
||||||
|
inline static int(*Prefilter)(wchar_t*, const wchar_t*) = nullptr;
|
||||||
inline static int FlushDelay = 250; // flush every 250ms by default
|
inline static int FlushDelay = 250; // flush every 250ms by default
|
||||||
inline static int MaxBufferSize = 200;
|
inline static int MaxBufferSize = 200;
|
||||||
inline static int ThreadCounter = 0;
|
inline static int ThreadCounter = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user