fastweb.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #pragma once
  2. #include <vector>
  3. #include <string>
  4. #include "base/define.h"
  5. #include "util/ini.h"
  6. #define FASTWEB_VERSION "V1.0.5"
  7. #define FASTWEB_MODULE_JSON_URL "https://download.fwlua.com/module/module.json"
  8. class fastweb
  9. {
  10. public:
  11. fastweb(const std::vector<std::string>& param);
  12. ~fastweb();
  13. private:
  14. struct module_info{
  15. std::string id;
  16. std::string name;
  17. std::string name_en;
  18. std::string doc;
  19. std::string desc;
  20. std::string type;
  21. std::string download_win64;
  22. std::string download_linux_type;
  23. std::string download_linux_url;
  24. };
  25. private:
  26. /// @brief 启动
  27. /// @param ini_filepath
  28. /// @param wait
  29. void start(std::string ini_filepath);
  30. /// @brief 停止
  31. /// @param app
  32. void stop(void* app);
  33. /// @brief 输出HELP信息
  34. void output_help();
  35. /// @brief 创建配置文件
  36. /// @param dirpath
  37. void create_config(std::string dirpath);
  38. /// @brief 创建网站木板
  39. /// @param dirpath
  40. void create_website(std::string dirpath);
  41. /// @brief 安装模块
  42. /// @param ini_filepath
  43. /// @param name
  44. void install_module(std::string ini_filepath,std::string name);
  45. /// @brief 卸载模块
  46. /// @param ini_filepath
  47. /// @param name
  48. void uninstall_module(std::string ini_filepath,std::string name);
  49. /// @brief 模块列表
  50. void module_list();
  51. /// @brief 模块信息
  52. /// @return
  53. bool module_infos(std::vector<fastweb::module_info>& list);
  54. private:
  55. /// @brief 无限等待
  56. void wait();
  57. void install_module_linux(fastweb::module_info info);
  58. void install_module_windows(fastweb::module_info info);
  59. /// @brief 解析INI配置文件
  60. /// @param ini_filepath
  61. bool parse_config(const std::string& ini_filepath);
  62. private:
  63. ylib::ini m_ini;
  64. };