コード例 #1
0
ファイル: ComUtil.cs プロジェクト: x1m0/PowerShell
        /// <summary>
        /// Converts a MethodBase[] into a MethodInformation[]
        /// </summary>
        /// <returns>the ComMethodInformation[] corresponding to methods</returns>
        internal static ComMethodInformation[] GetMethodInformationArray(COM.ITypeInfo typeInfo, Collection <int> methods, bool skipLastParameters)
        {
            int methodCount = methods.Count;
            int count       = 0;

            ComMethodInformation[] returnValue = new ComMethodInformation[methodCount];

            foreach (int index in methods)
            {
                IntPtr pFuncDesc;
                typeInfo.GetFuncDesc(index, out pFuncDesc);
                COM.FUNCDESC funcdesc = ClrFacade.PtrToStructure <COM.FUNCDESC>(pFuncDesc);
                returnValue[count++] = ComUtil.GetMethodInformation(funcdesc, skipLastParameters);
                typeInfo.ReleaseFuncDesc(pFuncDesc);
            }
            return(returnValue);
        }
コード例 #2
0
ファイル: ComUtil.cs プロジェクト: mmoenfly/GitCook2021
        internal static ComMethodInformation[] GetMethodInformationArray(
            ITypeInfo typeInfo,
            Collection <int> methods,
            bool skipLastParameters)
        {
            int count = methods.Count;
            int num   = 0;

            ComMethodInformation[] methodInformationArray = new ComMethodInformation[count];
            foreach (int method in methods)
            {
                IntPtr ppFuncDesc;
                typeInfo.GetFuncDesc(method, out ppFuncDesc);
                System.Runtime.InteropServices.ComTypes.FUNCDESC structure = (System.Runtime.InteropServices.ComTypes.FUNCDESC)Marshal.PtrToStructure(ppFuncDesc, typeof(System.Runtime.InteropServices.ComTypes.FUNCDESC));
                methodInformationArray[num++] = ComUtil.GetMethodInformation(structure, skipLastParameters);
                typeInfo.ReleaseFuncDesc(ppFuncDesc);
            }
            return(methodInformationArray);
        }