SiteMap.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //
  2. // System.Web.SiteMap
  3. //
  4. // Authors:
  5. // Ben Maurer ([email protected])
  6. //
  7. // (C) 2003 Ben Maurer
  8. //
  9. #if NET_1_2
  10. using System.Collections;
  11. using System.Collections.Specialized;
  12. using System.Text;
  13. using System.Configuration.Provider;
  14. namespace System.Web {
  15. public sealed class SiteMap {
  16. [MonoTODO ("Get everything from the config")]
  17. private static void Init ()
  18. {
  19. if (provider == null) {
  20. lock (typeof (SiteMap)) {
  21. if (provider == null) {
  22. providers = new SiteMapProviderCollection ();
  23. provider = new XmlSiteMapProvider ();
  24. NameValueCollection attributes = new NameValueCollection ();
  25. attributes.Add ("siteMapFile", "app.sitemap");
  26. ((IProvider)provider).Initialize ("AspNetXmlSiteMapProvider", attributes);
  27. providers.Add ((IProvider)provider);
  28. }
  29. }
  30. }
  31. }
  32. public static SiteMapNode CurrentNode {
  33. get { return Provider.CurrentNode; }
  34. }
  35. public static SiteMapNode RootNode {
  36. get { return Provider.RootNode; }
  37. }
  38. public static ISiteMapProvider Provider {
  39. get {
  40. Init ();
  41. return provider;
  42. }
  43. }
  44. public static SiteMapProviderCollection Providers {
  45. get {
  46. Init ();
  47. return providers;
  48. }
  49. }
  50. static ISiteMapProvider provider;
  51. static SiteMapProviderCollection providers;
  52. }
  53. }
  54. #endif