Skip to content

Commit 9f3de26

Browse files
author
starlying
committed
plugins
1 parent 3de2dad commit 9f3de26

File tree

8 files changed

+5
-10
lines changed

8 files changed

+5
-10
lines changed

source/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.vs/
22
packages/
33
**/bin/
4-
**/obj/
4+
**/obj/
5+
Plugins/**/*.dll
-3.5 KB
Binary file not shown.
-3.5 KB
Binary file not shown.
-3.5 KB
Binary file not shown.

source/Plugins/Oss/Aliyun.OSS.dll

-212 KB
Binary file not shown.

source/Plugins/Oss/Oss.dll

-10 KB
Binary file not shown.

source/Plugins/WeiXin/WeiXin.dll

-3.5 KB
Binary file not shown.

source/SiteServer.CMS/Core/Plugin/PluginsLoader.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Diagnostics;
44
using System.Linq;
55
using System.Reflection;
6+
using BaiRong.Core;
67
using SiteServer.Plugin;
78

89
namespace SiteServer.CMS.Core.Plugin
@@ -24,13 +25,6 @@ public static IEnumerable<PluginPair> CSharpPlugins(List<PluginMetadata> metadat
2425
{
2526
var s = Stopwatch.StartNew();
2627

27-
28-
#if DEBUG
29-
var assembly = Assembly.Load(AssemblyName.GetAssemblyName(metadata.ExecuteFilePath));
30-
var types = assembly.GetTypes();
31-
var type = types.First(o => o.IsClass && !o.IsAbstract && o.GetInterfaces().Contains(typeof(IPlugin)));
32-
var plugin = (IPlugin)Activator.CreateInstance(type);
33-
#else
3428
Assembly assembly;
3529
try
3630
{
@@ -47,7 +41,7 @@ public static IEnumerable<PluginPair> CSharpPlugins(List<PluginMetadata> metadat
4741
{
4842
type = types.First(o => o.IsClass && !o.IsAbstract && o.GetInterfaces().Contains(typeof(IPlugin)));
4943
}
50-
catch (InvalidOperationException e)
44+
catch (Exception e)
5145
{
5246
LogUtils.AddErrorLog(e, $"Can't find class implement IPlugin for <{metadata.Name}>");
5347
continue;
@@ -62,7 +56,7 @@ public static IEnumerable<PluginPair> CSharpPlugins(List<PluginMetadata> metadat
6256
LogUtils.AddErrorLog(e, $"Can't create instance for <{metadata.Name}>");
6357
continue;
6458
}
65-
#endif
59+
6660
plugins.Add(new PluginPair(metadata, plugin));
6761

6862
var milliseconds = s.ElapsedMilliseconds;

0 commit comments

Comments
 (0)