-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils.cpp
More file actions
28 lines (25 loc) · 796 Bytes
/
Utils.cpp
File metadata and controls
28 lines (25 loc) · 796 Bytes
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
#include "Utils.h"
#include <fstream>
#include <windows.h>
void LogToFile(const std::string& message) {
std::ofstream logFile("overlay_log.txt", std::ios::app);
if (logFile.is_open()) {
logFile << message << std::endl;
}
}
std::wstring Utf8ToWstring(const std::string& str) {
if (str.empty()) return L"";
int size_needed = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), (int)str.size(), NULL, 0);
std::wstring wstrTo(size_needed, 0);
MultiByteToWideChar(CP_UTF8, 0, str.c_str(), (int)str.size(), &wstrTo[0], size_needed);
return wstrTo;
}
std::wstring FormatNumber(int value) {
std::wstring str = std::to_wstring(value);
int pos = (int)str.size() - 3;
while (pos > 0) {
str.insert(pos, L" ");
pos -= 3;
}
return str;
}