mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
commit
977a83cce8
39 changed files with 339 additions and 849 deletions
|
|
@ -1,9 +1,12 @@
|
|||
# msbuild based installer generation is not working in appveyor, not sure why
|
||||
|
||||
$currentPath = Convert-Path .
|
||||
Write-Host "Current path: " + $currentPath
|
||||
|
||||
$path = $env:APPVEYOR_BUILD_FOLDER + "\Deploy\wox.nuspec"
|
||||
Write-Host "nuspec path: " + $path
|
||||
& nuget.exe pack $path -Version $env:APPVEYOR_BUILD_VERSION -Properties Configuration=Release
|
||||
$releasePath = $env:APPVEYOR_BUILD_FOLDER + "\Output\Release"
|
||||
& nuget.exe pack $path -Version $env:APPVEYOR_BUILD_VERSION -Properties Configuration=Release -BasePath $releasePath
|
||||
|
||||
$nupkgPath = $env:APPVEYOR_BUILD_FOLDER + "\Wox." + $env:APPVEYOR_BUILD_VERSION + ".nupkg"
|
||||
Write-Host "nupkg path: " + $nupkgPath
|
||||
|
|
@ -12,4 +15,4 @@ Write-Host "nupkg path: " + $nupkgPath
|
|||
$squirrelPath = $env:APPVEYOR_BUILD_FOLDER + "\packages\squirrel*\tools\Squirrel.com"
|
||||
Write-Host "squirrel path: " + $squirrelPath
|
||||
$iconPath = $env:APPVEYOR_BUILD_FOLDER + "\Wox\Resources\app.ico"
|
||||
& $squirrelPath --releasify $nupkgPath --setupIcon $iconPath --no-msi
|
||||
& $squirrelPath --releasify $nupkgPath --setupIcon $iconPath --no-msi
|
||||
|
|
@ -11,6 +11,6 @@
|
|||
<description>Wox - a launcher for windows</description>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="..\Output\Release\**\*.*" target="lib\net45\" exclude="*.nupkg;*.vshost.*"/>
|
||||
<file src="**\*.*" target="lib\net45\" exclude="Wox.vshost.exe;Wox.vshost.exe.config;Wox.vshost.exe.manifest;*.nupkg;Setup.exe;RELEASES"/>
|
||||
</files>
|
||||
</package>
|
||||
|
|
|
|||
|
|
@ -85,10 +85,10 @@ namespace Wox.Plugin.WebSearch
|
|||
if (_settings.EnableWebSearchSuggestion)
|
||||
{
|
||||
const int waittime = 300;
|
||||
var task = Task.Run(() =>
|
||||
var task = Task.Run(async () =>
|
||||
{
|
||||
results.AddRange(ResultsFromSuggestions(keyword, subtitle, webSearch));
|
||||
|
||||
var suggestions = await Suggestions(keyword, subtitle, webSearch);
|
||||
results.AddRange(suggestions);
|
||||
}, _updateToken);
|
||||
|
||||
if (!task.Wait(waittime))
|
||||
|
|
@ -102,12 +102,12 @@ namespace Wox.Plugin.WebSearch
|
|||
}
|
||||
}
|
||||
|
||||
private IEnumerable<Result> ResultsFromSuggestions(string keyword, string subtitle, WebSearch webSearch)
|
||||
private async Task<IEnumerable<Result>> Suggestions(string keyword, string subtitle, WebSearch webSearch)
|
||||
{
|
||||
var source = SuggestionSource.GetSuggestionSource(_settings.WebSearchSuggestionSource, Context);
|
||||
var suggestions = source?.GetSuggestions(keyword);
|
||||
if (suggestions != null)
|
||||
if (source != null)
|
||||
{
|
||||
var suggestions = await source.GetSuggestions(keyword);
|
||||
var resultsFromSuggestion = suggestions.Select(o => new Result
|
||||
{
|
||||
Title = o,
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Wox.Infrastructure.Http;
|
||||
using Wox.Infrastructure.Logger;
|
||||
|
||||
namespace Wox.Plugin.WebSearch.SuggestionSources
|
||||
{
|
||||
|
|
@ -14,20 +16,24 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
|||
|
||||
Regex reg = new Regex("window.baidu.sug\\((.*)\\)");
|
||||
|
||||
public override List<string> GetSuggestions(string query)
|
||||
public override async Task<List<string>> GetSuggestions(string query)
|
||||
{
|
||||
var result = HttpRequest.Get("http://suggestion.baidu.com/su?json=1&wd=" + Uri.EscapeUriString(query), Proxy, "GB2312");
|
||||
var result = await HttpRequest.Get("http://suggestion.baidu.com/su?json=1&wd=" + Uri.EscapeUriString(query), Proxy, "GB2312");
|
||||
if (string.IsNullOrEmpty(result)) return new List<string>();
|
||||
|
||||
Match match = reg.Match(result);
|
||||
if (match.Success)
|
||||
{
|
||||
JContainer json = null;
|
||||
JContainer json;
|
||||
try
|
||||
{
|
||||
json = JsonConvert.DeserializeObject(match.Groups[1].Value) as JContainer;
|
||||
}
|
||||
catch { }
|
||||
catch (JsonSerializationException e)
|
||||
{
|
||||
Log.Error(e);
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
if (json != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,34 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Wox.Infrastructure.Http;
|
||||
using Wox.Infrastructure.Logger;
|
||||
|
||||
namespace Wox.Plugin.WebSearch.SuggestionSources
|
||||
{
|
||||
public class Google : SuggestionSource
|
||||
{
|
||||
public override string Domain { get; set; } = "www.google.com";
|
||||
public override List<string> GetSuggestions(string query)
|
||||
public override async Task<List<string>> GetSuggestions(string query)
|
||||
{
|
||||
var result = HttpRequest.Get("https://www.google.com/complete/search?output=chrome&q=" + Uri.EscapeUriString(query), Proxy);
|
||||
var result = await HttpRequest.Get("https://www.google.com/complete/search?output=chrome&q=" + Uri.EscapeUriString(query), Proxy);
|
||||
if (string.IsNullOrEmpty(result)) return new List<string>();
|
||||
|
||||
JContainer json;
|
||||
try
|
||||
{
|
||||
JContainer json = JsonConvert.DeserializeObject(result) as JContainer;
|
||||
if (json != null)
|
||||
json = JsonConvert.DeserializeObject(result) as JContainer;
|
||||
}
|
||||
catch (JsonSerializationException e)
|
||||
{
|
||||
Log.Error(e);
|
||||
return new List<string>();
|
||||
}
|
||||
if (json != null)
|
||||
{
|
||||
var results = json[1] as JContainer;
|
||||
if (results != null)
|
||||
{
|
||||
var results = json[1] as JContainer;
|
||||
if (results != null)
|
||||
{
|
||||
return results.OfType<JValue>().Select(o => o.Value).OfType<string>().ToList();
|
||||
}
|
||||
return results.OfType<JValue>().Select(o => o.Value).OfType<string>().ToList();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Wox.Plugin.WebSearch.SuggestionSources
|
||||
{
|
||||
|
|
@ -12,7 +13,7 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
|
|||
Proxy = httpProxy;
|
||||
}
|
||||
|
||||
public abstract List<string> GetSuggestions(string query);
|
||||
public abstract Task<List<string>> GetSuggestions(string query);
|
||||
|
||||
public static SuggestionSource GetSuggestionSource(string name, PluginInitContext context)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: AssemblyVersion("1.2.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.2.0")]
|
||||
[assembly: AssemblyVersion("1.2.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.2.0.*")]
|
||||
[assembly: AssemblyInformationalVersion("1.2.0.*")]
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
namespace Wox.Core
|
||||
{
|
||||
public static class APIServer
|
||||
{
|
||||
private static string BaseAPIURL = "http://api.getwox.com";
|
||||
public static string ErrorReportURL = BaseAPIURL + "/error/";
|
||||
public static string LastestReleaseURL = BaseAPIURL + "/release/latest/";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
namespace Wox.Core.Updater
|
||||
{
|
||||
public class Release
|
||||
{
|
||||
public string version { get; set; }
|
||||
public string download_link { get; set; }
|
||||
public string download_link1 { get; set; }
|
||||
public string download_link2 { get; set; }
|
||||
public string description { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
using System;
|
||||
using Wox.Infrastructure.Exception;
|
||||
|
||||
namespace Wox.Core.Updater
|
||||
{
|
||||
public class SemanticVersion : IComparable
|
||||
{
|
||||
public int MAJOR { get; set; }
|
||||
public int MINOR { get; set; }
|
||||
public int PATCH { get; set; }
|
||||
|
||||
public SemanticVersion(Version version)
|
||||
{
|
||||
MAJOR = version.Major;
|
||||
MINOR = version.Minor;
|
||||
PATCH = version.Build;
|
||||
}
|
||||
|
||||
public SemanticVersion(int major, int minor, int patch)
|
||||
{
|
||||
MAJOR = major;
|
||||
MINOR = minor;
|
||||
PATCH = patch;
|
||||
}
|
||||
|
||||
public SemanticVersion(string version)
|
||||
{
|
||||
var strings = version.Split('.');
|
||||
if (strings.Length != 3)
|
||||
{
|
||||
throw new WoxException("Invalid semantic version");
|
||||
}
|
||||
MAJOR = int.Parse(strings[0]);
|
||||
MINOR = int.Parse(strings[1]);
|
||||
PATCH = int.Parse(strings[2]);
|
||||
}
|
||||
|
||||
public static bool operator >(SemanticVersion v1, SemanticVersion v2)
|
||||
{
|
||||
return v1.CompareTo(v2) > 0;
|
||||
}
|
||||
|
||||
public static bool operator <(SemanticVersion v1, SemanticVersion v2)
|
||||
{
|
||||
return v1.CompareTo(v2) < 0;
|
||||
}
|
||||
|
||||
public static bool operator ==(SemanticVersion v1, SemanticVersion v2)
|
||||
{
|
||||
if (ReferenceEquals(v1, null))
|
||||
{
|
||||
return ReferenceEquals(v2, null);
|
||||
}
|
||||
if (ReferenceEquals(v2, null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return v1.Equals(v2);
|
||||
}
|
||||
|
||||
public static bool operator !=(SemanticVersion v1, SemanticVersion v2)
|
||||
{
|
||||
return !(v1 == v2);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}.{1}.{2}", MAJOR, MINOR, PATCH);
|
||||
}
|
||||
|
||||
public override bool Equals(object version)
|
||||
{
|
||||
var v2 = (SemanticVersion)version;
|
||||
return MAJOR == v2.MAJOR && MINOR == v2.MINOR && PATCH == v2.PATCH;
|
||||
}
|
||||
|
||||
public int CompareTo(object version)
|
||||
{
|
||||
var v2 = (SemanticVersion)version;
|
||||
if (MAJOR == v2.MAJOR)
|
||||
{
|
||||
if (MINOR == v2.MINOR)
|
||||
{
|
||||
if (PATCH == v2.PATCH)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return PATCH - v2.PATCH;
|
||||
}
|
||||
return MINOR - v2.MINOR;
|
||||
}
|
||||
return MAJOR - v2.MAJOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,182 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using NAppUpdate.Framework;
|
||||
using NAppUpdate.Framework.Common;
|
||||
using NAppUpdate.Framework.Sources;
|
||||
using NAppUpdate.Framework.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Wox.Core.Resource;
|
||||
using Wox.Core.UserSettings;
|
||||
using Wox.Infrastructure.Http;
|
||||
using Wox.Infrastructure.Logger;
|
||||
|
||||
namespace Wox.Core.Updater
|
||||
{
|
||||
public class UpdaterManager
|
||||
{
|
||||
private static UpdaterManager instance;
|
||||
private const string VersionCheckURL = "http://api.getwox.com/release/latest/";
|
||||
private const string UpdateFeedURL = "http://upgrade.getwox.com/update.xml";
|
||||
//private const string UpdateFeedURL = "http://127.0.0.1:8888/update.xml";
|
||||
private static SemanticVersion currentVersion;
|
||||
public UserSettings.Settings Settings { get; set; }
|
||||
|
||||
public event EventHandler PrepareUpdateReady;
|
||||
public event EventHandler UpdateError;
|
||||
|
||||
public Release NewRelease { get; set; }
|
||||
|
||||
public static UpdaterManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new UpdaterManager();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
private UpdaterManager()
|
||||
{
|
||||
UpdateManager.Instance.UpdateSource = GetUpdateSource();
|
||||
}
|
||||
|
||||
public SemanticVersion CurrentVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
if (currentVersion == null)
|
||||
{
|
||||
currentVersion = new SemanticVersion(Assembly.GetExecutingAssembly().GetName().Version);
|
||||
}
|
||||
return currentVersion;
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsNewerThanCurrent(Release release)
|
||||
{
|
||||
if (release == null) return false;
|
||||
|
||||
return new SemanticVersion(release.version) > CurrentVersion;
|
||||
}
|
||||
|
||||
public List<string> GetAvailableUpdateFiles()
|
||||
{
|
||||
List<string> files = new List<string>();
|
||||
foreach (var task in UpdateManager.Instance.Tasks)
|
||||
{
|
||||
if (task is FileUpdateTask)
|
||||
{
|
||||
files.Add(((FileUpdateTask)task).LocalPath);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
public void CheckUpdate()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
string json = HttpRequest.Get(VersionCheckURL, HttpProxy.Instance);
|
||||
if (!string.IsNullOrEmpty(json))
|
||||
{
|
||||
try
|
||||
{
|
||||
NewRelease = JsonConvert.DeserializeObject<Release>(json);
|
||||
if (IsNewerThanCurrent(NewRelease) && !Settings.DontPromptUpdateMsg)
|
||||
{
|
||||
StartUpdate();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void StartUpdate()
|
||||
{
|
||||
UpdateManager updManager = UpdateManager.Instance;
|
||||
updManager.BeginCheckForUpdates(asyncResult =>
|
||||
{
|
||||
if (asyncResult.IsCompleted)
|
||||
{
|
||||
// still need to check for caught exceptions if any and rethrow
|
||||
try
|
||||
{
|
||||
((UpdateProcessAsyncResult)asyncResult).EndInvoke();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
updManager.CleanUp();
|
||||
Log.Error(e);
|
||||
return;
|
||||
}
|
||||
|
||||
// No updates were found, or an error has occured. We might want to check that...
|
||||
if (updManager.UpdatesAvailable == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
updManager.BeginPrepareUpdates(result =>
|
||||
{
|
||||
((UpdateProcessAsyncResult)result).EndInvoke();
|
||||
OnPrepareUpdateReady();
|
||||
}, null);
|
||||
}, null);
|
||||
}
|
||||
|
||||
public void CleanUp()
|
||||
{
|
||||
UpdateManager.Instance.CleanUp();
|
||||
}
|
||||
|
||||
public void ApplyUpdates()
|
||||
{
|
||||
// ApplyUpdates is a synchronous method by design. Make sure to save all user work before calling
|
||||
// it as it might restart your application
|
||||
// get out of the way so the console window isn't obstructed
|
||||
try
|
||||
{
|
||||
UpdateManager.Instance.ApplyUpdates(true, Settings.EnableUpdateLog, false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
string updateError = InternationalizationManager.Instance.GetTranslation("update_wox_update_error");
|
||||
Log.Error(e);
|
||||
MessageBox.Show(updateError);
|
||||
OnUpdateError();
|
||||
}
|
||||
|
||||
UpdateManager.Instance.CleanUp();
|
||||
}
|
||||
|
||||
private IUpdateSource GetUpdateSource()
|
||||
{
|
||||
var source = new WoxUpdateSource(UpdateFeedURL, HttpRequest.GetWebProxy(HttpProxy.Instance));
|
||||
return source;
|
||||
}
|
||||
|
||||
protected virtual void OnPrepareUpdateReady()
|
||||
{
|
||||
var handler = PrepareUpdateReady;
|
||||
if (handler != null) handler(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
protected virtual void OnUpdateError()
|
||||
{
|
||||
var handler = UpdateError;
|
||||
if (handler != null) handler(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using NAppUpdate.Framework.Common;
|
||||
using NAppUpdate.Framework.Sources;
|
||||
using NAppUpdate.Framework.Utils;
|
||||
|
||||
namespace Wox.Core.Updater
|
||||
{
|
||||
internal class WoxUpdateSource : IUpdateSource
|
||||
{
|
||||
public IWebProxy Proxy { get; set; }
|
||||
|
||||
public string FeedUrl { get; set; }
|
||||
|
||||
public WoxUpdateSource(string feedUrl,IWebProxy proxy)
|
||||
{
|
||||
FeedUrl = feedUrl;
|
||||
Proxy = proxy;
|
||||
}
|
||||
|
||||
private void TryResolvingHost()
|
||||
{
|
||||
Uri uri = new Uri(FeedUrl);
|
||||
try
|
||||
{
|
||||
Dns.GetHostEntry(uri.Host);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new WebException(string.Format("Failed to resolve {0}. Check your connectivity.", uri.Host), WebExceptionStatus.ConnectFailure);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetUpdatesFeed()
|
||||
{
|
||||
TryResolvingHost();
|
||||
string str = string.Empty;
|
||||
WebRequest webRequest = WebRequest.Create(FeedUrl);
|
||||
webRequest.Method = "GET";
|
||||
webRequest.Proxy = Proxy;
|
||||
using (WebResponse response = webRequest.GetResponse())
|
||||
{
|
||||
Stream responseStream = response.GetResponseStream();
|
||||
if (responseStream != null)
|
||||
{
|
||||
using (StreamReader streamReader = new StreamReader(responseStream, true))
|
||||
str = streamReader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public bool GetData(string url, string baseUrl, Action<UpdateProgressInfo> onProgress, ref string tempLocation)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(baseUrl) && !baseUrl.EndsWith("/"))
|
||||
baseUrl += "/";
|
||||
FileDownloader fileDownloader = !Uri.IsWellFormedUriString(url, UriKind.Absolute) ? (!Uri.IsWellFormedUriString(baseUrl, UriKind.Absolute) ? (string.IsNullOrEmpty(baseUrl) ? new FileDownloader(url) : new FileDownloader(new Uri(new Uri(baseUrl), url))) : new FileDownloader(new Uri(new Uri(baseUrl, UriKind.Absolute), url))) : new FileDownloader(url);
|
||||
fileDownloader.Proxy = Proxy;
|
||||
if (string.IsNullOrEmpty(tempLocation) || !Directory.Exists(Path.GetDirectoryName(tempLocation)))
|
||||
tempLocation = Path.GetTempFileName();
|
||||
return fileDownloader.DownloadToFile(tempLocation, onProgress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,12 +64,8 @@
|
|||
<Compile Include="..\SolutionAssemblyInfo.cs">
|
||||
<Link>Properties\SolutionAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="APIServer.cs" />
|
||||
<Compile Include="Plugin\ExecutablePlugin.cs" />
|
||||
<Compile Include="Plugin\PluginsLoader.cs" />
|
||||
<Compile Include="Updater\Release.cs" />
|
||||
<Compile Include="Updater\UpdaterManager.cs" />
|
||||
<Compile Include="Updater\WoxUpdateSource.cs" />
|
||||
<Compile Include="UserSettings\HttpProxy.cs" />
|
||||
<Compile Include="Resource\AvailableLanguages.cs" />
|
||||
<Compile Include="Resource\Internationalization.cs" />
|
||||
|
|
@ -90,7 +86,6 @@
|
|||
<Compile Include="UserSettings\PluginSettings.cs" />
|
||||
<Compile Include="UserSettings\PluginHotkey.cs" />
|
||||
<Compile Include="UserSettings\Settings.cs" />
|
||||
<Compile Include="Updater\SemanticVersion.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using System.Windows;
|
|||
using System.Windows.Documents;
|
||||
using Exceptionless;
|
||||
using Wox.Core.Resource;
|
||||
using Wox.Core.Updater;
|
||||
using Wox.Infrastructure;
|
||||
|
||||
namespace Wox.CrashReporter
|
||||
{
|
||||
|
|
@ -23,7 +23,7 @@ namespace Wox.CrashReporter
|
|||
private void SetException(Exception exception)
|
||||
{
|
||||
tbSummary.AppendText(exception.Message);
|
||||
tbVersion.Text = UpdaterManager.Instance.CurrentVersion.ToString();
|
||||
tbVersion.Text = Infrastructure.Wox.Version;
|
||||
tbDatetime.Text = DateTime.Now.ToString();
|
||||
tbStackTrace.AppendText(exception.StackTrace);
|
||||
tbSource.Text = exception.Source;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,10 @@
|
|||
<Project>{B749F0DB-8E75-47DB-9E5E-265D16D0C0D2}</Project>
|
||||
<Name>Wox.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
||||
<Project>{4fd29318-a8ab-4d8f-aa47-60bc241b8da3}</Project>
|
||||
<Name>Wox.Infrastructure</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\crash_warning.png">
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ namespace Wox.Infrastructure.Exception
|
|||
return CreateExceptionReport(exception);
|
||||
}
|
||||
|
||||
//todo log /display line by line
|
||||
private static string CreateExceptionReport(System.Exception ex)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
|
@ -84,7 +85,21 @@ namespace Wox.Infrastructure.Exception
|
|||
sb.Append("* ");
|
||||
sb.Append(ass.FullName);
|
||||
sb.Append(" (");
|
||||
sb.Append(string.IsNullOrEmpty(ass.Location) ? "not supported" : ass.Location);
|
||||
|
||||
if (ass.IsDynamic)
|
||||
{
|
||||
sb.Append("dynamic assembly doesn't has location");
|
||||
}
|
||||
else if (string.IsNullOrEmpty(ass.Location))
|
||||
{
|
||||
sb.Append("location is null or empty");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(ass.Location);
|
||||
|
||||
}
|
||||
sb.AppendLine(")");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,120 +1,79 @@
|
|||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Wox.Infrastructure.Http
|
||||
{
|
||||
public class HttpRequest
|
||||
public static class HttpRequest
|
||||
{
|
||||
public static string Get(string url, IHttpProxy proxy, string encoding = "UTF-8")
|
||||
{
|
||||
return Get(url, encoding, proxy);
|
||||
}
|
||||
|
||||
public static WebProxy GetWebProxy(IHttpProxy proxy)
|
||||
private static WebProxy GetWebProxy(IHttpProxy proxy)
|
||||
{
|
||||
if (proxy != null && proxy.Enabled && !string.IsNullOrEmpty(proxy.Server))
|
||||
{
|
||||
if (string.IsNullOrEmpty(proxy.UserName) || string.IsNullOrEmpty(proxy.Password))
|
||||
{
|
||||
return new WebProxy(proxy.Server, proxy.Port);
|
||||
}
|
||||
|
||||
return new WebProxy(proxy.Server, proxy.Port)
|
||||
{
|
||||
Credentials = new NetworkCredential(proxy.UserName, proxy.Password)
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string Get(string url, string encoding, IHttpProxy proxy)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url)) return string.Empty;
|
||||
|
||||
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
|
||||
request.Method = "GET";
|
||||
request.Timeout = 10 * 1000;
|
||||
request.Proxy = GetWebProxy(proxy);
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
|
||||
if (response != null)
|
||||
{
|
||||
Stream stream = response.GetResponseStream();
|
||||
if (stream != null)
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(stream, Encoding.GetEncoding(encoding)))
|
||||
{
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public static string Post(string url, string jsonData, IHttpProxy proxy)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url)) return string.Empty;
|
||||
|
||||
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
|
||||
request.Method = "POST";
|
||||
request.ContentType = "text/json";
|
||||
request.Timeout = 10 * 1000;
|
||||
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);
|
||||
var webProxy = new WebProxy(proxy.Server, proxy.Port);
|
||||
return webProxy;
|
||||
}
|
||||
else
|
||||
{
|
||||
request.Proxy = new WebProxy(proxy.Server, proxy.Port)
|
||||
var webProxy = new WebProxy(proxy.Server, proxy.Port)
|
||||
{
|
||||
Credentials = new NetworkCredential(proxy.UserName, proxy.Password)
|
||||
};
|
||||
return webProxy;
|
||||
}
|
||||
}
|
||||
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
|
||||
else
|
||||
{
|
||||
streamWriter.Write(jsonData);
|
||||
streamWriter.Flush();
|
||||
streamWriter.Close();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<string> Get([NotNull] string url, IHttpProxy proxy, string encoding = "UTF-8")
|
||||
{
|
||||
|
||||
HttpWebRequest request = WebRequest.CreateHttp(url);
|
||||
request.Method = "GET";
|
||||
request.Timeout = 10 * 1000;
|
||||
request.Proxy = GetWebProxy(proxy);
|
||||
request.UserAgent = @"Mozilla/5.0 (Trident/7.0; rv:11.0) like Gecko";
|
||||
HttpWebResponse response;
|
||||
try
|
||||
{
|
||||
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
|
||||
if (response != null)
|
||||
{
|
||||
Stream stream = response.GetResponseStream();
|
||||
if (stream != null)
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(stream, Encoding.GetEncoding("UTF-8")))
|
||||
{
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
response = await request.GetResponseAsync() as HttpWebResponse;
|
||||
}
|
||||
catch (System.Exception e)
|
||||
catch (WebException e)
|
||||
{
|
||||
Log.Error(e);
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
if (response != null)
|
||||
{
|
||||
var stream = response.GetResponseStream();
|
||||
if (stream != null)
|
||||
{
|
||||
using (var reader = new StreamReader(stream, Encoding.GetEncoding(encoding)))
|
||||
{
|
||||
return await reader.ReadToEndAsync();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -57,6 +57,7 @@
|
|||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
|
|
@ -10,11 +11,13 @@ namespace Wox.Infrastructure
|
|||
public const string Plugins = "Plugins";
|
||||
public const string Settings = "Settings";
|
||||
|
||||
public static readonly string ProgramPath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).ToString();
|
||||
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
|
||||
public static readonly string ProgramPath = Directory.GetParent(Assembly.Location).ToString();
|
||||
public static readonly string DataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Name);
|
||||
public static readonly string UserDirectory = Path.Combine(DataPath, Plugins);
|
||||
public static readonly string PreinstalledDirectory = Path.Combine(ProgramPath, Plugins);
|
||||
public static readonly string SettingsPath = Path.Combine(DataPath, Settings);
|
||||
public const string Github = "https://github.com/Wox-launcher/Wox";
|
||||
public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location).ProductVersion;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
using NUnit.Framework;
|
||||
using Wox.Core.Updater;
|
||||
|
||||
namespace Wox.Test
|
||||
{
|
||||
[TestFixture]
|
||||
public class SemanticVersionTest
|
||||
{
|
||||
[Test]
|
||||
public void CompareTest()
|
||||
{
|
||||
SemanticVersion v1 = new SemanticVersion(1, 1, 0);
|
||||
SemanticVersion v2 = new SemanticVersion(1, 2, 0);
|
||||
SemanticVersion v3 = new SemanticVersion(1, 1, 0);
|
||||
SemanticVersion v4 = new SemanticVersion("1.1.0");
|
||||
Assert.IsTrue(v1 < v2);
|
||||
Assert.IsTrue(v2 > v1);
|
||||
Assert.IsTrue(v1 == v3);
|
||||
Assert.IsTrue(v1.Equals(v3));
|
||||
Assert.IsTrue(v1 == v4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +52,6 @@
|
|||
<Compile Include="Plugins\PluginInitTest.cs" />
|
||||
<Compile Include="QueryTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SemanticVersionTest.cs" />
|
||||
<Compile Include="UrlPluginTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using Squirrel;
|
||||
using Wox.Core.Plugin;
|
||||
|
|
@ -57,14 +58,26 @@ namespace Wox
|
|||
{
|
||||
try
|
||||
{
|
||||
using (Updater = await UpdateManager.GitHubUpdateManager(Infrastructure.Wox.Github, prerelease: true))
|
||||
using (Updater = await UpdateManager.GitHubUpdateManager(Infrastructure.Wox.Github))
|
||||
{
|
||||
await Updater.UpdateApp();
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
Log.Error(ex);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Log.Error(exception);
|
||||
const string info = "Update.exe not found, not a Squirrel-installed app?";
|
||||
if (exception.Message == info)
|
||||
{
|
||||
Log.Warn(info);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Wox.Helper;
|
||||
|
||||
namespace Wox.CommandArgs
|
||||
{
|
||||
internal static class CommandArgsFactory
|
||||
{
|
||||
private static List<ICommandArg> commandArgs;
|
||||
|
||||
static CommandArgsFactory()
|
||||
{
|
||||
var type = typeof(ICommandArg);
|
||||
commandArgs = Assembly.GetExecutingAssembly()
|
||||
.GetTypes()
|
||||
.Where(p => type.IsAssignableFrom(p) && !p.IsInterface)
|
||||
.Select(t => Activator.CreateInstance(t) as ICommandArg).ToList();
|
||||
}
|
||||
|
||||
public static void Execute(IList<string> args)
|
||||
{
|
||||
// todo restart command line args?
|
||||
//if (args.Count > 0 && args[0] != SingleInstance<App>.Restart)
|
||||
if (args.Count > 0)
|
||||
{
|
||||
string command = args[0];
|
||||
ICommandArg cmd = commandArgs.FirstOrDefault(o => o.Command.ToLower() == command);
|
||||
if (cmd != null)
|
||||
{
|
||||
args.RemoveAt(0); //remove command itself
|
||||
cmd.Execute(args);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
App.API.ShowApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Wox.CommandArgs
|
||||
{
|
||||
public class HideStartCommandArg : ICommandArg
|
||||
{
|
||||
public string Command
|
||||
{
|
||||
get { return "hidestart"; }
|
||||
}
|
||||
|
||||
public void Execute(IList<string> args)
|
||||
{
|
||||
//App.Window.ShowApp();
|
||||
//App.Window.HideApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Wox.CommandArgs
|
||||
{
|
||||
interface ICommandArg
|
||||
{
|
||||
string Command { get; }
|
||||
void Execute(IList<string> args);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using Wox.Core.Plugin;
|
||||
|
||||
namespace Wox.CommandArgs
|
||||
{
|
||||
public class InstallPluginCommandArg : ICommandArg
|
||||
{
|
||||
public string Command
|
||||
{
|
||||
get { return "installplugin"; }
|
||||
}
|
||||
|
||||
public void Execute(IList<string> args)
|
||||
{
|
||||
if (args.Count > 0)
|
||||
{
|
||||
var path = args[0];
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
MessageBox.Show("Plugin " + path + " didn't exist");
|
||||
return;
|
||||
}
|
||||
PluginManager.InstallPlugin(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wox.CommandArgs
|
||||
{
|
||||
public class QueryCommandArg : ICommandArg
|
||||
{
|
||||
public string Command
|
||||
{
|
||||
get { return "query"; }
|
||||
}
|
||||
|
||||
public void Execute(IList<string> args)
|
||||
{
|
||||
Console.WriteLine("test");
|
||||
if (args.Count > 0)
|
||||
{
|
||||
string query = args[0];
|
||||
App.API.ChangeQuery(query);
|
||||
}
|
||||
App.API.ShowApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Wox.CommandArgs
|
||||
{
|
||||
public class ToggleCommandArg:ICommandArg
|
||||
{
|
||||
public string Command
|
||||
{
|
||||
get { return "toggle"; }
|
||||
}
|
||||
|
||||
public void Execute(IList<string> args)
|
||||
{
|
||||
if (App.Window.IsVisible)
|
||||
{
|
||||
App.API.HideApp();
|
||||
}
|
||||
else
|
||||
{
|
||||
App.API.ShowApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -78,6 +78,9 @@
|
|||
<system:String x:Key="about">About</system:String>
|
||||
<system:String x:Key="website">Website</system:String>
|
||||
<system:String x:Key="version">Version</system:String>
|
||||
<system:String x:Key="checkUpdates">Check Updates</system:String>
|
||||
<system:String x:Key="newVersionTips">New Version {0} avaiable, please restart</system:String>
|
||||
<system:String x:Key="releaseNotes">Release Notes:</system:String>
|
||||
<system:String x:Key="about_activate_times">You have activated Wox {0} times</system:String>
|
||||
|
||||
<!--Action Keyword Setting Dialog-->
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ using System.Windows.Media.Animation;
|
|||
using System.Windows.Controls;
|
||||
using Wox.Core.Plugin;
|
||||
using Wox.Core.Resource;
|
||||
using Wox.Core.Updater;
|
||||
using Wox.Core.UserSettings;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure.Hotkey;
|
||||
|
|
@ -47,8 +46,6 @@ namespace Wox
|
|||
|
||||
private void OnLoaded(object sender, RoutedEventArgs _)
|
||||
{
|
||||
CheckUpdate();
|
||||
|
||||
InitProgressbarAnimation();
|
||||
WindowIntelopHelper.DisableControlBox(this);
|
||||
|
||||
|
|
@ -110,27 +107,6 @@ namespace Wox
|
|||
return top;
|
||||
}
|
||||
|
||||
private void CheckUpdate()
|
||||
{
|
||||
UpdaterManager.Instance.PrepareUpdateReady += OnPrepareUpdateReady;
|
||||
UpdaterManager.Instance.UpdateError += OnUpdateError;
|
||||
UpdaterManager.Instance.CheckUpdate();
|
||||
}
|
||||
|
||||
void OnUpdateError(object sender, EventArgs e)
|
||||
{
|
||||
string updateError = InternationalizationManager.Instance.GetTranslation("update_wox_update_error");
|
||||
MessageBox.Show(updateError);
|
||||
}
|
||||
|
||||
private void OnPrepareUpdateReady(object sender, EventArgs e)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
new WoxUpdate().ShowDialog();
|
||||
});
|
||||
}
|
||||
|
||||
private void InitProgressbarAnimation()
|
||||
{
|
||||
var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 100, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
|
||||
|
|
|
|||
|
|
@ -68,6 +68,11 @@ namespace Wox
|
|||
|
||||
public void RestarApp()
|
||||
{
|
||||
HideWox();
|
||||
// we must force dispose application
|
||||
// UpdateManager.RestartApp() will call Environment.Exit(0)
|
||||
// which will cause ungraceful exit
|
||||
((IDisposable) Application.Current).Dispose();
|
||||
UpdateManager.RestartApp();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -340,27 +340,42 @@
|
|||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="0" Text="{DynamicResource website}" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="0" HorizontalAlignment="Left" Cursor="Hand"
|
||||
MouseUp="tbWebsite_MouseUp" x:Name="tbWebsite" Foreground="Blue"
|
||||
Text="http://www.getwox.com" />
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="1" Text="{DynamicResource version}" />
|
||||
<StackPanel Grid.Column="1" Grid.Row="1" Orientation="Horizontal">
|
||||
<TextBlock HorizontalAlignment="Left" x:Name="tbVersion" Text="1.0.0" />
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock x:Name="tbActivatedTimes" Grid.Row="2" Grid.ColumnSpan="2"
|
||||
<TextBlock x:Name="ActivatedTimes" Grid.Row="0" Grid.ColumnSpan="3"
|
||||
Text="{DynamicResource about_activate_times}" />
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="1" Text="{DynamicResource website}" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" >
|
||||
<Hyperlink NavigateUri="https://github.com/Wox-launcher/Wox" RequestNavigate="OnRequestNavigate">
|
||||
https://github.com/Wox-launcher/Wox
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="2" Text="{DynamicResource version}" />
|
||||
<TextBlock Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" x:Name="tbVersion" Text="1.0.0" />
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="3" Text="{DynamicResource releaseNotes}"></TextBlock>
|
||||
<TextBlock Grid.Column="1" Grid.Row="3" HorizontalAlignment="Left" >
|
||||
<Hyperlink NavigateUri="https://github.com/Wox-launcher/Wox/releases/latest" RequestNavigate="OnRequestNavigate">
|
||||
https://github.com/Wox-launcher/Wox/releases/latest
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
|
||||
<Button Grid.Column="0" Grid.Row="4" Content="{DynamicResource checkUpdates}" HorizontalAlignment="Left" Margin="10 10 10 10"
|
||||
Click="OnCheckUpdates"/>
|
||||
<TextBlock Grid.Column="1" Grid.Row="4" Name="NewVersionTips" HorizontalAlignment="Left" Text="{DynamicResource newVersionTips}" Visibility="Hidden"/>
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ using System.Diagnostics;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
|
|
@ -11,16 +13,21 @@ using System.Windows.Forms;
|
|||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NHotkey;
|
||||
using NHotkey.Wpf;
|
||||
using Squirrel;
|
||||
using Wox.Core.Plugin;
|
||||
using Wox.Core.Resource;
|
||||
using Wox.Core.Updater;
|
||||
using Wox.Core.UserSettings;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure.Hotkey;
|
||||
using Wox.Infrastructure.Http;
|
||||
using Wox.Infrastructure.Image;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using Wox.Plugin;
|
||||
using Wox.ViewModel;
|
||||
using Application = System.Windows.Forms.Application;
|
||||
|
|
@ -56,9 +63,10 @@ namespace Wox
|
|||
_settings.ProxyEnabled = ToggleProxy.IsChecked ?? false;
|
||||
}
|
||||
|
||||
private void Setting_Loaded(object sender, RoutedEventArgs ev)
|
||||
private async void Setting_Loaded(object sender, RoutedEventArgs ev)
|
||||
{
|
||||
#region General
|
||||
|
||||
cbHideWhenDeactive.Checked += (o, e) =>
|
||||
{
|
||||
_settings.HideWhenDeactive = true;
|
||||
|
|
@ -137,10 +145,10 @@ namespace Wox
|
|||
|
||||
#region About
|
||||
|
||||
tbVersion.Text = UpdaterManager.Instance.CurrentVersion.ToString();
|
||||
string activateTimes = string.Format(InternationalizationManager.Instance.GetTranslation("about_activate_times"),
|
||||
_settings.ActivateTimes);
|
||||
tbActivatedTimes.Text = activateTimes;
|
||||
string activateTimes = string.Format(
|
||||
InternationalizationManager.Instance.GetTranslation("about_activate_times"), _settings.ActivateTimes);
|
||||
ActivatedTimes.Text = activateTimes;
|
||||
tbVersion.Text = Infrastructure.Wox.Version;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -221,7 +229,9 @@ namespace Wox
|
|||
|
||||
private void AddApplicationToStartup()
|
||||
{
|
||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
|
||||
using (
|
||||
RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
|
||||
true))
|
||||
{
|
||||
key.SetValue("Wox", "\"" + Application.ExecutablePath + "\" --hidestart");
|
||||
}
|
||||
|
|
@ -229,7 +239,9 @@ namespace Wox
|
|||
|
||||
private void RemoveApplicationFromStartup()
|
||||
{
|
||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
|
||||
using (
|
||||
RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
|
||||
true))
|
||||
{
|
||||
key.DeleteValue("Wox", false);
|
||||
}
|
||||
|
|
@ -237,7 +249,9 @@ namespace Wox
|
|||
|
||||
private bool CheckApplicationIsStartupWithWindow()
|
||||
{
|
||||
using (RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
|
||||
using (
|
||||
RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
|
||||
true))
|
||||
{
|
||||
return key.GetValue("Wox") != null;
|
||||
}
|
||||
|
|
@ -270,6 +284,7 @@ namespace Wox
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Hotkey
|
||||
|
|
@ -303,7 +318,8 @@ namespace Wox
|
|||
}
|
||||
catch (Exception)
|
||||
{
|
||||
string errorMsg = string.Format(InternationalizationManager.Instance.GetTranslation("registerHotkeyFailed"), hotkeyStr);
|
||||
string errorMsg =
|
||||
string.Format(InternationalizationManager.Instance.GetTranslation("registerHotkeyFailed"), hotkeyStr);
|
||||
MessageBox.Show(errorMsg);
|
||||
}
|
||||
}
|
||||
|
|
@ -332,8 +348,12 @@ namespace Wox
|
|||
return;
|
||||
}
|
||||
|
||||
string deleteWarning = string.Format(InternationalizationManager.Instance.GetTranslation("deleteCustomHotkeyWarning"), item.Hotkey);
|
||||
if (MessageBox.Show(deleteWarning, InternationalizationManager.Instance.GetTranslation("delete"), MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
string deleteWarning =
|
||||
string.Format(InternationalizationManager.Instance.GetTranslation("deleteCustomHotkeyWarning"),
|
||||
item.Hotkey);
|
||||
if (
|
||||
MessageBox.Show(deleteWarning, InternationalizationManager.Instance.GetTranslation("delete"),
|
||||
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
{
|
||||
_settings.CustomPluginHotkeys.Remove(item);
|
||||
lvCustomHotkey.Items.Refresh();
|
||||
|
|
@ -390,22 +410,26 @@ namespace Wox
|
|||
{
|
||||
cbQueryBoxFont.Text = _settings.QueryBoxFont;
|
||||
|
||||
cbQueryBoxFontFaces.SelectedItem = SyntaxSugars.CallOrRescueDefault(() => ((FontFamily)cbQueryBoxFont.SelectedItem).ConvertFromInvariantStringsOrNormal(
|
||||
_settings.QueryBoxFontStyle,
|
||||
_settings.QueryBoxFontWeight,
|
||||
_settings.QueryBoxFontStretch
|
||||
));
|
||||
cbQueryBoxFontFaces.SelectedItem =
|
||||
SyntaxSugars.CallOrRescueDefault(
|
||||
() => ((FontFamily)cbQueryBoxFont.SelectedItem).ConvertFromInvariantStringsOrNormal(
|
||||
_settings.QueryBoxFontStyle,
|
||||
_settings.QueryBoxFontWeight,
|
||||
_settings.QueryBoxFontStretch
|
||||
));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(_settings.ResultFont) &&
|
||||
Fonts.SystemFontFamilies.Count(o => o.FamilyNames.Values.Contains(_settings.ResultFont)) > 0)
|
||||
{
|
||||
ResultFontComboBox.Text = _settings.ResultFont;
|
||||
|
||||
ResultFontFacesComboBox.SelectedItem = SyntaxSugars.CallOrRescueDefault(() => ((FontFamily)ResultFontComboBox.SelectedItem).ConvertFromInvariantStringsOrNormal(
|
||||
_settings.ResultFontStyle,
|
||||
_settings.ResultFontWeight,
|
||||
_settings.ResultFontStretch
|
||||
));
|
||||
ResultFontFacesComboBox.SelectedItem =
|
||||
SyntaxSugars.CallOrRescueDefault(
|
||||
() => ((FontFamily)ResultFontComboBox.SelectedItem).ConvertFromInvariantStringsOrNormal(
|
||||
_settings.ResultFontStyle,
|
||||
_settings.ResultFontWeight,
|
||||
_settings.ResultFontStretch
|
||||
));
|
||||
}
|
||||
|
||||
ResultListBoxPreview.AddResults(new List<Result>
|
||||
|
|
@ -526,7 +550,8 @@ namespace Wox
|
|||
if (!settingsLoaded) return;
|
||||
string resultItemFont = ResultFontComboBox.SelectedItem.ToString();
|
||||
_settings.ResultFont = resultItemFont;
|
||||
ResultFontFacesComboBox.SelectedItem = ((FontFamily)ResultFontComboBox.SelectedItem).ChooseRegularFamilyTypeface();
|
||||
ResultFontFacesComboBox.SelectedItem =
|
||||
((FontFamily)ResultFontComboBox.SelectedItem).ChooseRegularFamilyTypeface();
|
||||
ThemeManager.Instance.ChangeTheme(_settings.Theme);
|
||||
}
|
||||
|
||||
|
|
@ -564,7 +589,8 @@ namespace Wox
|
|||
pluginInitTime.Text =
|
||||
string.Format(InternationalizationManager.Instance.GetTranslation("plugin_init_time"), pair.InitTime);
|
||||
pluginQueryTime.Text =
|
||||
string.Format(InternationalizationManager.Instance.GetTranslation("plugin_query_time"), pair.AvgQueryTime);
|
||||
string.Format(InternationalizationManager.Instance.GetTranslation("plugin_query_time"),
|
||||
pair.AvgQueryTime);
|
||||
if (actionKeywords.Count > 1)
|
||||
{
|
||||
pluginActionKeywordsTitle.Visibility = Visibility.Collapsed;
|
||||
|
|
@ -579,7 +605,8 @@ namespace Wox
|
|||
pluginTitle.Text = pair.Metadata.Name;
|
||||
pluginTitle.Cursor = Cursors.Hand;
|
||||
pluginActionKeywords.Text = string.Join(Query.ActionKeywordSeperater, actionKeywords.ToArray());
|
||||
pluginAuthor.Text = InternationalizationManager.Instance.GetTranslation("author") + ": " + pair.Metadata.Author;
|
||||
pluginAuthor.Text = InternationalizationManager.Instance.GetTranslation("author") + ": " +
|
||||
pair.Metadata.Author;
|
||||
pluginSubTitle.Text = pair.Metadata.Description;
|
||||
pluginId = pair.Metadata.ID;
|
||||
pluginIcon.Source = ImageLoader.Load(pair.Metadata.IcoPath);
|
||||
|
|
@ -651,7 +678,9 @@ namespace Wox
|
|||
ActionKeywords changeKeywordsWindow = new ActionKeywords(id, _settings);
|
||||
changeKeywordsWindow.ShowDialog();
|
||||
PluginPair plugin = PluginManager.GetPluginForId(id);
|
||||
if (plugin != null) pluginActionKeywords.Text = string.Join(Query.ActionKeywordSeperater, pair.Metadata.ActionKeywords.ToArray());
|
||||
if (plugin != null)
|
||||
pluginActionKeywords.Text = string.Join(Query.ActionKeywordSeperater,
|
||||
pair.Metadata.ActionKeywords.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -671,7 +700,8 @@ namespace Wox
|
|||
Process.Start(pair.Metadata.Website);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -692,7 +722,8 @@ namespace Wox
|
|||
Process.Start(pair.Metadata.PluginDirectory);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -719,6 +750,7 @@ namespace Wox
|
|||
#endregion
|
||||
|
||||
#region Proxy
|
||||
|
||||
private void btnSaveProxy_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_settings.ProxyEnabled = ToggleProxy.IsChecked ?? false;
|
||||
|
|
@ -806,7 +838,7 @@ namespace Wox
|
|||
|
||||
private void tbWebsite_MouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
Process.Start("http://www.getwox.com");
|
||||
Process.Start(Infrastructure.Wox.Github);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -820,5 +852,84 @@ namespace Wox
|
|||
}
|
||||
}
|
||||
|
||||
private async void OnCheckUpdates(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var version = await NewVersion();
|
||||
if (!string.IsNullOrEmpty(version))
|
||||
{
|
||||
var newVersion = NumericVersion(version);
|
||||
var oldVersion = NumericVersion(Infrastructure.Wox.Version);
|
||||
if (newVersion > oldVersion)
|
||||
{
|
||||
NewVersionTips.Text = string.Format(NewVersionTips.Text, version);
|
||||
NewVersionTips.Visibility = Visibility.Visible;
|
||||
UpdateApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void UpdateApp()
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var updater = await UpdateManager.GitHubUpdateManager(Infrastructure.Wox.Github))
|
||||
{
|
||||
// todo 5/9 the return value of UpdateApp() is NULL, fucking useless!
|
||||
await updater.UpdateApp();
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
Log.Error(ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex);
|
||||
}
|
||||
}
|
||||
private async Task<string> NewVersion()
|
||||
{
|
||||
const string githubAPI = @"https://api.github.com/repos/wox-launcher/wox/releases/latest";
|
||||
var response = await HttpRequest.Get(githubAPI, HttpProxy.Instance);
|
||||
|
||||
if (!string.IsNullOrEmpty(response))
|
||||
{
|
||||
JContainer json;
|
||||
try
|
||||
{
|
||||
json = (JContainer)JsonConvert.DeserializeObject(response);
|
||||
}
|
||||
catch (JsonSerializationException e)
|
||||
{
|
||||
Log.Error(e);
|
||||
return string.Empty;
|
||||
}
|
||||
var version = json?["tag_name"]?.ToString();
|
||||
if (!string.IsNullOrEmpty(version))
|
||||
{
|
||||
return version;
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private
|
||||
int NumericVersion(string version)
|
||||
{
|
||||
var newVersion = version.Replace("v", ".").Replace(".", "").Replace("*", "");
|
||||
return int.Parse(newVersion);
|
||||
}
|
||||
private void OnRequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ using System.Windows;
|
|||
using System.Windows.Input;
|
||||
using Wox.Core.Plugin;
|
||||
using Wox.Core.Resource;
|
||||
using Wox.Core.Updater;
|
||||
using Wox.Core.UserSettings;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure;
|
||||
|
|
@ -64,7 +63,6 @@ namespace Wox.ViewModel
|
|||
|
||||
// happlebao todo temp fix for instance code logic
|
||||
HttpProxy.Instance.Settings = _settings;
|
||||
UpdaterManager.Instance.Settings = _settings;
|
||||
InternationalizationManager.Instance.Settings = _settings;
|
||||
InternationalizationManager.Instance.ChangeLanguage(_settings.Language);
|
||||
ThemeManager.Instance.Settings = _settings;
|
||||
|
|
|
|||
|
|
@ -157,7 +157,6 @@
|
|||
<Compile Include="..\SolutionAssemblyInfo.cs">
|
||||
<Link>Properties\SolutionAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="CommandArgs\ToggleCommandArg.cs" />
|
||||
<Compile Include="Helper\VisibilityExtensions.cs" />
|
||||
<Compile Include="Helper\SingletonWindowOpener.cs" />
|
||||
<Compile Include="NotifyIconManager.cs" />
|
||||
|
|
@ -172,9 +171,6 @@
|
|||
<Compile Include="ViewModel\MainViewModel.cs" />
|
||||
<Compile Include="ViewModel\ResultViewModel.cs" />
|
||||
<Compile Include="ViewModel\ResultsViewModel.cs" />
|
||||
<Compile Include="WoxUpdate.xaml.cs">
|
||||
<DependentUpon>WoxUpdate.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
|
@ -182,11 +178,6 @@
|
|||
<Compile Include="ActionKeywords.xaml.cs">
|
||||
<DependentUpon>ActionKeywords.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CommandArgs\CommandArgsFactory.cs" />
|
||||
<Compile Include="CommandArgs\HideStartCommandArg.cs" />
|
||||
<Compile Include="CommandArgs\ICommandArg.cs" />
|
||||
<Compile Include="CommandArgs\InstallPluginCommandArg.cs" />
|
||||
<Compile Include="CommandArgs\QueryCommandArg.cs" />
|
||||
<Compile Include="Helper\DataWebRequestFactory.cs" />
|
||||
<Compile Include="Helper\ErrorReporting.cs" />
|
||||
<Compile Include="Helper\SingleInstance.cs" />
|
||||
|
|
@ -332,10 +323,6 @@
|
|||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Page>
|
||||
<Page Include="WoxUpdate.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
|
|
@ -418,29 +405,31 @@
|
|||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy /Y $(ProjectDir)Themes\* $(TargetDir)Themes\
|
||||
xcopy /Y /E $(ProjectDir)Images\* $(TargetDir)Images\
|
||||
xcopy /Y /D /E $(SolutionDir)Plugins\HelloWorldPython\* $(TargetDir)Plugins\HelloWorldPython\*
|
||||
|
||||
<PostBuildEvent>
|
||||
xcopy /Y $(ProjectDir)Themes\* $(TargetDir)Themes\
|
||||
xcopy /Y /E $(ProjectDir)Images\* $(TargetDir)Images\
|
||||
xcopy /Y /D /E $(SolutionDir)Plugins\HelloWorldPython\* $(TargetDir)Plugins\HelloWorldPython\*
|
||||
|
||||
|
||||
if $(ConfigurationName) == Release (
|
||||
cd "$(TargetDir)Plugins" & del /s /q NLog.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q NLog.config
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Plugin.pdb
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Plugin.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Core.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Core.pdb
|
||||
cd "$(TargetDir)Plugins" & del /s /q ICSharpCode.SharpZipLib.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q NAppUpdate.Framework.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Infrastructure.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Infrastructure.pdb
|
||||
cd "$(TargetDir)Plugins" & del /s /q Newtonsoft.Json.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q JetBrains.Annotations.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Pinyin4Net.dll
|
||||
|
||||
cd "$(TargetDir)" & del /s /q *.xml
|
||||
)</PostBuildEvent>
|
||||
if $(ConfigurationName) == Release (
|
||||
cd "$(TargetDir)Plugins" & del /s /q NLog.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q NLog.config
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Plugin.pdb
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Plugin.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Core.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Core.pdb
|
||||
cd "$(TargetDir)Plugins" & del /s /q ICSharpCode.SharpZipLib.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q NAppUpdate.Framework.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Infrastructure.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Infrastructure.pdb
|
||||
cd "$(TargetDir)Plugins" & del /s /q Newtonsoft.Json.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q JetBrains.Annotations.dll
|
||||
cd "$(TargetDir)Plugins" & del /s /q Pinyin4Net.dll
|
||||
|
||||
cd "$(TargetDir)" & del /s /q *.xml
|
||||
)
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
|
|
@ -448,9 +437,14 @@ cd "$(TargetDir)" & del /s /q *.xml
|
|||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
!-->
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release' And '$(APPVEYOR_BUILD_FOLDER)' == '' ">
|
||||
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
|
||||
<Output TaskParameter="Assemblies" ItemName="myAssemblyInfo" />
|
||||
</GetAssemblyIdentity>
|
||||
<Exec Command="nuget pack $(SolutionDir)Deploy\wox.nuspec -Version %(myAssemblyInfo.Version) -Properties Configuration=Release -OutputDirectory $(TargetDir) -BasePath $(TargetDir)" />
|
||||
<Exec Command="squirrel --releasify $(TargetDir)Wox.%(myAssemblyInfo.Version).nupkg --releaseDir $(TargetDir)Installer --no-msi" />
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
<Window x:Class="Wox.WoxUpdate"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Icon="Images/app.png"
|
||||
Topmost="True"
|
||||
ResizeMode="NoResize"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Title="{DynamicResource update_wox_update}" Height="400" Width="600">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="80" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<Image Source="Images/update.png" Width="64" />
|
||||
<TextBlock x:Name="tbNewVersionAvailable" Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" FontSize="20"
|
||||
Text="{DynamicResource update_wox_update_new_version_available}" />
|
||||
<TabControl Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2">
|
||||
<TabItem Header="{DynamicResource update_wox_update_upadte_description}">
|
||||
<WebBrowser x:Name="wbDetails" Grid.Row="1" />
|
||||
</TabItem>
|
||||
<TabItem Header="{DynamicResource update_wox_update_files}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Padding="8" Text="{DynamicResource update_wox_update_upadte_files}" />
|
||||
<ListBox x:Name="lbUpdatedFiles" Grid.Row="1" />
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<StackPanel Grid.Column="1" Grid.Row="4" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<TextBlock Foreground="Gray" TextAlignment="Center" Margin="0 0 10 0" VerticalAlignment="Center"
|
||||
Text="{DynamicResource update_wox_update_restart_wox_tip}" />
|
||||
<Button x:Name="btnUpdate" Padding="8 3" Margin="8" Click="btnUpdate_Click"
|
||||
Content="{DynamicResource update_wox_update}" />
|
||||
<Button x:Name="btnCancel" Padding="8 3" Margin="8" Click="btnCancel_Click"
|
||||
Content="{DynamicResource update_wox_update_cancel}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
using System.Windows;
|
||||
using MarkdownSharp;
|
||||
using Wox.Core.Resource;
|
||||
using Wox.Core.Updater;
|
||||
|
||||
namespace Wox
|
||||
{
|
||||
public partial class WoxUpdate : Window
|
||||
{
|
||||
public WoxUpdate()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
string newVersionAvailable = string.Format(
|
||||
InternationalizationManager.Instance.GetTranslation("update_wox_update_new_version_available"),
|
||||
UpdaterManager.Instance.NewRelease);
|
||||
tbNewVersionAvailable.Text = newVersionAvailable;
|
||||
Markdown markdown = new Markdown();
|
||||
wbDetails.NavigateToString(markdown.Transform(UpdaterManager.Instance.NewRelease.description));
|
||||
lbUpdatedFiles.ItemsSource = UpdaterManager.Instance.GetAvailableUpdateFiles();
|
||||
}
|
||||
|
||||
private void btnUpdate_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UpdaterManager.Instance.ApplyUpdates();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UpdaterManager.Instance.CleanUp();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
|
||||
<package id="NHotkey" version="1.2.1" targetFramework="net452" />
|
||||
<package id="NHotkey.Wpf" version="1.2.1" targetFramework="net452" />
|
||||
<package id="NuGet.CommandLine" version="3.4.3" targetFramework="net452" developmentDependency="true" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net452" />
|
||||
<package id="Splat" version="1.6.2" targetFramework="net452" />
|
||||
<package id="squirrel.windows" version="1.4.0" targetFramework="net452" />
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ assembly_info:
|
|||
file: AssemblyInfo.*
|
||||
assembly_version: '{version}'
|
||||
assembly_file_version: '{version}'
|
||||
assembly_informational_version: '{version}-$(APPVEYOR_REPO_COMMIT)'
|
||||
assembly_informational_version: '{version}'
|
||||
before_build:
|
||||
- ps: nuget restore
|
||||
build:
|
||||
|
|
@ -17,7 +17,7 @@ after_test:
|
|||
.\Deploy\nuget.ps1
|
||||
|
||||
.\Deploy\binary_zip.ps1
|
||||
|
||||
|
||||
.\Deploy\squirrel_installer.ps1
|
||||
artifacts:
|
||||
- path: 'Wox-*.zip'
|
||||
|
|
|
|||
Loading…
Reference in a new issue