internal static MethodInformation GetMethodInformation(MethodData mData) { SortedList parametersList = new SortedList(); BaseWMIAdapter.UpdateParameters(mData.InParameters, parametersList); BaseWMIAdapter.WMIParameterInformation[] parameterInformationArray = new BaseWMIAdapter.WMIParameterInformation[parametersList.Count]; if (parametersList.Count > 0) { parametersList.Values.CopyTo((Array)parameterInformationArray, 0); } return(new MethodInformation(false, true, (ParameterInformation[])parameterInformationArray)); }
internal static string GetMethodDefinition(MethodData mData) { SortedList parametersList = new SortedList(); BaseWMIAdapter.UpdateParameters(mData.InParameters, parametersList); StringBuilder stringBuilder1 = new StringBuilder(); if (parametersList.Count > 0) { foreach (BaseWMIAdapter.WMIParameterInformation parameterInformation in (IEnumerable)parametersList.Values) { string embeddedObjectTypeName = parameterInformation.parameterType.ToString(); PropertyData property = mData.InParameters.Properties[parameterInformation.Name]; if (property.Type == CimType.Object) { embeddedObjectTypeName = BaseWMIAdapter.GetEmbeddedObjectTypeName(property); if (property.IsArray) { embeddedObjectTypeName += "[]"; } } stringBuilder1.Append(embeddedObjectTypeName); stringBuilder1.Append(" "); stringBuilder1.Append(parameterInformation.Name); stringBuilder1.Append(", "); } } if (stringBuilder1.Length > 2) { stringBuilder1.Remove(stringBuilder1.Length - 2, 2); } Adapter.tracer.WriteLine("Constructing method definition for method {0}", (object)mData.Name); StringBuilder stringBuilder2 = new StringBuilder(); stringBuilder2.Append("System.Management.ManagementBaseObject "); stringBuilder2.Append(mData.Name); stringBuilder2.Append("("); stringBuilder2.Append(stringBuilder1.ToString()); stringBuilder2.Append(")"); string str = stringBuilder2.ToString(); Adapter.tracer.WriteLine("Definition constructed: {0}", (object)str); return(str); }