#pragma once

#include "IBaseCurl.h"

#include "event.h"



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

	void init();

	void Login(LPCSTR username, LPCSTR password);

	void SetUrl(LPCSTR url);

	SStringA GetUsername();
	SStringA GetPassWord();
	
	void DonloadConfg();

	void GetNodeList();

	void GetVersion();

	void GetSysConfig();

	void Auth();

	void Reg(LPCSTR username, LPCSTR password);

	void SetUrlList(std::vector<ServerListUrl> data);

private:
	void ThreadFun_login(LPARAM lParam);
	void ThreadFun_Dowlon_Config(LPARAM lParam);
	void ThreadFun_Version_Config(LPARAM lParam);
	void ThreadFun_Sys_Config(LPARAM lParam);
	void ThreadFun_Node_Config(LPARAM lParam);
	void ThreadFun_Auth(LPARAM lParam);
	void ThreadFun_Reg(LPARAM lParam);
	void LoadFileToData();

	void DataToFile();

private:
	SStringA m_username;
	SStringA m_password;
	IBaseCurl* m_base_curl;
	AsynTaskHandle<LPARAM>	m_Asyntask;
};

