add:添加两个模板base64内容。
This commit is contained in:
parent
df2380f5ed
commit
ae78cc98a8
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -17,7 +17,8 @@
|
||||
}
|
||||
],
|
||||
"args": [
|
||||
"-m", "0", "-f", "/home/yun/Code/PackBinary/build/PackBinary", "-p", "/home/yun/文档", "-d", "/home/yun/mlib/boost/lib"
|
||||
"-m", "1", "-f", "/home/yun/Code/PackBinary/build/PackBinary", "-p", "/home/yun/文档", "-d", "/home/yun/mlib/boost/lib",
|
||||
"-i", "/home/yun/Code/PackBinary/build/PackBinary"
|
||||
]
|
||||
},
|
||||
// "cmake.configureSettings": {
|
||||
|
@ -19,6 +19,7 @@ set(SOURCES_FILE
|
||||
cmd_parse.cpp public.hpp
|
||||
pack.h pack.cpp
|
||||
install.h install.cpp
|
||||
resource.h resource.cpp
|
||||
)
|
||||
|
||||
set(Boost_USE_STATIC_LIBS OFF)
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "install.h"
|
||||
#include "resource.h"
|
||||
|
||||
bool CInstallBinary::startInstall(const CmdResult& result)
|
||||
{
|
||||
CResource res;
|
||||
auto shell_template = res.getShellTemplate();
|
||||
return false;
|
||||
}
|
2
main.cpp
2
main.cpp
@ -13,7 +13,9 @@ int main(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
if (!parse.Run()) {
|
||||
std::cout << "\n功能执行失败。" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
std::cout << "\n完成。" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
52
resource.cpp
Normal file
52
resource.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
#include "resource.h"
|
||||
#include <boost/beast/core.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <iostream>
|
||||
|
||||
CResource::CResource()
|
||||
{
|
||||
}
|
||||
|
||||
std::string base64_decode(const std::string& in)
|
||||
{
|
||||
static const std::string base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"0123456789+/";
|
||||
|
||||
std::string out;
|
||||
int val = 0, valb = -8;
|
||||
for (unsigned char c : in) {
|
||||
if (base64_chars.find(c) == std::string::npos) {
|
||||
if (c != '=') {
|
||||
std::cout << "Invalid Base64 input" << std::endl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
val = (val << 6) + base64_chars.find(c);
|
||||
valb += 6;
|
||||
if (valb >= 0) {
|
||||
out.push_back(char((val >> valb) & 0xFF));
|
||||
valb -= 8;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string CResource::getShellTemplate()
|
||||
{
|
||||
std::string s =
|
||||
"IyEvYmluL2Jhc2gKU0NSSVBUX0RJUj0kKGNkICIkKGRpcm5hbWUgIiQwIikiICYmIHB3ZC"
|
||||
"kKY2QgIiRTQ1JJUFRfRElSIiB8fCBleGl0CmV4cG9ydCBMRF9MSUJSQVJZX1BBVEg9JExE"
|
||||
"X0xJQlJBUllfUEFUSDoiJFNDUklQVF9ESVIiCiIkU0NSSVBUX0RJUi9yZXBsYWNlX3N0ci"
|
||||
"IgIiRAIgo=";
|
||||
return base64_decode(s);
|
||||
}
|
||||
|
||||
std::string CResource::getDesktopTemplate()
|
||||
{
|
||||
std::string s =
|
||||
"W0Rlc2t0b3AgRW50cnldCk5hbWU9cmVfbmFtZQpDb21tZW50PXJlX2Rlc2NyaWJlCkV4ZW"
|
||||
"M9cmVfcGF0aApJY29uPXJlX2ljb24KVGVybWluYWw9ZmFsc2UKVHlwZT1BcHBsaWNhdGlv"
|
||||
"bgpDYXRlZ29yaWVzPXJlX2NhdGVnb3J5Owo=";
|
||||
return base64_decode(s);
|
||||
}
|
15
resource.h
Normal file
15
resource.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef RESOURCE_HEADER
|
||||
#define RESOURCE_HEADER
|
||||
|
||||
#include <string>
|
||||
|
||||
class CResource
|
||||
{
|
||||
public:
|
||||
CResource();
|
||||
public:
|
||||
std::string getShellTemplate();
|
||||
std::string getDesktopTemplate();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user