OuterConfig.cs 840 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System.Net;
  2. using MongoDB.Bson.Serialization.Attributes;
  3. namespace Model
  4. {
  5. [BsonIgnoreExtraElements]
  6. public class OuterConfig: AConfigComponent
  7. {
  8. public string Host { get; set; }
  9. public int Port { get; set; }
  10. public string Host2 { get; set; }
  11. [BsonIgnore]
  12. private IPEndPoint ipEndPoint;
  13. [BsonIgnore]
  14. private IPEndPoint ipEndPoint2;
  15. public override void EndInit()
  16. {
  17. base.EndInit();
  18. if (this.Host2 == null)
  19. {
  20. this.Host2 = this.Host;
  21. }
  22. this.ipEndPoint = NetworkHelper.ToIPEndPoint(this.Host, this.Port);
  23. this.ipEndPoint2 = NetworkHelper.ToIPEndPoint(this.Host2, this.Port);
  24. }
  25. [BsonIgnore]
  26. public IPEndPoint IPEndPoint
  27. {
  28. get
  29. {
  30. return this.ipEndPoint;
  31. }
  32. }
  33. [BsonIgnore]
  34. public IPEndPoint IPEndPoint2
  35. {
  36. get
  37. {
  38. return this.ipEndPoint2;
  39. }
  40. }
  41. }
  42. }