mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
Refactoring
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
using Wox.Infrastructure.Storage.UserSettings;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Wox.Helper
|
||||
{
|
||||
public class HttpProxy : IHttpProxy
|
||||
{
|
||||
private static readonly HttpProxy instance = new HttpProxy();
|
||||
|
||||
private HttpProxy()
|
||||
{
|
||||
}
|
||||
|
||||
public static HttpProxy Instance
|
||||
{
|
||||
get { return instance; }
|
||||
}
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get { return UserSettingStorage.Instance.ProxyEnabled; }
|
||||
}
|
||||
|
||||
public string Server
|
||||
{
|
||||
get { return UserSettingStorage.Instance.ProxyServer; }
|
||||
}
|
||||
|
||||
public int Port
|
||||
{
|
||||
get { return UserSettingStorage.Instance.ProxyPort; }
|
||||
}
|
||||
|
||||
public string UserName
|
||||
{
|
||||
get { return UserSettingStorage.Instance.ProxyUserName; }
|
||||
}
|
||||
|
||||
public string Password
|
||||
{
|
||||
get { return UserSettingStorage.Instance.ProxyPassword; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Helper
|
||||
{
|
||||
public class WoxException : Exception
|
||||
{
|
||||
public WoxException(string msg)
|
||||
: base(msg)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Helper
|
||||
{
|
||||
public class WoxJsonPRCException : WoxException
|
||||
{
|
||||
public WoxJsonPRCException(string msg)
|
||||
: base(msg)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using NHotkey;
|
||||
using NHotkey.Wpf;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Hotkey;
|
||||
using Wox.Plugin;
|
||||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||
using UserControl = System.Windows.Controls.UserControl;
|
||||
|
||||
@@ -18,6 +18,7 @@ using Wox.Commands;
|
||||
using Wox.Helper;
|
||||
using Wox.ImageLoader;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Hotkey;
|
||||
using Wox.Infrastructure.Storage;
|
||||
using Wox.Infrastructure.Storage.UserSettings;
|
||||
using Wox.Plugin;
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using Wox.Helper;
|
||||
using Wox.Helper.ErrorReporting;
|
||||
using Wox.Infrastructure.Exceptions;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using Wox.JsonRPC;
|
||||
using Wox.Plugin;
|
||||
@@ -142,7 +143,7 @@ namespace Wox.PluginLoader
|
||||
string error = errorReader.ReadToEnd();
|
||||
if (!string.IsNullOrEmpty(error))
|
||||
{
|
||||
ErrorReporting.TryShowErrorMessageBox(error, new WoxJsonPRCException(error));
|
||||
ErrorReporting.TryShowErrorMessageBox(error, new WoxJsonRPCException(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure.Exceptions;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using Wox.Infrastructure.Storage.UserSettings;
|
||||
using Wox.Plugin;
|
||||
|
||||
@@ -3,6 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Http;
|
||||
using Wox.Infrastructure.Storage.UserSettings;
|
||||
using Wox.Plugin;
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Http;
|
||||
using Wox.JsonRPC;
|
||||
using Wox.Plugin;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.Http;
|
||||
|
||||
namespace Wox.Update
|
||||
{
|
||||
@@ -25,28 +26,20 @@ namespace Wox.Update
|
||||
public Release CheckUpgrade(bool forceCheck = false)
|
||||
{
|
||||
if (checkedUpdate && !forceCheck) return newRelease;
|
||||
string json = HttpRequest.Get(updateURL);
|
||||
if (string.IsNullOrEmpty(json)) return null;
|
||||
|
||||
HttpWebResponse response = HttpRequest.CreateGetHttpResponse(updateURL, HttpProxy.Instance);
|
||||
Stream s = response.GetResponseStream();
|
||||
if (s != null)
|
||||
try
|
||||
{
|
||||
StreamReader reader = new StreamReader(s, Encoding.UTF8);
|
||||
string json = reader.ReadToEnd();
|
||||
try
|
||||
{
|
||||
newRelease = JsonConvert.DeserializeObject<Release>(json);
|
||||
}
|
||||
catch
|
||||
newRelease = JsonConvert.DeserializeObject<Release>(json);
|
||||
if (!IsNewerThanCurrent(newRelease))
|
||||
{
|
||||
newRelease = null;
|
||||
}
|
||||
checkedUpdate = true;
|
||||
}
|
||||
catch{}
|
||||
|
||||
if (!IsNewerThanCurrent(newRelease))
|
||||
{
|
||||
newRelease = null;
|
||||
}
|
||||
|
||||
checkedUpdate = true;
|
||||
return newRelease;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,6 @@
|
||||
<DependentUpon>WPFErrorReportingDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Helper\FontHelper.cs" />
|
||||
<Compile Include="Helper\HttpProxy.cs" />
|
||||
<Compile Include="ImageLoader\ImageLoader.cs" />
|
||||
<Compile Include="Helper\SingleInstance.cs" />
|
||||
<Compile Include="Helper\SyntaxSugars.cs" />
|
||||
@@ -150,8 +149,6 @@
|
||||
<Compile Include="Helper\DispatcherExtensions.cs" />
|
||||
<Compile Include="Helper\DWMDropShadow.cs" />
|
||||
<Compile Include="Helper\PluginInstaller.cs" />
|
||||
<Compile Include="Helper\WoxException.cs" />
|
||||
<Compile Include="Helper\WoxPythonException.cs" />
|
||||
<Compile Include="HotkeyControl.xaml.cs">
|
||||
<DependentUpon>HotkeyControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
Reference in New Issue
Block a user