PerformanceCounterInstaller.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. // System.Diagnostics.PerformanceCounterInstaller.cs
  2. //
  3. // Author:
  4. // Gert Driesen ([email protected])
  5. //
  6. // (C) Gert Driesen
  7. // (C) Novell
  8. //
  9. //
  10. // Permission is hereby granted, free of charge, to any person obtaining
  11. // a copy of this software and associated documentation files (the
  12. // "Software"), to deal in the Software without restriction, including
  13. // without limitation the rights to use, copy, modify, merge, publish,
  14. // distribute, sublicense, and/or sell copies of the Software, and to
  15. // permit persons to whom the Software is furnished to do so, subject to
  16. // the following conditions:
  17. //
  18. // The above copyright notice and this permission notice shall be
  19. // included in all copies or substantial portions of the Software.
  20. //
  21. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  26. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. //
  29. using System.Collections;
  30. using System.ComponentModel;
  31. using System.Configuration.Install;
  32. using System.Runtime.InteropServices;
  33. namespace System.Diagnostics
  34. {
  35. public class PerformanceCounterInstaller : ComponentInstaller
  36. {
  37. public PerformanceCounterInstaller ()
  38. {
  39. }
  40. [MonoTODO]
  41. public override void CopyFromComponent (IComponent component)
  42. {
  43. throw new NotImplementedException ();
  44. }
  45. [MonoTODO]
  46. public override void Install (IDictionary stateSaver)
  47. {
  48. throw new NotImplementedException ();
  49. }
  50. [MonoTODO]
  51. public override void Rollback (IDictionary savedState)
  52. {
  53. throw new NotImplementedException ();
  54. }
  55. [MonoTODO]
  56. public override void Uninstall (IDictionary savedState)
  57. {
  58. throw new NotImplementedException ();
  59. }
  60. [DefaultValue ("")]
  61. #if !NET_2_0
  62. [MonitoringDescription ("PCI_CategoryHelp")]
  63. #endif
  64. public string CategoryHelp {
  65. get {
  66. return _categoryHelp;
  67. }
  68. set {
  69. if (value == null)
  70. throw new ArgumentNullException ("value");
  71. _categoryHelp = value;
  72. }
  73. }
  74. [DefaultValue ("")]
  75. [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
  76. public string CategoryName {
  77. get {
  78. return _categoryName;
  79. }
  80. set {
  81. if (value == null)
  82. throw new ArgumentNullException ("value");
  83. _categoryName = value;
  84. }
  85. }
  86. [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
  87. #if !NET_2_0
  88. [MonitoringDescription("PCI_Counters")]
  89. #endif
  90. public CounterCreationDataCollection Counters {
  91. get {
  92. return _counters;
  93. }
  94. }
  95. [DefaultValue (UninstallAction.Remove)]
  96. #if !NET_2_0
  97. [MonitoringDescription ("PCI_UninstallAction")]
  98. #endif
  99. public UninstallAction UninstallAction {
  100. get {
  101. return _uninstallAction;
  102. }
  103. set {
  104. if (!Enum.IsDefined(typeof(UninstallAction), value))
  105. // LAMESPEC, the docs do not mention this, but
  106. // this exception is indeed thrown for invalid
  107. // values
  108. throw new InvalidEnumArgumentException("value",
  109. (int) value, typeof(UninstallAction));
  110. _uninstallAction = value;
  111. }
  112. }
  113. #if NET_2_0
  114. [ComVisible (false)]
  115. [DefaultValue (PerformanceCounterCategoryType.Unknown)]
  116. public PerformanceCounterCategoryType CategoryType {
  117. get {
  118. return _categoryType;
  119. }
  120. set {
  121. if (!Enum.IsDefined(typeof(PerformanceCounterCategoryType), value))
  122. // LAMESPEC, the docs do not mention this, but
  123. // this exception is indeed thrown for invalid
  124. // values
  125. throw new InvalidEnumArgumentException("value",
  126. (int) value, typeof(PerformanceCounterCategoryType));
  127. _categoryType = value;
  128. }
  129. }
  130. #endif
  131. private string _categoryHelp = string.Empty;
  132. private string _categoryName = string.Empty;
  133. private CounterCreationDataCollection _counters = new CounterCreationDataCollection ();
  134. private UninstallAction _uninstallAction = UninstallAction.Remove;
  135. #if NET_2_0
  136. private PerformanceCounterCategoryType _categoryType;
  137. #endif
  138. }
  139. }