using System; namespace Renci.SshNet.Connection { /// /// Represents an SSH identification. /// internal sealed class SshIdentification { /// /// Initializes a new instance of the class with the specified protocol version /// and software version. /// /// The SSH protocol version. /// The software version of the implementation. /// is . /// is . public SshIdentification(string protocolVersion, string softwareVersion) : this(protocolVersion, softwareVersion, comments: null) { } /// /// Initializes a new instance of the class with the specified protocol version, /// software version and comments. /// /// The SSH protocol version. /// The software version of the implementation. /// The comments. /// is . /// is . public SshIdentification(string protocolVersion, string softwareVersion, string comments) { if (protocolVersion is null) { throw new ArgumentNullException(nameof(protocolVersion)); } if (softwareVersion is null) { throw new ArgumentNullException(nameof(softwareVersion)); } ProtocolVersion = protocolVersion; SoftwareVersion = softwareVersion; Comments = comments; } /// /// Gets the software version of the implementation. /// /// /// The software version of the implementation. /// /// /// This is primarily used to trigger compatibility extensions and to indicate /// the capabilities of an implementation. /// public string SoftwareVersion { get; } /// /// Gets the SSH protocol version. /// /// /// The SSH protocol version. /// public string ProtocolVersion { get; } /// /// Gets the comments. /// /// /// The comments, or if there are no comments. /// /// /// should contain additional information that might be useful /// in solving user problems. /// public string Comments { get; } /// /// Returns the SSH identification string. /// /// /// The SSH identification string. /// public override string ToString() { var identificationString = "SSH-" + ProtocolVersion + "-" + SoftwareVersion; if (Comments != null) { identificationString += " " + Comments; } return identificationString; } } }