Add upgrade check.

This commit is contained in:
qianlifeng
2014-12-14 23:16:29 +08:00
parent ac3b86fb85
commit 128453fad1
8 changed files with 186 additions and 7 deletions

View File

@@ -9,6 +9,8 @@ using System.Security.Cryptography.X509Certificates;
using System.Text;
//From:http://blog.csdn.net/zhoufoxcn/article/details/6404236
using Wox.Plugin;
namespace Wox.Infrastructure
{
public class HttpRequest
@@ -16,6 +18,30 @@ namespace Wox.Infrastructure
private static readonly string DefaultUserAgent = "Wox/" + Assembly.GetEntryAssembly().GetName().Version.ToString() + " (+https://github.com/qianlifeng/Wox)";
public static HttpWebResponse CreateGetHttpResponse(string url, IHttpProxy proxy)
{
if (string.IsNullOrEmpty(url))
{
throw new ArgumentNullException("url");
}
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
if (proxy != null && proxy.Enabled && !string.IsNullOrEmpty(proxy.Server))
{
if (string.IsNullOrEmpty(proxy.UserName) || string.IsNullOrEmpty(proxy.Password))
{
request.Proxy = new WebProxy(proxy.Server, proxy.Port);
}
else
{
request.Proxy = new WebProxy(proxy.Server, proxy.Port);
request.Proxy.Credentials = new NetworkCredential(proxy.UserName, proxy.Password);
}
}
request.Method = "GET";
request.UserAgent = DefaultUserAgent;
return request.GetResponse() as HttpWebResponse;
}
public static HttpWebResponse CreateGetHttpResponse(string url, int? timeout, string userAgent, CookieCollection cookies)
{
if (string.IsNullOrEmpty(url))

View File

@@ -8,6 +8,9 @@ namespace Wox.Infrastructure.Storage.UserSettings
{
public class UserSettingStorage : BaseStorage<UserSettingStorage>
{
[JsonProperty]
public bool DontPromptUpdateMsg { get; set; }
[JsonProperty]
public string Hotkey { get; set; }
@@ -145,6 +148,7 @@ namespace Wox.Infrastructure.Storage.UserSettings
protected override UserSettingStorage LoadDefaultConfig()
{
DontPromptUpdateMsg = false;
Theme = "Dark";
ReplaceWinR = true;
WebSearches = LoadDefaultWebSearches();