This commit is contained in:
2022-05-07 14:31:17 +08:00
parent bf57a0ad7a
commit 201cec9c34
10 changed files with 146 additions and 102 deletions

View File

@@ -290,7 +290,7 @@ wchar_t* DNFTOOL::SquirrelW2W(const wchar_t* Str)
char* wbuffer = (char*)(Str);
while (true)
{
if (wbuffer[len] == 0 && wbuffer[len + 1] == 0)break;
if (wbuffer[len] == 0 && wbuffer[len - 1] == 0)break;
++len;
}
char* cbuffer = new char[len / 2 + 1];
@@ -351,20 +351,23 @@ void DNFTOOL::GMNotice(char* str, int type, int color)
#else
std::string DNFTOOL::GetIP()
{
std::cout << "111" << std::endl;
httplib::SSLClient Tencword("docs.qq.com");
std::cout << "444" << std::endl;
std::string body;
auto res = Tencword.Get("/doc/DQ1dGbVpzTkZDVlhY",
[&](const char* data, size_t data_length) {
body.append(data, data_length);
return true;
});
std::cout << "333" << std::endl;
int strat_index = body.find("Yosin_Ip:");
int end_index = body.find("Yosin_IP");
std::cout << "222" << std::endl;
if (strat_index != -1 && end_index != -1)
{
std::string rqip = body.substr(strat_index + 9, end_index - (strat_index + 9));
std::cout << "333" << std::endl;
return rqip;
}
else
@@ -416,3 +419,20 @@ void DNFTOOL::Split(const std::string& src, std::vector<std::string>& dest, cons
substring = str.substr(start);
dest.push_back(substring);
}
bool DNFTOOL::isNum(std::string str)
{
for (int i = 0; i < str.size(); i++)
{
int tmp = (int)str[i];
if (tmp >= 48 && tmp <= 57)
{
continue;
}
else
{
return false;
}
}
return true;
}