public VObject(VType type) { this.type = type; this.genericArgs = null; fields = new object[type.GetFields().Length]; }
public Type _Resolve(TypeReference typeRef) { if (typeRef is GenericInstanceType g && g.HasGenericArguments) { var typeDef = Resolve(g.ElementType); var c = g.GenericArguments.Select(x => Resolve(x)).ToArray(); return(typeDef.MakeGenericType(c)); } if (typeRef.IsArray) { return(Resolve(typeRef.GetElementType()) .MakeArrayType()); } VType vtype = null; if (vtypes.TryGetValue(typeRef.FullName, out vtype)) { return(vtype); } var asm = assemblyResolver.GetAssembly(typeRef.Module.Assembly); var type = asm.GetType(typeRef.FullName); if (type == null) { type = typeof(int).Assembly.GetType(typeRef.FullName); } if (type == null) { type = typeof(System.Linq.Enumerable).Assembly.GetType(typeRef.FullName); } if (type == null) { type = typeof(System.Net.Sockets.Socket).Assembly.GetType(typeRef.FullName); } if (type == null) { throw new InvalidOperationException("Type not resolved"); } return(type); }
public VPropertyInfo(VM vm, PropertyDefinition property, VType declaringType) { this.vm = vm; this.property = property; _Name = property.Name; _DeclaringType = declaringType; _CanRead = property.GetMethod != null; _CanWrite = property.SetMethod != null; if (_CanRead) { getMethod = declaringType.GetMethod(property.GetMethod.Name); } if (_CanWrite) { setMethod = declaringType.GetMethod(property.SetMethod.Name); } BuildAttributes(); }
public void AddType(VType type) { vtypes[type.FullName] = type; }