Skip to content

Commit 57f749c

Browse files
authored
Merge pull request #21 from libxengine/develop
V3.5.1.1001 Merge
2 parents 111a813 + 2f52198 commit 57f749c

File tree

21 files changed

+142
-56
lines changed

21 files changed

+142
-56
lines changed

.gitignore

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.en.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,6 @@ Port:HTTP Center Port 5100,Download 5101,UPLoad 5102,P2P 5103
9595
3. Submit the code
9696
4. New Pull Request
9797

98-
## Clean up statement
99-
the software will not generate any files to other directories in your system.
100-
the software will not modify any of your system configuration.
101-
the software can achieve complete cleanup by directly delete the directory.
102-
10398
## Follow us
10499
If you think this software is helpful to you, please give us a START
105100

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,6 @@ P2P广域网文件查找与下载支持
9595
3. 提交代码
9696
4. 新建 Pull Request
9797

98-
## 绿色声明
99-
此软件不会产生任何文件到你的系统的其他目录中.
100-
此软件不会修改你的任何系统配置.
101-
此软件可通过直接删除主目录而达到完全清理目的.
102-
10398
## 关注我们
10499
如果你觉得这个软件对你有帮助,请你给我们一个START吧
105100

XEngine_Release/XEngine_Config/XEngine_Config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
},
7676
"XVer":{
7777
"StorageVersion":[
78+
"3.5.1.1001 Build20220314",
7879
"3.5.0.1001 Build20220228",
7980
"3.4.1.1001 Build20220126",
8081
"3.4.0.1001 Build20220121",

XEngine_Source/StorageModule_APIHelp/APIHelp_Api/APIHelp_Api.cpp

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,65 @@ BOOL CAPIHelp_Api::APIHelp_Api_VerHash(LPCTSTR lpszFileHash, TCHAR** pptszListHd
222222
APIHelp_dwErrorCode = ERROR_STORAGE_MODULE_APIHELP_NOTMATCH;
223223
return FALSE;
224224
}
225+
return TRUE;
226+
}
227+
/********************************************************************
228+
函数名称:APIHelp_Api_GetIPInfo
229+
函数功能:获取IP信息
230+
参数.一:lpszMsgBuffer
231+
In/Out:In
232+
类型:常量字符指针
233+
可空:N
234+
意思:输入要操作的缓冲区
235+
参数.二:nMsgLen
236+
In/Out:In
237+
类型:整数型
238+
可空:N
239+
意思:输入要操作的大小
240+
参数.三:pSt_IPAddrInfo
241+
In/Out:Out
242+
类型:数据结构指针
243+
可空:N
244+
意思:输出获取到的IP信息
245+
返回值
246+
类型:逻辑型
247+
意思:是否成功
248+
备注:
249+
*********************************************************************/
250+
BOOL CAPIHelp_Api::APIHelp_Api_GetIPInfo(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_IPADDRINFO* pSt_IPAddrInfo)
251+
{
252+
APIHelp_IsErrorOccur = FALSE;
253+
254+
Json::Value st_JsonRoot;
255+
JSONCPP_STRING st_JsonError;
256+
Json::CharReaderBuilder st_JsonBuilder;
257+
//解析
258+
std::unique_ptr<Json::CharReader> const pSt_JsonReader(st_JsonBuilder.newCharReader());
259+
if (!pSt_JsonReader->parse(lpszMsgBuffer, lpszMsgBuffer + nMsgLen, &st_JsonRoot, &st_JsonError))
260+
{
261+
APIHelp_IsErrorOccur = TRUE;
262+
APIHelp_dwErrorCode = ERROR_STORAGE_MODULE_APIHELP_PARSE;
263+
return FALSE;
264+
}
265+
//是否获取成功
266+
if (0 != st_JsonRoot["code"].asInt())
267+
{
268+
APIHelp_IsErrorOccur = TRUE;
269+
APIHelp_dwErrorCode = ERROR_STORAGE_MODULE_APIHELP_CODE;
270+
return FALSE;
271+
}
272+
Json::Value st_JsonObject = st_JsonRoot["data"];
273+
274+
_tcscpy(pSt_IPAddrInfo->tszIPStart, st_JsonObject["tszIPStart"].asCString());
275+
_tcscpy(pSt_IPAddrInfo->tszIPEnd, st_JsonObject["tszIPEnd"].asCString());
276+
_tcscpy(pSt_IPAddrInfo->tszIPAddress, st_JsonObject["tszIPAddress"].asCString());
277+
_tcscpy(pSt_IPAddrInfo->tszIPAddr, st_JsonObject["tszIPAddr"].asCString());
278+
_tcscpy(pSt_IPAddrInfo->tszIPCity, st_JsonObject["tszIPCity"].asCString());
279+
_tcscpy(pSt_IPAddrInfo->tszIPCountry, st_JsonObject["tszIPCountry"].asCString());
280+
_tcscpy(pSt_IPAddrInfo->tszIPCounty, st_JsonObject["tszIPCounty"].asCString());
281+
_tcscpy(pSt_IPAddrInfo->tszIPProvince, st_JsonObject["tszIPProvince"].asCString());
282+
_tcscpy(pSt_IPAddrInfo->tszIPISP, st_JsonObject["tszIPISP"].asCString());
283+
_tcscpy(pSt_IPAddrInfo->tszIPTime, st_JsonObject["tszIPTime"].asCString());
284+
225285
return TRUE;
226286
}

XEngine_Source/StorageModule_APIHelp/APIHelp_Api/APIHelp_Api.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class CAPIHelp_Api
2121
BOOL APIHelp_Api_ProxyAuth(TCHAR* ptszUser, TCHAR* ptszPass, TCHAR** pptszListHdr, int nHdrCount);
2222
BOOL APIHelp_Api_RangeFile(int* pInt_SPos, int* pInt_EPos, __int64x* pInt_Count, TCHAR** pptszListHdr, int nHdrCount);
2323
BOOL APIHelp_Api_VerHash(LPCTSTR lpszFileHash, TCHAR** pptszListHdr, int nHdrCount);
24+
BOOL APIHelp_Api_GetIPInfo(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_IPADDRINFO* pSt_IPAddrInfo);
2425
protected:
2526
private:
2627
};

XEngine_Source/StorageModule_APIHelp/APIHelp_Define.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,4 +236,28 @@ extern "C" BOOL APIHelp_Api_RangeFile(int* pInt_SPos, int* pInt_EPos, __int64x*
236236
意思:是否成功
237237
备注:
238238
*********************************************************************/
239-
extern "C" BOOL APIHelp_Api_VerHash(LPCTSTR lpszFileHash, TCHAR** pptszListHdr, int nHdrCount);
239+
extern "C" BOOL APIHelp_Api_VerHash(LPCTSTR lpszFileHash, TCHAR** pptszListHdr, int nHdrCount);
240+
/********************************************************************
241+
函数名称:APIHelp_Api_GetIPInfo
242+
函数功能:获取IP信息
243+
参数.一:lpszMsgBuffer
244+
In/Out:In
245+
类型:常量字符指针
246+
可空:N
247+
意思:输入要操作的缓冲区
248+
参数.二:nMsgLen
249+
In/Out:In
250+
类型:整数型
251+
可空:N
252+
意思:输入要操作的大小
253+
参数.三:pSt_IPAddrInfo
254+
In/Out:Out
255+
类型:数据结构指针
256+
可空:N
257+
意思:输出获取到的IP信息
258+
返回值
259+
类型:逻辑型
260+
意思:是否成功
261+
备注:
262+
*********************************************************************/
263+
extern "C" BOOL APIHelp_Api_GetIPInfo(LPCTSTR lpszMsgBuffer, int nMsgLen, XENGINE_IPADDRINFO* pSt_IPAddrInfo);

XEngine_Source/StorageModule_APIHelp/APIHelp_Distributed/APIHelp_Distributed.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ BOOL CAPIHelp_Distributed::APIHelp_Distributed_RandomAddr(list<string>* pStl_Lis
8585
{
8686
nRandomFront = 0;
8787
}
88-
int i = 0;
88+
unsigned int i = 0;
8989
for (auto stl_ListIterator = pStl_ListAddr->begin(); stl_ListIterator != pStl_ListAddr->end(); stl_ListIterator++, i++)
9090
{
9191
if (nRandomFront == i)
@@ -102,7 +102,7 @@ BOOL CAPIHelp_Distributed::APIHelp_Distributed_RandomAddr(list<string>* pStl_Lis
102102
{
103103
nRandomBack = 0;
104104
}
105-
int i = 0;
105+
unsigned int i = 0;
106106
for (auto stl_ListIterator = pStl_ListAddr->rbegin(); stl_ListIterator != pStl_ListAddr->rend(); stl_ListIterator++, i++)
107107
{
108108
if (nRandomBack == i)
@@ -290,8 +290,8 @@ BOOL CAPIHelp_Distributed::APIHelp_Distributed_UPStorage(LPCTSTR lpszMsgBuffer,
290290
SystemApi_File_EnumFile(pSt_StorageBucket->tszFilePath, &ppListFile, &nListCount, NULL, NULL, TRUE, 1);
291291
for (int j = 0; j < nListCount; j++)
292292
{
293-
struct __stat64 st_FStat;
294-
_stat64(ppListFile[j], &st_FStat);
293+
struct _tstat64 st_FStat;
294+
_tstat64(ppListFile[j], &st_FStat);
295295
nDirCount += st_FStat.st_size;
296296
}
297297
BaseLib_OperatorMemory_Free((XPPPMEM)&ppListFile, nListCount);
@@ -334,8 +334,8 @@ BOOL CAPIHelp_Distributed::APIHelp_Distributed_UPStorage(LPCTSTR lpszMsgBuffer,
334334
SystemApi_File_EnumFile(stl_ListIterator->tszFilePath, &ppListFile, &nListCount, NULL, NULL, TRUE, 1);
335335
for (int j = 0; j < nListCount; j++)
336336
{
337-
struct __stat64 st_FStat;
338-
_stat64(ppListFile[j], &st_FStat);
337+
struct _tstat64 st_FStat;
338+
_tstat64(ppListFile[j], &st_FStat);
339339
nDirCount += st_FStat.st_size;
340340
}
341341
BaseLib_OperatorMemory_Free((XPPPMEM)&ppListFile, nListCount);
@@ -382,7 +382,7 @@ BOOL CAPIHelp_Distributed::APIHelp_Distributed_UPStorage(LPCTSTR lpszMsgBuffer,
382382
{
383383
nUPFront = 0;
384384
}
385-
int i = 0;
385+
unsigned int i = 0;
386386
for (auto stl_ListIterator = stl_BuckSelect.begin(); stl_ListIterator != stl_BuckSelect.end(); stl_ListIterator++, i++)
387387
{
388388
if (nUPFront == i)
@@ -399,7 +399,7 @@ BOOL CAPIHelp_Distributed::APIHelp_Distributed_UPStorage(LPCTSTR lpszMsgBuffer,
399399
{
400400
nUPBack = 0;
401401
}
402-
int i = 0;
402+
unsigned int i = 0;
403403
for (auto stl_ListIterator = stl_BuckSelect.rbegin(); stl_ListIterator != stl_BuckSelect.rend(); stl_ListIterator++, i++)
404404
{
405405
if (nUPBack == i)

XEngine_Source/StorageModule_APIHelp/APIHelp_Error.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@
1919
#define ERROR_STORAGE_MODULE_APIHELP_PARSELEN 0x0030013 //解析长度失败
2020
#define ERROR_STORAGE_MODULE_APIHELP_NOTHASH 0x0030014 //没有HASH值
2121
#define ERROR_STORAGE_MODULE_APIHELP_NOTMATCH 0x0030015 //HASH不匹配
22-
#define ERROR_STORAGE_MODULE_APIHELP_SIZE 0x0030016 //目录大小已经满了
22+
#define ERROR_STORAGE_MODULE_APIHELP_SIZE 0x0030016 //目录大小已经满了
23+
#define ERROR_STORAGE_MODULE_APIHELP_CODE 0x0030017 //服务器返回失败

XEngine_Source/StorageModule_APIHelp/StorageModule_APIHelp.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ EXPORTS
1111

1212
APIHelp_Api_ProxyAuth
1313
APIHelp_Api_RangeFile
14-
APIHelp_Api_VerHash
14+
APIHelp_Api_VerHash
15+
APIHelp_Api_GetIPInfo

0 commit comments

Comments
 (0)