// -------------------------------------------------------------
        //
        //  Setup() - called when the user has requested to setup
        //            the plugin instance
        //
        // -------------------------------------------------------------
        public override bool Setup()
        {
            //initialize setupNode


            //Initialize();
            isSetupOpen = true;



            // define/create objects

            using (var setupForm = new SetupForm())
            {
                // Tell the setupForm our output count
                setupForm.PluginChannelCount = this.OutputCount;

                List <int> initialUniverseList = new List <int>();
                // for each universe add it to setup form
                foreach (var uE in _data.Universes)
                {
                    setupForm.UniverseAdd(
                        uE.Active, uE.Universe, uE.Start + 1, uE.Size, uE.Unicast, uE.Multicast, uE.Ttl);

                    if (!E131OutputPlugin.EmployedUniverses.Contains(uE.Universe))
                    {
                        E131OutputPlugin.EmployedUniverses.Add(uE.Universe);
                    }

                    initialUniverseList.Add(uE.Universe);
                }



                setupForm.WarningsOption     = _data.Warnings;
                setupForm.StatisticsOption   = _data.Statistics;
                setupForm.EventRepeatCount   = _data.EventRepeatCount;
                setupForm.EventSuppressCount = _data.EventSuppressCount;


                if (setupForm.ShowDialog() == DialogResult.OK)
                {
                    _data.Warnings           = setupForm.WarningsOption;
                    _data.Statistics         = setupForm.StatisticsOption;
                    _data.EventRepeatCount   = setupForm.EventRepeatCount;
                    _data.EventSuppressCount = setupForm.EventSuppressCount;
                    _data.Universes.Clear();

                    initialUniverseList.ForEach(u => E131OutputPlugin.EmployedUniverses.RemoveAll(t => u == t));

                    // add each of the universes as a child
                    for (int i = 0; i < setupForm.UniverseCount; i++)
                    {
                        bool   active    = true;
                        int    universe  = 0;
                        int    start     = 0;
                        int    size      = 0;
                        string unicast   = string.Empty;
                        string multicast = string.Empty;
                        int    ttl       = 0;

                        if (setupForm.UniverseGet(
                                i, ref active, ref universe, ref start, ref size, ref unicast, ref multicast, ref ttl))
                        {
                            _data.Universes.Add(new UniverseEntry(i, active, universe, start - 1, size, unicast, multicast, ttl));
                            //Only add the universe if it doesnt already exist
                            if (!E131OutputPlugin.EmployedUniverses.Contains(universe))
                            {
                                E131OutputPlugin.EmployedUniverses.Add(universe);
                            }
                        }
                    }

                    hasStarted = false; //prevent updates

                    // update in memory table to match xml
                    this.Shutdown();
                    this.Start();
                }
            }

            isSetupOpen = false;

            return(true);
        }
        // -------------------------------------------------------------
        //
        // 	Setup() - called when the user has requested to setup
        // 			  the plugin instance
        //
        // -------------------------------------------------------------
        public override bool Setup()
        {
            // define/create objects
            XmlElement newChild;
            using (var setupForm = new SetupForm())
            {
                this.LoadSetupNodeInfo();

                // if our channels from/to are setup then tell the setupForm
                if (this._pluginChannelsFrom != 0 && this._pluginChannelsTo != 0)
                {
                    setupForm.PluginChannelCount = this._pluginChannelsTo - this._pluginChannelsFrom + 1;
                }

                // for each universe add it to setup form
                foreach (var uE in this._universeTable)
                {
                    setupForm.UniverseAdd(
                        uE.Active, uE.Universe, uE.Start + 1, uE.Size, uE.Unicast, uE.Multicast, uE.Ttl);
                }

                setupForm.WarningsOption = this._warningsOption;
                setupForm.StatisticsOption = this._statisticsOption;
                setupForm.EventRepeatCount = this._eventRepeatCount;

                if (setupForm.ShowDialog() == DialogResult.OK)
                {
                    // first get rid of our old children
                    while (_setupNode.ChildNodes.Count > 0)
                    {
                        _setupNode.RemoveChild(_setupNode.ChildNodes[0]);
                    }

                    // add the Guid child
                    newChild = _setupNode.OwnerDocument.CreateElement("Guid");
                    newChild.SetAttribute("id", this._guid.ToString());
                    _setupNode.AppendChild(newChild);

                    // add the Options child
                    newChild = _setupNode.OwnerDocument.CreateElement("Options");
                    newChild.SetAttribute("warnings", setupForm.WarningsOption.ToString());
                    newChild.SetAttribute("statistics", setupForm.StatisticsOption.ToString());
                    newChild.SetAttribute("eventRepeatCount", setupForm.EventRepeatCount.ToString());
                    _setupNode.AppendChild(newChild);

                    // add each of the universes as a child
                    for (int i = 0; i < setupForm.UniverseCount; i++)
                    {
                        bool active = true;
                        int universe = 0;
                        int start = 0;
                        int size = 0;
                        string unicast = string.Empty;
                        string multicast = string.Empty;
                        int ttl = 0;

                        if (setupForm.UniverseGet(
                            i, ref active, ref universe, ref start, ref size, ref unicast, ref multicast, ref ttl))
                        {
                            newChild = _setupNode.OwnerDocument.CreateElement("Universe");

                            newChild.SetAttribute("active", active.ToString());
                            newChild.SetAttribute("number", universe.ToString());
                            newChild.SetAttribute("start", start.ToString());
                            newChild.SetAttribute("size", size.ToString());
                            if (unicast != null)
                            {
                                newChild.SetAttribute("unicast", unicast);
                            }
                            else if (multicast != null)
                            {
                                newChild.SetAttribute("multicast", multicast);
                            }

                            newChild.SetAttribute("ttl", ttl.ToString());

                            _setupNode.AppendChild(newChild);
                        }
                    }

                    // update in memory table to match xml
                    this.LoadSetupNodeInfo();
                }
            }
        }
        // -------------------------------------------------------------
        //
        //  Setup() - called when the user has requested to setup
        //            the plugin instance
        //
        // -------------------------------------------------------------
        public override bool Setup()
        {
            //initialize setupNode



            //Initialize();
            isSetupOpen = true;


            // define/create objects
            XmlElement newChild;

            using (var setupForm = new SetupForm())
            {
                this.LoadSetupNodeInfo();



                // Tell the setupForm our output count
                setupForm.PluginChannelCount = this.OutputCount;

                // for each universe add it to setup form
                foreach (var uE in this._universeTable)
                {
                    setupForm.UniverseAdd(
                        uE.Active, uE.Universe, uE.Start + 1, uE.Size, uE.Unicast, uE.Multicast, uE.Ttl);
                }

                setupForm.WarningsOption   = this._warningsOption;
                setupForm.StatisticsOption = this._statisticsOption;
                setupForm.EventRepeatCount = this._eventRepeatCount;


                if (setupForm.ShowDialog() == DialogResult.OK)
                {
                    // first get rid of our old children
                    while (_setupNode.ChildNodes.Count > 0)
                    {
                        _setupNode.RemoveChild(_setupNode.ChildNodes[0]);
                    }

                    // add the Guid child
                    newChild = _setupNode.OwnerDocument.CreateElement("Guid");
                    newChild.SetAttribute("id", this._guid.ToString());
                    _setupNode.AppendChild(newChild);

                    // add the Options child
                    newChild = _setupNode.OwnerDocument.CreateElement("Options");
                    newChild.SetAttribute("warnings", setupForm.WarningsOption.ToString());
                    newChild.SetAttribute("statistics", setupForm.StatisticsOption.ToString());
                    newChild.SetAttribute("eventRepeatCount", setupForm.EventRepeatCount.ToString());
                    _setupNode.AppendChild(newChild);


                    // add each of the universes as a child
                    for (int i = 0; i < setupForm.UniverseCount; i++)
                    {
                        bool   active    = true;
                        int    universe  = 0;
                        int    start     = 0;
                        int    size      = 0;
                        string unicast   = string.Empty;
                        string multicast = string.Empty;
                        int    ttl       = 0;

                        if (setupForm.UniverseGet(
                                i, ref active, ref universe, ref start, ref size, ref unicast, ref multicast, ref ttl))
                        {
                            newChild = _setupNode.OwnerDocument.CreateElement("Universe");

                            newChild.SetAttribute("active", active.ToString());
                            newChild.SetAttribute("number", universe.ToString());
                            newChild.SetAttribute("start", start.ToString());
                            newChild.SetAttribute("size", size.ToString());
                            if (unicast != null)
                            {
                                newChild.SetAttribute("unicast", unicast);
                            }
                            else if (multicast != null)
                            {
                                newChild.SetAttribute("multicast", multicast);
                            }

                            newChild.SetAttribute("ttl", ttl.ToString());

                            _setupNode.AppendChild(newChild);
                        }
                    }

                    doc.Save("Modules\\Controller\\E131settings.xml");

                    hasStarted = false; //prevent updates

                    // update in memory table to match xml
                    this.Shutdown();
                    this.Start();
                }
            }

            isSetupOpen = false;

            return(true);
        }