Skip to content

Commit cb8575f

Browse files
authored
Merge pull request #28 from libxengine/develop
V3.9.1.1001 Merge
2 parents 975c50d + d9281f3 commit cb8575f

28 files changed

+1527
-50
lines changed

CHANGELOG

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
XEngine_Storage V3.9.1.1001
2+
3+
修改:p2p广播的每个请求都可以被区分了
4+
修改:匹配XEngine V7.45版本
5+
修正:编译警告
6+
7+
modify:p2p broadcast request can be distinguished
8+
modify:match xengine v7.45
9+
fixed:build warn
10+
======================================================================================
111
XEngine_Storage V3.9.0.1001
212

313
添加:用户支持单独限速模式了
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#include "APPClient_UPHdr.h"
2+
#include "APPClient_UPInstall.h"
3+
#include "APPClient_UPTask.h"
4+
5+
int main(int argc, char** argv)
6+
{
7+
#ifdef _MSC_BUILD
8+
WSADATA st_WSAData;
9+
WSAStartup(MAKEWORD(2, 2), &st_WSAData);
10+
#endif
11+
LPCTSTR lpszLocalFile = _T("D:\\XEngine_Storage\\XEngine_APPClient\\Debug\\LocalFile.txt");
12+
LPCTSTR lpszDownload = _T("http://192.168.1.8:5101/storagekey1/xengine/upfile.txt");
13+
TCHAR* ptszMsgBuffer = NULL;
14+
int nMsgLen = 0;
15+
16+
if (!APIHelp_HttpRequest_Custom(_T("GET"), lpszDownload, NULL, NULL, &ptszMsgBuffer, &nMsgLen))
17+
{
18+
printf("APIHelp_HttpRequest_Custom:%lX\n", APIHelp_GetLastError());
19+
return 0;
20+
}
21+
string m_StrDes;
22+
int nLocalCount = 0;
23+
int nRemoteCount = 0;
24+
__int64x nLocalVer = 0;
25+
__int64x nRemoteVer = 0;
26+
FILEPARSER_VERSIONINFO** ppSt_LocalList;
27+
FILEPARSER_VERSIONINFO** ppSt_RemoteList;
28+
if (!FileParser_ReadVer_GetRemote(ptszMsgBuffer, nMsgLen, &ppSt_RemoteList, &nRemoteCount, &nRemoteVer, &m_StrDes))
29+
{
30+
printf("FileParser_ReadVer_GetRemote error\n");
31+
return 0;
32+
}
33+
if (!FileParser_ReadVer_GetLocal(lpszLocalFile, &ppSt_LocalList, &nLocalCount, &nLocalVer))
34+
{
35+
printf("FileParser_ReadVer_GetLocal error\n");
36+
return 0;
37+
}
38+
39+
if (nLocalVer >= nRemoteVer)
40+
{
41+
printf("没有新版本可以使用\n");
42+
return 0;
43+
}
44+
list<FILEPARSER_VERSIONINFO> stl_ListUPDate;
45+
if (!FileParser_Match_Start(&ppSt_RemoteList, nRemoteCount, &ppSt_LocalList, nLocalCount, &stl_ListUPDate))
46+
{
47+
printf("FileParser_ReadVer_GetLocal error\n");
48+
return 0;
49+
}
50+
BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_LocalList, nLocalCount);
51+
BaseLib_OperatorMemory_Free((XPPPMEM)&ppSt_RemoteList, nRemoteCount);
52+
53+
if (stl_ListUPDate.empty())
54+
{
55+
printf("有更新,但是更新列表为空,无法继续\n");
56+
return 0;
57+
}
58+
list<FILEPARSER_VERSIONINFO>::const_iterator stl_ListIterator = stl_ListUPDate.begin();
59+
for (; stl_ListIterator != stl_ListUPDate.end(); stl_ListIterator++)
60+
{
61+
if (0 == stl_ListIterator->st_LocalVersion.nModuleVersion)
62+
{
63+
printf(_T("增加一个模块,模块名称:%s,老模块版本:%lld,新模块版本:%lld\n"), stl_ListIterator->tszModuleName, stl_ListIterator->st_LocalVersion.nModuleVersion, stl_ListIterator->nModuleVersion);
64+
}
65+
else
66+
{
67+
printf(_T("更新一个模块,模块名称:%s,老模块版本:%lld,新模块版本:%lld\n"), stl_ListIterator->tszModuleName, stl_ListIterator->st_LocalVersion.nModuleVersion, stl_ListIterator->nModuleVersion);
68+
}
69+
}
70+
71+
stl_ListIterator = stl_ListUPDate.begin();
72+
for (; stl_ListIterator != stl_ListUPDate.end(); stl_ListIterator++)
73+
{
74+
TCHAR tszPathFile[1024];
75+
NETDOWNLOAD_TASKINFO st_TaskInfo;
76+
77+
memset(tszPathFile, '\0', sizeof(tszPathFile));
78+
memset(&st_TaskInfo, '\0', sizeof(NETDOWNLOAD_TASKINFO));
79+
80+
_stprintf_s(tszPathFile, _T("%s%s"), stl_ListIterator->tszModulePath, stl_ListIterator->tszModuleName);
81+
_tremove(tszPathFile);
82+
XHANDLE xhDown = DownLoad_Http_Create(stl_ListIterator->tszModuleDownload, tszPathFile);
83+
while (TRUE)
84+
{
85+
if (!DownLoad_Http_Query(xhDown, &st_TaskInfo))
86+
{
87+
break;
88+
}
89+
if (ENUM_XENGINE_DOWNLOAD_STATUS_DOWNLOADDING != st_TaskInfo.en_DownStatus)
90+
{
91+
break;
92+
}
93+
}
94+
DownLoad_Http_Delete(xhDown);
95+
}
96+
97+
if (!HelpModule_Api_Copy(&stl_ListUPDate))
98+
{
99+
printf("HelpModule_Api_Copy error\n");
100+
return 0;
101+
}
102+
103+
if (!HelpModule_Api_SetVersion(lpszLocalFile, ptszMsgBuffer, nMsgLen))
104+
{
105+
printf("HelpModule_Api_Copy error\n");
106+
return 0;
107+
}
108+
109+
if (!HelpModule_Api_RunExec(&stl_ListUPDate))
110+
{
111+
printf("HelpModule_Api_Copy error\n");
112+
return 0;
113+
}
114+
115+
if (!HelpModule_Api_Clear(ptszMsgBuffer, nMsgLen))
116+
{
117+
printf("HelpModule_Api_Copy error\n");
118+
return 0;
119+
}
120+
121+
#ifdef _MSC_BUILD
122+
WSACleanup();
123+
#endif
124+
return 0;
125+
}
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>16.0</VCProjectVersion>
23+
<Keyword>Win32Proj</Keyword>
24+
<ProjectGuid>{d2b84345-ce80-4e29-8a3e-6ace68eb7adf}</ProjectGuid>
25+
<RootNamespace>APPClientUPFile</RootNamespace>
26+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30+
<ConfigurationType>Application</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>v143</PlatformToolset>
33+
<CharacterSet>MultiByte</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36+
<ConfigurationType>Application</ConfigurationType>
37+
<UseDebugLibraries>false</UseDebugLibraries>
38+
<PlatformToolset>v143</PlatformToolset>
39+
<WholeProgramOptimization>true</WholeProgramOptimization>
40+
<CharacterSet>Unicode</CharacterSet>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43+
<ConfigurationType>Application</ConfigurationType>
44+
<UseDebugLibraries>true</UseDebugLibraries>
45+
<PlatformToolset>v143</PlatformToolset>
46+
<CharacterSet>Unicode</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49+
<ConfigurationType>Application</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>v143</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>Unicode</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74+
<IncludePath>$(XEngine_Include);../../../XEngine_Source/XEngine_ThirdPart/jsoncpp;$(IncludePath)</IncludePath>
75+
<LibraryPath>$(XEngine_Lib32);$(LibraryPath)</LibraryPath>
76+
</PropertyGroup>
77+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
78+
<ClCompile>
79+
<WarningLevel>Level3</WarningLevel>
80+
<SDLCheck>true</SDLCheck>
81+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
82+
<ConformanceMode>true</ConformanceMode>
83+
</ClCompile>
84+
<Link>
85+
<SubSystem>Console</SubSystem>
86+
<GenerateDebugInformation>true</GenerateDebugInformation>
87+
</Link>
88+
</ItemDefinitionGroup>
89+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
90+
<ClCompile>
91+
<WarningLevel>Level3</WarningLevel>
92+
<FunctionLevelLinking>true</FunctionLevelLinking>
93+
<IntrinsicFunctions>true</IntrinsicFunctions>
94+
<SDLCheck>true</SDLCheck>
95+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
96+
<ConformanceMode>true</ConformanceMode>
97+
</ClCompile>
98+
<Link>
99+
<SubSystem>Console</SubSystem>
100+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
101+
<OptimizeReferences>true</OptimizeReferences>
102+
<GenerateDebugInformation>true</GenerateDebugInformation>
103+
</Link>
104+
</ItemDefinitionGroup>
105+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
106+
<ClCompile>
107+
<WarningLevel>Level3</WarningLevel>
108+
<SDLCheck>true</SDLCheck>
109+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
110+
<ConformanceMode>true</ConformanceMode>
111+
</ClCompile>
112+
<Link>
113+
<SubSystem>Console</SubSystem>
114+
<GenerateDebugInformation>true</GenerateDebugInformation>
115+
</Link>
116+
</ItemDefinitionGroup>
117+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
118+
<ClCompile>
119+
<WarningLevel>Level3</WarningLevel>
120+
<FunctionLevelLinking>true</FunctionLevelLinking>
121+
<IntrinsicFunctions>true</IntrinsicFunctions>
122+
<SDLCheck>true</SDLCheck>
123+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
124+
<ConformanceMode>true</ConformanceMode>
125+
</ClCompile>
126+
<Link>
127+
<SubSystem>Console</SubSystem>
128+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
129+
<OptimizeReferences>true</OptimizeReferences>
130+
<GenerateDebugInformation>true</GenerateDebugInformation>
131+
</Link>
132+
</ItemDefinitionGroup>
133+
<ItemGroup>
134+
<ClCompile Include="APPClient_UPFile.cpp" />
135+
</ItemGroup>
136+
<ItemGroup>
137+
<ClInclude Include="APPClient_UPHdr.h" />
138+
<ClInclude Include="APPClient_UPInstall.h" />
139+
<ClInclude Include="APPClient_UPTask.h" />
140+
</ItemGroup>
141+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
142+
<ImportGroup Label="ExtensionTargets">
143+
</ImportGroup>
144+
</Project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="源文件">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="头文件">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="资源文件">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="APPClient_UPFile.cpp">
19+
<Filter>源文件</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
<ItemGroup>
23+
<ClInclude Include="APPClient_UPInstall.h">
24+
<Filter>头文件</Filter>
25+
</ClInclude>
26+
<ClInclude Include="APPClient_UPTask.h">
27+
<Filter>头文件</Filter>
28+
</ClInclude>
29+
<ClInclude Include="APPClient_UPHdr.h">
30+
<Filter>头文件</Filter>
31+
</ClInclude>
32+
</ItemGroup>
33+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#ifdef _MSC_BUILD
2+
#include <Windows.h>
3+
#include <tchar.h>
4+
#pragma comment(lib,"Ws2_32.lib")
5+
#pragma comment(lib,"../../../XEngine_Source/Debug/jsoncpp")
6+
#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib.lib")
7+
#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIHelp.lib")
8+
#pragma comment(lib,"XEngine_DownLoad/XEngine_DownLoad.lib")
9+
#pragma comment(lib,"XEngine_SystemSdk/XEngine_SystemApi.lib")
10+
#endif
11+
#include <stdio.h>
12+
#include <stdlib.h>
13+
#include <string.h>
14+
#include <signal.h>
15+
#include <string>
16+
#include <list>
17+
#include <thread>
18+
#include <json/json.h>
19+
using namespace std;
20+
#include <XEngine_Include/XEngine_CommHdr.h>
21+
#include <XEngine_Include/XEngine_Types.h>
22+
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Define.h>
23+
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Error.h>
24+
#include <XEngine_Include/XEngine_NetHelp/APIHelp_Define.h>
25+
#include <XEngine_Include/XEngine_NetHelp/APIHelp_Error.h>
26+
#include <XEngine_Include/XEngine_DownLoad/DownLoad_Define.h>
27+
#include <XEngine_Include/XEngine_DownLoad/DownLoad_Error.h>
28+
#include <XEngine_Include/XEngine_SystemSdk/ProcFile_Define.h>
29+
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Define.h>
30+
#include <XEngine_Include/XEngine_SystemSdk/SystemApi_Error.h>
31+
32+
typedef struct
33+
{
34+
CHAR tszModulePath[MAX_PATH]; //模块路径,新增加的必须拥有此值
35+
CHAR tszModuleName[MAX_PATH]; //模块名称
36+
CHAR tszModuleDownload[MAX_PATH]; //模块下载地址
37+
CHAR tszModuleCode[MAX_PATH]; //远程模块标识符
38+
__int64x nModuleVersion; //文件版本号
39+
BOOL bIsRun; //安装完成是否运行
40+
struct
41+
{
42+
__int64x nModuleVersion;
43+
CHAR tszMoudelPath[MAX_PATH];
44+
CHAR tszMoudelName[MAX_PATH];
45+
CHAR tszMoudelCode[MAX_PATH];
46+
}st_LocalVersion;
47+
}FILEPARSER_VERSIONINFO, * LPFILEPARSER_VERSIONINFO;

0 commit comments

Comments
 (0)