/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
release-23.11
Code/Tools/Fileserve/Fileserve.cpp
93 строки
2 KB
Jan Krassnigg
Migrate code to use Make* functions (#1022)
03 авг 2023, 08:07
Не верифицирован
03 авг 2023, 08:07
c42cf1d
Код
Авторство
О чём код?
#include <Fileserve/FileservePCH.h> #include <Fileserve/Fileserve.h> #include <Foundation/Configuration/Startup.h> #include <Foundation/IO/FileSystem/FileSystem.h> #include <Foundation/Utilities/CommandLineUtils.h> #ifdef EZ_USE_QT # include <Fileserve/Gui.moc.h> # include <Foundation/Basics/Platform/Win/IncludeWindows.h> # include <QApplication> #endif #ifdef EZ_USE_QT int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine, int iCmdShow) { #else int main(int argc, const char** argv) { #endif ezFileserverApp* pApp = new ezFileserverApp(); #ifdef EZ_USE_QT ezCommandLineUtils::GetGlobalInstance()->SetCommandLine(); int argc = 0; char** argv = nullptr; QApplication* pQtApplication = new QApplication(argc, const_cast<char**>(argv)); pQtApplication->setApplicationName("ezFileserve"); pQtApplication->setOrganizationDomain("www.ezEngine.net"); pQtApplication->setOrganizationName("ezEngine Project"); pQtApplication->setApplicationVersion("1.0.0"); ezRun_Startup(pApp).IgnoreResult(); CreateFileserveMainWindow(pApp); pQtApplication->exec(); ezRun_Shutdown(pApp); #else pApp->SetCommandLineArguments((ezUInt32)argc, argv); ezRun(pApp); #endif const int iReturnCode = pApp->GetReturnCode(); if (iReturnCode != 0) { std::string text = pApp->TranslateReturnCode(); if (!text.empty()) printf("Return Code: '%s'\n", text.c_str()); } #ifdef EZ_USE_QT delete pQtApplication; #endif delete pApp; return iReturnCode; } ezResult ezFileserverApp::BeforeCoreSystemsStartup() { ezStartup::AddApplicationTag("tool"); ezStartup::AddApplicationTag("fileserve"); return SUPER::BeforeCoreSystemsStartup(); } void ezFileserverApp::FileserverEventHandler(const ezFileserverEvent& e) { switch (e.m_Type) { case ezFileserverEvent::Type::ClientConnected: case ezFileserverEvent::Type::ClientReconnected: ++m_uiConnections; m_TimeTillClosing = ezTime::MakeZero(); break; case ezFileserverEvent::Type::ClientDisconnected: --m_uiConnections; if (m_uiConnections == 0 && m_CloseAppTimeout.GetSeconds() > 0) { // reset the timer m_TimeTillClosing = ezTime::Now() + m_CloseAppTimeout; } break; default: break; } }