Explorar el Código

1、Debug调试配置文件切换;
2、Debug调试不需要延迟启动;

Jeff hace 5 años
padre
commit
6302f36453
Se han modificado 2 ficheros con 10 adiciones y 2 borrados
  1. 4 1
      SATService/SATService/Global.cpp
  2. 6 1
      SATService/SATService/SATService.cpp

+ 4 - 1
SATService/SATService/Global.cpp

@@ -180,12 +180,15 @@ namespace GLOBAL
 		StringCchCat(g_szCurModuleDir, MAX_PATH, szDrive);
 		StringCchCat(g_szCurModuleDir, MAX_PATH, szDir);
 
-		// -----------------------------------------------------//
 		TCHAR szIniPath[MAX_PATH] = {0};
 		if (szPath != NULL && szIniName != NULL)
 			StringCchPrintf(szIniPath, MAX_PATH, _T("%s%s"), szPath, szIniName);
 		else
+#if defined _DEBUG || defined RTEST
 			StringCchPrintf(szIniPath, MAX_PATH, _T("%sSATService.ini"), g_szCurModuleDir);
+#else
+			StringCchPrintf(szIniPath, MAX_PATH, _T("%sSATService_Test.ini"), g_szCurModuleDir);
+#endif
 
 		HANDLE hFile = CreateFile(szIniPath, 0/*GENERIC_READ*/, 0, NULL, OPEN_EXISTING, 0, NULL);
 		

+ 6 - 1
SATService/SATService/SATService.cpp

@@ -22,12 +22,18 @@ extern int test();
 // 工作启动回调函数;
 void CALLBACK WorkStart()
 {
+#if !defined _DEBUG && !defined RTEST
 	Sleep(30000); // 延时启动:未找到服务类型:自动(延迟)类型
+#endif
 	GLOBAL::GetIniInfo();
 	GLOBAL::GetMacAddress();
 	GLOBAL::GetLocalAddress();
 	GLOBAL::WriteTextLog(GLOBAL::SAT_TCP, "SATService goto start, tcp port = %ld", GLOBAL::g_stSATConfig.dwTCPSvrPort);
 
+#if defined _DEBUG || defined RTEST
+	printf("服务端TCP端口号=%ld\n", GLOBAL::g_stSATConfig.dwTCPSvrPort);
+#endif
+
 	WindowsService::GetDebugPriv();
 	// 启用SAT执行器;
 	CSATExecutor::GetInstance()->StartWork();
@@ -70,7 +76,6 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 	{
 		// TODO: 在此处为应用程序的行为编写代码。
 #if defined RTEST || defined _DEBUG
-		printf("服务端TCP端口号=%ld\n", GLOBAL::g_stSATConfig.dwTCPSvrPort);
 		WorkStart();
 
 		// 指定时间停止;