From 87ce03e13e8fda8e8629a8ebca512e9b8a0cb094 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Fri, 19 Sep 2014 16:57:48 +0800 Subject: [PATCH] Move Log to Infrastructure project. --- .../Wox.Plugin.PluginManagement.csproj | 173 +++++++++--------- .../packages.config | 2 +- .../Logger}/Log.cs | 2 +- Wox.Infrastructure/Properties/AssemblyInfo.cs | 73 ++++---- Wox.Infrastructure/Wox.Infrastructure.csproj | 10 +- Wox.Infrastructure/packages.config | 3 +- .../ProgramSources/FileSystemProgramSource.cs | 10 +- .../Wox.Plugin.SystemPlugins.csproj | 9 +- Wox.Plugin.SystemPlugins/packages.config | 3 +- Wox/Commands/PluginCommand.cs | 1 + Wox/Helper/ErrorReporting/ErrorReporting.cs | 1 + Wox/PluginLoader/BasePlugin.cs | 3 +- Wox/PluginLoader/CSharpPluginLoader.cs | 1 + Wox/PluginLoader/PluginConfigLoader.cs | 1 + Wox/Properties/AssemblyInfo.cs | 111 ++++++----- Wox/Wox.csproj | 9 +- Wox/packages.config | 2 +- 17 files changed, 220 insertions(+), 194 deletions(-) rename {Wox/Helper => Wox.Infrastructure/Logger}/Log.cs (95%) diff --git a/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj b/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj index 572950461f..4b061e3dfd 100644 --- a/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj +++ b/Plugins/Wox.Plugin.PluginManagement/Wox.Plugin.PluginManagement.csproj @@ -1,87 +1,88 @@ - - - - - Debug - AnyCPU - {049490F0-ECD2-4148-9B39-2135EC346EBE} - Library - Properties - Wox.Plugin.PluginManagement - Wox.Plugin.PluginManagement - v3.5 - 512 - ..\..\ - true - - - true - full - false - ..\..\Output\Debug\Plugins\Wox.Plugin.PluginManagement\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - ..\..\Output\Release\Plugins\Wox.Plugin.PluginManagement\ - TRACE - prompt - 4 - - - - ..\..\packages\Newtonsoft.Json.5.0.8\lib\net35\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - {8451ecdd-2ea4-4966-bb0a-7bbc40138e80} - Wox.Plugin - - - - - - PreserveNewest - - - - - PreserveNewest - - - - - - - - - - - 这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - - - - + + + + + Debug + AnyCPU + {049490F0-ECD2-4148-9B39-2135EC346EBE} + Library + Properties + Wox.Plugin.PluginManagement + Wox.Plugin.PluginManagement + v3.5 + 512 + ..\..\ + true + + + true + full + false + ..\..\Output\Debug\Plugins\Wox.Plugin.PluginManagement\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\Output\Release\Plugins\Wox.Plugin.PluginManagement\ + TRACE + prompt + 4 + + + + False + ..\..\packages\Newtonsoft.Json.6.0.5\lib\net35\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + {8451ecdd-2ea4-4966-bb0a-7bbc40138e80} + Wox.Plugin + + + + + + PreserveNewest + + + + + PreserveNewest + + + + + + + + + + + 这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 + + + + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.PluginManagement/packages.config b/Plugins/Wox.Plugin.PluginManagement/packages.config index 9520f36d83..f4c35941d3 100644 --- a/Plugins/Wox.Plugin.PluginManagement/packages.config +++ b/Plugins/Wox.Plugin.PluginManagement/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Wox/Helper/Log.cs b/Wox.Infrastructure/Logger/Log.cs similarity index 95% rename from Wox/Helper/Log.cs rename to Wox.Infrastructure/Logger/Log.cs index c23785d231..3860b76173 100644 --- a/Wox/Helper/Log.cs +++ b/Wox.Infrastructure/Logger/Log.cs @@ -1,7 +1,7 @@ using System.Reflection; using log4net; -namespace Wox.Helper +namespace Wox.Infrastructure.Logger { public class Log { diff --git a/Wox.Infrastructure/Properties/AssemblyInfo.cs b/Wox.Infrastructure/Properties/AssemblyInfo.cs index e79806fa95..1bffb5142d 100644 --- a/Wox.Infrastructure/Properties/AssemblyInfo.cs +++ b/Wox.Infrastructure/Properties/AssemblyInfo.cs @@ -1,36 +1,37 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("Wox.Infrastructure")] -[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox.Infrastructure")] -[assembly: AssemblyCopyright("The MIT License (MIT)")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID -[assembly: Guid("aee57a31-29e5-4f03-a41f-7917910fe90f")] - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("Wox.Infrastructure")] +[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Wox.Infrastructure")] +[assembly: AssemblyCopyright("The MIT License (MIT)")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("aee57a31-29e5-4f03-a41f-7917910fe90f")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: log4net.Config.XmlConfigurator(Watch = true)] diff --git a/Wox.Infrastructure/Wox.Infrastructure.csproj b/Wox.Infrastructure/Wox.Infrastructure.csproj index 5bdad21908..040b9d2be4 100644 --- a/Wox.Infrastructure/Wox.Infrastructure.csproj +++ b/Wox.Infrastructure/Wox.Infrastructure.csproj @@ -32,9 +32,14 @@ 4 + + False + ..\packages\log4net.2.0.3\lib\net35-full\log4net.dll + - - ..\packages\Newtonsoft.Json.5.0.8\lib\net35\Newtonsoft.Json.dll + + False + ..\packages\Newtonsoft.Json.6.0.5\lib\net35\Newtonsoft.Json.dll @@ -49,6 +54,7 @@ + diff --git a/Wox.Infrastructure/packages.config b/Wox.Infrastructure/packages.config index 9520f36d83..2e2986c62b 100644 --- a/Wox.Infrastructure/packages.config +++ b/Wox.Infrastructure/packages.config @@ -1,4 +1,5 @@  - + + \ No newline at end of file diff --git a/Wox.Plugin.SystemPlugins/Program/ProgramSources/FileSystemProgramSource.cs b/Wox.Plugin.SystemPlugins/Program/ProgramSources/FileSystemProgramSource.cs index 474f88a9e9..5f127b8b22 100644 --- a/Wox.Plugin.SystemPlugins/Program/ProgramSources/FileSystemProgramSource.cs +++ b/Wox.Plugin.SystemPlugins/Program/ProgramSources/FileSystemProgramSource.cs @@ -3,7 +3,9 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; +using log4net.Repository.Hierarchy; using Wox.Infrastructure.Storage.UserSettings; +using Log = Wox.Infrastructure.Logger.Log; namespace Wox.Plugin.SystemPlugins.Program.ProgramSources { @@ -52,11 +54,15 @@ namespace Wox.Plugin.SystemPlugins.Program.ProgramSources } catch (UnauthorizedAccessException e) { - Debug.WriteLine(string.Format("Can't access to directory {0}", path), "WoxDebug"); + Log.Warn(string.Format("Can't access to directory {0}", path)); } catch (DirectoryNotFoundException e) { - //no-operation + Log.Warn(string.Format("Directory {0} doesn't exist", path)); + } + catch (PathTooLongException e) + { + Log.Warn(string.Format("File path too long: {0}", e.Message)); } } diff --git a/Wox.Plugin.SystemPlugins/Wox.Plugin.SystemPlugins.csproj b/Wox.Plugin.SystemPlugins/Wox.Plugin.SystemPlugins.csproj index e915bdf239..d68e9e3a7a 100644 --- a/Wox.Plugin.SystemPlugins/Wox.Plugin.SystemPlugins.csproj +++ b/Wox.Plugin.SystemPlugins/Wox.Plugin.SystemPlugins.csproj @@ -35,8 +35,13 @@ ..\packages\ini-parser.2.0.2\lib\INIFileParser.dll - - ..\packages\Newtonsoft.Json.5.0.8\lib\net35\Newtonsoft.Json.dll + + False + ..\packages\log4net.2.0.3\lib\net35-full\log4net.dll + + + False + ..\packages\Newtonsoft.Json.6.0.5\lib\net35\Newtonsoft.Json.dll diff --git a/Wox.Plugin.SystemPlugins/packages.config b/Wox.Plugin.SystemPlugins/packages.config index 5166ffa5c1..5ada4eb8a9 100644 --- a/Wox.Plugin.SystemPlugins/packages.config +++ b/Wox.Plugin.SystemPlugins/packages.config @@ -1,7 +1,8 @@  - + + \ No newline at end of file diff --git a/Wox/Commands/PluginCommand.cs b/Wox/Commands/PluginCommand.cs index ec3a8edbb6..34707e9daa 100644 --- a/Wox/Commands/PluginCommand.cs +++ b/Wox/Commands/PluginCommand.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using Wox.Helper; +using Wox.Infrastructure.Logger; using Wox.Infrastructure.Storage.UserSettings; using Wox.Plugin; using Wox.PluginLoader; diff --git a/Wox/Helper/ErrorReporting/ErrorReporting.cs b/Wox/Helper/ErrorReporting/ErrorReporting.cs index 2134fa42cf..80063e1cdd 100644 --- a/Wox/Helper/ErrorReporting/ErrorReporting.cs +++ b/Wox/Helper/ErrorReporting/ErrorReporting.cs @@ -8,6 +8,7 @@ using System.Windows.Forms; using System.Windows.Threading; using System.Xml; using Microsoft.Win32; +using Wox.Infrastructure.Logger; namespace Wox.Helper.ErrorReporting { diff --git a/Wox/PluginLoader/BasePlugin.cs b/Wox/PluginLoader/BasePlugin.cs index ce800061c0..81c6154820 100644 --- a/Wox/PluginLoader/BasePlugin.cs +++ b/Wox/PluginLoader/BasePlugin.cs @@ -10,6 +10,7 @@ using System.Windows.Forms; using Newtonsoft.Json; using Wox.Helper; using Wox.Helper.ErrorReporting; +using Wox.Infrastructure.Logger; using Wox.JsonRPC; using Wox.Plugin; using MessageBox = System.Windows.MessageBox; @@ -72,7 +73,7 @@ namespace Wox.PluginLoader catch (Exception e) { ErrorReporting.TryShowErrorMessageBox(e.Message, e); - Wox.Helper.Log.Error(e.Message); + Log.Error(e.Message); } } return null; diff --git a/Wox/PluginLoader/CSharpPluginLoader.cs b/Wox/PluginLoader/CSharpPluginLoader.cs index 2f53855174..8fa07c5801 100644 --- a/Wox/PluginLoader/CSharpPluginLoader.cs +++ b/Wox/PluginLoader/CSharpPluginLoader.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using Wox.Helper; +using Wox.Infrastructure.Logger; using Wox.Plugin; using Wox.Plugin.SystemPlugins; diff --git a/Wox/PluginLoader/PluginConfigLoader.cs b/Wox/PluginLoader/PluginConfigLoader.cs index 0f4ffcf217..f14c45ff7f 100644 --- a/Wox/PluginLoader/PluginConfigLoader.cs +++ b/Wox/PluginLoader/PluginConfigLoader.cs @@ -6,6 +6,7 @@ using System.Reflection; using System.Windows.Forms; using Newtonsoft.Json; using Wox.Helper; +using Wox.Infrastructure.Logger; using Wox.Infrastructure.Storage.UserSettings; using Wox.Plugin; using Wox.Plugin.SystemPlugins; diff --git a/Wox/Properties/AssemblyInfo.cs b/Wox/Properties/AssemblyInfo.cs index cf2bcb8c78..a96441ba2a 100644 --- a/Wox/Properties/AssemblyInfo.cs +++ b/Wox/Properties/AssemblyInfo.cs @@ -1,56 +1,55 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// 有关程序集的常规信息通过以下 -// 特性集控制。更改这些特性值可修改 -// 与程序集关联的信息。 -[assembly: AssemblyTitle("Wox")] -[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Wox")] -[assembly: AssemblyCopyright("The MIT License (MIT)")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// 将 ComVisible 设置为 false 使此程序集中的类型 -// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, -// 则将该类型上的 ComVisible 特性设置为 true。 -[assembly: ComVisible(false)] - -//若要开始生成可本地化的应用程序,请在 -// 中的 .csproj 文件中 -//设置 CultureYouAreCodingWith。例如,如果您在源文件中 -//使用的是美国英语,请将 设置为 en-US。然后取消 -//对以下 NeutralResourceLanguage 特性的注释。更新 -//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //主题特定资源词典所处位置 - //(在页面或应用程序资源词典中 - // 未找到某个资源的情况下使用) - ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 - //(在页面、应用程序或任何主题特定资源词典中 - // 未找到某个资源的情况下使用) -)] - - -// 程序集的版本信息由下面四个值组成: -// -// 主版本 -// 次版本 -// 生成号 -// 修订号 -// -// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, -// 方法是按如下所示使用“*”: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: log4net.Config.XmlConfigurator(Watch = true)] \ No newline at end of file +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("Wox")] +[assembly: AssemblyDescription("https://github.com/qianlifeng/Wox")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Wox")] +[assembly: AssemblyCopyright("The MIT License (MIT)")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +//若要开始生成可本地化的应用程序,请在 +// 中的 .csproj 文件中 +//设置 CultureYouAreCodingWith。例如,如果您在源文件中 +//使用的是美国英语,请将 设置为 en-US。然后取消 +//对以下 NeutralResourceLanguage 特性的注释。更新 +//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //主题特定资源词典所处位置 + //(在页面或应用程序资源词典中 + // 未找到某个资源的情况下使用) + ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 + //(在页面、应用程序或任何主题特定资源词典中 + // 未找到某个资源的情况下使用) +)] + + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index e85b5af86d..14f4194d30 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -64,12 +64,14 @@ False ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - + + False ..\packages\log4net.2.0.3\lib\net35-full\log4net.dll - - ..\packages\Newtonsoft.Json.5.0.8\lib\net35\Newtonsoft.Json.dll + + False + ..\packages\Newtonsoft.Json.6.0.5\lib\net35\Newtonsoft.Json.dll ..\packages\NHotkey.1.1.0.0\lib\NHotkey.dll @@ -133,7 +135,6 @@ - diff --git a/Wox/packages.config b/Wox/packages.config index 2e5ba2b823..35531b8872 100644 --- a/Wox/packages.config +++ b/Wox/packages.config @@ -2,7 +2,7 @@ - +