mirror of
https://github.com/microsoft/PowerToys
synced 2025-09-01 23:15:18 +00:00
Getting stuff .net 6 buildable again
This commit is contained in:
@@ -18,7 +18,6 @@ using PowerLauncher.Plugin;
|
|||||||
using PowerLauncher.ViewModel;
|
using PowerLauncher.ViewModel;
|
||||||
using Wox;
|
using Wox;
|
||||||
using Wox.Infrastructure;
|
using Wox.Infrastructure;
|
||||||
using Wox.Infrastructure.Http;
|
|
||||||
using Wox.Infrastructure.Image;
|
using Wox.Infrastructure.Image;
|
||||||
using Wox.Infrastructure.UserSettings;
|
using Wox.Infrastructure.UserSettings;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
@@ -129,9 +128,6 @@ namespace PowerLauncher
|
|||||||
Current.MainWindow = _mainWindow;
|
Current.MainWindow = _mainWindow;
|
||||||
Current.MainWindow.Title = Constant.ExeFileName;
|
Current.MainWindow.Title = Constant.ExeFileName;
|
||||||
|
|
||||||
// main windows needs initialized before theme change because of blur settings
|
|
||||||
HttpClient.Proxy = _settings.Proxy;
|
|
||||||
|
|
||||||
RegisterExitEvents();
|
RegisterExitEvents();
|
||||||
|
|
||||||
_settingsReader.ReadSettingsOnChange();
|
_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.Frames.Add(bitmapFrame);
|
||||||
enc.Save(outStream);
|
enc.Save(outStream);
|
||||||
var byteArray = outStream.GetBuffer();
|
var byteArray = outStream.GetBuffer();
|
||||||
using (var sha1 = new SHA1CryptoServiceProvider())
|
|
||||||
|
using (var sha1 = SHA1.Create())
|
||||||
{
|
{
|
||||||
var hash = Convert.ToBase64String(sha1.ComputeHash(byteArray));
|
var hash = Convert.ToBase64String(sha1.ComputeHash(byteArray));
|
||||||
return hash;
|
return hash;
|
||||||
|
@@ -24,7 +24,7 @@ namespace Wox.Infrastructure.Storage
|
|||||||
// easier and flexible for default value of object
|
// easier and flexible for default value of object
|
||||||
private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions
|
private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions
|
||||||
{
|
{
|
||||||
IgnoreNullValues = true,
|
DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
|
||||||
IncludeFields = true,
|
IncludeFields = true,
|
||||||
PropertyNameCaseInsensitive = true,
|
PropertyNameCaseInsensitive = true,
|
||||||
WriteIndented = true,
|
WriteIndented = true,
|
||||||
|
Reference in New Issue
Block a user