CApp.h 1.2 KB

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