IISVersionInfo.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /**
  2. * Namespace: System.Web.Utils
  3. * Class: IISVersionInfo
  4. *
  5. * Author: Gaurav Vaish
  6. * Maintainer: [email protected]
  7. * Contact: <[email protected]>, <[email protected]>
  8. * Implementation: yes
  9. * Status: ??%
  10. *
  11. * (C) Gaurav Vaish (2001)
  12. */
  13. using System;
  14. using System.Diagnostics;
  15. using System.Web;
  16. using System.Web.Utils;
  17. namespace System.Web.Utils
  18. {
  19. //FIXME: This is highly Windows/IIS specific code. What about Apache related stuff?
  20. internal class IISVersionInfo
  21. {
  22. private static string isapiVersion;
  23. private static string mscoreeVersion;
  24. private static string systemWebVersion;
  25. private static readonly object lockObj = null;
  26. public IISVersionInfo()
  27. {
  28. }
  29. internal static string IsapiVersion
  30. {
  31. get
  32. {
  33. if(isapiVersion==null)
  34. {
  35. lock(lockObj)
  36. {
  37. // Recheck - another thread may have set the value
  38. // before entering lock / exiting previous lock
  39. if(isapiVersion==null)
  40. {
  41. //FIXME: What about Apache? What dll/shared-object to be loaded?
  42. isapiVersion = GetLoadedModuleVersion("aspnet_isapi.dll");
  43. }
  44. }
  45. }
  46. return isapiVersion;
  47. }
  48. }
  49. internal static string ClrVersion
  50. {
  51. get
  52. {
  53. if(mscoreeVersion==null)
  54. {
  55. lock(lockObj)
  56. {
  57. if(mscoreeVersion==null)
  58. {
  59. mscoreeVersion = GetLoadedModuleVersion("mscorlib.dll");
  60. }
  61. }
  62. }
  63. return mscoreeVersion;
  64. }
  65. }
  66. internal static string SystemWebVersion
  67. {
  68. get
  69. {
  70. if(systemWebVersion == null)
  71. {
  72. lock(lockObj)
  73. {
  74. if(systemWebVersion==null)
  75. {
  76. systemWebVersion = (FileVersionInfo.GetVersionInfo((typeof(HttpRuntime)).Module.FullyQualifiedName)).FileVersion;
  77. }
  78. }
  79. }
  80. return systemWebVersion;
  81. }
  82. }
  83. [MonoTODO]
  84. internal static string GetLoadedModuleVersion(string modulename)
  85. {
  86. //TODO: Load the version information from the module
  87. // Needs native calls - which ones, since the module will not be .Net aware
  88. throw new NotImplementedException();
  89. }
  90. [MonoTODO]
  91. internal static string GetLoadedModuleFilename(string modulename)
  92. {
  93. throw new NotImplementedException();
  94. }
  95. }
  96. }