private static void OnRegisterReply(ServiceRef sdRef, ServiceFlags flags, ServiceError errorCode, string name, string regtype, string domain, IntPtr context) { var handle = GCHandle.FromIntPtr(context); var registerService = handle.Target as RegisterService; RegisterServiceEventArgs args = new RegisterServiceEventArgs(); args.Service = registerService; args.IsRegistered = false; args.ServiceError = (ServiceErrorCode)errorCode; if (errorCode == ServiceError.NoError) { registerService.Name = name; registerService.RegType = regtype; registerService.ReplyDomain = domain; args.IsRegistered = true; } RegisterServiceEventHandler handler = registerService.Response; if (handler != null) { handler(registerService, args); } }
private void OnRegisterReply(ServiceRef sdRef, ServiceFlags flags, ServiceError errorCode, IntPtr name, string regtype, string domain, IntPtr context) { var args = new RegisterServiceEventArgs { Service = this, IsRegistered = false, ServiceError = (ServiceErrorCode)errorCode }; if (errorCode == ServiceError.NoError) { this.Name = Native.Utf8toString(name); this.RegType = regtype; this.ReplyDomain = domain; args.IsRegistered = true; } RegisterServiceEventHandler handler = this.Response; handler?.Invoke(this, args); }
private void OnRegisterReply(ServiceRef sdRef, ServiceFlags flags, ServiceError errorCode, string name, string regtype, string domain, IntPtr context) { RegisterServiceEventArgs args = new RegisterServiceEventArgs(); args.Service = this; args.IsRegistered = false; args.NameConflict = false; args.Error = errorCode; if (errorCode == ServiceError.NoError) { Name = name; RegType = regtype; ReplyDomain = domain; args.IsRegistered = true; } else if (errorCode == ServiceError.NameConflict) { args.NameConflict = true; } RegisterServiceEventHandler handler = Response; if (handler != null) { handler(this, args); } }
protected virtual bool OnResponse(AV.ErrorCode errorCode) { RegisterServiceEventArgs args = new RegisterServiceEventArgs(); args.Service = this; args.IsRegistered = false; args.ServiceError = AvahiUtils.ErrorCodeToServiceError(errorCode); if (errorCode == AV.ErrorCode.Ok) { args.IsRegistered = true; } RegisterServiceEventHandler handler = Response; if (handler != null) { handler(this, args); return(true); } else { return(false); } }