You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
2.1 KiB
C
138 lines
2.1 KiB
C
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
__declspec(dllexport) bool EncodeFile(LPCTSTR lpSrcFilePath, LPCTSTR lpDstFilePath);
|
|
__declspec(dllexport) bool DecodeFile(LPCTSTR lpSrcFilePath, LPCTSTR lpDstFilePath);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* @brief 异或加密
|
|
*
|
|
* @param data
|
|
* @param key
|
|
*/
|
|
void XorEncrypt(LPTSTR lpData, DWORD len, LPCTSTR lpKey);
|
|
|
|
/**
|
|
* @brief 异或加密指定文件.
|
|
*
|
|
* @param lpFilePath
|
|
* @return
|
|
*/
|
|
BOOL XorEncryptFile(LPCTSTR lpFilePath);
|
|
|
|
/**
|
|
* @brief 创建临时加密文件.
|
|
*
|
|
* @param lpSrcFilePath 指定的源文件
|
|
* @param lpDstFilePath 指定的临时文件
|
|
* @return
|
|
*/
|
|
BOOL XorEncryptFile(LPCTSTR lpSrcFilePath, LPCTSTR lpDstFilePath);
|
|
|
|
/**
|
|
* @brief 文件映射内存拷贝
|
|
*
|
|
* @param lpSrcFilePath
|
|
* @param lpDstFilePath
|
|
* @return
|
|
*/
|
|
BOOL CopyLargeFileByMapping(LPCTSTR lpSrcFilePath, LPCTSTR lpDstFilePath);
|
|
|
|
/**
|
|
* @brief 是否是二进制文件.
|
|
*
|
|
* @param file
|
|
* @return
|
|
*/
|
|
bool IsBinaryFile(CString filePath);
|
|
|
|
/**
|
|
* @brief 判断是否是UNICODE文件.
|
|
*
|
|
* @param filename
|
|
* @return
|
|
*/
|
|
bool IsUnicodeTextFile(const char *filename);
|
|
|
|
/**
|
|
* @brief 获取文件首行.
|
|
*
|
|
* @param filePath
|
|
* @return
|
|
*/
|
|
CString GetFirstLineOfFile(const CString& filePath);
|
|
|
|
/**
|
|
* @brief 预处理文件.
|
|
*
|
|
* @param filePath
|
|
* @return 临时文件
|
|
*/
|
|
CString PreprocessFile(CString& filePath);
|
|
|
|
/**
|
|
* @brief 清除文件夹内的所有内容.
|
|
*
|
|
* @param folderPath
|
|
*/
|
|
void ClearFolder(const CString& folderPath);
|
|
|
|
/**
|
|
* @brief 清空临时文件夹.
|
|
*
|
|
*/
|
|
void ClearTempFolder();
|
|
|
|
/**
|
|
* @brief 后处理文件.
|
|
*
|
|
* @param filePath
|
|
* @return
|
|
*/
|
|
void PostProcessFile(CString& filePath);
|
|
|
|
/**
|
|
* @brief 检测并创建目录.
|
|
*
|
|
* @param path
|
|
* @return
|
|
*/
|
|
BOOL CheckAndCreateDirectory(const CString& path);
|
|
|
|
/**
|
|
* @brief 产生GUID字符串.
|
|
*
|
|
* @param guidStr
|
|
*/
|
|
void generateGUID(char *guidStr);
|
|
|
|
/**
|
|
* @brief 存临时文件目录产生临时文件.
|
|
*
|
|
* @return 临时文件路径
|
|
*/
|
|
CString generateTempFile(CString& filePath);
|
|
|
|
/**
|
|
* @brief 获取可执行文件所在目录.
|
|
*
|
|
* @return 当前应用目录
|
|
*/
|
|
CString GetExecutableDirectory();
|
|
|
|
/**
|
|
* @brief 获取可执行文件所在目录.
|
|
*
|
|
* @return 当前应用目录
|
|
*/
|
|
CString GetTempDirectory();
|
|
|
|
|