wxhelper/src/global_context.cc
2023-05-20 17:10:14 +08:00

40 lines
1005 B
C++

#include "pch.h"
#include "global_context.h"
#include "http_server.h"
#include "hooks.h"
#include "thread_pool.h"
namespace wxhelper {
void GlobalContext::initialize(HMODULE module) {
module_ = module;
DWORD base = Utils::GetWeChatWinBase();
config.emplace();
config->Initialize();
log.emplace();
log->Initialize();
hide_module.emplace();
#ifndef _DEBUG
hide_module->Hide(module_);
#endif
HttpServer::GetInstance().Init(config->GetPort());
HttpServer::GetInstance().HttpStart();
DB::GetInstance().init(base);
contact_mgr.emplace(ContactMgr{base});
misc_mgr.emplace(MiscMgr{base});
send_mgr.emplace(SendMessageMgr{base});
account_mgr.emplace(AccountMgr{base});
chat_room_mgr.emplace(ChatRoomMgr{base});
sns_mgr.emplace(SNSMgr{base});
ThreadPool::GetInstance().Create(1,512);
}
void GlobalContext::finally() {
HttpServer::GetInstance().HttpClose();
hooks::UnHookLog();
hooks::UnHookRecvMsg();
hooks::UnHookSearchContact();
}
} // namespace wxhelper