mirror of
https://github.com/yuanyuanxiang/SimpleRemoter.git
synced 2026-01-21 15:03:09 +08:00
Improve: GetForegroundSelectedFiles if GetClipboardFiles failed
This commit is contained in:
@@ -777,7 +777,7 @@ std::vector<CString> SplitCString(CString strData)
|
||||
|
||||
VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName, CString strOS,
|
||||
CString strCPU, CString strVideo, CString strPing, CString ver,
|
||||
CString startTime, const std::vector<std::string>& v, CONTEXT_OBJECT * ContextObject)
|
||||
CString startTime, std::vector<std::string>& v, CONTEXT_OBJECT * ContextObject)
|
||||
{
|
||||
auto arr = StringToVector(strPCName.GetString(), '/', 2);
|
||||
strPCName = arr[0].c_str();
|
||||
@@ -790,9 +790,12 @@ VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName
|
||||
v[RES_CLIENT_PUBIP].empty() ? strIP : v[RES_CLIENT_PUBIP].c_str(),
|
||||
};
|
||||
auto id = CONTEXT_OBJECT::CalculateID(data);
|
||||
if (std::to_string(id) != v[RES_CLIENT_ID]) {
|
||||
auto id_str = std::to_string(id);
|
||||
if (v[RES_CLIENT_ID].empty()) {
|
||||
v[RES_CLIENT_ID] = id_str;
|
||||
}else if (id_str != v[RES_CLIENT_ID]) {
|
||||
Mprintf("上线消息 - 主机ID错误: calc=%llu, recv=%s, IP=%s, Path=%s\n",
|
||||
id, v[RES_CLIENT_ID].c_str(), strIP.GetString(), path.GetString());
|
||||
id, v[RES_CLIENT_ID].c_str(), strIP.GetString(), path.GetString());
|
||||
}
|
||||
bool modify = false;
|
||||
CString loc = GetClientMapData(id, MAP_LOCATION);
|
||||
@@ -2369,25 +2372,6 @@ BOOL CMy2015RemoteDlg::AuthorizeClient(const std::string& sn, const std::string&
|
||||
return VerifyMessage(pwd, (BYTE*)passcode.c_str(), passcode.length(), hmac);
|
||||
}
|
||||
|
||||
// 从char数组解析出多个路径
|
||||
std::vector<std::string> ParseMultiStringPath(const char* buffer, size_t size)
|
||||
{
|
||||
std::vector<std::string> paths;
|
||||
|
||||
const char* p = buffer;
|
||||
const char* end = buffer + size;
|
||||
|
||||
while (p < end) {
|
||||
size_t len = strlen(p);
|
||||
if (len > 0) {
|
||||
paths.emplace_back(p, len);
|
||||
}
|
||||
p += len + 1;
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject)
|
||||
{
|
||||
if (isClosed) {
|
||||
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
VOID InitControl(); //初始控件
|
||||
VOID TestOnline(); //测试函数
|
||||
VOID AddList(CString strIP, CString strAddr, CString strPCName, CString strOS, CString strCPU, CString strVideo, CString strPing,
|
||||
CString ver, CString startTime, const std::vector<std::string>& v, CONTEXT_OBJECT* ContextObject);
|
||||
CString ver, CString startTime, std::vector<std::string>& v, CONTEXT_OBJECT* ContextObject);
|
||||
VOID ShowMessage(CString strType, CString strMsg);
|
||||
VOID CreatStatusBar();
|
||||
VOID CreateToolBar();
|
||||
|
||||
@@ -342,6 +342,12 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\common\file_upload.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\common\ikcp.c">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
<ClCompile Include="SplashDlg.cpp" />
|
||||
<ClCompile Include="ToolbarDlg.cpp" />
|
||||
<ClCompile Include="CDlgFileSend.cpp" />
|
||||
<ClCompile Include="..\..\common\file_upload.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\client\Audio.h" />
|
||||
|
||||
@@ -73,7 +73,7 @@ LRESULT CDlgFileSend::OnUpdateFileProgress(WPARAM wParam, LPARAM lParam)
|
||||
FileChunkPacket* pChunk = (FileChunkPacket*)lParam;
|
||||
|
||||
CString status;
|
||||
double percent = pChunk->fileSize > 0 ? double(pChunk->offset) / pChunk->fileSize * 100.0 : 100.0;
|
||||
double percent = pChunk->fileSize ? (pChunk->offset + pChunk->dataLength) * 100. / pChunk->fileSize : 100.;
|
||||
m_bIsSending ?
|
||||
status.Format("发送文件(%d/%d): %.2f%%", 1 + pChunk->fileIndex, pChunk->totalNum, percent):
|
||||
status.Format("接收文件(%d/%d): %.2f%%", 1 + pChunk->fileIndex, pChunk->totalNum, percent);
|
||||
|
||||
@@ -340,9 +340,16 @@ VOID CScreenSpyDlg::OnReceiveComplete()
|
||||
std::string folder;
|
||||
if (GetCurrentFolderPath(folder)) {
|
||||
// 发送目录并准备接收文件
|
||||
BYTE cmd[300] = { COMMAND_GET_FILE };
|
||||
std::string files(szBuffer + 1, szBuffer + len);
|
||||
int len = 1 + folder.length() + files.length() + 1;
|
||||
BYTE* cmd = new BYTE[len];
|
||||
cmd[0] = COMMAND_GET_FILE;
|
||||
memcpy(cmd + 1, folder.c_str(), folder.length());
|
||||
m_ContextObject->Send2Client(cmd, sizeof(cmd));
|
||||
cmd[1 + folder.length()] = 0;
|
||||
memcpy(cmd + 1 + folder.length() + 1, files.data(), files.length());
|
||||
cmd[1 + folder.length() + files.length()] = 0;
|
||||
m_ContextObject->Send2Client(cmd, len);
|
||||
SAFE_DELETE_ARRAY(cmd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1161,20 +1168,6 @@ void CScreenSpyDlg::UpdateCtrlStatus(BOOL ctrl)
|
||||
SetClassLongPtr(m_hWnd, GCLP_HCURSOR, m_bIsCtrl ? (LONG_PTR)m_hRemoteCursor : (LONG_PTR)LoadCursor(NULL, IDC_NO));
|
||||
}
|
||||
|
||||
// 将多个路径组合成单\0分隔的char数组
|
||||
// 格式: "path1\0path2\0path3\0"
|
||||
std::vector<char> BuildMultiStringPath(const std::vector<std::string>& paths)
|
||||
{
|
||||
std::vector<char> result;
|
||||
|
||||
for (const auto& path : paths) {
|
||||
result.insert(result.end(), path.begin(), path.end());
|
||||
result.push_back('\0');
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void CScreenSpyDlg::OnDropFiles(HDROP hDropInfo)
|
||||
{
|
||||
if (m_bIsCtrl && m_bConnected) {
|
||||
|
||||
@@ -511,7 +511,7 @@ public:
|
||||
for (int i = 0; i < ONLINELIST_MAX; i++) {
|
||||
sClientInfo[i] = s[i];
|
||||
}
|
||||
for (int i = 0; i < a.size(); i++) {
|
||||
for (int i = 0; i < a.size() && i < RES_MAX; i++) {
|
||||
additonalInfo[i] = a[i].c_str();
|
||||
}
|
||||
}
|
||||
@@ -549,6 +549,12 @@ public:
|
||||
{
|
||||
return additonalInfo[index];
|
||||
}
|
||||
void SetAdditionalData(int index, const std::string &value)
|
||||
{
|
||||
if (index >= 0 && index < RES_MAX) {
|
||||
additonalInfo[index] = value.c_str();
|
||||
}
|
||||
}
|
||||
std::string GetGroupName() const override
|
||||
{
|
||||
return GroupName;
|
||||
|
||||
Reference in New Issue
Block a user