private void FoundAddress(string metaAddress) { // establish a meta connection and load all sets, if possible IEnumerable <WebServiceSet> sets; try { IMetaService meta = CreateMeta(metaAddress); if (meta == null) { return; } sets = meta.GetActiveServiceSets(); if (sets == null || sets.Count() == 0) { return; } } catch (Exception) { return; } // loop through sets and remove all subsets of this set (and dump this set if we already have a bigger one) lock (serviceSets) { foreach (WebServiceSet newSet in sets) { bool loopAgain = false; bool add = true; do { loopAgain = false; foreach (WebServiceSet acceptedSet in serviceSets) { if (acceptedSet.IsSubsetOf(newSet)) { serviceSets.Remove(acceptedSet); loopAgain = true; break; } else if (newSet.IsSubsetOf(acceptedSet) || newSet.IsSameAs(acceptedSet)) { add = false; break; } } } while (loopAgain && add); if (add) { // yeah, this seems to be a valid set. Add it and notify clients. serviceSets.Add(newSet); if (SetDiscovered != null) { SetDiscovered(this, new SetDiscoveredEventArgs(new ServiceAddressSet(newSet))); } } } } }