RewriterRule.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. namespace URLRewriter.Config
  3. {
  4. /// <summary>
  5. /// Represents a rewriter rule. A rewriter rule is composed of a pattern to search for and a string to replace
  6. /// the pattern with (if matched).
  7. /// </summary>
  8. [Serializable()]
  9. public class RewriterRule
  10. {
  11. // private member variables...
  12. private string lookFor, sendTo;
  13. #region Public Properties
  14. /// <summary>
  15. /// Gets or sets the pattern to look for.
  16. /// </summary>
  17. /// <remarks><b>LookFor</b> is a regular expression pattern. Therefore, you might need to escape
  18. /// characters in the pattern that are reserved characters in regular expression syntax (., ?, ^, $, etc.).
  19. /// <p />
  20. /// The pattern is searched for using the <b>System.Text.RegularExpression.Regex</b> class's <b>IsMatch()</b>
  21. /// method. The pattern is case insensitive.</remarks>
  22. public string LookFor
  23. {
  24. get
  25. {
  26. return lookFor;
  27. }
  28. set
  29. {
  30. lookFor = value;
  31. }
  32. }
  33. /// <summary>
  34. /// The string to replace the pattern with, if found.
  35. /// </summary>
  36. /// <remarks>The replacement string may use grouping symbols, like $1, $2, etc. Specifically, the
  37. /// <b>System.Text.RegularExpression.Regex</b> class's <b>Replace()</b> method is used to replace
  38. /// the match in <see cref="LookFor"/> with the value in <b>SendTo</b>.</remarks>
  39. public string SendTo
  40. {
  41. get
  42. {
  43. return sendTo;
  44. }
  45. set
  46. {
  47. sendTo = value;
  48. }
  49. }
  50. #endregion
  51. }
  52. }