From 2658b42247d2cb3434c5aac729be29df5457548b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20K=C3=B6nig?= Date: Sun, 20 Sep 2020 09:51:46 +0200 Subject: [PATCH] Updated xml doc --- MessageCommunicator/MessageCommunicator.xml | 205 +++++++++++++++++- .../_ByteStreamHandler/ByteStreamHandler.cs | 2 +- .../_MessageRecognizer/IMessageRecognizer.cs | 4 + .../MessageRecognitionException.cs | 3 + .../_MessageRecognizer/MessageRecognizer.cs | 13 ++ .../MessageRecognizerSettings.cs | 7 + .../_Default/DefaultMessageRecognizer.cs | 8 + .../DefaultMessageRecognizerSettings.cs | 10 + .../EndSymbolsMessageRecognizer.cs | 9 + .../EndSymbolsMessageRecognizerSettings.cs | 14 ++ ...xedLengthAndEndSymbolsMessageRecognizer.cs | 12 + ...hAndEndSymbolsMessageRecognizerSettings.cs | 22 ++ .../StartAndEndSymbolsRecognizer.cs | 9 + .../StartAndEndSymbolsRecognizerSettings.cs | 18 ++ 14 files changed, 333 insertions(+), 3 deletions(-) diff --git a/MessageCommunicator/MessageCommunicator.xml b/MessageCommunicator/MessageCommunicator.xml index 48cab61..003569f 100644 --- a/MessageCommunicator/MessageCommunicator.xml +++ b/MessageCommunicator/MessageCommunicator.xml @@ -723,7 +723,7 @@ - A custom logger. If set, this delegate will be called with all relevant events. + Gets or sets a custom logger. If set, this delegate will be called with all relevant events. @@ -783,6 +783,27 @@ The bytes to be sent. True if sending was successful, otherwise false. + + + This implementation sends/receives bytes over a TCP socket. This implementation connects defined port on a + defined . + + + + + Gets the name er ip address of the remote host. + + + + + Gets the remote ip address. + + + + + Gets the remote port. + + @@ -790,7 +811,20 @@ - + + Creates a new instance. + + The dns name or string encoded ip address of the remote host. + The remote port. + The which generates wait times after broke connection and before reconnect. + + + + Creates a new instance. + + The ip address of the remote host. + The remote port. + The which generates wait times after broke connection and before reconnect. @@ -801,6 +835,47 @@ + + + This class provides all relevant settings for . + + + + + Gets or sets the hostname or ip address of the remote host. + + + + + Gets or sets the of the remote host. + + + + + Gets or sets the remote port. + + + + + Gets or sets the instance. + + + + + Creates a new instance. + + The dns name or string encoded ip address of the remote host. + The remote port. + The which generates wait times after broke connection and before reconnect. + + + + Creates a new instance. + + The ip address of the remote host. + The remote port. + The which generates wait times after broke connection and before reconnect. + @@ -844,26 +919,91 @@ The bytes to be sent True when sending was successful + + + Gets the current object for sending. + This method returns null when this is not connected to a remote partner. + + The object for sending + Internal method which reacts on incoming bytes on the currently active tcp client connection. Only one of this connection is active at one time. + + + This implementation sends/receives bytes over a TCP socket. This implementation listens on a defined port and waits for + an incoming connection. + + + + + Gets the this instance is listening on. + + + + + Gets the configured listening port. + + Gets the true listening port in case ListeningPort is set to 0. + + + + + + Create a new instance. + + The this instance should listen on. + The port his instance should listen on. Pass 0 here if the OS should decide which port to use. + The which generates wait times after broke connection and before reconnect. + + + + + + + This class provides all relevant settings for . + + + + + Gets or sets the to listening on. + + + + + Gets or sets the port to listen on. + + + + + Gets or sets the instance. + + + + + Create a new instance. + + The to listen on. + The port to listen on. Pass 0 here if the OS should decide which port to use. + The which generates wait times after broke connection and before reconnect. + @@ -884,6 +1024,12 @@ The referencing to the target character buffer. Total count of characters parsed. + + + A is responsible to recognize incoming messages and for formatting + outgoing messages. + + Gets or sets the which will be called inside the send method. @@ -898,6 +1044,32 @@ This flag is set to true when the given bytes are the first ones from a new connection. Typically this triggers receive buffer cleanup before processing received bytes. A span containing all received bytes. + + + This exception type is thrown during message recognition in an implementation. + + + + + A is responsible to recognize incoming messages and for formatting + outgoing messages. + + + + + Gets or sets the implementation to which to forward messages to be sent. + + + + + Gets or sets the implementation to which to forward all recognized messages. + + + + + Gets or sets a custom logger. If set, this delegate will be called with all relevant events. + + Sends the given message to the partner. @@ -909,12 +1081,41 @@ + + + Encapsulates all settings for an implementation. + + + + + Factory method which creates an implementation. + + The created implementation. + + + + This implements a custom messages style of the MessageCommunicator + project. + + + + + Creates a new instance. + + The to be used when convert characters to/from bytes. + + + + Creates a new instance. + + The to be used when convert characters to/from bytes. + diff --git a/MessageCommunicator/_ByteStreamHandler/ByteStreamHandler.cs b/MessageCommunicator/_ByteStreamHandler/ByteStreamHandler.cs index 7e41be4..2931bd0 100644 --- a/MessageCommunicator/_ByteStreamHandler/ByteStreamHandler.cs +++ b/MessageCommunicator/_ByteStreamHandler/ByteStreamHandler.cs @@ -33,7 +33,7 @@ public abstract class ByteStreamHandler : IByteStreamHandler public abstract string RemoteEndpointDescription { get; } /// - /// A custom logger. If set, this delegate will be called with all relevant events. + /// Gets or sets a custom logger. If set, this delegate will be called with all relevant events. /// public IMessageCommunicatorLogger? Logger { get; set; } diff --git a/MessageCommunicator/_MessageRecognizer/IMessageRecognizer.cs b/MessageCommunicator/_MessageRecognizer/IMessageRecognizer.cs index 91678ef..31e974b 100644 --- a/MessageCommunicator/_MessageRecognizer/IMessageRecognizer.cs +++ b/MessageCommunicator/_MessageRecognizer/IMessageRecognizer.cs @@ -4,6 +4,10 @@ namespace MessageCommunicator { + /// + /// A is responsible to recognize incoming messages and for formatting + /// outgoing messages. + /// public interface IMessageRecognizer { /// diff --git a/MessageCommunicator/_MessageRecognizer/MessageRecognitionException.cs b/MessageCommunicator/_MessageRecognizer/MessageRecognitionException.cs index 0497c0d..34c166e 100644 --- a/MessageCommunicator/_MessageRecognizer/MessageRecognitionException.cs +++ b/MessageCommunicator/_MessageRecognizer/MessageRecognitionException.cs @@ -3,6 +3,9 @@ namespace MessageCommunicator { + /// + /// This exception type is thrown during message recognition in an implementation. + /// public class MessageRecognitionException : Exception { public MessageRecognitionException() diff --git a/MessageCommunicator/_MessageRecognizer/MessageRecognizer.cs b/MessageCommunicator/_MessageRecognizer/MessageRecognizer.cs index 6d9712a..c99a3ca 100644 --- a/MessageCommunicator/_MessageRecognizer/MessageRecognizer.cs +++ b/MessageCommunicator/_MessageRecognizer/MessageRecognizer.cs @@ -3,12 +3,25 @@ namespace MessageCommunicator { + /// + /// A is responsible to recognize incoming messages and for formatting + /// outgoing messages. + /// public abstract class MessageRecognizer : IMessageRecognizer { + /// + /// Gets or sets the implementation to which to forward messages to be sent. + /// public IByteStreamHandler? ByteStreamHandler { get; set; } + /// + /// Gets or sets the implementation to which to forward all recognized messages. + /// public IMessageReceiveHandler? ReceiveHandler { get; set; } + /// + /// Gets or sets a custom logger. If set, this delegate will be called with all relevant events. + /// public IMessageCommunicatorLogger? Logger { get; set; } /// diff --git a/MessageCommunicator/_MessageRecognizer/MessageRecognizerSettings.cs b/MessageCommunicator/_MessageRecognizer/MessageRecognizerSettings.cs index de2aa6a..d211f04 100644 --- a/MessageCommunicator/_MessageRecognizer/MessageRecognizerSettings.cs +++ b/MessageCommunicator/_MessageRecognizer/MessageRecognizerSettings.cs @@ -4,8 +4,15 @@ namespace MessageCommunicator { + /// + /// Encapsulates all settings for an implementation. + /// public abstract class MessageRecognizerSettings { + /// + /// Factory method which creates an implementation. + /// + /// The created implementation. public abstract MessageRecognizer CreateMessageRecognizer(); } } diff --git a/MessageCommunicator/_MessageRecognizer/_Default/DefaultMessageRecognizer.cs b/MessageCommunicator/_MessageRecognizer/_Default/DefaultMessageRecognizer.cs index d7ef534..97611bb 100644 --- a/MessageCommunicator/_MessageRecognizer/_Default/DefaultMessageRecognizer.cs +++ b/MessageCommunicator/_MessageRecognizer/_Default/DefaultMessageRecognizer.cs @@ -5,6 +5,10 @@ namespace MessageCommunicator { + /// + /// This implements a custom messages style of the MessageCommunicator + /// project. + /// public class DefaultMessageRecognizer : MessageRecognizer { private const char SYMBOL_START = '<'; @@ -15,6 +19,10 @@ public class DefaultMessageRecognizer : MessageRecognizer private Decoder _decoder; private StringBuffer _receiveStringBuffer; + /// + /// Creates a new instance. + /// + /// The to be used when convert characters to/from bytes. public DefaultMessageRecognizer(Encoding encoding) { _encoding = encoding; diff --git a/MessageCommunicator/_MessageRecognizer/_Default/DefaultMessageRecognizerSettings.cs b/MessageCommunicator/_MessageRecognizer/_Default/DefaultMessageRecognizerSettings.cs index 1a3fcc1..2209de5 100644 --- a/MessageCommunicator/_MessageRecognizer/_Default/DefaultMessageRecognizerSettings.cs +++ b/MessageCommunicator/_MessageRecognizer/_Default/DefaultMessageRecognizerSettings.cs @@ -4,10 +4,20 @@ namespace MessageCommunicator { + /// + /// This class provides all settings for . + /// public class DefaultMessageRecognizerSettings : MessageRecognizerSettings { + /// + /// Gets or sets the to be used when convert characters to/from bytes. + /// public Encoding Encoding { get; set; } + /// + /// Creates a new instance. + /// + /// The to be used when convert characters to/from bytes. public DefaultMessageRecognizerSettings(Encoding encoding) { this.Encoding = encoding; diff --git a/MessageCommunicator/_MessageRecognizer/_EndSymbols/EndSymbolsMessageRecognizer.cs b/MessageCommunicator/_MessageRecognizer/_EndSymbols/EndSymbolsMessageRecognizer.cs index 14b3db5..54cdbb6 100644 --- a/MessageCommunicator/_MessageRecognizer/_EndSymbols/EndSymbolsMessageRecognizer.cs +++ b/MessageCommunicator/_MessageRecognizer/_EndSymbols/EndSymbolsMessageRecognizer.cs @@ -6,6 +6,9 @@ namespace MessageCommunicator { + /// + /// This implementation recognizes messages with one or more end symbols. + /// public class EndSymbolsMessageRecognizer : MessageRecognizer { private Encoding _encoding; @@ -13,6 +16,11 @@ public class EndSymbolsMessageRecognizer : MessageRecognizer private string _endSymbols; private StringBuffer _receiveStringBuffer; + /// + /// Creates a new instance. + /// + /// The to be used when convert characters to/from bytes. + /// The end symbols of received/sent messages. public EndSymbolsMessageRecognizer(Encoding encoding, string endSymbols) { if (string.IsNullOrEmpty(endSymbols)) @@ -64,6 +72,7 @@ protected override Task SendInternalAsync(IByteStreamHandler byteStreamHan } } + /// public override void OnReceivedBytes(bool isNewConnection, ArraySegment receivedSegment) { // Clear receive buffer on new connections diff --git a/MessageCommunicator/_MessageRecognizer/_EndSymbols/EndSymbolsMessageRecognizerSettings.cs b/MessageCommunicator/_MessageRecognizer/_EndSymbols/EndSymbolsMessageRecognizerSettings.cs index ce1d1dc..eeb6da5 100644 --- a/MessageCommunicator/_MessageRecognizer/_EndSymbols/EndSymbolsMessageRecognizerSettings.cs +++ b/MessageCommunicator/_MessageRecognizer/_EndSymbols/EndSymbolsMessageRecognizerSettings.cs @@ -4,12 +4,26 @@ namespace MessageCommunicator { + /// + /// This class provides all settings for . + /// public class EndSymbolsMessageRecognizerSettings : MessageRecognizerSettings { + /// + /// Gets or sets the to be used when convert characters to/from bytes. + /// public Encoding Encoding { get; set; } + /// + /// Gets or sets the end symbols of received/sent messages. + /// public string EndSymbols { get; set; } + /// + /// Creates a new instance. + /// + /// The to be used when convert characters to/from bytes. + /// The end symbols of received/sent messages. public EndSymbolsMessageRecognizerSettings(Encoding encoding, string endSymbols) { this.Encoding = encoding; diff --git a/MessageCommunicator/_MessageRecognizer/_FixedLengthAndEndSymbols/FixedLengthAndEndSymbolsMessageRecognizer.cs b/MessageCommunicator/_MessageRecognizer/_FixedLengthAndEndSymbols/FixedLengthAndEndSymbolsMessageRecognizer.cs index b0fb4a3..510e976 100644 --- a/MessageCommunicator/_MessageRecognizer/_FixedLengthAndEndSymbols/FixedLengthAndEndSymbolsMessageRecognizer.cs +++ b/MessageCommunicator/_MessageRecognizer/_FixedLengthAndEndSymbols/FixedLengthAndEndSymbolsMessageRecognizer.cs @@ -6,6 +6,10 @@ namespace MessageCommunicator { + /// + /// This implementation recognizes messages with one or more end symbols and + /// a fixed length. + /// public class FixedLengthAndEndSymbolsMessageRecognizer : MessageRecognizer { private Encoding _encoding; @@ -16,6 +20,13 @@ public class FixedLengthAndEndSymbolsMessageRecognizer : MessageRecognizer private char _fillSymbol; private StringBuffer _receiveStringBuffer; + /// + /// Creates a new instance. + /// + /// The to be used when convert characters to/from bytes. + /// The end symbols of received/sent messages. + /// Total length of received/sent messages. + /// Fill symbol for messages shorter than the fixed length. public FixedLengthAndEndSymbolsMessageRecognizer(Encoding encoding, string endSymbols, int lengthIncludingEndSymbols, char fillSymbol) { _encoding = encoding; @@ -82,6 +93,7 @@ protected override Task SendInternalAsync(IByteStreamHandler byteStreamHan } } + /// public override void OnReceivedBytes(bool isNewConnection, ArraySegment receivedSegment) { // Clear receive buffer on new connections diff --git a/MessageCommunicator/_MessageRecognizer/_FixedLengthAndEndSymbols/FixedLengthAndEndSymbolsMessageRecognizerSettings.cs b/MessageCommunicator/_MessageRecognizer/_FixedLengthAndEndSymbols/FixedLengthAndEndSymbolsMessageRecognizerSettings.cs index c03efa9..29e0b21 100644 --- a/MessageCommunicator/_MessageRecognizer/_FixedLengthAndEndSymbols/FixedLengthAndEndSymbolsMessageRecognizerSettings.cs +++ b/MessageCommunicator/_MessageRecognizer/_FixedLengthAndEndSymbols/FixedLengthAndEndSymbolsMessageRecognizerSettings.cs @@ -4,16 +4,38 @@ namespace MessageCommunicator { + /// + /// This class provides all settings for . + /// public class FixedLengthAndEndSymbolsMessageRecognizerSettings : MessageRecognizerSettings { + /// + /// Gets or sets the to be used when convert characters to/from bytes. + /// public Encoding Encoding { get; set; } + /// + /// Gets or sets the end symbols of received/sent messages. + /// public string EndSymbols { get; set; } + /// + /// Gets or sets the total length of received/sent messages. + /// public int LengthIncludingEndSymbols { get; set; } + /// + /// Gets or sets the fill symbol for messages shorter than the fixed length. + /// public char FillSymbol { get; set; } + /// + /// Creates a new instance. + /// + /// The to be used when convert characters to/from bytes. + /// The end symbols of received/sent messages. + /// Total length of received/sent messages. + /// Fill symbol for messages shorter than the fixed length. public FixedLengthAndEndSymbolsMessageRecognizerSettings(Encoding encoding, string endSymbols, int lengthIncludingEndSymbols, char fillSymbol) { this.Encoding = encoding; diff --git a/MessageCommunicator/_MessageRecognizer/_StartAndEndSymbols/StartAndEndSymbolsRecognizer.cs b/MessageCommunicator/_MessageRecognizer/_StartAndEndSymbols/StartAndEndSymbolsRecognizer.cs index ad4ae2e..18bfbbb 100644 --- a/MessageCommunicator/_MessageRecognizer/_StartAndEndSymbols/StartAndEndSymbolsRecognizer.cs +++ b/MessageCommunicator/_MessageRecognizer/_StartAndEndSymbols/StartAndEndSymbolsRecognizer.cs @@ -6,6 +6,9 @@ namespace MessageCommunicator { + /// + /// This implementation recognizes messages with one or more start and end symbols. + /// public class StartAndEndSymbolsRecognizer : MessageRecognizer { private Encoding _encoding; @@ -14,6 +17,12 @@ public class StartAndEndSymbolsRecognizer : MessageRecognizer private string _endSymbols; private StringBuffer _receiveStringBuffer; + /// + /// Creates a new instance. + /// + /// The to be used when convert characters to/from bytes. + /// The start symbols of received/sent messages. + /// The end symbols of received/sent messages. public StartAndEndSymbolsRecognizer(Encoding encoding, string startSymbols, string endSymbols) { _encoding = encoding; diff --git a/MessageCommunicator/_MessageRecognizer/_StartAndEndSymbols/StartAndEndSymbolsRecognizerSettings.cs b/MessageCommunicator/_MessageRecognizer/_StartAndEndSymbols/StartAndEndSymbolsRecognizerSettings.cs index 1abd28f..8da27cc 100644 --- a/MessageCommunicator/_MessageRecognizer/_StartAndEndSymbols/StartAndEndSymbolsRecognizerSettings.cs +++ b/MessageCommunicator/_MessageRecognizer/_StartAndEndSymbols/StartAndEndSymbolsRecognizerSettings.cs @@ -4,14 +4,32 @@ namespace MessageCommunicator { + /// + /// This class provides all settings for . + /// public class StartAndEndSymbolsRecognizerSettings : MessageRecognizerSettings { + /// + /// Gets or sets the to be used when convert characters to/from bytes. + /// public Encoding Encoding { get; set; } + /// + /// Gets or sets the start symbols of received/sent messages. + /// public string StartSymbols { get; set; } + /// + /// Gets or sets the end symbols of received/sent messages. + /// public string EndSymbols { get; set; } + /// + /// Creates a new instance. + /// + /// The to be used when convert characters to/from bytes. + /// The start symbols of received/sent messages. + /// The end symbols of received/sent messages. public StartAndEndSymbolsRecognizerSettings(Encoding encoding, string startSymbols, string endSymbols) { this.Encoding = encoding;