Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d81d53bc15 | ||
|
|
d2763683e1 | ||
|
|
2167896df8 | ||
|
|
7d0943e63c | ||
|
|
b2d24adf3e | ||
|
|
12a934c9b6 | ||
|
|
d2841cb617 | ||
|
|
607c13a9c4 | ||
|
|
775ed9318e |
BIN
3rdparty/bin/aria2c.exe
vendored
Normal file
11
README.md
@@ -85,6 +85,13 @@ A game assistance for Arknights
|
||||
|
||||
完美支持。需要在模拟器`设定`-`进阶`中打开`Android调试桥`
|
||||
|
||||
#### 蓝叠模拟器Hyper-V版本
|
||||
|
||||
支持。
|
||||
|
||||
1. 需要在模拟器`设定`-`进阶`中打开`Android调试桥`
|
||||
2. 需要在软件`设置`-`连接设置`中添加蓝叠安装目录下`bluestacks.conf`文件的完整路径
|
||||
|
||||
#### 夜神模拟器
|
||||
|
||||
完美支持
|
||||
@@ -152,7 +159,7 @@ A game assistance for Arknights
|
||||
|
||||
### 公开招募识别
|
||||
|
||||
**请注意:公招识别和自动公招是两个功能!**
|
||||
**请注意:公招识别和自动公招是两个独立的功能!**
|
||||
|
||||
1. 明日方舟打开公开招募,有Tag选择的界面
|
||||
2. 软件勾选你需要的选项,点击"开始识别"
|
||||
@@ -194,7 +201,7 @@ A game assistance for Arknights
|
||||
- [x] 企鹅物流汇报,自定义ID
|
||||
- [ ] 指定刷某种材料xx个
|
||||
- [ ] `config`中部分选项做成图形化界面
|
||||
- [ ] 界面拖动顺序保存
|
||||
- [x] 界面拖动顺序保存
|
||||
- [ ] 进一步的异形屏支持
|
||||
- [x] 后台自动更新
|
||||
- [x] 忽略当前版本更新
|
||||
|
||||
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 58 KiB |
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
bool MEOAPI AsstCatchDefault(void* p_asst);
|
||||
bool MEOAPI AsstCatchEmulator(void* p_asst);
|
||||
bool MEOAPI AsstCatchCustom(void* p_asst);
|
||||
bool MEOAPI AsstCatchCustom(void* p_asst, const char* address);
|
||||
bool MEOAPI AsstCatchFake(void* p_asst);
|
||||
|
||||
bool MEOAPI AsstAppendFight(void* p_asst, int max_mecidine, int max_stone, int max_times);
|
||||
@@ -21,7 +21,7 @@ extern "C" {
|
||||
bool MEOAPI AsstAppendVisit(void* p_asst);
|
||||
bool MEOAPI AsstAppendMall(void* p_asst, bool with_shopping);
|
||||
//bool MEOAPI AsstAppendProcessTask(void* p_asst, const char* task);
|
||||
bool MEOAPI AsstAppendInfrast(void* p_asst, int work_mode, const char** order, int order_size, int uses_of_drones, double dorm_threshold);
|
||||
bool MEOAPI AsstAppendInfrast(void* p_asst, int work_mode, const char** order, int order_size, const char* uses_of_drones, double dorm_threshold);
|
||||
bool MEOAPI AsstAppendRecruit(void* p_asst, int max_times, const int required_level[], int required_len, const int confirm_level[], int confirm_len, bool need_refresh);
|
||||
bool MEOAPI AsstAppendDebug(void* p_asst);
|
||||
|
||||
|
||||
@@ -570,6 +570,7 @@
|
||||
"ReturnToAward",
|
||||
"Award",
|
||||
"ReceiveAward",
|
||||
"DailyTask",
|
||||
"WeeklyTask"
|
||||
]
|
||||
},
|
||||
@@ -584,6 +585,7 @@
|
||||
],
|
||||
"next": [
|
||||
"ReceiveAward",
|
||||
"DailyTask",
|
||||
"WeeklyTask",
|
||||
"Award"
|
||||
]
|
||||
@@ -629,12 +631,25 @@
|
||||
"Stop"
|
||||
]
|
||||
},
|
||||
"DailyTask": {
|
||||
"action": "clickSelf",
|
||||
"roi": [
|
||||
400,
|
||||
0,
|
||||
880,
|
||||
100
|
||||
],
|
||||
"next": [
|
||||
"ReceiveAward",
|
||||
"WeeklyTask"
|
||||
]
|
||||
},
|
||||
"WeeklyTask": {
|
||||
"action": "clickSelf",
|
||||
"roi": [
|
||||
700,
|
||||
400,
|
||||
0,
|
||||
250,
|
||||
880,
|
||||
100
|
||||
],
|
||||
"next": [
|
||||
@@ -1308,7 +1323,7 @@
|
||||
"Stop"
|
||||
]
|
||||
},
|
||||
"DroneAssist-MFG": {
|
||||
"DroneAssistMfg": {
|
||||
"action": "clickSelf",
|
||||
"cache": false,
|
||||
"roi": [
|
||||
@@ -1324,7 +1339,7 @@
|
||||
"DroneConfirm"
|
||||
]
|
||||
},
|
||||
"DroneAssist-Trade": {
|
||||
"DroneAssistTrade": {
|
||||
"action": "clickSelf",
|
||||
"cache": false,
|
||||
"roi": [
|
||||
@@ -1362,7 +1377,7 @@
|
||||
"next": [
|
||||
"DeliverableOrder",
|
||||
"DroneAssist-Trade-Stop",
|
||||
"DroneAssist-MFG"
|
||||
"DroneAssistMfg"
|
||||
]
|
||||
},
|
||||
"DeliverableOrder": {
|
||||
@@ -1376,13 +1391,13 @@
|
||||
],
|
||||
"next": [
|
||||
"DeliverableOrder",
|
||||
"DroneAssist-Trade"
|
||||
"DroneAssistTrade"
|
||||
],
|
||||
"rearDelay": 2000
|
||||
},
|
||||
"DroneAssist-Trade-Stop": {
|
||||
"Doc": "如果找到了“无人机加速”按钮,却没有找到订单交付:说明上一次无人机没有把一个订单加速完成,也说明没有更多的无人机了,所以直接stop",
|
||||
"template": "DroneAssist-Trade.png",
|
||||
"template": "DroneAssistTrade.png",
|
||||
"action": "stop",
|
||||
"cache": false
|
||||
},
|
||||
|
||||
BIN
resource/template/DailyTask.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 19 KiB |
@@ -112,7 +112,7 @@ bool Assistance::catch_emulator(const std::string& emulator_name)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool asst::Assistance::catch_custom()
|
||||
bool asst::Assistance::catch_custom(const std::string& address)
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
@@ -124,6 +124,9 @@ bool asst::Assistance::catch_custom()
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
|
||||
EmulatorInfo remote_info = cfg.get_emulators_info().at("Custom");
|
||||
if (!address.empty()) {
|
||||
remote_info.adb.addresses.push_back(address);
|
||||
}
|
||||
|
||||
ret = ctrler.try_capture(remote_info, true);
|
||||
|
||||
@@ -293,7 +296,7 @@ bool Assistance::start_recruit_calc(const std::vector<int>& required_level, bool
|
||||
return start(false);
|
||||
}
|
||||
|
||||
bool asst::Assistance::append_infrast(infrast::WorkMode work_mode, const std::vector<std::string>& order, UsesOfDrones uses_of_drones, double dorm_threshold, bool only_append)
|
||||
bool asst::Assistance::append_infrast(infrast::WorkMode work_mode, const std::vector<std::string>& order, const std::string& uses_of_drones, double dorm_threshold, bool only_append)
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_inited) {
|
||||
@@ -325,10 +328,12 @@ bool asst::Assistance::append_infrast(infrast::WorkMode work_mode, const std::ve
|
||||
mfg_task_ptr->set_work_mode(work_mode);
|
||||
mfg_task_ptr->set_task_chain(InfrastTaskCahin);
|
||||
mfg_task_ptr->set_mood_threshold(dorm_threshold);
|
||||
mfg_task_ptr->set_uses_of_drone(uses_of_drones);
|
||||
auto trade_task_ptr = std::make_shared<InfrastTradeTask>(task_callback, (void*)this);
|
||||
trade_task_ptr->set_work_mode(work_mode);
|
||||
trade_task_ptr->set_task_chain(InfrastTaskCahin);
|
||||
trade_task_ptr->set_mood_threshold(dorm_threshold);
|
||||
trade_task_ptr->set_uses_of_drone(uses_of_drones);
|
||||
auto power_task_ptr = std::make_shared<InfrastPowerTask>(task_callback, (void*)this);
|
||||
power_task_ptr->set_work_mode(work_mode);
|
||||
power_task_ptr->set_task_chain(InfrastTaskCahin);
|
||||
@@ -357,15 +362,9 @@ bool asst::Assistance::append_infrast(infrast::WorkMode work_mode, const std::ve
|
||||
}
|
||||
else if (facility == "Mfg") {
|
||||
m_tasks_queue.emplace(mfg_task_ptr);
|
||||
if (UsesOfDrones::DronesMfg & uses_of_drones) {
|
||||
append_process_task("DroneAssist-MFG", InfrastTaskCahin);
|
||||
}
|
||||
}
|
||||
else if (facility == "Trade") {
|
||||
m_tasks_queue.emplace(trade_task_ptr);
|
||||
if (UsesOfDrones::DronesTrade & uses_of_drones) {
|
||||
append_process_task("DroneAssist-Trade", InfrastTaskCahin);
|
||||
}
|
||||
}
|
||||
else if (facility == "Power") {
|
||||
m_tasks_queue.emplace(power_task_ptr);
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace asst
|
||||
// 捕获模拟器
|
||||
bool catch_emulator(const std::string& emulator_name = std::string());
|
||||
// 捕获自定义设备
|
||||
bool catch_custom();
|
||||
bool catch_custom(const std::string& address = std::string());
|
||||
// 不实际进行捕获,调试用接口
|
||||
bool catch_fake();
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace asst
|
||||
bool append_mall(bool with_shopping, bool only_append = true);
|
||||
|
||||
// 添加基建换班任务任务
|
||||
bool append_infrast(infrast::WorkMode work_mode, const std::vector<std::string>& order, UsesOfDrones uses, double dorm_threshold, bool only_append = true);
|
||||
bool append_infrast(infrast::WorkMode work_mode, const std::vector<std::string>& order, const std::string& uses_of_drones, double dorm_threshold, bool only_append = true);
|
||||
|
||||
// 添加自动公招任务
|
||||
// 参数max_times: 最多进行几次公招
|
||||
|
||||
@@ -90,13 +90,13 @@ bool AsstCatchEmulator(void* p_asst)
|
||||
return ((asst::Assistance*)p_asst)->catch_emulator();
|
||||
}
|
||||
|
||||
bool AsstCatchCustom(void* p_asst)
|
||||
bool AsstCatchCustom(void* p_asst, const char* address)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->catch_custom();
|
||||
return ((asst::Assistance*)p_asst)->catch_custom(address);
|
||||
}
|
||||
|
||||
bool AsstCatchFake(void* p_asst)
|
||||
@@ -168,7 +168,7 @@ bool AsstStartRecruitCalc(void* p_asst, const int required_level[], int required
|
||||
return ((asst::Assistance*)p_asst)->start_recruit_calc(level_vector, set_time);
|
||||
}
|
||||
|
||||
bool AsstAppendInfrast(void* p_asst, int work_mode, const char** order, int order_size, int uses_of_drones, double dorm_threshold)
|
||||
bool AsstAppendInfrast(void* p_asst, int work_mode, const char** order, int order_size, const char* uses_of_drones, double dorm_threshold)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
@@ -180,7 +180,7 @@ bool AsstAppendInfrast(void* p_asst, int work_mode, const char** order, int orde
|
||||
append_infrast(
|
||||
static_cast<asst::infrast::WorkMode>(work_mode),
|
||||
order_vector,
|
||||
static_cast<asst::UsesOfDrones>(uses_of_drones),
|
||||
uses_of_drones,
|
||||
dorm_threshold);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,16 +91,6 @@ namespace asst
|
||||
return os << _type_name.at(type);
|
||||
}
|
||||
|
||||
enum UsesOfDrones
|
||||
{
|
||||
DronesNotUse = 0,
|
||||
DronesTrade = 0x100,
|
||||
DronesTradeMoney = DronesTrade & 0x10,
|
||||
DronesMfg = 0x200,
|
||||
DronesMfgCombatRecord = DronesMfg | 0x10,
|
||||
DronesMfgPureGold = DronesMfg | 0x20
|
||||
};
|
||||
|
||||
// AsstCallback 消息回调函数
|
||||
// 参数:
|
||||
// AsstMsg 消息类型
|
||||
|
||||
@@ -436,8 +436,28 @@ asst::Point asst::Controller::rand_point_in_rect(const Rect& rect)
|
||||
return Point(x, y);
|
||||
}
|
||||
|
||||
void asst::Controller::random_delay() const
|
||||
{
|
||||
auto& opt = resource.cfg().get_options();
|
||||
if (opt.control_delay_upper != 0) {
|
||||
LogTraceFunction;
|
||||
static std::default_random_engine rand_engine(
|
||||
std::chrono::system_clock::now().time_since_epoch().count());
|
||||
static std::uniform_int_distribution<unsigned> rand_uni(
|
||||
opt.control_delay_lower,
|
||||
opt.control_delay_upper);
|
||||
|
||||
unsigned rand_delay = rand_uni(rand_engine);
|
||||
|
||||
log.trace("random_delay |", rand_delay, "ms");
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(rand_delay));
|
||||
}
|
||||
}
|
||||
|
||||
int asst::Controller::push_cmd(const std::string& cmd)
|
||||
{
|
||||
random_delay();
|
||||
|
||||
std::unique_lock<std::mutex> lock(m_cmd_queue_mutex);
|
||||
m_cmd_queue.emplace(cmd);
|
||||
m_cmd_condvar.notify_one();
|
||||
|
||||
@@ -67,6 +67,8 @@ namespace asst
|
||||
bool screencap();
|
||||
Point rand_point_in_rect(const Rect& rect);
|
||||
|
||||
void random_delay() const;
|
||||
|
||||
// 转换data中所有的crlf为lf:有些模拟器自带的adb,exec-out输出的\n,会被替换成\r\n,导致解码错误,所以这里转一下回来(点名批评mumu)
|
||||
static void convert_lf(std::vector<unsigned char>& data);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "MultiMatchImageAnalyzer.h"
|
||||
#include "Resource.h"
|
||||
#include "RuntimeStatus.h"
|
||||
#include "ProcessTask.h"
|
||||
|
||||
bool asst::InfrastProductionTask::shift_facility_list()
|
||||
{
|
||||
@@ -90,6 +91,13 @@ bool asst::InfrastProductionTask::shift_facility_list()
|
||||
set_product(cur_product);
|
||||
log.info("cur product", cur_product);
|
||||
|
||||
// 使用无人机
|
||||
if (cur_product == m_uses_of_drones) {
|
||||
if (use_drone()) {
|
||||
m_uses_of_drones = "_Used";
|
||||
}
|
||||
}
|
||||
|
||||
locked_analyzer.set_image(image);
|
||||
if (locked_analyzer.analyze()) {
|
||||
m_cur_num_of_lokced_opers = locked_analyzer.get_result().size();
|
||||
@@ -109,12 +117,14 @@ bool asst::InfrastProductionTask::shift_facility_list()
|
||||
}
|
||||
click_clear_button();
|
||||
swipe_to_the_left_of_operlist();
|
||||
swipe_to_the_left_of_operlist();
|
||||
|
||||
if (m_all_available_opers.empty()) {
|
||||
if (!opers_detect_with_swipe()) {
|
||||
return false;
|
||||
}
|
||||
swipe_to_the_left_of_operlist();
|
||||
swipe_to_the_left_of_operlist();
|
||||
}
|
||||
else {
|
||||
opers_detect();
|
||||
@@ -542,6 +552,13 @@ bool asst::InfrastProductionTask::opers_choose()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asst::InfrastProductionTask::use_drone()
|
||||
{
|
||||
std::string task_name = "DroneAssist" + m_facility;
|
||||
ProcessTask task(*this, { task_name });
|
||||
return task.run();
|
||||
}
|
||||
|
||||
asst::infrast::SkillsComb
|
||||
asst::InfrastProductionTask::efficient_regex_calc(
|
||||
std::unordered_set<infrast::Skill> skills) const
|
||||
|
||||
@@ -12,6 +12,17 @@ namespace asst
|
||||
public:
|
||||
using InfrastAbstractTask::InfrastAbstractTask;
|
||||
virtual ~InfrastProductionTask() = default;
|
||||
|
||||
void set_uses_of_drone(std::string uses_of_drones) noexcept
|
||||
{
|
||||
m_uses_of_drones = std::move(uses_of_drones);
|
||||
}
|
||||
#ifdef LOG_TRACE
|
||||
public:
|
||||
#else
|
||||
// 为了方便调试,把这两个个接口拿到public来了
|
||||
protected:
|
||||
#endif
|
||||
void set_facility(std::string facility_name) noexcept
|
||||
{
|
||||
m_facility = std::move(facility_name);
|
||||
@@ -28,11 +39,14 @@ namespace asst
|
||||
size_t opers_detect(); // 返回当前页面的干员数
|
||||
bool optimal_calc();
|
||||
bool opers_choose();
|
||||
bool use_drone();
|
||||
|
||||
infrast::SkillsComb efficient_regex_calc(
|
||||
std::unordered_set<infrast::Skill> skills) const;
|
||||
|
||||
std::string m_facility;
|
||||
std::string m_product;
|
||||
std::string m_uses_of_drones;
|
||||
int m_cur_num_of_lokced_opers = 0;
|
||||
std::vector<infrast::Oper> m_all_available_opers;
|
||||
std::vector<infrast::SkillsComb> m_optimal_combs;
|
||||
|
||||
@@ -179,38 +179,13 @@ bool ProcessTask::_run()
|
||||
return true;
|
||||
}
|
||||
|
||||
// 随机延时功能
|
||||
bool asst::ProcessTask::delay_random()
|
||||
{
|
||||
auto& opt = resource.cfg().get_options();
|
||||
if (opt.control_delay_upper != 0) {
|
||||
static std::default_random_engine rand_engine(
|
||||
std::chrono::system_clock::now().time_since_epoch().count());
|
||||
static std::uniform_int_distribution<unsigned> rand_uni(
|
||||
opt.control_delay_lower,
|
||||
opt.control_delay_upper);
|
||||
|
||||
unsigned rand_delay = rand_uni(rand_engine);
|
||||
|
||||
return sleep(rand_delay);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ProcessTask::exec_click_task(const Rect& matched_rect)
|
||||
{
|
||||
if (!delay_random()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ctrler.click(matched_rect);
|
||||
}
|
||||
|
||||
void asst::ProcessTask::exec_swipe_task(ProcessTaskAction action)
|
||||
{
|
||||
if (!delay_random()) {
|
||||
return;
|
||||
}
|
||||
const auto&& [width, height] = ctrler.get_scale_size();
|
||||
|
||||
const static Rect right_rect(width * 0.8,
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace asst
|
||||
|
||||
protected:
|
||||
virtual bool _run() override;
|
||||
bool delay_random();
|
||||
void exec_click_task(const Rect& matched_rect);
|
||||
void exec_swipe_task(ProcessTaskAction action);
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
namespace asst
|
||||
{
|
||||
constexpr static const char* Version = "v2.1.2";
|
||||
constexpr static const char* Version = "v2.2";
|
||||
}
|
||||
|
||||
@@ -22,7 +22,9 @@ namespace MeoAsstGui
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern void AsstDestory(IntPtr ptr);
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstCatchDefault(IntPtr ptr);
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstCatchDefault(IntPtr ptr);
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstCatchCustom(IntPtr ptr, string address);
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstAppendFight(IntPtr ptr, int max_medicine, int max_stone, int max_times);
|
||||
|
||||
@@ -32,7 +34,7 @@ namespace MeoAsstGui
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstAppendMall(IntPtr ptr, bool with_shopping);
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstAppendInfrast(IntPtr ptr, int work_mode, string[] order, int order_len, int uses_of_drones, double dorm_threshold);
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstAppendInfrast(IntPtr ptr, int work_mode, string[] order, int order_len, string uses_of_drones, double dorm_threshold);
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstAppendRecruit(IntPtr ptr, int max_times, int[] required_level, int required_len, int[] confirm_level, int confirm_len, bool need_refresh);
|
||||
|
||||
@@ -246,7 +248,7 @@ namespace MeoAsstGui
|
||||
|
||||
case AsstMsg.RecruitSpecialTag:
|
||||
string special = detail["tag"].ToString();
|
||||
new ToastContentBuilder().AddText("公招特殊Tag:" + special).Show();
|
||||
new ToastContentBuilder().AddText("公招提示:" + special).Show();
|
||||
break;
|
||||
|
||||
case AsstMsg.RecruitResult:
|
||||
@@ -294,46 +296,49 @@ namespace MeoAsstGui
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isCatched = false;
|
||||
|
||||
public bool AsstCatchDefault()
|
||||
|
||||
public bool AsstCatch()
|
||||
{
|
||||
if (!_isCatched)
|
||||
{
|
||||
_isCatched = AsstCatchDefault(_ptr);
|
||||
}
|
||||
return _isCatched;
|
||||
}
|
||||
|
||||
public bool AsstAppendFight(int max_medicine, int max_stone, int max_times)
|
||||
{
|
||||
return AsstAppendFight(_ptr, max_medicine, max_stone, max_times);
|
||||
var settings = _container.Get<SettingsViewModel>();
|
||||
settings.TryToSetBlueStacksHyperVAddress();
|
||||
if (settings.ConnectAddress.Length == 0)
|
||||
{
|
||||
return AsstCatchDefault(_ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
return AsstCatchCustom(_ptr, settings.ConnectAddress);
|
||||
}
|
||||
}
|
||||
|
||||
public bool AsstAppendFight(int max_medicine, int max_stone, int max_times)
|
||||
{
|
||||
return AsstAppendFight(_ptr, max_medicine, max_stone, max_times);
|
||||
}
|
||||
|
||||
public bool AsstAppendAward()
|
||||
{
|
||||
return AsstAppendAward(_ptr);
|
||||
}
|
||||
|
||||
public bool AsstAppendVisit()
|
||||
{
|
||||
return AsstAppendVisit(_ptr);
|
||||
}
|
||||
|
||||
public bool AsstAppendMall(bool with_shopping)
|
||||
{
|
||||
return AsstAppendMall(_ptr, with_shopping);
|
||||
public bool AsstAppendVisit()
|
||||
{
|
||||
return AsstAppendVisit(_ptr);
|
||||
}
|
||||
|
||||
|
||||
public bool AsstAppendMall(bool with_shopping)
|
||||
{
|
||||
return AsstAppendMall(_ptr, with_shopping);
|
||||
}
|
||||
|
||||
public bool AsstAppendRecruit(int max_times, int[] required_level, int required_len, int[] confirm_level, int confirm_len, bool need_refresh)
|
||||
{
|
||||
return AsstAppendRecruit(_ptr, max_times, required_level, required_len, confirm_level, confirm_len, need_refresh);
|
||||
}
|
||||
|
||||
public bool AsstAppendInfrast(int work_mode, string[] order, int order_len, int uses_of_drones, double dorm_threshold)
|
||||
{
|
||||
return AsstAppendInfrast(_ptr, work_mode, order, order_len, uses_of_drones, dorm_threshold);
|
||||
public bool AsstAppendInfrast(int work_mode, string[] order, int order_len, string uses_of_drones, double dorm_threshold)
|
||||
{
|
||||
return AsstAppendInfrast(_ptr, work_mode, order, order_len, uses_of_drones, dorm_threshold);
|
||||
}
|
||||
|
||||
public bool AsstStart()
|
||||
@@ -341,14 +346,14 @@ namespace MeoAsstGui
|
||||
return AsstStart(_ptr);
|
||||
}
|
||||
|
||||
public bool AsstStartRecruitCalc(int[] required_level, int required_len, bool set_time)
|
||||
{
|
||||
return AsstStartRecruitCalc(_ptr, required_level, required_len, set_time);
|
||||
public bool AsstStartRecruitCalc(int[] required_level, int required_len, bool set_time)
|
||||
{
|
||||
return AsstStartRecruitCalc(_ptr, required_level, required_len, set_time);
|
||||
}
|
||||
|
||||
public bool AsstStop()
|
||||
{
|
||||
return AsstStop(_ptr);
|
||||
|
||||
public bool AsstStop()
|
||||
{
|
||||
return AsstStop(_ptr);
|
||||
}
|
||||
|
||||
public void AsstSetPenguinId(string id)
|
||||
@@ -360,41 +365,41 @@ namespace MeoAsstGui
|
||||
//{
|
||||
// AsstSetParam(_ptr, type, param, value);
|
||||
//}
|
||||
}
|
||||
|
||||
public enum AsstMsg
|
||||
{
|
||||
}
|
||||
|
||||
public enum AsstMsg
|
||||
{
|
||||
/* Error Msg */
|
||||
PtrIsNull, // 指针为空
|
||||
ImageIsEmpty, // 图像为空
|
||||
WindowMinimized, // [已弃用] 窗口被最小化了
|
||||
InitFaild, // 初始化失败
|
||||
TaskError, // 任务错误(任务一直出错,retry次数达到上限)
|
||||
OcrResultError, // Ocr识别结果错误
|
||||
PtrIsNull, // 指针为空
|
||||
ImageIsEmpty, // 图像为空
|
||||
WindowMinimized, // [已弃用] 窗口被最小化了
|
||||
InitFaild, // 初始化失败
|
||||
TaskError, // 任务错误(任务一直出错,retry次数达到上限)
|
||||
OcrResultError, // Ocr识别结果错误
|
||||
/* Info Msg: about Task */
|
||||
TaskStart = 1000, // 任务开始
|
||||
TaskMatched, // 任务匹配成功
|
||||
ReachedLimit, // 单个原子任务达到次数上限
|
||||
ReadyToSleep, // 准备开始睡眠
|
||||
EndOfSleep, // 睡眠结束
|
||||
AppendProcessTask, // 新增流程任务,Assistance内部消息,外部不需要处理
|
||||
AppendTask, // 新增任务,Assistance内部消息,外部不需要处理
|
||||
TaskCompleted, // 单个原子任务完成
|
||||
PrintWindow, // 截图消息
|
||||
ProcessTaskStopAction, // 流程任务执行到了Stop的动作
|
||||
TaskChainCompleted, // 任务链完成
|
||||
ProcessTaskNotMatched, // 流程任务识别错误
|
||||
TaskStart = 1000, // 任务开始
|
||||
TaskMatched, // 任务匹配成功
|
||||
ReachedLimit, // 单个原子任务达到次数上限
|
||||
ReadyToSleep, // 准备开始睡眠
|
||||
EndOfSleep, // 睡眠结束
|
||||
AppendProcessTask, // 新增流程任务,Assistance内部消息,外部不需要处理
|
||||
AppendTask, // 新增任务,Assistance内部消息,外部不需要处理
|
||||
TaskCompleted, // 单个原子任务完成
|
||||
PrintWindow, // 截图消息
|
||||
ProcessTaskStopAction, // 流程任务执行到了Stop的动作
|
||||
TaskChainCompleted, // 任务链完成
|
||||
ProcessTaskNotMatched, // 流程任务识别错误
|
||||
AllTasksCompleted, // 所有任务完成
|
||||
TaskChainStart, // 开始任务链
|
||||
/* Info Msg: about Identify */
|
||||
TextDetected = 2000, // 识别到文字
|
||||
ImageFindResult, // 查找图像的结果
|
||||
ImageMatched, // 图像匹配成功
|
||||
TextDetected = 2000, // 识别到文字
|
||||
ImageFindResult, // 查找图像的结果
|
||||
ImageMatched, // 图像匹配成功
|
||||
StageDrops, // 关卡掉落信息
|
||||
/* Open Recruit Msg */
|
||||
RecruitTagsDetected = 3000, // 公招识别到了Tags
|
||||
RecruitSpecialTag, // 公招识别到了特殊的Tag
|
||||
RecruitResult, // 公开招募结果
|
||||
RecruitTagsDetected = 3000, // 公招识别到了Tags
|
||||
RecruitSpecialTag, // 公招识别到了特殊的Tag
|
||||
RecruitResult, // 公开招募结果
|
||||
RecruitSelected, // 选择了Tags
|
||||
/* Infrast Msg */
|
||||
InfrastSkillsDetected = 4000, // 识别到了基建技能(当前页面)
|
||||
@@ -402,18 +407,8 @@ namespace MeoAsstGui
|
||||
InfrastComb, // 当前房间的最优干员组合
|
||||
EnterFacility, // 进入某个房间
|
||||
FacilityInfo, // 当前设施信息
|
||||
};
|
||||
|
||||
public enum UsesOfDrones
|
||||
{
|
||||
DronesNotUse = 0,
|
||||
DronesTrade = 0x100,
|
||||
DronesTradeMoney = DronesTrade & 0x10,
|
||||
DronesMfg = 0x200,
|
||||
DronesMfgCombatRecord = DronesMfg | 0x10,
|
||||
DronesMfgPureGold = DronesMfg | 0x20
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
public enum InfrastWorkMode
|
||||
{
|
||||
Invaild = -1,
|
||||
|
||||
25
src/MeoAsstGui/Helper/CombData.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
// MeoAssistanceGui - A part of the MeoAssistance-Arknight project
|
||||
// Copyright (C) 2021 MistEO and Contributors
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MeoAsstGui
|
||||
{
|
||||
public class CombData
|
||||
{
|
||||
public string Display { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -112,6 +112,7 @@
|
||||
<Compile Include="Bootstrapper.cs" />
|
||||
<Compile Include="Helper\AsstProxy.cs" />
|
||||
<Compile Include="Helper\AutoScroll.cs" />
|
||||
<Compile Include="Helper\CombData.cs" />
|
||||
<Compile Include="Helper\LogItemViewModel.cs" />
|
||||
<Compile Include="Helper\ScrollViewerBinding.cs" />
|
||||
<Compile Include="Helper\ViewStatusStorage.cs" />
|
||||
@@ -119,6 +120,9 @@
|
||||
<Compile Include="UserControl\AutoRecruitSettingsUserControl.xaml.cs">
|
||||
<DependentUpon>AutoRecruitSettingsUserControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\ConnectSettingsUserControl.xaml.cs">
|
||||
<DependentUpon>ConnectSettingsUserControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\MallSettingsUserControl.xaml.cs">
|
||||
<DependentUpon>MallSettingsUserControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -132,6 +136,9 @@
|
||||
<Compile Include="UserControl\PenguinReportSettingsUserControl.xaml.cs">
|
||||
<DependentUpon>PenguinReportSettingsUserControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControl\VersionUpdateSettingsUserControl.xaml.cs">
|
||||
<DependentUpon>VersionUpdateSettingsUserControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ViewModels\RecruitViewModel.cs" />
|
||||
<Compile Include="ViewModels\RootViewModel.cs" />
|
||||
<Compile Include="ViewModels\SettingsViewModel.cs" />
|
||||
@@ -153,6 +160,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\ConnectSettingsUserControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\MallSettingsUserControl.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -169,6 +180,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControl\VersionUpdateSettingsUserControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\SettingsView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -13,19 +13,19 @@
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" VerticalAlignment="Center" Margin="10">
|
||||
<CheckBox IsChecked="{Binding ChooseLevel3}" Content="自动确认3星Tags" Margin="5" />
|
||||
<CheckBox IsChecked="{Binding ChooseLevel4}" Content="自动确认4星Tags" Margin="5" />
|
||||
<CheckBox IsChecked="{Binding ChooseLevel5}" Content="自动确认5星Tags" Margin="5" />
|
||||
<CheckBox IsEnabled="False" IsChecked="False" Content="自动确认6星Tags" Margin="5" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="10">
|
||||
<CheckBox IsChecked="{Binding RefreshLevel3}" Content="自动刷新3星Tags" VerticalAlignment="Center" Margin="10" />
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0, 10">
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}"
|
||||
Text="最大招募次数" Margin="5" VerticalAlignment="Center" />
|
||||
Text="每次执行时
的招募次数" Margin="5" VerticalAlignment="Center" />
|
||||
<TextBox Text="{Binding RecruitMaxTimes}" Margin="5"
|
||||
Width="50" InputMethod.IsInputMethodEnabled="False" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="10">
|
||||
<CheckBox IsChecked="{Binding ChooseLevel3}" Content="自动确认3星" Margin="5" />
|
||||
<CheckBox IsChecked="{Binding ChooseLevel4}" Content="自动确认4星" Margin="5" />
|
||||
<CheckBox IsChecked="{Binding ChooseLevel5}" Content="自动确认5星" Margin="5" />
|
||||
<CheckBox IsEnabled="False" IsChecked="False" Content="自动确认6星" Margin="5" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
31
src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml
Normal file
@@ -0,0 +1,31 @@
|
||||
<UserControl x:Class="MeoAsstGui.ConnectSettingsUserControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
xmlns:dd="urn:gong-wpf-dragdrop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="550">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Block.TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Text="Tips: 以下设置均需要自行下载ADB
将platform-tools文件夹解压到本软件的同级目录" Margin="10" />
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Block.TextAlignment="Center"
|
||||
Text="自定义地址" Margin="10" />
|
||||
<TextBox Text="{Binding ConnectAddress}" Margin="10"
|
||||
Width="150" InputMethod.IsInputMethodEnabled="False" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Block.TextAlignment="Center"
|
||||
Text="bluestacks.conf
文件路径" Margin="10" />
|
||||
<TextBox Text="{Binding BluestacksConfPath}" Margin="10"
|
||||
Width="250" InputMethod.IsInputMethodEnabled="False" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,38 @@
|
||||
// MeoAssistanceGui - A part of the MeoAssistance-Arknight project
|
||||
// Copyright (C) 2021 MistEO and Contributors
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace MeoAsstGui
|
||||
{
|
||||
/// <summary>
|
||||
/// ConnectSettingsUserControl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ConnectSettingsUserControl : UserControl
|
||||
{
|
||||
public ConnectSettingsUserControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,9 +31,14 @@
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Vertical" Margin="0, 20">
|
||||
<RadioButton GroupName="无人机" Content="不使用无人机" IsChecked="{Binding NotUseDrone}" Margin="0, 5" />
|
||||
<RadioButton GroupName="无人机" Content="加速贸易站 " IsChecked="{Binding DroneForTrade}" Margin="0, 5" />
|
||||
<RadioButton GroupName="无人机" Content="加速制造站 " IsChecked="{Binding DroneForMfg}" Margin="0, 5" />
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Margin="0, 5"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Text="无人机用途" />
|
||||
<ComboBox Width="150" Margin="0, 5"
|
||||
ItemsSource="{Binding UsesOfDronesList}"
|
||||
DisplayMemberPath="Display"
|
||||
SelectedValuePath="Value"
|
||||
SelectedValue="{Binding UsesOfDrones}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Orientation="Vertical" Margin="0, 20">
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
d:DesignHeight="300" d:DesignWidth="550">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}"
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Block.TextAlignment="Center"
|
||||
Text="企鹅数据汇报ID (仅数字部分)" Margin="10" />
|
||||
<TextBox Text="{Binding PenguinId}" Margin="10"
|
||||
Width="150" InputMethod.IsInputMethodEnabled="False" />
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<UserControl x:Class="MeoAsstGui.VersionUpdateSettingsUserControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
xmlns:dd="urn:gong-wpf-dragdrop"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="550">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Style="{StaticResource TextBlockDefault}" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Text="{Binding VersionInfo, Mode=OneWay}" Margin="10" />
|
||||
<CheckBox Grid.Row="1" IsChecked="{Binding UpdateBeta}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10"
|
||||
Content="检查测试版本更新" />
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}"
|
||||
Text="Proxy" Margin="10" />
|
||||
<TextBox Text="{Binding Proxy}" Margin="10"
|
||||
Width="150" InputMethod.IsInputMethodEnabled="False" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,26 @@
|
||||
// MeoAssistanceGui - A part of the MeoAssistance-Arknight project
|
||||
// Copyright (C) 2021 MistEO and Contributors
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY
|
||||
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace MeoAsstGui
|
||||
{
|
||||
/// <summary>
|
||||
/// PenguinReportSettingsUserControl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class VersionUpdateSettingsUserControl : UserControl
|
||||
{
|
||||
public VersionUpdateSettingsUserControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ namespace MeoAsstGui
|
||||
var asstProxy = _container.Get<AsstProxy>();
|
||||
var task = Task.Run(() =>
|
||||
{
|
||||
return asstProxy.AsstCatchDefault();
|
||||
return asstProxy.AsstCatch();
|
||||
});
|
||||
bool catchd = await task;
|
||||
if (!catchd)
|
||||
|
||||
@@ -61,7 +61,10 @@ namespace MeoAsstGui
|
||||
{
|
||||
var task = Task.Run(() =>
|
||||
{
|
||||
return vuvm.CheckAndDownloadUpdate();
|
||||
if (!vuvm.CheckAndDownloadUpdate())
|
||||
{
|
||||
vuvm.ResourceOTA();
|
||||
}
|
||||
});
|
||||
|
||||
await task;
|
||||
|
||||
@@ -9,9 +9,11 @@
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Stylet;
|
||||
using StyletIoC;
|
||||
|
||||
@@ -22,17 +24,27 @@ namespace MeoAsstGui
|
||||
private IWindowManager _windowManager;
|
||||
private IContainer _container;
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern IntPtr AsstGetVersion();
|
||||
|
||||
private string _versionInfo = "版本号:" + Marshal.PtrToStringAnsi(AsstGetVersion());
|
||||
|
||||
public string VersionInfo
|
||||
{
|
||||
get { return _versionInfo; }
|
||||
}
|
||||
|
||||
public SettingsViewModel(IContainer container, IWindowManager windowManager)
|
||||
{
|
||||
_container = container;
|
||||
_windowManager = windowManager;
|
||||
DisplayName = "设置";
|
||||
|
||||
_listTitle.Add("基建");
|
||||
_listTitle.Add("基建设置");
|
||||
_listTitle.Add("自动公招");
|
||||
_listTitle.Add("信用商店");
|
||||
_listTitle.Add("企鹅数据");
|
||||
//_listTitle.Add("连接");
|
||||
_listTitle.Add("连接设置");
|
||||
_listTitle.Add("软件更新");
|
||||
//_listTitle.Add("其他");
|
||||
|
||||
InfrastInit();
|
||||
@@ -52,40 +64,44 @@ namespace MeoAsstGui
|
||||
private void InfrastInit()
|
||||
{
|
||||
/* 基建设置 */
|
||||
InfrastItemViewModels = new ObservableCollection<DragItemViewModel>();
|
||||
string[] facility_list = new string[] { "制造站", "贸易站", "控制中枢", "发电站", "会客室", "办公室", "宿舍" };
|
||||
|
||||
string key = "Infrast.";
|
||||
//InfrastItemViewModels.Add(new DragItemViewModel("宿舍", key));
|
||||
InfrastItemViewModels.Add(new DragItemViewModel("制造站", key));
|
||||
InfrastItemViewModels.Add(new DragItemViewModel("贸易站", key));
|
||||
InfrastItemViewModels.Add(new DragItemViewModel("控制中枢", key));
|
||||
InfrastItemViewModels.Add(new DragItemViewModel("发电站", key));
|
||||
InfrastItemViewModels.Add(new DragItemViewModel("会客室", key));
|
||||
InfrastItemViewModels.Add(new DragItemViewModel("办公室", key));
|
||||
InfrastItemViewModels.Add(new DragItemViewModel("宿舍", key));
|
||||
var temp_order_list = new List<DragItemViewModel>(new DragItemViewModel[facility_list.Length]);
|
||||
for (int i = 0; i != facility_list.Length; ++i)
|
||||
{
|
||||
var facility = facility_list[i];
|
||||
int order = -1;
|
||||
bool parsed = int.TryParse(ViewStatusStorage.Get("Infrast.Order." + facility, "-1"), out order);
|
||||
|
||||
facilityKey.Add("宿舍", "Dorm");
|
||||
facilityKey.Add("制造站", "Mfg");
|
||||
facilityKey.Add("贸易站", "Trade");
|
||||
facilityKey.Add("发电站", "Power");
|
||||
facilityKey.Add("会客室", "Reception");
|
||||
facilityKey.Add("办公室", "Office");
|
||||
facilityKey.Add("控制中枢", "Control");
|
||||
if (!parsed || order < 0)
|
||||
{
|
||||
temp_order_list[i] = new DragItemViewModel(facility, "Infrast.");
|
||||
}
|
||||
else
|
||||
{
|
||||
temp_order_list[order] = new DragItemViewModel(facility, "Infrast.");
|
||||
}
|
||||
}
|
||||
InfrastItemViewModels = new ObservableCollection<DragItemViewModel>(temp_order_list);
|
||||
|
||||
FacilityKey.Add("宿舍", "Dorm");
|
||||
FacilityKey.Add("制造站", "Mfg");
|
||||
FacilityKey.Add("贸易站", "Trade");
|
||||
FacilityKey.Add("发电站", "Power");
|
||||
FacilityKey.Add("会客室", "Reception");
|
||||
FacilityKey.Add("办公室", "Office");
|
||||
FacilityKey.Add("控制中枢", "Control");
|
||||
|
||||
UsesOfDronesList = new List<CombData>();
|
||||
UsesOfDronesList.Add(new CombData { Display = "不使用无人机", Value = "_NotUse" });
|
||||
UsesOfDronesList.Add(new CombData { Display = "贸易站-龙门币", Value = "Money" });
|
||||
UsesOfDronesList.Add(new CombData { Display = "贸易站-合成玉", Value = "SyntheticJade" });
|
||||
UsesOfDronesList.Add(new CombData { Display = "制造站-经验书", Value = "CombatRecord" });
|
||||
UsesOfDronesList.Add(new CombData { Display = "制造站-赤金", Value = "PureGold" });
|
||||
UsesOfDronesList.Add(new CombData { Display = "制造站-源石碎片", Value = "OriginStone" });
|
||||
UsesOfDronesList.Add(new CombData { Display = "制造站-芯片组", Value = "Chip" });
|
||||
|
||||
_dormThresholdLabel = "宿舍入驻心情阈值:" + _dormThreshold + "%";
|
||||
|
||||
if (NotUseDrone)
|
||||
{
|
||||
_usesOfDrones = UsesOfDrones.DronesNotUse;
|
||||
}
|
||||
else if (DroneForTrade)
|
||||
{
|
||||
_usesOfDrones = UsesOfDrones.DronesTrade;
|
||||
}
|
||||
else if (DroneForMfg)
|
||||
{
|
||||
_usesOfDrones = UsesOfDrones.DronesMfg;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _idle = true;
|
||||
@@ -100,56 +116,10 @@ namespace MeoAsstGui
|
||||
}
|
||||
|
||||
/* 基建设置 */
|
||||
public Dictionary<string, string> facilityKey = new Dictionary<string, string>();
|
||||
public Dictionary<string, string> FacilityKey = new Dictionary<string, string>();
|
||||
public ObservableCollection<DragItemViewModel> InfrastItemViewModels { get; set; }
|
||||
|
||||
private bool _notUseDrone = System.Convert.ToBoolean(ViewStatusStorage.Get("Infrast.NotUseDrone", bool.TrueString));
|
||||
|
||||
public bool NotUseDrone
|
||||
{
|
||||
get { return _notUseDrone; }
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
_usesOfDrones = UsesOfDrones.DronesNotUse;
|
||||
}
|
||||
SetAndNotify(ref _notUseDrone, value);
|
||||
ViewStatusStorage.Set("Infrast.NotUseDrone", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _droneForTrade = System.Convert.ToBoolean(ViewStatusStorage.Get("Infrast.DroneForTrade", bool.FalseString));
|
||||
|
||||
public bool DroneForTrade
|
||||
{
|
||||
get { return _droneForTrade; }
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
_usesOfDrones = UsesOfDrones.DronesTrade;
|
||||
}
|
||||
SetAndNotify(ref _droneForTrade, value);
|
||||
ViewStatusStorage.Set("Infrast.DroneForTrade", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool _droneForMfg = System.Convert.ToBoolean(ViewStatusStorage.Get("Infrast.DroneForMfg", bool.FalseString));
|
||||
|
||||
public bool DroneForMfg
|
||||
{
|
||||
get { return _droneForMfg; }
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
_usesOfDrones = UsesOfDrones.DronesMfg;
|
||||
}
|
||||
SetAndNotify(ref _droneForMfg, value);
|
||||
ViewStatusStorage.Set("Infrast.DroneForMfg", value.ToString());
|
||||
}
|
||||
}
|
||||
public List<CombData> UsesOfDronesList { get; set; }
|
||||
|
||||
private int _dormThreshold = System.Convert.ToInt32(ViewStatusStorage.Get("Infrast.DormThreshold", "30"));
|
||||
|
||||
@@ -185,19 +155,28 @@ namespace MeoAsstGui
|
||||
continue;
|
||||
}
|
||||
|
||||
orderList.Add(facilityKey[item.Name]);
|
||||
orderList.Add(FacilityKey[item.Name]);
|
||||
}
|
||||
return orderList;
|
||||
}
|
||||
|
||||
private UsesOfDrones _usesOfDrones = UsesOfDrones.DronesNotUse;
|
||||
public void SaveInfrastOrderList()
|
||||
{
|
||||
for (int i = 0; i < InfrastItemViewModels.Count; i++)
|
||||
{
|
||||
ViewStatusStorage.Set("Infrast.Order." + InfrastItemViewModels[i].Name, i.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public UsesOfDrones UsesOfDrones
|
||||
private string _usesOfDrones = ViewStatusStorage.Get("Infrast.UsesOfDrones", "Money");
|
||||
|
||||
public string UsesOfDrones
|
||||
{
|
||||
get { return _usesOfDrones; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _usesOfDrones, value);
|
||||
ViewStatusStorage.Set("Infrast.UsesOfDrones", value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +247,7 @@ namespace MeoAsstGui
|
||||
|
||||
/* 信用商店设置 */
|
||||
|
||||
private bool _creditShopping = System.Convert.ToBoolean(ViewStatusStorage.Get("Mall.CreditShopping", bool.FalseString));
|
||||
private bool _creditShopping = System.Convert.ToBoolean(ViewStatusStorage.Get("Mall.CreditShopping", bool.TrueString));
|
||||
|
||||
public bool CreditShopping
|
||||
{
|
||||
@@ -354,5 +333,73 @@ namespace MeoAsstGui
|
||||
ViewStatusStorage.Set("AutoRecruit.ChooseLevel5", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/* 软件更新设置 */
|
||||
private bool _updateBeta = System.Convert.ToBoolean(ViewStatusStorage.Get("VersionUpdate.UpdateBeta", bool.FalseString));
|
||||
|
||||
public bool UpdateBeta
|
||||
{
|
||||
get { return _updateBeta; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _updateBeta, value);
|
||||
ViewStatusStorage.Set("VersionUpdate.UpdateBeta", value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private string _proxy = ViewStatusStorage.Get("VersionUpdate.Proxy", "");
|
||||
|
||||
public string Proxy
|
||||
{
|
||||
get { return _proxy; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _proxy, value);
|
||||
ViewStatusStorage.Set("VersionUpdate.Proxy", value);
|
||||
}
|
||||
}
|
||||
|
||||
/* 连接设置 */
|
||||
|
||||
private string _connectAddress = ViewStatusStorage.Get("Connect.Address", string.Empty);
|
||||
|
||||
public string ConnectAddress
|
||||
{
|
||||
get { return _connectAddress; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _connectAddress, value);
|
||||
ViewStatusStorage.Set("Connect.Address", value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _bluestacksConfPath = ViewStatusStorage.Get("Connect.BluestacksConfPath", string.Empty);
|
||||
|
||||
public string BluestacksConfPath
|
||||
{
|
||||
get { return _bluestacksConfPath; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _bluestacksConfPath, value);
|
||||
ViewStatusStorage.Set("Connect.BluestacksConfPath", value);
|
||||
}
|
||||
}
|
||||
|
||||
public void TryToSetBlueStacksHyperVAddress()
|
||||
{
|
||||
if (BluestacksConfPath.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var all_lines = File.ReadAllLines(BluestacksConfPath);
|
||||
foreach (var line in all_lines)
|
||||
{
|
||||
if (line.StartsWith("bst.instance.Nougat64.status.adb_port"))
|
||||
{
|
||||
var sp = line.Split('"');
|
||||
ConnectAddress = "127.0.0.1:" + sp[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,20 +22,31 @@ namespace MeoAsstGui
|
||||
_container = container;
|
||||
_windowManager = windowManager;
|
||||
DisplayName = "一键长草";
|
||||
TaskItemViewModels = new ObservableCollection<DragItemViewModel>();
|
||||
LogItemViewModels = new ObservableCollection<LogItemViewModel>();
|
||||
InitializeItems();
|
||||
}
|
||||
|
||||
public void InitializeItems()
|
||||
{
|
||||
string stroageKey = "TaskQueue.";
|
||||
TaskItemViewModels.Add(new DragItemViewModel("刷理智", stroageKey));
|
||||
TaskItemViewModels.Add(new DragItemViewModel("基建换班", stroageKey));
|
||||
TaskItemViewModels.Add(new DragItemViewModel("自动公招", stroageKey));
|
||||
TaskItemViewModels.Add(new DragItemViewModel("访问好友", stroageKey));
|
||||
TaskItemViewModels.Add(new DragItemViewModel("收取信用及购物", stroageKey));
|
||||
TaskItemViewModels.Add(new DragItemViewModel("领取日常奖励", stroageKey));
|
||||
string[] task_list = new string[] { "刷理智", "基建换班", "自动公招", "访问好友", "收取信用及购物", "领取日常奖励" };
|
||||
|
||||
var temp_order_list = new List<DragItemViewModel>(new DragItemViewModel[task_list.Length]);
|
||||
for (int i = 0; i != task_list.Length; ++i)
|
||||
{
|
||||
var task = task_list[i];
|
||||
int order = -1;
|
||||
bool parsed = int.TryParse(ViewStatusStorage.Get("TaskQueue.Order." + task, "-1"), out order);
|
||||
|
||||
if (!parsed || order < 0)
|
||||
{
|
||||
temp_order_list[i] = new DragItemViewModel(task, "TaskQueue.");
|
||||
}
|
||||
else
|
||||
{
|
||||
temp_order_list[order] = new DragItemViewModel(task, "TaskQueue.");
|
||||
}
|
||||
}
|
||||
TaskItemViewModels = new ObservableCollection<DragItemViewModel>(temp_order_list);
|
||||
}
|
||||
|
||||
public void AddLog(string content, string color = "Gray", string weight = "Regular")
|
||||
@@ -58,7 +69,7 @@ namespace MeoAsstGui
|
||||
var asstProxy = _container.Get<AsstProxy>();
|
||||
var task = Task.Run(() =>
|
||||
{
|
||||
return asstProxy.AsstCatchDefault();
|
||||
return asstProxy.AsstCatch();
|
||||
});
|
||||
bool catchd = await task;
|
||||
if (!catchd)
|
||||
@@ -70,8 +81,12 @@ namespace MeoAsstGui
|
||||
bool ret = true;
|
||||
// 直接遍历TaskItemViewModels里面的内容,是排序后的
|
||||
int count = 0;
|
||||
int index = 0;
|
||||
foreach (var item in TaskItemViewModels)
|
||||
{
|
||||
ViewStatusStorage.Set("TaskQueue.Order." + item.Name, index.ToString());
|
||||
++index;
|
||||
|
||||
if (item.IsChecked == false)
|
||||
{
|
||||
continue;
|
||||
@@ -170,10 +185,11 @@ namespace MeoAsstGui
|
||||
{
|
||||
var settings = _container.Get<SettingsViewModel>();
|
||||
var order = settings.GetInfrastOrderList();
|
||||
settings.SaveInfrastOrderList();
|
||||
int orderLen = order.Count;
|
||||
var asstProxy = _container.Get<AsstProxy>();
|
||||
return asstProxy.AsstAppendInfrast((int)settings.InfrastWorkMode, order.ToArray(), orderLen,
|
||||
(int)settings.UsesOfDrones, settings.DormThreshold / 100.0);
|
||||
settings.UsesOfDrones, settings.DormThreshold / 100.0);
|
||||
}
|
||||
|
||||
private bool appendMall()
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using StyletIoC;
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -15,9 +18,11 @@ namespace MeoAsstGui
|
||||
public class VersionUpdateViewModel : Screen
|
||||
{
|
||||
private IWindowManager _windowManager;
|
||||
private IContainer _container;
|
||||
|
||||
public VersionUpdateViewModel(IWindowManager windowManager)
|
||||
public VersionUpdateViewModel(IContainer container, IWindowManager windowManager)
|
||||
{
|
||||
_container = container;
|
||||
_windowManager = windowManager;
|
||||
}
|
||||
|
||||
@@ -87,7 +92,8 @@ namespace MeoAsstGui
|
||||
}
|
||||
|
||||
private const string _requestUrl = "https://api.github.com/repos/MistEO/MeoAssistance-Arknights/releases/latest";
|
||||
private const string _viewUrl = "https://github.com/MistEO/MeoAssistance-Arknights/releases/latest";
|
||||
private const string _requestBetaUrl = "https://api.github.com/repos/MistEO/MeoAssistance-Arknights/releases";
|
||||
private string _viewUrl;
|
||||
private JObject _lastestJson;
|
||||
private string _downloadUrl;
|
||||
|
||||
@@ -179,7 +185,7 @@ namespace MeoAsstGui
|
||||
.AddButton(openUrlToastButton)
|
||||
.Show();
|
||||
// 下载压缩包
|
||||
const int downloadRetryMaxTimes = 5;
|
||||
const int downloadRetryMaxTimes = 1;
|
||||
string downloadTempFilename = UpdatePackageName + ".tmp";
|
||||
bool downloaded = false;
|
||||
for (int i = 0; i != downloadRetryMaxTimes; ++i)
|
||||
@@ -194,11 +200,11 @@ namespace MeoAsstGui
|
||||
{
|
||||
new ToastContentBuilder()
|
||||
.AddText("新版本下载失败")
|
||||
.AddText("请尝试手动下载后,将压缩包放到exe同级目录_(:з」∠)_")
|
||||
.AddText("请尝试手动下载后,将压缩包放到目录下_(:з」∠)_")
|
||||
.AddButton(openUrlToastButton)
|
||||
.Show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
File.Copy(downloadTempFilename, UpdatePackageName, true);
|
||||
File.Delete(downloadTempFilename);
|
||||
// 把相关信息存下来,更新完之后启动的时候显示
|
||||
@@ -211,12 +217,20 @@ namespace MeoAsstGui
|
||||
}
|
||||
|
||||
public bool CheckUpdate()
|
||||
{
|
||||
{
|
||||
var settings = _container.Get<SettingsViewModel>();
|
||||
string response = string.Empty;
|
||||
const int requestRetryMaxTimes = 5;
|
||||
for (int i = 0; i != requestRetryMaxTimes; ++i)
|
||||
{
|
||||
response = RequestApi(_requestUrl);
|
||||
if (settings.UpdateBeta)
|
||||
{
|
||||
response = RequestApi(_requestBetaUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
response = RequestApi(_requestUrl);
|
||||
}
|
||||
if (response.Length != 0)
|
||||
{
|
||||
break;
|
||||
@@ -226,8 +240,19 @@ namespace MeoAsstGui
|
||||
{
|
||||
return false;
|
||||
}
|
||||
JObject json = (JObject)JsonConvert.DeserializeObject(response);
|
||||
|
||||
JObject json;
|
||||
|
||||
if (settings.UpdateBeta)
|
||||
{
|
||||
JArray all = (JArray)JsonConvert.DeserializeObject(response);
|
||||
json = (JObject)all[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
json = (JObject)JsonConvert.DeserializeObject(response);
|
||||
}
|
||||
|
||||
_viewUrl = json["html_url"].ToString();
|
||||
_latestVersion = json["tag_name"].ToString();
|
||||
if (string.Compare(_latestVersion, _curVersion) <= 0
|
||||
|| ViewStatusStorage.Get("VersionUpdate.Ignore", string.Empty) == _latestVersion)
|
||||
@@ -242,63 +267,115 @@ namespace MeoAsstGui
|
||||
_downloadUrl = downUrl;
|
||||
_lastestJson = json;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private string RequestApi(string url)
|
||||
{
|
||||
HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);
|
||||
httpWebRequest.Method = "GET";
|
||||
httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36";
|
||||
httpWebRequest.Accept = "application/vnd.github.v3+json";
|
||||
//httpWebRequest.Timeout = 20000;
|
||||
try
|
||||
{
|
||||
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
|
||||
StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream(), Encoding.UTF8);
|
||||
string responseContent = streamReader.ReadToEnd();
|
||||
streamReader.Close();
|
||||
httpWebResponse.Close();
|
||||
return responseContent;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
private string RequestApi(string url)
|
||||
{
|
||||
HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);
|
||||
httpWebRequest.Method = "GET";
|
||||
httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36";
|
||||
httpWebRequest.Accept = "application/vnd.github.v3+json";
|
||||
var settings = _container.Get<SettingsViewModel>();
|
||||
if (settings.Proxy.Length > 0)
|
||||
{
|
||||
httpWebRequest.Proxy = new WebProxy(settings.Proxy);
|
||||
}
|
||||
//httpWebRequest.Timeout = 20000;
|
||||
try
|
||||
{
|
||||
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
|
||||
StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream(), Encoding.UTF8);
|
||||
string responseContent = streamReader.ReadToEnd();
|
||||
streamReader.Close();
|
||||
httpWebResponse.Close();
|
||||
return responseContent;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private bool DownloadFile(string url, string path)
|
||||
{
|
||||
HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);
|
||||
httpWebRequest.Method = "GET";
|
||||
httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36";
|
||||
httpWebRequest.Accept = "application/vnd.github.v3+json";
|
||||
httpWebRequest.Timeout = 20 * 1000;
|
||||
try
|
||||
{
|
||||
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
|
||||
Stream reponseStream = httpWebResponse.GetResponseStream();
|
||||
Stream fileStream = new FileStream(path, FileMode.Create);
|
||||
byte[] bArr = new byte[4096];
|
||||
int size = reponseStream.Read(bArr, 0, (int)bArr.Length);
|
||||
while (size > 0)
|
||||
{
|
||||
fileStream.Write(bArr, 0, size);
|
||||
size = reponseStream.Read(bArr, 0, (int)bArr.Length);
|
||||
};
|
||||
fileStream.Close();
|
||||
reponseStream.Close();
|
||||
httpWebResponse.Close();
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool DownloadFile(string url, string filename)
|
||||
{
|
||||
string cmd = Environment.CurrentDirectory + "\\aria2c.exe";
|
||||
string args = "-c " + url + " -o " + filename;
|
||||
|
||||
var settings = _container.Get<SettingsViewModel>();
|
||||
if (settings.Proxy.Length > 0)
|
||||
{
|
||||
args += " --all-proxy " + settings.Proxy;
|
||||
}
|
||||
|
||||
int exit_code = -1;
|
||||
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
startInfo.FileName = cmd;
|
||||
startInfo.Arguments = args;
|
||||
startInfo.RedirectStandardOutput = true;
|
||||
startInfo.RedirectStandardError = true;
|
||||
startInfo.UseShellExecute = false;
|
||||
startInfo.CreateNoWindow = true;
|
||||
|
||||
Process processTemp = new Process();
|
||||
processTemp.StartInfo = startInfo;
|
||||
processTemp.EnableRaisingEvents = true;
|
||||
try
|
||||
{
|
||||
processTemp.Start();
|
||||
processTemp.WaitForExit();
|
||||
exit_code = processTemp.ExitCode;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return exit_code == 0;
|
||||
}
|
||||
|
||||
public bool ResourceOTA()
|
||||
{
|
||||
const string base_url = "https://raw.githubusercontent.com/MistEO/MeoAssistance-Arknights/master/";
|
||||
var update_dict = new Dictionary<string, string>()
|
||||
{
|
||||
{ "3rdparty/resource/penguin-stats-recognize/json/stages.json" , "resource/penguin-stats-recognize/json/stages.json"},
|
||||
{ "resource/recruit.json", "resource/recruit.json" }
|
||||
};
|
||||
bool updated = false;
|
||||
foreach (var item in update_dict)
|
||||
{
|
||||
string url = base_url + item.Key;
|
||||
string filename = item.Value;
|
||||
string tempname = filename + ".tmp";
|
||||
if (!DownloadFile(url, tempname))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string src = File.ReadAllText(filename).Replace("\r\n", "\n");
|
||||
string tmp = File.ReadAllText(tempname).Replace("\r\n", "\n");
|
||||
|
||||
if (src.Length < tmp.Length)
|
||||
{
|
||||
File.Copy(tempname, filename, true);
|
||||
updated = true;
|
||||
}
|
||||
File.Delete(tempname);
|
||||
}
|
||||
if (updated)
|
||||
{
|
||||
new ToastContentBuilder().AddText("资源文件已更新").AddText("下次启动软件生效!").Show();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void CopyFilesRecursively(string sourcePath, string targetPath)
|
||||
{
|
||||
//Now Create all of the directories
|
||||
@@ -312,14 +389,14 @@ namespace MeoAsstGui
|
||||
{
|
||||
File.Copy(newPath, newPath.Replace(sourcePath, targetPath), true);
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
RequestClose();
|
||||
IsFirstBootAfterUpdate = false;
|
||||
UpdateTag = "";
|
||||
UpdateInfo = "";
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
RequestClose();
|
||||
IsFirstBootAfterUpdate = false;
|
||||
UpdateTag = "";
|
||||
UpdateInfo = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,12 @@
|
||||
<Rectangle HorizontalAlignment="Stretch" Fill="LightGray" Height="1" />
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Text="{Binding ListTitle[3]}" Foreground="Gray" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left" />
|
||||
<local:PenguinReportSettingsUserControl Margin="20" />
|
||||
<Rectangle HorizontalAlignment="Stretch" Fill="LightGray" Height="1" />
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Text="{Binding ListTitle[4]}" Foreground="Gray" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left" />
|
||||
<local:ConnectSettingsUserControl Margin="20" />
|
||||
<Rectangle HorizontalAlignment="Stretch" Fill="LightGray" Height="1" />
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Text="{Binding ListTitle[5]}" Foreground="Gray" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left" />
|
||||
<local:VersionUpdateSettingsUserControl Margin="20" />
|
||||
<!--<Rectangle HorizontalAlignment="Stretch" Fill="LightGray" Height="1" />-->
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
@@ -3,4 +3,4 @@ LatestTag=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
Package="../x64/MeoAssistance_"$LatestTag".zip"
|
||||
|
||||
cp ./*.url $TargetDir
|
||||
7z.exe a $Package $TargetDir/resource $TargetDir/*.dll $TargetDir/MeoAsstGui.exe $TargetDir/*.url
|
||||
7z.exe a $Package $TargetDir/resource $TargetDir/*.dll $TargetDir/aria2c.exe $TargetDir/MeoAsstGui.exe $TargetDir/*.url
|
||||