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


C# IAssemblyName.GetProperty方法代码示例

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


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

示例1: GetStringProperty

 internal string GetStringProperty(IAssemblyName name, ASM_NAME propertyName)
 {
     uint bufferSize = BufferLength;
     IntPtr buffer = Marshal.AllocHGlobal((int)bufferSize);
     name.GetProperty(propertyName, buffer, ref bufferSize);
     var stringVaule = Marshal.PtrToStringUni(buffer, (int)bufferSize);
     Marshal.FreeHGlobal(buffer);
     return stringVaule;
 }
开发者ID:wangn6,项目名称:rep2,代码行数:9,代码来源:AssemblyFusionProperties.cs

示例2: GetDwordProperty

 internal UInt32 GetDwordProperty(IAssemblyName name, ASM_NAME propertyName)
 {
     uint bufferSize = 512;
     IntPtr buffer = Marshal.AllocHGlobal((int)bufferSize);
     name.GetProperty(propertyName, buffer, ref bufferSize);
     byte a = Marshal.ReadByte(buffer);
     byte b = Marshal.ReadByte(buffer, 1);
     byte c = Marshal.ReadByte(buffer);
     byte d = Marshal.ReadByte(buffer, 1);
     Marshal.FreeHGlobal(buffer);
     return (UInt32)(a + (b << 8) + (c << 16) + (d << 24));
 }
开发者ID:wangn6,项目名称:rep2,代码行数:12,代码来源:AssemblyFusionProperties.cs

示例3: GetShortProperty

 internal UInt16 GetShortProperty(IAssemblyName name, ASM_NAME propertyName)
 {
     uint bufferSize = 512;
     IntPtr buffer = Marshal.AllocHGlobal((int)bufferSize);
     name.GetProperty(propertyName, buffer, ref bufferSize);
     byte low = Marshal.ReadByte(buffer);
     byte high = Marshal.ReadByte(buffer, 1);
     Marshal.FreeHGlobal(buffer);
     return (UInt16)(low + (high << 8));
 }
开发者ID:wangn6,项目名称:rep2,代码行数:10,代码来源:AssemblyFusionProperties.cs

示例4: GetCulture

        /// <summary>
        ///     Gets the culture.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public static CultureInfo GetCulture(IAssemblyName name)
        {
            uint bufferSize = 255;
            IntPtr buffer = Marshal.AllocHGlobal((int) bufferSize);
            name.GetProperty(ASM_NAME.ASM_NAME_CULTURE, buffer, ref bufferSize);
            string result = Marshal.PtrToStringAuto(buffer);
            Marshal.FreeHGlobal(buffer);
            if (result != null)
            {
                return new CultureInfo(result);
            }

            return null;
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:19,代码来源:GAC.cs

示例5: GetByteArrayProperty

 internal byte[] GetByteArrayProperty(IAssemblyName name, ASM_NAME propertyName)
 {
     uint bufferSize = 512;
     IntPtr buffer = Marshal.AllocHGlobal((int)bufferSize);
     name.GetProperty(propertyName, buffer, ref bufferSize);
     byte[] result = new byte[bufferSize];
     for (int i = 0; i < bufferSize; i++)
         result[i] = Marshal.ReadByte(buffer, i);
     Marshal.FreeHGlobal(buffer);
     return result;
 }
开发者ID:wangn6,项目名称:rep2,代码行数:11,代码来源:AssemblyFusionProperties.cs

示例6: GetPublicKey

 /// <summary>
 ///     Gets the public key.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <returns></returns>
 public static byte[] GetPublicKey(IAssemblyName name)
 {
     uint bufferSize = 512;
     IntPtr buffer = Marshal.AllocHGlobal((int) bufferSize);
     name.GetProperty(ASM_NAME.ASM_NAME_PUBLIC_KEY, buffer, ref bufferSize);
     var result = new byte[bufferSize];
     for (int i = 0; i < bufferSize; i++)
         result[i] = Marshal.ReadByte(buffer, i);
     Marshal.FreeHGlobal(buffer);
     return result;
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:16,代码来源:GAC.cs

示例7: GetPublicKeyToken

 /// <summary>
 ///     Gets the public key token.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <returns></returns>
 public static byte[] GetPublicKeyToken(IAssemblyName name)
 {
     var result = new byte[8];
     uint bufferSize = 8;
     IntPtr buffer = Marshal.AllocHGlobal((int) bufferSize);
     name.GetProperty(ASM_NAME.ASM_NAME_PUBLIC_KEY_TOKEN, buffer, ref bufferSize);
     for (int i = 0; i < 8; i++)
         result[i] = Marshal.ReadByte(buffer, i);
     Marshal.FreeHGlobal(buffer);
     return result;
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:16,代码来源:GAC.cs

示例8: GetPropertyWord

        internal static unsafe uint? GetPropertyWord(IAssemblyName nameObject, PropertyId propertyId)
        {
            uint result;
            uint size = sizeof(uint);
            int hr = nameObject.GetProperty(propertyId, &result, ref size);
            if (hr != 0)
            {
                throw Marshal.GetExceptionForHR(hr);
            }

            if (size == 0)
            {
                return null;
            }

            return result;
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:17,代码来源:FusionAssemblyIdentity.cs

示例9: IsKeyOrTokenEmpty

 internal static unsafe bool IsKeyOrTokenEmpty(IAssemblyName nameObject, PropertyId propertyId)
 {
     Debug.Assert(propertyId == PropertyId.NULL_PUBLIC_KEY_TOKEN || propertyId == PropertyId.NULL_PUBLIC_KEY);
     uint size = 0;
     int hr = nameObject.GetProperty(propertyId, null, ref size);
     return hr == 0;
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:7,代码来源:FusionAssemblyIdentity.cs

示例10: GetPropertyBytes

        internal static unsafe byte[] GetPropertyBytes(IAssemblyName nameObject, PropertyId propertyId)
        {
            int hr;
            uint size = 0;

            hr = nameObject.GetProperty(propertyId, null, ref size);
            if (hr == 0)
            {
                return null;
            }

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

            byte[] data = new byte[(int)size];
            fixed (byte* p = data)
            {
                hr = nameObject.GetProperty(propertyId, p, ref size);
                if (hr != 0)
                {
                    throw Marshal.GetExceptionForHR(hr);
                }
            }

            return data;
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:28,代码来源:FusionAssemblyIdentity.cs


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