WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
PacDriveAutoConfigurator.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
6 
7 namespace DirectOutput.Cab.Out.Pac
8 {
13  {
14  #region IAutoConfigOutputController Member
15 
20  public void AutoConfig(Cabinet Cabinet)
21  {
23  if (Index >= 0)
24  {
25  if (!Cabinet.OutputControllers.Any(oc => oc is PacDrive))
26  {
27  PacDrive PD = new PacDrive();
28  if (!Cabinet.OutputControllers.Contains(PD.Name))
29  {
30  Cabinet.OutputControllers.Add(PD);
31 
32  Log.Write("Detected and added PacDrive");
33 
34  if (!Cabinet.Toys.Any(T => T is LedWizEquivalent && ((LedWizEquivalent)T).LedWizNumber == 19))
35  {
36 
37 
39  LWE.LedWizNumber = 19;
40  LWE.Name = "{0} Equivalent".Build(PD.Name);
41  for (int i = 1; i <= 16; i++)
42  {
43  LedWizEquivalentOutput LWEO = new LedWizEquivalentOutput() { OutputName = "{0}.{1:00}".Build(PD.Name, i), LedWizEquivalentOutputNumber = i };
44  LWE.Outputs.Add(LWEO);
45 
46  }
47  if (!Cabinet.Toys.Contains(LWE.Name))
48  {
49  Cabinet.Toys.Add(LWE);
50  Log.Write("Added LedwizEquivalent Nr. {0} with name {1} for PacDrive".Build(LWE.LedWizNumber, LWE.Name));
51  }
52 
53 
54  }
55  }
56  }
57  }
58  }
59 
60  #endregion
61  }
62 }
The Cabinet object describes the parts of a pinball cabinet (toys, outputcontrollers, outputs and more).
Definition: Cabinet.cs:17
new string Name
Name of the IOutputController. This property is fully implemented in the abstract OutputControllerBas...
Interface for classes used to automatically detect and configure output controllers ...
The namespace DirectOutput.Cab.Toys contains all toy related classes.
LedWizEquivalentOutputList Outputs
Gets or sets the outputs of the LedWizEquivalent toy.
Detectes and configures a PacDrive unit.
Singleton version of the PacDrive class found in the PacDrive SDK.
DirectOutput.Cab.Toys.ToyList Toys
List of IToy objects describing the toys in the cabinet.
Definition: Cabinet.cs:107
static void Write(string Message)
Writes the specified message to the logfile.
Definition: Log.cs:99
A simple logger used to record important events and exceptions.
Definition: Log.cs:14
Out.OutputControllerList OutputControllers
List of IOutputController objects representing the output controllers in the cabinet.
Definition: Cabinet.cs:179
The namespace DirectOutput.Cab contains all cabinet related classes like the Cabinet class itself...
Definition: Cab.cs:16
The PacDrive is a simple output controller with 16 digital/on off outputs.
Definition: PacDrive.cs:24
void AutoConfig(Cabinet Cabinet)
This method detects and configures a PacDrive output controller.
The LEDWizEquivalent toy is only used by the framework when ini files are used for the configuration ...
int LedWizNumber
Gets or sets the number of the virtual LedWiz resp. ini file to be matched with the LedWizEquivalentT...
new string Name
Gets or sets the Name of the IToy.
Definition: IToy.cs:17
int PacDriveGetIndex()
Gets the Ids of the first PacDrive controller which is connected to the system.
LEDWizEquivalentOutput is the output object for the LedWizEquivalent IToy.