diff --git a/CrownClient/CrownClient.rc b/CrownClient/CrownClient.rc index 28c7ef4..18affa8 100644 --- a/CrownClient/CrownClient.rc +++ b/CrownClient/CrownClient.rc @@ -61,8 +61,8 @@ IDI_ICON1 ICON "Images\\client.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,6,8 - PRODUCTVERSION 1,0,6,8 + FILEVERSION 1,0,7,8 + PRODUCTVERSION 1,0,7,8 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -79,12 +79,12 @@ BEGIN BEGIN VALUE "CompanyName", "Crown" VALUE "FileDescription", "CrownClient" - VALUE "FileVersion", "1.0.6.8" + VALUE "FileVersion", "1.0.7.8" VALUE "InternalName", "CrownClient.exe" VALUE "LegalCopyright", "Copyright (C) 2025" VALUE "OriginalFilename", "CrownClient.exe" VALUE "ProductName", "TODO: " - VALUE "ProductVersion", "1.0.6.8" + VALUE "ProductVersion", "1.0.7.8" END END BLOCK "VarFileInfo" diff --git a/CrownClient/main.cpp b/CrownClient/main.cpp index 2fba00d..6aa6697 100644 --- a/CrownClient/main.cpp +++ b/CrownClient/main.cpp @@ -42,15 +42,19 @@ bool CheckAndRunUpdater() << "--app-key" << kUpdaterAppKey << "--version" << VERSION); - if (code == kUpdaterNoUpdate || code == kUpdaterFailed) { - // 已经是最新,或者服务器/网络有问题——后者放行,避免把用户挡在门外 + if (code == kUpdaterNoUpdate || code == kUpdaterFailed || code == kUpdaterBadVersion) { + // 已经是最新 / 检查失败 / 服务端不认识当前版本 —— 都放行,避免把用户挡在门外。 + // badVersion 时服务端不会为这个版本返回可用的包信息,强行拉起更新器 + // 只会让用户卡在"版本号参数错误"的界面上 return true; } QStringList args; if (code == kUpdaterBadVersion) { - // 服务端不认识当前版本,补丁包无从生成,直接整包覆盖安装到程序所在目录 - args << "--app-key" << kUpdaterAppKey << "--dir" << appDir; + // 服务端不认识当前版本,补丁包无从生成,直接整包覆盖安装到程序所在目录。 + // 仍要带上 --version:更新器内部会用它请求服务端,空版本号会被判为参数错误 + args << "--app-key" << kUpdaterAppKey << "--version" << VERSION + << "--dir" << appDir << "--full"; } else { // 常规补丁包更新 args << "--app-key" << kUpdaterAppKey << "--version" << VERSION diff --git a/CrownServer/main.cpp b/CrownServer/main.cpp index 5e7cbd4..cce4b49 100644 --- a/CrownServer/main.cpp +++ b/CrownServer/main.cpp @@ -47,15 +47,19 @@ bool CheckAndRunUpdater() << "--app-key" << kUpdaterAppKey << "--version" << VERSION); - if (code == kUpdaterNoUpdate || code == kUpdaterFailed) { - // 已经是最新,或者服务器/网络有问题——后者放行,避免把用户挡在门外 + if (code == kUpdaterNoUpdate || code == kUpdaterFailed || code == kUpdaterBadVersion) { + // 已经是最新 / 检查失败 / 服务端不认识当前版本 —— 都放行,避免把用户挡在门外。 + // badVersion 时服务端不会为这个版本返回可用的包信息,强行拉起更新器 + // 只会让用户卡在"版本号参数错误"的界面上 return true; } QStringList args; if (code == kUpdaterBadVersion) { - // 服务端不认识当前版本,补丁包无从生成,直接整包覆盖安装到程序所在目录 - args << "--app-key" << kUpdaterAppKey << "--dir" << appDir; + // 服务端不认识当前版本,补丁包无从生成,直接整包覆盖安装到程序所在目录。 + // 仍要带上 --version:更新器内部会用它请求服务端,空版本号会被判为参数错误 + args << "--app-key" << kUpdaterAppKey << "--version" << VERSION + << "--dir" << appDir << "--full"; } else { // 常规补丁包更新 args << "--app-key" << kUpdaterAppKey << "--version" << VERSION diff --git a/Update/main.cpp b/Update/main.cpp index 04de33b..06d86a8 100644 --- a/Update/main.cpp +++ b/Update/main.cpp @@ -68,12 +68,20 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE /*prev*/, LPWSTR /*cmdLine*/ options.appKey = UPDATER_APP_KEY; options.targetDir = UPDATER_TARGET_DIR; + // --full / -f:显式要求整包安装,区别于"没传版本号"的隐含整包 + bool forceFull = false; + // 无命令行参数 = 完整包更新;有参数则按传入信息检查版本并更新补丁包 if (args.empty()) { options.fullMode = true; } else { std::vector positional; for (size_t i = 0; i < args.size(); ++i) { + if (args[i] == L"--full" || args[i] == L"-f") { + forceFull = true; + continue; + } + std::wstring key = updater::Utils::Trim(ArgValue(args, i, L"--app-key", L"-k")); if (!key.empty()) { options.appKey = key; continue; } @@ -93,7 +101,9 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE /*prev*/, LPWSTR /*cmdLine*/ if (positional.size() >= 2) options.clientVersion = positional[1]; if (positional.size() >= 3) options.targetDir = positional[2]; - options.fullMode = options.clientVersion.empty(); + // 空版本号会让 check-update 缺少 version 参数,被服务端判为"版本号参数错误"。 + // 整包模式改由 --full 显式指定,这样版本号可以始终带上 + options.fullMode = forceFull || options.clientVersion.empty(); } if (checkOnly) {