#pragma once

#include "CUserInfo.h"

enum PROXY_MODE {

	sys_mode = 0,
	tun_mode,

};


enum ROUT_MODE {

	cn_mode = 0,
	qg_mode,

};

struct SysMode {
	int id;
	PROXY_MODE proxy_mode;
	SStringW  name;
};

struct RouteMode {
	int id;
	ROUT_MODE route_mode;
	SStringW  name;
};

class CApp : public SSingleton<CApp>
{
public:
	CApp();
	~CApp();

	void Init();

	void UnInit();


	bool DataToUserInfo(std::string data);


	CUserInfo* GetUserinfo();

	void SetOut(int out);

	int GetOut();

	void SetSysMode(PROXY_MODE mode);

	PROXY_MODE GetSysMode();

	void SetRouteMode(ROUT_MODE mode);

	ROUT_MODE GetRouteMode();

	void SetMethod(HINSTANCE hinst);

	HINSTANCE GetMethod();
	
	//¼ì²â»òÕßÉèÖÃDataÄ¿Â¼
	void ChkeAndSetDtaPath();

	bool CheckOnlyOneInstance() noexcept;

	std::filesystem::path GetDataPath();
	std::filesystem::path GetConfigPath();
	std::filesystem::path GetConfigGuiPath();

	void SetupDataDirectory();

	void SetCLashRuning(bool m);

	bool GetClashRuning();


private:
	int m_is_out;

	CUserInfo*   m_userinfo;
	PROXY_MODE m_proxy_mode;
	ROUT_MODE  m_route_mode;
	HINSTANCE  m_hInst;
	std::filesystem::path m_dataPath;
	std::filesystem::path m_configPath;
	std::filesystem::path m_config_Gui_Path;

	bool m_clashRuning = true;

};

