CApp.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #pragma once
  2. #include "CBaseMode.h"
  3. #include "CUserInfo.h"
  4. #include "CServerList.h"
  5. #include "CVersion.h"
  6. #include "CSysConfig.h"
  7. #include "CLoginInfo.h"
  8. enum struct PROXY_MODE {
  9. sys_mode = 0,
  10. tun_mode,
  11. };
  12. enum struct ROUT_MODE{
  13. cn_mode = 0,
  14. qg_mode,
  15. };
  16. struct SysMode {
  17. int id;
  18. PROXY_MODE proxy_mode;
  19. SStringW name;
  20. };
  21. struct RouteMode {
  22. int id;
  23. ROUT_MODE route_mode;
  24. SStringW name;
  25. };
  26. class CApp : public SSingleton<CApp>
  27. {
  28. public:
  29. CApp();
  30. ~CApp();
  31. void Init();
  32. void UnInit();
  33. CLoginInfo* GetLoginInfo();
  34. CSysConfig* CApp::GetSysconfig();
  35. CUserInfo* GetUserinfo();
  36. CServerList* GetServerList();
  37. CVersion* GetVerinfo();
  38. void SetOut(int out);
  39. int GetOut();
  40. void SetSysMode(PROXY_MODE mode);
  41. PROXY_MODE GetSysMode();
  42. void SetRouteMode(ROUT_MODE mode);
  43. ROUT_MODE GetRouteMode();
  44. void SetMethod(HINSTANCE hinst);
  45. HINSTANCE GetMethod();
  46. //¼ì²â»òÕßÉèÖÃDataĿ¼
  47. void ChkeAndSetDtaPath();
  48. bool CheckOnlyOneInstance() noexcept;
  49. std::filesystem::path GetDataPath();
  50. std::filesystem::path GetConfigPath();
  51. std::filesystem::path GetConfigGuiPath();
  52. void SetupDataDirectory();
  53. void SetCLashRuning(bool m);
  54. bool GetClashRuning();
  55. std::string GetToken() const { return m_token; }
  56. void SetToken(std::string val) { m_token = val; }
  57. std::string GetSelect_node() const;
  58. void SetSelect_node(std::string val);
  59. void SetSelectNodeById(int i_d);
  60. int GetSelectNodeById();
  61. private:
  62. int m_is_out;
  63. CLoginInfo* m_login_info;
  64. CServerList* m_server_list;
  65. CUserInfo* m_userinfo;
  66. CVersion* m_versioninfo;
  67. CSysConfig* m_sys_config;
  68. PROXY_MODE m_proxy_mode;
  69. ROUT_MODE m_route_mode;
  70. HINSTANCE m_hInst;
  71. std::filesystem::path m_dataPath;
  72. std::filesystem::path m_configPath;
  73. std::filesystem::path m_config_Gui_Path;
  74. bool m_clashRuning = true;
  75. std::string m_token;
  76. /**/
  77. std::string select_node;
  78. int node_select_id;
  79. };