|
|
#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
|
|
|
|
|
|
#pragma warning(disable : 4996)
|
|
|
|
|
|
#if defined(_DEBUG)
|
|
|
|
|
|
#ifndef LIB_PATH
|
|
|
#define LIB_PATH ""
|
|
|
#endif
|
|
|
|
|
|
#pragma comment(lib, LIB_PATH "FormatConversionD.lib")
|
|
|
#pragma message("Automatically linking with FormatConversionD.lib")
|
|
|
|
|
|
#else
|
|
|
|
|
|
#ifndef LIB_PATH
|
|
|
#define LIB_PATH ""
|
|
|
#endif
|
|
|
|
|
|
#pragma comment(lib, LIB_PATH "FormatConversion.lib")
|
|
|
#pragma message("Automatically linking with FormatConversion.lib")
|
|
|
|
|
|
#endif
|
|
|
|
|
|
extern "C" __declspec(dllimport) int FromDFDToDFD4(char* inputFile, char* outputFile);
|
|
|
|
|
|
/**
|
|
|
* @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 临时文件
|
|
|
*/
|
|
|
extern "C" __declspec(dllimport)
|
|
|
CString PreprocessFile(CString& filePath);
|
|
|
|
|
|
/**
|
|
|
* @brief 清除文件夹内的所有内容.
|
|
|
*
|
|
|
* @param folderPath
|
|
|
*/
|
|
|
void ClearFolder(const CString& folderPath);
|
|
|
|
|
|
/**
|
|
|
* @brief 清空临时文件夹.
|
|
|
*
|
|
|
*/
|
|
|
void ClearTempFolder();
|
|
|
|
|
|
/**
|
|
|
* @brief 后处理文件.
|
|
|
*
|
|
|
* @param filePath
|
|
|
* @return
|
|
|
*/
|
|
|
extern "C" __declspec(dllimport)
|
|
|
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();
|
|
|
|
|
|
/**
|
|
|
* @brief 设置程序启动目录,目前只用于获取临时目录
|
|
|
*
|
|
|
* @return 成功返回 true,路径不合法,或者没有权限,返回 false
|
|
|
*/
|
|
|
__declspec(dllexport)
|
|
|
bool SetApplicationStartupDirectory(const CString& dirPath);
|