Feature: Add file-transfer speed dialog with multi-language support
Add a novice-friendly "File Transfer Speed" dialog under the Advanced menu that controls file-transfer speed in both directions without touching SimplePlugins. Speed is passed through InitFileUpload's existing chunkSizeKb/sendDurationMs arguments, so the precompiled library stays untouched. Seven presets run from ~0.3 MB/s up to a new 10 MB/s tier plus an unlimited tier; the chosen value is stored in [transfer] ChunkKb/DurationMs. Upload reads THIS_CFG at the master's InitFileUpload (2015RemoteDlg.cpp:2225) and takes effect on restart. Download is pushed to the client over a new CMD_FILE_SPEED (252) command, sent from OnOnlineFileManager and OnOnlineDesktopManager before each session opens, and read by all four client InitFileUpload call sites via GetTransferSpeed so the process-global refcount cannot latch a stale speed. All Chinese strings go through LangManager, with en_US/zh_TW/de_DE entries added for the tier names, format strings and hint text. Co-Authored-By: deepseek-v4-pro
This commit is contained in:
1 parent
9eed43bc8d
commit
76decec0fe
14 files changed
+424
-11
No files matched your search
@@ -36,9 +36,13 @@ CFileManager::CFileManager(CClientSocket *pClient, int h, void* user):CManager(p
|
||||
// 初始化V2文件传输模块
|
||||
CKernelManager* main = (CKernelManager*)pClient->GetMain();
|
||||
m_Signature = main ? main->m_LoginSignature : pClient->m_LoginSignature;
|
||||
if (!m_Signature.empty())
|
||||
if (!m_Signature.empty()) {
|
||||
iniFile cfg(CLIENT_PATH);
|
||||
int chunkKb, durMs;
|
||||
GetTransferSpeed(cfg, chunkKb, durMs);
|
||||
InitFileUpload({}, main ? main->m_LoginMsg : pClient->m_LoginMsg,
|
||||
main ? main->m_LoginSignature : pClient->m_LoginSignature, 64, 50, Logf);
|
||||
main ? main->m_LoginSignature : pClient->m_LoginSignature, chunkKb, durMs, Logf);
|
||||
}
|
||||
|
||||
// 发送驱动器列表, 开始进行文件管理,建立新线程
|
||||
SendDriveList();
|
||||
|
||||
@@ -1277,6 +1277,18 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
break;
|
||||
}
|
||||
|
||||
case CMD_FILE_SPEED: {
|
||||
// 主控端下发文件传输速度档位:[cmd:1][chunkKb:uint16 LE][durationMs:uint16 LE]。
|
||||
// 写入 [transfer] 节,供各 InitFileUpload 调用点经 GetTransferSpeed 读取。
|
||||
if (ulLength >= 5) {
|
||||
int chunkKb = szBuffer[1] | (szBuffer[2] << 8);
|
||||
int durMs = szBuffer[3] | (szBuffer[4] << 8);
|
||||
m_cfg->SetInt("transfer", "ChunkKb", chunkKb);
|
||||
m_cfg->SetInt("transfer", "DurationMs", durMs);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case COMMAND_LIST_DRIVE : {
|
||||
if (!ENABLE_FILE_MNG) {
|
||||
return ResponseDisable(m_ClientObject, "FILE", szBuffer + 1, ulLength - 1);
|
||||
@@ -1396,7 +1408,9 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
// static 标志保证进程内只初始化一次,不随主连接重连反复 Init/Uninit。
|
||||
static bool s_v2RecvInited = false;
|
||||
if (!s_v2RecvInited) {
|
||||
InitFileUpload({}, m_LoginMsg, m_LoginSignature, 64, 50, Logf);
|
||||
int chunkKb, durMs;
|
||||
GetTransferSpeed(*m_cfg, chunkKb, durMs);
|
||||
InitFileUpload({}, m_LoginMsg, m_LoginSignature, chunkKb, durMs, Logf);
|
||||
s_v2RecvInited = true;
|
||||
}
|
||||
// C2C/V2 文件接收(RecvFileChunkV2 内部会打印进度)
|
||||
|
||||
@@ -106,8 +106,13 @@ CScreenManager::CScreenManager(IOCPClient* ClientObject, int n, void* user, BOOL
|
||||
SetConnection(g_MyApp.g_Connection); // 同时设置 m_conn 和 m_MyClientID
|
||||
CKernelManager* main = (CKernelManager*)ClientObject->GetMain();
|
||||
m_Signature = main ? main->m_LoginSignature : ClientObject->m_LoginSignature;
|
||||
if (!m_Signature.empty()) InitFileUpload({}, main ? main->m_LoginMsg : ClientObject->m_LoginMsg,
|
||||
main ? main->m_LoginSignature : ClientObject->m_LoginSignature, 64, 50, Logf);
|
||||
if (!m_Signature.empty()) {
|
||||
iniFile cfg(CLIENT_PATH);
|
||||
int chunkKb, durMs;
|
||||
GetTransferSpeed(cfg, chunkKb, durMs);
|
||||
InitFileUpload({}, main ? main->m_LoginMsg : ClientObject->m_LoginMsg,
|
||||
main ? main->m_LoginSignature : ClientObject->m_LoginSignature, chunkKb, durMs, Logf);
|
||||
}
|
||||
#endif
|
||||
m_isGDI = TRUE;
|
||||
m_virtual = FALSE;
|
||||
@@ -870,7 +875,10 @@ VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
if (m_Signature.empty()) {
|
||||
m_Signature = std::string(resp.signature, resp.signature + 64);
|
||||
m_ClientObject->SetVerifyInfo(resp.msg, m_Signature);
|
||||
InitFileUpload({}, std::string(resp.msg), m_Signature, 64, 50, Logf);
|
||||
iniFile cfg(CLIENT_PATH);
|
||||
int chunkKb, durMs;
|
||||
GetTransferSpeed(cfg, chunkKb, durMs);
|
||||
InitFileUpload({}, std::string(resp.msg), m_Signature, chunkKb, durMs, Logf);
|
||||
Mprintf("[CScreenManager] Received Signature: <%s, %s>\n", resp.msg, m_Signature.c_str());
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user