Interface IConsoleCommandRegistrar
- Namespace
- SkyrimForge
- Assembly
- SkyrimForge.dll
Adds console commands that run managed handlers.
public interface IConsoleCommandRegistrar
- Extension Methods
Remarks
The console command table has a fixed size, so each command replaces an entry the game has disabled: one whose name begins with a space, which the console cannot match. Skyrim 1.6.1170 has 43 such entries. A command remains until the game exits. Every argument is optional text. Call members on the game's thread.
Methods
Register(string, string?, string, IEnumerable<string>, Func<ObjectReference?, IReadOnlyList<string>, Task>)
Adds a console command whose handler returns a task.
void Register(string name, string? shortName, string help, IEnumerable<string> parameterNames, Func<ObjectReference?, IReadOnlyList<string>, Task> handler)
Parameters
namestringThe name the console matches, regardless of case.
shortNamestringA second name the console matches, or null.
helpstringThe text the console's help command shows.
parameterNamesIEnumerable<string>One name per argument. The console passes as many arguments as were entered, up to this count.
handlerFunc<ObjectReference?, IReadOnlyList<string>, Task>Runs on the game's thread for a command typed in the console, and on the caller's thread for one run through IConsoleCommands. The console does not wait for its task. An exception it throws, or one its task faults with, is written to the plugin's log.
Exceptions
- ArgumentNullException
name,help,parameterNames, orhandlerisnull.- ArgumentException
nameis empty, a name contains white space, or a console or script command already hasnameorshortName.- InvalidOperationException
No disabled entry remains.