diff --git a/src/Flandre.Framework/Common/Command.cs b/src/Flandre.Framework/Common/Command.cs index 4566e55..1057549 100644 --- a/src/Flandre.Framework/Common/Command.cs +++ b/src/Flandre.Framework/Common/Command.cs @@ -89,11 +89,11 @@ private void InferFromMethod(MethodBase method) var paramIsParamArray = param.ParameterType.IsArray && param.GetCustomAttribute() is not null; Parameters.Add(new CommandParameter( - name: param.Name!, - type: param.ParameterType, - isRequired: !(paramIsParamArray || param.HasDefaultValue), - defaultValue: param.HasDefaultValue ? param.DefaultValue : null, - isParamArray: paramIsParamArray) { Description = description }); + param.Name!, + param.ParameterType, + !(paramIsParamArray || param.HasDefaultValue), + param.HasDefaultValue ? param.DefaultValue : null, + paramIsParamArray) { Description = description }); } } diff --git a/src/Flandre.Framework/Common/CommandExceptions.cs b/src/Flandre.Framework/Common/CommandExceptions.cs index 656f76d..1c99385 100644 --- a/src/Flandre.Framework/Common/CommandExceptions.cs +++ b/src/Flandre.Framework/Common/CommandExceptions.cs @@ -1,7 +1,14 @@ namespace Flandre.Framework.Common; +/// +/// 指令调用异常 +/// public sealed class CommandInvokeException : Exception { + /// + /// + /// + /// public CommandInvokeException(string message) : base(message) { } diff --git a/src/Flandre.Framework/Common/CommandOption.cs b/src/Flandre.Framework/Common/CommandOption.cs index b2c4ddf..6b41d13 100644 --- a/src/Flandre.Framework/Common/CommandOption.cs +++ b/src/Flandre.Framework/Common/CommandOption.cs @@ -1,17 +1,38 @@ namespace Flandre.Framework.Common; +/// +/// 指令选项 +/// public sealed class CommandOption { + /// + /// 选项名称 + /// public string Name { get; } + /// + /// 选项短名称 + /// public char ShortName { get; } + /// + /// 是否有短名称 + /// public bool HasShortName { get; } + /// + /// 选项类型 + /// public Type Type { get; } + /// + /// 选项默认值 + /// public object? DefaultValue { get; } + /// + /// 选项描述 + /// public string? Description { get; init; } internal CommandOption(string name, char shortName, Type type, object? defaultValue) diff --git a/src/Flandre.Framework/Extensions/SessionExtensions.cs b/src/Flandre.Framework/Extensions/SessionExtensions.cs index 1e3f405..4cdf43d 100644 --- a/src/Flandre.Framework/Extensions/SessionExtensions.cs +++ b/src/Flandre.Framework/Extensions/SessionExtensions.cs @@ -1,5 +1,4 @@ using Flandre.Core.Messaging; -using Flandre.Framework.Common; using Flandre.Framework.Utils; // ReSharper disable once CheckNamespace diff --git a/src/Flandre.Framework/FlandreApp.cs b/src/Flandre.Framework/FlandreApp.cs index 559972d..65f3199 100644 --- a/src/Flandre.Framework/FlandreApp.cs +++ b/src/Flandre.Framework/FlandreApp.cs @@ -3,6 +3,7 @@ using Flandre.Core.Messaging; using Flandre.Framework.Common; using Flandre.Framework.Events; +using Flandre.Framework.Internal; using Flandre.Framework.Routing; using Flandre.Framework.Services; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Flandre.Framework/FlandreAppBuilder.cs b/src/Flandre.Framework/FlandreAppBuilder.cs index 91202bf..e64524f 100644 --- a/src/Flandre.Framework/FlandreAppBuilder.cs +++ b/src/Flandre.Framework/FlandreAppBuilder.cs @@ -1,5 +1,6 @@ using Flandre.Core.Common; using Flandre.Framework.Common; +using Flandre.Framework.Internal; using Flandre.Framework.Services; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; diff --git a/src/Flandre.Framework/Common/DefaultCommandParser.cs b/src/Flandre.Framework/Internal/DefaultCommandParser.cs similarity index 98% rename from src/Flandre.Framework/Common/DefaultCommandParser.cs rename to src/Flandre.Framework/Internal/DefaultCommandParser.cs index e2a2042..2fc850a 100644 --- a/src/Flandre.Framework/Common/DefaultCommandParser.cs +++ b/src/Flandre.Framework/Internal/DefaultCommandParser.cs @@ -1,8 +1,9 @@ using System.Collections; using Flandre.Core.Utils; +using Flandre.Framework.Common; using Flandre.Framework.Services; -namespace Flandre.Framework.Common; +namespace Flandre.Framework.Internal; internal class DefaultCommandParser : ICommandParser { diff --git a/src/Flandre.Framework/Common/PluginCommandLoader.cs b/src/Flandre.Framework/Internal/PluginCommandLoader.cs similarity index 98% rename from src/Flandre.Framework/Common/PluginCommandLoader.cs rename to src/Flandre.Framework/Internal/PluginCommandLoader.cs index f95f453..8dbd892 100644 --- a/src/Flandre.Framework/Common/PluginCommandLoader.cs +++ b/src/Flandre.Framework/Internal/PluginCommandLoader.cs @@ -1,11 +1,12 @@ using System.ComponentModel; using System.Reflection; +using Flandre.Framework.Common; using Flandre.Framework.Routing; using Flandre.Framework.Services; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -namespace Flandre.Framework.Common; +namespace Flandre.Framework.Internal; /// /// 读取指令的上下文 diff --git a/src/Flandre.Framework/Services/MiddlewareService.cs b/src/Flandre.Framework/Services/MiddlewareService.cs new file mode 100644 index 0000000..87fefc4 --- /dev/null +++ b/src/Flandre.Framework/Services/MiddlewareService.cs @@ -0,0 +1,11 @@ +using Flandre.Framework.Common; + +namespace Flandre.Framework.Services; + +/// +/// 中间件服务 +/// +public sealed class MiddlewareService +{ + private readonly List, Task>> _middleware = new(); +} diff --git a/tests/Flandre.Framework.Tests/CommandTests.cs b/tests/Flandre.Framework.Tests/CommandTests.cs index 364b66a..fa7ac91 100644 --- a/tests/Flandre.Framework.Tests/CommandTests.cs +++ b/tests/Flandre.Framework.Tests/CommandTests.cs @@ -1,5 +1,4 @@ using System.ComponentModel; -using System.Text; using Flandre.Core.Common; using Flandre.Framework.Routing; using Flandre.Framework.Services; diff --git a/tests/Flandre.Framework.Tests/Usings.cs b/tests/Flandre.Framework.Tests/Usings.cs index 2a4aba7..bda8fb5 100644 --- a/tests/Flandre.Framework.Tests/Usings.cs +++ b/tests/Flandre.Framework.Tests/Usings.cs @@ -1,4 +1,4 @@ global using Xunit; global using Flandre.Adapters.Mock; global using Flandre.Framework.Common; -global using Flandre.Core.Messaging; \ No newline at end of file +global using Flandre.Core.Messaging;