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


C# CustomAttribute.GetBlob方法代码示例

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


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

示例1: WriteCustomAttribute

        private void WriteCustomAttribute(CustomAttribute custom)
        {
            custom.Resolve();
            WriteDot();
            WriteKeyword("custom");
            WriteSpace();
            WriteMethodReference(custom.Constructor, true);
            WriteSpace();
            Write("=");
            WriteLine();
            if (custom.HasConstructorArguments || custom.HasProperties || custom.HasFields)
            {
                WriteOpenBreckets();
                WriteLine();
                Indent();
                if (custom.HasConstructorArguments)
                {
                    WriteCustomAttributeConstructorArguments(custom.ConstructorArguments);
                }
                if (custom.HasProperties)
                {
                    WriteCustomAttributeProperties(custom);
                }
                if (custom.HasFields)
                {
                    WriteCustomAttributeFields(custom);
                }
                Outdent();
                WriteEndBreckets();
            }

            else
            {
                Byte[] blob = custom.GetBlob();
                Write("(");
                WriteLine();
                Indent();
                WriteByteArray(blob);
                WriteLine();
                Outdent();
                Write(")");
                WriteLine();
            }
        }
开发者ID:juancarlosbaezpozos,项目名称:JustDecompileEngine,代码行数:44,代码来源:IntermediateLanguageAttributeWriter.cs

示例2: Copy

        /*
         * COPIES
         */
        private CustomAttribute Copy(DeepCopier copier, CustomAttribute def)
        {
            var ret = new CustomAttribute(CopyReference(copier,def.Constructor),def.GetBlob());

            copier.Log("< CopyAttributes ");
            copier.CopyAll(def,ret,ret,"DeclaringType");

            return ret;
        }
开发者ID:tritao,项目名称:flood,代码行数:12,代码来源:TypeWeaver.cs

示例3: Clone

 private CustomAttribute Clone(CustomAttribute sourceAttribute)
 {
     return new CustomAttribute(Import(sourceAttribute.Constructor), sourceAttribute.GetBlob());
 }
开发者ID:Pomona,项目名称:Pomona,代码行数:4,代码来源:TypeDefinitionCloner.cs

示例4: WriteAttributeSignature

        private bool WriteAttributeSignature(CustomAttribute attribute, bool resolvingProblem)
        {
            //Removing the "Attribute" suffix if present
            string attributeName = attribute.AttributeType.Name.EndsWith("Attribute") ? attribute.AttributeType.Name.Remove(attribute.AttributeType.Name.LastIndexOf("Attribute")) : attribute.AttributeType.Name;

			if (genericWriter.Language.IsGlobalKeyword(attributeName))
			{
				// Return the "Attribute" suffix, if removing it makes the name match a global keyword.
				attributeName = attribute.AttributeType.Name;
			}

			genericWriter.WriteNamespaceIfTypeInCollision(attribute.AttributeType);
            genericWriter.WriteReference(attributeName, attribute.AttributeType);

            if (attribute.HasConstructorArguments || attribute.HasFields || attribute.HasProperties)
            {
                genericWriter.WriteToken("(");

                bool wroteArgument = false;

                for (int argIndex = 0; argIndex < attribute.ConstructorArguments.Count; argIndex++)
                {
                    wroteArgument = true;

                    WriteAttributeArgumentValue(attribute.ConstructorArguments[argIndex]);

                    if (argIndex + 1 < attribute.ConstructorArguments.Count)
                    {
                        genericWriter.Write(",");
                        genericWriter.WriteSpace();
                    }
                }

                if (attribute.HasProperties)
                {
                    TypeDefinition attributeType = attribute.AttributeType.Resolve();
                    wroteArgument = WriteAttributeNamedArgs(attributeType, attribute.Properties, false, wroteArgument);
                }
                if (attribute.HasFields)
                {
                    TypeDefinition attributeType = attribute.AttributeType.Resolve();
                    WriteAttributeNamedArgs(attributeType, attribute.Fields, true, wroteArgument);
                }

                genericWriter.WriteToken(")");
            }
            else if (attribute.IsResolved == false && attribute.GetBlob().Length > 4)
            {
                genericWriter.WriteToken("(");
                genericWriter.Write(",");
                genericWriter.WriteToken(")");
                resolvingProblem = true;
            }
            return resolvingProblem;
        }
开发者ID:juancarlosbaezpozos,项目名称:JustDecompileEngine,代码行数:55,代码来源:AttributeWriter.cs


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