This commit is contained in:
2022-07-14 20:03:21 +02:00
parent a616970ce2
commit ff996e8e55
21 changed files with 1310 additions and 157 deletions

31
AsuroTool/Util.cpp Normal file
View File

@@ -0,0 +1,31 @@
#include <iostream>
#include "Util.h"
bool isError(const HRESULT result, const std::stringstream message)
{
if (FAILED(result))
{
std::cout << message.str() << std::hex << result << std::endl;
return true;
}
return false;
}
bool isError(const HRESULT result, const char* message)
{
return isError(result, std::stringstream(message));
}
std::string utf8Encode(const std::wstring& wstr)
{
if (wstr.empty())
{
return std::string();
}
int sizeNeeded = WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), -1, NULL, 0, NULL, NULL);
std::string resultString(sizeNeeded, 0);
WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), -1, &resultString[0], sizeNeeded, NULL, NULL);
return resultString;
}