public void Update(IResolvableService service, BonjourEventArgs args) { if (service != null && service.HostEntry != null) { string host = DetectedService.GetHostname(service); int port = (int)service.Port; this.Description = service.Name; this.IPAddress = host; this.Port = port; this.Platform = args.Platform; this.Available = true; this.resolved = true; } }
void service_Resolved(object o, ServiceResolvedEventArgs args) { IResolvableService service = args.Service; service.Resolved -= new ServiceResolvedEventHandler(service_Resolved); DestinationPlatformType fcPlatform = KnownDestinationPlatformType.Other; if (service.TxtRecord != null) { foreach (TxtRecordItem record in service.TxtRecord) { if (record.Key == "platform") { string platform = record.ValueString; fcPlatform = KnownDestinationPlatformType.FromString(platform); break; } } } BonjourEventArgs e = new BonjourEventArgs(fcPlatform); this.OnServiceFound(service, e); }
protected void OnServiceFound(IResolvableService service, BonjourEventArgs args) { if (!servicesFound.ContainsKey(service.Name)) { DetectedService ds = new DetectedService(service, args.Platform); servicesFound.Add(service.Name, ds); } if (this.ServiceFound != null) { this.ServiceFound(this, service, args); } }
public void Update(IResolvableService service, BonjourEventArgs args) { if (service != null && service.HostEntry != null) { string host = DetectedService.GetHostname(service); int port = (int) service.Port; this.Description = service.Name; this.IPAddress = host; this.Port = port; this.Platform = args.Platform; this.Available = true; this.resolved = true; } }
void bonjour_ServiceFound(Bonjour sender, IResolvableService service, BonjourEventArgs args) { BonjourForwardDestination bfc = MatchBonjourServiceToForwardDestination(service); if (bfc != null) { bfc.Update(service, args); OnBonjourServiceUpdate(bfc); } }