DirectOutputR1
DirectOutput framework R1 for virtual pinball cabinets.
Go to:
Overview 
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros Pages
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;
5 using DirectOutput.Cab.Toys.LWEquivalent;
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  foreach (int Id in PacDriveSingleton.Instance.PacLed64GetIdList())
24  {
25  if (!Cabinet.OutputControllers.Any(oc => oc is PacLed64 && ((PacLed64)oc).Id == Id))
26  {
27  PacLed64 PL = new PacLed64();
28  PL.Id = Id;
29 
30  if (!Cabinet.OutputControllers.Contains(PL.Name))
31  {
32  Cabinet.OutputControllers.Add(PL);
33 
34  Log.Write("Detected and added PacLed64 Id {0} with name {1}".Build(PL.Id, PL.Name));
35 
36 
37  if (!!Cabinet.Toys.Any(T => T is LedWizEquivalent && (((LedWizEquivalent)T).LedWizNumber == ((PL.Id - 1) * 2) + 20 || ((LedWizEquivalent)T).LedWizNumber == ((PL.Id - 1) * 2) + 20+1)))
38  {
40  LWE.LedWizNumber = (PL.Id - 1) * 2 + 20;
41  LWE.Name = "{0} Equivalent 1".Build(PL.Name);
42  for (int i = 1; i <= 32; i++)
43  {
44 
45 
46  LedWizEquivalentOutput LWEO = new LedWizEquivalentOutput() { OutputName = "{0}\\{0}.{1:00}".Build(PL.Name,i), LedWizEquivalentOutputNumber = i };
47  LWE.Outputs.Add(LWEO);
48 
49  }
50  if (!Cabinet.Toys.Contains(LWE.Name))
51  {
52  Cabinet.Toys.Add(LWE);
53  }
54 
55  LWE = new LedWizEquivalent();
56  LWE.LedWizNumber = (PL.Id - 1) * 2 + 20 + 1;
57  LWE.Name = "{0} Equivalent 2".Build(PL.Name);
58  for (int i = 1; i <= 32; i++)
59  {
60 
61 
62  LedWizEquivalentOutput LWEO = new LedWizEquivalentOutput() { OutputName = "{0}\\{0}.{1:00}".Build(PL.Name, i+32), LedWizEquivalentOutputNumber = i };
63  LWE.Outputs.Add(LWEO);
64 
65 
66  }
67  if (!Cabinet.Toys.Contains(LWE.Name))
68  {
69  Cabinet.Toys.Add(LWE);
70  Log.Write("Added LedwizEquivalent Nr. {0} with name {1} for PacLed64 with Id {2}".Build(LWE.LedWizNumber, LWE.Name, PL.Id));
71 
72  }
73 
74 
75  }
76 
77 
78  }
79  }
80 
81 
82  }
83 
84  }
85 
86  #endregion
87  }
88 }