CommandSystem 1.0.5
See the version list below for details.
dotnet add package CommandSystem --version 1.0.5
NuGet\Install-Package CommandSystem -Version 1.0.5
<PackageReference Include="CommandSystem" Version="1.0.5" />
<PackageVersion Include="CommandSystem" Version="1.0.5" />
<PackageReference Include="CommandSystem" />
paket add CommandSystem --version 1.0.5
#r "nuget: CommandSystem, 1.0.5"
#:package CommandSystem@1.0.5
#addin nuget:?package=CommandSystem&version=1.0.5
#tool nuget:?package=CommandSystem&version=1.0.5
CommandSystem
Add tools for binding classes and methods as string input line for console or input using systems.
Content
Install
Package manager
- In Visual studion open View Tab;
- Select in this tab Other windows;
- Paste code below.
Install-Package CommandSystem -Version 1.0.0
.NET CLI
dotnet add package CommandSystem --version 1.0.0
Packege referance
<PackageReference Include="CommandSystem" Version="1.0.0" />
Set up
using CommandSystem.Routing.Management;
new RequestRouter().SetManagers(new CommandRoutingManager(),
new DirectCommandRoutingManager()).MainLoop();
Using
Name attributes
[Command] attribute
- Can be used both for class and methods;
- Has parametrized version
[Command(name)]; - Can be used only once;
- Is not case-sensative.
Class usage without parameters
- Uses class name as routing value
- Can be used once per class
[Command]
public class Calculator
{
public static int Add(int a, int b)
{
return a + b;
}
}
After that user request calculator will be bind to this class.
Class parameterized [Command(name)] attibute
- Uses parameter as routing value;
- If command name is not found uses class name for routing;
- Can be used once per class.
[Command("Calc")]
public class Calculator
{
public static int Add(int a, int b)
{
return a + b;
}
}
In this case you may use both Calc and Calculator to direct this class.
Method [Command] without parameters
- Uses method name to bind method and routing request;
- Method should be static;
- Can be used only once per method;
- Class that contains command-method may have no attributes.
public class DialogRepresenter
{
[Command]
public static string Hello(string name)
{
return $"Hello, {name}!";
}
}
In this case hello world has the output will be Hello, world!.
Method [Command(name)] parametrized attribute
- Uses provided name to bind method and routing request;
- If provided name is not found in request, uses method name;
- Method should be static;
- Can be used only once per method;
- Class that contains command-method may have no attributes.
public class DialogRepresenter
{
[Command("Greet")]
public static string Hello(string name)
{
return $"Hello, {name}!";
}
}
In this case greet world has the output will be Hello, world! the same as hello world.
Warning: You may use overload attribute with this method marked as [Command] but it's not recomended.
[Alias(alias)] attribute
- Is only parametrized;
- Can be used both for classes and methods;
- Can be used multiple times;
- Do not adds method or class to routing system.
[Command("Calc")]
[Alias("C")]
[Alias("Clc")]
public class Calculator
{
public static int Add(int a, int b)
{
return a + b;
}
}
Routing requests Calc, C, Clc, Calculator directs to one class.
public class DialogRepresenter
{
[Command("Greet")]
[Alias("SayHello")]
public static string Hello(string name)
{
return $"Hello, {name}!";
}
}
In this case attribute is used for method and routing requests Greet, Say hello and Hello directs to one method.
[Overload] attribute
- This attribute is used for methods.
- This methods should be static.
- Register method as command overload.
- If name is not provided uses method name for routing
Warning: In тext vesions overload withoud name parameter will not use method name.
They will be omit and routing request pattern will be CommandName [parameters].
[Command("Calc")]
[Alias("C")]
[Alias("Clc")]
public class Calculator
{
[Overload]
public static int Add(int a, int b)
{
return a + b;
}
}
Adding this attribute alows use Calc add and add parameters after that.
For example calc add 5 12 and result will be displayed as 17.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Change comparing system