-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
56 lines (47 loc) · 1.76 KB
/
main.cpp
File metadata and controls
56 lines (47 loc) · 1.76 KB
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
#include <csettings.h>
#include <cfilesanalize.h>
#include <creport.h>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
if(argc < 2)
{
cout << "usage: " << argv[0] << " <-init|-check>" << endl;
return -1;
}
QString confPath = "C:/Users/test/Documents/secnsafe";
//QString confPath = "/etc/secnsafe";
QTextCodec *codec = QTextCodec::codecForName("utf-8");
QTextCodec::setCodecForCStrings(codec);
QTextCodec::setCodecForLocale(codec);
QTextCodec::setCodecForTr(codec);
CFilesAnalize *analizator = new CFilesAnalize();
CReport *report = new CReport();
CSettings &settings = CSettings::instance();
settings.setConfPath(confPath);
settings.loadSettings(confPath + "/secnsafe.conf");
if(qstrcmp(argv[1],"-init") == 0) {
foreach(QString path, settings.getPaths()){
analizator->setFileTypes(settings.getValue(path, "filetypes"));
analizator->setExclusions(settings.getValue(path, "exclusions"));
analizator->getState(path);
}
}
else if(qstrcmp(argv[1],"-check") == 0) {
foreach(QString path, settings.getPaths()){
analizator->setFileTypes(settings.getValue(path, "filetypes"));
analizator->setExclusions(settings.getValue(path, "exclusions"));
analizator->checkState(path);
report->setAddedItems(analizator->getAddedItems());
report->setChangedItmes(analizator->getChangedItmes());
report->setDeletedItmes(analizator->getDeletedItmes());
report->showReport();
}
}
else {
cout << "usage: " << argv[0] << " <-init|-check>" << endl;
return -1;
}
return 0;
}