73 lines
1.5 KiB
C++
73 lines
1.5 KiB
C++
#include "DataManage/DataHandle.h"
|
|
#include "global.h"
|
|
#include "SystemInfo.h"
|
|
#include "Logger.h"
|
|
#include "LanguageManager.h"
|
|
#include "Toast.h"
|
|
#include "config/ConfigManager.h"
|
|
#include <iostream>
|
|
|
|
UserType g_Admin;
|
|
|
|
string g_AppPath;
|
|
string g_AppDisk;
|
|
Logger* g_log;
|
|
LanguageManager* g_LngManager;
|
|
Toast* g_Toast;
|
|
bool g_isDebug;
|
|
uint32_t g_ScanSerial;
|
|
string g_gno;
|
|
SystemInfo* g_SystemInfo;
|
|
|
|
void usage() {
|
|
|
|
|
|
}
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
char szFilePath[MAX_PATH + 1] = { 0 };
|
|
GetModuleFileName(NULL, szFilePath, MAX_PATH);
|
|
(strrchr(szFilePath, '\\'))[1] = 0;
|
|
g_AppPath = szFilePath;
|
|
g_AppDisk = g_AppPath.substr(0, 2);
|
|
g_LngManager = new LanguageManager();
|
|
g_LngManager->Init();
|
|
g_Admin = ADMIN;
|
|
|
|
g_isDebug = false;
|
|
g_log = new Logger();
|
|
g_log->m_LogDao->Init();
|
|
g_SystemInfo = new SystemInfo();
|
|
g_Toast = new Toast();
|
|
|
|
DataHandle* dataHandle = new DataHandle();
|
|
dataHandle->Init();
|
|
|
|
printf("服务器已启动,请输入命令:");
|
|
|
|
std::string userInput;
|
|
while (true) {
|
|
std::getline(std::cin, userInput); // 读取用户输入
|
|
|
|
if (userInput == "r" || userInput == "run") {
|
|
printf("service is running...\n");
|
|
dataHandle->Run();
|
|
}
|
|
else if (userInput == "exit" || userInput == "e") {
|
|
dataHandle->Stop();
|
|
delete dataHandle;
|
|
printf("service is exited...\n");
|
|
break;
|
|
}
|
|
else {
|
|
std::cout << "未识别的命令,请重新输入。" << std::endl;
|
|
}
|
|
}
|
|
|
|
delete g_log;
|
|
delete g_SystemInfo;
|
|
delete g_Toast;
|
|
delete g_LngManager;
|
|
return 0;
|
|
} |