void ReadSecurityBlob(BlobReader reader, IAttribute[] attributes, ITypeResolveContext context, ResolveResult securityActionRR)
        {
            for (int i = 0; i < attributes.Length; i++)
            {
                string         attributeTypeName = reader.ReadSerString();
                ITypeReference attributeTypeRef  = ReflectionHelper.ParseReflectionName(attributeTypeName);
                IType          attributeType     = attributeTypeRef.Resolve(context);

                reader.ReadCompressedUInt32();                 // ??
                // The specification seems to be incorrect here, so I'm using the logic from Cecil instead.
                uint numNamed = reader.ReadCompressedUInt32();

                var namedArgs = new List <KeyValuePair <IMember, ResolveResult> >((int)numNamed);
                for (uint j = 0; j < numNamed; j++)
                {
                    var namedArg = reader.ReadNamedArg(attributeType);
                    if (namedArg.Key != null)
                    {
                        namedArgs.Add(namedArg);
                    }
                }
                attributes[i] = new DefaultAttribute(
                    attributeType,
                    positionalArguments: new ResolveResult[] { securityActionRR },
                    namedArguments: namedArgs);
            }
        }
Example #2
0
            void ReadSecurityBlob(BlobReader reader, IAttribute[] attributes, ITypeResolveContext context, ResolveResult securityActionRR)
            {
                for (int i = 0; i < attributes.Length; i++) {
                    string attributeTypeName = reader.ReadSerString();
                    ITypeReference attributeTypeRef = ReflectionHelper.ParseReflectionName(attributeTypeName);
                    IType attributeType = attributeTypeRef.Resolve(context);

                    reader.ReadCompressedUInt32(); // ??
                    // The specification seems to be incorrect here, so I'm using the logic from Cecil instead.
                    uint numNamed = reader.ReadCompressedUInt32();

                    var namedArgs = new List<KeyValuePair<IMember, ResolveResult>>((int)numNamed);
                    for (uint j = 0; j < numNamed; j++) {
                        var namedArg = reader.ReadNamedArg(attributeType);
                        if (namedArg.Key != null)
                            namedArgs.Add(namedArg);

                    }
                    attributes[i] = new DefaultAttribute(
                        attributeType,
                        positionalArguments: new ResolveResult[] { securityActionRR },
                    namedArguments: namedArgs);
                }
            }