CApp.h 1.6 KB

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