fastweb.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.6"
  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. #ifndef _WIN32
  58. void install_module_linux(fastweb::module_info info);
  59. #else
  60. void install_module_windows(fastweb::module_info info);
  61. #endif
  62. /// @brief 解析INI配置文件
  63. /// @param ini_filepath
  64. bool parse_config(const std::string& ini_filepath);
  65. private:
  66. ylib::ini m_ini;
  67. };