From d84ac0df9cdeae821cfac40fc0a191ff14a99dc1 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 23 Jun 2016 22:53:30 +0100 Subject: [PATCH 01/22] fix names --- Plugins/Wox.Plugin.Shell/Main.cs | 38 +++++++++---------- Plugins/Wox.Plugin.Shell/Settings.cs | 6 +-- Plugins/Wox.Plugin.Shell/ShellSetting.xaml | 2 +- Plugins/Wox.Plugin.Shell/ShellSetting.xaml.cs | 2 +- Wox.sln | 3 -- 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/Plugins/Wox.Plugin.Shell/Main.cs b/Plugins/Wox.Plugin.Shell/Main.cs index 1504b0befd..ad72b16431 100644 --- a/Plugins/Wox.Plugin.Shell/Main.cs +++ b/Plugins/Wox.Plugin.Shell/Main.cs @@ -12,19 +12,19 @@ using Application = System.Windows.Application; using Control = System.Windows.Controls.Control; using Keys = System.Windows.Forms.Keys; -namespace Wox.Plugin.CMD +namespace Wox.Plugin.Shell { - public class CMD : IPlugin, ISettingProvider, IPluginI18n, IContextMenu, ISavable + public class Main : IPlugin, ISettingProvider, IPluginI18n, IContextMenu, ISavable { private const string Image = "Images/shell.png"; - private PluginInitContext context; - private bool WinRStroked; - private readonly KeyboardSimulator keyboardSimulator = new KeyboardSimulator(new InputSimulator()); + private PluginInitContext _context; + private bool _winRStroked; + private readonly KeyboardSimulator _keyboardSimulator = new KeyboardSimulator(new InputSimulator()); private readonly Settings _settings; private readonly PluginJsonStorage _storage; - public CMD() + public Main() { _storage = new PluginJsonStorage(); _settings = _storage.Load(); @@ -104,14 +104,14 @@ namespace Wox.Plugin.CMD { if (m.Key == cmd) { - result.SubTitle = string.Format(context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value); + result.SubTitle = string.Format(_context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value); return null; } var ret = new Result { Title = m.Key, - SubTitle = string.Format(context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value), + SubTitle = string.Format(_context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value), IcoPath = Image, Action = c => { @@ -130,7 +130,7 @@ namespace Wox.Plugin.CMD { Title = cmd, Score = 5000, - SubTitle = context.API.GetTranslation("wox_plugin_cmd_execute_through_shell"), + SubTitle = _context.API.GetTranslation("wox_plugin_cmd_execute_through_shell"), IcoPath = Image, Action = c => { @@ -148,7 +148,7 @@ namespace Wox.Plugin.CMD .Select(m => new Result { Title = m.Key, - SubTitle = string.Format(context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value), + SubTitle = string.Format(_context.API.GetTranslation("wox_plugin_cmd_cmd_has_been_executed_times"), m.Value), IcoPath = Image, Action = c => { @@ -165,7 +165,7 @@ namespace Wox.Plugin.CMD command = Environment.ExpandEnvironmentVariables(command); ProcessStartInfo info; - if (_settings.Shell == Shell.CMD) + if (_settings.Shell == Shell.Cmd) { var arguments = _settings.LeaveShellOpen ? $"/k \"{command}\"" : $"/c \"{command}\" & pause"; info = new ProcessStartInfo @@ -268,7 +268,7 @@ namespace Wox.Plugin.CMD public void Init(PluginInitContext context) { - this.context = context; + this._context = context; context.API.GlobalKeyboardEvent += API_GlobalKeyboardEvent; } @@ -278,13 +278,13 @@ namespace Wox.Plugin.CMD { if (keyevent == (int)KeyEvent.WM_KEYDOWN && vkcode == (int)Keys.R && state.WinPressed) { - WinRStroked = true; + _winRStroked = true; OnWinRPressed(); return false; } - if (keyevent == (int)KeyEvent.WM_KEYUP && WinRStroked && vkcode == (int)Keys.LWin) + if (keyevent == (int)KeyEvent.WM_KEYUP && _winRStroked && vkcode == (int)Keys.LWin) { - WinRStroked = false; + _winRStroked = false; return false; } } @@ -293,7 +293,7 @@ namespace Wox.Plugin.CMD private void OnWinRPressed() { - context.API.ChangeQuery($"{context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeperater}"); + _context.API.ChangeQuery($"{_context.CurrentPluginMetadata.ActionKeywords[0]}{Plugin.Query.TermSeperater}"); Application.Current.MainWindow.Visibility = Visibility.Visible; } @@ -304,12 +304,12 @@ namespace Wox.Plugin.CMD public string GetTranslatedPluginTitle() { - return context.API.GetTranslation("wox_plugin_cmd_plugin_name"); + return _context.API.GetTranslation("wox_plugin_cmd_plugin_name"); } public string GetTranslatedPluginDescription() { - return context.API.GetTranslation("wox_plugin_cmd_plugin_description"); + return _context.API.GetTranslation("wox_plugin_cmd_plugin_description"); } public List LoadContextMenus(Result selectedResult) @@ -318,7 +318,7 @@ namespace Wox.Plugin.CMD { new Result { - Title = context.API.GetTranslation("wox_plugin_cmd_run_as_administrator"), + Title = _context.API.GetTranslation("wox_plugin_cmd_run_as_administrator"), Action = c => { Execute(selectedResult.Title, true); diff --git a/Plugins/Wox.Plugin.Shell/Settings.cs b/Plugins/Wox.Plugin.Shell/Settings.cs index 2734097395..62eb31f4e3 100644 --- a/Plugins/Wox.Plugin.Shell/Settings.cs +++ b/Plugins/Wox.Plugin.Shell/Settings.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; -namespace Wox.Plugin.CMD +namespace Wox.Plugin.Shell { public class Settings { - public Shell Shell { get; set; } = Shell.CMD; + public Shell Shell { get; set; } = Shell.Cmd; public bool ReplaceWinR { get; set; } = true; public bool LeaveShellOpen { get; set; } public Dictionary Count = new Dictionary(); @@ -24,7 +24,7 @@ namespace Wox.Plugin.CMD public enum Shell { - CMD = 0, + Cmd = 0, Powershell = 1, RunCommand = 2, diff --git a/Plugins/Wox.Plugin.Shell/ShellSetting.xaml b/Plugins/Wox.Plugin.Shell/ShellSetting.xaml index a0d4ae7d96..f631f6e228 100644 --- a/Plugins/Wox.Plugin.Shell/ShellSetting.xaml +++ b/Plugins/Wox.Plugin.Shell/ShellSetting.xaml @@ -1,4 +1,4 @@ - Date: Thu, 23 Jun 2016 22:55:38 +0100 Subject: [PATCH 02/22] fix bug introduced in 2a3bf727be1c8bc185f1b436893b1c4385d982ac --- Plugins/Wox.Plugin.Shell/Main.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Plugins/Wox.Plugin.Shell/Main.cs b/Plugins/Wox.Plugin.Shell/Main.cs index ad72b16431..360ba508b9 100644 --- a/Plugins/Wox.Plugin.Shell/Main.cs +++ b/Plugins/Wox.Plugin.Shell/Main.cs @@ -5,6 +5,7 @@ using System.IO; using System.Linq; using System.Windows; using WindowsInput; +using WindowsInput.Native; using Wox.Infrastructure.Hotkey; using Wox.Infrastructure.Logger; using Wox.Infrastructure.Storage; @@ -285,6 +286,7 @@ namespace Wox.Plugin.Shell if (keyevent == (int)KeyEvent.WM_KEYUP && _winRStroked && vkcode == (int)Keys.LWin) { _winRStroked = false; + _keyboardSimulator.ModifiedKeyStroke(VirtualKeyCode.LWIN, VirtualKeyCode.CONTROL); return false; } } From f5069aef6edb352587303ce1284debcbb5818107 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 23 Jun 2016 23:01:20 +0100 Subject: [PATCH 03/22] fix everything error text --- Plugins/Wox.Plugin.Everything/Languages/de.xaml | 2 +- Plugins/Wox.Plugin.Everything/Languages/en.xaml | 2 +- Plugins/Wox.Plugin.Everything/Languages/pl.xaml | 2 +- Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml | 6 +++--- Plugins/Wox.Plugin.Everything/Languages/zh-tw.xaml | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Plugins/Wox.Plugin.Everything/Languages/de.xaml b/Plugins/Wox.Plugin.Everything/Languages/de.xaml index ba4cfe9add..49cde761a8 100644 --- a/Plugins/Wox.Plugin.Everything/Languages/de.xaml +++ b/Plugins/Wox.Plugin.Everything/Languages/de.xaml @@ -2,7 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib"> - Everything läuft nicht + Everything Service läuft nicht Everything Plugin hat einen Fehler (drücke Enter zum kopieren der Fehlernachricht) kopiert Kann {0} nicht starten diff --git a/Plugins/Wox.Plugin.Everything/Languages/en.xaml b/Plugins/Wox.Plugin.Everything/Languages/en.xaml index a076308253..5cd3c559e8 100644 --- a/Plugins/Wox.Plugin.Everything/Languages/en.xaml +++ b/Plugins/Wox.Plugin.Everything/Languages/en.xaml @@ -2,7 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib"> - Everything is not running + Everything Service is not running Error while querying Everything Copied Can’t start {0} diff --git a/Plugins/Wox.Plugin.Everything/Languages/pl.xaml b/Plugins/Wox.Plugin.Everything/Languages/pl.xaml index 37c39db1ca..3c1bf2a38b 100644 --- a/Plugins/Wox.Plugin.Everything/Languages/pl.xaml +++ b/Plugins/Wox.Plugin.Everything/Languages/pl.xaml @@ -2,7 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib"> - Program Everything nie jest uruchomiony + Everything Service nie jest uruchomiony Wystąpił błąd podczas pobierania wyników z Everything Skopiowano Nie udało się uruchomić {0} diff --git a/Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml b/Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml index 309b59e488..b6baffb359 100644 --- a/Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml +++ b/Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml @@ -2,14 +2,14 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib"> - Everything没有运行 - Everything插件发生了一个错误(回车拷贝具体错误信息) + Everything Service 没有运行 + Everything 插件发生了一个错误(回车拷贝具体错误信息) 拷贝成功 不能启动 {0} 打开所属文件夹 Everything - 利用Everything搜索磁盘文件 + 利用 Everything 搜索磁盘文件 使用应用程序的位置为可执行的工作目录 \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Everything/Languages/zh-tw.xaml b/Plugins/Wox.Plugin.Everything/Languages/zh-tw.xaml index 40651d9ed4..b70d73202b 100644 --- a/Plugins/Wox.Plugin.Everything/Languages/zh-tw.xaml +++ b/Plugins/Wox.Plugin.Everything/Languages/zh-tw.xaml @@ -2,14 +2,14 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib"> - Everything沒有運行 - Everything插件發生了一個錯誤(回車拷貝具體錯誤信息) + Everything Service 沒有運行 + Everything 插件發生了一個錯誤(回車拷貝具體錯誤信息) 拷貝成功 不能啟動 {0} 打開所屬文件夾 Everything - 利用Everything搜索磁盤文件 + 利用 Everything 搜索磁盤文件 使用应用程序的位置为可执行的工作目录 \ No newline at end of file From c9a8a2af07ebd2f0c24a489e443353c3aacf4562 Mon Sep 17 00:00:00 2001 From: Haitao Yin Date: Tue, 5 Jul 2016 22:44:14 +0800 Subject: [PATCH 04/22] Ramen Bless Your Repo --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a79c75a6f7..e22cd5bfda 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ WoX [![Build status](https://ci.appveyor.com/api/projects/status/bfktntbivg32e103)](https://ci.appveyor.com/project/happlebao/wox) [![Github All Releases](https://img.shields.io/github/downloads/Wox-launcher/Wox/total.svg)](https://github.com/Wox-launcher/Wox/releases) [![Issue Stats](http://issuestats.com/github/Wox-launcher/Wox/badge/pr)](http://issuestats.com/github/Wox-launcher/Wox) +[![RamenBless](https://cdn.rawgit.com/LunaGao/BlessYourCodeTag/master/tags/ramen.svg)](https://github.com/LunaGao/BlessYourCodeTag) **WoX** is a launcher for Windows that simply works. It's an alternative to [Alfred](https://www.alfredapp.com/) and [Launchy](http://www.launchy.net/). You can call it Windows omni-eXecutor if you want a long name. From f45ca180e9e14026911b6803e6e16a64b45ab032 Mon Sep 17 00:00:00 2001 From: Jordy Hulck Date: Wed, 20 Jul 2016 01:24:28 +0200 Subject: [PATCH 05/22] Fixed hide on startup problem (#852) * Fixed HideOnStartup * Fixed tray icon not showing up and hiding properly --- Wox/App.xaml.cs | 9 +++------ Wox/MainWindow.xaml | 1 + Wox/MainWindow.xaml.cs | 7 ++++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Wox/App.xaml.cs b/Wox/App.xaml.cs index 77bade7005..4a17a2fe1e 100644 --- a/Wox/App.xaml.cs +++ b/Wox/App.xaml.cs @@ -60,10 +60,7 @@ namespace Wox AutoStartup(); AutoUpdates(); - if (!_settings.HideOnStartup) - { - mainVM.MainWindowVisibility = Visibility.Visible; - } + mainVM.MainWindowVisibility = _settings.HideOnStartup ? Visibility.Hidden : Visibility.Visible; }); } @@ -102,7 +99,7 @@ namespace Wox } /// - /// let exception throw as normal is better for Debug + /// let exception throw as normal is better for Debug /// [Conditional("RELEASE")] private void RegisterDispatcherUnhandledException() @@ -113,7 +110,7 @@ namespace Wox /// - /// let exception throw as normal is better for Debug + /// let exception throw as normal is better for Debug /// [Conditional("RELEASE")] private static void RegisterAppDomainExceptions() diff --git a/Wox/MainWindow.xaml b/Wox/MainWindow.xaml index 3412cd0ac3..5106b8b9bb 100644 --- a/Wox/MainWindow.xaml +++ b/Wox/MainWindow.xaml @@ -17,6 +17,7 @@ Icon="Images\app.png" AllowsTransparency="True" Loaded="OnLoaded" + Initialized="OnInitialized" Closing="OnClosing" Drop="OnDrop" SizeChanged="OnSizeChanged" diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 1a130c71ba..de56fa027a 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -46,11 +46,16 @@ namespace Wox _viewModel.Save(); } + private void OnInitialized(object sender, EventArgs e) + { + // show notify icon when wox is hided + InitializeNotifyIcon(); + } + private void OnLoaded(object sender, RoutedEventArgs _) { WindowIntelopHelper.DisableControlBox(this); ThemeManager.Instance.ChangeTheme(_settings.Theme); - InitializeNotifyIcon(); InitProgressbarAnimation(); _viewModel.PropertyChanged += (o, e) => From 8f073c5b6fb5abdfe35008f4caf97060066efe0c Mon Sep 17 00:00:00 2001 From: Boris Makogonyuk Date: Wed, 20 Jul 2016 01:30:15 +0200 Subject: [PATCH 06/22] Hardcoded supported accents version 8 (Windows 8 is 6.2, Windows 7 is 6.1). (#817) Added check before applying blur. --- Wox.Core/Resource/Theme.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Wox.Core/Resource/Theme.cs b/Wox.Core/Resource/Theme.cs index 391456d2c7..3107b26de6 100644 --- a/Wox.Core/Resource/Theme.cs +++ b/Wox.Core/Resource/Theme.cs @@ -15,6 +15,7 @@ namespace Wox.Core.Resource public class Theme : Resource { private static List themeDirectories = new List(); + private static Version supportedAccentsVersion = new Version(6, 2); public Settings Settings { get; set; } public Theme() @@ -59,7 +60,7 @@ namespace Wox.Core.Resource // Exception of FindResource can't be cathed if global exception handle is set var isBlur = Application.Current.TryFindResource("ThemeBlurEnabled"); - if (isBlur is bool) + if (isBlur is bool && Environment.OSVersion.Version >= supportedAccentsVersion) { SetBlurForWindow(Application.Current.MainWindow, (bool)isBlur); } From b55c05095a93f8a22918cfbed7e6df1d7c6d0ed3 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Wed, 20 Jul 2016 01:43:03 +0100 Subject: [PATCH 07/22] Update ISSUE_TEMPLATE.md --- ISSUE_TEMPLATE.md | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index 368d66f77a..f1c0f8b0cf 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -1,23 +1,21 @@ ## English -Before you report any bugs try search existing issues +Try search existing issues before you open new one -1. Please specify Wox version - - If you checkout from master/dev branch, please specify **commit number** -2. Please describe the steps to **reproduce** the bug -3. Please provide Windows version -4. Please provide Exception info if you have. -5. Please provide **logs** from `%APPDATA%\Wox\Logs` if you have. -6. Please provide screenshot if you have +1. Wox version / commit number: +2. Steps to **reproduce** the bug: +3. Windows version: +4. Exception: +5. **logs** (`%APPDATA%\Wox\Logs\version\date.txt`): +6. Screenshot (optional): ## 中文 / Chinese -报 bug 之前搜索一下已经有的 issue +提问之前搜索一下已经有的 issue -1. 请提供 Wox 版本 - - 如果你是从 master/dev branch checkout 的,请提供 **commit number** -2. 请提供如何**重现** bug 的步骤 -3. 请提供 Windows 版本 -4. 如果有 Exception/Crash Report 的话,请一并提供 -5. 如果有 **logs** (`%APPDATA%\Wox\Logs`)的话,请一并提供 -6. 如果有截图的话,请一并提供 +1. Wox 版本 / commit number: +2. 如何**重现** bug: +3. Windows 版本: +4. Exception: +5. **logs** (`%APPDATA%\Wox\Logs\version\date.txt`): +6. 截图 (可选): From c9f38fef4577a8d0b713184b3ee5b124696f7da7 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Wed, 20 Jul 2016 00:31:29 +0100 Subject: [PATCH 08/22] fixup --- Wox.Core/Resource/Theme.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Wox.Core/Resource/Theme.cs b/Wox.Core/Resource/Theme.cs index 3107b26de6..68df370b1f 100644 --- a/Wox.Core/Resource/Theme.cs +++ b/Wox.Core/Resource/Theme.cs @@ -15,7 +15,6 @@ namespace Wox.Core.Resource public class Theme : Resource { private static List themeDirectories = new List(); - private static Version supportedAccentsVersion = new Version(6, 2); public Settings Settings { get; set; } public Theme() @@ -60,7 +59,7 @@ namespace Wox.Core.Resource // Exception of FindResource can't be cathed if global exception handle is set var isBlur = Application.Current.TryFindResource("ThemeBlurEnabled"); - if (isBlur is bool && Environment.OSVersion.Version >= supportedAccentsVersion) + if (isBlur is bool && Environment.OSVersion.Version >= new Version(6, 2)) { SetBlurForWindow(Application.Current.MainWindow, (bool)isBlur); } From 206532f1950fa9ce39acbfc143793c542ae10d02 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Wed, 20 Jul 2016 02:01:47 +0100 Subject: [PATCH 09/22] add more exception info --- Plugins/Wox.Plugin.Everything/Main.cs | 1 + Wox.Core/Plugin/PluginsLoader.cs | 2 + .../Exception/ExceptionFormatter.cs | 80 +++++++++---------- Wox.Infrastructure/Wox.cs | 3 + Wox/ReportWindow.xaml.cs | 4 + 5 files changed, 49 insertions(+), 41 deletions(-) diff --git a/Plugins/Wox.Plugin.Everything/Main.cs b/Plugins/Wox.Plugin.Everything/Main.cs index 231d94d0c2..c08efc85b7 100644 --- a/Plugins/Wox.Plugin.Everything/Main.cs +++ b/Plugins/Wox.Plugin.Everything/Main.cs @@ -142,6 +142,7 @@ namespace Wox.Plugin.Everything Helper.ValidateDataDirectory(bundledSDKDirectory, sdkDirectory); var sdkPath = Path.Combine(sdkDirectory, DLL); + Constant.EverythingSDKPath = sdkPath; LoadLibrary(sdkPath); } diff --git a/Wox.Core/Plugin/PluginsLoader.cs b/Wox.Core/Plugin/PluginsLoader.cs index b2132eb4ae..a43cd43b35 100644 --- a/Wox.Core/Plugin/PluginsLoader.cs +++ b/Wox.Core/Plugin/PluginsLoader.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using Wox.Infrastructure; using Wox.Infrastructure.Exception; using Wox.Infrastructure.Logger; using Wox.Infrastructure.UserSettings; @@ -113,6 +114,7 @@ namespace Wox.Core.Plugin return new List(); } } + Constant.PythonPath = filename; var plugins = metadatas.Select(metadata => new PluginPair { Plugin = new PythonPlugin(filename), diff --git a/Wox.Infrastructure/Exception/ExceptionFormatter.cs b/Wox.Infrastructure/Exception/ExceptionFormatter.cs index 31f548ae8d..91fc5f2f4b 100644 --- a/Wox.Infrastructure/Exception/ExceptionFormatter.cs +++ b/Wox.Infrastructure/Exception/ExceptionFormatter.cs @@ -24,54 +24,52 @@ namespace Wox.Infrastructure.Exception sb.AppendLine(); sb.AppendLine("```"); - var exlist = new List(); + var exlist = new List(); - while (ex != null) + while (ex != null) + { + var exsb = new StringBuilder(); + exsb.Append(ex.GetType().FullName); + exsb.Append(": "); + exsb.AppendLine(ex.Message); + if (ex.Source != null) { - var exsb = new StringBuilder(); - exsb.Append(ex.GetType().FullName); - exsb.Append(": "); - exsb.AppendLine(ex.Message); - if (ex.Source != null) - { - exsb.Append(" Source: "); - exsb.AppendLine(ex.Source); - } - if (ex.TargetSite != null) - { - exsb.Append(" TargetAssembly: "); - exsb.AppendLine(ex.TargetSite.Module.Assembly.ToString()); - exsb.Append(" TargetModule: "); - exsb.AppendLine(ex.TargetSite.Module.ToString()); - exsb.Append(" TargetSite: "); - exsb.AppendLine(ex.TargetSite.ToString()); - } - exsb.AppendLine(ex.StackTrace); - exlist.Add(exsb); - - ex = ex.InnerException; + exsb.Append(" Source: "); + exsb.AppendLine(ex.Source); } - - foreach (var result in exlist.Select(o => o.ToString()).Reverse()) + if (ex.TargetSite != null) { - sb.AppendLine(result); + exsb.Append(" TargetAssembly: "); + exsb.AppendLine(ex.TargetSite.Module.Assembly.ToString()); + exsb.Append(" TargetModule: "); + exsb.AppendLine(ex.TargetSite.Module.ToString()); + exsb.Append(" TargetSite: "); + exsb.AppendLine(ex.TargetSite.ToString()); } - sb.AppendLine("```"); - sb.AppendLine(); + exsb.AppendLine(ex.StackTrace); + exlist.Add(exsb); + + ex = ex.InnerException; + } + + foreach (var result in exlist.Select(o => o.ToString()).Reverse()) + { + sb.AppendLine(result); + } + sb.AppendLine("```"); + sb.AppendLine(); sb.AppendLine("## Environment"); - sb.AppendLine(); - sb.Append("* Command Line: "); - sb.AppendLine(Environment.CommandLine); - sb.Append("* Timestamp: "); - sb.AppendLine(DateTime.Now.ToString(CultureInfo.InvariantCulture)); - sb.Append("* IntPtr Length: "); - sb.AppendLine(IntPtr.Size.ToString()); - sb.Append("* System Version: "); - sb.AppendLine(Environment.OSVersion.VersionString); - sb.Append("* CLR Version: "); - sb.AppendLine(Environment.Version.ToString()); - sb.AppendLine("* Installed .NET Framework: "); + sb.AppendLine($"* Command Line: {Environment.CommandLine}"); + sb.AppendLine($"* Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}"); + sb.AppendLine($"* Wox version: {Constant.Version}"); + sb.AppendLine($"* OS Version: {Environment.OSVersion.VersionString}"); + sb.AppendLine($"* IntPtr Length: {IntPtr.Size}"); + sb.AppendLine($"* x64: {Environment.Is64BitOperatingSystem}"); + sb.AppendLine($"* Python Path: {Constant.PythonPath}"); + sb.AppendLine($"* Everything SDK Path: {Constant.EverythingSDKPath}"); + sb.AppendLine($"* CLR Version: {Environment.Version}"); + sb.AppendLine($"* Installed .NET Framework: "); foreach (var result in GetFrameworkVersionFromRegistry()) { sb.Append(" * "); diff --git a/Wox.Infrastructure/Wox.cs b/Wox.Infrastructure/Wox.cs index 4e73c94703..39f2fe6229 100644 --- a/Wox.Infrastructure/Wox.cs +++ b/Wox.Infrastructure/Wox.cs @@ -21,5 +21,8 @@ namespace Wox.Infrastructure public const string Github = "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 string PythonPath; + public static string EverythingSDKPath; } } diff --git a/Wox/ReportWindow.xaml.cs b/Wox/ReportWindow.xaml.cs index 6a365e46c8..93fbb08cb7 100644 --- a/Wox/ReportWindow.xaml.cs +++ b/Wox/ReportWindow.xaml.cs @@ -34,6 +34,10 @@ namespace Wox 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($"Date: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}"); content.AppendLine("Exception:"); content.AppendLine(exception.Source); From 3604e6fa7d3a1398e4490295591c68ee813ee008 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Wed, 20 Jul 2016 23:37:06 +0100 Subject: [PATCH 10/22] fix #813 #823 --- Wox/MainWindow.xaml.cs | 6 +++++- Wox/PublicAPIInstance.cs | 4 ++-- Wox/ViewModel/MainViewModel.cs | 18 +++++++++++++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index de56fa027a..0110e87339 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -235,7 +235,11 @@ namespace Wox private void OnTextChanged(object sender, TextChangedEventArgs e) { - QueryTextBox.CaretIndex = QueryTextBox.Text.Length; + if (_viewModel.QueryTextCursorMovedToEnd) + { + QueryTextBox.CaretIndex = QueryTextBox.Text.Length; + _viewModel.QueryTextCursorMovedToEnd = false; + } } } } \ No newline at end of file diff --git a/Wox/PublicAPIInstance.cs b/Wox/PublicAPIInstance.cs index e9801f686c..86f415727e 100644 --- a/Wox/PublicAPIInstance.cs +++ b/Wox/PublicAPIInstance.cs @@ -36,12 +36,12 @@ namespace Wox public void ChangeQuery(string query, bool requery = false) { - _mainVM.QueryText = query; + _mainVM.ChangeQueryText(query); } public void ChangeQueryText(string query, bool selectAll = false) { - _mainVM.QueryText = query; + _mainVM.ChangeQueryText(query); } [Obsolete] diff --git a/Wox/ViewModel/MainViewModel.cs b/Wox/ViewModel/MainViewModel.cs index d5fa307f69..8cc43084c8 100644 --- a/Wox/ViewModel/MainViewModel.cs +++ b/Wox/ViewModel/MainViewModel.cs @@ -205,7 +205,19 @@ namespace Wox.ViewModel Query(); } } + + /// + /// we need move cursor to end when we manually changed query + /// but we don't want to move cursor to end when query is updated from TextBox + /// + /// + public void ChangeQueryText(string queryText) + { + QueryTextCursorMovedToEnd = true; + QueryText = queryText; + } public bool QueryTextSelected { get; set; } + public bool QueryTextCursorMovedToEnd { get; set; } private ResultsViewModel _selectedResults; private ResultsViewModel SelectedResults @@ -218,7 +230,7 @@ namespace Wox.ViewModel { ContextMenu.Visbility = Visibility.Collapsed; History.Visbility = Visibility.Collapsed; - QueryText = _queryTextBeforeLeaveResults; + ChangeQueryText(_queryTextBeforeLeaveResults); } else { @@ -325,7 +337,7 @@ namespace Wox.ViewModel Action = _ => { SelectedResults = Results; - QueryText = h.Query; + ChangeQueryText(h.Query); return false; } }; @@ -547,7 +559,7 @@ namespace Wox.ViewModel { if (ShouldIgnoreHotkeys()) return; MainWindowVisibility = Visibility.Visible; - QueryText = hotkey.ActionKeyword; + ChangeQueryText(hotkey.ActionKeyword); }); } } From 390d49d59953985f2d895bf49f78d51955890600 Mon Sep 17 00:00:00 2001 From: Jordy Hulck Date: Thu, 21 Jul 2016 15:50:37 +0200 Subject: [PATCH 11/22] Fix SearchSource editing when action keyword is not changed (#856) * Fixed SearchSource edit * Remove temp var --- Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs b/Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs index 55eab81e16..d1b1bab7a1 100644 --- a/Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs +++ b/Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs @@ -96,11 +96,10 @@ namespace Wox.Plugin.WebSearch private void EditSearchSource() { - var keyword = _searchSource.ActionKeyword; - if (!PluginManager.ActionKeywordRegistered(keyword)) + var newKeyword = _searchSource.ActionKeyword; + var oldKeyword = _oldSearchSource.ActionKeyword; + if (!PluginManager.ActionKeywordRegistered(newKeyword) || oldKeyword == newKeyword) { - var newKeyword = keyword; - var oldKeyword = _oldSearchSource.ActionKeyword; var id = _context.CurrentPluginMetadata.ID; PluginManager.ReplaceActionKeyword(id, oldKeyword, newKeyword); From c8d81518cc951b48527ac88178e3c71c56ee17e2 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 21 Jul 2016 00:02:13 +0100 Subject: [PATCH 12/22] simple refactoring --- .../Wox.Plugin.Program/FileChangeWatcher.cs | 23 +++++++------------ Plugins/Wox.Plugin.Program/Main.cs | 5 ++-- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs b/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs index 0ab797d9c9..95853d4628 100644 --- a/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs +++ b/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs @@ -1,33 +1,31 @@ using System.Collections.Generic; using System.IO; -using System.Threading; using System.Threading.Tasks; using Wox.Infrastructure.Logger; namespace Wox.Plugin.Program { - internal class FileChangeWatcher + internal static class FileChangeWatcher { - private static bool isIndexing; - private static List watchedPath = new List(); + private static readonly List WatchedPath = new List(); public static void AddWatch(string path, string[] programSuffixes, bool includingSubDirectory = true) { - if (watchedPath.Contains(path)) return; + if (WatchedPath.Contains(path)) return; if (!Directory.Exists(path)) { Log.Warn($"FileChangeWatcher: {path} doesn't exist"); return; } - watchedPath.Add(path); + WatchedPath.Add(path); foreach (string fileType in programSuffixes) { FileSystemWatcher watcher = new FileSystemWatcher { Path = path, IncludeSubdirectories = includingSubDirectory, - Filter = string.Format("*.{0}", fileType), + Filter = $"*.{fileType}", EnableRaisingEvents = true }; watcher.Changed += FileChanged; @@ -39,15 +37,10 @@ namespace Wox.Plugin.Program private static void FileChanged(object source, FileSystemEventArgs e) { - if (!isIndexing) + Task.Run(() => { - Task.Run(() => - { - Main.IndexPrograms(); - isIndexing = false; - }); - } + Main.IndexPrograms(); + }); } - } } diff --git a/Plugins/Wox.Plugin.Program/Main.cs b/Plugins/Wox.Plugin.Program/Main.cs index bb0beb7f5f..3ce9971c38 100644 --- a/Plugins/Wox.Plugin.Program/Main.cs +++ b/Plugins/Wox.Plugin.Program/Main.cs @@ -14,7 +14,7 @@ namespace Wox.Plugin.Program { public class Main : ISettingProvider, IPlugin, IPluginI18n, IContextMenu, ISavable { - private static object lockObject = new object(); + private static readonly object IndexLock = new object(); private static List _programs = new List(); private static List _sources = new List(); private static readonly Dictionary SourceTypes = new Dictionary @@ -96,8 +96,7 @@ namespace Wox.Plugin.Program public static void IndexPrograms() { - // todo why there is a lock?? - lock (lockObject) + lock (IndexLock) { var sources = DefaultProgramSources(); if (_settings.ProgramSources != null && From 13a51b6bd300fad3836f2e679e7cb561dd3ba728 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 21 Jul 2016 00:22:00 +0100 Subject: [PATCH 13/22] move files --- .../Wox.Plugin.Program/{ => ProgramSources}/IProgramSource.cs | 0 .../Wox.Plugin.Program/{ => ProgramSources}/ProgramSource.cs | 0 Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename Plugins/Wox.Plugin.Program/{ => ProgramSources}/IProgramSource.cs (100%) rename Plugins/Wox.Plugin.Program/{ => ProgramSources}/ProgramSource.cs (100%) diff --git a/Plugins/Wox.Plugin.Program/IProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/IProgramSource.cs similarity index 100% rename from Plugins/Wox.Plugin.Program/IProgramSource.cs rename to Plugins/Wox.Plugin.Program/ProgramSources/IProgramSource.cs diff --git a/Plugins/Wox.Plugin.Program/ProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs similarity index 100% rename from Plugins/Wox.Plugin.Program/ProgramSource.cs rename to Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs diff --git a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj index cbc3820a35..65accfe305 100644 --- a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj +++ b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj @@ -61,7 +61,7 @@ AddProgramSource.xaml - + @@ -69,7 +69,7 @@ ProgramSetting.xaml - + From 3c53c2c56c1ce1c5ef7d35c47ad11845ec28b6ba Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 21 Jul 2016 19:51:47 +0100 Subject: [PATCH 14/22] Program plugin: remove complicated inheritance --- .../AddProgramSource.xaml.cs | 8 +-- Plugins/Wox.Plugin.Program/Main.cs | 30 ++--------- Plugins/Wox.Plugin.Program/Program.cs | 3 +- .../Wox.Plugin.Program/ProgramSetting.xaml.cs | 8 +-- .../ProgramSources/AppPathsProgramSource.cs | 23 +++------ .../CommonStartMenuProgramSource.cs | 36 +++++-------- .../ProgramSources/FileSystemProgramSource.cs | 44 +++++----------- .../ProgramSources/IProgramSource.cs | 49 ------------------ .../ProgramSources/ProgramSource.cs | 51 ++++++++++++++----- .../UserStartMenuProgramSource.cs | 22 ++------ .../ProgramSuffixes.xaml.cs | 1 + Plugins/Wox.Plugin.Program/Settings.cs | 4 +- .../Wox.Plugin.Program.csproj | 1 - 13 files changed, 93 insertions(+), 187 deletions(-) delete mode 100644 Plugins/Wox.Plugin.Program/ProgramSources/IProgramSource.cs diff --git a/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs b/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs index 253bce41ff..507626eb05 100644 --- a/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs +++ b/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Windows; using System.Windows.Forms; +using Wox.Plugin.Program.ProgramSources; namespace Wox.Plugin.Program { @@ -9,7 +10,7 @@ namespace Wox.Plugin.Program /// public partial class AddProgramSource { - private ProgramSource _editing; + private FileSystemProgramSource _editing; private Settings _settings; public AddProgramSource(Settings settings) @@ -20,7 +21,7 @@ namespace Wox.Plugin.Program Directory.Focus(); } - public AddProgramSource(ProgramSource edit, Settings settings) + public AddProgramSource(FileSystemProgramSource edit, Settings settings) { _editing = edit; _settings = settings; @@ -51,12 +52,11 @@ namespace Wox.Plugin.Program if(_editing == null) { - var source = new ProgramSource + var source = new FileSystemProgramSource { Location = Directory.Text, MaxDepth = max, Suffixes = Suffixes.Text.Split(ProgramSource.SuffixSeperator), - Type = "FileSystemProgramSource", Enabled = true }; _settings.ProgramSources.Add(source); diff --git a/Plugins/Wox.Plugin.Program/Main.cs b/Plugins/Wox.Plugin.Program/Main.cs index 3ce9971c38..11b4572c81 100644 --- a/Plugins/Wox.Plugin.Program/Main.cs +++ b/Plugins/Wox.Plugin.Program/Main.cs @@ -16,14 +16,6 @@ namespace Wox.Plugin.Program { private static readonly object IndexLock = new object(); private static List _programs = new List(); - private static List _sources = new List(); - private static readonly Dictionary SourceTypes = new Dictionary - { - {"FileSystemProgramSource", typeof(FileSystemProgramSource)}, - {"CommonStartMenuProgramSource", typeof(CommonStartMenuProgramSource)}, - {"UserStartMenuProgramSource", typeof(UserStartMenuProgramSource)}, - {"AppPathsProgramSource", typeof(AppPathsProgramSource)} - }; private PluginInitContext _context; @@ -105,18 +97,7 @@ namespace Wox.Plugin.Program sources.AddRange(_settings.ProgramSources); } - _sources = sources.AsParallel() - .Where(s => s.Enabled && SourceTypes.ContainsKey(s.Type)) - .Select(s => - { - var sourceClass = SourceTypes[s.Type]; - var constructorInfo = sourceClass.GetConstructor(new[] { typeof(ProgramSource) }); - var programSource = constructorInfo?.Invoke(new object[] { s }) as IProgramSource; - return programSource; - }) - .Where(s => s != null).ToList(); - - _programs = _sources.AsParallel() + _programs = sources.AsParallel() .SelectMany(s => s.LoadPrograms()) // filter duplicate program .GroupBy(x => new { ExecutePath = x.Path, ExecuteName = x.ExecutableName }) @@ -134,23 +115,20 @@ namespace Wox.Plugin.Program { var list = new List { - new ProgramSource + new CommonStartMenuProgramSource { BonusPoints = 0, Enabled = _settings.EnableStartMenuSource, - Type = "CommonStartMenuProgramSource" }, - new ProgramSource + new UserStartMenuProgramSource { BonusPoints = 0, Enabled = _settings.EnableStartMenuSource, - Type = "UserStartMenuProgramSource" }, - new ProgramSource + new AppPathsProgramSource { BonusPoints = -10, Enabled = _settings.EnableRegistrySource, - Type = "AppPathsProgramSource" } }; return list; diff --git a/Plugins/Wox.Plugin.Program/Program.cs b/Plugins/Wox.Plugin.Program/Program.cs index e8c59ac1fc..ff468e674e 100644 --- a/Plugins/Wox.Plugin.Program/Program.cs +++ b/Plugins/Wox.Plugin.Program/Program.cs @@ -2,6 +2,7 @@ using System; using System.Text.RegularExpressions; using System.Threading; using Wox.Infrastructure; +using Wox.Plugin.Program.ProgramSources; namespace Wox.Plugin.Program { @@ -14,6 +15,6 @@ namespace Wox.Plugin.Program public string Directory { get; set; } public string ExecutableName { get; set; } public int Score { get; set; } - public IProgramSource Source { get; set; } + public ProgramSource Source { get; set; } } } \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs b/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs index 5f0430e2b0..f54cc7b3e6 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using Wox.Plugin.Program.ProgramSources; namespace Wox.Plugin.Program { @@ -50,7 +51,7 @@ namespace Wox.Plugin.Program private void btnDeleteProgramSource_OnClick(object sender, RoutedEventArgs e) { - ProgramSource selectedProgramSource = programSourceView.SelectedItem as ProgramSource; + var selectedProgramSource = programSourceView.SelectedItem as FileSystemProgramSource; if (selectedProgramSource != null) { string msg = string.Format(context.API.GetTranslation("wox_plugin_program_delete_program_source"), selectedProgramSource.Location); @@ -70,7 +71,7 @@ namespace Wox.Plugin.Program private void btnEditProgramSource_OnClick(object sender, RoutedEventArgs e) { - ProgramSource selectedProgramSource = programSourceView.SelectedItem as ProgramSource; + var selectedProgramSource = programSourceView.SelectedItem as FileSystemProgramSource; if (selectedProgramSource != null) { var add = new AddProgramSource(selectedProgramSource, _settings); @@ -119,10 +120,9 @@ namespace Wox.Plugin.Program { if (Directory.Exists(s)) { - _settings.ProgramSources.Add(new ProgramSource + _settings.ProgramSources.Add(new FileSystemProgramSource { Location = s, - Type = "FileSystemProgramSource", Enabled = true }); diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/AppPathsProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/AppPathsProgramSource.cs index 47c2b7bae5..9f86e868f4 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/AppPathsProgramSource.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/AppPathsProgramSource.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.IO; using Microsoft.Win32; using Wox.Infrastructure.Logger; @@ -8,24 +7,19 @@ using Wox.Infrastructure.Logger; namespace Wox.Plugin.Program.ProgramSources { [Serializable] - [Browsable(false)] - public class AppPathsProgramSource : AbstractProgramSource + public class AppPathsProgramSource : ProgramSource { public AppPathsProgramSource() { BonusPoints = -10; } - public AppPathsProgramSource(ProgramSource source) : this() - { - BonusPoints = source.BonusPoints; - } - public override List LoadPrograms() { var list = new List(); ReadAppPaths(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths", list); - ReadAppPaths(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths", list); //TODO: need test more on 64-bit + ReadAppPaths(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths", list); + //TODO: need test more on 64-bit return list; } @@ -40,12 +34,12 @@ namespace Wox.Plugin.Program.ProgramSources { using (var key = root.OpenSubKey(item)) { - string path = key.GetValue("") as string; + var path = key.GetValue("") as string; if (string.IsNullOrEmpty(path)) continue; // fix path like this ""\"C:\\folder\\executable.exe\""" const int begin = 0; - int end = path.Length - 1; + var end = path.Length - 1; const char quotationMark = '"'; if (path[begin] == quotationMark && path[end] == quotationMark) { @@ -66,10 +60,5 @@ namespace Wox.Plugin.Program.ProgramSources } } } - - public override string ToString() - { - return typeof(AppPathsProgramSource).Name; - } } -} +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/CommonStartMenuProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/CommonStartMenuProgramSource.cs index 2eee434c96..185330be62 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/CommonStartMenuProgramSource.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/CommonStartMenuProgramSource.cs @@ -1,40 +1,30 @@ using System; -using System.ComponentModel; using System.Runtime.InteropServices; using System.Text; namespace Wox.Plugin.Program.ProgramSources { [Serializable] - [Browsable(false)] - public class CommonStartMenuProgramSource : FileSystemProgramSource + public sealed class CommonStartMenuProgramSource : FileSystemProgramSource { + private const int CSIDL_COMMON_PROGRAMS = 0x17; + + // todo happlebao how to pass location before loadPrograms + public CommonStartMenuProgramSource() + { + Location = getPath(); + } + [DllImport("shell32.dll")] - static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, [Out] StringBuilder lpszPath, int nFolder, bool fCreate); - const int CSIDL_COMMON_PROGRAMS = 0x17; + private static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, [Out] StringBuilder lpszPath, int nFolder, + bool fCreate); private static string getPath() { - StringBuilder commonStartMenuPath = new StringBuilder(560); + var commonStartMenuPath = new StringBuilder(560); SHGetSpecialFolderPath(IntPtr.Zero, commonStartMenuPath, CSIDL_COMMON_PROGRAMS, false); return commonStartMenuPath.ToString(); } - - public CommonStartMenuProgramSource(string[] suffixes) - : base(getPath(), suffixes) - { - } - - public CommonStartMenuProgramSource(ProgramSource source) - : this(source.Suffixes) - { - BonusPoints = source.BonusPoints; - } - - public override string ToString() - { - return typeof(CommonStartMenuProgramSource).Name; - } } -} +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs index 420d6172a3..718aafd7cc 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs @@ -8,35 +8,17 @@ using Wox.Infrastructure.Logger; namespace Wox.Plugin.Program.ProgramSources { [Serializable] - public class FileSystemProgramSource : AbstractProgramSource + public class FileSystemProgramSource : ProgramSource { - private string _baseDirectory; - private int _maxDepth; - private string[] _suffixes; - - public FileSystemProgramSource(string baseDirectory, int maxDepth, string[] suffixes) - { - _baseDirectory = baseDirectory; - _maxDepth = maxDepth; - _suffixes = suffixes; - } - - public FileSystemProgramSource(string baseDirectory, string[] suffixes) - : this(baseDirectory, -1, suffixes) {} - - public FileSystemProgramSource(ProgramSource source) - : this(source.Location, source.MaxDepth, source.Suffixes) - { - BonusPoints = source.BonusPoints; - } + public string Location { get; set; } = ""; public override List LoadPrograms() { - List list = new List(); - if (Directory.Exists(_baseDirectory)) + var list = new List(); + if (Directory.Exists(Location)) { - GetAppFromDirectory(_baseDirectory, list); - FileChangeWatcher.AddWatch(_baseDirectory, _suffixes); + GetAppFromDirectory(Location, list); + FileChangeWatcher.AddWatch(Location, Suffixes); } return list; } @@ -48,17 +30,17 @@ namespace Wox.Plugin.Program.ProgramSources private void GetAppFromDirectory(string path, List list, int depth) { - if(_maxDepth != -1 && depth > _maxDepth) + if (MaxDepth != -1 && depth > MaxDepth) { return; } try { - foreach (string file in Directory.GetFiles(path)) + foreach (var file in Directory.GetFiles(path)) { - if (_suffixes.Any(o => file.EndsWith("." + o))) + if (Suffixes.Any(o => file.EndsWith("." + o))) { - Program p = CreateEntry(file); + var p = CreateEntry(file); p.Source = this; list.Add(p); } @@ -75,10 +57,10 @@ namespace Wox.Plugin.Program.ProgramSources Log.Exception(woxPluginException); } } - public override string ToString() { - return typeof(FileSystemProgramSource).Name + ":" + _baseDirectory; + var display = GetType().Name + Location; + return display; } } -} +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/IProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/IProgramSource.cs deleted file mode 100644 index 6df37995c9..0000000000 --- a/Plugins/Wox.Plugin.Program/ProgramSources/IProgramSource.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; - -namespace Wox.Plugin.Program -{ - public interface IProgramSource - { - List LoadPrograms(); - int BonusPoints { get; set; } - } - - [Serializable] - public abstract class AbstractProgramSource : IProgramSource - { - public abstract List LoadPrograms(); - - public int BonusPoints { get; set; } - - protected Program CreateEntry(string file) - { - var p = new Program - { - Title = Path.GetFileNameWithoutExtension(file), - IcoPath = file, - Path = file, - Directory = Directory.GetParent(file).FullName - }; - - switch (Path.GetExtension(file).ToLower()) - { - case ".exe": - p.ExecutableName = Path.GetFileName(file); - try - { - FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(file); - if (!string.IsNullOrEmpty(versionInfo.FileDescription)) - { - p.Title = versionInfo.FileDescription; - } - } - catch (Exception) { } - break; - } - return p; - } - } -} diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs index 1345c51f4a..9e4e839e32 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs @@ -1,24 +1,51 @@ using System; using System.Collections.Generic; +using System.Diagnostics; +using System.IO; -namespace Wox.Plugin.Program +namespace Wox.Plugin.Program.ProgramSources { [Serializable] - public class ProgramSource + public abstract class ProgramSource { - public string Location { get; set; } - public string Type { get; set; } - public int BonusPoints { get; set; } - public bool Enabled { get; set; } + public const char SuffixSeperator = ';'; + + public int BonusPoints { get; set; } = 0; + public bool Enabled { get; set; } = true; // happlebao todo: temp hack for program suffixes public string[] Suffixes { get; set; } = {"bat", "appref-ms", "exe", "lnk"}; - public const char SuffixSeperator = ';'; - public int MaxDepth { get; set; } - public Dictionary Meta { get; set; } + public int MaxDepth { get; set; } = -1; - public override string ToString() + public abstract List LoadPrograms(); + + protected Program CreateEntry(string file) { - return (Type ?? "") + ":" + Location ?? ""; + var p = new Program + { + Title = Path.GetFileNameWithoutExtension(file), + IcoPath = file, + Path = file, + Directory = Directory.GetParent(file).FullName + }; + + switch (Path.GetExtension(file).ToLower()) + { + case ".exe": + p.ExecutableName = Path.GetFileName(file); + try + { + var versionInfo = FileVersionInfo.GetVersionInfo(file); + if (!string.IsNullOrEmpty(versionInfo.FileDescription)) + { + p.Title = versionInfo.FileDescription; + } + } + catch (Exception) + { + } + break; + } + return p; } } -} +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/UserStartMenuProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/UserStartMenuProgramSource.cs index 97acba337f..d6489c0f45 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/UserStartMenuProgramSource.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/UserStartMenuProgramSource.cs @@ -1,26 +1,14 @@ using System; -using System.ComponentModel; namespace Wox.Plugin.Program.ProgramSources { + [Serializable] - [Browsable(false)] - public class UserStartMenuProgramSource : FileSystemProgramSource + public sealed class UserStartMenuProgramSource : FileSystemProgramSource { - public UserStartMenuProgramSource(string[] suffixes) - : base(Environment.GetFolderPath(Environment.SpecialFolder.Programs), suffixes) + public UserStartMenuProgramSource() { - } - - public UserStartMenuProgramSource(ProgramSource source) - : this(source.Suffixes) - { - BonusPoints = source.BonusPoints; - } - - public override string ToString() - { - return typeof(UserStartMenuProgramSource).Name; + Location = Environment.GetFolderPath(Environment.SpecialFolder.Programs); } } -} +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs b/Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs index 390e16d164..e484ba55ab 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs @@ -1,5 +1,6 @@ using System.Windows; using System.Linq; +using Wox.Plugin.Program.ProgramSources; namespace Wox.Plugin.Program { diff --git a/Plugins/Wox.Plugin.Program/Settings.cs b/Plugins/Wox.Plugin.Program/Settings.cs index 9acd01d727..6fc052247c 100644 --- a/Plugins/Wox.Plugin.Program/Settings.cs +++ b/Plugins/Wox.Plugin.Program/Settings.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; -using System.ComponentModel; +using Wox.Plugin.Program.ProgramSources; namespace Wox.Plugin.Program { public class Settings { - public List ProgramSources { get; set; } = new List(); + public List ProgramSources { get; set; } = new List(); public string[] ProgramSuffixes { get; set; } = {"bat", "appref-ms", "exe", "lnk"}; public bool EnableStartMenuSource { get; set; } = true; diff --git a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj index 65accfe305..874d0b5b48 100644 --- a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj +++ b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj @@ -61,7 +61,6 @@ AddProgramSource.xaml - From 3b53527e9e8f51977bce95f6e7e874bc2feff8ed Mon Sep 17 00:00:00 2001 From: bao-qian Date: Wed, 20 Jul 2016 23:37:06 +0100 Subject: [PATCH 15/22] fix #813 --- Wox/MainWindow.xaml.cs | 6 +++++- Wox/PublicAPIInstance.cs | 4 ++-- Wox/ViewModel/MainViewModel.cs | 18 +++++++++++++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index de56fa027a..0110e87339 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -235,7 +235,11 @@ namespace Wox private void OnTextChanged(object sender, TextChangedEventArgs e) { - QueryTextBox.CaretIndex = QueryTextBox.Text.Length; + if (_viewModel.QueryTextCursorMovedToEnd) + { + QueryTextBox.CaretIndex = QueryTextBox.Text.Length; + _viewModel.QueryTextCursorMovedToEnd = false; + } } } } \ No newline at end of file diff --git a/Wox/PublicAPIInstance.cs b/Wox/PublicAPIInstance.cs index e9801f686c..86f415727e 100644 --- a/Wox/PublicAPIInstance.cs +++ b/Wox/PublicAPIInstance.cs @@ -36,12 +36,12 @@ namespace Wox public void ChangeQuery(string query, bool requery = false) { - _mainVM.QueryText = query; + _mainVM.ChangeQueryText(query); } public void ChangeQueryText(string query, bool selectAll = false) { - _mainVM.QueryText = query; + _mainVM.ChangeQueryText(query); } [Obsolete] diff --git a/Wox/ViewModel/MainViewModel.cs b/Wox/ViewModel/MainViewModel.cs index d5fa307f69..8cc43084c8 100644 --- a/Wox/ViewModel/MainViewModel.cs +++ b/Wox/ViewModel/MainViewModel.cs @@ -205,7 +205,19 @@ namespace Wox.ViewModel Query(); } } + + /// + /// we need move cursor to end when we manually changed query + /// but we don't want to move cursor to end when query is updated from TextBox + /// + /// + public void ChangeQueryText(string queryText) + { + QueryTextCursorMovedToEnd = true; + QueryText = queryText; + } public bool QueryTextSelected { get; set; } + public bool QueryTextCursorMovedToEnd { get; set; } private ResultsViewModel _selectedResults; private ResultsViewModel SelectedResults @@ -218,7 +230,7 @@ namespace Wox.ViewModel { ContextMenu.Visbility = Visibility.Collapsed; History.Visbility = Visibility.Collapsed; - QueryText = _queryTextBeforeLeaveResults; + ChangeQueryText(_queryTextBeforeLeaveResults); } else { @@ -325,7 +337,7 @@ namespace Wox.ViewModel Action = _ => { SelectedResults = Results; - QueryText = h.Query; + ChangeQueryText(h.Query); return false; } }; @@ -547,7 +559,7 @@ namespace Wox.ViewModel { if (ShouldIgnoreHotkeys()) return; MainWindowVisibility = Visibility.Visible; - QueryText = hotkey.ActionKeyword; + ChangeQueryText(hotkey.ActionKeyword); }); } } From 59fbb2acb1e00c7546d0660cbdd1e96e393d31fb Mon Sep 17 00:00:00 2001 From: Jordy Hulck Date: Thu, 21 Jul 2016 15:50:37 +0200 Subject: [PATCH 16/22] Fix SearchSource editing when action keyword is not changed (#856) * Fixed SearchSource edit * Remove temp var --- Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs b/Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs index 55eab81e16..d1b1bab7a1 100644 --- a/Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs +++ b/Plugins/Wox.Plugin.WebSearch/SearchSourceSetting.xaml.cs @@ -96,11 +96,10 @@ namespace Wox.Plugin.WebSearch private void EditSearchSource() { - var keyword = _searchSource.ActionKeyword; - if (!PluginManager.ActionKeywordRegistered(keyword)) + var newKeyword = _searchSource.ActionKeyword; + var oldKeyword = _oldSearchSource.ActionKeyword; + if (!PluginManager.ActionKeywordRegistered(newKeyword) || oldKeyword == newKeyword) { - var newKeyword = keyword; - var oldKeyword = _oldSearchSource.ActionKeyword; var id = _context.CurrentPluginMetadata.ID; PluginManager.ReplaceActionKeyword(id, oldKeyword, newKeyword); From a8c200f25aa72e4574df9aba8085ec675fe5c3fd Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 21 Jul 2016 00:02:13 +0100 Subject: [PATCH 17/22] simple refactoring --- .../Wox.Plugin.Program/FileChangeWatcher.cs | 23 +++++++------------ Plugins/Wox.Plugin.Program/Main.cs | 5 ++-- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs b/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs index 0ab797d9c9..95853d4628 100644 --- a/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs +++ b/Plugins/Wox.Plugin.Program/FileChangeWatcher.cs @@ -1,33 +1,31 @@ using System.Collections.Generic; using System.IO; -using System.Threading; using System.Threading.Tasks; using Wox.Infrastructure.Logger; namespace Wox.Plugin.Program { - internal class FileChangeWatcher + internal static class FileChangeWatcher { - private static bool isIndexing; - private static List watchedPath = new List(); + private static readonly List WatchedPath = new List(); public static void AddWatch(string path, string[] programSuffixes, bool includingSubDirectory = true) { - if (watchedPath.Contains(path)) return; + if (WatchedPath.Contains(path)) return; if (!Directory.Exists(path)) { Log.Warn($"FileChangeWatcher: {path} doesn't exist"); return; } - watchedPath.Add(path); + WatchedPath.Add(path); foreach (string fileType in programSuffixes) { FileSystemWatcher watcher = new FileSystemWatcher { Path = path, IncludeSubdirectories = includingSubDirectory, - Filter = string.Format("*.{0}", fileType), + Filter = $"*.{fileType}", EnableRaisingEvents = true }; watcher.Changed += FileChanged; @@ -39,15 +37,10 @@ namespace Wox.Plugin.Program private static void FileChanged(object source, FileSystemEventArgs e) { - if (!isIndexing) + Task.Run(() => { - Task.Run(() => - { - Main.IndexPrograms(); - isIndexing = false; - }); - } + Main.IndexPrograms(); + }); } - } } diff --git a/Plugins/Wox.Plugin.Program/Main.cs b/Plugins/Wox.Plugin.Program/Main.cs index bb0beb7f5f..3ce9971c38 100644 --- a/Plugins/Wox.Plugin.Program/Main.cs +++ b/Plugins/Wox.Plugin.Program/Main.cs @@ -14,7 +14,7 @@ namespace Wox.Plugin.Program { public class Main : ISettingProvider, IPlugin, IPluginI18n, IContextMenu, ISavable { - private static object lockObject = new object(); + private static readonly object IndexLock = new object(); private static List _programs = new List(); private static List _sources = new List(); private static readonly Dictionary SourceTypes = new Dictionary @@ -96,8 +96,7 @@ namespace Wox.Plugin.Program public static void IndexPrograms() { - // todo why there is a lock?? - lock (lockObject) + lock (IndexLock) { var sources = DefaultProgramSources(); if (_settings.ProgramSources != null && From 0c9015bb77f7015db6c98a4dad1a8aa6d6e69c02 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 21 Jul 2016 00:22:00 +0100 Subject: [PATCH 18/22] Program plugin: move files --- .../Wox.Plugin.Program/{ => ProgramSources}/IProgramSource.cs | 0 .../Wox.Plugin.Program/{ => ProgramSources}/ProgramSource.cs | 0 Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename Plugins/Wox.Plugin.Program/{ => ProgramSources}/IProgramSource.cs (100%) rename Plugins/Wox.Plugin.Program/{ => ProgramSources}/ProgramSource.cs (100%) diff --git a/Plugins/Wox.Plugin.Program/IProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/IProgramSource.cs similarity index 100% rename from Plugins/Wox.Plugin.Program/IProgramSource.cs rename to Plugins/Wox.Plugin.Program/ProgramSources/IProgramSource.cs diff --git a/Plugins/Wox.Plugin.Program/ProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs similarity index 100% rename from Plugins/Wox.Plugin.Program/ProgramSource.cs rename to Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs diff --git a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj index cbc3820a35..65accfe305 100644 --- a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj +++ b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj @@ -61,7 +61,7 @@ AddProgramSource.xaml - + @@ -69,7 +69,7 @@ ProgramSetting.xaml - + From 1de68051e37c0890b3a66bcc7d1ed0b6c7b57a94 Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 21 Jul 2016 19:51:47 +0100 Subject: [PATCH 19/22] Program plugin: remove complicated inheritance --- .../AddProgramSource.xaml.cs | 8 +-- Plugins/Wox.Plugin.Program/Main.cs | 30 ++--------- Plugins/Wox.Plugin.Program/Program.cs | 3 +- .../Wox.Plugin.Program/ProgramSetting.xaml.cs | 8 +-- .../ProgramSources/AppPathsProgramSource.cs | 23 +++------ .../CommonStartMenuProgramSource.cs | 36 +++++-------- .../ProgramSources/FileSystemProgramSource.cs | 44 +++++----------- .../ProgramSources/IProgramSource.cs | 49 ------------------ .../ProgramSources/ProgramSource.cs | 51 ++++++++++++++----- .../UserStartMenuProgramSource.cs | 22 ++------ .../ProgramSuffixes.xaml.cs | 1 + Plugins/Wox.Plugin.Program/Settings.cs | 4 +- .../Wox.Plugin.Program.csproj | 1 - 13 files changed, 93 insertions(+), 187 deletions(-) delete mode 100644 Plugins/Wox.Plugin.Program/ProgramSources/IProgramSource.cs diff --git a/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs b/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs index 253bce41ff..507626eb05 100644 --- a/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs +++ b/Plugins/Wox.Plugin.Program/AddProgramSource.xaml.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Windows; using System.Windows.Forms; +using Wox.Plugin.Program.ProgramSources; namespace Wox.Plugin.Program { @@ -9,7 +10,7 @@ namespace Wox.Plugin.Program /// public partial class AddProgramSource { - private ProgramSource _editing; + private FileSystemProgramSource _editing; private Settings _settings; public AddProgramSource(Settings settings) @@ -20,7 +21,7 @@ namespace Wox.Plugin.Program Directory.Focus(); } - public AddProgramSource(ProgramSource edit, Settings settings) + public AddProgramSource(FileSystemProgramSource edit, Settings settings) { _editing = edit; _settings = settings; @@ -51,12 +52,11 @@ namespace Wox.Plugin.Program if(_editing == null) { - var source = new ProgramSource + var source = new FileSystemProgramSource { Location = Directory.Text, MaxDepth = max, Suffixes = Suffixes.Text.Split(ProgramSource.SuffixSeperator), - Type = "FileSystemProgramSource", Enabled = true }; _settings.ProgramSources.Add(source); diff --git a/Plugins/Wox.Plugin.Program/Main.cs b/Plugins/Wox.Plugin.Program/Main.cs index 3ce9971c38..11b4572c81 100644 --- a/Plugins/Wox.Plugin.Program/Main.cs +++ b/Plugins/Wox.Plugin.Program/Main.cs @@ -16,14 +16,6 @@ namespace Wox.Plugin.Program { private static readonly object IndexLock = new object(); private static List _programs = new List(); - private static List _sources = new List(); - private static readonly Dictionary SourceTypes = new Dictionary - { - {"FileSystemProgramSource", typeof(FileSystemProgramSource)}, - {"CommonStartMenuProgramSource", typeof(CommonStartMenuProgramSource)}, - {"UserStartMenuProgramSource", typeof(UserStartMenuProgramSource)}, - {"AppPathsProgramSource", typeof(AppPathsProgramSource)} - }; private PluginInitContext _context; @@ -105,18 +97,7 @@ namespace Wox.Plugin.Program sources.AddRange(_settings.ProgramSources); } - _sources = sources.AsParallel() - .Where(s => s.Enabled && SourceTypes.ContainsKey(s.Type)) - .Select(s => - { - var sourceClass = SourceTypes[s.Type]; - var constructorInfo = sourceClass.GetConstructor(new[] { typeof(ProgramSource) }); - var programSource = constructorInfo?.Invoke(new object[] { s }) as IProgramSource; - return programSource; - }) - .Where(s => s != null).ToList(); - - _programs = _sources.AsParallel() + _programs = sources.AsParallel() .SelectMany(s => s.LoadPrograms()) // filter duplicate program .GroupBy(x => new { ExecutePath = x.Path, ExecuteName = x.ExecutableName }) @@ -134,23 +115,20 @@ namespace Wox.Plugin.Program { var list = new List { - new ProgramSource + new CommonStartMenuProgramSource { BonusPoints = 0, Enabled = _settings.EnableStartMenuSource, - Type = "CommonStartMenuProgramSource" }, - new ProgramSource + new UserStartMenuProgramSource { BonusPoints = 0, Enabled = _settings.EnableStartMenuSource, - Type = "UserStartMenuProgramSource" }, - new ProgramSource + new AppPathsProgramSource { BonusPoints = -10, Enabled = _settings.EnableRegistrySource, - Type = "AppPathsProgramSource" } }; return list; diff --git a/Plugins/Wox.Plugin.Program/Program.cs b/Plugins/Wox.Plugin.Program/Program.cs index e8c59ac1fc..ff468e674e 100644 --- a/Plugins/Wox.Plugin.Program/Program.cs +++ b/Plugins/Wox.Plugin.Program/Program.cs @@ -2,6 +2,7 @@ using System; using System.Text.RegularExpressions; using System.Threading; using Wox.Infrastructure; +using Wox.Plugin.Program.ProgramSources; namespace Wox.Plugin.Program { @@ -14,6 +15,6 @@ namespace Wox.Plugin.Program public string Directory { get; set; } public string ExecutableName { get; set; } public int Score { get; set; } - public IProgramSource Source { get; set; } + public ProgramSource Source { get; set; } } } \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs b/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs index 5f0430e2b0..f54cc7b3e6 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSetting.xaml.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using Wox.Plugin.Program.ProgramSources; namespace Wox.Plugin.Program { @@ -50,7 +51,7 @@ namespace Wox.Plugin.Program private void btnDeleteProgramSource_OnClick(object sender, RoutedEventArgs e) { - ProgramSource selectedProgramSource = programSourceView.SelectedItem as ProgramSource; + var selectedProgramSource = programSourceView.SelectedItem as FileSystemProgramSource; if (selectedProgramSource != null) { string msg = string.Format(context.API.GetTranslation("wox_plugin_program_delete_program_source"), selectedProgramSource.Location); @@ -70,7 +71,7 @@ namespace Wox.Plugin.Program private void btnEditProgramSource_OnClick(object sender, RoutedEventArgs e) { - ProgramSource selectedProgramSource = programSourceView.SelectedItem as ProgramSource; + var selectedProgramSource = programSourceView.SelectedItem as FileSystemProgramSource; if (selectedProgramSource != null) { var add = new AddProgramSource(selectedProgramSource, _settings); @@ -119,10 +120,9 @@ namespace Wox.Plugin.Program { if (Directory.Exists(s)) { - _settings.ProgramSources.Add(new ProgramSource + _settings.ProgramSources.Add(new FileSystemProgramSource { Location = s, - Type = "FileSystemProgramSource", Enabled = true }); diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/AppPathsProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/AppPathsProgramSource.cs index 47c2b7bae5..9f86e868f4 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/AppPathsProgramSource.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/AppPathsProgramSource.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.IO; using Microsoft.Win32; using Wox.Infrastructure.Logger; @@ -8,24 +7,19 @@ using Wox.Infrastructure.Logger; namespace Wox.Plugin.Program.ProgramSources { [Serializable] - [Browsable(false)] - public class AppPathsProgramSource : AbstractProgramSource + public class AppPathsProgramSource : ProgramSource { public AppPathsProgramSource() { BonusPoints = -10; } - public AppPathsProgramSource(ProgramSource source) : this() - { - BonusPoints = source.BonusPoints; - } - public override List LoadPrograms() { var list = new List(); ReadAppPaths(@"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths", list); - ReadAppPaths(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths", list); //TODO: need test more on 64-bit + ReadAppPaths(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths", list); + //TODO: need test more on 64-bit return list; } @@ -40,12 +34,12 @@ namespace Wox.Plugin.Program.ProgramSources { using (var key = root.OpenSubKey(item)) { - string path = key.GetValue("") as string; + var path = key.GetValue("") as string; if (string.IsNullOrEmpty(path)) continue; // fix path like this ""\"C:\\folder\\executable.exe\""" const int begin = 0; - int end = path.Length - 1; + var end = path.Length - 1; const char quotationMark = '"'; if (path[begin] == quotationMark && path[end] == quotationMark) { @@ -66,10 +60,5 @@ namespace Wox.Plugin.Program.ProgramSources } } } - - public override string ToString() - { - return typeof(AppPathsProgramSource).Name; - } } -} +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/CommonStartMenuProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/CommonStartMenuProgramSource.cs index 2eee434c96..185330be62 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/CommonStartMenuProgramSource.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/CommonStartMenuProgramSource.cs @@ -1,40 +1,30 @@ using System; -using System.ComponentModel; using System.Runtime.InteropServices; using System.Text; namespace Wox.Plugin.Program.ProgramSources { [Serializable] - [Browsable(false)] - public class CommonStartMenuProgramSource : FileSystemProgramSource + public sealed class CommonStartMenuProgramSource : FileSystemProgramSource { + private const int CSIDL_COMMON_PROGRAMS = 0x17; + + // todo happlebao how to pass location before loadPrograms + public CommonStartMenuProgramSource() + { + Location = getPath(); + } + [DllImport("shell32.dll")] - static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, [Out] StringBuilder lpszPath, int nFolder, bool fCreate); - const int CSIDL_COMMON_PROGRAMS = 0x17; + private static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner, [Out] StringBuilder lpszPath, int nFolder, + bool fCreate); private static string getPath() { - StringBuilder commonStartMenuPath = new StringBuilder(560); + var commonStartMenuPath = new StringBuilder(560); SHGetSpecialFolderPath(IntPtr.Zero, commonStartMenuPath, CSIDL_COMMON_PROGRAMS, false); return commonStartMenuPath.ToString(); } - - public CommonStartMenuProgramSource(string[] suffixes) - : base(getPath(), suffixes) - { - } - - public CommonStartMenuProgramSource(ProgramSource source) - : this(source.Suffixes) - { - BonusPoints = source.BonusPoints; - } - - public override string ToString() - { - return typeof(CommonStartMenuProgramSource).Name; - } } -} +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs index 420d6172a3..718aafd7cc 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/FileSystemProgramSource.cs @@ -8,35 +8,17 @@ using Wox.Infrastructure.Logger; namespace Wox.Plugin.Program.ProgramSources { [Serializable] - public class FileSystemProgramSource : AbstractProgramSource + public class FileSystemProgramSource : ProgramSource { - private string _baseDirectory; - private int _maxDepth; - private string[] _suffixes; - - public FileSystemProgramSource(string baseDirectory, int maxDepth, string[] suffixes) - { - _baseDirectory = baseDirectory; - _maxDepth = maxDepth; - _suffixes = suffixes; - } - - public FileSystemProgramSource(string baseDirectory, string[] suffixes) - : this(baseDirectory, -1, suffixes) {} - - public FileSystemProgramSource(ProgramSource source) - : this(source.Location, source.MaxDepth, source.Suffixes) - { - BonusPoints = source.BonusPoints; - } + public string Location { get; set; } = ""; public override List LoadPrograms() { - List list = new List(); - if (Directory.Exists(_baseDirectory)) + var list = new List(); + if (Directory.Exists(Location)) { - GetAppFromDirectory(_baseDirectory, list); - FileChangeWatcher.AddWatch(_baseDirectory, _suffixes); + GetAppFromDirectory(Location, list); + FileChangeWatcher.AddWatch(Location, Suffixes); } return list; } @@ -48,17 +30,17 @@ namespace Wox.Plugin.Program.ProgramSources private void GetAppFromDirectory(string path, List list, int depth) { - if(_maxDepth != -1 && depth > _maxDepth) + if (MaxDepth != -1 && depth > MaxDepth) { return; } try { - foreach (string file in Directory.GetFiles(path)) + foreach (var file in Directory.GetFiles(path)) { - if (_suffixes.Any(o => file.EndsWith("." + o))) + if (Suffixes.Any(o => file.EndsWith("." + o))) { - Program p = CreateEntry(file); + var p = CreateEntry(file); p.Source = this; list.Add(p); } @@ -75,10 +57,10 @@ namespace Wox.Plugin.Program.ProgramSources Log.Exception(woxPluginException); } } - public override string ToString() { - return typeof(FileSystemProgramSource).Name + ":" + _baseDirectory; + var display = GetType().Name + Location; + return display; } } -} +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/IProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/IProgramSource.cs deleted file mode 100644 index 6df37995c9..0000000000 --- a/Plugins/Wox.Plugin.Program/ProgramSources/IProgramSource.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; - -namespace Wox.Plugin.Program -{ - public interface IProgramSource - { - List LoadPrograms(); - int BonusPoints { get; set; } - } - - [Serializable] - public abstract class AbstractProgramSource : IProgramSource - { - public abstract List LoadPrograms(); - - public int BonusPoints { get; set; } - - protected Program CreateEntry(string file) - { - var p = new Program - { - Title = Path.GetFileNameWithoutExtension(file), - IcoPath = file, - Path = file, - Directory = Directory.GetParent(file).FullName - }; - - switch (Path.GetExtension(file).ToLower()) - { - case ".exe": - p.ExecutableName = Path.GetFileName(file); - try - { - FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(file); - if (!string.IsNullOrEmpty(versionInfo.FileDescription)) - { - p.Title = versionInfo.FileDescription; - } - } - catch (Exception) { } - break; - } - return p; - } - } -} diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs index 1345c51f4a..9e4e839e32 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/ProgramSource.cs @@ -1,24 +1,51 @@ using System; using System.Collections.Generic; +using System.Diagnostics; +using System.IO; -namespace Wox.Plugin.Program +namespace Wox.Plugin.Program.ProgramSources { [Serializable] - public class ProgramSource + public abstract class ProgramSource { - public string Location { get; set; } - public string Type { get; set; } - public int BonusPoints { get; set; } - public bool Enabled { get; set; } + public const char SuffixSeperator = ';'; + + public int BonusPoints { get; set; } = 0; + public bool Enabled { get; set; } = true; // happlebao todo: temp hack for program suffixes public string[] Suffixes { get; set; } = {"bat", "appref-ms", "exe", "lnk"}; - public const char SuffixSeperator = ';'; - public int MaxDepth { get; set; } - public Dictionary Meta { get; set; } + public int MaxDepth { get; set; } = -1; - public override string ToString() + public abstract List LoadPrograms(); + + protected Program CreateEntry(string file) { - return (Type ?? "") + ":" + Location ?? ""; + var p = new Program + { + Title = Path.GetFileNameWithoutExtension(file), + IcoPath = file, + Path = file, + Directory = Directory.GetParent(file).FullName + }; + + switch (Path.GetExtension(file).ToLower()) + { + case ".exe": + p.ExecutableName = Path.GetFileName(file); + try + { + var versionInfo = FileVersionInfo.GetVersionInfo(file); + if (!string.IsNullOrEmpty(versionInfo.FileDescription)) + { + p.Title = versionInfo.FileDescription; + } + } + catch (Exception) + { + } + break; + } + return p; } } -} +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/ProgramSources/UserStartMenuProgramSource.cs b/Plugins/Wox.Plugin.Program/ProgramSources/UserStartMenuProgramSource.cs index 97acba337f..d6489c0f45 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSources/UserStartMenuProgramSource.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSources/UserStartMenuProgramSource.cs @@ -1,26 +1,14 @@ using System; -using System.ComponentModel; namespace Wox.Plugin.Program.ProgramSources { + [Serializable] - [Browsable(false)] - public class UserStartMenuProgramSource : FileSystemProgramSource + public sealed class UserStartMenuProgramSource : FileSystemProgramSource { - public UserStartMenuProgramSource(string[] suffixes) - : base(Environment.GetFolderPath(Environment.SpecialFolder.Programs), suffixes) + public UserStartMenuProgramSource() { - } - - public UserStartMenuProgramSource(ProgramSource source) - : this(source.Suffixes) - { - BonusPoints = source.BonusPoints; - } - - public override string ToString() - { - return typeof(UserStartMenuProgramSource).Name; + Location = Environment.GetFolderPath(Environment.SpecialFolder.Programs); } } -} +} \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs b/Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs index 390e16d164..e484ba55ab 100644 --- a/Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs +++ b/Plugins/Wox.Plugin.Program/ProgramSuffixes.xaml.cs @@ -1,5 +1,6 @@ using System.Windows; using System.Linq; +using Wox.Plugin.Program.ProgramSources; namespace Wox.Plugin.Program { diff --git a/Plugins/Wox.Plugin.Program/Settings.cs b/Plugins/Wox.Plugin.Program/Settings.cs index 9acd01d727..6fc052247c 100644 --- a/Plugins/Wox.Plugin.Program/Settings.cs +++ b/Plugins/Wox.Plugin.Program/Settings.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; -using System.ComponentModel; +using Wox.Plugin.Program.ProgramSources; namespace Wox.Plugin.Program { public class Settings { - public List ProgramSources { get; set; } = new List(); + public List ProgramSources { get; set; } = new List(); public string[] ProgramSuffixes { get; set; } = {"bat", "appref-ms", "exe", "lnk"}; public bool EnableStartMenuSource { get; set; } = true; diff --git a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj index 65accfe305..874d0b5b48 100644 --- a/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj +++ b/Plugins/Wox.Plugin.Program/Wox.Plugin.Program.csproj @@ -61,7 +61,6 @@ AddProgramSource.xaml - From 0816fdf3188f0ba9867efa223b2da094584d3cbd Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 21 Jul 2016 20:07:23 +0100 Subject: [PATCH 20/22] Program plugin: remove lock lock is not needed since assignment is atomic --- Plugins/Wox.Plugin.Program/Main.cs | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/Plugins/Wox.Plugin.Program/Main.cs b/Plugins/Wox.Plugin.Program/Main.cs index 11b4572c81..c0c09da004 100644 --- a/Plugins/Wox.Plugin.Program/Main.cs +++ b/Plugins/Wox.Plugin.Program/Main.cs @@ -14,7 +14,6 @@ namespace Wox.Plugin.Program { public class Main : ISettingProvider, IPlugin, IPluginI18n, IContextMenu, ISavable { - private static readonly object IndexLock = new object(); private static List _programs = new List(); private PluginInitContext _context; @@ -88,24 +87,21 @@ namespace Wox.Plugin.Program public static void IndexPrograms() { - lock (IndexLock) + var sources = DefaultProgramSources(); + if (_settings.ProgramSources != null && + _settings.ProgramSources.Count(o => o.Enabled) > 0) { - var sources = DefaultProgramSources(); - if (_settings.ProgramSources != null && - _settings.ProgramSources.Count(o => o.Enabled) > 0) - { - sources.AddRange(_settings.ProgramSources); - } - - _programs = sources.AsParallel() - .SelectMany(s => s.LoadPrograms()) - // filter duplicate program - .GroupBy(x => new { ExecutePath = x.Path, ExecuteName = x.ExecutableName }) - .Select(g => g.First()) - .ToList(); - - _cache.Programs = _programs; + sources.AddRange(_settings.ProgramSources); } + + _programs = sources.AsParallel() + .SelectMany(s => s.LoadPrograms()) + // filter duplicate program + .GroupBy(x => new { ExecutePath = x.Path, ExecuteName = x.ExecutableName }) + .Select(g => g.First()) + .ToList(); + + _cache.Programs = _programs; } /// From 10f8941258bd225bbecfdee448fbabd4c7ff5fdc Mon Sep 17 00:00:00 2001 From: bao-qian Date: Thu, 21 Jul 2016 20:49:01 +0100 Subject: [PATCH 21/22] Program plugin: simple refactoring --- Plugins/Wox.Plugin.Program/Main.cs | 123 ++++++++++++++++------------- 1 file changed, 68 insertions(+), 55 deletions(-) diff --git a/Plugins/Wox.Plugin.Program/Main.cs b/Plugins/Wox.Plugin.Program/Main.cs index c0c09da004..851907cfb7 100644 --- a/Plugins/Wox.Plugin.Program/Main.cs +++ b/Plugins/Wox.Plugin.Program/Main.cs @@ -27,8 +27,15 @@ namespace Wox.Plugin.Program { _settingsStorage = new PluginJsonStorage(); _settings = _settingsStorage.Load(); - _cacheStorage = new BinaryStorage(); - _cache = _cacheStorage.Load(); + + Stopwatch.Debug("Preload programs", () => + { + _cacheStorage = new BinaryStorage(); + _cache = _cacheStorage.Load(); + _programs = _cache.Programs; + }); + Log.Info($"Preload {_programs.Count} programs from cache"); + Stopwatch.Debug("Program Index", IndexPrograms); } public void Save() @@ -41,29 +48,35 @@ namespace Wox.Plugin.Program { var results = _programs.AsParallel() .Where(p => Score(p, query.Search) > 0) - .Select(ScoreFilter) .OrderByDescending(p => p.Score) - .Select(p => new Result - { - Title = p.Title, - SubTitle = p.Path, - IcoPath = p.IcoPath, - Score = p.Score, - ContextData = p, - Action = e => - { - var info = new ProcessStartInfo - { - FileName = p.Path, - WorkingDirectory = p.Directory - }; - var hide = StartProcess(info); - return hide; - } - }).ToList(); + .Select(ResultFromProgram) + .ToList(); return results; } + public Result ResultFromProgram(Program p) + { + var result = new Result + { + Title = p.Title, + SubTitle = p.Path, + IcoPath = p.IcoPath, + Score = p.Score, + ContextData = p, + Action = e => + { + var info = new ProcessStartInfo + { + FileName = p.Path, + WorkingDirectory = p.Directory + }; + var hide = StartProcess(info); + return hide; + } + }; + return result; + } + private int Score(Program program, string query) { var score1 = StringMatcher.Score(program.Title, query); @@ -77,39 +90,26 @@ namespace Wox.Plugin.Program public void Init(PluginInitContext context) { _context = context; - Stopwatch.Debug("Preload programs", () => - { - _programs = _cache.Programs; - }); - Log.Info($"Preload {_programs.Count} programs from cache"); - Stopwatch.Debug("Program Index", IndexPrograms); } public static void IndexPrograms() { - var sources = DefaultProgramSources(); - if (_settings.ProgramSources != null && - _settings.ProgramSources.Count(o => o.Enabled) > 0) - { - sources.AddRange(_settings.ProgramSources); - } + var sources = ProgramSources(); - _programs = sources.AsParallel() - .SelectMany(s => s.LoadPrograms()) - // filter duplicate program - .GroupBy(x => new { ExecutePath = x.Path, ExecuteName = x.ExecutableName }) - .Select(g => g.First()) - .ToList(); + var programs = sources.AsParallel() + .SelectMany(s => s.LoadPrograms()) + // filter duplicate program + .GroupBy(x => new { ExecutePath = x.Path, ExecuteName = x.ExecutableName }) + .Select(g => g.First()); + programs = programs.Select(ScoreFilter); + _programs = programs.ToList(); _cache.Programs = _programs; } - /// - /// Load program sources that wox always provide - /// - private static List DefaultProgramSources() + private static List ProgramSources() { - var list = new List + var sources = new List { new CommonStartMenuProgramSource { @@ -127,33 +127,46 @@ namespace Wox.Plugin.Program Enabled = _settings.EnableRegistrySource, } }; - return list; + + if (_settings.ProgramSources.Count(o => o.Enabled) > 0) + { + sources.AddRange(_settings.ProgramSources); + } + + return sources; } - private Program ScoreFilter(Program p) + private static Program ScoreFilter(Program p) { p.Score += p.Source.BonusPoints; + var start = new[] { "启动", "start" }; + var doc = new[] { "帮助", "help", "文档", "documentation" }; + var uninstall = new[] { "卸载", "uninstall" }; - if (p.Title.Contains("启动") || p.Title.ToLower().Contains("start")) + var contained = start.Any(s => p.Title.ToLower().Contains(s)); + if (contained) + { p.Score += 10; - - if (p.Title.Contains("帮助") || p.Title.ToLower().Contains("help") || p.Title.Contains("文档") || p.Title.ToLower().Contains("documentation")) + } + contained = doc.Any(d => p.Title.ToLower().Contains(d)); + if (contained) + { p.Score -= 10; - - if (p.Title.Contains("卸载") || p.Title.ToLower().Contains("uninstall")) + } + contained = uninstall.Any(u => p.Title.ToLower().Contains(u)); + if (contained) + { p.Score -= 20; + } + return p; } - #region ISettingProvider Members - public Control CreateSettingPanel() { return new ProgramSetting(_context, _settings); } - #endregion - public string GetTranslatedPluginTitle() { return _context.API.GetTranslation("wox_plugin_program_plugin_name"); From ba8a675eaa09887e47c817e89acf4339e0ab11fe Mon Sep 17 00:00:00 2001 From: bao-qian Date: Fri, 22 Jul 2016 15:30:16 +0100 Subject: [PATCH 22/22] Update ISSUE_TEMPLATE.md --- ISSUE_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index f1c0f8b0cf..12a2e3ed53 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -6,7 +6,7 @@ Try search existing issues before you open new one 2. Steps to **reproduce** the bug: 3. Windows version: 4. Exception: -5. **logs** (`%APPDATA%\Wox\Logs\version\date.txt`): +5. **whole** log file (`%APPDATA%\Wox\Logs\version\date.txt`): 6. Screenshot (optional): ## 中文 / Chinese @@ -17,5 +17,5 @@ Try search existing issues before you open new one 2. 如何**重现** bug: 3. Windows 版本: 4. Exception: -5. **logs** (`%APPDATA%\Wox\Logs\version\date.txt`): +5. **整个** log 文件 (`%APPDATA%\Wox\Logs\version\date.txt`): 6. 截图 (可选):