CApp.h 1.4 KB

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