-
Notifications
You must be signed in to change notification settings - Fork 8
Getting started
proepkes edited this page Jun 5, 2019
·
28 revisions
- Clone this repository to your computer
- Open "SpeedDate.sln" in Visual Studio
- Set "SpeedDate.Server.Console" as your startup-project
- Hit F5
- Congratulations, you are now running the fully-featured SpeedDate Masterserver
The EchoPlugin provides a simple examples which echoes and incoming string back to the client. A simple usage of the EchoPlugin can be found in the class "TestEcho".
var server = new SpeedDateServer();
server.Started += () => { /* server ready, do something */};
server.Start(new FileConfigProvider("ServerConfig.xml"));
var client = new SpeedDateClient();
client.Started += () => { /* client connected, do something */};
client.Start(new FileConfigProvider("ClientConfig.xml"));
To make a plugin configurable through Xml-Configuration, add a new class that holds the configurable variables and let it implement IConfig-interface:
class MyServerPluginConfig : IConfig
{
public bool SettingWhatever { get; set; }
}
Add a field to the plugin and apply the [Inject]-attribute to it:
[Inject] private MyServerPluginConfig _config;
To configure the plugin, add the corresponding tag inside the *.xml-configuration:
<MyServerPluginConfig SettingWhatever="false"/>
You can now use _config in your plugin everywhere (except in the constructor):
public override void Loaded()
{
var configValue = _config.SettingWhatever;
}
You can also configure your plugins from within the code, see "SpeedDate.Client.Spawner.Console" for an example.