B2S.Server Sample Plugin
Sample plugin implementation for the B2S.Server
Switch to B2S.Server Plugin Interface Documentation 
 All Classes Namespaces Files Functions Properties Pages
B2SServerSamplePluginCSharp.SamplePluginCSharp Class Reference

Main class of the B2S.Server plugin.
This class must implement the IDirectPlugin interface provided by the B2SServerPluginInterface.dll.
If a plugin provides a frontend the IDirectPluginFrontend interface has to be implemented as well.
For plugins wanting to receive updates on important PinMame actions the IDirectPluginPinMame interface has to be implemented.

In addition to the implementation of the necessary interfaces, the class has to be exported for the use with MEF using the following attribute Export(typeof(B2SServerPluginInterface.IDirectPlugin)))> would be the same). More...

Inheritance diagram for B2SServerSamplePluginCSharp.SamplePluginCSharp:
Collaboration diagram for B2SServerSamplePluginCSharp.SamplePluginCSharp:

Public Member Functions

void PluginInit (string TableFilename, string RomName)
 Initializes the Plugin.
This is the first method, which is called after the plugin has been instanciated by the B2S.Server.
The IDirectPlugin interface requires the implementation of this method.
More...
 
void PluginFinish ()
 Finishes the plugin.
This is the last method called, before a plugin is discared. This method is also called, after a undhandled exception has occured in a plugin.
PluginFinish must do all nessecary clean up work for the plugin (e.g. release resources).
The IDirectPlugin interface requires the implementation of this method.
More...
 
void DataReceive (char TableElementTypeChar, int Number, int Value)
 This method is called, when new data from PinMame becomes available.
The IDirectPlugin interface requires the implementation of this method.
More...
 
void PinMameRun ()
 This method is called by the B2S.Server, when the Run method of PinMame gets called.
The IDirectPlugin interface requires the implementation of this method.
More...
 
void PinMamePause ()
 This method is called, when the property Pause of Pinmame gets set to true.
The IDirectPlugin interface requires the implementation of this method.
More...
 
void PinMameContinue ()
 This method is called by the B2S.Server, when the property Pause of Pinmame gets set to false.
The IDirectPlugin interface requires the implementation of this method.
More...
 
void PinMameStop ()
 This method is called by the B2S.Server, when the Stop method of Pinmame is called.
The IDirectPlugin interface requires the implementation of this method.
More...
 
void PluginShowFrontend (Form Owner=null)
 PluginShowFrontend is called by the B2S.Server if a plugin has to show its frontend.
The IDirectPluginFrontend interface requires the implementation of this method. More...
 
 SamplePluginCSharp ()
 Initializes a new instance of the SamplePluginCSharp class.
The class exporting the plugin interface must have a constructor without parameters. If you dont want to do any work in the constructor, the constructor can be ommitted. More...
 

Properties

string Name [get]
 Gets the name of the plugin.
When implmenting this property it is recommended to add the version of the plugin to the name as well.
The IDirectPlugin interface requires the implementation of the property.
More...
 

Detailed Description

Main class of the B2S.Server plugin.
This class must implement the IDirectPlugin interface provided by the B2SServerPluginInterface.dll.
If a plugin provides a frontend the IDirectPluginFrontend interface has to be implemented as well.
For plugins wanting to receive updates on important PinMame actions the IDirectPluginPinMame interface has to be implemented.

In addition to the implementation of the necessary interfaces, the class has to be exported for the use with MEF using the following attribute Export(typeof(B2SServerPluginInterface.IDirectPlugin)))> would be the same).

Remarks
Remember to change the name of the class to something meaningful for your plugin project when reusing this code.

Definition at line 33 of file SamplePluginCSharp.cs.

Constructor & Destructor Documentation

B2SServerSamplePluginCSharp.SamplePluginCSharp.SamplePluginCSharp ( )

Initializes a new instance of the SamplePluginCSharp class.
The class exporting the plugin interface must have a constructor without parameters. If you dont want to do any work in the constructor, the constructor can be ommitted.

Definition at line 175 of file SamplePluginCSharp.cs.

Member Function Documentation

void B2SServerSamplePluginCSharp.SamplePluginCSharp.DataReceive ( char  TableElementTypeChar,
int  Number,
int  Value 
)

This method is called, when new data from PinMame becomes available.
The IDirectPlugin interface requires the implementation of this method.

Remarks
The special care when implementing to keep this method very fast! Slow implementations will slow down Visual Pinball, Pinmame, the B2S.Server as well as all other plugins.
The best solution is to put the data in a queue and process the data in a separate thread.
Parameters
TableElementTypeCharChar representing the table element type (S=Solenoid, W=Switch, L=Lamp, M=Mech, G=GI, E=EMTable, ?=Unknown table element).
NumberThe number of the table element.
ValueThe value of the table element.

Definition at line 92 of file SamplePluginCSharp.cs.

void B2SServerSamplePluginCSharp.SamplePluginCSharp.PinMameContinue ( )

This method is called by the B2S.Server, when the property Pause of Pinmame gets set to false.
The IDirectPlugin interface requires the implementation of this method.

Definition at line 119 of file SamplePluginCSharp.cs.

void B2SServerSamplePluginCSharp.SamplePluginCSharp.PinMamePause ( )

This method is called, when the property Pause of Pinmame gets set to true.
The IDirectPlugin interface requires the implementation of this method.

Definition at line 112 of file SamplePluginCSharp.cs.

void B2SServerSamplePluginCSharp.SamplePluginCSharp.PinMameRun ( )

This method is called by the B2S.Server, when the Run method of PinMame gets called.
The IDirectPlugin interface requires the implementation of this method.

Definition at line 105 of file SamplePluginCSharp.cs.

void B2SServerSamplePluginCSharp.SamplePluginCSharp.PinMameStop ( )

This method is called by the B2S.Server, when the Stop method of Pinmame is called.
The IDirectPlugin interface requires the implementation of this method.

Definition at line 126 of file SamplePluginCSharp.cs.

void B2SServerSamplePluginCSharp.SamplePluginCSharp.PluginFinish ( )

Finishes the plugin.
This is the last method called, before a plugin is discared. This method is also called, after a undhandled exception has occured in a plugin.
PluginFinish must do all nessecary clean up work for the plugin (e.g. release resources).
The IDirectPlugin interface requires the implementation of this method.

Definition at line 78 of file SamplePluginCSharp.cs.

void B2SServerSamplePluginCSharp.SamplePluginCSharp.PluginInit ( string  TableFilename,
string  RomName 
)

Initializes the Plugin.
This is the first method, which is called after the plugin has been instanciated by the B2S.Server.
The IDirectPlugin interface requires the implementation of this method.

Parameters
TableFilenameThe table filename.
RomNameName of the rom.

Definition at line 67 of file SamplePluginCSharp.cs.

void B2SServerSamplePluginCSharp.SamplePluginCSharp.PluginShowFrontend ( Form  Owner = null)

PluginShowFrontend is called by the B2S.Server if a plugin has to show its frontend.
The IDirectPluginFrontend interface requires the implementation of this method.

Parameters
Owner(optional) The owner window of the frontend to be opend.
Make sure that your plugin does also support null for this parameter.

Definition at line 137 of file SamplePluginCSharp.cs.

Property Documentation

string B2SServerSamplePluginCSharp.SamplePluginCSharp.Name
get

Gets the name of the plugin.
When implmenting this property it is recommended to add the version of the plugin to the name as well.
The IDirectPlugin interface requires the implementation of the property.

Remarks
If the code of this implementation of the property is reused, be sure to set the versioning information in AssemblyInfo.cs to something like [assembly: AssemblyVersion("1.0.*")]. Otherwise the BuildDate will not be correct.

The name of the IDirectPlugin.

Definition at line 48 of file SamplePluginCSharp.cs.


The documentation for this class was generated from the following file: