bool Encryption::Start() { int selection = MessageBox(NULL, TEXT("Click Yes to encrypt, No to decrypt, and Cancel to exit."), TEXT("Info"), MB_YESNOCANCEL); switch (selection) { case IDYES: bEncrypt = true; break; case IDNO: bDecrypt = true; break; case IDCANCEL: exit(0); default: break; }; if(!InputThreadProc()) return false; TCHAR pFolderPath[MAX_BUFFER_SIZE]; GetCurrentDirectory(MAX_BUFFER_SIZE, pFolderPath); if (!GetCryptionStuffReady()) return false; if (!TraverseFile(pFolderPath)) return false; return true; }
int main(int argc, char** argv) try { char LogFileName[MFile::MaxPath]; GetLogFilename(LogFileName, "MatchLog", "txt"); InitLog(MLOGSTYLE_DEBUGSTRING | MLOGSTYLE_FILE, LogFileName); void MatchServerCustomLog(const char*); CustomLog = MatchServerCustomLog; MCrashDump::SetCallback([](uintptr_t ExceptionInfo) { char Filename[MFile::MaxPath]; GetLogFilename(Filename, "MatchServer", "dmp"); MCrashDump::WriteDump(ExceptionInfo, Filename); }); MBMatchServer MatchServer; if (!MatchServer.Create(6000)) { MLog("MMatchServer::Create failed\n"); return -1; } MatchServer.InitLocator(); std::thread{ [&] { InputThreadProc(); } }.detach(); while (true) { MatchServer.Run(); HandleInput(MatchServer); std::this_thread::sleep_for(std::chrono::milliseconds(1)); } } catch (std::runtime_error& e) { MLog("Uncaught std::runtime_error: %s\n", e.what()); throw; }