Dev2.Reflection.GAC.GetDisplayName C# (CSharp) Method

GetDisplayName() public static method

public static GetDisplayName ( IAssemblyName name, ASM_DISPLAY_FLAGS which ) : String
name IAssemblyName
which ASM_DISPLAY_FLAGS
return String
        public static String GetDisplayName(IAssemblyName name, ASM_DISPLAY_FLAGS which)
        {
            uint bufferSize = 255;
            StringBuilder buffer = new StringBuilder((int)bufferSize);
            name.GetDisplayName(buffer, ref bufferSize, which);
            return buffer.ToString();
        }

Usage Example

示例#1
0
文件: GAC.cs 项目: kapiya/Warewolf
        public static bool RebuildGACAssemblyCache(bool forceRebuild)
        {
            if (_gacNameCache.Length != 0 && !forceRebuild)
            {
                return(true);
            }

            IAssemblyEnum iterator = null;

            try { iterator = GAC.CreateGACEnum(); }
            catch (Exception e)
            {
                TraceWriter.WriteTrace("Could not obtain GAC assembly enumerator, " + e.Message);
                iterator = null;
            }

            if (iterator == null)
            {
                return(false);
            }
            IAssemblyName          currentName = null;
            List <GACAssemblyName> gacNames    = new List <GACAssemblyName>();

            while (GAC.GetNextAssembly(iterator, out currentName) == 0)
            {
                if (currentName == null)
                {
                    continue;
                }
                string displayName = GAC.GetDisplayName(currentName, ASM_DISPLAY_FLAGS.PUBLIC_KEY_TOKEN | ASM_DISPLAY_FLAGS.VERSION | ASM_DISPLAY_FLAGS.CULTURE);
                gacNames.Add(new GACAssemblyName(displayName));
            }

            _gacNameCache = gacNames.ToArray();
            return(true);
        }