Skip to main content

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.

Terbin’s data layer uses two parallel class hierarchies: manifest/reference classes (rich domain objects stored as JSON on disk) and DTO structs (compact IStructSerializable structs sent over the named pipe). Every domain object implements IToDTO<T> and IToSerializeDTO, providing a ToDTO() → struct and a ToSerilizeDTO()byte[] shortcut.

Interfaces

IManifest (internal)

internal interface IManifest
{
    string? GetId();
}
Used internally so managers can address any manifest by a string identifier.

Transport interfaces

InterfaceMethodReturns
IToDTO<T>ToDTO()T DTO struct
IToSerializeDTOToSerilizeDTO()byte[] serialized DTO
IDTOmarker only
IPrintablePrint()void (debug console output)

ManifestInstance

A rich in-memory representation of a game instance and its installed plugins. Stored as JSON inside the instance’s directory by ManagerInstances.
public class ManifestInstance : IManifest, IToDTO<ManifestInstanceDTO>, IToSerializeDTO
{
    public string? Name { get; set; }
    public string? Version { get; set; }
    public string? Executable { get; set; }
    public List<ReferencePlugin> Plugins { get; set; } = [];
}
Conversions:
  • ToDTO()ManifestInstanceDTO
  • ToSerilizeDTO()byte[]
  • Explicit cast: (ManifestInstance)ManifestInstanceDTO (restores Name and Version)

ManifestInstanceDTO

The wire format sent when a client requests instance details via ServiceInstances.GetOne.
public struct ManifestInstanceDTO : IStructSerializable, IPrintable
{
    public string? Name { get; set; }
    public string? Version { get; set; }
    public ThreeQuartersInt PluginCount { get; set; }
}
Wire layout (WriteTo/ReadFrom order):
FieldTypeEncoding
Namestring?char[] with 3-byte length prefix
Versionstring?char[] with 3-byte length prefix
PluginCountThreeQuartersInt3 bytes
Explicit cast: (ManifestInstanceDTO)ManifestInstance copies Name, Version, Plugins.Count.

ReferenceInstance

A lightweight index entry for a game instance. Stored in the global ManifestIndex so the service can locate an instance by name without reading its full manifest.
public class ReferenceInstance : IToDTO<ReferenceInstanceDTO>, IToSerializeDTO
{
    public string? Name;
    public bool? OutSide;   // true if the instance lives outside the default instances directory
    public string? Path;    // filesystem path to the instance folder
}

ReferenceInstanceDTO

Wire format for ReferenceInstance, used in ServiceInstances.GetAllInstances responses.
public struct ReferenceInstanceDTO : IStructSerializable, IPrintable
{
    public string? Name;
    public bool? OutSide;
    public string? Path;
}
Wire layout:
FieldTypeEncoding
Namestring?char[] with 3-byte length prefix
OutSidebool?sbyte (1 byte, nullable tri-state)
Pathstring?char[] with 3-byte length prefix

ManifestPlugin

The full record of an installed plugin within a game instance. Stored as JSON in the instance’s plugin manifest by ManagerPlugin.
public class ManifestPlugin : IManifest, IToDTO<ManifestPluginDTO>, IToSerializeDTO
{
    public string? Name { get; set; }
    public string? Id { get; set; }          // ID in the plugin storage registry
    public string? IdLocal { get; set; }     // unique ID generated at install time
    public bool? OutSideIntance { get; set; } // true if installed outside the instance path
    public DirectoryHandwritten HandWritten { get; set; } = new();
}
Id identifies the plugin in the global plugin storage (ReferencePluginStore). IdLocal is a separate identifier generated when the plugin is installed into a specific instance, allowing the same plugin to be registered multiple times in one instance.

ManifestPluginDTO

Wire format for ManifestPlugin, used in ServicePlugins.GetAll and ServicePlugins.GetOne responses.
public struct ManifestPluginDTO : IStructSerializable, IPrintable
{
    public string? Name { get; set; }
    public string? Id { get; set; }
    public string? IdLocal { get; set; }
    public bool? OutSideIntance { get; set; }
}
Wire layout:
FieldTypeEncoding
Namestring?char[] with 3-byte length prefix
Idstring?char[] with 3-byte length prefix
IdLocalstring?char[] with 3-byte length prefix
OutSideIntancebool?sbyte (1 byte, nullable tri-state)

ReferencePluginStore

An entry in the global plugin storage registry. Tracks what has been downloaded but is independent of any specific instance installation.
public class ReferencePluginStore : IManifest, IToDTO<ReferencePluginStoreDTO>, IToSerializeDTO
{
    public string? Name { get; set; }
    public string? Id { get; set; }       // GUID string
    public string? FileName { get; set; } // filename of the downloaded archive
    public string? UrlWeb { get; set; }   // original download URL
    public string? Version { get; set; }
}

ReferencePluginStoreDTO

Wire format for ReferencePluginStore, used in ServicePluginStorage responses.
public struct ReferencePluginStoreDTO : IStructSerializable, IPrintable
{
    public string? Name { get; set; }
    public string? Id { get; set; }
    public string? FileName { get; set; }
    public string? UrlWeb { get; set; }
    public string? Version { get; set; }
}
Wire layout:
FieldTypeEncoding
Namestring?char[] with 3-byte length prefix
Idstring?char[] with 3-byte length prefix
FileNamestring?char[] with 3-byte length prefix
UrlWebstring?char[] with 3-byte length prefix
Versionstring?char[] with 3-byte length prefix

DirectoryHandwritten

Tracks the files and directories created when a plugin is installed. Used by ManagerPlugin to cleanly uninstall a plugin by reversing its installation footprint.
public class DirectoryHandwritten
{
    public List<string> Directories { get; set; } = new();
    public List<string> Files { get; set; } = new();

    [JsonIgnore]
    public string? Root { get; set; }         // root path (not serialized to JSON)

    public long GetSize()                      // count of Directories + Files
    public string ToJson()                     // indented JSON
    public string ToJson(JsonSerializerOptions options)
}
GetSize() returns Directories.Count + Files.Count as a long — used during uninstall to set the max progress value for the client’s progress bar.

MaxProgressDTO

Sent from the server to the client at the start of a long operation to configure the progress bar’s maximum value.
public struct MaxProgressDTO : IStructSerializable
{
    // wraps a long value representing the total operation size
}
The client receives it via the CodeServicesClient.SetMaxProgress action. The server then sends incremental updates via CodeServicesClient.SetBarProgress.

Deserialization Example

// Client receives GetAllInstances response payload
ReadOnlySpan<byte> reader = responsePayload;

int count = (int)reader.Read<ThreeQuartersInt>();
var instances = new ReferenceInstanceDTO[count];

for (int i = 0; i < count; i++)
    instances[i] = reader.ReadStruct<ReferenceInstanceDTO>();

Build docs developers (and LLMs) love