From 04f73e7c233dace56dcd7b7236e6e9ab05cf4870 Mon Sep 17 00:00:00 2001 From: DavidWang19 Date: Sat, 25 Mar 2023 21:22:36 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"feat:=20=E5=A2=9E=E5=8A=A0json?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E8=B6=85=E6=97=B6=E9=99=90=E5=88=B6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Helper/WebService.cs | 8 -------- src/MaaWpfGui/Main/CopilotViewModel.cs | 9 ++++++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/MaaWpfGui/Helper/WebService.cs b/src/MaaWpfGui/Helper/WebService.cs index 19f182c1b9..e441e51c24 100644 --- a/src/MaaWpfGui/Helper/WebService.cs +++ b/src/MaaWpfGui/Helper/WebService.cs @@ -27,8 +27,6 @@ namespace MaaWpfGui.Helper { public const string RequestUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 Edg/97.0.1072.76"; - private const int TimeoutMs = 3000; - private static string s_proxy = Config.Get(Config.UpdateProxy, string.Empty); public static string Proxy @@ -37,18 +35,12 @@ namespace MaaWpfGui.Helper { s_proxy = value; NormalClient = BuildNormalClient(); - NormalClient.Timeout = TimeSpan.FromMilliseconds(TimeoutMs); } } #nullable enable public static HttpClient NormalClient { get; private set; } = BuildNormalClient(); - static WebService() - { - NormalClient.Timeout = TimeSpan.FromMilliseconds(TimeoutMs); - } - private static HttpClient BuildNormalClient() => new HttpClient(new HttpClientHandler() { Proxy = string.IsNullOrWhiteSpace(s_proxy) ? null : new WebProxy(s_proxy), diff --git a/src/MaaWpfGui/Main/CopilotViewModel.cs b/src/MaaWpfGui/Main/CopilotViewModel.cs index 54d89c8ac7..5206af8f01 100644 --- a/src/MaaWpfGui/Main/CopilotViewModel.cs +++ b/src/MaaWpfGui/Main/CopilotViewModel.cs @@ -148,7 +148,13 @@ namespace MaaWpfGui get => _filename; set { - SetAndNotify(ref _filename, value); + if (value == _filename) + { + return; + } + + _filename = value; + NotifyOfPropertyChange(() => Filename); ClearLog(); UpdateFilename(); } @@ -218,6 +224,7 @@ namespace MaaWpfGui { ParseJsonAndShowInfo(jsonStr); } + } private async Task RequestCopilotServer(int copilotID)