This commit is contained in:
HolographicHat
2022-04-10 13:02:36 +08:00
parent 60f0d8d23b
commit 00898d11cb
5 changed files with 7 additions and 6 deletions

1
.gitignore vendored
View File

@@ -4,6 +4,7 @@ config.json
out.*
node_modules
.idea
app*.7z
app*.exe
export*.json
secret.js

View File

@@ -34,7 +34,7 @@ const exportToSnapGenshin = async proto => {
proto.list.filter(a => a.status === 3 || a.status === 2).forEach(({id, finishTimestamp}) => {
out.push({
id: id,
ts: finishTimestamp
timestamp: finishTimestamp
})
})
const json = JSON.stringify(out, null, 2)

View File

@@ -3,7 +3,8 @@
"version": "1.0.0",
"description": "",
"scripts": {
"build": "node-gyp rebuild && copy .\\build\\Release\\native.node ..\\genshin-export\\"
"build": "node-gyp rebuild && copy .\\build\\Release\\native.node ..\\genshin-export\\",
"build-for-win7": "node-gyp rebuild --target=v14.17.0 && copy .\\build\\Release\\native.node ..\\genshin-export\\"
},
"gypfile": true,
"devDependencies": {

View File

@@ -105,7 +105,7 @@ namespace native {
int sw = GetDeviceCaps(desktop, DESKTOPHORZRES);
int sh = GetDeviceCaps(desktop, DESKTOPVERTRES);
ReleaseDC(nullptr, desktop);
DWORD buildNum = RegUtils::GetInt(env, HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", L"UBR");
DWORD buildNum = RegUtils::GetInt(env, HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", L"UBR", 0);
wstring locale;
if (RegUtils::GetString(HKEY_CURRENT_USER, L"Control Panel\\International", L"LocaleName", locale) != ERROR_SUCCESS) {
locale = L"zh-CN";

View File

@@ -7,13 +7,12 @@
namespace RegUtils {
DWORD GetInt(Env env, HKEY hKey, const wstring &path, const wstring &value) {
DWORD GetInt(Env env, HKEY hKey, const wstring &path, const wstring &value, DWORD defaultValue) {
DWORD data = 0;
DWORD size = sizeof(DWORD);
LSTATUS retcode = RegGetValue(hKey, path.c_str(), value.c_str(), RRF_RT_REG_DWORD, nullptr, &data, &size);
if (retcode != ERROR_SUCCESS) {
Error::New(env, "RegGetValue error: " + to_string(retcode)).ThrowAsJavaScriptException();
return 0;
return defaultValue;
}
return data;
}