-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathPluginBase.cs
131 lines (99 loc) · 3.98 KB
/
PluginBase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
using System;
using System.Collections.Generic;
namespace SiteServer.Plugin
{
/// <summary>
/// 插件父类,所有插件必须继承此类并实现Startup方法。
/// </summary>
public abstract class PluginBase : Initializer, IMetadata
{
/// <summary>
/// 初始化插件。
/// 此方法将由 SiteServer CMS 系统载入插件时调用。
/// </summary>
/// <param name="metadata">插件元数据接口。</param>
public sealed override void Initialize(IMetadata metadata)
{
Id = metadata.Id;
Version = metadata.Version;
IconUrl = metadata.IconUrl;
ProjectUrl = metadata.ProjectUrl;
LicenseUrl = metadata.LicenseUrl;
Copyright = metadata.Copyright;
Description = metadata.Description;
ReleaseNotes = metadata.ReleaseNotes;
RequireLicenseAcceptance = metadata.RequireLicenseAcceptance;
Summary = metadata.Summary;
Title = metadata.Title;
Tags = metadata.Tags;
Authors = metadata.Authors;
Owners = metadata.Owners;
Language = metadata.Language;
}
/// <summary>
/// Startup方法是插件机制的核心,用于定义插件能够提供的各种服务。
/// </summary>
/// <param name="service">插件服务注册接口。</param>
public abstract void Startup(IService service);
/// <inheritdoc />
public string Id { get; private set; }
/// <inheritdoc />
public string Version { get; private set; }
/// <inheritdoc />
public Uri IconUrl { get; private set; }
/// <inheritdoc />
public Uri ProjectUrl { get; private set; }
/// <inheritdoc />
public Uri LicenseUrl { get; private set; }
/// <inheritdoc />
public string Copyright { get; private set; }
/// <inheritdoc />
public string Description { get; private set; }
/// <inheritdoc />
public string ReleaseNotes { get; private set; }
/// <inheritdoc />
public bool RequireLicenseAcceptance { get; private set; }
/// <inheritdoc />
public string Summary { get; private set; }
/// <inheritdoc />
public string Title { get; private set; }
/// <inheritdoc />
public string Tags { get; private set; }
/// <inheritdoc />
public List<string> Authors { get; private set; }
/// <inheritdoc />
public string Owners { get; private set; }
/// <inheritdoc />
public string Language { get; private set; }
///// <inheritdoc />
//public DatabaseType DatabaseType { get; private set; }
///// <inheritdoc />
//public string ConnectionString { get; private set; }
///// <inheritdoc />
//public string AdminDirectory { get; private set; }
///// <inheritdoc />
//public string PhysicalApplicationPath { get; private set; }
///// <inheritdoc />
//public IRequest Request => _environment.Request;
///// <inheritdoc />
//public IAdminApi AdminApi { get; private set; }
///// <inheritdoc />
//public IConfigApi ConfigApi { get; private set; }
///// <inheritdoc />
//public IContentApi ContentApi { get; private set; }
///// <inheritdoc />
//public IDatabaseApi DatabaseApi { get; private set; }
///// <inheritdoc />
//public IChannelApi ChannelApi { get; private set; }
///// <inheritdoc />
//public IParseApi ParseApi { get; private set; }
///// <inheritdoc />
//public IPluginApi PluginApi { get; private set; }
///// <inheritdoc />
//public ISiteApi SiteApi { get; private set; }
///// <inheritdoc />
//public IUserApi UserApi { get; private set; }
///// <inheritdoc />
//public IUtilsApi UtilsApi { get; private set; }
}
}