DynamicDiscoveryDocument.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // System.Web.Services.Discovery.DynamicDiscoveryDocument.cs
  3. //
  4. // Author:
  5. // Dave Bettin ([email protected])
  6. // Lluis Sanchez Gual ([email protected])
  7. //
  8. // Copyright (C) Dave Bettin, 2002
  9. //
  10. using System.IO;
  11. using System.Xml.Serialization;
  12. namespace System.Web.Services.Discovery {
  13. [XmlRootAttribute("dynamicDiscovery", Namespace="urn:schemas-dynamicdiscovery:disco.2000-03-17", IsNullable=true)]
  14. public sealed class DynamicDiscoveryDocument {
  15. #region Fields
  16. public const string Namespace = "urn:schemas-dynamicdiscovery:disco.2000-03-17";
  17. ExcludePathInfo[] excludes;
  18. #endregion // Fields
  19. #region Constructors
  20. public DynamicDiscoveryDocument ()
  21. {
  22. }
  23. #endregion // Constructors
  24. #region Properties
  25. [XmlElement("exclude", typeof(ExcludePathInfo))]
  26. public ExcludePathInfo[] ExcludePaths {
  27. get { return excludes; }
  28. set { excludes = value; }
  29. }
  30. #endregion // Properties
  31. #region Methods
  32. public static DynamicDiscoveryDocument Load (Stream stream)
  33. {
  34. XmlSerializer ser = new XmlSerializer (typeof(DynamicDiscoveryDocument));
  35. return (DynamicDiscoveryDocument) ser.Deserialize (stream);
  36. }
  37. public void Write (Stream stream)
  38. {
  39. XmlSerializer ser = new XmlSerializer (typeof(DynamicDiscoveryDocument));
  40. ser.Serialize (stream, this);
  41. }
  42. internal bool IsExcluded (string path)
  43. {
  44. if (excludes == null) return false;
  45. foreach (ExcludePathInfo ex in excludes)
  46. if (ex.Path == path) return true;
  47. return false;
  48. }
  49. #endregion // Methods
  50. }
  51. }