本文整理汇总了C#中CustomAttributeBuilder.DecodeBlob方法的典型用法代码示例。如果您正苦于以下问题:C# CustomAttributeBuilder.DecodeBlob方法的具体用法?C# CustomAttributeBuilder.DecodeBlob怎么用?C# CustomAttributeBuilder.DecodeBlob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomAttributeBuilder
的用法示例。
在下文中一共展示了CustomAttributeBuilder.DecodeBlob方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetAttribute
internal void SetAttribute(AssemblyBuilder asm, CustomAttributeBuilder cab)
{
Universe u = cab.Constructor.Module.universe;
Type type = cab.Constructor.DeclaringType;
if (copyright == null && type == u.System_Reflection_AssemblyCopyrightAttribute)
{
copyright = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
}
else if (trademark == null && type == u.System_Reflection_AssemblyTrademarkAttribute)
{
trademark = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
}
else if (product == null && type == u.System_Reflection_AssemblyProductAttribute)
{
product = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
}
else if (company == null && type == u.System_Reflection_AssemblyCompanyAttribute)
{
company = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
}
else if (description == null && type == u.System_Reflection_AssemblyDescriptionAttribute)
{
description = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
}
else if (title == null && type == u.System_Reflection_AssemblyTitleAttribute)
{
title = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
}
else if (informationalVersion == null && type == u.System_Reflection_AssemblyInformationalVersionAttribute)
{
informationalVersion = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
}
else if (fileVersion == null && type == u.System_Reflection_AssemblyFileVersionAttribute)
{
fileVersion = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
}
}
示例2: SetMarshalAsAttribute
internal static void SetMarshalAsAttribute(ModuleBuilder module, int token, CustomAttributeBuilder attribute)
{
attribute = attribute.DecodeBlob(module.Assembly);
FieldMarshalTable.Record rec = new FieldMarshalTable.Record();
rec.Parent = token;
rec.NativeType = WriteMarshallingDescriptor(module, attribute);
module.FieldMarshal.AddRecord(rec);
}
示例3: SetCustomAttribute
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
Universe u = this.Module.universe;
if (customBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_FieldOffsetAttribute)
{
customBuilder = customBuilder.DecodeBlob(this.Module.Assembly);
SetOffset((int)customBuilder.GetConstructorArgument(0));
}
else if (customBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_MarshalAsAttribute)
{
MarshalSpec.SetMarshalAsAttribute(typeBuilder.ModuleBuilder, pseudoToken, customBuilder);
attribs |= FieldAttributes.HasFieldMarshal;
}
else if (customBuilder.Constructor.DeclaringType == u.System_NonSerializedAttribute)
{
attribs |= FieldAttributes.NotSerialized;
}
else if (customBuilder.Constructor.DeclaringType == u.System_Runtime_CompilerServices_SpecialNameAttribute)
{
attribs |= FieldAttributes.SpecialName;
}
else
{
typeBuilder.ModuleBuilder.SetCustomAttribute(pseudoToken, customBuilder);
}
}
示例4: SetCustomAttribute
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
switch (customBuilder.KnownCA)
{
case KnownCA.FieldOffsetAttribute:
SetOffset((int)customBuilder.DecodeBlob(this.Module.Assembly).GetConstructorArgument(0));
break;
case KnownCA.MarshalAsAttribute:
FieldMarshal.SetMarshalAsAttribute(typeBuilder.ModuleBuilder, pseudoToken, customBuilder);
attribs |= FieldAttributes.HasFieldMarshal;
break;
case KnownCA.NonSerializedAttribute:
attribs |= FieldAttributes.NotSerialized;
break;
case KnownCA.SpecialNameAttribute:
attribs |= FieldAttributes.SpecialName;
break;
default:
typeBuilder.ModuleBuilder.SetCustomAttribute(pseudoToken, customBuilder);
break;
}
}
示例5: SetCustomAttribute
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
switch (customBuilder.KnownCA)
{
case KnownCA.DllImportAttribute:
SetDllImportPseudoCustomAttribute(customBuilder.DecodeBlob(this.Module.Assembly));
attributes |= MethodAttributes.PinvokeImpl;
break;
case KnownCA.MethodImplAttribute:
SetMethodImplAttribute(customBuilder.DecodeBlob(this.Module.Assembly));
break;
case KnownCA.PreserveSigAttribute:
implFlags |= MethodImplAttributes.PreserveSig;
break;
case KnownCA.SpecialNameAttribute:
attributes |= MethodAttributes.SpecialName;
break;
case KnownCA.SuppressUnmanagedCodeSecurityAttribute:
attributes |= MethodAttributes.HasSecurity;
goto default;
default:
this.ModuleBuilder.SetCustomAttribute(pseudoToken, customBuilder);
break;
}
}
示例6: SetCustomAttribute
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
switch (customBuilder.KnownCA)
{
case KnownCA.StructLayoutAttribute:
SetStructLayoutPseudoCustomAttribute(customBuilder.DecodeBlob(this.Assembly));
break;
case KnownCA.SerializableAttribute:
attribs |= TypeAttributes.Serializable;
break;
case KnownCA.ComImportAttribute:
attribs |= TypeAttributes.Import;
break;
case KnownCA.SpecialNameAttribute:
attribs |= TypeAttributes.SpecialName;
break;
case KnownCA.SuppressUnmanagedCodeSecurityAttribute:
attribs |= TypeAttributes.HasSecurity;
goto default;
default:
this.ModuleBuilder.SetCustomAttribute(token, customBuilder);
break;
}
}