-
Notifications
You must be signed in to change notification settings - Fork 0
/
master.h
43 lines (38 loc) · 1.02 KB
/
master.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
#pragma once
#include "worker.h"
class Master {
HWND hDialog = nullptr;
Worker *pFirst = nullptr;
public:
void messageInit(HWND hDlg) {
hDialog = hDlg;
}
void startWorker(PCWSTR file, PCSTR key, WPARAM wParam) {
const auto worker = new Worker;
if (pFirst) {
worker->index = pFirst->index + 1;
worker->next = pFirst;
}
pFirst = worker;
worker->initWorker(hDialog, file, key, wParam);
worker->runWorker();
}
Worker *removeSucceed() {
auto before = pFirst;
auto current = pFirst;
while (current != nullptr) {
if (current->success) {
if (before == pFirst) {
pFirst = current->next;
} else {
before->next = current->next;
}
return current;
} else {
before = current;
current = current->next;
}
}
return nullptr;
}
};