forked from SHRP/shrp_bootable_recovery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SHRPMAIN.hpp
83 lines (74 loc) · 2.28 KB
/
SHRPMAIN.hpp
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//SHRP minUtils
class minUtils{
public:
static bool compare(string str1,string str2);
static bool isFileEditable(string fileExtension);
static bool find(std::string str,std::string sub);
static bool find(std::string str,std::string sub,int dummy);
static void remountSystem(bool display);
};
//Text Editor Class
class textEditor{
private:
void pushString(string,string); //push the processed strings into the file
public:
void disp_file(string); //displays the content of the file in the console
void replaceLine(string,string,int); //replaces specific line into the file
void addLine(string,string,int); //adds specific line into the file
void removeLine(string,int); //removes specific line from the file
void getdString(string,string&,string&,int,int);//divides the file in two strings according to the parameter
void getReplacebleLine(string,int); //finds the line which are going to be replace
string handleTab(string str); //handles Tab character
int getLineNo(string path); //process total line of text file
};
//Parse Theme
class ThemeParser{
private:
string themeName;
string bgColor;
string navBgColor;
string accColor;
string textColor;
void processValue(string,int);
bool verifyColor(string);
public:
void fetchInformation(string);
bool verifyInformation();
void pushValues();
};
//JSON_Genarator
class JSON{
public:
static string getVar(string,string);
static string getVar(string,int);
static string getVar(string,float);
static string genarateRAWJson();
static void storeShrpInfo();
};
//EXPRESS Class
class Express{
public:
#ifdef SHRP_EXPRESS
static bool shrpResExp(string inPath,string outpath,bool display = true);
static void flushSHRP();
static void init(string basePath);
#endif
static void updateSHRPBasePath();
};
#define BUFFER_SIZE_SLT 16
#define BUFFER_SIZE_PW 64
//Hasher Class
class Hasher{
private:
std::string arg,fsalt,fhash,chash;
char getlp[1];
char getfs[BUFFER_SIZE_SLT];
char gethp[BUFFER_SIZE_PW];
public:
string lock_pass;
static string create_sha256(const string str);
static string create_salt( size_t length );
bool LockPassInit(string str);
bool isPassCorrect();
static string doHash(string str);
};