2025-10-25 16:13:18 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
#pragma pack(push, 1)
|
2025-11-09 00:49:34 +08:00
|
|
|
|
struct FileChunkPacket {
|
|
|
|
|
|
unsigned char cmd; // COMMAND_SEND_FILE
|
|
|
|
|
|
uint32_t fileIndex; // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
uint32_t totalNum; // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
uint64_t fileSize; // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С
|
|
|
|
|
|
uint64_t offset; // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>е<EFBFBD>ƫ<EFBFBD><C6AB>
|
|
|
|
|
|
uint64_t dataLength; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
|
|
|
|
|
uint64_t nameLength; // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD><EFBFBD> '\0'<27><>
|
2025-10-25 16:13:18 +08:00
|
|
|
|
};
|
|
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
2025-12-26 19:35:10 +01:00
|
|
|
|
typedef void (*LogFunc)(const char* file, int line, const char* format, ...);
|
|
|
|
|
|
|
|
|
|
|
|
int InitFileUpload(const std::string hmac, int chunkSizeKb = 64, int sendDurationMs = 50, LogFunc logFunc = NULL);
|
2025-10-25 16:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
int UninitFileUpload();
|
|
|
|
|
|
|
2025-12-09 17:27:50 +01:00
|
|
|
|
std::vector<std::string> GetClipboardFiles(int& result);
|
2025-10-25 16:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
bool GetCurrentFolderPath(std::string& outDir);
|
|
|
|
|
|
|
|
|
|
|
|
typedef bool (*OnTransform)(void* user, FileChunkPacket* chunk, unsigned char* data, int size);
|
|
|
|
|
|
|
|
|
|
|
|
typedef void (*OnFinish)(void* user);
|
|
|
|
|
|
|
2025-11-09 00:49:34 +08:00
|
|
|
|
int FileBatchTransferWorker(const std::vector<std::string>& files, const std::string& targetDir,
|
|
|
|
|
|
void* user, OnTransform f, OnFinish finish, const std::string& hash, const std::string& hmac);
|
2025-10-25 16:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
int RecvFileChunk(char* buf, size_t len, void* user, OnFinish f, const std::string& hash, const std::string& hmac);
|
2025-12-24 09:24:15 +01:00
|
|
|
|
|
|
|
|
|
|
uint8_t* ScaleBitmap(uint8_t* dst, const uint8_t* src, int srcW, int srcH, int dstW, int dstH);
|