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