-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutilities.h
executable file
·47 lines (38 loc) · 1.46 KB
/
utilities.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
#ifndef UTILITIES_H
#define UTILITIES_H
#include <QRegExp>
#include <QRegularExpression>
#include <QString>
#include <QJsonDocument>
#ifdef Q_OS_WIN
#include <windows.h>
#include <tlhelp32.h>
#endif
class Utils : public QObject
{
Q_OBJECT
public:
static QString getRandomString(int len);
static QString SafeBase64Decode(QString string);
static QString VerifyJsonString(const QString &source);
static QString JsonToString(const QJsonObject &json, QJsonDocument::JsonFormat format);
static QString JsonToString(const QJsonArray &array, QJsonDocument::JsonFormat format);
static QJsonObject JsonFromString(const QString &string);
static QString executable(const QString &baseName, bool absPath);
static QString usrExecutable(const QString &baseName);
static bool createEmptyFile(const QString &path);
static bool initializePath(const QString &path);
static bool processIsRunning(const QString &fileName, const bool fullFlag = false);
static bool killProcessByName(const QString &name);
static QString openVpnExecPath();
static QString wireguardExecPath();
static QString certUtilPath();
static QString tun2socksPath();
static void logException(const std::exception &e);
static void logException(const std::exception_ptr &eptr = std::current_exception());
#ifdef Q_OS_WIN
static bool signalCtrl(DWORD dwProcessId, DWORD dwCtrlEvent);
static QString getNextDriverLetter();
#endif
};
#endif // UTILITIES_H