diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs index b5090868ca..52b4942501 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs @@ -5,8 +5,8 @@ using System; using System.Collections.Generic; using System.Globalization; -using Wox.Infrastructure.Logger; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Microsoft.Plugin.Calculator { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/ContextMenuLoader.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/ContextMenuLoader.cs index be368be864..e1fd857aa6 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/ContextMenuLoader.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/ContextMenuLoader.cs @@ -10,8 +10,8 @@ using System.Reflection; using System.Windows; using System.Windows.Input; using Wox.Infrastructure; -using Wox.Infrastructure.Logger; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Microsoft.Plugin.Folder { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/SearchResult.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/SearchResult.cs index d871b464c4..d2f4e45f70 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/SearchResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/SearchResult.cs @@ -10,8 +10,8 @@ using System.Reflection; using System.Windows; using System.Windows.Input; using Wox.Infrastructure; -using Wox.Infrastructure.Logger; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Microsoft.Plugin.Folder { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/ShellAction.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/ShellAction.cs index d82ff91459..5e452c2668 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/ShellAction.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/ShellAction.cs @@ -7,8 +7,8 @@ using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Text.RegularExpressions; -using Wox.Infrastructure.Logger; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Microsoft.Plugin.Folder.Sources { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/ContextMenuLoader.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/ContextMenuLoader.cs index b2885e8321..820fc2fc91 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/ContextMenuLoader.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/ContextMenuLoader.cs @@ -12,8 +12,8 @@ using System.Windows; using System.Windows.Input; using Microsoft.Plugin.Indexer.SearchHelper; using Wox.Infrastructure; -using Wox.Infrastructure.Logger; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Microsoft.Plugin.Indexer { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Main.cs index 4f9f294949..256bd27bfe 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Main.cs @@ -15,9 +15,9 @@ using Microsoft.Plugin.Indexer.DriveDetection; using Microsoft.Plugin.Indexer.SearchHelper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.Search.Interop; -using Wox.Infrastructure.Logger; using Wox.Infrastructure.Storage; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Microsoft.Plugin.Indexer { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Logger/ProgramLogger.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Logger/ProgramLogger.cs index 825be50585..d04cfff7a4 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Logger/ProgramLogger.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Logger/ProgramLogger.cs @@ -7,7 +7,7 @@ using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using System.Security; -using Wox.Infrastructure.Logger; +using Wox.Plugin.Logger; namespace Microsoft.Plugin.Program.Logger { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Main.cs index 239f77263e..274bd23abd 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Main.cs @@ -11,9 +11,9 @@ using System.Threading.Tasks; using Microsoft.Plugin.Program.ProgramArgumentParser; using Microsoft.Plugin.Program.Programs; using Microsoft.Plugin.Program.Storage; -using Wox.Infrastructure.Logger; using Wox.Infrastructure.Storage; using Wox.Plugin; +using Wox.Plugin.Logger; using Stopwatch = Wox.Infrastructure.Stopwatch; namespace Microsoft.Plugin.Program diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/PackagemanagerWrapper.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/PackagemanagerWrapper.cs index 7a9ee51053..a2b475e37e 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/PackagemanagerWrapper.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/PackagemanagerWrapper.cs @@ -6,7 +6,7 @@ using System; using System.Collections.Generic; using System.Security.Principal; using Windows.Management.Deployment; -using Wox.Infrastructure.Logger; +using Wox.Plugin.Logger; using Package = Windows.ApplicationModel.Package; namespace Microsoft.Plugin.Program.Programs diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs index ed8c2d0537..397ecb6a62 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs @@ -12,7 +12,7 @@ using System.Runtime.InteropServices.ComTypes; using System.Xml.Linq; using Microsoft.Plugin.Program.Logger; using Microsoft.Plugin.Program.Win32; -using Wox.Infrastructure.Logger; +using Wox.Plugin.Logger; namespace Microsoft.Plugin.Program.Programs { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs index f60031f6f8..91acbcfb8f 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs @@ -20,8 +20,8 @@ using Microsoft.Plugin.Program.Logger; using Microsoft.Plugin.Program.Win32; using Wox.Infrastructure; using Wox.Infrastructure.Image; -using Wox.Infrastructure.Logger; using Wox.Plugin; +using Wox.Plugin.Logger; using Wox.Plugin.SharedCommands; using static Microsoft.Plugin.Program.Programs.UWP; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs index 980e8a6a0c..ca984da762 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs @@ -18,8 +18,8 @@ using Microsoft.Plugin.Program.Logger; using Microsoft.Win32; using Wox.Infrastructure; using Wox.Infrastructure.FileSystemHelper; -using Wox.Infrastructure.Logger; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Microsoft.Plugin.Program.Programs { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/Win32ProgramRepository.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/Win32ProgramRepository.cs index 3d2e7d1bf6..78210d4bfc 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/Win32ProgramRepository.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/Win32ProgramRepository.cs @@ -9,8 +9,8 @@ using System.Collections.ObjectModel; using System.Globalization; using System.IO; using System.Threading.Tasks; -using Wox.Infrastructure.Logger; using Wox.Infrastructure.Storage; +using Wox.Plugin.Logger; using Win32Program = Microsoft.Plugin.Program.Programs.Win32Program; namespace Microsoft.Plugin.Program.Storage diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs index f7de0428b6..625638fc66 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs @@ -12,9 +12,9 @@ using System.Linq; using System.Reflection; using System.Windows.Input; using Microsoft.PowerToys.Settings.UI.Library; -using Wox.Infrastructure.Logger; using Wox.Infrastructure.Storage; using Wox.Plugin; +using Wox.Plugin.Logger; using Wox.Plugin.SharedCommands; using Control = System.Windows.Controls.Control; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/Main.cs index 2b05ab239d..db3999f7c2 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/Main.cs @@ -8,9 +8,9 @@ using System.Diagnostics; using System.IO; using System.Text; using Microsoft.Plugin.Uri.UriHelper; -using Wox.Infrastructure.Logger; using Wox.Infrastructure.Storage; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Microsoft.Plugin.Uri { diff --git a/src/modules/launcher/PowerLauncher/App.xaml.cs b/src/modules/launcher/PowerLauncher/App.xaml.cs index 7996f0d2b8..c2bdfe3a37 100644 --- a/src/modules/launcher/PowerLauncher/App.xaml.cs +++ b/src/modules/launcher/PowerLauncher/App.xaml.cs @@ -16,9 +16,9 @@ using Wox.Core.Plugin; using Wox.Infrastructure; using Wox.Infrastructure.Http; using Wox.Infrastructure.Image; -using Wox.Infrastructure.Logger; using Wox.Infrastructure.UserSettings; using Wox.Plugin; +using Wox.Plugin.Logger; using Stopwatch = Wox.Infrastructure.Stopwatch; namespace PowerLauncher diff --git a/src/modules/launcher/PowerLauncher/Helper/ErrorReporting.cs b/src/modules/launcher/PowerLauncher/Helper/ErrorReporting.cs index 27a0c0d08e..0c4b2ec0b9 100644 --- a/src/modules/launcher/PowerLauncher/Helper/ErrorReporting.cs +++ b/src/modules/launcher/PowerLauncher/Helper/ErrorReporting.cs @@ -10,6 +10,7 @@ using System.Windows.Threading; using NLog; using Wox.Infrastructure; using Wox.Infrastructure.Exception; +using Wox.Plugin; namespace PowerLauncher.Helper { diff --git a/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs b/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs index 5d24b77631..31391e8bb3 100644 --- a/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs +++ b/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs @@ -15,7 +15,7 @@ using PowerLauncher.Helper; using PowerLauncher.ViewModel; using Wox.Infrastructure.UserSettings; using KeyEventArgs = System.Windows.Input.KeyEventArgs; -using Log = Wox.Infrastructure.Logger.Log; +using Log = Wox.Plugin.Logger.Log; using Screen = System.Windows.Forms.Screen; namespace PowerLauncher diff --git a/src/modules/launcher/PowerLauncher/ReportWindow.xaml.cs b/src/modules/launcher/PowerLauncher/ReportWindow.xaml.cs index 44d5135007..2bf082b252 100644 --- a/src/modules/launcher/PowerLauncher/ReportWindow.xaml.cs +++ b/src/modules/launcher/PowerLauncher/ReportWindow.xaml.cs @@ -15,7 +15,7 @@ using System.Windows.Navigation; using PowerLauncher.Helper; using Wox.Infrastructure; using Wox.Infrastructure.Image; -using Wox.Infrastructure.Logger; +using Wox.Plugin.Logger; namespace PowerLauncher { diff --git a/src/modules/launcher/PowerLauncher/SettingsWatcher.cs b/src/modules/launcher/PowerLauncher/SettingsWatcher.cs index e526623761..a36ce45032 100644 --- a/src/modules/launcher/PowerLauncher/SettingsWatcher.cs +++ b/src/modules/launcher/PowerLauncher/SettingsWatcher.cs @@ -11,9 +11,9 @@ using Microsoft.PowerToys.Settings.UI.Library.Utilities; using PowerLauncher.Helper; using Wox.Core.Plugin; using Wox.Infrastructure.Hotkey; -using Wox.Infrastructure.Logger; using Wox.Infrastructure.UserSettings; using Wox.Plugin; +using Wox.Plugin.Logger; using JsonException = System.Text.Json.JsonException; namespace PowerLauncher diff --git a/src/modules/launcher/PowerLauncher/ViewModel/ResultViewModel.cs b/src/modules/launcher/PowerLauncher/ViewModel/ResultViewModel.cs index ba2e323dec..3f2a176b09 100644 --- a/src/modules/launcher/PowerLauncher/ViewModel/ResultViewModel.cs +++ b/src/modules/launcher/PowerLauncher/ViewModel/ResultViewModel.cs @@ -9,8 +9,8 @@ using System.Windows.Media; using PowerLauncher.Helper; using Wox.Core.Plugin; using Wox.Infrastructure.Image; -using Wox.Infrastructure.Logger; using Wox.Plugin; +using Wox.Plugin.Logger; namespace PowerLauncher.ViewModel { diff --git a/src/modules/launcher/Wox.Core/Plugin/PluginConfig.cs b/src/modules/launcher/Wox.Core/Plugin/PluginConfig.cs index 11094c0a4e..4c677ed9ec 100644 --- a/src/modules/launcher/Wox.Core/Plugin/PluginConfig.cs +++ b/src/modules/launcher/Wox.Core/Plugin/PluginConfig.cs @@ -8,8 +8,8 @@ using System.IO; using System.Linq; using System.Reflection; using Newtonsoft.Json; -using Wox.Infrastructure.Logger; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Wox.Core.Plugin { diff --git a/src/modules/launcher/Wox.Core/Plugin/PluginInstaller.cs b/src/modules/launcher/Wox.Core/Plugin/PluginInstaller.cs index e70745189d..edf42fe4d1 100644 --- a/src/modules/launcher/Wox.Core/Plugin/PluginInstaller.cs +++ b/src/modules/launcher/Wox.Core/Plugin/PluginInstaller.cs @@ -8,8 +8,8 @@ using System.Reflection; using System.Windows; using ICSharpCode.SharpZipLib.Zip; using Newtonsoft.Json; -using Wox.Infrastructure.Logger; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Wox.Core.Plugin { @@ -41,7 +41,7 @@ namespace Wox.Core.Plugin return; } - string pluginFolderPath = Infrastructure.Constant.PluginsDirectory; + string pluginFolderPath = Constant.PluginsDirectory; // Using Ordinal since this is part of a path string newPluginName = plugin.Name diff --git a/src/modules/launcher/Wox.Core/Plugin/PluginManager.cs b/src/modules/launcher/Wox.Core/Plugin/PluginManager.cs index d225090f3d..687f5460f5 100644 --- a/src/modules/launcher/Wox.Core/Plugin/PluginManager.cs +++ b/src/modules/launcher/Wox.Core/Plugin/PluginManager.cs @@ -11,10 +11,10 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; using Wox.Infrastructure; -using Wox.Infrastructure.Logger; using Wox.Infrastructure.Storage; using Wox.Infrastructure.UserSettings; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Wox.Core.Plugin { diff --git a/src/modules/launcher/Wox.Core/Plugin/PluginsLoader.cs b/src/modules/launcher/Wox.Core/Plugin/PluginsLoader.cs index d946d7fc14..c446cafc82 100644 --- a/src/modules/launcher/Wox.Core/Plugin/PluginsLoader.cs +++ b/src/modules/launcher/Wox.Core/Plugin/PluginsLoader.cs @@ -10,6 +10,7 @@ using System.Runtime.Loader; using Wox.Infrastructure; using Wox.Infrastructure.UserSettings; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Wox.Core.Plugin { @@ -46,7 +47,7 @@ namespace Wox.Core.Plugin } catch (Exception e) { - Infrastructure.Logger.Log.Exception($"Couldn't load assembly for {metadata.Name}", e, MethodBase.GetCurrentMethod().DeclaringType); + Log.Exception($"Couldn't load assembly for {metadata.Name}", e, MethodBase.GetCurrentMethod().DeclaringType); return; } @@ -58,7 +59,7 @@ namespace Wox.Core.Plugin } catch (InvalidOperationException e) { - Infrastructure.Logger.Log.Exception($"Can't find class implement IPlugin for <{metadata.Name}>", e, MethodBase.GetCurrentMethod().DeclaringType); + Log.Exception($"Can't find class implement IPlugin for <{metadata.Name}>", e, MethodBase.GetCurrentMethod().DeclaringType); return; } @@ -69,7 +70,7 @@ namespace Wox.Core.Plugin } catch (Exception e) { - Infrastructure.Logger.Log.Exception($"Can't create instance for <{metadata.Name}>", e, MethodBase.GetCurrentMethod().DeclaringType); + Log.Exception($"Can't create instance for <{metadata.Name}>", e, MethodBase.GetCurrentMethod().DeclaringType); return; } #endif diff --git a/src/modules/launcher/Wox.Core/Resource/FontHelper.cs b/src/modules/launcher/Wox.Core/Resource/FontHelper.cs index 90f6931fef..8575bc1d53 100644 --- a/src/modules/launcher/Wox.Core/Resource/FontHelper.cs +++ b/src/modules/launcher/Wox.Core/Resource/FontHelper.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Reflection; using System.Windows; using System.Windows.Media; -using Wox.Infrastructure.Logger; +using Wox.Plugin.Logger; namespace Wox.Core.Resource { diff --git a/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs b/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs index 8973f0ead2..aa1e123db2 100644 --- a/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs +++ b/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs @@ -8,6 +8,7 @@ using System.Globalization; using System.Linq; using System.Text; using Microsoft.Win32; +using Wox.Plugin; namespace Wox.Infrastructure.Exception { diff --git a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileWrapper.cs b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileWrapper.cs index 4acd853061..816306575d 100644 --- a/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileWrapper.cs +++ b/src/modules/launcher/Wox.Infrastructure/FileSystemHelper/FileWrapper.cs @@ -5,7 +5,7 @@ using System; using System.IO; using System.Security; -using Wox.Infrastructure.Logger; +using Wox.Plugin.Logger; namespace Wox.Infrastructure.FileSystemHelper { diff --git a/src/modules/launcher/Wox.Infrastructure/Helper.cs b/src/modules/launcher/Wox.Infrastructure/Helper.cs index 6b5f839521..b780a6f924 100644 --- a/src/modules/launcher/Wox.Infrastructure/Helper.cs +++ b/src/modules/launcher/Wox.Infrastructure/Helper.cs @@ -8,7 +8,7 @@ using System.IO; using System.Reflection; using Newtonsoft.Json; using Newtonsoft.Json.Converters; -using Wox.Infrastructure.Logger; +using Wox.Plugin.Logger; namespace Wox.Infrastructure { diff --git a/src/modules/launcher/Wox.Infrastructure/Http/Http.cs b/src/modules/launcher/Wox.Infrastructure/Http/Http.cs index 1fdac292c9..52e0d48e1e 100644 --- a/src/modules/launcher/Wox.Infrastructure/Http/Http.cs +++ b/src/modules/launcher/Wox.Infrastructure/Http/Http.cs @@ -9,8 +9,8 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; using JetBrains.Annotations; -using Wox.Infrastructure.Logger; using Wox.Infrastructure.UserSettings; +using Wox.Plugin.Logger; namespace Wox.Infrastructure.Http { diff --git a/src/modules/launcher/Wox.Infrastructure/Image/ImageCache.cs b/src/modules/launcher/Wox.Infrastructure/Image/ImageCache.cs index 52a428cce0..eca8d8f0fe 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/ImageCache.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/ImageCache.cs @@ -7,6 +7,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Windows.Media; +using Wox.Plugin; namespace Wox.Infrastructure.Image { diff --git a/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs b/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs index 8a4d47ca5d..7f5fac8b06 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs @@ -11,9 +11,9 @@ using System.Reflection; using System.Threading.Tasks; using System.Windows.Media; using System.Windows.Media.Imaging; -using Wox.Infrastructure.Logger; using Wox.Infrastructure.Storage; using Wox.Plugin; +using Wox.Plugin.Logger; namespace Wox.Infrastructure.Image { diff --git a/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs b/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs index 54e39b3b3c..d59f481b5c 100644 --- a/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs +++ b/src/modules/launcher/Wox.Infrastructure/Stopwatch.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Reflection; -using Wox.Infrastructure.Logger; +using Wox.Plugin.Logger; namespace Wox.Infrastructure { diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage`1.cs b/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage`1.cs index 62dce38403..59760afbe8 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage`1.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/BinaryStorage`1.cs @@ -8,7 +8,8 @@ using System.Reflection; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters; using System.Runtime.Serialization.Formatters.Binary; -using Wox.Infrastructure.Logger; +using Wox.Plugin; +using Wox.Plugin.Logger; namespace Wox.Infrastructure.Storage { diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs index 75eea78946..1d33d0c79c 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs @@ -6,7 +6,7 @@ using System; using System.Globalization; using System.IO; using Newtonsoft.Json; -using Wox.Infrastructure.Logger; +using Wox.Plugin.Logger; namespace Wox.Infrastructure.Storage { diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository`1.cs b/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository`1.cs index ef86817a44..55b1db2b23 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository`1.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/ListRepository`1.cs @@ -7,7 +7,7 @@ using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using Wox.Infrastructure.Logger; +using Wox.Plugin.Logger; namespace Wox.Infrastructure.Storage { diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage`1.cs b/src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage`1.cs index b8353ff943..ea30f8056e 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage`1.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/PluginJsonStorage`1.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.IO; +using Wox.Plugin; namespace Wox.Infrastructure.Storage { diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage`1.cs b/src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage`1.cs index 5ab52fe2e9..b14577852b 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage`1.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/WoxJsonStorage`1.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.IO; +using Wox.Plugin; namespace Wox.Infrastructure.Storage { diff --git a/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs b/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs index 777b701ca5..5af5d91982 100644 --- a/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs +++ b/src/modules/launcher/Wox.Infrastructure/UserSettings/Settings.cs @@ -84,7 +84,7 @@ namespace Wox.Infrastructure.UserSettings } catch (ArgumentException e) { - Logger.Log.Exception("Failed to load QuerySearchPrecisionString value from Settings file", e, GetType()); + Wox.Plugin.Logger.Log.Exception("Failed to load QuerySearchPrecisionString value from Settings file", e, GetType()); QuerySearchPrecision = StringMatcher.SearchPrecisionScore.Regular; StringMatcher.Instance.UserSettingSearchPrecision = StringMatcher.SearchPrecisionScore.Regular; diff --git a/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj b/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj index d0ef177536..6ec0721a23 100644 --- a/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj +++ b/src/modules/launcher/Wox.Infrastructure/Wox.Infrastructure.csproj @@ -1,4 +1,4 @@ - + @@ -56,7 +56,6 @@ - diff --git a/src/modules/launcher/Wox.Infrastructure/Constant.cs b/src/modules/launcher/Wox.Plugin/Constant.cs similarity index 86% rename from src/modules/launcher/Wox.Infrastructure/Constant.cs rename to src/modules/launcher/Wox.Plugin/Constant.cs index e0abc4e6c7..5bfaac1644 100644 --- a/src/modules/launcher/Wox.Infrastructure/Constant.cs +++ b/src/modules/launcher/Wox.Plugin/Constant.cs @@ -7,10 +7,25 @@ using System.Diagnostics; using System.IO; using System.Reflection; -namespace Wox.Infrastructure +namespace Wox.Plugin { public static class Constant { + /// + /// http://www.yinwang.org/blog-cn/2015/11/21/programming-philosophy + /// + public static string NonNull(this string obj) + { + if (obj == null) + { + throw new NullReferenceException(); + } + else + { + return obj; + } + } + public const string ExeFileName = "PowerLauncher"; public const string ModuleLocation = "Microsoft\\PowerToys\\PowerToys Run"; public const string Plugins = "Plugins"; diff --git a/src/modules/launcher/Wox.Infrastructure/Logger/Log.cs b/src/modules/launcher/Wox.Plugin/Logger/Log.cs similarity index 86% rename from src/modules/launcher/Wox.Infrastructure/Logger/Log.cs rename to src/modules/launcher/Wox.Plugin/Logger/Log.cs index ba97966bad..00bebead1f 100644 --- a/src/modules/launcher/Wox.Infrastructure/Logger/Log.cs +++ b/src/modules/launcher/Wox.Plugin/Logger/Log.cs @@ -9,7 +9,7 @@ using NLog; using NLog.Config; using NLog.Targets; -namespace Wox.Infrastructure.Logger +namespace Wox.Plugin.Logger { public static class Log { @@ -28,7 +28,9 @@ namespace Wox.Infrastructure.Logger var configuration = new LoggingConfiguration(); var target = new FileTarget(); configuration.AddTarget("file", target); - target.FileName = CurrentLogDirectory.Replace(@"\", "/") + "/${shortdate}.txt"; + + // Adding CurrentCulture since this is user facing + target.FileName = CurrentLogDirectory.Replace(@"\", "/", StringComparison.CurrentCulture) + "/${shortdate}.txt"; #if DEBUG var rule = new LoggingRule("*", LogLevel.Debug, target); #else @@ -36,6 +38,7 @@ namespace Wox.Infrastructure.Logger #endif configuration.LoggingRules.Add(rule); LogManager.Configuration = configuration; + target.Dispose(); } private static void LogInternalException(string message, System.Exception e, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) @@ -66,26 +69,51 @@ namespace Wox.Infrastructure.Logger public static void Info(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { + if (fullClassName == null) + { + throw new ArgumentNullException(nameof(fullClassName)); + } + LogInternal(LogLevel.Info, message, fullClassName, methodName, sourceFilePath, sourceLineNumber); } public static void Debug(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { + if (fullClassName == null) + { + throw new ArgumentNullException(nameof(fullClassName)); + } + LogInternal(LogLevel.Debug, message, fullClassName, methodName, sourceFilePath, sourceLineNumber); } public static void Warn(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { + if (fullClassName == null) + { + throw new ArgumentNullException(nameof(fullClassName)); + } + LogInternal(LogLevel.Warn, message, fullClassName, methodName, sourceFilePath, sourceLineNumber); } public static void Error(string message, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { + if (fullClassName == null) + { + throw new ArgumentNullException(nameof(fullClassName)); + } + LogInternal(LogLevel.Error, message, fullClassName, methodName, sourceFilePath, sourceLineNumber); } public static void Exception(string message, System.Exception ex, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { + if (fullClassName == null) + { + throw new ArgumentNullException(nameof(fullClassName)); + } + LogInternalException(message, ex, fullClassName, methodName, sourceFilePath, sourceLineNumber); } diff --git a/src/modules/launcher/Wox.Plugin/SharedCommands/FilesFolders.cs b/src/modules/launcher/Wox.Plugin/SharedCommands/FilesFolders.cs index 932347438f..5e59093b8c 100644 --- a/src/modules/launcher/Wox.Plugin/SharedCommands/FilesFolders.cs +++ b/src/modules/launcher/Wox.Plugin/SharedCommands/FilesFolders.cs @@ -4,11 +4,14 @@ using System; using System.IO; +using System.Reflection; +using Wox.Plugin.Logger; namespace Wox.Plugin.SharedCommands { public static class FilesFolders { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Exception has been logged")] public static void Copy(this string sourcePath, string targetPath) { // Get the subdirectories for the specified directory. @@ -50,6 +53,8 @@ namespace Wox.Plugin.SharedCommands catch (Exception e) #pragma warning restore CS0168 // Variable is declared but never used { + string error = $"Copying path {targetPath} has failed"; + Log.Exception(error, e, MethodBase.GetCurrentMethod().DeclaringType); #if DEBUG throw e; #else @@ -59,6 +64,7 @@ namespace Wox.Plugin.SharedCommands } } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Exception has been logged")] public static bool VerifyBothFolderFilesEqual(this string fromPath, string toPath) { try @@ -82,15 +88,18 @@ namespace Wox.Plugin.SharedCommands catch (Exception e) #pragma warning restore CS0168 // Variable is declared but never used { + string error = $"Unable to verify folders and files between {fromPath} and {toPath}"; + Log.Exception(error, e, MethodBase.GetCurrentMethod().DeclaringType); #if DEBUG throw e; #else - System.Windows.MessageBox.Show(string.Format("Unable to verify folders and files between {0} and {1}", fromPath, toPath)); + System.Windows.MessageBox.Show(string.Format(error)); return false; #endif } } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Exception has been logged")] public static void RemoveFolder(this string path) { try @@ -104,10 +113,12 @@ namespace Wox.Plugin.SharedCommands catch (Exception e) #pragma warning restore CS0168 // Variable is declared but never used { + string error = $"Not able to delete folder {path}, please go to the location and manually delete it"; + Log.Exception(error, e, MethodBase.GetCurrentMethod().DeclaringType); #if DEBUG throw e; #else - System.Windows.MessageBox.Show(string.Format("Not able to delete folder {0}, please go to the location and manually delete it", path)); + System.Windows.MessageBox.Show(string.Format(error)); #endif } } diff --git a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj index 09247ccff1..cb80fc6db9 100644 --- a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj +++ b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj @@ -70,6 +70,7 @@ + all