mirror of
https://github.com/Stone-Red-Code/Commander.NET.git
synced 2026-09-04 00:46:08 +02:00
Update project to .NET 8
This commit is contained in:
@@ -4,14 +4,14 @@ namespace Commander;
|
|||||||
|
|
||||||
public class Command
|
public class Command
|
||||||
{
|
{
|
||||||
internal readonly List<Command> subCommands = new();
|
internal readonly List<Command> subCommands = [];
|
||||||
public string[] Identifiers { get; set; }
|
public string[] Identifiers { get; set; }
|
||||||
public Func<string, CommandResult> Method { get; set; }
|
public Func<string, CommandResult> Method { get; set; }
|
||||||
public HelpText HelpText { get; set; }
|
public HelpText HelpText { get; set; }
|
||||||
|
|
||||||
public Command()
|
public Command()
|
||||||
{
|
{
|
||||||
Identifiers = Array.Empty<string>();
|
Identifiers = [];
|
||||||
HelpText = string.Empty;
|
HelpText = string.Empty;
|
||||||
Method = new Func<string, CommandResult>((_) => CommandResult.Success());
|
Method = new Func<string, CommandResult>((_) => CommandResult.Success());
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ public class Command
|
|||||||
string[] inputParts = input.Split(' ');
|
string[] inputParts = input.Split(' ');
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
commandResults ??= new List<CommandResult>();
|
commandResults ??= [];
|
||||||
|
|
||||||
foreach (Command? command in subCommands.Where(command => command.Identifiers.Contains(inputParts[0])))
|
foreach (Command? command in subCommands.Where(command => command.Identifiers.Contains(inputParts[0])))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
namespace Commander;
|
namespace Commander;
|
||||||
|
|
||||||
public class CommandResult
|
public class CommandResult(ResultType type, string message = "")
|
||||||
{
|
{
|
||||||
public ResultType ResultType { get; }
|
public ResultType ResultType { get; } = type;
|
||||||
public string Message { get; }
|
public string Message { get; } = message;
|
||||||
|
|
||||||
public CommandResult(ResultType type, string message = "")
|
|
||||||
{
|
|
||||||
ResultType = type;
|
|
||||||
Message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CommandResult Success(string message = "")
|
public static CommandResult Success(string message = "")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||||
|
|||||||
Reference in New Issue
Block a user