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
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;
5 using DirectOutput.Cab.Toys.LWEquivalent;
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 }