本文整理汇总了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();
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
}
示例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();
}
示例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;
}