Skip to content

Commit 97791af

Browse files
committed
modify:detach version and main configure file
1 parent 9ed8bda commit 97791af

File tree

15 files changed

+113
-18
lines changed

15 files changed

+113
-18
lines changed

.github/workflows/macbuild.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
include:
1717
- os: macos-13
1818
- os: macos-14
19-
- os: macos-15
19+
# - os: macos-15
2020
runs-on: ${{ matrix.os }}
2121

2222
steps:

XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,23 @@ extern "C" XLONG ModuleConfigure_GetLastError(int* pInt_ErrorCode = NULL);
6868
意思:是否成功
6969
备注:
7070
*********************************************************************/
71-
extern "C" bool ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XENGINE_SERVICECONFIG* pSt_ServerConfig);
71+
extern "C" bool ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XENGINE_SERVICECONFIG* pSt_ServerConfig);
72+
/********************************************************************
73+
函数名称:Config_Json_Version
74+
函数功能:读取版本配置文件
75+
参数.一:lpszConfigFile
76+
In/Out:In
77+
类型:常量字符指针
78+
可空:N
79+
意思:输入配置文件
80+
参数.二:pSt_ServerConfig
81+
In/Out:Out
82+
类型:数据结构指针
83+
可空:N
84+
意思:输出读取到的信息
85+
返回值
86+
类型:逻辑型
87+
意思:是否成功
88+
备注:
89+
*********************************************************************/
90+
extern "C" bool ModuleConfigure_Json_Version(LPCXSTR lpszConfigFile, XENGINE_SERVICECONFIG* pSt_ServerConfig);

XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,66 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE
119119
pSt_ServerConfig->st_XLog.nLogLeave = st_JsonXLog["LogLeave"].asInt();
120120
pSt_ServerConfig->st_XLog.nLogType = st_JsonXLog["LogType"].asInt();
121121
_tcsxcpy(pSt_ServerConfig->st_XLog.tszLogFile, st_JsonXLog["LogFile"].asCString());
122-
//版本列表
123-
if (st_JsonRoot["XVer"].empty())
122+
return true;
123+
}
124+
/********************************************************************
125+
函数名称:Config_Json_Version
126+
函数功能:读取版本配置文件
127+
参数.一:lpszConfigFile
128+
In/Out:In
129+
类型:常量字符指针
130+
可空:N
131+
意思:输入配置文件
132+
参数.二:pSt_ServerConfig
133+
In/Out:Out
134+
类型:数据结构指针
135+
可空:N
136+
意思:输出读取到的信息
137+
返回值
138+
类型:逻辑型
139+
意思:是否成功
140+
备注:
141+
*********************************************************************/
142+
bool CModuleConfigure_Json::ModuleConfigure_Json_Version(LPCXSTR lpszConfigFile, XENGINE_SERVICECONFIG* pSt_ServerConfig)
143+
{
144+
Config_IsErrorOccur = false;
145+
146+
if ((NULL == lpszConfigFile) || (NULL == pSt_ServerConfig))
147+
{
148+
Config_IsErrorOccur = true;
149+
Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_PARAMENT;
150+
return false;
151+
}
152+
JSONCPP_STRING st_JsonError;
153+
Json::Value st_JsonRoot;
154+
Json::CharReaderBuilder st_JsonBuilder;
155+
156+
FILE* pSt_File = _xtfopen(lpszConfigFile, _X("rb"));
157+
if (NULL == pSt_File)
158+
{
159+
Config_IsErrorOccur = true;
160+
Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_OPENFILE;
161+
return false;
162+
}
163+
XCHAR tszMsgBuffer[8192] = {};
164+
size_t nRet = fread(tszMsgBuffer, 1, sizeof(tszMsgBuffer), pSt_File);
165+
fclose(pSt_File);
166+
167+
std::unique_ptr<Json::CharReader> const pSt_JsonReader(st_JsonBuilder.newCharReader());
168+
if (!pSt_JsonReader->parse(tszMsgBuffer, tszMsgBuffer + nRet, &st_JsonRoot, &st_JsonError))
169+
{
170+
Config_IsErrorOccur = true;
171+
Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_PARAMENT;
172+
return false;
173+
}
174+
if (st_JsonRoot["XVersionList"].empty())
124175
{
125176
Config_IsErrorOccur = true;
126177
Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_XVER;
127178
return false;
128179
}
129-
Json::Value st_JsonXVer = st_JsonRoot["XVer"];
180+
Json::Value st_JsonXVer = st_JsonRoot["XVersionList"];
181+
130182
pSt_ServerConfig->st_XVer.pStl_ListVer = new list<string>;
131183
if (NULL == pSt_ServerConfig->st_XVer.pStl_ListVer)
132184
{

XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class CModuleConfigure_Json
1818
~CModuleConfigure_Json();
1919
public:
2020
bool ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XENGINE_SERVICECONFIG* pSt_ServerConfig);
21+
bool ModuleConfigure_Json_Version(LPCXSTR lpszConfigFile, XENGINE_SERVICECONFIG* pSt_ServerConfig);
2122
protected:
2223
private:
2324
};

XEngine_Source/XEngine_ModuleConfigure/XEngine_ModuleConfigure.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ LIBRARY
33
EXPORTS
44
ModuleConfigure_GetLastError
55

6-
ModuleConfigure_Json_File
6+
ModuleConfigure_Json_File
7+
ModuleConfigure_Json_Version

XEngine_Source/XEngine_ModuleConfigure/XEngine_ModuleConfigure.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
<PropertyGroup Label="UserMacros" />
100100
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
101101
<LinkIncremental>true</LinkIncremental>
102-
<IncludePath>$(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath)</IncludePath>
102+
<IncludePath>$(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;..\XEngine_ModuleConfigure;$(IncludePath)</IncludePath>
103103
<LibraryPath>$(XEngine_Lib32);$(LibraryPath)</LibraryPath>
104104
</PropertyGroup>
105105
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -109,7 +109,7 @@
109109
</PropertyGroup>
110110
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
111111
<LinkIncremental>true</LinkIncremental>
112-
<IncludePath>$(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath)</IncludePath>
112+
<IncludePath>$(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;..\XEngine_ModuleConfigure;$(IncludePath)</IncludePath>
113113
</PropertyGroup>
114114
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
115115
<LinkIncremental>true</LinkIncremental>

XEngine_Source/XEngine_ModuleConfigure/pch.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ extern "C" bool ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XENGINE_SERVIC
3333
{
3434
return m_ConfigJson.ModuleConfigure_Json_File(lpszConfigFile, pSt_ServerConfig);
3535
}
36+
extern "C" bool ModuleConfigure_Json_Version(LPCXSTR lpszConfigFile, XENGINE_SERVICECONFIG* pSt_ServerConfig)
37+
{
38+
return m_ConfigJson.ModuleConfigure_Json_Version(lpszConfigFile, pSt_ServerConfig);
39+
}

XEngine_Source/XEngine_ServiceApp/XEngine_CenterApp/XEngine_CenterApp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ int main(int argc, char** argv)
179179
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X("启动服务中,业务消息服务没有被启用"));
180180
}
181181

182-
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("所有服务成功启动,服务运行中,XEngine版本:%s%s,服务版本:%s,发行次数;%d。。。"), BaseLib_Version_XNumberStr(), BaseLib_Version_XTypeStr(), st_ServiceConfig.st_XVer.pStl_ListVer->front().c_str(), st_ServiceConfig.st_XVer.pStl_ListVer->size());
182+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("所有服务成功启动,服务运行中,XEngine版本:%s%s,服务版本:%s,发行次数:%d。。。"), BaseLib_Version_XNumberStr(), BaseLib_Version_XTypeStr(), st_ServiceConfig.st_XVer.pStl_ListVer->front().c_str(), st_ServiceConfig.st_XVer.pStl_ListVer->size());
183183

184184
while (true)
185185
{

XEngine_Source/XEngine_ServiceApp/XEngine_CenterApp/XEngine_Configure.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@
1313
bool XEngine_Configure_Parament(int argc, char** argv, XENGINE_SERVICECONFIG* pSt_Configure)
1414
{
1515
LPCXSTR lpszConfigFile = _X("./XEngine_Config/XEngine_CenterConfig.json");
16-
16+
LPCXSTR lpszVersionFile = _X("./XEngine_Config/XEngine_VersionList.json");
1717
if (!ModuleConfigure_Json_File(lpszConfigFile, pSt_Configure))
1818
{
1919
printf("解析配置文件失败,ModuleConfigure_Json_File:%lX\n", ModuleConfigure_GetLastError());
2020
return false;
2121
}
22-
22+
if (!ModuleConfigure_Json_Version(lpszVersionFile, pSt_Configure))
23+
{
24+
printf("解析版本配置失败,ModuleConfigure_Json_Version:%lX\n", ModuleConfigure_GetLastError());
25+
return false;
26+
}
2327
for (int i = 0; i < argc; i++)
2428
{
2529
if ((0 == _tcsxcmp("-h", argv[i])) || (0 == _tcsxcmp("-H", argv[i])))

XEngine_Source/XEngine_ServiceApp/XEngine_HTTP2App/XEngine_Configure.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@
1313
bool XEngine_Configure_Parament(int argc, char** argv, XENGINE_SERVICECONFIG* pSt_Configure)
1414
{
1515
LPCXSTR lpszConfigFile = _X("./XEngine_Config/XEngine_Http2Config.json");
16-
16+
LPCXSTR lpszVersionFile = _X("./XEngine_Config/XEngine_VersionList.json");
1717
if (!ModuleConfigure_Json_File(lpszConfigFile, pSt_Configure))
1818
{
1919
printf("解析配置文件失败,ModuleConfigure_Json_File:%lX\n", ModuleConfigure_GetLastError());
2020
return false;
2121
}
22-
22+
if (!ModuleConfigure_Json_Version(lpszVersionFile, pSt_Configure))
23+
{
24+
printf("解析版本配置失败,ModuleConfigure_Json_Version:%lX\n", ModuleConfigure_GetLastError());
25+
return false;
26+
}
2327
for (int i = 0; i < argc; i++)
2428
{
2529
if ((0 == _tcsxcmp("-h", argv[i])) || (0 == _tcsxcmp("-H", argv[i])))

0 commit comments

Comments
 (0)