SimulateClient is the interactive test harness for TerbinService. Rather than requiring a full mod-manager front-end, it provides a minimal console REPL that connects to the service’s named pipe and lets you invoke any service operation by typing its class name and method name. It is the primary tool for exploring and testing Terbin’s IPC API during development.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/FarlandsModdingTeam/TerbinProyect/llms.txt
Use this file to discover all available pages before exploring further.
How It Works
SimulateClient follows a straightforward reflection-based dispatch loop:- It creates a
TerbinCommunicatorin client mode (false) and connects to the running service. - It registers its own
[TerbinExecutable]handlers so it can receive and print any response packets the service sends back. - In a loop it reads a command string from stdin in the format
ClassName -MethodName. - It uses
Commands.GetClass()andCommands.GetMethod()— two source-generatedRegexhelpers — to extract the class name and one or more-MethodNametokens from the input. - It resolves the class with
Type.GetType("SimulateClient.<ClassName>")and the method withBindingFlags.Static | BindingFlags.Public. - It invokes the method, passing the shared
TerbinCommunicator communicatorinstance. - If the resolved method returns a
Task, itawaits it before prompting again.
SimulateClient also calls
TerbinExecutor.Register(Assembly.GetExecutingAssembly()) on startup. This registers any static methods in the SimulateClient assembly that are decorated with [TerbinExecutable] as handlers for inbound response packets from the server — for example, progress updates and async notifications that the service pushes back to the client.Starting SimulateClient
Ensure TerbinService is running
In a separate terminal, start the service:Wait until the startup TODO diagnostics finish printing and the service is listening on the pipe.
Command Format
ClassName— the name of one of the static command classes in theSimulateClientnamespace (e.g.Inst,Plug,Game).-MethodName— the name of the public static method to call, prefixed with a hyphen.- You can chain multiple methods in one line:
Inst -Create -GetAll. - Two numeric shorthands are built in:
-1resolves toYoloand-2resolves toLittleByLittle.
Available Command Classes
Inst
Instance management. Creates, reads, lists, and deletes Terbin game instances.
| Method | Description |
|---|---|
Create | Prompts for an instance name and sends a CodeServices.Create / Instances packet. |
GetAll | Retrieves all instances; prints each ReferenceInstanceDTO. |
GetOne | Retrieves one instance by name; prints its ManifestInstanceDTO. |
Del | Deletes an instance by name. |
Plug
Plugin management. Installs, removes, lists, and queries plugins within instances or in the central plugin store.
| Method | Description |
|---|---|
Add | Prompts for instance name and plugin GUID; sends an install packet. |
Del | Prompts for instance name and plugin GUID; uninstalls the plugin from that instance. |
Rm | Removes a plugin from the central plugin storage by GUID. |
GetAll | Lists all plugins installed in a named instance (ManifestPluginDTO list). |
GetOne | Gets one plugin by instance name and GUID. |
Game
Game instance operations. Duplicates the base Farlands installation into an instance, deletes a game instance, or launches one.
| Method | Description |
|---|---|
Dup | Duplicates the Farlands installation into a named instance (hardcoded source path for testing). |
Rm | Deletes a game instance by name. |
Exe | Launches a named game instance via CodeServices.Execute. |
Store
Plugin store queries. Lists and inspects entries in the central plugin storage directory.
| Method | Description |
|---|---|
GetAll | Lists all plugins in the store (ReferencePluginStoreDTO list). |
GetOne | Fetches one store entry by plugin GUID. |
Down
Download operations. Exercises the service’s download pipeline against known URLs.
| Method | Description |
|---|---|
LittleByLittle | Downloads BepInEx, UnityExplorer, and FCM sequentially, waiting for confirmation between each step. |
Yolo | Fires all three downloads concurrently without waiting. |
D | Prompts for an arbitrary URL and sends a single download request. |
Yolo
Legacy end-to-end smoke test. The
yolo_old method (marked [Obsolete]) walks through the full workflow — get paths, create instance, duplicate Farlands, install BepInEx, install UnityExplorer, install FCM — step by step with PressAnyKeyToContinue prompts. Useful as a reference for the complete multi-step flow.Example Session
Registering Custom Command Classes
SimulateClient discovers command classes at runtime purely through theType.GetType("SimulateClient.<name>") lookup — there is no registry or attribute required. To add your own commands:
- Create a
staticclass in theSimulateClientnamespace. - Add
public static async Taskmethods that accept a singleTerbinCommunicator communicatorparameter. - Build the project — your class and its methods are immediately available at the REPL.
MyCommands -Ping in the REPL to invoke it.
Helper Utilities
TheHelper static class provides the utility methods used throughout all command classes:
| Method | Description |
|---|---|
Helper.Read(string msg) | Renders an inline prompt and reads a string from the console with live backspace support. |
Helper.IsError(PacketRequest) | Checks the response status; prints the error code (including InternalErrors enum values for InternalWorkerError packets) and calls PressAnyKeyToContinue on failure. Returns true if an error occurred. |
Helper.PrintMethod(params byte[]) | Decodes the ActionMethod byte array into CodeServices, CodeServicesSection, and CodeServicesClient enum names and prints them. |
Helper.Fin() | Prints [Client] ==> FIN and waits for a keypress. |
Helper.PressAnyKeyToContinue() | Prints a prompt and waits for the user to press Enter, then delays 500 ms. |