DirectOuput Framework R2
DirectOutput framework R2 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 
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 }