IdentifyEngine.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "stdafx.h"
  2. #include "IdentifyEngine.h"
  3. #include <WinInet.h>
  4. #include "ServerConfig.h"
  5. #include "basic_struct.h"
  6. CIdentifyEngine::CIdentifyEngine()
  7. {
  8. }
  9. CIdentifyEngine::~CIdentifyEngine()
  10. {
  11. }
  12. int CIdentifyEngine::SetCookie(std::string path, std::string name, std::string value)
  13. {
  14. return InternetSetCookie(CA2T(path.c_str()), CA2T(name.c_str()), CA2T(value.c_str()));
  15. }
  16. int CIdentifyEngine::SetLocalServerCookie(std::string name, std::string value)
  17. {
  18. switch (CServerConfig::server_address_type){
  19. case SAT_LOCAL_IN:InternetSetCookie(CServerConfig::server_url_local_in, CA2T(name.c_str()), CA2T(value.c_str())); break;
  20. case SAT_LOCAL_OUT:InternetSetCookie(CServerConfig::server_url_local_out, CA2T(name.c_str()), CA2T(value.c_str())); break;
  21. }
  22. return TRUE;
  23. }
  24. int CIdentifyEngine::SetServerUrl(std::string server_url)
  25. {
  26. CServerConfig::server_url = CString(server_url.c_str());
  27. return EPIR_SUCCESS;
  28. }
  29. boost::shared_ptr<CIdentifyEngine> CIdentifyEngine::GetInstance()
  30. {
  31. static boost::shared_ptr<CIdentifyEngine> instance_(new CIdentifyEngine);
  32. return instance_;
  33. }
  34. int CIdentifyEngine::SetScanConfig(std::string app_data_dir, std::string scan_data_dir)
  35. {
  36. CServerConfig::app_data_dir = CString(app_data_dir.c_str());
  37. CServerConfig::app_data_dir_string = scan_data_dir;
  38. CServerConfig::scan_data_dir = CString(scan_data_dir.c_str());
  39. return TRUE;
  40. }