当前位置: 首页>>代码示例>>C#>>正文


C# IAssemblyName.GetDisplayName方法代码示例

本文整理汇总了C#中IAssemblyName.GetDisplayName方法的典型用法代码示例。如果您正苦于以下问题:C# IAssemblyName.GetDisplayName方法的具体用法?C# IAssemblyName.GetDisplayName怎么用?C# IAssemblyName.GetDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAssemblyName的用法示例。


在下文中一共展示了IAssemblyName.GetDisplayName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFullName

        private String GetFullName(IAssemblyName fusionAsmName)
        {
            StringBuilder sDisplayName = new StringBuilder(1024);
            int iLen = 1024;

            int hr = fusionAsmName.GetDisplayName(sDisplayName, ref iLen, (int)AssemblyNameDisplayFlags.ALL);
            if (hr < 0) {
                Marshal.ThrowExceptionForHR(hr);
            }

            return sDisplayName.ToString();
        }
开发者ID:Just-The-Tip,项目名称:T4Sandbox,代码行数:12,代码来源:AssemblyCacheEnum.cs

示例2: GetDisplayName

        private static string GetDisplayName(IAssemblyName native)
        {
            int bufferSize = 1024;
            StringBuilder buffer = new StringBuilder(bufferSize);

            AssemblyDisplayFlags dwDisplayFlags = AssemblyDisplayFlags.ProcessorArchitecture |
                                                  AssemblyDisplayFlags.PublicKeyToken |
                                                  AssemblyDisplayFlags.LanguageId |
                                                  AssemblyDisplayFlags.Culture |
                                                  AssemblyDisplayFlags.Version;

            if (NativeMethods.SUCCESS == native.GetDisplayName(buffer, ref bufferSize, dwDisplayFlags))
            {
                return buffer.ToString();
            }

            return null;
        }
开发者ID:razaraz,项目名称:Pscx,代码行数:18,代码来源:AssemblyNameConvertor.cs

示例3: AssemblyDescription

        /// <summary>
        /// Initializes a new instance of the <see cref="AssemblyDescription"/> class.
        /// </summary>
        /// <param name="assemblyName">Name of the assembly.</param>
        public AssemblyDescription(IAssemblyName assemblyName)
        {
            //  Get the qualified name.
            var stringBuilder = new StringBuilder(10000);
            var iLen = 10000;
            var hr = assemblyName.GetDisplayName(stringBuilder, ref iLen, ASM_DISPLAY_FLAGS.ASM_DISPLAYF_VERSION
                | ASM_DISPLAY_FLAGS.ASM_DISPLAYF_CULTURE
                | ASM_DISPLAY_FLAGS.ASM_DISPLAYF_PUBLIC_KEY_TOKEN
                | ASM_DISPLAY_FLAGS.ASM_DISPLAYF_PROCESSORARCHITECTURE);
            if (hr < 0)
                Marshal.ThrowExceptionForHR(hr);
            var displayName = stringBuilder.ToString();

            //  Load properties from the display name.
            LoadPropertiesFromDisplayName(displayName);

            //  We have the assembly name, so we can use the optimised version to load the fusion properties.
            lazyFusionProperties = new Lazy<AssemblyFusionProperties>(DoLoadFusionProperties);
            lazyReflectionProperties = new Lazy<AssemblyReflectionProperties>(DoLoadReflectionProperties);
        }
开发者ID:wangn6,项目名称:rep2,代码行数:24,代码来源:AssemblyDescription.cs

示例4: GetDisplayName

 /// <summary>
 ///     Gets the display name.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="which">The which.</param>
 /// <returns></returns>
 public static String GetDisplayName(IAssemblyName name, ASM_DISPLAY_FLAGS which)
 {
     uint bufferSize = 255;
     var buffer = new StringBuilder((int) bufferSize);
     name.GetDisplayName(buffer, ref bufferSize, which);
     return buffer.ToString();
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:13,代码来源:GAC.cs

示例5: GetDisplayName

        internal static unsafe string GetDisplayName(IAssemblyName nameObject, ASM_DISPLAYF displayFlags)
        {
            int hr;
            uint characterCountIncludingTerminator = 0;

            hr = nameObject.GetDisplayName(null, ref characterCountIncludingTerminator, displayFlags);
            if (hr == 0)
            {
                return String.Empty;
            }

            if (hr != ERROR_INSUFFICIENT_BUFFER)
            {
                throw Marshal.GetExceptionForHR(hr);
            }

            byte[] data = new byte[(int)characterCountIncludingTerminator * 2];
            fixed (byte* p = data)
            {
                hr = nameObject.GetDisplayName(p, ref characterCountIncludingTerminator, displayFlags);
                if (hr != 0)
                {
                    throw Marshal.GetExceptionForHR(hr);
                }

                return Marshal.PtrToStringUni((IntPtr)p, (int)characterCountIncludingTerminator - 1);
            }
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:28,代码来源:FusionAssemblyIdentity.cs

示例6: GetFullName

        private string GetFullName(IAssemblyName asmName)
        {
            StringBuilder fullName = new StringBuilder(1024);
            int iLen = fullName.Capacity;
            COM.CheckHR(asmName.GetDisplayName(fullName, ref iLen, (int) AssemblyNameDisplayFlags.ALL));

            return fullName.ToString();
        }
开发者ID:gordonc64,项目名称:CellAO-Archived-Obsolete,代码行数:8,代码来源:GACHelper.cs

示例7: GetDisplayName

        [System.Security.SecuritySafeCritical]  // auto-generated
        static unsafe String GetDisplayName(IAssemblyName aName, uint dwDisplayFlags)
        {
            uint iLen=0;            
            String sDisplayName = null;

            aName.GetDisplayName((IntPtr)0, ref iLen, dwDisplayFlags);
            if (iLen > 0) {
                IntPtr pDisplayName=(IntPtr)0;
               
                // Do some memory allocating here
                // We need to assume that a wide character is 2 bytes.
                byte[] data = new byte[((int)iLen+1)*2];
                fixed (byte *dataptr = data) {
                    pDisplayName = new IntPtr((void *) dataptr);
                    aName.GetDisplayName(pDisplayName, ref iLen, dwDisplayFlags);
                    sDisplayName = Marshal.PtrToStringUni(pDisplayName);                
                }
            }
            
            return sDisplayName;
        }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:22,代码来源:fusionwrap.cs


注:本文中的IAssemblyName.GetDisplayName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。