Example #1
0
        private Annotation ReadEncodedAnnotation(BinaryReader reader)
        {
            var typeIndex   = (int)reader.ReadULEB128();
            var elementSize = (int)reader.ReadULEB128();

            var annotation = new Annotation {
                Type = (ClassReference)Dex.TypeReferences[typeIndex]
            };

            for (var i = 0; i < elementSize; i++)
            {
                var argument  = new AnnotationArgument();
                var nameIndex = (int)reader.ReadULEB128();
                argument.Name  = Dex.Strings[nameIndex];
                argument.Value = ReadValue(reader);
                annotation.Arguments.Add(argument);
            }

            return(annotation);
        }
Example #2
0
        private static void addAnnotationDependencies(AnnotationArgument arg, Set <TypeInfo> dependencies)
        {
            switch (arg.AnnotationArgumentKind)
            {
            case Annotation:
                foreach (var s in arg.getArgumentNames())
                {
                    addAnnotationDependencies(arg.getArgument(s), dependencies);
                }
                break;

            case Array:
                foreach (var e in arg.getElements())
                {
                    addAnnotationDependencies(e, dependencies);
                }
                break;

            case Enum:
            case Type:
                addDependencies(arg.Type, dependencies);
                break;
            }
        }
Example #3
0
        private static void cloneAnnotationArgument(AnnotationArgument arg, Library targetTypeSystem,
                                                    AnnotationArrayValueBuilder builder, Scope <String, TypeInfo> genericArgs)
        {
            switch (arg.AnnotationArgumentKind)
            {
            case Annotation:
                cloneAnnotationValue((AnnotationValue)arg, targetTypeSystem,
                                     builder.addAnnotationArgument(arg.Type, arg.IsRuntimeVisible), genericArgs);
                break;

            case Array:
                var avb = builder.addArrayArgument();
                foreach (var aa in arg.Elements)
                {
                    cloneAnnotationArgument(aa, targetTypeSystem, avb, genericArgs);
                }
                break;

            case Boolean:
                builder.addBooleanArgument((Boolean)arg.Value);
                break;

            case Byte:
                builder.addByteArgument((Byte)arg.Value);
                break;

            case Char:
                builder.addCharArgument((Character)arg.Value);
                break;

            case Double:
                builder.addDoubleArgument((Double)arg.Value);
                break;

            case Enum:
                builder.addEnumArgument(arg.Type, arg.Name);
                break;

            case Float:
                builder.addFloatArgument((Float)arg.Value);
                break;

            case Int:
                builder.addIntArgument((Integer)arg.Value);
                break;

            case Long:
                builder.addLongArgument((Long)arg.Value);
                break;

            case Short:
                builder.addShortArgument((Short)arg.Value);
                break;

            case String:
                builder.addStringArgument((String)arg.Value);
                break;

            case Type:
                builder.addTypeArgument(arg.Type);
                break;
            }
        }
Example #4
0
 public virtual void Collect(AnnotationArgument argument)
 {
     Collect(argument.Name);
     Collect(argument.Value);
 }
Example #5
0
        private Annotation ReadEncodedAnnotation(BinaryReader reader)
        {
            var typeIndex = (int)reader.ReadULEB128();
            var elementSize = (int)reader.ReadULEB128();

            var annotation = new Annotation {Type = (ClassReference) Dex.TypeReferences[typeIndex]};

            for (var i = 0; i < elementSize; i++)
            {
                var argument = new AnnotationArgument();
                var nameIndex = (int)reader.ReadULEB128();
                argument.Name = Dex.Strings[nameIndex];
                argument.Value = ReadValue(reader);
                annotation.Arguments.Add(argument);
            }

            return annotation;
        }
Example #6
0
        private Annotation ReadEncodedAnnotation(BinaryReader reader)
        {
            var typeIndex = (int) reader.ReadULEB128();
            var elementSize = (int) reader.ReadULEB128();

            var annotation = new Annotation();
            annotation.Type = (ClassReference) typeReferences[typeIndex];

            for (int i = 0; i < elementSize; i++)
            {
                var nameIndex = (int) reader.ReadULEB128();
                var name = strings[nameIndex];
                var value = ReadValue(reader);
                var argument = new AnnotationArgument(name, value);
                annotation.Arguments.Add(argument);
            }

            return annotation;
        }