LunaHook-mirror/LunaHost/GUI/pluginmanager.h
恍兮惚兮 c94547bbc9 everyone
This reverts commit 975f049797bcd6b9de0e11f9a926d5ac3ec79ef8.

1

1

Revert "Update QtLoader_inline.cpp"

This reverts commit 372dd2dc3e2f23c810f13e51437904fac1422c04.

Update QtLoader_inline.cpp

Update QtLoader_inline.cpp

1

1

1

Update CMakeLists.txt

1

1
2024-03-30 02:32:54 +08:00

55 lines
1.5 KiB
C++

#ifndef LUNA_PLUGINMANAGER_H
#define LUNA_PLUGINMANAGER_H
#include"Plugin/plugindef.h"
#include"textthread.h"
#include<nlohmann/json.hpp>
class LunaHost;
class confighelper;
enum class addpluginresult{
success,
invaliddll,
isnotaplugins,
dumplicate
};
struct pluginitem{
std::string path;
bool isQt;
bool isref;
bool enable;
pluginitem(const nlohmann::json&);
pluginitem(const std::wstring&,bool);
std::wstring wpath();
nlohmann::json dump() const;
};
struct plugindata{
bool isQt;
LPVOID funcptr;
HMODULE hmodule;
};
class Pluginmanager{
std::unordered_map<std::wstring,plugindata>OnNewSentenceS;
std::optional<LPVOID> checkisvalidplugin(const std::wstring&);
concurrency::reader_writer_lock OnNewSentenceSLock;
bool checkisdump(const std::wstring&);
confighelper* configs;
LunaHost* host;
std::array<InfoForExtension, 20> GetSentenceInfo(TextThread& thread);
void loadqtdlls(std::vector<std::wstring>&collectQtplugs);
public:
Pluginmanager(LunaHost*);
bool dispatch(TextThread&, std::wstring& sentence);
addpluginresult addplugin(const std::wstring&,bool onlyload=false);
std::optional<std::wstring>selectpluginfile();
pluginitem get(int);
std::wstring getname(int);
bool getenable(int);
void set(int,const pluginitem&);
void setenable(int ,bool);
int count();
void add(const pluginitem&);
void remove(const std::wstring&,bool);
void swaprank(int,int);
};
#endif