Match.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. namespace Renci.SshNet.TestTools.OpenSSH
  2. {
  3. public class Match
  4. {
  5. public Match(string[] users, string[] addresses)
  6. {
  7. Users = users;
  8. Addresses = addresses;
  9. }
  10. public string[] Users { get; }
  11. public string[] Addresses { get; }
  12. public string? AuthenticationMethods { get; set; }
  13. public void WriteTo(TextWriter writer)
  14. {
  15. writer.Write("Match ");
  16. if (Users.Length > 0)
  17. {
  18. writer.Write("User ");
  19. for (var i = 0; i < Users.Length; i++)
  20. {
  21. if (i > 0)
  22. {
  23. writer.Write(',');
  24. }
  25. writer.Write(Users[i]);
  26. }
  27. }
  28. if (Addresses.Length > 0)
  29. {
  30. writer.Write("Address ");
  31. for (var i = 0; i < Addresses.Length; i++)
  32. {
  33. if (i > 0)
  34. {
  35. writer.Write(',');
  36. }
  37. writer.Write(Addresses[i]);
  38. }
  39. }
  40. writer.WriteLine();
  41. if (AuthenticationMethods != null)
  42. {
  43. writer.WriteLine(" AuthenticationMethods " + AuthenticationMethods);
  44. }
  45. }
  46. }
  47. }