Merge branch 'master' into dev

This commit is contained in:
bao-qian 2017-04-07 11:55:56 +01:00
commit 16531653ab
27 changed files with 326 additions and 266 deletions

1
.gitignore vendored
View File

@ -289,6 +289,7 @@ paket-files/
Output/*
/Python.Runtime.dll
Thumbs.db
RELEASES
*.sublime-*

View File

@ -1,9 +0,0 @@
$sourceDirectoryName = $env:APPVEYOR_BUILD_FOLDER + "\Output\Release"
$fileName = $env:APPVEYOR_BUILD_FOLDER + "\Wox-$env:APPVEYOR_BUILD_VERSION.zip"
$currentPath = Convert-Path .
Write-Host "Current path: " + $currentPath
Write-Host "Target path: " + $sourceDirectoryName
[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem")
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourceDirectoryName, $fileName)

View File

@ -1,7 +0,0 @@
$path = $env:APPVEYOR_BUILD_FOLDER + "\Deploy\wox.plugin.nuspec"
$currentPath = Convert-Path .
Write-Host "Current path:" + $currentPath
Write-Host "nuspec path:" + $path
& nuget pack $path -Version $env:APPVEYOR_BUILD_VERSION

View File

@ -1,21 +0,0 @@
# 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
$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
# must use Squirrel.com, Squirrel.exe will produce nothing
$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
$path = "Releases\" + "Wox-" + $env:APPVEYOR_BUILD_VERSION + ".exe"
mv Releases\Setup.exe $path

View File

@ -1,8 +1,8 @@
## Known problems for 1.3.183:
1. `System.NullReferenceException`: https://github.com/Wox-launcher/Wox/releases/tag/v1.3.357
1. `System.NullReferenceException`: https://github.com/Wox-launcher/Wox/releases/tag/v1.3.424
2. `System.UriFormatException`: delete your old theme file
3. `System.Threading.Tasks.TaskCanceledException`: 设置 http 代理
3. `System.Threading.Tasks.TaskCanceledException`: https://github.com/Wox-launcher/Wox/releases/tag/v1.3.424
## English

View File

@ -146,7 +146,20 @@ namespace Wox.Plugin.Program.Programs
var support = Environment.OSVersion.Version.Major >= windows10.Major;
if (support)
{
var applications = CurrentUserPackages().AsParallel().SelectMany(p => new UWP(p).Apps).ToArray();
var applications = CurrentUserPackages().AsParallel().SelectMany(p =>
{
UWP u;
try
{
u = new UWP(p);
}
catch (Exception e)
{
Log.Exception($"|UWP.All|Can't convert Package to UWP for <{p.Id.FullName}>:", e);
return new Application[] { };
}
return u.Apps;
}).ToArray();
return applications;
}
else
@ -157,17 +170,31 @@ namespace Wox.Plugin.Program.Programs
private static IEnumerable<Package> CurrentUserPackages()
{
var user = WindowsIdentity.GetCurrent().User;
var u = WindowsIdentity.GetCurrent().User;
if (user != null)
if (u != null)
{
var userSecurityId = user.Value;
var packageManager = new PackageManager();
var packages = packageManager.FindPackagesForUser(userSecurityId);
packages =
packages.Where(
p => !p.IsFramework && !p.IsDevelopmentMode && !string.IsNullOrEmpty(p.InstalledLocation.Path));
return packages;
var id = u.Value;
var m = new PackageManager();
var ps = m.FindPackagesForUser(id);
ps = ps.Where(p =>
{
bool valid;
try
{
var f = p.IsFramework;
var d = p.IsDevelopmentMode;
var path = p.InstalledLocation.Path;
valid = !f && !d && !string.IsNullOrEmpty(path);
}
catch (Exception e)
{
Log.Exception($"|UWP.CurrentUserPackages|Can't get package info for <{p.Id.FullName}>", e);
valid = false;
}
return valid;
});
return ps;
}
else
{

View File

@ -52,6 +52,12 @@ Contribution
- I'd appreciate if you could solve [help_needed](https://github.com/Wox-launcher/Wox/issues?q=is%3Aopen+is%3Aissue+label%3Ahelp_needed) labeled issue
- Don't hesitate to ask questions in the [issues](https://github.com/Wox-launcher/Wox/issues)
Build
-----
1. Install Visual Studio 2015 and tick all Windows 10 sdk options
2. Open powershell with admin permission and `Set-ExecutionPolicy Unrestricted -Scope CurrentUser`
Documentation
-------------
- [Wiki](https://github.com/Wox-launcher/Wox/wiki)

140
Scripts/post_build.ps1 Normal file
View File

@ -0,0 +1,140 @@
param(
[string]$config = "Release",
[string]$solution
)
Write-Host "Config: $config"
function Build-Version {
if ([string]::IsNullOrEmpty($env:APPVEYOR_BUILD_VERSION)) {
$v = "1.2.0"
} else {
$v = $env:APPVEYOR_BUILD_VERSION
}
Write-Host "Build Version: $v"
return $v
}
function Build-Path {
if (![string]::IsNullOrEmpty($env:APPVEYOR_BUILD_FOLDER)) {
$p = $env:APPVEYOR_BUILD_FOLDER
} elseif (![string]::IsNullOrEmpty($solution)) {
$p = $solution
} else {
$p = Get-Location
}
Write-Host "Build Folder: $p"
Set-Location $p
return $p
}
function Copy-Resources ($path, $config) {
$project = "$path\Wox"
$output = "$path\Output"
$target = "$output\$config"
Copy-Item -Recurse -Force $project\Themes\* $target\Themes\
Copy-Item -Recurse -Force $project\Images\* $target\Images\
Copy-Item -Recurse -Force $path\Plugins\HelloWorldPython $target\Plugins\HelloWorldPython
Copy-Item -Recurse -Force $path\JsonRPC $target\JsonRPC
Copy-Item -Force $path\packages\squirrel*\tools\Squirrel.exe $output\Update.exe
}
function Delete-Unused ($path, $config) {
$target = "$path\Output\$config"
$included = Get-ChildItem $target -Filter "*.dll"
foreach ($i in $included){
Remove-Item -Path $target\Plugins -Include $i -Recurse
Write-Host "Deleting duplicated $i"
}
Remove-Item -Path $target -Include "*.xml" -Recurse
}
function Validate-Directory ($output) {
New-Item $output -ItemType Directory -Force
}
function Pack-Nuget ($path, $version, $output) {
Write-Host "Begin build nuget library"
$spec = "$path\Scripts\wox.plugin.nuspec"
Write-Host "nuspec path: $spec"
Write-Host "Output path: $output"
Nuget pack $spec -Version $version -OutputDirectory $output
Write-Host "End build nuget library"
}
function Zip-Release ($path, $version, $output) {
Write-Host "Begin zip release"
$input = "$path\Output\Release"
Write-Host "Input path: $input"
$file = "$output\Wox-$version.zip"
Write-Host "Filename: $file"
[Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem")
[System.IO.Compression.ZipFile]::CreateFromDirectory($input, $file)
Write-Host "End zip release"
}
function Pack-Squirrel-Installer ($path, $version, $output) {
# msbuild based installer generation is not working in appveyor, not sure why
Write-Host "Begin pack squirrel installer"
$spec = "$path\Scripts\wox.nuspec"
Write-Host "nuspec path: $spec"
$input = "$path\Output\Release"
Write-Host "Input path: $input"
Nuget pack $spec -Version $version -Properties Configuration=Release -BasePath $input -OutputDirectory $output
$nupkg = "$output\Wox.$version.nupkg"
Write-Host "nupkg path: $nupkg"
$icon = "$path\Wox\Resources\app.ico"
Write-Host "icon: $icon"
# Squirrel.com: https://github.com/Squirrel/Squirrel.Windows/issues/369
New-Alias Squirrel $path\packages\squirrel*\tools\Squirrel.exe -Force
# why we need Write-Output: https://github.com/Squirrel/Squirrel.Windows/issues/489#issuecomment-156039327
# directory of releaseDir in fucking squirrel can't be same as directory ($nupkg) in releasify
$temp = "$output\Temp"
Squirrel --releasify $nupkg --releaseDir $temp --setupIcon $icon --no-msi | Write-Output
Move-Item $temp\* $output -Force
Remove-Item $temp
$file = "$output\Wox-$version.exe"
Write-Host "Filename: $file"
Move-Item "$output\Setup.exe" $file -Force
Write-Host "End pack squirrel installer"
}
function Main {
$p = Build-Path
$v = Build-Version
Copy-Resources $p $config
if ($config -eq "Release"){
Delete-Unused $p $config
$o = "$p\Output\Packages"
Validate-Directory $o
New-Alias Nuget $p\packages\NuGet.CommandLine.*\tools\NuGet.exe -Force
Pack-Squirrel-Installer $p $v $o
$isInCI = $env:APPVEYOR
if ($isInCI) {
Pack-Nuget $p $v $o
Zip-Release $p $v $o
}
Write-Host "List output directory"
Get-ChildItem $o
}
}
Main

View File

@ -1,13 +1,14 @@
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Sockets;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using JetBrains.Annotations;
using Squirrel;
using Newtonsoft.Json;
using Wox.Core.Resource;
using Wox.Infrastructure;
using Wox.Infrastructure.Http;
@ -17,107 +18,95 @@ namespace Wox.Core
{
public static class Updater
{
private static readonly Internationalization Translater = InternationalizationManager.Instance;
public static async Task UpdateApp()
{
var c = new WebClient { Proxy = Http.WebProxy() };
var d = new FileDownloader(c);
UpdateManager m;
UpdateInfo u;
try
{
const string url = Constant.Github;
// UpdateApp() will return value only if the app is squirrel installed
using (var m = await UpdateManager.GitHubUpdateManager(url, urlDownloader: d))
{
var e = await m.CheckForUpdate();
var fe = e.FutureReleaseEntry;
var ce = e.CurrentlyInstalledVersion;
if (fe.Version > ce.Version)
{
var t = NewVersinoTips(fe.Version.ToString());
MessageBox.Show(t);
await m.DownloadReleases(e.ReleasesToApply);
await m.ApplyReleases(e);
await m.CreateUninstallerRegistryEntry();
Log.Info($"|Updater.UpdateApp|TEST <{e.Formatted()}>");
Log.Info($"|Updater.UpdateApp|TEST <{fe.Formatted()}>");
Log.Info($"|Updater.UpdateApp|TEST <{ce.Formatted()}>");
Log.Info($"|Updater.UpdateApp|TEST <{e.ReleasesToApply.Formatted()}>");
Log.Info($"|Updater.UpdateApp|TEST <{t.Formatted()}>");
}
}
m = await GitHubUpdateManager(Constant.Repository);
}
catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException)
{
Log.Exception("|Updater.UpdateApp|Network error", e);
Log.Exception($"|Updater.UpdateApp|Please check your connection and proxy settings to api.github.com.", e);
return;
}
catch (Exception e)
{
const string info = "Update.exe not found, not a Squirrel-installed app?";
if (e.Message == info)
{
Log.Error($"|Updater.UpdateApp|{info}");
}
else
{
throw;
}
}
}
public static async Task<string> NewVersion()
{
const string githubAPI = @"https://api.github.com/repos/wox-launcher/wox/releases/latest";
string response;
try
{
response = await Http.Get(githubAPI);
// UpdateApp CheckForUpdate will return value only if the app is squirrel installed
u = await m.CheckForUpdate().NonNull();
}
catch (WebException e)
catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException)
{
Log.Exception("|Updater.NewVersion|Can't connect to github api to check new version", e);
return string.Empty;
Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to api.github.com.", e);
m.Dispose();
return;
}
if (!string.IsNullOrEmpty(response))
var fr = u.FutureReleaseEntry;
var cr = u.CurrentlyInstalledVersion;
Log.Info($"|Updater.UpdateApp|Future Release <{fr.Formatted()}>");
if (fr.Version > cr.Version)
{
JContainer json;
try
{
json = (JContainer)JsonConvert.DeserializeObject(response);
await m.DownloadReleases(u.ReleasesToApply);
}
catch (JsonSerializationException e)
catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException)
{
Log.Exception("|Updater.NewVersion|can't parse response", e);
return string.Empty;
}
var version = json?["tag_name"]?.ToString();
if (!string.IsNullOrEmpty(version))
{
return version;
}
else
{
Log.Warn("|Updater.NewVersion|Can't find tag_name from Github API response");
return string.Empty;
Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
m.Dispose();
return;
}
await m.ApplyReleases(u);
await m.CreateUninstallerRegistryEntry();
var newVersionTips = Translater.GetTranslation("newVersionTips");
newVersionTips = string.Format(newVersionTips, fr.Version);
MessageBox.Show(newVersionTips);
Log.Info($"|Updater.UpdateApp|Update succeed:{newVersionTips}");
}
else
{
Log.Warn("|Updater.NewVersion|Can't get response from Github API");
return string.Empty;
}
// always dispose UpdateManager
m.Dispose();
}
public static int NumericVersion(string version)
[UsedImplicitly]
private class GithubRelease
{
var newVersion = version.Replace("v", ".").Replace(".", "").Replace("*", "");
return int.Parse(newVersion);
[JsonProperty("prerelease")]
public bool Prerelease { get; [UsedImplicitly] set; }
[JsonProperty("published_at")]
public DateTime PublishedAt { get; [UsedImplicitly] set; }
[JsonProperty("html_url")]
public string HtmlUrl { get; [UsedImplicitly] set; }
}
/// https://github.com/Squirrel/Squirrel.Windows/blob/master/src/Squirrel/UpdateManager.Factory.cs
private static async Task<UpdateManager> GitHubUpdateManager(string repository)
{
var uri = new Uri(repository);
var api = $"https://api.github.com/repos{uri.AbsolutePath}/releases";
var json = await Http.Get(api);
var releases = JsonConvert.DeserializeObject<List<GithubRelease>>(json);
var latest = releases.Where(r => !r.Prerelease).OrderByDescending(r => r.PublishedAt).First();
var latestUrl = latest.HtmlUrl.Replace("/tag/", "/download/");
var client = new WebClient { Proxy = Http.WebProxy() };
var downloader = new FileDownloader(client);
var manager = new UpdateManager(latestUrl, urlDownloader: downloader);
return manager;
}
public static string NewVersinoTips(string version)
@ -128,4 +117,4 @@ namespace Wox.Core
}
}
}
}

View File

@ -1,8 +1,10 @@
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Wox.Infrastructure.Logger;
using Wox.Infrastructure.UserSettings;
namespace Wox.Infrastructure.Http
@ -36,7 +38,6 @@ namespace Wox.Infrastructure.Http
}
}
/// <exception cref="WebException">Can't download file </exception>
public static void Download([NotNull] string url, [NotNull] string filePath)
{
var client = new WebClient { Proxy = WebProxy() };
@ -44,35 +45,30 @@ namespace Wox.Infrastructure.Http
client.DownloadFile(url, filePath);
}
/// <exception cref="WebException">Can't get response from http get </exception>
public static async Task<string> Get([NotNull] string url, string encoding = "UTF-8")
{
HttpWebRequest request = WebRequest.CreateHttp(url);
Log.Debug($"|Http.Get|Url <{url}>");
var request = WebRequest.CreateHttp(url);
request.Method = "GET";
request.Timeout = 10 * 1000;
request.Timeout = 1000;
request.Proxy = WebProxy();
request.UserAgent = UserAgent;
var response = await request.GetResponseAsync() as HttpWebResponse;
if (response != null)
response = response.NonNull();
var stream = response.GetResponseStream().NonNull();
using (var reader = new StreamReader(stream, Encoding.GetEncoding(encoding)))
{
var stream = response.GetResponseStream();
if (stream != null)
var content = await reader.ReadToEndAsync();
if (response.StatusCode == HttpStatusCode.OK)
{
using (var reader = new StreamReader(stream, Encoding.GetEncoding(encoding)))
{
return await reader.ReadToEndAsync();
}
return content;
}
else
{
return string.Empty;
throw new HttpRequestException($"Error code <{response.StatusCode}> with content <{content}> returned from <{url}>");
}
}
else
{
return string.Empty;
}
}
}
}

View File

@ -93,6 +93,7 @@ namespace Wox.Infrastructure.Logger
logger.Error($"Exception stack trace:\n <{e.StackTrace}>");
logger.Error($"Exception source:\n <{e.Source}>");
logger.Error($"Exception target site:\n <{e.TargetSite}>");
logger.Error($"Exception HResult:\n <{e.HResult}>");
e = e.InnerException;
} while (e != null);

View File

@ -11,14 +11,14 @@ namespace Wox.Infrastructure
public const string Plugins = "Plugins";
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
public static readonly string ProgramDirectory = Directory.GetParent(Assembly.Location).ToString();
public static readonly string ProgramDirectory = Directory.GetParent(Assembly.Location.NonNull()).ToString();
public static readonly string ExecutablePath = Path.Combine(ProgramDirectory, Wox + ".exe");
public static readonly string DataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Wox);
public static readonly string PluginsDirectory = Path.Combine(DataDirectory, Plugins);
public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
public const string Github = "https://github.com/Wox-launcher/Wox";
public const string Repository = "https://github.com/Wox-launcher/Wox";
public const string Issue = "https://github.com/Wox-launcher/Wox/issues/new";
public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location).ProductVersion;
public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location.NonNull()).ProductVersion;
public static readonly string DefaultIcon = Path.Combine(ProgramDirectory, "Images", "app.png");
public static readonly string ErrorIcon = Path.Combine(ProgramDirectory, "Images", "app_error.png");

View File

@ -58,9 +58,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.gitignore = .gitignore
appveyor.yml = appveyor.yml
LICENSE = LICENSE
Performance1.psess = Performance1.psess
Scripts\post_build.ps1 = Scripts\post_build.ps1
README.md = README.md
SolutionAssemblyInfo.cs = SolutionAssemblyInfo.cs
Scripts\wox.nuspec = Scripts\wox.nuspec
Scripts\wox.plugin.nuspec = Scripts\wox.plugin.nuspec
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorldCSharp", "Plugins\HelloWorldCSharp\HelloWorldCSharp.csproj", "{03FFA443-5F50-48D5-8869-F3DF316803AA}"

View File

@ -29,8 +29,6 @@ namespace Wox
[STAThread]
public static void Main()
{
RegisterAppDomainExceptions();
if (SingleInstance<App>.InitializeAsFirstInstance(Unique))
{
using (var application = new App())
@ -46,6 +44,8 @@ namespace Wox
Stopwatch.Normal("|App.OnStartup|Startup cost", () =>
{
Log.Info("|App.OnStartup|Begin Wox startup ----------------------------------------------------");
Log.Info($"|App.OnStartup|Runtime info:{ErrorReporting.RuntimeInfo()}");
RegisterAppDomainExceptions();
RegisterDispatcherUnhandledException();
ImageLoader.Initialize();
@ -59,6 +59,7 @@ namespace Wox
var window = new MainWindow(_settings, _mainVM);
API = new PublicAPIInstance(_settingsVM, _mainVM);
PluginManager.InitializePlugins(API);
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");
Current.MainWindow = window;
Current.MainWindow.Title = Constant.Wox;
@ -140,8 +141,10 @@ namespace Wox
private static void RegisterAppDomainExceptions()
{
AppDomain.CurrentDomain.UnhandledException += ErrorReporting.UnhandledExceptionHandle;
AppDomain.CurrentDomain.FirstChanceException +=
(s, e) => { Log.Exception("|App.RegisterAppDomainExceptions|First Chance Exception:", e.Exception); };
AppDomain.CurrentDomain.FirstChanceException += (_, e) =>
{
Log.Exception("|App.RegisterAppDomainExceptions|First Chance Exception:", e.Exception);
};
}
public void Dispose()

View File

@ -1,26 +0,0 @@
using System;
namespace Wox
{
public class CrashReporter
{
private Exception exception;
public CrashReporter(Exception e)
{
exception = e;
}
public void Show()
{
if (exception == null) return;
if (exception.InnerException != null)
{
exception = exception.InnerException;
}
ReportWindow reportWindow = new ReportWindow(exception);
reportWindow.Show();
}
}
}

View File

@ -1,35 +1,49 @@
using System;
using System.Windows;
using System.Windows.Threading;
using NLog;
using Wox.Infrastructure;
using Wox.Infrastructure.Exception;
namespace Wox.Helper
{
public static class ErrorReporting
{
public static void Report(Exception e)
private static void Report(Exception e)
{
var logger = LogManager.GetLogger("UnHandledException");
logger.Fatal(ExceptionFormatter.FormatExcpetion(e));
new CrashReporter(e).Show();
var reportWindow = new ReportWindow(e);
reportWindow.Show();
}
public static void UnhandledExceptionHandle(object sender, UnhandledExceptionEventArgs e)
{
//handle non-ui thread exceptions
Application.Current.MainWindow.Dispatcher.Invoke(() =>
{
Report((Exception)e.ExceptionObject);
});
Report((Exception)e.ExceptionObject);
}
public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
//handle ui thread exceptions
Report(e.Exception);
//prevent crash
//prevent application exist, so the user can copy prompted error info
e.Handled = true;
}
public static string RuntimeInfo()
{
var info = $"\nWox version: {Constant.Version}" +
$"\nOS Version: {Environment.OSVersion.VersionString}" +
$"\nIntPtr Length: {IntPtr.Size}" +
$"\nx64: {Environment.Is64BitOperatingSystem}";
return info;
}
public static string DependenciesInfo()
{
var info = $"\nPython Path: {Constant.PythonPath}" +
$"\nEverything SDK Path: {Constant.EverythingSDKPath}";
return info;
}
}
}

View File

@ -84,7 +84,12 @@
<system:String x:Key="version">Version</system:String>
<system:String x:Key="about_activate_times">You have activated Wox {0} times</system:String>
<system:String x:Key="checkUpdates">Check for Updates</system:String>
<system:String x:Key="newVersionTips">New version {0} is available, please restart Wox</system:String>
<system:String x:Key="newVersionTips">New version {0} is available, please restart Wox.</system:String>
<system:String x:Key="checkUpdatesFailed">Check updates failed, please check your connection and proxy settings to api.github.com.</system:String>
<system:String x:Key="downloadUpdatesFailed">
Download updates failed, please check your connection and proxy settings to github-cloud.s3.amazonaws.com,
or go to https://github.com/Wox-launcher/Wox/releases to download updates manually.
</system:String>
<system:String x:Key="releaseNotes">Release Notes:</system:String>
<!--Action Keyword Setting Dialog-->

View File

@ -84,7 +84,7 @@
<system:String x:Key="version">版本</system:String>
<system:String x:Key="about_activate_times">你已经激活了Wox {0} 次</system:String>
<system:String x:Key="checkUpdates">检查更新</system:String>
<system:String x:Key="newVersionTips">发现新版本 {0} , 请重启 wox</system:String>
<system:String x:Key="newVersionTips">发现新版本 {0} , 请重启 wox</system:String>
<system:String x:Key="releaseNotes">更新说明:</system:String>
<!--Action Keyword 设置对话框-->

View File

@ -80,7 +80,7 @@
<system:String x:Key="version">版本</system:String>
<system:String x:Key="about_activate_times">您已經啟動了 Wox {0} 次</system:String>
<system:String x:Key="checkUpdates">檢查更新</system:String>
<system:String x:Key="newVersionTips">發現有新版本 {0} , 請重新啟動 Wox</system:String>
<system:String x:Key="newVersionTips">發現有新版本 {0} 請重新啟動 Wox。</system:String>
<system:String x:Key="releaseNotes">更新說明:</system:String>
<!--Action Keyword 設定對話框-->

View File

@ -6,6 +6,7 @@ using System.Text;
using System.Linq;
using System.Windows;
using System.Windows.Documents;
using Wox.Helper;
using Wox.Infrastructure;
using Wox.Infrastructure.Logger;
@ -26,18 +27,14 @@ namespace Wox
var directory = new DirectoryInfo(path);
var log = directory.GetFiles().OrderByDescending(f => f.LastWriteTime).First();
var paragraph = Hyperlink("Please open new issue in: " , Constant.Issue);
var paragraph = Hyperlink("Please open new issue in: ", Constant.Issue);
paragraph.Inlines.Add($"1. upload log file: {log.FullName}\n");
paragraph.Inlines.Add($"2. copy below exception message");
ErrorTextbox.Document.Blocks.Add(paragraph);
StringBuilder content = new StringBuilder();
content.AppendLine($"Wox version: {Constant.Version}");
content.AppendLine($"OS Version: {Environment.OSVersion.VersionString}");
content.AppendLine($"IntPtr Length: {IntPtr.Size}");
content.AppendLine($"x64: {Environment.Is64BitOperatingSystem}");
content.AppendLine($"Python Path: {Constant.PythonPath}");
content.AppendLine($"Everything SDK Path: {Constant.EverythingSDKPath}");
content.AppendLine(ErrorReporting.RuntimeInfo());
content.AppendLine(ErrorReporting.DependenciesInfo());
content.AppendLine($"Date: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
content.AppendLine("Exception:");
content.AppendLine(exception.Source);
@ -54,7 +51,7 @@ namespace Wox
var paragraph = new Paragraph();
paragraph.Margin = new Thickness(0);
var link = new Hyperlink {IsEnabled = true};
var link = new Hyperlink { IsEnabled = true };
link.Inlines.Add(url);
link.NavigateUri = new Uri(url);
link.RequestNavigate += (s, e) => Process.Start(e.Uri.ToString());

View File

@ -384,8 +384,6 @@
<Button Grid.Row="4" Grid.Column="0"
Content="{DynamicResource checkUpdates}" Click="OnCheckUpdates"
HorizontalAlignment="Left" Margin="10 10 10 10" />
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding NewVersionTips}"
HorizontalAlignment="Left" Visibility="{Binding NewVersionTipsVisibility}" />
</Grid>
</TabItem>
</TabControl>

View File

@ -272,7 +272,7 @@ namespace Wox
return;
}
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Infrastructure.Constant.Github);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Infrastructure.Constant.Repository);
if (string.IsNullOrEmpty(_settings.Proxy.UserName) || string.IsNullOrEmpty(_settings.Proxy.Password))
{
request.Proxy = new WebProxy(_settings.Proxy.Server, _settings.Proxy.Port);
@ -306,17 +306,7 @@ namespace Wox
private async void OnCheckUpdates(object sender, RoutedEventArgs e)
{
var version = await Updater.NewVersion();
if (!string.IsNullOrEmpty(version))
{
var newVersion = Updater.NumericVersion(version);
var oldVersion = Updater.NumericVersion(Infrastructure.Constant.Version);
if (newVersion > oldVersion)
{
Updater.UpdateApp();
_viewModel.NewVersionTips = version;
}
}
await Updater.UpdateApp();
}
private void OnRequestNavigate(object sender, RequestNavigateEventArgs e)

View File

@ -6,6 +6,7 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Wox.Core;
using Wox.Core.Plugin;
using Wox.Core.Resource;
using Wox.Helper;
@ -205,7 +206,7 @@ namespace Wox.ViewModel
},
new Result
{
Title = $"Open Source: {Constant.Github}",
Title = $"Open Source: {Constant.Repository}",
SubTitle = "Please star it!"
}
};
@ -315,22 +316,10 @@ namespace Wox.ViewModel
#region about
public static string Github => Constant.Github;
public static string Github => Constant.Repository;
public static string ReleaseNotes => @"https://github.com/Wox-launcher/Wox/releases/latest";
public static string Version => Constant.Version;
public string ActivatedTimes => string.Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
private string _newVersionTips;
public string NewVersionTips
{
get { return _newVersionTips; }
set
{
_newVersionTips = string.Format(_translater.GetTranslation("newVersionTips"), value);
NewVersionTipsVisibility = Visibility.Visible;
}
}
public Visibility NewVersionTipsVisibility { get; set; }
#endregion
}
}

View File

@ -158,7 +158,6 @@
<Compile Include="..\SolutionAssemblyInfo.cs">
<Link>Properties\SolutionAssemblyInfo.cs</Link>
</Compile>
<Compile Include="CrashReporter.cs" />
<Compile Include="Helper\SingletonWindowOpener.cs" />
<Compile Include="PublicAPIInstance.cs" />
<Compile Include="ReportWindow.xaml.cs" />
@ -433,33 +432,7 @@
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
xcopy /Y /E $(ProjectDir)Themes\* $(TargetDir)Themes\
xcopy /Y /E $(ProjectDir)Images\* $(TargetDir)Images\
xcopy /Y /D /E $(SolutionDir)Plugins\HelloWorldPython\* $(TargetDir)Plugins\HelloWorldPython\*
xcopy /Y /E $(SolutionDir)JsonRPC\* $(TargetDir)JsonRPC\
cd $(SolutionDir)packages\squirrel*\tools
copy /Y Squirrel.exe $(TargetDir)..\Update.exe
cd $(SolutionDir)
if $(ConfigurationName) == Release (
cd "$(TargetDir)Plugins" &amp; del /s /q NLog.dll
cd "$(TargetDir)Plugins" &amp; del /s /q NLog.config
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Plugin.pdb
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Plugin.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Core.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Core.pdb
cd "$(TargetDir)Plugins" &amp; del /s /q ICSharpCode.SharpZipLib.dll
cd "$(TargetDir)Plugins" &amp; del /s /q NAppUpdate.Framework.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Infrastructure.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Wox.Infrastructure.pdb
cd "$(TargetDir)Plugins" &amp; del /s /q Newtonsoft.Json.dll
cd "$(TargetDir)Plugins" &amp; del /s /q JetBrains.Annotations.dll
cd "$(TargetDir)Plugins" &amp; del /s /q Pinyin4Net.dll
cd "$(TargetDir)" &amp; del /s /q *.xml
)
</PostBuildEvent>
<PostBuildEvent>powershell.exe -NoProfile -File $(SolutionDir)Scripts\post_build.ps1 $(ConfigurationName) $(SolutionDir)</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>taskkill /f /fi "IMAGENAME eq Wox.exe"</PreBuildEvent>

View File

@ -13,22 +13,14 @@ before_build:
build:
project: Wox.sln
after_test:
- ps: >-
.\Deploy\nuget.ps1
.\Deploy\binary_zip.ps1
.\Deploy\squirrel_installer.ps1
artifacts:
- path: 'Wox-*.zip'
- path: 'Output\Packages\Wox-*.zip'
name: zipped_binary
- path: '*.nupkg'
- path: 'Output\Packages\Wox.Plugin.*.nupkg'
name: nuget_package
- path: '\Releases\*.exe'
- path: 'Output\Packages\Wox-*.*'
name: installer
- path: '\Releases\*.nupkg'
name: installer
- path: 'Releases\RELEASES'
- path: 'Output\Packages\RELEASES'
name: installer
deploy:
provider: NuGet