diff --git a/src/modules/launcher/PowerLauncher/App.xaml.cs b/src/modules/launcher/PowerLauncher/App.xaml.cs index ddb31eb437..948e76ebb3 100644 --- a/src/modules/launcher/PowerLauncher/App.xaml.cs +++ b/src/modules/launcher/PowerLauncher/App.xaml.cs @@ -18,7 +18,6 @@ using PowerLauncher.Plugin; using PowerLauncher.ViewModel; using Wox; using Wox.Infrastructure; -using Wox.Infrastructure.Http; using Wox.Infrastructure.Image; using Wox.Infrastructure.UserSettings; using Wox.Plugin; @@ -129,9 +128,6 @@ namespace PowerLauncher Current.MainWindow = _mainWindow; Current.MainWindow.Title = Constant.ExeFileName; - // main windows needs initialized before theme change because of blur settings - HttpClient.Proxy = _settings.Proxy; - RegisterExitEvents(); _settingsReader.ReadSettingsOnChange(); diff --git a/src/modules/launcher/Wox.Infrastructure/Http/HttpClient.cs b/src/modules/launcher/Wox.Infrastructure/Http/HttpClient.cs deleted file mode 100644 index 6ebeeeaef2..0000000000 --- a/src/modules/launcher/Wox.Infrastructure/Http/HttpClient.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation -// The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; -using System.Net; -using System.Net.Http; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using JetBrains.Annotations; -using Wox.Infrastructure.UserSettings; -using Wox.Plugin.Logger; - -namespace Wox.Infrastructure.Http -{ - public static class HttpClient - { - private const string UserAgent = @"Mozilla/5.0 (Trident/7.0; rv:11.0) like Gecko"; - - public static HttpProxy Proxy { get; set; } - - public static IWebProxy WebProxy() - { - if (Proxy != null && Proxy.Enabled && !string.IsNullOrEmpty(Proxy.Server)) - { - if (string.IsNullOrEmpty(Proxy.UserName) || string.IsNullOrEmpty(Proxy.Password)) - { - var webProxy = new WebProxy(Proxy.Server, Proxy.Port); - return webProxy; - } - else - { - var webProxy = new WebProxy(Proxy.Server, Proxy.Port) - { - Credentials = new NetworkCredential(Proxy.UserName, Proxy.Password), - }; - return webProxy; - } - } - else - { - return WebRequest.GetSystemWebProxy(); - } - } - - public static void Download([NotNull] Uri url, [NotNull] string filePath) - { - if (url == null) - { - throw new ArgumentNullException(nameof(url)); - } - - var client = new WebClient { Proxy = WebProxy() }; - client.Headers.Add("user-agent", UserAgent); - client.DownloadFile(url.AbsoluteUri, filePath); - client.Dispose(); - } - } -} diff --git a/src/modules/launcher/Wox.Infrastructure/Image/ImageHashGenerator.cs b/src/modules/launcher/Wox.Infrastructure/Image/ImageHashGenerator.cs index 8c7bbe680d..dc9b576234 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/ImageHashGenerator.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/ImageHashGenerator.cs @@ -35,7 +35,8 @@ namespace Wox.Infrastructure.Image enc.Frames.Add(bitmapFrame); enc.Save(outStream); var byteArray = outStream.GetBuffer(); - using (var sha1 = new SHA1CryptoServiceProvider()) + + using (var sha1 = SHA1.Create()) { var hash = Convert.ToBase64String(sha1.ComputeHash(byteArray)); return hash; diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs index 12088202fe..9181364855 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs @@ -24,7 +24,7 @@ namespace Wox.Infrastructure.Storage // easier and flexible for default value of object private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions { - IgnoreNullValues = true, + DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, IncludeFields = true, PropertyNameCaseInsensitive = true, WriteIndented = true,