コード例 #1
0
ファイル: fusionwrap.cs プロジェクト: wwkkww1983/ZJCredit
        public static void ReadCache(ArrayList alAssems, string name, uint nFlag)
        {
            IAssemblyEnum       ppEnum1  = (IAssemblyEnum)null;
            IAssemblyName       ppName   = (IAssemblyName)null;
            IAssemblyName       ppEnum2  = (IAssemblyName)null;
            IApplicationContext ppAppCtx = (IApplicationContext)null;

            if (name != null)
            {
                int assemblyNameObject = Win32Native.CreateAssemblyNameObject(out ppEnum2, name, 1U, IntPtr.Zero);
                if (assemblyNameObject != 0)
                {
                    Marshal.ThrowExceptionForHR(assemblyNameObject);
                }
            }
            int assemblyEnum = Win32Native.CreateAssemblyEnum(out ppEnum1, ppAppCtx, ppEnum2, nFlag, IntPtr.Zero);

            if (assemblyEnum != 0)
            {
                Marshal.ThrowExceptionForHR(assemblyEnum);
            }
            while (true)
            {
                string displayName;
                do
                {
                    int nextAssembly = ppEnum1.GetNextAssembly(out ppAppCtx, out ppName, 0U);
                    if (nextAssembly != 0)
                    {
                        if (nextAssembly < 0)
                        {
                            Marshal.ThrowExceptionForHR(nextAssembly);
                            return;
                        }
                        goto label_10;
                    }
                    else
                    {
                        displayName = Fusion.GetDisplayName(ppName, 0U);
                    }
                }while (displayName == null);
                alAssems.Add((object)displayName);
            }
            label_10 :;
        }
コード例 #2
0
        public static void ReadCache(ArrayList alAssems, string name, uint nFlag)
        {
            IAssemblyEnum       assemblyEnum = null;
            IAssemblyName       aName        = null;
            IAssemblyName       pName        = null;
            IApplicationContext pAppCtx      = null;
            int num;

            if (name != null)
            {
                num = Win32Native.CreateAssemblyNameObject(out pName, name, 1U, IntPtr.Zero);
                if (num != 0)
                {
                    Marshal.ThrowExceptionForHR(num);
                }
            }
            num = Win32Native.CreateAssemblyEnum(out assemblyEnum, pAppCtx, pName, nFlag, IntPtr.Zero);
            if (num != 0)
            {
                Marshal.ThrowExceptionForHR(num);
            }
            for (;;)
            {
                num = assemblyEnum.GetNextAssembly(out pAppCtx, out aName, 0U);
                if (num != 0)
                {
                    break;
                }
                string displayName = Fusion.GetDisplayName(aName, 0U);
                if (displayName != null)
                {
                    alAssems.Add(displayName);
                }
            }
            if (num < 0)
            {
                Marshal.ThrowExceptionForHR(num);
                return;
            }
        }