internal RhsEntitySelector(IRhsEntity entity)
 {
     this.entity      = entity;
     this.modeCounter = CycleCollection.Create(getSelectionModes(entity));
     initIndexCounter();
     // funny thing, index counter depends on mode counter
     // but sub-selectors just depends on elements, not on mode or index (of this/parent selector)
     subSelectors = entity.Elements.Select(it => new RhsEntitySelector(it)).ToArray();
 }
        public SelectGame_Screen()
        {
            InitializeComponent();

            CycleCollection<Uri> collection = new CycleCollection<Uri>();

            var maps = Directory.EnumerateFiles(Directory.GetCurrentDirectory() + @"\Maps", "*.*", SearchOption.TopDirectoryOnly)
                .Where(s => s.EndsWith(".png") || s.EndsWith(".jpg"));

            foreach(string map in maps)
                collection.Add(new Uri(map, UriKind.Relative));
           
            CarouselMenu.ItemsSources = collection;
        }
示例#3
0
文件: Plan.cs 项目: gault00/ATSPMlite
        private void AddPreemptData(List <SignalPhaseEventsUDOT> preempt_table)
        {
            foreach (SignalPhaseEventsUDOT row in preempt_table)
            {
                IEnumerable <Cycle> query;
                query = CycleCollection.Where(a => a.CycleStart <row.TimeStamp& a.CycleEnd> row.TimeStamp);

                foreach (Cycle pcd in query)
                {
                    DetectorDataPoint ddp = new DetectorDataPoint(pcd.CycleStart, row.TimeStamp, pcd.ChangeToGreen, pcd.CycleEnd);
                    pcd.AddPreempt(ddp);
                }
            }
        }
示例#4
0
        public CycleCollection GetCycles()
        {
            cycleCollection = new CycleCollection();

            foreach (Node node in Nodes)
            {
                foreach (Rib rib in node.Ribs)
                {
                    Cycle cycle = new Cycle(node);
                    if (cycle.TryToAddRib(rib))
                    {
                        GetCyclesForRib(cycle, rib);
                    }
                }
            }

            return(cycleCollection);
        }
示例#5
0
文件: Plan.cs 项目: gault00/ATSPMlite
        private void AddDetectorData(List <DetectorEventsUDOT> detector_table)
        {
            mTotalArrivalOnRed   = -1;
            mTotalVolume         = -1;
            mTotalGreenTime      = -1;
            mTotalArrivalOnGreen = -1;

            foreach (DetectorEventsUDOT row in detector_table)
            {
                IEnumerable <Cycle> query;
                query = CycleCollection.Where(a => a.CycleStart <row.Timestamp& a.CycleEnd> row.Timestamp);

                foreach (Cycle pcd in query)
                {
                    DetectorDataPoint ddp = new DetectorDataPoint(pcd.CycleStart, row.Timestamp, pcd.ChangeToGreen, pcd.CycleEnd);
                    pcd.AddDetector(ddp);
                }
            }
        }
示例#6
0
        public UDP_Server(int socketReceivers = 10)
        {
            if (socketReceivers <= 0)
            {
                socketReceivers = 10;
            }
            else if (socketReceivers > 50)
            {
                socketReceivers = 50;
            }

            m_ReceiversPerSocket = socketReceivers;

            m_pSockets       = new List <Socket>();
            m_pSocketsIPv4   = new CycleCollection <Socket>();
            m_pSocketsIPv6   = new CycleCollection <Socket>();
            m_pBindSockets   = new Dictionary <string, Socket>();
            m_pDataReceivers = new List <UDP_DataReceiver>();
        }
示例#7
0
        public void Load(string[] bindings)
        {
            m_pDefaultBindings = new CycleCollection <string>();
            foreach (var remoteRule in m_pRemoteRules)
            {
                remoteRule.LocalBindings.Clear();
            }

            foreach (string binding in bindings)
            {
                var    items = binding.Split(":", true, true, "[]");
                string addr  = items[0].TrimStart('[').TrimEnd(']');
                string port  = items[1];

                var ip = IPAddress.Parse(addr);
                if (ip.AddressFamily != AddressFamily.InterNetwork)
                {
                    continue;
                }

                foreach (var localRule in m_pLocalRules)
                {
                    if (!localRule.LocalRule.Contains(ip))
                    {
                        continue;
                    }

                    if (localRule.IsDefaultRule)
                    {
                        m_pDefaultBindings.Add(binding);
                    }

                    foreach (var remoteRule in localRule.RemoteRules)
                    {
                        remoteRule.LocalBindings.Add(binding);
                    }
                }
            }
        }
示例#8
0
        public void Dispose()
        {
            if (this.IsDisposed)
            {
                return;
            }

            this.IsDisposed = true;


            Stop();

            m_pSockets       = null;
            m_pSocketsIPv4   = null;
            m_pSocketsIPv6   = null;
            m_pBindSockets   = null;
            m_pDataReceivers = null;

            // Release all events.
            this.PacketReceived = null;
            this.Error          = null;
        }
示例#9
0
        public void RegisterStateImage(eSettingItem_State itemState, params int[] imgIndexes)
        {
            CycleCollection <int> imgIndexColl = CycleCollection <int> .CreateInstance(0, imgIndexes);

            _stateImageMaping[itemState] = imgIndexColl;
        }
示例#10
0
        static void Main(string[] args)
        {
            Graph graph1 = new Graph();

            Node node0 = new Node(0);
            Node node1 = new Node(1);
            Node node2 = new Node(2);
            Node node3 = new Node(3);
            Node node4 = new Node(4);
            Node node5 = new Node(5);

            /*
             * N = 6 (0 -> 1), (2 -> 0), (1 -> 2), (2 -> 3), (0 -> 3), (4 -> 5), (5 -> 4)
             * node0.AddRib(1);
             * node0.AddRib(3);
             *
             * node1.AddRib(2);
             *
             * node2.AddRib(3);
             * node2.AddRib(0);
             *
             * node4.AddRib(5);
             *
             * node5.AddRib(4);
             *
             * graph1.Nodes.Add(node0);
             * graph1.Nodes.Add(node1);
             * graph1.Nodes.Add(node2);
             * graph1.Nodes.Add(node3);
             * graph1.Nodes.Add(node4);
             * graph1.Nodes.Add(node5);
             */

            /*
             * N=4 (0 -> 1), (0 -> 2), (1 -> 2), (2 -> 0), (2 -> 3), (3 -> 3)
             * node0.AddRib(1);
             * node0.AddRib(2);
             *
             * node1.AddRib(2);
             *
             * node2.AddRib(0);
             * node2.AddRib(3);
             *
             * node3.AddRib(3);
             *
             * graph1.Nodes.Add(node0);
             * graph1.Nodes.Add(node1);
             * graph1.Nodes.Add(node2);
             * graph1.Nodes.Add(node3);
             */

            /* N=4 (0 -> 1), (0 -> 2), (1 -> 2), (2 -> 3)
             * node0.AddRib(1);
             * node0.AddRib(2);
             *
             * node1.AddRib(2);
             *
             * node2.AddRib(3);
             *
             * graph1.Nodes.Add(node0);
             * graph1.Nodes.Add(node1);
             * graph1.Nodes.Add(node2);
             * graph1.Nodes.Add(node3);
             */

            /* N=4 (0 -> 1), (2 -> 0), (1 -> 2), (2 -> 3), (3 -> 0)
             * node0.AddRib(1);
             *
             * node1.AddRib(2);
             *
             * node2.AddRib(3);
             * node2.AddRib(0);
             *
             * node3.AddRib(0);
             *
             * graph1.Nodes.Add(node0);
             * graph1.Nodes.Add(node1);
             * graph1.Nodes.Add(node2);
             * graph1.Nodes.Add(node3);
             */

            /* N=2 (0 -> 1)
             * node0.AddRib(1);
             *
             * graph1.Nodes.Add(node0);
             * graph1.Nodes.Add(node1);
             */

            /* N=2 (0 -> 1), (1 -> 0)
             * node0.AddRib(1);
             * node1.AddRib(0);
             *
             * graph1.Nodes.Add(node0);
             * graph1.Nodes.Add(node1);
             */

            /* N=3 (0 -> 1), (1 -> 2), (0 -> 2)
             * node0.AddRib(1);
             * node0.AddRib(2);
             *
             * node1.AddRib(2);
             *
             * graph1.Nodes.Add(node0);
             * graph1.Nodes.Add(node1);
             * graph1.Nodes.Add(node2);
             */

            CycleCollection cycles = graph1.GetCycles();

            Console.WriteLine("Press any key to continue!");
            Console.ReadLine();
            Console.WriteLine(cycles);
            Console.ReadLine();
        }
示例#11
0
        public void RegisterStatusImages(eSyncStatus status, params int[] imgIndexes)
        {
            CycleCollection <int> imgIndexColl = CycleCollection <int> .CreateInstance(0, imgIndexes);

            _statusImageMaping[status] = imgIndexColl;
        }
示例#12
0
 // constructors
 internal Structures(string pluginDataFolder, Encoding encoding)
 {
     this.Ground = new StructureCollection();
     this.Rail = new StructureCollection();
     this.WallL = new StructureCollection();
     this.WallR = new StructureCollection();
     this.DikeL = new StructureCollection();
     this.DikeR = new StructureCollection();
     this.Pole = new StructureCollection();
     this.PoleMirrored = new StructureCollection();
     this.FormL = new StructureCollection();
     this.FormR = new StructureCollection();
     this.FormCL = new StructureCollection();
     this.FormCR = new StructureCollection();
     this.RoofL = new StructureCollection();
     this.RoofR = new StructureCollection();
     this.RoofCL = new StructureCollection();
     this.RoofCR = new StructureCollection();
     this.CrackL = new StructureCollection();
     this.CrackR = new StructureCollection();
     this.FreeObj = new StructureCollection();
     this.Beacon = new Parser.StructureCollection();
     this.Cycle = new CycleCollection();
     this.Limits = new Parser.StructureCollection();
     /*
      * Set up the default objects.
      * */
     string poleFolder = OpenBveApi.Path.CombineFolder(pluginDataFolder, "poles");
     this.PoleMirrored.Set(0, 0, OpenBveApi.Path.CombineFile(poleFolder, "pole_1.csv"), true);
     this.Pole.Set(0, 0, OpenBveApi.Path.CombineFile(poleFolder, "pole_1.csv"), false);
     this.Pole.Set(0, 1, OpenBveApi.Path.CombineFile(poleFolder, "pole_2.csv"), false);
     this.Pole.Set(0, 2, OpenBveApi.Path.CombineFile(poleFolder, "pole_3.csv"), false);
     this.Pole.Set(0, 3, OpenBveApi.Path.CombineFile(poleFolder, "pole_4.csv"), false);
     string transponderFolder = OpenBveApi.Path.CombineFolder(pluginDataFolder, "transponders");
     this.Beacon.Set(-1, 0, OpenBveApi.Path.CombineFile(transponderFolder, "s.csv"), false);
     this.Beacon.Set(-2, 0, OpenBveApi.Path.CombineFile(transponderFolder, "sn.csv"), false);
     this.Beacon.Set(-3, 0, OpenBveApi.Path.CombineFile(transponderFolder, "falsestart.csv"), false);
     this.Beacon.Set(-4, 0, OpenBveApi.Path.CombineFile(transponderFolder, "porigin.csv"), false);
     this.Beacon.Set(-5, 0, OpenBveApi.Path.CombineFile(transponderFolder, "pstop.csv"), false);
     string stopFolder = OpenBveApi.Path.CombineFolder(pluginDataFolder, "stops");
     this.Stop = new Parser.Structure(0, 0, OpenBveApi.Path.CombineFile(stopFolder, "stop.csv"), false);
     string limitFolder = OpenBveApi.Path.CombineFolder(pluginDataFolder, "limits");
     this.Limits.Set(0, 0, OpenBveApi.Path.CombineFile(limitFolder, "digit_0.csv"), false);
     this.Limits.Set(1, 0, OpenBveApi.Path.CombineFile(limitFolder, "digit_1.csv"), false);
     this.Limits.Set(2, 0, OpenBveApi.Path.CombineFile(limitFolder, "digit_2.csv"), false);
     this.Limits.Set(3, 0, OpenBveApi.Path.CombineFile(limitFolder, "digit_3.csv"), false);
     this.Limits.Set(4, 0, OpenBveApi.Path.CombineFile(limitFolder, "digit_4.csv"), false);
     this.Limits.Set(5, 0, OpenBveApi.Path.CombineFile(limitFolder, "digit_5.csv"), false);
     this.Limits.Set(6, 0, OpenBveApi.Path.CombineFile(limitFolder, "digit_6.csv"), false);
     this.Limits.Set(7, 0, OpenBveApi.Path.CombineFile(limitFolder, "digit_7.csv"), false);
     this.Limits.Set(8, 0, OpenBveApi.Path.CombineFile(limitFolder, "digit_8.csv"), false);
     this.Limits.Set(9, 0, OpenBveApi.Path.CombineFile(limitFolder, "digit_9.csv"), false);
     this.Limits.Set(10, 0, OpenBveApi.Path.CombineFile(limitFolder, "unlimited.csv"), false);
     this.Limits.Set(11, 0, OpenBveApi.Path.CombineFile(limitFolder, "limit_left.csv"), false);
     this.Limits.Set(12, 0, OpenBveApi.Path.CombineFile(limitFolder, "limit_straight.csv"), false);
     this.Limits.Set(13, 0, OpenBveApi.Path.CombineFile(limitFolder, "limit_right.csv"), false);
 }
示例#13
0
文件: Plan.cs 项目: gault00/ATSPMlite
        private void GetGreenYellowRedCycle(DateTime start_time, DateTime end_time, List <SignalPhaseEventsUDOT> cycleEvents, List <DetectorEventsUDOT> detectorEvents, List <SignalPhaseEventsUDOT> preemptEvents)
        {
            Cycle pcd;

            pcd = null /* TODO Change to default(_) if this is not a reference type */;

            // use a counter to help determine when we are on the last row
            int counter = 0;

            foreach (SignalPhaseEventsUDOT row in cycleEvents)
            {
                // use a counter to help determine when we are on the last row
                counter += 1;
                if ((row.TimeStamp >= start_time & row.TimeStamp <= end_time))
                {
                    // if this is the first PCD group we need to handle a special case
                    // where the PCD starts at the start of the requested period to
                    // make sure we include all data
                    if (pcd != null)
                    {
                        // make the first group start on the exact start of the requested period
                        pcd = new Cycle(start_time);
                        // add a green event if the first event is yellow
                        if (GetEventType(row.EventCode) == Cycle.EventType.ChangeToYellow)
                        {
                            pcd.NextEvent(Cycle.EventType.ChangeToGreen, start_time.AddMilliseconds(1));
                        }
                        else if (GetEventType(row.EventCode) == Cycle.EventType.ChangeToRed)
                        {
                            pcd.NextEvent(Cycle.EventType.ChangeToGreen, start_time.AddMilliseconds(1));
                            pcd.NextEvent(Cycle.EventType.ChangeToYellow, start_time.AddMilliseconds(2));
                        }
                    }

                    // check to see if the event is a change to red
                    // the 64 event is for overlaps
                    if (row.EventCode == 10 | row.EventCode == 64)
                    {
                        // if it is red and the pcd group is empty create a new one
                        if (pcd != null)
                        {
                            pcd = new Cycle(row.TimeStamp);
                        }
                        else
                        {
                            pcd.NextEvent(GetEventType(row.EventCode), row.TimeStamp);
                            // if the next event response is complete add it and start the next group
                            if (pcd.Status == Cycle.NextEventResponse.GroupComplete)
                            {
                                CycleCollection.Add(pcd);
                                pcd = new Cycle(row.TimeStamp);
                            }
                        }
                    }
                    else if (pcd != null)
                    {
                        // if the event is not red and the group is not empty
                        // add the event and set the next event
                        pcd.NextEvent(GetEventType(row.EventCode), row.TimeStamp);
                        if (pcd.Status == Cycle.NextEventResponse.GroupComplete)
                        {
                            CycleCollection.Add(pcd);
                            pcd = new Cycle(row.TimeStamp);
                        }
                    }

                    if (pcd != null & pcd.Status == Cycle.NextEventResponse.GroupMissingData)
                    {
                        pcd = null /* TODO Change to default(_) if this is not a reference type */;
                    }
                }
                else if (counter == cycleEvents.Count & pcd != null)
                {
                    // if the last event is red create a new group to consume the remaining time in the period
                    if (GetEventType(row.EventCode) == Cycle.EventType.ChangeToRed)
                    {
                        pcd.NextEvent(Cycle.EventType.ChangeToGreen, end_time.AddMilliseconds(-2));
                        pcd.NextEvent(Cycle.EventType.ChangeToYellow, end_time.AddMilliseconds(-1));
                        pcd.NextEvent(Cycle.EventType.ChangeToRed, end_time);
                    }
                    else if (GetEventType(row.EventCode) == Cycle.EventType.ChangeToGreen)
                    {
                        pcd.NextEvent(Cycle.EventType.ChangeToYellow, end_time.AddMilliseconds(-1));
                        pcd.NextEvent(Cycle.EventType.ChangeToRed, end_time);
                    }
                    else if (GetEventType(row.EventCode) == Cycle.EventType.ChangeToYellow)
                    {
                        pcd.NextEvent(Cycle.EventType.ChangeToRed, end_time);
                    }

                    if (pcd.Status != Cycle.NextEventResponse.GroupMissingData)
                    {
                        CycleCollection.Add(pcd);
                    }
                }
            }

            // if there are no records at all for the selected time, then the line and counts don't show.
            // this next bit fixes that
            if ((CycleCollection.Count == 0 & start_time != end_time))
            {
                // then we need to make a dummy PCD group
                // then PCD assumes it starts on red
                pcd = new Cycle(start_time);

                // and find out what phase state the controller was in by looking for the next phase event
                // after the end of the plan
                List <SignalPhaseEventsUDOT> eventTable         = new List <SignalPhaseEventsUDOT>();
                SignalPhaseEventsUDOT        eventBeforePattern = new SignalPhaseEventsUDOT();
                eventBeforePattern = null /* TODO Change to default(_) if this is not a reference type */;

                IEnumerable <ControllerEvent> TempEvents;
                DateTime yesterday;
                yesterday  = start_time.AddDays(-1);
                TempEvents = Globals.UDOTEventLog.Where(a => a.SignalID == SignalID & a.TimeStamp >= yesterday & a.TimeStamp <= start_time & a.EventParam == PhaseNumber & (a.EventCode == 1 | a.EventCode == 8 | a.EventCode == 10)).OrderByDescending(a => a.TimeStamp);

                foreach (ControllerEvent x in TempEvents)
                {
                    SignalPhaseEventsUDOT tempRow = new SignalPhaseEventsUDOT();
                    tempRow.EventCode  = (byte)x.EventCode;
                    tempRow.EventParam = (byte)x.EventParam;
                    tempRow.TimeStamp  = x.TimeStamp;
                    eventTable.Add(tempRow);
                }

                eventTable.OrderByDescending(a => a.TimeStamp);
                eventBeforePattern = eventTable.FirstOrDefault();

                if (eventBeforePattern != null)
                {
                    if (GetEventType(eventBeforePattern.EventCode) == Cycle.EventType.ChangeToRed)
                    {
                        // let it dwell in red (we don't have to do anything)

                        // then add a green phase, a yellow phase and a red phase at the end to complete the cycle
                        pcd.NextEvent(Cycle.EventType.ChangeToGreen, end_time.AddMilliseconds(-2));
                        pcd.NextEvent(Cycle.EventType.ChangeToYellow, end_time.AddMilliseconds(-1));
                        pcd.NextEvent(Cycle.EventType.ChangeToRed, end_time);
                    }
                    else if (GetEventType(eventBeforePattern.EventCode) == Cycle.EventType.ChangeToYellow)
                    {
                        // we were in yellow, though this will probably never happen
                        // we have to add a green to our dummy phase
                        pcd.NextEvent(Cycle.EventType.ChangeToGreen, start_time.AddMilliseconds(1));
                        // then make it dwell in yellow
                        pcd.NextEvent(Cycle.EventType.ChangeToYellow, start_time.AddMilliseconds(2));
                        // then add a red phase at the end to complete the cycle
                        pcd.NextEvent(Cycle.EventType.ChangeToRed, end_time);
                    }
                    else if (GetEventType(eventBeforePattern.EventCode) == Cycle.EventType.ChangeToGreen)
                    {
                        // make it dwell in green
                        pcd.NextEvent(Cycle.EventType.ChangeToGreen, start_time.AddMilliseconds(1));

                        // then add a yellow phase and a red phase at the end to complete the cycle
                        pcd.NextEvent(Cycle.EventType.ChangeToYellow, end_time.AddMilliseconds(-1));
                        pcd.NextEvent(Cycle.EventType.ChangeToRed, end_time);
                    }
                }

                if (pcd.Status == Cycle.NextEventResponse.GroupComplete)
                {
                    // If pcd.EndTime = DateTime.MinValue Then pcd.EndTime = Me.EndTime
                    CycleCollection.Add(pcd);
                }
            }

            AddDetectorData(detectorEvents);
            AddPreemptData(preemptEvents);
        }
示例#14
0
        private void StartListen()
        {
            try
            {
                // Dispose all old receivers.
                foreach (var receiver in m_pDataReceivers.ToArray())
                {
                    try
                    { receiver.Dispose(); }
                    catch (Exception ex)
                    { OnError(ex); }
                }
                m_pDataReceivers.Clear();

                // Dispose all old sockets.
                foreach (var socket in m_pSockets.ToArray())
                {
                    try
                    { socket.Dispose(); }
                    catch (Exception ex)
                    { OnError(ex); }
                }
                m_pSockets.Clear();
                m_pSocketsIPv4.Clear();
                m_pSocketsIPv6.Clear();
                m_pBindSockets.Clear();

                // We must replace IPAddress.Any to all available IPs, otherwise it's impossible to send
                // reply back to UDP packet sender on same local EP where packet received.
                // This is very important when clients are behind NAT.
                var listeningEPs = new List <IPEndPoint>();
                foreach (var ep in m_pBindings)
                {
                    if (ep.Address.Equals(IPAddress.Any))
                    {
                        // Add localhost.
                        var localEP = new IPEndPoint(IPAddress.Loopback, ep.Port);
                        if (!listeningEPs.Contains(localEP))
                        {
                            listeningEPs.Add(localEP);
                        }

                        foreach (var ip in NetworkUtil.GetIPAddresses())
                        {
                            if (ip.AddressFamily == AddressFamily.InterNetwork)
                            {
                                localEP = new IPEndPoint(ip, ep.Port);
                                if (!listeningEPs.Contains(localEP))
                                {
                                    listeningEPs.Add(localEP);
                                }
                            }
                        }
                    }
                    else if (ep.Address.Equals(IPAddress.IPv6Any))
                    {
                        foreach (var ip in NetworkUtil.GetIPAddresses())
                        {
                            if (ip.AddressFamily == AddressFamily.InterNetworkV6)
                            {
                                IPEndPoint localEP = new IPEndPoint(ip, ep.Port);
                                if (!listeningEPs.Contains(localEP))
                                {
                                    listeningEPs.Add(localEP);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (!listeningEPs.Contains(ep))
                        {
                            listeningEPs.Add(ep);
                        }
                    }
                }

                // Create sockets.
                m_pSockets     = new List <Socket>();
                m_pBindSockets = new Dictionary <string, Socket>();
                foreach (var ep in listeningEPs)
                {
                    try
                    {
                        var socket = NetworkUtil.CreateSocket(ep, ProtocolType.Udp);
                        m_pSockets.Add(socket);

                        if (!ep.Address.Equals(IPAddress.Loopback))
                        {
                            m_pBindSockets[ep.ToString()] = socket;
                        }

                        // Create UDP data receivers.
                        for (int i = 0; i < m_ReceiversPerSocket; i++)
                        {
                            var receiver = new UDP_DataReceiver(socket, m_MTU);
                            receiver.PacketReceived += (sender, e) =>
                            {
                                try
                                { ProcessUdpPacket(e); }
                                catch (Exception ex)
                                { OnError(ex); }
                            };

                            receiver.Error += (sender, e) =>
                            {
                                OnError(e.Exception);
                            };

                            m_pDataReceivers.Add(receiver);
                            receiver.Start();
                        }
                    }
                    catch (Exception ex)
                    { OnError(ex); }
                }

                // Create round-robin send sockets.
                // NOTE: We must skip localhost, it can't be used for sending out of server.
                m_pSocketsIPv4 = new CycleCollection <Socket>();
                m_pSocketsIPv6 = new CycleCollection <Socket>();
                foreach (Socket socket in m_pSockets)
                {
                    if (((IPEndPoint)socket.LocalEndPoint).AddressFamily == AddressFamily.InterNetwork)
                    {
                        if (!((IPEndPoint)socket.LocalEndPoint).Address.Equals(IPAddress.Loopback))
                        {
                            m_pSocketsIPv4.Add(socket);
                        }
                    }
                    else if (((IPEndPoint)socket.LocalEndPoint).AddressFamily == AddressFamily.InterNetworkV6)
                    {
                        m_pSocketsIPv6.Add(socket);
                    }
                }

                if (m_pBindSelector != null)
                {
                    m_pBindSelector.Load(m_pBindSockets.Keys.ToArray());
                }
            }
            catch (Exception ex)
            { OnError(ex); }
        }