From 63430caf254bd76f1a30b51b20a6be3d8609a7ae Mon Sep 17 00:00:00 2001 From: MasterLaplace Date: Tue, 10 Dec 2024 01:46:38 -0500 Subject: [PATCH] feat: add GameDownloader class for managing game downloads and updates --- CMakeLists.txt | 2 + Flakkari/Server/Internals/GameDownloader.cpp | 3 ++ Flakkari/Server/Internals/GameDownloader.hpp | 51 ++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 Flakkari/Server/Internals/GameDownloader.cpp create mode 100644 Flakkari/Server/Internals/GameDownloader.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 82c8632..b4131ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ set(SOURCES Flakkari/Server/Game/ResourceManager.cpp Flakkari/Server/Internals/CommandManager.cpp + Flakkari/Server/Internals/GameDownloader.cpp ) set(HEADERS @@ -71,6 +72,7 @@ set(HEADERS Flakkari/Server/Game/ResourceManager.hpp Flakkari/Server/Internals/CommandManager.hpp + Flakkari/Server/Internals/GameDownloader.hpp ) set(HEADER_LIB_LOGGER diff --git a/Flakkari/Server/Internals/GameDownloader.cpp b/Flakkari/Server/Internals/GameDownloader.cpp new file mode 100644 index 0000000..81229cd --- /dev/null +++ b/Flakkari/Server/Internals/GameDownloader.cpp @@ -0,0 +1,3 @@ +#include "GameDownloader.hpp" + +using namespace Flakkari::Internals; diff --git a/Flakkari/Server/Internals/GameDownloader.hpp b/Flakkari/Server/Internals/GameDownloader.hpp new file mode 100644 index 0000000..cced39d --- /dev/null +++ b/Flakkari/Server/Internals/GameDownloader.hpp @@ -0,0 +1,51 @@ +/************************************************************************** + * Flakkari Library v0.5.0 + * + * Flakkari Library is a C++ Library for Network. + * @file GameDownloader.hpp + * @brief GameDownloader is a class that downloads games from the remote + * repository and stores them in the Games folder. + * It also updates the games if they are already present and removes them + * if they are not present in the remote repository. + * + * Flakkari Library is under MIT License. + * https://opensource.org/licenses/MIT + * © 2023 @MasterLaplace + * @version 0.5.0 + * @date 2024-12-09 + **************************************************************************/ + +#ifndef GAMEDOWNLOADER_HPP_ +#define GAMEDOWNLOADER_HPP_ + +#include +#include +#include + +#include "../Game/GameManager.hpp" +#include "config.h.in" + + +namespace Flakkari::Internals { + +class GameDownloader { +public: + /** + * @brief Construct a new Game Downloader object + * + */ + GameDownloader(const std::string &gameDir) : _gameDir(gameDir) {} + + /** + * @brief Destroy the Game Downloader object + * + */ + ~GameDownloader() = default; + +private: + std::string _gameDir; +}; + +} // namespace Flakkari::Internals + +#endif /* !GAMEDOWNLOADER_HPP_ */