コード例 #1
0
        protected override string PropertyType(PSProperty property)
        {
            PropertyData adapterData            = property.adapterData as PropertyData;
            string       embeddedObjectTypeName = BaseWMIAdapter.GetDotNetType(adapterData).ToString();

            if (adapterData.Type == CimType.Object)
            {
                embeddedObjectTypeName = BaseWMIAdapter.GetEmbeddedObjectTypeName(adapterData);
                if (adapterData.IsArray)
                {
                    embeddedObjectTypeName += "[]";
                }
            }
            return(embeddedObjectTypeName);
        }
コード例 #2
0
        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);
        }