WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
PacLed64AutoConfigurator.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 using DirectOutput.Cab.Toys;
7 
8 namespace DirectOutput.Cab.Out.Pac
9 {
14  {
15  #region IAutoDetectOutputController Member
16 
21  public void AutoConfig(Cabinet Cabinet)
22  {
23 
24  foreach (int Id in PacDriveSingleton.Instance.PacLed64GetIdList())
25  {
26  if (!Cabinet.OutputControllers.Any(oc => oc is PacLed64 && ((PacLed64)oc).Id == Id))
27  {
28  PacLed64 PL = new PacLed64();
29  PL.Id = Id;
30 
31  if (!Cabinet.OutputControllers.Contains(PL.Name))
32  {
33  Cabinet.OutputControllers.Add(PL);
34 
35  Log.Write("Detected and added PacLed64 Id {0} with name {1}".Build(PL.Id, PL.Name));
36 
37 
38  if (!Cabinet.Toys.Any(T => T is LedWizEquivalent && ((LedWizEquivalent)T).LedWizNumber == PL.Id - 1 + 20))
39  {
41  LWE.LedWizNumber = PL.Id - 1 + 20;
42  LWE.Name = "{0} Equivalent 1".Build(PL.Name);
43  for (int i = 1; i <= 64; i++)
44  {
45 
46 
47  LedWizEquivalentOutput LWEO = new LedWizEquivalentOutput() { OutputName = "{0}\\{0}.{1:00}".Build(PL.Name, i), LedWizEquivalentOutputNumber = i };
48  LWE.Outputs.Add(LWEO);
49 
50  }
51  if (!Cabinet.Toys.Contains(LWE.Name))
52  {
53  Cabinet.Toys.Add(LWE);
54  Log.Write("Added LedwizEquivalent Nr. {0} with name {1} for PacLed64 with Id {2}".Build(LWE.LedWizNumber, LWE.Name, PL.Id));
55  }
56 
57  }
58 
59 
60  }
61  }
62 
63 
64  }
65 
66  }
67 
68  #endregion
69  }
70 }
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 ...
int Id
Gets or sets the Id of the PacLed64. The Id of the PacLed64 must be unique and in the range of 1 to ...
Definition: PacLed64.cs:43
The namespace DirectOutput.Cab.Toys contains all toy related classes.
LedWizEquivalentOutputList Outputs
Gets or sets the outputs of the LedWizEquivalent toy.
void AutoConfig(Cabinet Cabinet)
This method detects and configures PacLed64 controllers automatically
bool Contains(string Name)
Checks if a INamedItem object with the specified name exists in the list.
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
List< int > PacLed64GetIdList()
Gets the Ids of the PacLed64 controllers which are connected to the system.
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 PacLed64 is a output controller with 64 outputs all supporting 256 pwm levels with a PWM frequenc...
Definition: PacLed64.cs:23
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
LEDWizEquivalentOutput is the output object for the LedWizEquivalent IToy.
This class detects all connected PacLed64 units and configures them.