Files
Gert Driesen 508fc87d2a Fix analyzer errors in Renci.SshNet and Renci.SshNet.TestTools.OpenSSH (#1229)
* Fix analyzer errors in Renci.SshNet and Renci.SshNet.TestTools.OpenSSH.
Suppress all errors in unit tests and integration tests.

* Update unit tests now that we pass 'mode' as argument name when we throw ArgumentException.

* Remove stale comment and add unit tests for SshData.ReadBytes(int length).

* Remove unnessary suppression.

* Remove Visual Studio magic.

* Removed duplicate source file.

* Clarified that suppression hides a false positive.

* Remove suppressions for S2372.

* Update ReadExtensionPair() to return concrete dictionary.
2023-11-01 11:33:42 +01:00

63 lines
1.5 KiB
C#

namespace Renci.SshNet.TestTools.OpenSSH
{
public sealed class Match
{
public Match(string[] users, string[] addresses)
{
Users = users;
Addresses = addresses;
}
public string[] Users { get; }
public string[] Addresses { get; }
public string? AuthenticationMethods { get; set; }
public void WriteTo(TextWriter writer)
{
if (writer is null)
{
throw new ArgumentNullException(nameof(writer));
}
writer.Write("Match ");
if (Users.Length > 0)
{
writer.Write("User ");
for (var i = 0; i < Users.Length; i++)
{
if (i > 0)
{
writer.Write(',');
}
writer.Write(Users[i]);
}
}
if (Addresses.Length > 0)
{
writer.Write("Address ");
for (var i = 0; i < Addresses.Length; i++)
{
if (i > 0)
{
writer.Write(',');
}
writer.Write(Addresses[i]);
}
}
writer.WriteLine();
if (AuthenticationMethods != null)
{
writer.WriteLine(" AuthenticationMethods " + AuthenticationMethods);
}
}
}
}