2007-01-25 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.Configuration.Install / System.Diagnostics / EventLogInstaller.cs
1 // System.Diagnostics.EventLogInstaller.cs
2 //
3 // Author:
4 //      Gert Driesen (drieseng@users.sourceforge.net)
5 //
6 // (C) Novell
7 //
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
30 using System.Collections;
31 using System.ComponentModel;
32 using System.Configuration.Install;
33 using System.Runtime.InteropServices;
34
35 namespace System.Diagnostics
36 {
37         public class EventLogInstaller : ComponentInstaller
38         {
39                 public EventLogInstaller ()
40                 {
41                 }
42
43                 [MonoTODO]
44                 public override void CopyFromComponent (IComponent component)
45                 {
46                         throw new NotImplementedException ();
47                 }
48
49                 [MonoTODO]
50                 public override void Install (IDictionary stateSaver)
51                 {
52                         throw new NotImplementedException ();
53                 }
54
55                 [MonoTODO]
56                 public override bool IsEquivalentInstaller (ComponentInstaller otherInstaller)
57                 {
58                         throw new NotImplementedException ();
59                 }
60
61                 [MonoTODO]
62                 public override void Rollback (IDictionary savedState)
63                 {
64                         throw new NotImplementedException ();
65                 }
66
67                 [MonoTODO]
68                 public override void Uninstall (IDictionary savedState)
69                 {
70                         throw new NotImplementedException ();
71                 }
72
73                 [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
74                 public string Log {
75                         get {
76                                 if (_log == null && _source != null)
77                                         _log = EventLog.LogNameFromSourceName (_source, ".");
78
79                                 return _log;
80                         }
81                         set {
82                                 _log = value;
83                         }
84                 }
85
86                 [TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
87                 public string Source {
88                         get {
89                                 return _source;
90                         }
91                         set {
92                                 _source = value;
93                         }
94                 }
95
96                 [DefaultValue (UninstallAction.Remove)]
97                 public UninstallAction UninstallAction {
98                         get {
99                                 return _uninstallAction;
100                         }
101                         set {
102                                 if (!Enum.IsDefined(typeof(UninstallAction), value))
103                                         // LAMESPEC, the docs do not mention this, but 
104                                         // this exception is indeed thrown for invalid
105                                         // values
106                                         throw new InvalidEnumArgumentException("value", 
107                                                 (int) value, typeof(UninstallAction));
108
109                                 _uninstallAction = value;
110                         }
111                 }
112
113                 private string _log;
114                 private string _source;
115                 private UninstallAction _uninstallAction = UninstallAction.Remove;
116         }
117 }