111 references to Line
System.Management (111)
Instrumentation\CodeSpit.cs (6)
51
Line
(name);
52
Line
("{");
56
Line
("}");
67
Line
(name);
86
Line
(String.Concat(parts));
111
usingCode.
Line
(String.Format("using {0};", type.Namespace));
Instrumentation\SchemaMapping.cs (103)
91
codeOneLineMembers.
Line
("static ManagementClass managementClass = new ManagementClass(@\"" + classPath + "\");");
92
codeOneLineMembers.
Line
("static IntPtr classWbemObjectIP;");
93
codeOneLineMembers.
Line
("static Guid iidIWbemObjectAccess = new Guid(\"49353C9A-516B-11D1-AEA6-00C04FB68820\");");
94
codeOneLineMembers.
Line
("internal ManagementObject instance = managementClass.CreateInstance();");
95
codeOneLineMembers.
Line
("object reflectionInfoTempObj = null ; ");
96
codeOneLineMembers.
Line
("FieldInfo reflectionIWbemClassObjectField = null ; ");
97
codeOneLineMembers.
Line
("IntPtr emptyWbemObject = IntPtr.Zero ; ");
98
codeOneLineMembers.
Line
("IntPtr originalObject = IntPtr.Zero ; ");
99
codeOneLineMembers.
Line
("bool toWmiCalled = false ; ");
105
codeOneLineMembers.
Line
("IntPtr theClone = IntPtr.Zero;");
106
codeOneLineMembers.
Line
("public static ManagementObject emptyInstance = managementClass.CreateInstance();");
109
codeOneLineMembers.
Line
("public IntPtr instWbemObjectAccessIP;");
113
codeCCTOR.
Line
("classWbemObjectIP = (IntPtr)managementClass;");
114
codeCCTOR.
Line
("IntPtr wbemObjectAccessIP;");
115
codeCCTOR.
Line
("Marshal.QueryInterface(classWbemObjectIP, ref iidIWbemObjectAccess, out wbemObjectAccessIP);");
116
codeCCTOR.
Line
("int cimType;");
120
codeCTOR.
Line
("IntPtr wbemObjectIP = (IntPtr)instance;");
121
codeCTOR.
Line
("originalObject = (IntPtr)instance;");
122
codeCTOR.
Line
("Marshal.QueryInterface(wbemObjectIP, ref iidIWbemObjectAccess, out instWbemObjectAccessIP);");
131
codeCTOR.
Line
("FieldInfo tempField = instance.GetType().GetField ( \"_wbemObject\", BindingFlags.Instance | BindingFlags.NonPublic );" );
132
codeCTOR.
Line
("if ( tempField == null )");
133
codeCTOR.
Line
("{");
134
codeCTOR.
Line
(" tempField = instance.GetType().GetField ( \"wbemObject\", BindingFlags.Instance | BindingFlags.NonPublic ) ;");
135
codeCTOR.
Line
("}");
137
codeCTOR.
Line
("reflectionInfoTempObj = tempField.GetValue (instance) ;");
138
codeCTOR.
Line
("reflectionIWbemClassObjectField = reflectionInfoTempObj.GetType().GetField (\"pWbemClassObject\", BindingFlags.Instance | BindingFlags.NonPublic );");
139
codeCTOR.
Line
("emptyWbemObject = (IntPtr) emptyInstance;");
143
codeDTOR.AddChild("if(instWbemObjectAccessIP != IntPtr.Zero)").
Line
("Marshal.Release(instWbemObjectAccessIP);");
145
codeDTOR.
Line
("if ( toWmiCalled == true )");
146
codeDTOR.
Line
("{");
147
codeDTOR.
Line
(" Marshal.Release (originalObject);");
148
codeDTOR.
Line
("}");
157
codeToWMI.
Line
( "toWmiCalled = true ;" ) ;
158
codeToWMI.
Line
( "if(instWbemObjectAccessIP != IntPtr.Zero)" ) ;
159
codeToWMI.
Line
( "{" ) ;
160
codeToWMI.
Line
(" Marshal.Release(instWbemObjectAccessIP);" ) ;
161
codeToWMI.
Line
(" instWbemObjectAccessIP = IntPtr.Zero;" ) ;
162
codeToWMI.
Line
( "}" ) ;
164
codeToWMI.
Line
( "if(theClone != IntPtr.Zero)" ) ;
165
codeToWMI.
Line
( "{" ) ;
166
codeToWMI.
Line
(" Marshal.Release(theClone);" ) ;
167
codeToWMI.
Line
(" theClone = IntPtr.Zero;" ) ;
168
codeToWMI.
Line
( "}" ) ;
170
codeToWMI.
Line
( "IWOA.Clone_f(12, emptyWbemObject, out theClone) ;" ) ;
171
codeToWMI.
Line
( "Marshal.QueryInterface(theClone, ref iidIWbemObjectAccess, out instWbemObjectAccessIP) ;" ) ;
172
codeToWMI.
Line
( "reflectionIWbemClassObjectField.SetValue ( reflectionInfoTempObj, theClone ) ;" ) ;
174
codeToWMI.
Line
(String.Format("{0} instNET = ({0})obj;", type.FullName.Replace('+', '.'))); // bug#92918 - watch for nested classes
178
codeIntPtrCast.
Line
("return obj.instWbemObjectAccessIP;");
181
codeOneLineMembers.
Line
("public ManagementObject GetInstance() {return instance;}");
279
codeOneLineMembers.
Line
("static Hashtable mapTypeToConverter = new Hashtable();");
282
codeCCTOR.
Line
(String.Format("mapTypeToConverter[typeof({0})] = typeof({1});", ((Type)entry.Key).FullName.Replace('+', '.'), (string)entry.Value)); // bug#92918 - watch for nested classes
292
codeOneLineMembers.
Line
("static int " + handleFieldName + ";");
293
codeCCTOR.
Line
(String.Format("IWOA.GetPropertyHandle_f27(27, wbemObjectAccessIP, \"{0}\", out cimType, out {1});", propName, handleFieldName));
296
codeOneLineMembers.
Line
("PropertyData " + propFieldName + ";");
297
codeCTOR.
Line
(String.Format("{0} = instance.Properties[\"{1}\"];", propFieldName, propName));
303
codeElse.
Line
(String.Format("{0}.Value = null;", propFieldName));
306
codeNotNull.
Line
(String.Format("int len = instNET.{0}.Length;", field.Name));
307
codeNotNull.
Line
("ManagementObject[] embeddedObjects = new ManagementObject[len];");
308
codeNotNull.
Line
("IWmiConverter[] embeddedConverters = new IWmiConverter[len];");
313
codeFoundType.
Line
(String.Format("Type type = (Type)mapTypeToConverter[instNET.{0}[i].GetType()];", field.Name));
314
codeFoundType.
Line
("embeddedConverters[i] = (IWmiConverter)Activator.CreateInstance(type);");
315
codeFoundType.
Line
(String.Format("embeddedConverters[i].ToWMI(instNET.{0}[i]);", field.Name));
316
codeFoundType.
Line
("embeddedObjects[i] = embeddedConverters[i].GetInstance();");
318
codeForLoop.AddChild("else").
Line
(String.Format("embeddedObjects[i] = SafeAssign.GetManagementObject(instNET.{0}[i]);", field.Name));
320
codeNotNull.
Line
(String.Format("{0}.Value = embeddedObjects;", propFieldName));
325
codeFoundType.
Line
(String.Format("Type type = (Type)mapTypeToConverter[instNET.{0}.GetType()];", field.Name));
326
codeFoundType.
Line
("IWmiConverter converter = (IWmiConverter)Activator.CreateInstance(type);");
327
codeFoundType.
Line
(String.Format("converter.ToWMI(instNET.{0});", field.Name));
328
codeFoundType.
Line
(String.Format("{0}.Value = converter.GetInstance();", propFieldName));
330
codeNotNull.AddChild("else").
Line
(String.Format("{0}.Value = SafeAssign.GetInstance(instNET.{1});", propFieldName, field.Name));
343
codeElse.
Line
(String.Format("{0}.Value = null;", propFieldName));
348
codeNotNull.
Line
(String.Format("int len = instNET.{0}.Length;", field.Name));
349
codeNotNull.
Line
("ManagementObject[] embeddedObjects = new ManagementObject[len];");
350
codeNotNull.
Line
(String.Format("{0}[] embeddedConverters = new {0}[len];", embeddedConverterName));
353
codeForLoop.
Line
(String.Format("embeddedConverters[i] = new {0}();", embeddedConverterName));
358
codeForLoop.
Line
(String.Format("embeddedConverters[i].ToWMI(instNET.{0}[i]);", field.Name));
363
codeArrayElementNotNull.
Line
(String.Format("embeddedConverters[i].ToWMI(instNET.{0}[i]);", field.Name));
365
codeForLoop.
Line
("embeddedObjects[i] = embeddedConverters[i].instance;");
367
codeNotNull.
Line
(String.Format("{0}.Value = embeddedObjects;", propFieldName));
377
codeOneLineMembers.
Line
(String.Format("{0} lazy_embeddedConverter_{1} = null;", embeddedConverterName, propFieldName));
381
codeIf.
Line
(String.Format("lazy_embeddedConverter_{0} = new {1}();", propFieldName, embeddedConverterName));
382
codeGet.
Line
(String.Format("return lazy_embeddedConverter_{0};", propFieldName));
384
codeNotNull.
Line
(String.Format("embeddedConverter_{0}.ToWMI(instNET.{1});", propFieldName, field.Name));
385
codeNotNull.
Line
(String.Format("{0}.Value = embeddedConverter_{0}.instance;", propFieldName));
397
codeToWMI.
Line
(String.Format("{0} instNET_{1} = instNET.{1} ;", t2, field.Name));
398
codeToWMI.
Line
(String.Format("IWOA.WritePropertyValue_f28(28, instWbemObjectAccessIP, {0}, 1, ref instNET_{1});", handleFieldName, field.Name));
406
codeToWMI.
Line
(String.Format("{0} instNET_{1} = instNET.{1} ;", t2, field.Name));
407
codeToWMI.
Line
(String.Format("IWOA.WritePropertyValue_f28(28, instWbemObjectAccessIP, {0}, 2, ref instNET_{1});", handleFieldName, field.Name));
410
codeToWMI.
Line
(String.Format("IWOA.WriteDWORD_f31(31, instWbemObjectAccessIP, {0}, instNET.{1});", handleFieldName, field.Name));
412
codeToWMI.
Line
(String.Format("IWOA.WriteQWORD_f33(33, instWbemObjectAccessIP, {0}, instNET.{1});", handleFieldName, field.Name));
417
codeToWMI.
Line
(String.Format("if(instNET.{0})", field.Name));
418
codeToWMI.
Line
(String.Format(" IWOA.WritePropertyValue_f28(28, instWbemObjectAccessIP, {0}, 2, ref SafeAssign.boolTrue);", handleFieldName));
419
codeToWMI.
Line
("else");
420
codeToWMI.
Line
(String.Format(" IWOA.WritePropertyValue_f28(28, instWbemObjectAccessIP, {0}, 2, ref SafeAssign.boolFalse);", handleFieldName));
425
codeQuickString.
Line
(String.Format("IWOA.WritePropertyValue_f28(28, instWbemObjectAccessIP, {0}, (instNET.{1}.Length+1)*2, instNET.{1});", handleFieldName, field.Name));
427
codeToWMI.AddChild("else").
Line
(String.Format("IWOA.Put_f5(5, instWbemObjectAccessIP, \"{0}\", 0, ref nullObj, 8);", propName));
435
codeOneLineMembers.
Line
("object nullObj = DBNull.Value;");
440
codeToWMI.
Line
(String.Format("IWOA.WritePropertyValue_f28(28, instWbemObjectAccessIP, {0}, 52, SafeAssign.WMITimeToString(instNET.{1}));", handleFieldName, field.Name));
444
codeToWMI.
Line
(String.Format("{0}.Value = instNET.{1};", propFieldName, field.Name));
451
codeToWMI.AddChild(String.Format("if(null == instNET.{0})", field.Name)).
Line
(String.Format("{0}.Value = null;", propFieldName));
452
codeToWMI.AddChild("else").
Line
(String.Format("{0}.Value = SafeAssign.WMITimeArrayToStringArray(instNET.{1});", propFieldName, field.Name));
457
codeToWMI.
Line
(String.Format("{0}.Value = instNET.{1};", propFieldName, field.Name));
586
codeCCTOR.
Line
("Marshal.Release(wbemObjectAccessIP);");
Instrumentation\SchemaRegistration.cs (2)
353
codeWMIConverter.
Line
("public static Hashtable mapTypeToConverter = new Hashtable();");
378
codeCCTOR.
Line
(String.Format("mapTypeToConverter[typeof({0})] = typeof({1});", mapping.ClassType.FullName.Replace('+', '.'), mapping.CodeClassName)); // bug#92918 - watch for nested classes