GetProperties() public method

public GetProperties ( ) : Mono.Debugger.Soft.PropertyInfoMirror[]
return Mono.Debugger.Soft.PropertyInfoMirror[]
Exemplo n.º 1
0
        internal static CustomAttributeDataMirror[] Create(VirtualMachine vm, CattrInfo[] info)
        {
            var res = new CustomAttributeDataMirror [info.Length];

            for (int i = 0; i < info.Length; ++i)
            {
                CattrInfo    attr      = info [i];
                MethodMirror ctor      = vm.GetMethod(attr.ctor_id);
                var          ctor_args = new object [attr.ctor_args.Length];
                for (int j = 0; j < ctor_args.Length; ++j)
                {
                    ctor_args [j] = CreateArg(vm, attr.ctor_args [j]);
                }
                var named_args = new List <object> (attr.named_args.Length);
                for (int j = 0; j < attr.named_args.Length; ++j)
                {
                    CattrNamedArgInfo arg = attr.named_args [j];
                    CustomAttributeTypedArgumentMirror val;
                    CustomAttributeNamedArgumentMirror?named_arg = null;

                    val = CreateArg(vm, arg.value);

                    TypeMirror t = ctor.DeclaringType;
                    while (named_arg == null && t != null)
                    {
                        if (arg.is_property)
                        {
                            foreach (var prop in t.GetProperties())
                            {
                                if (prop.Id == arg.id)
                                {
                                    named_arg = new CustomAttributeNamedArgumentMirror(prop, null, val);
                                }
                            }
                        }
                        else if (vm.Version.AtLeast(2, 12))                              // we don't have the field ID before 2.12
                        {
                            foreach (var field in t.GetFields())
                            {
                                if (field.Id == arg.id)
                                {
                                    named_arg = new CustomAttributeNamedArgumentMirror(null, field, val);
                                }
                            }
                        }
                        t = t.BaseType;
                    }

                    if (named_arg.HasValue)
                    {
                        named_args.Add(named_arg.Value);
                    }
                }
                res [i] = new CustomAttributeDataMirror(ctor, ctor_args, named_args.ToArray());
            }

            return(res);
        }
Exemplo n.º 2
0
        internal static CustomAttributeDataMirror[] Create(VirtualMachine vm, CattrInfo[] info)
        {
            var res = new CustomAttributeDataMirror [info.Length];

            for (int i = 0; i < info.Length; ++i)
            {
                CattrInfo    attr      = info [i];
                MethodMirror ctor      = vm.GetMethod(attr.ctor_id);
                var          ctor_args = new object [attr.ctor_args.Length];
                for (int j = 0; j < ctor_args.Length; ++j)
                {
                    ctor_args [j] = CreateArg(vm, attr.ctor_args [j]);
                }
                var named_args = new object [attr.named_args.Length];
                for (int j = 0; j < named_args.Length; ++j)
                {
                    CattrNamedArgInfo arg = attr.named_args [j];
                    CustomAttributeTypedArgumentMirror val;

                    val = CreateArg(vm, arg.value);

                    TypeMirror t = ctor.DeclaringType;
                    while (named_args [j] == null && t != null)
                    {
                        if (arg.is_property)
                        {
                            foreach (var prop in t.GetProperties())
                            {
                                if (prop.Id == arg.id)
                                {
                                    named_args [j] = new CustomAttributeNamedArgumentMirror(prop, null, val);
                                }
                            }
                        }
                        else
                        {
                            foreach (var field in t.GetFields())
                            {
                                if (field.Id == arg.id)
                                {
                                    named_args [j] = new CustomAttributeNamedArgumentMirror(null, field, val);
                                }
                            }
                        }
                        t = t.BaseType;
                    }
                    if (named_args [j] == null)
                    {
                        throw new NotImplementedException();
                    }
                }
                res [i] = new CustomAttributeDataMirror(ctor, ctor_args, named_args);
            }

            return(res);
        }
Exemplo n.º 3
0
 public ExpandedProperty(TypeMirror typeMirror, StackFrame frame, LocalVariable localVariable)
 {
     this.frame = frame;
     this.localVariable = localVariable;
     var properties = typeMirror.GetProperties().Cast<Mirror>();
     var methods = typeMirror.GetMethods().Cast<Mirror>();
     var fields = typeMirror.GetFields().Cast<Mirror>();
     var children = properties.Concat(methods).Concat(fields);
     allProperties = children.ToList();
 }