1 // System.Diagnostics.PerformanceCounterInstaller.cs
2 //
3 // Author:
4 // 	Gert Driesen (drieseng@users.sourceforge.net)
5 //
6 // (C) Gert Driesen
7 // (C) Novell
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 PerformanceCounterInstaller : ComponentInstaller
39 	{
PerformanceCounterInstaller()40 		public PerformanceCounterInstaller ()
41 		{
42 		}
43 
44 		[MonoTODO]
CopyFromComponent(IComponent component)45 		public override void CopyFromComponent (IComponent component)
46 		{
47 			throw new NotImplementedException ();
48 		}
49 
50 		[MonoTODO]
Install(IDictionary stateSaver)51 		public override void Install (IDictionary stateSaver)
52 		{
53 			throw new NotImplementedException ();
54 		}
55 
56 		[MonoTODO]
Rollback(IDictionary savedState)57 		public override void Rollback (IDictionary savedState)
58 		{
59 			throw new NotImplementedException ();
60 		}
61 
62 		[MonoTODO]
Uninstall(IDictionary savedState)63 		public override void Uninstall (IDictionary savedState)
64 		{
65 			throw new NotImplementedException ();
66 		}
67 
68 		[DefaultValue ("")]
69 		public string CategoryHelp {
70 			get {
71 				return _categoryHelp;
72 			}
73 			set {
74 				if (value == null)
75 					throw new ArgumentNullException ("value");
76 
77 				_categoryHelp = value;
78 			}
79 		}
80 
81 		[DefaultValue ("")]
82 		[TypeConverter ("System.Diagnostics.Design.StringValueConverter, " + Consts.AssemblySystem_Design)]
83 		public string CategoryName {
84 			get {
85 				return _categoryName;
86 			}
87 			set {
88 				if (value == null)
89 					throw new ArgumentNullException ("value");
90 
91 				_categoryName = value;
92 			}
93 		}
94 
95 		[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
96 		public CounterCreationDataCollection Counters {
97 			get {
98 				return _counters;
99 			}
100 		}
101 
102 		[DefaultValue (UninstallAction.Remove)]
103 		public UninstallAction UninstallAction {
104 			get {
105 				return _uninstallAction;
106 			}
107 			set {
108 				if (!Enum.IsDefined(typeof(UninstallAction), value))
109 					// LAMESPEC, the docs do not mention this, but
110 					// this exception is indeed thrown for invalid
111 					// values
112 					throw new InvalidEnumArgumentException("value",
113 						(int) value, typeof(UninstallAction));
114 
115 				_uninstallAction = value;
116 			}
117 		}
118 
119 		[ComVisible (false)]
120 		[DefaultValue (PerformanceCounterCategoryType.Unknown)]
121 		public PerformanceCounterCategoryType CategoryType {
122 			get {
123 				return _categoryType;
124 			}
125 			set {
126 				if (!Enum.IsDefined(typeof(PerformanceCounterCategoryType), value))
127 					// LAMESPEC, the docs do not mention this, but
128 					// this exception is indeed thrown for invalid
129 					// values
130 					throw new InvalidEnumArgumentException("value",
131 						(int) value, typeof(PerformanceCounterCategoryType));
132 
133 				_categoryType = value;
134 			}
135 		}
136 
137 		private string _categoryHelp = string.Empty;
138 		private string _categoryName = string.Empty;
139 		private CounterCreationDataCollection _counters = new CounterCreationDataCollection ();
140 		private UninstallAction _uninstallAction = UninstallAction.Remove;
141 		private PerformanceCounterCategoryType _categoryType;
142 	}
143 }
144