EventLogInstaller.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. // System.Diagnostics.EventLogInstaller.cs
  2. //
  3. // Author:
  4. // Gert Driesen ([email protected])
  5. //
  6. // (C) Gert Driesen
  7. // (C) Novell Inc.
  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 EventLogInstaller : ComponentInstaller
  36. {
  37. public EventLogInstaller ()
  38. {
  39. }
  40. #if NET_2_0
  41. [MonoTODO]
  42. [ComVisible (false)]
  43. public int CategoryCount {
  44. get { throw new NotImplementedException (); }
  45. set { throw new NotImplementedException (); }
  46. }
  47. [MonoTODO]
  48. [Editor ("System.Windows.Forms.Design.FileNameEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing )]
  49. [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
  50. [ComVisible (false)]
  51. public string CategoryResourceFile {
  52. get { return _categoryResourceFile; }
  53. set { _categoryResourceFile = value; }
  54. }
  55. [MonoTODO]
  56. [Editor ("System.Windows.Forms.Design.FileNameEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing )]
  57. [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
  58. [ComVisible (false)]
  59. public string MessageResourceFile {
  60. get { return _messageResourceFile; }
  61. set { _messageResourceFile = value; }
  62. }
  63. [MonoTODO]
  64. [Editor ("System.Windows.Forms.Design.FileNameEditor, " + Consts.AssemblySystem_Design, "System.Drawing.Design.UITypeEditor, " + Consts.AssemblySystem_Drawing )]
  65. [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
  66. [ComVisible (false)]
  67. public string ParameterResourceFile {
  68. get { return _parameterResourceFile; }
  69. set { _parameterResourceFile = value; }
  70. }
  71. #endif
  72. [MonoTODO]
  73. public override void CopyFromComponent (IComponent component)
  74. {
  75. throw new NotImplementedException ();
  76. }
  77. [MonoTODO]
  78. public override void Install (IDictionary stateSaver)
  79. {
  80. throw new NotImplementedException ();
  81. }
  82. [MonoTODO]
  83. public override bool IsEquivalentInstaller (ComponentInstaller otherInstaller)
  84. {
  85. throw new NotImplementedException ();
  86. }
  87. [MonoTODO]
  88. public override void Rollback (IDictionary savedState)
  89. {
  90. throw new NotImplementedException ();
  91. }
  92. [MonoTODO]
  93. public override void Uninstall (IDictionary savedState)
  94. {
  95. throw new NotImplementedException ();
  96. }
  97. [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
  98. public string Log {
  99. get {
  100. if (_log == null && _source != null)
  101. _log = EventLog.LogNameFromSourceName (_source, ".");
  102. return _log;
  103. }
  104. set {
  105. _log = value;
  106. }
  107. }
  108. [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
  109. public string Source {
  110. get {
  111. return _source;
  112. }
  113. set {
  114. _source = value;
  115. }
  116. }
  117. [DefaultValue (UninstallAction.Remove)]
  118. public UninstallAction UninstallAction {
  119. get {
  120. return _uninstallAction;
  121. }
  122. set {
  123. if (!Enum.IsDefined(typeof(UninstallAction), value))
  124. // LAMESPEC, the docs do not mention this, but
  125. // this exception is indeed thrown for invalid
  126. // values
  127. throw new InvalidEnumArgumentException("value",
  128. (int) value, typeof(UninstallAction));
  129. _uninstallAction = value;
  130. }
  131. }
  132. private string _log;
  133. private string _source;
  134. private UninstallAction _uninstallAction = UninstallAction.Remove;
  135. #if NET_2_0
  136. private string _categoryResourceFile;
  137. private string _messageResourceFile;
  138. private string _parameterResourceFile;
  139. #endif
  140. }
  141. }