92 lines
1.8 KiB
C++

#include <iostream>
#include <memory>
#include <string>
#include <thread>
#include <codecvt>
#include <grpcpp/grpcpp.h>
#include "global.h"
#include "SystemInfo.h"
#include "Logger.h"
#include "Toast.h"
#include "stdafx.h"
#include <map>
#include "LanguageManager.h"
#include "../DataManage/DataHandle.h"
#include "../utils/ConverType.h"
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;
class HBDSystem {
public:
HBDSystem(){}
~HBDSystem(){
DELP(g_log);
DELP(g_Toast);
DELP(g_SystemInfo);
DELP(g_LngManager);
//DELP(m_controller);
//DELP(m_win);
}
bool init(){
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_isDebug = false;
g_log = new Logger();
g_log->m_LogDao->Init();
g_SystemInfo = new SystemInfo();
g_Toast = new Toast();
g_Lang = (char*)"zh_CN";
//g_LngManager = new LanguageManager();
//ChartletManager::GetInstance()->Init();
//g_LngManager->Init();
return true;
}
};
int main(int argc, char** argv) {
HBDSystem* sys = new HBDSystem();
sys->init();
DataHandle* dataHandle = new DataHandle();
dataHandle->Init();
dataHandle->Usage();
std::string userInput;
bool unknowCmd = false;
while (true) {
if (!unknowCmd)printf("*请输入命令:");
std::getline(std::cin, userInput); // 读取用户输入
unknowCmd = false;
if (userInput.empty()) continue;
if(ConverType::TryToI(userInput)<0 || dataHandle->Request(stoi(userInput)) < 0){
printf("未识别的命令,请重新输入命令:");
unknowCmd = true;
}
}
DELP(dataHandle);
DELP(sys);
return 0;
}