/// <summary>
        /// This method detects and configures LedWiz output controllers automatically.
       /// </summary>
        /// <param name="Cabinet">The cabinet object to which the automatically detected IOutputController objects are added if necessary.</param>
        public void AutoConfig(Cabinet Cabinet)
        {


            List<int> Preconfigured = new List<int>(Cabinet.OutputControllers.Where(OC => OC is LedWiz).Select(LW => ((LedWiz)LW).Number));
            List<int> Numbers = LedWiz.GetLedwizNumbers();
            foreach (int N in Numbers)
            {
                if (!Preconfigured.Contains(N))
                {
                    LedWiz LW = new LedWiz(N);
                    if (!Cabinet.OutputControllers.Contains(LW.Name))
                    {
                        
                        Cabinet.OutputControllers.Add(LW);
                        Log.Write("Detected and added LedWiz Nr. {0} with name {1}".Build(LW.Number, LW.Name));


                        if (!Cabinet.Toys.Any(T => T is LedWizEquivalent && ((LedWizEquivalent)T).LedWizNumber == LW.Number))
                        {
                            LedWizEquivalent LWE = new LedWizEquivalent();
                            LWE.LedWizNumber = LW.Number;
                            LWE.Name = "{0} Equivalent".Build(LW.Name);

                            for (int i = 1; i < 33; i++)
                            {
                                 LedWizEquivalentOutput LWEO = new LedWizEquivalentOutput() { OutputName = "{0}\\{0}.{1:00}".Build(LW.Name, i), LedWizEquivalentOutputNumber = i };
                                LWE.Outputs.Add(LWEO);
                            }

                            if (!Cabinet.Toys.Contains(LWE.Name))
                            {
                                Cabinet.Toys.Add(LWE);
                                Log.Write("Added LedwizEquivalent Nr. {0} with name {1} for Ledwiz Nr. {2}".Build(LWE.LedWizNumber,LWE.Name,LW.Number));
                            }

                        }
                    }
                }
            }





        }
        /// <summary>
        /// This method detects and configures PacLed64 controllers automatically
       /// </summary>
        /// <param name="Cabinet">The cabinet object to which the automatically detected IOutputController objects are added if necessary.</param>
        public void AutoConfig(Cabinet Cabinet)
        {
            foreach (int Id in PacDriveSingleton.Instance.PacLed64GetIdList())
            {
                if (!Cabinet.OutputControllers.Any(oc => oc is PacLed64 && ((PacLed64)oc).Id == Id))
                {
                    PacLed64 PL = new PacLed64();
                    PL.Id = Id;
                   
                    if (!Cabinet.OutputControllers.Contains(PL.Name))
                    {
                        Cabinet.OutputControllers.Add(PL);

                        Log.Write("Detected and added PacLed64 Id {0} with name {1}".Build(PL.Id, PL.Name));


                        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)))
                        {
                            LedWizEquivalent LWE = new LedWizEquivalent();
                            LWE.LedWizNumber = (PL.Id - 1) * 2 + 20;
                            LWE.Name = "{0} Equivalent 1".Build(PL.Name);
                            for (int i = 1; i <= 32; i++)
                            {
                                

                                LedWizEquivalentOutput LWEO = new LedWizEquivalentOutput() { OutputName = "{0}\\{0}.{1:00}".Build(PL.Name,i), LedWizEquivalentOutputNumber = i };
                                LWE.Outputs.Add(LWEO);

                            }
                            if (!Cabinet.Toys.Contains(LWE.Name))
                            {
                                Cabinet.Toys.Add(LWE);
                            }

                            LWE = new LedWizEquivalent();
                            LWE.LedWizNumber = (PL.Id - 1) * 2 + 20 + 1;
                            LWE.Name = "{0} Equivalent 2".Build(PL.Name);
                            for (int i = 1; i <= 32; i++)
                            {
                                

                                LedWizEquivalentOutput LWEO = new LedWizEquivalentOutput() { OutputName = "{0}\\{0}.{1:00}".Build(PL.Name, i+32), LedWizEquivalentOutputNumber = i };
                                LWE.Outputs.Add(LWEO);


                            }
                            if (!Cabinet.Toys.Contains(LWE.Name))
                            {
                                Cabinet.Toys.Add(LWE);
                                Log.Write("Added LedwizEquivalent Nr. {0} with name {1} for PacLed64 with Id {2}".Build(LWE.LedWizNumber, LWE.Name, PL.Id));

                            }


                        }


                    }
                }


            }

        }