Class TrimmerClient
Client API to access Trimmer configuration over the network.
Inheritance
Namespace: sttz.Trimmer.Options
Assembly: Trimmer.dll
Syntax
public class TrimmerClient
Remarks
A client to connect to TrimmerServer.
If you use this class directly, make sure you call Update() regularily for the server to process commands.
Warning
The communication is unencrypted and doesn't use authentication. The use of this server is only intended for development.
Constructors
| Improve this Doc View SourceTrimmerClient()
Declaration
public TrimmerClient()
Properties
| Improve this Doc View SourceClientHelloFormat
Hello sent to the server.
Declaration
public string ClientHelloFormat { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The format string can contain following placeholders:
- {0}: Application.productName
- {1}: Application.version
- {2}: Application.unityVersion
IsConnected
Wether the client is currently connected.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
ServerAddress
The server address connected to.
Declaration
public IPAddress ServerAddress { get; }
Property Value
Type | Description |
---|---|
System.Net.IPAddress |
ServerHello
Expected string to receive back from server for discoveries and connections.
Declaration
public string ServerHello { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ServerPort
The port the server is listening on.
Declaration
public int ServerPort { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceConnect(IPAddress, TrimmerClient.CommandResult)
Connect to a server.
Declaration
public void Connect(IPAddress address, TrimmerClient.CommandResult onConnect)
Parameters
Type | Name | Description |
---|---|---|
System.Net.IPAddress | address | |
TrimmerClient.CommandResult | onConnect |
Disconnect()
Disconnect from the server.
Declaration
public void Disconnect()
FindServers()
Find discoverable servers on the local network.
Declaration
public void FindServers()
GetOptionValue(String, TrimmerClient.CommandResult)
Get an Option value.
Declaration
public void GetOptionValue(string optionPath, TrimmerClient.CommandResult onResult)
Parameters
Type | Name | Description |
---|---|---|
System.String | optionPath | Path of the Option |
TrimmerClient.CommandResult | onResult |
Ping(TrimmerClient.CommandResult)
Send a Ping command.
Declaration
public void Ping(TrimmerClient.CommandResult onPong)
Parameters
Type | Name | Description |
---|---|---|
TrimmerClient.CommandResult | onPong |
RawCommand(String, String, TrimmerClient.CommandResult)
Send a raw command to the server.
Declaration
public void RawCommand(string name, string arguments, TrimmerClient.CommandResult onResult)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the command |
System.String | arguments | Arguments of the command (if any) |
TrimmerClient.CommandResult | onResult | Result callback |
SetOptionValue(String, TrimmerClient.CommandResult)
Set an Option value.
Declaration
public void SetOptionValue(string optionPath, TrimmerClient.CommandResult onResult)
Parameters
Type | Name | Description |
---|---|---|
System.String | optionPath | Path of the Option |
TrimmerClient.CommandResult | onResult |
Update()
Call this method in a regular interval to process server messages.
Declaration
public void Update()
Events
| Improve this Doc View SourceOnServerFound
Event triggered when a server has been found.
Declaration
public event Action<IPAddress, string> OnServerFound
Event Type
Type | Description |
---|---|
System.Action<System.Net.IPAddress, System.String> |