Пример #1
0
        private void UpdateConnectedPeers(PeerMessage message)
        {
            if (message != null)
            {
                ConnectedPeers.Add(message);
            }

            NamedGuests = ConnectedPeers
                          .Where(g => !string.IsNullOrEmpty(g.CustomName) &&
                                 g.CustomName != PeerMessage.AnonymousName &&
                                 !g.IsHost).ToList();

            AnonymousGuests = ConnectedPeers
                              .Count(g => (string.IsNullOrEmpty(g.CustomName) ||
                                           g.CustomName == PeerMessage.AnonymousName) &&
                                     !g.IsHost);

            NamedHosts = ConnectedPeers
                         .Where(g => !string.IsNullOrEmpty(g.CustomName) &&
                                g.CustomName != PeerMessage.AnonymousName &&
                                g.IsHost).ToList();

            AnonymousHosts = ConnectedPeers
                             .Count(g => (string.IsNullOrEmpty(g.CustomName) ||
                                          g.CustomName == PeerMessage.AnonymousName) &&
                                    g.IsHost);

            RaiseUpdateEvent();

            foreach (var guest in ConnectedPeers)
            {
                _log.LogDebug($"{guest.CustomName}");
                _log.LogDebug($"{guest.DisplayName}");
            }
        }