Files
SimpleRemoter/server/2015Remote/PluginSettingsDlg.h

74 lines
2.3 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include "resource.h"
#include "LangManager.h"
#include "common/commands.h"
#include "common/scheduler.h"
#include <vector>
#include <string>
// 前向声明
struct DllInfo;
// 插件配置结构体(用于 JSON 存储)
struct PluginConfig {
std::string Name; // 插件名称(作为唯一标识)
std::string Md5; // MD5
int RunType; // 运行类型
int CallType; // 调用方式
unsigned char Mode; // 调度模式
unsigned char Flags; // 标志位
unsigned int Interval; // 间隔(秒)
unsigned char MaxCount; // 最大次数
PluginConfig() : RunType(MEMORYDLL), CallType(CALLTYPE_IOCPTHREAD), Mode(SCH_MODE_NONE), Flags(0), Interval(0), MaxCount(0) {}
};
// 插件设置对话框
class CPluginSettingsDlg : public CDialogLangEx
{
public:
CPluginSettingsDlg(std::vector<DllInfo*>& dllList, CWnd* pParent = nullptr);
virtual ~CPluginSettingsDlg();
enum { IDD = IDD_DIALOG_PLUGIN_SETTINGS };
// 静态方法:加载插件配置
static std::vector<PluginConfig> LoadPluginConfigs();
// 静态方法:保存插件配置
static void SavePluginConfigs(const std::vector<PluginConfig>& configs);
// 静态方法:获取配置文件路径
static std::string GetPluginConfigPath();
// 静态方法:根据配置更新 DllInfoPatch
static void PatchDllList(std::vector<DllInfo*>& dllList);
protected:
virtual void DoDataExchange(CDataExchange* pDX);
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
afx_msg void OnBnClickedBtnSave();
afx_msg void OnLvnItemchangedListPlugins(NMHDR* pNMHDR, LRESULT* pResult);
private:
void InitListCtrl();
void LoadPluginsToList();
void UpdateSelectedPluginInfo();
void SaveCurrentPluginConfig();
PluginConfig* FindConfig(const std::string& name);
private:
std::vector<DllInfo*>& m_DllList; // 引用主对话框的 DLL 列表
std::vector<PluginConfig> m_Configs; // 插件配置列表
int m_nSelectedIndex; // 当前选中的列表项索引
// 控件变量
CListCtrl m_listPlugins;
CComboBox m_comboRunType;
CComboBox m_comboCallType;
CComboBox m_comboMode;
CEdit m_editInterval;
CEdit m_editMaxCount;
};