mirror of
https://github.com/microsoft/PowerToys
synced 2024-11-22 08:11:25 +00:00
Getting stuff .net 6 buildable again
This commit is contained in:
parent
3a396fdd12
commit
42b4201c6b
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user