GetBlob() public method

public GetBlob ( ) : byte[]
return byte[]
        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();
            }
        }
Esempio n. 2
0
        /*
         * 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;
        }
Esempio n. 3
0
 private CustomAttribute Clone(CustomAttribute sourceAttribute)
 {
     return new CustomAttribute(Import(sourceAttribute.Constructor), sourceAttribute.GetBlob());
 }
        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;
        }