RefererConfiguration.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using System.Xml.Serialization;
  3. using System.Text;
  4. using System.Collections.Generic;
  5. namespace COSXML.Model.Tag
  6. {
  7. [XmlRoot("RefererConfiguration")]
  8. public sealed class RefererConfiguration
  9. {
  10. [XmlElement("Status")]
  11. public string Status;
  12. [XmlElement("RefererType")]
  13. public string RefererType;
  14. [XmlElement("DomainList")]
  15. public DomainList domainList;
  16. [XmlElement("EmptyReferConfiguration")]
  17. public string EmptyReferConfiguration;
  18. public string GetInfo()
  19. {
  20. StringBuilder stringBuilder = new StringBuilder("{RefererConfiguration:\n");
  21. stringBuilder.Append("Status:").Append(Status).Append("\n");
  22. stringBuilder.Append("RefererType:").Append(RefererType).Append("\n");
  23. stringBuilder.Append(domainList.ToString());
  24. if(EmptyReferConfiguration == null)
  25. {
  26. stringBuilder.Append("EmptyReferConfiguration:").Append(EmptyReferConfiguration).Append("\n");
  27. }
  28. stringBuilder.Append("}");
  29. return stringBuilder.ToString();
  30. }
  31. }
  32. public sealed class DomainList
  33. {
  34. [XmlElement("Domain")]
  35. public List<string> domains;
  36. public DomainList()
  37. {
  38. this.domains = new List<string>();
  39. }
  40. public void AddDomain(string domain)
  41. {
  42. domains.Add(domain);
  43. }
  44. public string GetInfo()
  45. {
  46. StringBuilder stringBuilder = new StringBuilder("{DomainList:\n");
  47. foreach (var domain in domains)
  48. {
  49. stringBuilder.Append("Domain:").Append(domain).Append("\n");
  50. }
  51. stringBuilder.Append("}");
  52. return stringBuilder.ToString();
  53. }
  54. }
  55. }