MimeTextMatch.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //
  2. // System.Web.Services.Description.MimeTextMatch.cs
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. //
  7. // Copyright (C) Tim Coleman, 2002
  8. //
  9. using System.ComponentModel;
  10. using System.Xml.Serialization;
  11. namespace System.Web.Services.Description {
  12. public sealed class MimeTextMatch {
  13. #region Fields
  14. int capture;
  15. int group;
  16. bool ignoreCase;
  17. MimeTextMatchCollection matches;
  18. string name;
  19. string pattern;
  20. int repeats;
  21. string type;
  22. #endregion // Fields
  23. #region Constructors
  24. public MimeTextMatch ()
  25. {
  26. capture = 0;
  27. group = 1;
  28. ignoreCase = false;
  29. matches = null;
  30. name = String.Empty;
  31. pattern = String.Empty;
  32. repeats = 1;
  33. type = String.Empty;
  34. }
  35. #endregion // Constructors
  36. #region Properties
  37. [DefaultValue (0)]
  38. [XmlAttribute ("capture")]
  39. public int Capture {
  40. get { return capture; }
  41. set {
  42. if (value < 0)
  43. throw new ArgumentException ();
  44. capture = value;
  45. }
  46. }
  47. [DefaultValue (1)]
  48. [XmlAttribute ("group")]
  49. public int Group {
  50. get { return group; }
  51. set {
  52. if (value < 0)
  53. throw new ArgumentException ();
  54. group = value;
  55. }
  56. }
  57. [XmlAttribute ("ignoreCase")]
  58. public bool IgnoreCase {
  59. get { return ignoreCase; }
  60. set { ignoreCase = value; }
  61. }
  62. [XmlElement ("match")]
  63. public MimeTextMatchCollection Matches {
  64. get { return matches; }
  65. }
  66. [XmlAttribute ("name")]
  67. public string Name {
  68. get { return name; }
  69. set { name = value; }
  70. }
  71. [XmlAttribute ("pattern")]
  72. public string Pattern {
  73. get { return pattern; }
  74. set { pattern = value; }
  75. }
  76. [XmlIgnore]
  77. public int Repeats {
  78. get { return repeats; }
  79. set {
  80. if (value < 0)
  81. throw new ArgumentException ();
  82. repeats = value;
  83. }
  84. }
  85. [DefaultValue ("1")]
  86. [XmlAttribute ("repeats")]
  87. public string RepeatsString {
  88. get { return Repeats.ToString (); }
  89. set { Repeats = Int32.Parse (value); }
  90. }
  91. [XmlAttribute ("type")]
  92. public string Type {
  93. get { return type; }
  94. set { type = value; }
  95. }
  96. #endregion // Properties
  97. #region Methods
  98. internal void SetParent (MimeTextMatchCollection matches)
  99. {
  100. this.matches = matches;
  101. }
  102. #endregion // Methods
  103. }
  104. }