From 9be57d2f294687a9283e6d3ed8599def4faf1fec Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 04 三月 2024 13:49:14 +0800 Subject: [PATCH] '功能修改' --- FloatTrade/ConfigUtil.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 49 insertions(+), 0 deletions(-) diff --git a/FloatTrade/ConfigUtil.cpp b/FloatTrade/ConfigUtil.cpp index 5610477..ee39400 100644 --- a/FloatTrade/ConfigUtil.cpp +++ b/FloatTrade/ConfigUtil.cpp @@ -92,6 +92,26 @@ writeConfig(mConfig); } +list<string> ConfigUtil::getKeys() +{ + libconfig::Config mConfig; + readConfig(mConfig); + libconfig::Setting& root = mConfig.getRoot(); + list<string> keys; + for (auto iter = root.begin(); iter != root.end(); ++iter) { + keys.push_back(iter->getName()); + } + return keys; +} + +void ConfigUtil::delKey(string key) +{ + libconfig::Config mConfig; + readConfig(mConfig); + libconfig::Setting& root = mConfig.getRoot(); + root.remove(key); +} + bool ConfigUtil::isTradeRefresh() { try { @@ -137,6 +157,28 @@ return false; } +int* ConfigUtil::getSellRuleDialogShowPos() +{ + + int* pos = (int*)malloc(sizeof(int) * 2); + pos[0] = 0; + pos[1] = 0; + try { + string str = readStringConfig("sell_rule_show_pos"); + // 分隔字符串 + int split_index = str.find(","); + int x= stoi( str.substr(0, split_index)); + int y = stoi(str.substr(split_index + 1, str.length() - (split_index+1))); + pos[0] = x; + pos[1] = y; + } + catch (...) { + + } + + return pos; +} + void ConfigUtil::setTradeRefresh(bool enable) { setIntConfig("trade_refresh", enable ? 1 : 0); @@ -154,6 +196,13 @@ setIntConfig("trade_quick_key", enable ? 1 : 0); } +void ConfigUtil::setSellRuleDialogShowPos(int x, int y) +{ + string pos = ""; + pos.append(to_string(x)).append(",").append(to_string(y)); + setStringConfig("sell_rule_show_pos", pos); +} + POINT ConfigUtil::getWindowPos() { -- Gitblit v1.8.0