diff --git a/src/modules/launcher/Wox.Core/Plugin/ExecutablePlugin.cs b/src/modules/launcher/Wox.Core/Plugin/ExecutablePlugin.cs index c485c638f1..36defbe9af 100644 --- a/src/modules/launcher/Wox.Core/Plugin/ExecutablePlugin.cs +++ b/src/modules/launcher/Wox.Core/Plugin/ExecutablePlugin.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + using System.Diagnostics; using Wox.Plugin; @@ -53,4 +56,4 @@ namespace Wox.Core.Plugin return Execute(_startInfo); } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Core/Plugin/JsonPRCModel.cs b/src/modules/launcher/Wox.Core/Plugin/JsonPRCModel.cs index 5a02975b5f..23c3dbd8fc 100644 --- a/src/modules/launcher/Wox.Core/Plugin/JsonPRCModel.cs +++ b/src/modules/launcher/Wox.Core/Plugin/JsonPRCModel.cs @@ -66,7 +66,6 @@ namespace Wox.Core.Plugin } return rpc; - } private string GetParameterByType(object parameter) diff --git a/src/modules/launcher/Wox.Core/Plugin/JsonRPCPlugin.cs b/src/modules/launcher/Wox.Core/Plugin/JsonRPCPlugin.cs index 86118cc15c..d536cd0a3d 100644 --- a/src/modules/launcher/Wox.Core/Plugin/JsonRPCPlugin.cs +++ b/src/modules/launcher/Wox.Core/Plugin/JsonRPCPlugin.cs @@ -1,13 +1,13 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Reflection; -using System.Threading; -using System.Threading.Tasks; using System.Windows.Forms; using Newtonsoft.Json; -using Wox.Infrastructure.Exception; using Wox.Infrastructure.Logger; using Wox.Plugin; @@ -205,4 +205,4 @@ namespace Wox.Core.Plugin context = ctx; } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Core/Plugin/PluginConfig.cs b/src/modules/launcher/Wox.Core/Plugin/PluginConfig.cs index bbb4173350..747407d109 100644 --- a/src/modules/launcher/Wox.Core/Plugin/PluginConfig.cs +++ b/src/modules/launcher/Wox.Core/Plugin/PluginConfig.cs @@ -1,10 +1,12 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections.Generic; using System.Linq; using System.IO; -using System.Threading.Tasks; using Newtonsoft.Json; -using Wox.Infrastructure.Exception; using Wox.Infrastructure.Logger; using Wox.Plugin; @@ -81,7 +83,6 @@ namespace Wox.Core.Plugin return null; } - if (!AllowedLanguage.IsAllowed(metadata.Language)) { Log.Error($"|PluginConfig.GetPluginMetadata|Invalid language <{metadata.Language}> for config <{configPath}>"); @@ -97,4 +98,4 @@ namespace Wox.Core.Plugin return metadata; } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Core/Plugin/PluginInstaller.cs b/src/modules/launcher/Wox.Core/Plugin/PluginInstaller.cs index 01072305ac..701cfd14db 100644 --- a/src/modules/launcher/Wox.Core/Plugin/PluginInstaller.cs +++ b/src/modules/launcher/Wox.Core/Plugin/PluginInstaller.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.IO; using System.Windows; using ICSharpCode.SharpZipLib.Zip; @@ -118,7 +122,6 @@ namespace Wox.Core.Plugin return null; } - if (!AllowedLanguage.IsAllowed(metadata.Language)) { string error = $"Parse plugin config {configPath} failed: invalid language {metadata.Language}"; diff --git a/src/modules/launcher/Wox.Core/Plugin/PluginManager.cs b/src/modules/launcher/Wox.Core/Plugin/PluginManager.cs index 735a344e6f..6d8c695615 100644 --- a/src/modules/launcher/Wox.Core/Plugin/PluginManager.cs +++ b/src/modules/launcher/Wox.Core/Plugin/PluginManager.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; @@ -221,7 +225,6 @@ namespace Wox.Core.Plugin { return new List(); } - } public static bool ActionKeywordRegistered(string actionKeyword) @@ -275,7 +278,6 @@ namespace Wox.Core.Plugin if (oldActionkeyword != Query.GlobalPluginWildcardSign) NonGlobalPlugins.Remove(oldActionkeyword); - plugin.Metadata.ActionKeywords.Remove(oldActionkeyword); } diff --git a/src/modules/launcher/Wox.Core/Plugin/PluginsLoader.cs b/src/modules/launcher/Wox.Core/Plugin/PluginsLoader.cs index fcfdf5b1e7..8616d881ef 100644 --- a/src/modules/launcher/Wox.Core/Plugin/PluginsLoader.cs +++ b/src/modules/launcher/Wox.Core/Plugin/PluginsLoader.cs @@ -1,11 +1,13 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Reflection; using System.Runtime.Loader; using Wox.Infrastructure; -using Wox.Infrastructure.Exception; using Wox.Infrastructure.Logger; using Wox.Infrastructure.UserSettings; using Wox.Plugin; @@ -80,7 +82,6 @@ namespace Wox.Core.Plugin plugins.Add(pair); }); metadata.InitTime += milliseconds; - } return plugins; } @@ -96,6 +97,5 @@ namespace Wox.Core.Plugin }); return plugins; } - } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Core/Plugin/QueryBuilder.cs b/src/modules/launcher/Wox.Core/Plugin/QueryBuilder.cs index ba1142a8cd..8e2e4ac726 100644 --- a/src/modules/launcher/Wox.Core/Plugin/QueryBuilder.cs +++ b/src/modules/launcher/Wox.Core/Plugin/QueryBuilder.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections.Generic; using System.Linq; using Wox.Plugin; @@ -47,4 +51,4 @@ namespace Wox.Core.Plugin return query; } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Core/Resource/AvailableLanguages.cs b/src/modules/launcher/Wox.Core/Resource/AvailableLanguages.cs index e6c1e07f26..53a63b83c3 100644 --- a/src/modules/launcher/Wox.Core/Resource/AvailableLanguages.cs +++ b/src/modules/launcher/Wox.Core/Resource/AvailableLanguages.cs @@ -1,3 +1,7 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + using System.Collections.Generic; namespace Wox.Core.Resource diff --git a/src/modules/launcher/Wox.Core/Resource/FontHelper.cs b/src/modules/launcher/Wox.Core/Resource/FontHelper.cs index 16b0247e15..7680bacd39 100644 --- a/src/modules/launcher/Wox.Core/Resource/FontHelper.cs +++ b/src/modules/launcher/Wox.Core/Resource/FontHelper.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Linq; using System.Windows; using System.Windows.Media; @@ -69,6 +73,5 @@ namespace Wox.Core.Resource return family.FamilyTypefaces.FirstOrDefault(o => o.Style == styleObj && o.Weight == weightObj && o.Stretch == stretchObj) ?? family.ChooseRegularFamilyTypeface(); } - } } diff --git a/src/modules/launcher/Wox.Core/Resource/Internationalization.cs b/src/modules/launcher/Wox.Core/Resource/Internationalization.cs index 53cce9174c..7fb3fdbf8d 100644 --- a/src/modules/launcher/Wox.Core/Resource/Internationalization.cs +++ b/src/modules/launcher/Wox.Core/Resource/Internationalization.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -30,14 +34,12 @@ namespace Wox.Core.Resource AddWoxLanguageDirectory(); } - private void AddWoxLanguageDirectory() { var directory = Path.Combine(Constant.ProgramDirectory, Folder); _languageDirectories.Add(directory); } - private void AddPluginLanguageDirectories() { foreach (var plugin in PluginManager.GetPluginsForInterface()) @@ -96,7 +98,6 @@ namespace Wox.Core.Resource LoadLanguage(language); } UpdatePluginMetadataTranslations(); - } public bool PromptShouldUsePinyin(string languageCodeToSet) @@ -214,4 +215,4 @@ namespace Wox.Core.Resource } } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Core/Resource/InternationalizationManager.cs b/src/modules/launcher/Wox.Core/Resource/InternationalizationManager.cs index ffc2c2ecfe..474a85a29d 100644 --- a/src/modules/launcher/Wox.Core/Resource/InternationalizationManager.cs +++ b/src/modules/launcher/Wox.Core/Resource/InternationalizationManager.cs @@ -1,4 +1,8 @@ -namespace Wox.Core.Resource +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Wox.Core.Resource { public static class InternationalizationManager { @@ -23,4 +27,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Core/Resource/Language.cs b/src/modules/launcher/Wox.Core/Resource/Language.cs index c0bdc1ccb4..c66ae578d2 100644 --- a/src/modules/launcher/Wox.Core/Resource/Language.cs +++ b/src/modules/launcher/Wox.Core/Resource/Language.cs @@ -1,4 +1,8 @@ -namespace Wox.Core.Resource +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Wox.Core.Resource { public class Language { diff --git a/src/modules/launcher/Wox.Core/Wox.Core.csproj b/src/modules/launcher/Wox.Core/Wox.Core.csproj index 0f1657492d..25a66d3e42 100644 --- a/src/modules/launcher/Wox.Core/Wox.Core.csproj +++ b/src/modules/launcher/Wox.Core/Wox.Core.csproj @@ -67,5 +67,19 @@ - + \ No newline at end of file diff --git a/src/modules/launcher/Wox.Infrastructure/Alphabet.cs b/src/modules/launcher/Wox.Infrastructure/Alphabet.cs index 05a7f93377..d7d789b073 100644 --- a/src/modules/launcher/Wox.Infrastructure/Alphabet.cs +++ b/src/modules/launcher/Wox.Infrastructure/Alphabet.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; @@ -79,6 +83,7 @@ namespace Wox.Infrastructure { return; } + _pinyinStorage.Save(GetPinyinCacheAsDictionary()); } diff --git a/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs b/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs index 68aea89399..ecb0c51b95 100644 --- a/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs +++ b/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs @@ -1,9 +1,12 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; -using System.Xml; using Microsoft.Win32; namespace Wox.Infrastructure.Exception @@ -37,6 +40,7 @@ namespace Wox.Infrastructure.Exception exsb.Append(" Source: "); exsb.AppendLine(ex.Source); } + if (ex.TargetSite != null) { exsb.Append(" TargetAssembly: "); @@ -46,6 +50,7 @@ namespace Wox.Infrastructure.Exception exsb.Append(" TargetSite: "); exsb.AppendLine(ex.TargetSite.ToString()); } + exsb.AppendLine(ex.StackTrace); exlist.Add(exsb); @@ -56,6 +61,7 @@ namespace Wox.Infrastructure.Exception { sb.AppendLine(result); } + sb.AppendLine("```"); sb.AppendLine(); @@ -97,6 +103,7 @@ namespace Wox.Infrastructure.Exception sb.Append(ass.Location); } + sb.AppendLine(")"); } @@ -129,6 +136,7 @@ namespace Wox.Infrastructure.Exception { continue; } + foreach (string subKeyName in versionKey.GetSubKeyNames()) { RegistryKey subKey = versionKey.OpenSubKey(subKeyName); @@ -149,6 +157,7 @@ namespace Wox.Infrastructure.Exception } } } + using (RegistryKey ndpKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\")) { int releaseKey = (int)ndpKey.GetValue("Release"); @@ -163,6 +172,7 @@ namespace Wox.Infrastructure.Exception result.Add("4.5.1 installed on Windows 8, Windows 7 SP1, or Windows Vista SP2"); } } + return result; } catch (System.Exception e) diff --git a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileVersionInfoWrapper.cs b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileVersionInfoWrapper.cs index fdba9d2be1..e52f12340e 100644 --- a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileVersionInfoWrapper.cs +++ b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileVersionInfoWrapper.cs @@ -1,4 +1,8 @@ -using System.Diagnostics; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; using System.IO; namespace Wox.Infrastructure.FileSystemHelper diff --git a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileWrapper.cs b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileWrapper.cs index eb1a9b41f2..b2c56f9bb9 100644 --- a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileWrapper.cs +++ b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileWrapper.cs @@ -1,9 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.IO; using Wox.Infrastructure.Logger; -using System.Threading; namespace Wox.Infrastructure.FileSystemHelper { diff --git a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/IFileVersionInfoWrapper.cs b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/IFileVersionInfoWrapper.cs index 70ccbf25a9..66c5bf13dc 100644 --- a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/IFileVersionInfoWrapper.cs +++ b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/IFileVersionInfoWrapper.cs @@ -1,4 +1,8 @@ -using System.Diagnostics; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Diagnostics; namespace Wox.Infrastructure.FileSystemHelper { diff --git a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/IFileWrapper.cs b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/IFileWrapper.cs index 36cb31d3a3..8c6edbed77 100644 --- a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/IFileWrapper.cs +++ b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/IFileWrapper.cs @@ -1,6 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Wox.Infrastructure.FileSystemHelper { diff --git a/src/modules/launcher/Wox.Infrastructure/FuzzyMatcher.cs b/src/modules/launcher/Wox.Infrastructure/FuzzyMatcher.cs index 49520e19d2..1d56ab429f 100644 --- a/src/modules/launcher/Wox.Infrastructure/FuzzyMatcher.cs +++ b/src/modules/launcher/Wox.Infrastructure/FuzzyMatcher.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; namespace Wox.Infrastructure { diff --git a/src/modules/launcher/Wox.Infrastructure/Helper.cs b/src/modules/launcher/Wox.Infrastructure/Helper.cs index 92516b49d8..51e1b0404d 100644 --- a/src/modules/launcher/Wox.Infrastructure/Helper.cs +++ b/src/modules/launcher/Wox.Infrastructure/Helper.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Diagnostics; using System.IO; using Newtonsoft.Json; @@ -97,6 +101,7 @@ namespace Wox.Infrastructure Log.Exception($"Wox.Infrastructure.Helper| Unable to Run {path} as admin : {ex.Message}", ex); } } + public static Process OpenInConsole(string path) { var processStartInfo = new ProcessStartInfo diff --git a/src/modules/launcher/Wox.Infrastructure/Hotkey/HotkeyModel.cs b/src/modules/launcher/Wox.Infrastructure/Hotkey/HotkeyModel.cs index af14e71d3a..abb528ffae 100644 --- a/src/modules/launcher/Wox.Infrastructure/Hotkey/HotkeyModel.cs +++ b/src/modules/launcher/Wox.Infrastructure/Hotkey/HotkeyModel.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections.Generic; using System.Linq; using System.Windows.Input; @@ -13,7 +17,6 @@ namespace Wox.Infrastructure.Hotkey public bool Ctrl { get; set; } public Key CharKey { get; set; } - Dictionary specialSymbolDictionary = new Dictionary { {Key.Space, "Space"}, @@ -29,18 +32,22 @@ namespace Wox.Infrastructure.Hotkey { modifierKeys = ModifierKeys.Alt; } + if (Shift) { modifierKeys = modifierKeys | ModifierKeys.Shift; } + if (Win) { modifierKeys = modifierKeys | ModifierKeys.Windows; } + if (Ctrl) { modifierKeys = modifierKeys | ModifierKeys.Control; } + return modifierKeys; } } @@ -70,27 +77,32 @@ namespace Wox.Infrastructure.Hotkey { return; } + List keys = hotkeyString.Replace(" ", "").Split('+').ToList(); if (keys.Contains("Alt")) { Alt = true; keys.Remove("Alt"); } + if (keys.Contains("Shift")) { Shift = true; keys.Remove("Shift"); } + if (keys.Contains("Win")) { Win = true; keys.Remove("Win"); } + if (keys.Contains("Ctrl")) { Ctrl = true; keys.Remove("Ctrl"); } + if (keys.Count > 0) { string charKey = keys[0]; @@ -120,14 +132,17 @@ namespace Wox.Infrastructure.Hotkey { text += "Ctrl + "; } + if (Alt) { text += "Alt + "; } + if (Shift) { text += "Shift + "; } + if (Win) { text += "Win + "; diff --git a/src/modules/launcher/Wox.Infrastructure/Hotkey/KeyEvent.cs b/src/modules/launcher/Wox.Infrastructure/Hotkey/KeyEvent.cs index 7c601660ec..5ea5c1c423 100644 --- a/src/modules/launcher/Wox.Infrastructure/Hotkey/KeyEvent.cs +++ b/src/modules/launcher/Wox.Infrastructure/Hotkey/KeyEvent.cs @@ -1,3 +1,7 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + namespace Wox.Infrastructure.Hotkey { public enum KeyEvent @@ -22,4 +26,4 @@ namespace Wox.Infrastructure.Hotkey /// WM_SYSKEYDOWN = 260 } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Infrastructure/Http/Http.cs b/src/modules/launcher/Wox.Infrastructure/Http/Http.cs index f8767e6e3e..a2981bd5c5 100644 --- a/src/modules/launcher/Wox.Infrastructure/Http/Http.cs +++ b/src/modules/launcher/Wox.Infrastructure/Http/Http.cs @@ -1,4 +1,8 @@ -using System.IO; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; using System.Net; using System.Net.Http; using System.Text; @@ -80,4 +84,4 @@ namespace Wox.Infrastructure.Http } } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Infrastructure/Image/ImageCache.cs b/src/modules/launcher/Wox.Infrastructure/Image/ImageCache.cs index 29101e7e42..7d229d3dca 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/ImageCache.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/ImageCache.cs @@ -1,8 +1,11 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using System.Windows.Media; namespace Wox.Infrastructure.Image @@ -87,4 +90,4 @@ namespace Wox.Infrastructure.Image } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Infrastructure/Image/ImageHashGenerator.cs b/src/modules/launcher/Wox.Infrastructure/Image/ImageHashGenerator.cs index 68e5be63ac..54f85f3951 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/ImageHashGenerator.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/ImageHashGenerator.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.IO; using System.Security.Cryptography; using System.Windows.Media; @@ -10,6 +14,7 @@ namespace Wox.Infrastructure.Image { string GetHashFromImage(ImageSource image); } + public class ImageHashGenerator : IImageHashGenerator { public string GetHashFromImage(ImageSource imageSource) @@ -46,4 +51,4 @@ namespace Wox.Infrastructure.Image } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs b/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs index 0f83c8a686..1d84caa038 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; @@ -32,7 +36,6 @@ namespace Wox.Infrastructure.Image ".ico" }; - public static void Initialize(Theme theme) { _storage = new BinaryStorage>("Image"); @@ -45,6 +48,7 @@ namespace Wox.Infrastructure.Image img.Freeze(); ImageCache[icon] = img; } + UpdateIconPath(theme); Task.Run(() => { @@ -112,6 +116,7 @@ namespace Wox.Infrastructure.Image { return new ImageResult(ImageCache[ErrorIconPath], ImageType.Error); } + if (ImageCache.ContainsKey(path)) { return new ImageResult(ImageCache[path], ImageType.Cache); @@ -188,6 +193,7 @@ namespace Wox.Infrastructure.Image image = ImageCache[ErrorIconPath]; ImageCache[path] = image; } + return new ImageResult(image, type); } @@ -221,7 +227,6 @@ namespace Wox.Infrastructure.Image ImageCache[path] = img; } - return img; } @@ -235,4 +240,4 @@ namespace Wox.Infrastructure.Image return image; } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Infrastructure/Image/ThumbnailReader.cs b/src/modules/launcher/Wox.Infrastructure/Image/ThumbnailReader.cs index 553aa63481..a10c759855 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/ThumbnailReader.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/ThumbnailReader.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Runtime.InteropServices; using System.IO; using System.Windows.Interop; @@ -49,7 +53,8 @@ namespace Wox.Infrastructure.Image void GetDisplayName(SIGDN sigdnName, out IntPtr ppszName); void GetAttributes(uint sfgaoMask, out uint psfgaoAttribs); void Compare(IShellItem psi, uint hint, out int piOrder); - }; + } +; internal enum SIGDN : uint { @@ -101,8 +106,8 @@ namespace Wox.Infrastructure.Image public int Width { set { width = value; } } public int Height { set { height = value; } } - }; - + } +; public static BitmapSource GetThumbnail(string fileName, int width, int height, ThumbnailOptions options) { @@ -150,4 +155,4 @@ namespace Wox.Infrastructure.Image throw new COMException($"Error while extracting thumbnail for {fileName}", Marshal.GetExceptionForHR((int)hr)); } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Infrastructure/Logger/Log.cs b/src/modules/launcher/Wox.Infrastructure/Logger/Log.cs index d73a6b0488..cb1d2b8cb9 100644 --- a/src/modules/launcher/Wox.Infrastructure/Logger/Log.cs +++ b/src/modules/launcher/Wox.Infrastructure/Logger/Log.cs @@ -1,4 +1,7 @@ -using System.Diagnostics; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + using System.IO; using System.Runtime.CompilerServices; using NLog; @@ -49,8 +52,6 @@ namespace Wox.Infrastructure.Logger return valid; } - - [MethodImpl(MethodImplOptions.Synchronized)] public static void Exception(string className, string message, System.Exception exception, [CallerMemberName] string methodName = "") { @@ -193,4 +194,4 @@ namespace Wox.Infrastructure.Logger LogInternal(message, LogLevel.Warn); } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Infrastructure/Properties/AssemblyInfo.cs b/src/modules/launcher/Wox.Infrastructure/Properties/AssemblyInfo.cs index 92248ee964..5d8a122c39 100644 --- a/src/modules/launcher/Wox.Infrastructure/Properties/AssemblyInfo.cs +++ b/src/modules/launcher/Wox.Infrastructure/Properties/AssemblyInfo.cs @@ -1,6 +1,10 @@ -using System.Runtime.CompilerServices; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Wox")] [assembly: InternalsVisibleTo("PowerLauncher")] [assembly: InternalsVisibleTo("Wox.Core")] -[assembly: InternalsVisibleTo("Wox.Test")] \ No newline at end of file +[assembly: InternalsVisibleTo("Wox.Test")] diff --git a/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs b/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs index 6315654552..7f4f5c1fe5 100644 --- a/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs +++ b/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections.Generic; using Wox.Infrastructure.Logger; diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage.cs b/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage.cs index 8db8564982..3c8f37bb4d 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.IO; using System.Reflection; using System.Runtime.Serialization; @@ -104,6 +108,7 @@ namespace Wox.Infrastructure.Storage break; } } + return ayResult; } @@ -125,6 +130,7 @@ namespace Wox.Infrastructure.Storage Log.Exception($"|BinaryStorage.Save|serialize error for file <{FilePath}>", e); } } + _storageHelper.Close(); Log.Info($"|BinaryStorage.Save|Saving cached data| <{FilePath}>"); } diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/FileSystemWatcherWrapper.cs b/src/modules/launcher/Wox.Infrastructure/Storage/FileSystemWatcherWrapper.cs index bf5f8c2ed9..a4a50b6fdb 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/FileSystemWatcherWrapper.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/FileSystemWatcherWrapper.cs @@ -1,4 +1,8 @@ -using System.Collections.ObjectModel; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.ObjectModel; using System.IO; namespace Wox.Infrastructure.Storage diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/IFileSystemWatcherWrapper.cs b/src/modules/launcher/Wox.Infrastructure/Storage/IFileSystemWatcherWrapper.cs index acb43c0847..8cf72f906e 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/IFileSystemWatcherWrapper.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/IFileSystemWatcherWrapper.cs @@ -1,4 +1,8 @@ -using System.Collections.ObjectModel; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.ObjectModel; using System.IO; namespace Wox.Infrastructure.Storage diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/IRepository.cs b/src/modules/launcher/Wox.Infrastructure/Storage/IRepository.cs index ca8b9f1d26..9bdfdec88c 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/IRepository.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/IRepository.cs @@ -1,7 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; namespace Wox.Infrastructure.Storage { diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/ISavable.cs b/src/modules/launcher/Wox.Infrastructure/Storage/ISavable.cs index 4ff1e3d2f0..872ab0d3f5 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/ISavable.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/ISavable.cs @@ -1,4 +1,8 @@ -namespace Wox.Infrastructure.Storage +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Wox.Infrastructure.Storage { /// /// Save plugin settings/cache, diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/IStorage.cs b/src/modules/launcher/Wox.Infrastructure/Storage/IStorage.cs index 252cc8a9e9..246ec0b818 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/IStorage.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/IStorage.cs @@ -1,7 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Wox.Infrastructure.Storage { diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage.cs b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage.cs index 0ffb4a33a6..61ea32bd1e 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage.cs @@ -1,4 +1,8 @@ -using System; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Globalization; using System.IO; using Newtonsoft.Json; @@ -63,6 +67,7 @@ namespace Wox.Infrastructure.Storage { LoadDefault(); } + return _data.NonNull(); } diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository.cs b/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository.cs index 8c39355d1d..291f2c6502 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository.cs @@ -1,13 +1,12 @@ -using NLog.Filters; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls.Primitives; -using Wox.Infrastructure; using Wox.Infrastructure.Logger; namespace Wox.Infrastructure.Storage diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage.cs b/src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage.cs index c248762760..6f3e259a10 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage.cs @@ -1,4 +1,8 @@ -using System.IO; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.IO; namespace Wox.Infrastructure.Storage { diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs b/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs index 47c3d9c60c..d0f6be88af 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs @@ -1,8 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Text; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.IO; -using System.Windows.Markup; namespace Wox.Infrastructure.Storage { @@ -11,7 +12,6 @@ namespace Wox.Infrastructure.Storage // This detail is accessed by the storage items and is used to decide if the cache must be deleted or not public bool clearCache = false; - private String currentPowerToysVersion = String.Empty; private String FilePath { get; set; } = String.Empty; diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage.cs b/src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage.cs index d58ef876f2..dc8cf91a2b 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage.cs @@ -1,9 +1,8 @@ -using System; -using System.Collections.Generic; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Wox.Infrastructure.Storage { @@ -18,4 +17,4 @@ namespace Wox.Infrastructure.Storage FilePath = Path.Combine(directoryPath, $"{filename}{FileSuffix}"); } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs b/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs index 7ea6a51a62..839ef26415 100644 --- a/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs +++ b/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs @@ -1,6 +1,9 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using static Wox.Infrastructure.StringMatcher; diff --git a/src/modules/launcher/Wox.Infrastructure/UserSettings/HttpProxy.cs b/src/modules/launcher/Wox.Infrastructure/UserSettings/HttpProxy.cs index 5385aca12a..375dc50d65 100644 --- a/src/modules/launcher/Wox.Infrastructure/UserSettings/HttpProxy.cs +++ b/src/modules/launcher/Wox.Infrastructure/UserSettings/HttpProxy.cs @@ -1,4 +1,8 @@ -namespace Wox.Infrastructure.UserSettings +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Wox.Infrastructure.UserSettings { public class HttpProxy { @@ -8,4 +12,4 @@ public string UserName { get; set; } public string Password { get; set; } } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginHotkey.cs b/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginHotkey.cs index aef90a3839..39239d76a5 100644 --- a/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginHotkey.cs +++ b/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginHotkey.cs @@ -1,4 +1,8 @@ -using Wox.Plugin; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Wox.Plugin; namespace Wox.Infrastructure.UserSettings { diff --git a/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginSettings.cs b/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginSettings.cs index 5234185fdb..a7077fd7ed 100644 --- a/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginSettings.cs +++ b/src/modules/launcher/Wox.Infrastructure/UserSettings/PluginSettings.cs @@ -1,4 +1,8 @@ -using System.Collections.Generic; +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; using Wox.Plugin; namespace Wox.Infrastructure.UserSettings @@ -19,6 +23,7 @@ namespace Wox.Infrastructure.UserSettings metadata.ActionKeywords = settings.ActionKeywords; metadata.ActionKeyword = settings.ActionKeywords[0]; } + metadata.Disabled = settings.Disabled; } else @@ -34,6 +39,7 @@ namespace Wox.Infrastructure.UserSettings } } } + public class Plugin { public string ID { get; set; } diff --git a/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs b/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs index f410be79c4..289a5e3f6f 100644 --- a/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs +++ b/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs @@ -1,3 +1,7 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + using System; using System.Collections.ObjectModel; using System.Drawing; @@ -18,6 +22,7 @@ namespace Wox.Infrastructure.UserSettings return _previousHotkey; } } + public string Hotkey { get @@ -34,6 +39,7 @@ namespace Wox.Infrastructure.UserSettings } } } + public string Language { get; set; } = "en"; public string Theme { get; set; } = "Dark"; public string QueryBoxFont { get; set; } = FontFamily.GenericSansSerif.Name; @@ -44,8 +50,7 @@ namespace Wox.Infrastructure.UserSettings public string ResultFontStyle { get; set; } public string ResultFontWeight { get; set; } public string ResultFontStretch { get; set; } - - + /// /// when false Alphabet static service will always return empty results /// @@ -100,6 +105,7 @@ namespace Wox.Infrastructure.UserSettings } } } + public int ActivateTimes { get; set; } // Order defaults to 0 or -1, so 1 will let this property appear last @@ -128,6 +134,7 @@ namespace Wox.Infrastructure.UserSettings OnPropertyChanged(); } } + public bool LeaveCmdOpen { get; set; } public bool HideWhenDeactivated { get; set; } = true; public bool ClearInputOnLaunch { get; set; } = false; @@ -155,4 +162,4 @@ namespace Wox.Infrastructure.UserSettings LayeredWindow = 1, DWM = 2 } -} \ No newline at end of file +} diff --git a/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj b/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj index f605083ad7..18e4cba9c5 100644 --- a/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj +++ b/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj @@ -69,5 +69,19 @@ PreserveNewest - + \ No newline at end of file diff --git a/src/modules/launcher/Wox.Infrastructure/Wox.cs b/src/modules/launcher/Wox.Infrastructure/Wox.cs index 0ec58b419d..ecf65f7aa1 100644 --- a/src/modules/launcher/Wox.Infrastructure/Wox.cs +++ b/src/modules/launcher/Wox.Infrastructure/Wox.cs @@ -1,3 +1,7 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + using System; using System.Diagnostics; using System.IO;