diff --git a/source/MaaToolKit/Config/Config.cpp b/source/MaaToolKit/Config/Config.cpp deleted file mode 100644 index 4c39707b7..000000000 --- a/source/MaaToolKit/Config/Config.cpp +++ /dev/null @@ -1,230 +0,0 @@ -#include "Config.h" - -#include "MaaFramework/MaaAPI.h" - -#include "Utils/Logger.h" -#include "Utils/Ranges.hpp" - -MAA_TOOLKIT_CONFIG_NS_BEGIN - -void Config::set_name(std::string_view new_name) -{ - LogInfo << VAR(name_) << VAR(new_name); - name_ = new_name; -} - -void Config::set_description(std::string_view new_description) -{ - LogInfo << VAR(name_) << VAR(description_) << VAR(new_description); - description_ = new_description; -} - -std::string_view Config::get_custom_info(std::string_view key) const -{ - auto find_it = custom_info_.find(std::string(key)); - if (find_it == custom_info_.end()) { - LogError << "Key not found" << VAR(key) << VAR(custom_info_); - return std::string_view(); - } - return find_it->second; -} - -void Config::set_custom_info(std::string key, std::string value) -{ - LogInfo << VAR(name_) << VAR(key) << VAR(value); - custom_info_.insert_or_assign(std::move(key), std::move(value)); -} - -void Config::bind_instance(MaaInstanceHandle instance) -{ - LogInfo << VAR(name_) << VAR_VOIDP(instance_) << VAR_VOIDP(instance); - instance_ = instance; -} - -size_t Config::task_size() const -{ - return task_vec_.size(); -} - -MaaToolKitTaskHandle Config::task_by_index(size_t index) -{ - if (index >= task_vec_.size()) { - LogError << "Out of range" << VAR(index) << VAR(task_vec_.size()); - return nullptr; - } - return task_vec_[index].get(); -} - -MaaToolKitTaskHandle Config::add_task(std::string_view task_name, MaaToolKitTaskHandle copy_from) -{ - LogInfo << VAR(name_) << VAR(task_name) << VAR(copy_from); - - if (task_name.empty()) { - LogError << "Name is empty"; - return nullptr; - } - - std::string str_task_name(task_name); - if (task_map_.contains(str_task_name)) { - LogError << "Task name already exists" << VAR(task_name) << VAR(task_map_); - return nullptr; - } - - Task new_task; - if (auto cast = dynamic_cast(copy_from); cast) { - new_task = *cast; - } - new_task.set_name(task_name); - - // Don't worry, the raw pointer is always in member cache. - return insert(std::move(str_task_name), std::move(new_task)).get(); -} - -bool Config::del_task(std::string_view task_name) -{ - LogInfo << VAR(name_) << VAR(task_name); - - if (task_name.empty()) { - LogError << "Name is empty"; - return false; - } - - std::string str_task_name(task_name); - bool removed = task_map_.erase(str_task_name) > 0; - if (!removed) { - LogError << "Task name not found in map" << VAR(task_name) << VAR(task_map_); - return false; - } - auto find_it = MAA_RNS::ranges::find_if(task_vec_, [&](const auto& task) { return task->get_name() == task_name; }); - if (find_it == task_vec_.end()) { - LogError << "Task name not found in vec" << VAR(task_name) << VAR(task_vec_); - return false; - } - task_vec_.erase(find_it); - - LogDebug << VAR(task_name) << VAR(task_vec_) << VAR(task_map_); - return true; -} - -bool Config::set_task_index(std::string_view task_name, size_t new_index) -{ - LogInfo << VAR(name_) << VAR(task_name) << VAR(new_index); - - auto find_it = MAA_RNS::ranges::find_if(task_vec_, [&](const auto& task) { return task->get_name() == task_name; }); - if (find_it == task_vec_.end()) { - LogError << "Task name not found in vec:" << task_name; - return false; - } - if (new_index >= task_vec_.size()) { - LogError << "Out of range" << VAR(new_index) << VAR(task_vec_.size()); - return false; - } - - auto task_ptr = std::move(*find_it); - task_vec_.erase(find_it); - task_vec_.insert(task_vec_.begin() + new_index, std::move(task_ptr)); - - return true; -} - -bool Config::post_all_task() -{ - if (!instance_) { - LogError << "Instance not binded"; - return false; - } - - for (const auto& task : task_vec_) { - if (!task->get_enabled()) { - continue; - } - - last_task_id_ = MaaPostTask(instance_, task->get_entry().data(), task->get_param().data()); - } - - return true; -} - -MaaStatus Config::wait_all_task() const -{ - if (!instance_) { - LogError << "Instance not binded"; - return MaaStatus_Invalid; - } - - return MaaWaitTask(instance_, last_task_id_); -} - -void Config::stop_all_task() -{ - if (!instance_) { - LogError << "Instance not binded"; - return; - } - - MaaStop(instance_); -} - -MaaResourceHandle Config::raw_resource() -{ - return MaaGetResource(instance_); -} - -MaaControllerHandle Config::raw_controller() -{ - return MaaGetController(instance_); -} - -json::value Config::to_json() const -{ - json::value root; - root[kNameKey] = name_; - root[kDescriptionKey] = description_; - - auto& tasks = root[kTasksKey].as_array(); - for (const auto& task : task_vec_) { - tasks.emplace_back(task->to_json()); - } - root[kCustomInfoKey] = json::object(custom_info_); - return root; -} - -bool Config::from_json(const json::value& json) -{ - LogFunc << VAR(json); - - auto name_opt = json.find(kNameKey); - if (!name_opt) { - return false; - } - name_ = std::move(name_opt).value(); - - description_ = json.get(kDescriptionKey, std::string()); - - for (const auto& j_task : json.get(kTasksKey, json::array())) { - Task task; - if (!task.from_json(j_task)) { - LogError << "Task from json failed" << VAR(j_task); - return false; - } - insert(std::string(task.get_name()), std::move(task)); - } - return true; -} - -const std::shared_ptr& Config::insert(std::string name, Task task) -{ - auto& ref = task_vec_.emplace_back(std::make_shared(std::move(task))); - task_map_.insert_or_assign(name, ref); - - LogDebug << VAR(name) << VAR(ref) << VAR(*ref) << VAR(task_vec_) << VAR(task_map_); - return ref; -} - -std::ostream& operator<<(std::ostream& os, const Config& config) -{ - os << VAR_RAW(config.name_) << VAR_RAW(config.description_) << VAR_RAW(config.task_vec_.size()); - return os; -} - -MAA_TOOLKIT_CONFIG_NS_END diff --git a/source/MaaToolKit/Config/Config.h b/source/MaaToolKit/Config/Config.h deleted file mode 100644 index fbf0cb78c..000000000 --- a/source/MaaToolKit/Config/Config.h +++ /dev/null @@ -1,71 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include - -#include "Conf/Conf.h" -#include "ConfigAPI.h" -#include "Task.h" - -MAA_TOOLKIT_CONFIG_NS_BEGIN - -class Config : public MaaToolKitConfigAPI -{ -public: - inline static const std::string kNameKey = "name"; - inline static const std::string kDescriptionKey = "description"; - inline static const std::string kCustomInfoKey = "custom"; - inline static const std::string kTasksKey = "tasks"; - -public: - Config() = default; - virtual ~Config() override = default; - -public: // from MaaToolKitConfigAPI - virtual std::string_view get_name() const override { return name_; } - virtual void set_name(std::string_view new_name) override; - virtual std::string_view get_description() const override { return description_; } - virtual void set_description(std::string_view new_description) override; - virtual std::string_view get_custom_info(std::string_view key) const override; - virtual void set_custom_info(std::string key, std::string value) override; - - virtual size_t task_size() const override; - virtual MaaToolKitTaskHandle task_by_index(size_t index) override; - - virtual MaaToolKitTaskHandle add_task(std::string_view task_name, MaaToolKitTaskHandle copy_from) override; - virtual bool del_task(std::string_view task_name) override; - virtual bool set_task_index(std::string_view task_name, size_t new_index) override; - - virtual void bind_instance(MaaInstanceHandle instance) override; - virtual bool post_all_task() override; - virtual MaaStatus wait_all_task() const override; - virtual void stop_all_task() override; - - virtual MaaInstanceHandle raw_instance() override { return instance_; } - virtual MaaResourceHandle raw_resource() override; - virtual MaaControllerHandle raw_controller() override; - -public: - json::value to_json() const; - bool from_json(const json::value& json); - const std::shared_ptr& insert(std::string name, Task task); - - friend std::ostream& operator<<(std::ostream& os, const Config& config); - -private: - std::string name_; - std::string description_; - std::map custom_info_; - - std::vector> task_vec_; // for C API - std::map> task_map_; - - MaaInstanceHandle instance_ = nullptr; - MaaTaskId last_task_id_ = 0; -}; - -MAA_TOOLKIT_CONFIG_NS_END diff --git a/source/MaaToolKit/Config/ConfigAPI.h b/source/MaaToolKit/Config/ConfigAPI.h index 9b61f5a79..76c6c7e6d 100644 --- a/source/MaaToolKit/Config/ConfigAPI.h +++ b/source/MaaToolKit/Config/ConfigAPI.h @@ -11,63 +11,4 @@ struct MaaToolKitConfigMgrAPI virtual bool init() = 0; virtual bool uninit() = 0; - - virtual std::string_view get_custom_info(std::string_view key) const = 0; - virtual void set_custom_info(std::string key, std::string value) = 0; - - virtual size_t config_size() const = 0; - virtual MaaToolKitConfigHandle config_by_index(size_t index) = 0; - virtual MaaToolKitConfigHandle current() = 0; - - virtual MaaToolKitConfigHandle add_config(std::string_view config_name, MaaToolKitConfigHandle copy_from) = 0; - virtual bool del_config(std::string_view config_name) = 0; - virtual bool set_current_config(std::string_view config_name) = 0; -}; - -struct MaaToolKitConfigAPI -{ - virtual ~MaaToolKitConfigAPI() = default; - - virtual std::string_view get_name() const = 0; - virtual void set_name(std::string_view new_name) = 0; - virtual std::string_view get_description() const = 0; - virtual void set_description(std::string_view new_description) = 0; - virtual std::string_view get_custom_info(std::string_view key) const = 0; - virtual void set_custom_info(std::string key, std::string value) = 0; - - virtual size_t task_size() const = 0; - virtual MaaToolKitTaskHandle task_by_index(size_t index) = 0; - - virtual MaaToolKitTaskHandle add_task(std::string_view task_name, MaaToolKitTaskHandle copy_from) = 0; - virtual bool del_task(std::string_view task_name) = 0; - virtual bool set_task_index(std::string_view task_name, size_t new_index) = 0; - - virtual void bind_instance(MaaInstanceHandle instance) = 0; - virtual bool post_all_task() = 0; - virtual MaaStatus wait_all_task() const = 0; - virtual void stop_all_task() = 0; - - virtual MaaResourceHandle raw_resource() = 0; - virtual MaaControllerHandle raw_controller() = 0; - virtual MaaInstanceHandle raw_instance() = 0; -}; - -struct MaaToolKitTaskAPI -{ - virtual ~MaaToolKitTaskAPI() = default; - - virtual std::string_view get_name() const = 0; - virtual void set_name(std::string_view new_name) = 0; - virtual std::string_view get_description() const = 0; - virtual void set_description(std::string_view new_description) = 0; - virtual std::string_view get_entry() const = 0; - virtual void set_entry(std::string_view new_entry) = 0; - virtual std::string_view get_param() const = 0; - virtual void set_param(std::string_view new_param) = 0; - virtual bool get_enabled() const = 0; - virtual void set_enabled(bool new_enabled) = 0; - virtual std::string_view get_custom_info(std::string_view key) const = 0; - virtual void set_custom_info(std::string key, std::string value) = 0; - - virtual MaaStatus status() const = 0; }; diff --git a/source/MaaToolKit/Config/ConfigMgr.cpp b/source/MaaToolKit/Config/ConfigMgr.cpp index 601c14619..96d793f4d 100644 --- a/source/MaaToolKit/Config/ConfigMgr.cpp +++ b/source/MaaToolKit/Config/ConfigMgr.cpp @@ -17,7 +17,6 @@ bool ConfigMgr::init() LogFunc << VAR(kConfigPath); if (!std::filesystem::exists(kConfigPath)) { - generate_default_config(); dump(); } @@ -37,124 +36,6 @@ bool ConfigMgr::uninit() return dump(); } -std::string_view ConfigMgr::get_custom_info(std::string_view key) const -{ - auto find_it = custom_info_.find(std::string(key)); - if (find_it == custom_info_.end()) { - LogError << "Key not found" << VAR(key) << VAR(custom_info_); - return std::string_view(); - } - return find_it->second; -} - -void ConfigMgr::set_custom_info(std::string key, std::string value) -{ - LogInfo << VAR(key) << VAR(value); - custom_info_.insert_or_assign(std::move(key), std::move(value)); -} - -size_t ConfigMgr::config_size() const -{ - return config_vec_.size(); -} - -MaaToolKitConfigHandle ConfigMgr::config_by_index(size_t index) -{ - if (index >= config_vec_.size()) { - LogError << "Out of range" << VAR(index) << VAR(config_vec_.size()); - return nullptr; - } - return config_vec_[index].get(); -} - -MaaToolKitConfigHandle ConfigMgr::current() -{ - auto find_it = config_map_.find(current_); - if (find_it == config_map_.end()) { - LogError << "Current not found" << VAR(current_) << VAR(config_map_); - return nullptr; - } - - return find_it->second.get(); -} - -MaaToolKitConfigHandle ConfigMgr::add_config(std::string_view config_name, MaaToolKitConfigHandle copy_from) -{ - LogInfo << VAR(config_name) << VAR_VOIDP(copy_from); - - if (config_name.empty()) { - LogError << "Name is empty"; - return nullptr; - } - - std::string str_config_name(config_name); - if (config_map_.contains(str_config_name)) { - LogError << "Config name already exists" << VAR(config_name) << VAR(config_map_); - return nullptr; - } - - Config new_config; - if (auto cast = dynamic_cast(copy_from); cast) { - new_config = *cast; - } - new_config.set_name(config_name); - - auto new_config_ptr = std::make_shared(std::move(new_config)); - auto& ref = config_vec_.emplace_back(new_config_ptr); - config_map_.emplace(std::move(str_config_name), new_config_ptr); - - LogDebug << VAR(config_name) << VAR(new_config_ptr) << VAR(*new_config_ptr) << VAR(config_vec_) << VAR(config_map_); - - return ref.get(); -} - -bool ConfigMgr::del_config(std::string_view config_name) -{ - LogInfo << VAR(config_name); - - if (config_name.empty()) { - LogError << "Name is empty"; - return false; - } - - std::string str_config_name(config_name); - bool removed = config_map_.erase(str_config_name) > 0; - if (!removed) { - LogError << "Config name not found in map" << VAR(config_name) << VAR(config_map_); - return false; - } - auto find_it = - MAA_RNS::ranges::find_if(config_vec_, [&](const auto& config) { return config->get_name() == config_name; }); - if (find_it == config_vec_.end()) { - LogError << "Config name not found in vec" << VAR(config_name) << VAR(config_vec_); - return false; - } - config_vec_.erase(find_it); - - LogDebug << VAR(config_name) << VAR(config_vec_) << VAR(config_map_); - return true; -} - -bool ConfigMgr::set_current_config(std::string_view config_name) -{ - LogInfo << VAR(config_name); - - if (config_name.empty()) { - LogError << "Name is empty"; - return false; - } - - std::string str_config_name(config_name); - auto find_it = config_map_.find(str_config_name); - if (find_it == config_map_.end()) { - LogError << "Config not found" << VAR(config_vec_) << VAR(config_map_); - return false; - } - - current_ = config_name; - return true; -} - bool ConfigMgr::load() { LogFunc << VAR(kConfigPath); @@ -177,18 +58,6 @@ bool ConfigMgr::load() return false; } - auto& config = json[kConfigKey]; - if (!parse_config(config)) { - LogError << "Failed to parse config:" << VAR(config); - return false; - } - - auto& current = json[kCurrentKey]; - if (!parse_current(current)) { - LogError << "Failed to parse current:" << VAR(current); - return false; - } - return true; } @@ -206,54 +75,6 @@ bool ConfigMgr::parse_and_apply_policy(const json::value& policy_json) return true; } -bool ConfigMgr::parse_config(const json::value& config_json) -{ - LogFunc << VAR(config_json); - - config_vec_.clear(); - config_map_.clear(); - - if (!config_json.is_array()) { - LogError << "Json is not an array:" << VAR(config_json); - return false; - } - - for (const auto& jconfig : config_json.as_array()) { - Config config; - if (!config.from_json(jconfig)) { - LogError << "Failed to parse config:" << jconfig; - return false; - } - std::string name(config.get_name()); - insert(std::move(name), std::move(config)); - } - - LogInfo << VAR(config_vec_) << VAR(config_map_); - return true; -} - -bool ConfigMgr::parse_current(const json::value& current_json) -{ - LogFunc << VAR(current_json); - - if (!current_json.is_string()) { - LogError << "Json is not a string:" << VAR(current_json); - return false; - } - - current_ = current_json.as_string(); - return true; -} - -void ConfigMgr::generate_default_config() -{ - LogInfo; - - Config config; - config.set_name(kConfigDefaultName); - insert(kConfigDefaultName, std::move(config)); -} - json::value ConfigMgr::to_json() const { json::value root; @@ -261,12 +82,6 @@ json::value ConfigMgr::to_json() const { kPolicyLoggging, policy_logging_ }, { kPolicyDebugMode, policy_debug_mode_ }, }; - json::array& jconfig = root[kConfigKey].as_array(); - for (const auto& config : config_map_ | MAA_RNS::views::values) { - jconfig.emplace_back(config->to_json()); - } - root[kCurrentKey] = current_; - root[kCustomInfoKey] = json::object(custom_info_); return root; } @@ -292,24 +107,4 @@ bool ConfigMgr::save(const json::value& root) const return true; } -void ConfigMgr::insert(std::string name, Config config) -{ - LogInfo << VAR(name) << VAR(config); - - auto config_ptr = std::make_shared(std::move(config)); - - auto map_it = config_map_.find(name); - if (map_it != config_map_.end()) { - auto vec_it = - MaaRangesNS::ranges::find_if(config_vec_, [&](const auto& ptr) { return ptr->get_name() == name; }); - *vec_it = config_ptr; - - map_it->second = std::move(config_ptr); - } - else { - config_vec_.emplace_back(config_ptr); - config_map_.emplace(std::move(name), std::move(config_ptr)); - } -} - MAA_TOOLKIT_CONFIG_NS_END diff --git a/source/MaaToolKit/Config/ConfigMgr.h b/source/MaaToolKit/Config/ConfigMgr.h index 1300ede23..d8e408891 100644 --- a/source/MaaToolKit/Config/ConfigMgr.h +++ b/source/MaaToolKit/Config/ConfigMgr.h @@ -6,8 +6,9 @@ #include #include +#include + #include "Conf/Conf.h" -#include "Config.h" #include "ConfigAPI.h" #include "Utils/SingletonHolder.hpp" @@ -25,15 +26,9 @@ class ConfigMgr : public SingletonHolder, public MaaToolKitConfigMgrA public: inline static const std::string kPolicyKey = "policy"; - inline static const std::string kConfigKey = "config"; - inline static const std::string kCurrentKey = "current"; - inline static const std::string kCustomInfoKey = "custom"; - inline static const std::string kPolicyLoggging = "logging"; inline static const std::string kPolicyDebugMode = "debug_mode"; - inline static const std::string kConfigDefaultName = "Default"; - public: virtual ~ConfigMgr() noexcept override = default; @@ -41,38 +36,17 @@ class ConfigMgr : public SingletonHolder, public MaaToolKitConfigMgrA virtual bool init() override; virtual bool uninit() override; - virtual std::string_view get_custom_info(std::string_view key) const override; - virtual void set_custom_info(std::string key, std::string value) override; - - virtual size_t config_size() const override; - virtual MaaToolKitConfigHandle config_by_index(size_t index) override; - virtual MaaToolKitConfigHandle current() override; - - virtual MaaToolKitConfigHandle add_config(std::string_view config_name, MaaToolKitConfigHandle copy_from) override; - virtual bool del_config(std::string_view config_name) override; - virtual bool set_current_config(std::string_view config_name) override; - private: ConfigMgr() = default; bool load(); bool parse_and_apply_policy(const json::value& policy_json); - bool parse_config(const json::value& config_json); - bool parse_current(const json::value& current_json); - - void generate_default_config(); json::value to_json() const; bool dump() const; bool save(const json::value& root) const; - void insert(std::string name, Config config); private: - std::vector> config_vec_; // for C API - std::map> config_map_; - std::string current_ = kConfigDefaultName; - std::map custom_info_; - bool policy_logging_ = true; bool policy_debug_mode_ = false; }; diff --git a/source/MaaToolKit/Config/Task.cpp b/source/MaaToolKit/Config/Task.cpp deleted file mode 100644 index 2b52ed07f..000000000 --- a/source/MaaToolKit/Config/Task.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include "Task.h" - -#include "Utils/Logger.h" - -MAA_TOOLKIT_CONFIG_NS_BEGIN - -void Task::set_name(std::string_view new_name) -{ - LogInfo << VAR(name_) << VAR(new_name); - name_ = new_name; -} - -void Task::set_description(std::string_view new_description) -{ - LogInfo << VAR(name_) << VAR(description_) << VAR(new_description); - description_ = new_description; -} - -void Task::set_entry(std::string_view new_entry) -{ - LogInfo << VAR(name_) << VAR(entry_) << VAR(new_entry); - entry_ = new_entry; -} - -void Task::set_param(std::string_view new_param) -{ - LogInfo << VAR(name_) << VAR(param_) << VAR(new_param); - param_ = new_param; -} - -void Task::set_enabled(bool new_enabled) -{ - LogInfo << VAR(name_) << VAR(enabled_) << VAR(new_enabled); - enabled_ = new_enabled; -} - -std::string_view Task::get_custom_info(std::string_view key) const -{ - auto find_it = custom_info_.find(std::string(key)); - if (find_it == custom_info_.end()) { - LogError << "Key not found" << VAR(key) << VAR(custom_info_); - return std::string_view(); - } - return find_it->second; -} - -void Task::set_custom_info(std::string key, std::string value) -{ - LogInfo << VAR(name_) << VAR(key) << VAR(value); - custom_info_.insert_or_assign(std::move(key), std::move(value)); -} - -MaaStatus Task::status() const -{ - return MaaStatus(); -} - -json::value Task::to_json() const -{ - json::value root; - root[kNameKey] = name_; - root[kDescriptionKey] = description_; - root[kEntryKey] = entry_; - root[kParamKey] = param_; - root[kEnabledKey] = enabled_; - root[kCustomInfoKey] = json::object(custom_info_); - - return root; -} - -bool Task::from_json(const json::value& json) -{ - LogFunc << VAR(json); - - auto name_opt = json.find(kNameKey); - if (!name_opt) { - return false; - } - name_ = std::move(name_opt).value(); - - description_ = json.get(kDescriptionKey, std::string()); - entry_ = json.get(kEntryKey, std::string()); - param_ = json.get(kParamKey, std::string()); - enabled_ = json.get(kEnabledKey, true); - - return true; -} - -std::ostream& operator<<(std::ostream& os, const Task& task) -{ - os << VAR_RAW(task.name_) << VAR_RAW(task.description_) << VAR_RAW(task.entry_) << VAR_RAW(task.param_) - << VAR_RAW(task.enabled_); - return os; -} - -MAA_TOOLKIT_CONFIG_NS_END diff --git a/source/MaaToolKit/Config/Task.h b/source/MaaToolKit/Config/Task.h deleted file mode 100644 index b1bbb440c..000000000 --- a/source/MaaToolKit/Config/Task.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "Conf/Conf.h" -#include "ConfigAPI.h" - -MAA_TOOLKIT_CONFIG_NS_BEGIN - -class Task : public MaaToolKitTaskAPI -{ -public: - inline static const std::string kNameKey = "name"; - inline static const std::string kDescriptionKey = "description"; - inline static const std::string kEntryKey = "entry"; - inline static const std::string kParamKey = "param"; - inline static const std::string kEnabledKey = "enabled"; - inline static const std::string kCustomInfoKey = "custom"; - -public: - virtual ~Task() override = default; - -public: // from MaaToolKitTaskAPI - virtual std::string_view get_name() const override { return name_; } - virtual void set_name(std::string_view new_name) override; - virtual std::string_view get_description() const override { return description_; } - virtual void set_description(std::string_view new_description) override; - virtual std::string_view get_entry() const override { return entry_; } - virtual void set_entry(std::string_view new_entry) override; - virtual std::string_view get_param() const override { return param_; } - virtual void set_param(std::string_view new_param) override; - virtual bool get_enabled() const override { return enabled_; } - virtual void set_enabled(bool new_enabled) override; - virtual std::string_view get_custom_info(std::string_view key) const override; - virtual void set_custom_info(std::string key, std::string value) override; - - virtual MaaStatus status() const override; - -public: - json::value to_json() const; - bool from_json(const json::value& json); - - friend std::ostream& operator<<(std::ostream& os, const Task& task); - -private: - std::string name_; - std::string description_; - std::string entry_; - std::string param_; - bool enabled_ = true; - std::map custom_info_; -}; - -MAA_TOOLKIT_CONFIG_NS_END diff --git a/source/MaaToolKit/MaaToolKit.vcxproj b/source/MaaToolKit/MaaToolKit.vcxproj index 118a4c247..9ebadd3a0 100644 --- a/source/MaaToolKit/MaaToolKit.vcxproj +++ b/source/MaaToolKit/MaaToolKit.vcxproj @@ -17,38 +17,23 @@ - - - - - - - - - - - - - - - 16.0