17 [Export(typeof(IDirectPlugin))]
18 public class Plugin : IDirectPlugin, IDirectPluginFrontend
21 #region IDirectPluginFrontend Member
38 System.
Windows.
Forms.MessageBox.Show(
"Could not show DirectOutput frontend.\n The following exception occured:\n{0}".Build(E.Message),
"DirectOutput");
45 #region IDirectPlugin Members
58 Version V = typeof(
Pinball).Assembly.GetName().Version;
59 DateTime BuildDate =
new DateTime(2000, 1, 1).AddDays(V.Build).AddSeconds(V.Revision * 2);
60 return "DirectOutput (V: {0} as of {1})".Build(V.ToString(), BuildDate.ToString(
"yyyy.MM.dd HH:mm"));
73 public void DataReceive(
char TableElementTypeChar,
int Number,
int Value)
97 public void PluginInit(
string TableFilename,
string RomName)
101 FileInfo F =
new FileInfo(Path.Combine(
new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName,
"config",
"GlobalConfig_B2SServer.xml"));
105 FileInfo LnkFile =
new FileInfo(Path.Combine(
new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName,
"config",
"GlobalConfig_B2SServer.lnk"));
108 string ConfigDirPath = ResolveShortcut(LnkFile);
109 if (Directory.Exists(ConfigDirPath))
111 F =
new FileInfo(Path.Combine(ConfigDirPath,
"GlobalConfig_B2SServer.xml"));
118 F =
new FileInfo(
"GlobalConfig_B2SServer.xml");
122 F =
new FileInfo(Path.Combine(
new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName,
"GlobalConfig_B2SServer.xml"));
126 F =
new FileInfo(Path.Combine(
new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName,
"config",
"GlobalConfig_B2SServer.xml"));
141 private string ResolveShortcut(FileInfo ShortcutFile)
143 string TargetPath =
"";
146 Type WScriptShell = Type.GetTypeFromProgID(
"WScript.Shell");
147 object Shell = Activator.CreateInstance(WScriptShell);
148 object Shortcut = WScriptShell.InvokeMember(
"CreateShortcut", BindingFlags.InvokeMethod, null, Shell,
new object[] { ShortcutFile.FullName });
149 TargetPath = (string)Shortcut.GetType().InvokeMember(
"TargetPath", BindingFlags.GetProperty, null, Shortcut, null);
160 if (Directory.Exists(TargetPath))
164 else if (File.Exists(TargetPath))
196 get {
return _Pinball; }
197 set { _Pinball = value; }
void PluginFinish()
Finishes the plugin. This is the last method called, before the plugin is discarded. This method is also called, after a undhandled exception has occured in the plugin.
void Setup(string GlobalConfigFilename="", string TableFilename="", string RomName="")
Configures the Pinball object. Loads the global config, table config and cabinet config ...
void PluginInit(string TableFilename, string RomName)
Initializes the Plugin. The IDirectPlugin interface requires the implementation of this method...
Pinball Pinball
Gets or sets the DirectOutput.Pinball object for the plugin.
Pinball is the main object of the DirectOutput framework. It holds all objects required to process P...
void Finish()
Finishes the Pinball object.
void PluginShowFrontend(System.Windows.Forms.Form Owner=null)
Shows the frontend of the the DirectOutput framework. The IDirectPluginFrontend interface requires t...
Plugin()
Initializes a new instance of the Plugin class.
DirectOutputPlugin is the namespace of the Dll implementing the actual plugin interface for the B2S S...
void Init()
Initializes/starts the Pinball object
void ReceiveData(char TableElementTypeChar, int Number, int Value)
Receives the table element data from the calling app (e.g. B2S.Server providing data through the plug...
Plugin is the IDirectPlugin interface implementation required by the B2S Server.
static void Open(Pinball Pinball, Form Owner=null)
void DataReceive(char TableElementTypeChar, int Number, int Value)
This method is called, when new data from Pinmame becomes available. The IDirectPlugin interface req...
string Name
Gets the name of the IDirectPlugin.