private bool PostgresMessageRead(out IPostgresMessage message) { while (true) { var foundMessage = PostgresMessage.ReadMessage( _buffer, ref _bufferOffset, ref _bufferCount, ref _readState, ref ClientState, out message); if (foundMessage) { // https://www.postgresql.org/docs/10/static/protocol-flow.html#PROTOCOL-ASYNC // TODO: Handle 'LISTEN' switch (message) { case ErrorResponseMessage errorMessage: throw new PostgresErrorException(errorMessage); case NoticeResponseMessage noticeMessage: NoticeResponse?.Invoke( this, noticeMessage.PublicCloneNotices()); continue; case ParameterStatusMessage paramMessage: ClientState.SetParameter(paramMessage); continue; } } return(foundMessage); } }
private void NoticeEvent(NoticeResponse response) { if (response != null) { NotifyWindow notify = new NotifyWindow(new Notice { Date = response.date, From = response.from, Link = response.url, Message = response.message, MessageType = response.type, Title = response.title }); } }