2
0

GithubContext.cs 989 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Net;
  3. namespace FastGithub.Scanner
  4. {
  5. sealed class GithubContext : IEquatable<GithubContext>
  6. {
  7. public string Domain { get; }
  8. public IPAddress Address { get; }
  9. public TimeSpan? HttpElapsed { get; set; }
  10. public GithubContext(string domain, IPAddress address)
  11. {
  12. this.Domain = domain;
  13. this.Address = address;
  14. }
  15. public override string ToString()
  16. {
  17. return $"{Address}\t{Domain}\t# {HttpElapsed}";
  18. }
  19. public override bool Equals(object? obj)
  20. {
  21. return obj is GithubContext other && this.Equals(other);
  22. }
  23. public bool Equals(GithubContext? other)
  24. {
  25. return other != null && other.Address.Equals(this.Address) && other.Domain == this.Domain;
  26. }
  27. public override int GetHashCode()
  28. {
  29. return HashCode.Combine(this.Domain, this.Address);
  30. }
  31. }
  32. }