You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding a class that implements **InEngine.Core.ICommand** is the simplest way to create a command.
30
-
31
-
```c#
32
-
usingSystem;
33
-
usingInEngine.Core;
34
-
35
-
namespaceMyCommandPlugin
36
-
{
37
-
publicclassMyCommand : ICommand
38
-
{
39
-
publicvoidRun()
40
-
{
41
-
Console.WriteLine("Hello, world!");
42
-
}
43
-
}
44
-
}
45
-
```
46
-
47
-
A command that implements ICommand can be run directly or [queued](queuing), but it cannot be [scheduled](scheduling).
48
-
Extending the **InEngine.Core.AbstractCommand** class adds extra functionality, like a progress bar, and the ability to schedule the command using the scheduler.
31
+
To create a class command, extend the **InEngine.Core.AbstractCommand** class.
49
32
Minimally, the Run method should be overridden.
50
33
51
34
```c#
@@ -66,10 +49,10 @@ namespace MyCommandPlugin
66
49
67
50
## Run a Command
68
51
69
-
Create a class that implements**InEngine.Core.IOptions** in the same assembly as the command class.
70
-
Add a VerbOptions attribute, from the CommandLine namespace, that defines the name of the command.
71
-
Optional help text can also be specified in the VerbOption attribute.
72
-
The help text can be auto-generated from the attribute or manually specified in the GetUsage method if desired.
52
+
Create a class that extends**InEngine.Core.AbstractPlugin** in the same assembly as the command class.
53
+
Add a VerbOptions attribute, from the **CommandLine** namespace, that defines the name of the command.
54
+
55
+
This class registers a command in the MyPlugin assembly called "mycommand":
73
56
74
57
```c#
75
58
usingCommandLine;
@@ -78,135 +61,26 @@ using InEngine.Core;
78
61
79
62
namespaceMyCommandPlugin
80
63
{
81
-
publicclassMyOptions : IOptions
64
+
publicclassMyPlugin : AbstractPlugin
82
65
{
83
-
[VerbOption("my-command", HelpText="My example command.")]
66
+
[VerbOption("mycommand", HelpText="My example command.")]
84
67
publicMyCommandMyCommand { get; set; }
85
-
86
-
[HelpVerbOption]
87
-
publicstringGetUsage(stringverb)
88
-
{
89
-
returnHelpText.AutoBuild(this, verb);
90
-
}
91
68
}
92
69
}
93
70
```
94
71
95
72
Download the InEngine binary distribution, from the [GitHub Releases](https://github.com/InEngine-NET/InEngine.NET/releases) page, that matches the version of the InEngine.Core package you included.
96
73
97
74
Copy your project's DLLs into the Plugins subdirectory included in the binary distribution.
98
-
Add your plugin to the ["Plugins" list in appsettings.config](configuration) at the root of the binary distribution.
75
+
Add your plugin to the "Plugins" list in [appsettings.config](configuration) at the root of the binary distribution.
99
76
100
77
Run your command:
101
78
102
79
```bash
103
-
inengine.exe -pMyCommandPlugin my-command
104
-
```
105
-
106
-
### Executing Arbitrary Processes
107
-
108
-
It isn't necessary to create C# classes to utilize InEngine.NET.
109
-
Arbitrary commands can be run, with an argument list by leveraging the InEngine.Core plugin's **proc** command.
110
-
The command lists directory contents using "ls" with the "-lhp" switches:
0 commit comments