Beispiel #1
0
        /// <summary>
        /// Bonjour callback
        /// </summary>
        /// <param name="service"></param>
        private void didUpdateTXT(NetService service)
        {
            ArrayList list = getList(service.Type);

            if (list == null)
                return;

            lock (list.SyncRoot) {
                foreach (JSONSrcSink player in list) {
                    if (player.id.Equals(service.Name)) {
                        processTXTrecord(service, player);

                        // Kludge. Sometimes, we miss the TXT update record from Bonjour.
                        // So, we stop and restart a new monitoring session. That forces the system to continously get updates/stop/new update/stop, yuck
                        service.StopMonitoring();

                        service.DidUpdateTXT += new NetService.ServiceTXTUpdated(didUpdateTXT);
                        service.StartMonitoring();

                        return;
                    }
                }
            }
        }