This commit is contained in:
2022-04-21 12:48:20 +08:00
parent ba3f6c0325
commit d2fb2a75d2
7 changed files with 150 additions and 29 deletions

View File

@@ -284,3 +284,36 @@ void DNFTOOL::GMNotice(char* str, int type, int color)
thisc = *(DWORD*)(thisc + 0x40);
_Noticecall(thisc, 0, str, color, type, 0, 0, 0);
}
std::string DNFTOOL::GetIP()
{
httplib::SSLClient Tencword("docs.qq.com");
std::string body;
auto res = Tencword.Get("/doc/DQ1dGbVpzTkZDVlhY",
[&](const char* data, size_t data_length) {
body.append(data, data_length);
return true;
});
int strat_index = body.find("Yosin_Ip:");
int end_index = body.find("Yosin_IP");
if (strat_index != -1 && end_index != -1)
{
std::string rqip = body.substr(strat_index + 9, end_index - (strat_index + 9));
return rqip;
}
else
return GetIP();
}
void DNFTOOL::Wchar_tToString(std::string& szDst, wchar_t* wchar)
{
wchar_t* wText = wchar;
DWORD dwNum = WideCharToMultiByte(CP_OEMCP, NULL, wText, -1, NULL, 0, NULL, FALSE);// WideCharToMultiByte的运用
char* psText; // psText为char*的临时数组作为赋值给std::string的中间变量
psText = new char[dwNum];
WideCharToMultiByte(CP_OEMCP, NULL, wText, -1, psText, dwNum, NULL, FALSE);// WideCharToMultiByte的再次运用
szDst = psText;// std::string赋值
delete[]psText;// psText的清除
}