feature: TestRun读配置失败后再从命令行获取IP和端口信息
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <corecrt_io.h>
|
||||||
|
|
||||||
typedef void (*StopRun)();
|
typedef void (*StopRun)();
|
||||||
|
|
||||||
@@ -90,6 +91,11 @@ BOOL CALLBACK callback(DWORD CtrlType)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @brief <20><><EFBFBD>ȶ<EFBFBD>ȡsettings.ini<6E><69><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ȡIP<49>Ͷ˿<CDB6>.
|
||||||
|
// [settings]
|
||||||
|
// localIp=XXX
|
||||||
|
// ghost=6688
|
||||||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ھʹ<DABE><CDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>ȡIP<49>Ͷ˿<CDB6>.
|
||||||
int main(int argc, const char *argv[])
|
int main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
if(!SetSelfStart(argv[0], "a_ghost"))
|
if(!SetSelfStart(argv[0], "a_ghost"))
|
||||||
@@ -116,9 +122,15 @@ int main(int argc, const char *argv[])
|
|||||||
if (0 == strlen(ip))
|
if (0 == strlen(ip))
|
||||||
{
|
{
|
||||||
strcpy(p+1, "settings.ini");
|
strcpy(p+1, "settings.ini");
|
||||||
|
if (_access(path, 0) == -1){
|
||||||
|
ip = argc > 1 ? argv[1] : "127.0.0.1";
|
||||||
|
port = argc > 2 ? atoi(argv[2]) : 19141;
|
||||||
|
}
|
||||||
|
else {
|
||||||
GetPrivateProfileStringA("settings", "localIp", "yuanyuanxiang.oicp.net", ip, _MAX_PATH, path);
|
GetPrivateProfileStringA("settings", "localIp", "yuanyuanxiang.oicp.net", ip, _MAX_PATH, path);
|
||||||
port = GetPrivateProfileIntA("settings", "ghost", 19141, path);
|
port = GetPrivateProfileIntA("settings", "ghost", 19141, path);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
printf("[server] %s:%d\n", ip, port);
|
printf("[server] %s:%d\n", ip, port);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user