Example #1
0
        public Module Module;                // ex RunCode_00002.dll

        public TypeValueInfo(Type sourceType, MemberInfo memberInfo)
        {
            SourceType = sourceType;
            Name = memberInfo.Name;
            TreeName = memberInfo.Name;
            ParentName = null;

            Type valueType = memberInfo.zGetValueType();
            Type enumerableType = null;
            if (valueType != typeof(string))
                enumerableType = zReflection.GetEnumerableType(valueType);
            if (enumerableType != null)
            {
                ValueType = enumerableType;
                IsEnumerable = true;
            }
            else
            {
                ValueType = valueType;
                IsEnumerable = false;
            }

            IsValueType = TypeReflection.IsValueType(ValueType);
            DeclaringType = memberInfo.DeclaringType;
            ReflectedType = memberInfo.ReflectedType;
            MemberTypes = memberInfo.MemberType;
            MetadataToken = memberInfo.MetadataToken;
            Module = memberInfo.Module;
        }
Example #2
0
        public WiredToAttribute(MemberTypes memberType, string name, Type typeWiredTo)
        {
            WiredMemberType = memberType;
            WiredMemberName = name;

            TypeWiredTo = typeWiredTo;
        }
Example #3
0
 public MapCallInfo(Type targetType, Type[] genericTypes, Flags bindingFlags, MemberTypes memberTypes, string name, Type[] parameterTypes, MemberInfo memberInfo, bool isReadOperation, Type sourceType, MemberTypes sourceMemberTypes, MemberTypes targetMemberTypes, string[] names) : base(targetType, genericTypes, bindingFlags, memberTypes, name, parameterTypes, memberInfo, isReadOperation)
 {
     SourceType = sourceType;
     SourceMemberTypes = sourceMemberTypes;
     TargetMemberTypes = targetMemberTypes;
     Names = names;
 }
Example #4
0
        public ThinMember(ThinType declaringType, string memberName, string returnType, MemberTypes memberType,
                          IncludeStatus includeStatus, ITypeDefinitionMember memberNode, VisibilityOverride visibility)

            : this(declaringType, memberName, returnType, memberType,
                   includeStatus, memberNode, visibility, SecurityTransparencyStatus.Transparent)
        {
        }
Example #5
0
 public PermissionMember (MemberTypes member_type, BaseTypeRef type_ref, string name, object value)
 {
         this.member_type = member_type;
         this.type_ref = type_ref;
         this.name = name;
         this.value = value;
 }
Example #6
0
        public WiredToAttribute(MemberTypes memberType, string name, string qualifiedTypeNameWiredTo)
        {
            WiredMemberType = memberType;
            WiredMemberName = name;

            TypeWiredTo = Type.GetType(qualifiedTypeNameWiredTo, true, false);
        }
	// Constructor.
	public MemberInfoSerializationHolder(SerializationInfo info,
									StreamingContext context)
			{
				if(info == null)
				{
					throw new ArgumentNullException("info");
				}
				memberType = (MemberTypes)(info.GetInt32("MemberType"));
				name = info.GetString("Name");
				signature = info.GetString("Signature");
				String assemblyName = info.GetString("AssemblyName");
				String className = info.GetString("ClassName");
				if(assemblyName == null || className == null)
				{
					throw new SerializationException
						(_("Serialize_StateMissing"));
				}
				Assembly assembly = FormatterServices.GetAssemblyByName
					(assemblyName);
				if(assembly == null)
				{
					throw new SerializationException
						(_("Serialize_StateMissing"));
				}
				containingType = FormatterServices.GetTypeFromAssembly
					(assembly, className);
			}
Example #8
0
 public void SetMainMember(IField field)
 {
     this.Member = field;
     this.MemberType = MemberTypes.Field;
     this.SubMemberType = this.MemberType;
     this.SubMember = this.Member;
 }
		MemberInfoSerializationHolder(SerializationInfo info, StreamingContext ctx)
		{
			string assemblyName;
			string typeName;

			assemblyName = info.GetString("AssemblyName");
			typeName = info.GetString("ClassName");

			_memberName = info.GetString("Name");
			_memberSignature = info.GetString("Signature");
			_memberType = (MemberTypes) info.GetInt32("MemberType");

#if NET_2_0
			try {
				_genericArguments = null;

				// FIXME: this doesn't work at present. It seems that
				// ObjectManager doesn't cope with nested IObjectReferences.
				// _genericArguments = (Type[]) info.GetValue("GenericArguments", typeof(Type[]));
			} catch (SerializationException) {
				// expected (old NET_1_0 protocol)
			}
#endif
			// Load type
			Assembly asm = Assembly.Load(assemblyName);

			_reflectedType = asm.GetType(typeName, true, true);
		}
        private void GetSerializationInfo(SerializationInfo info, string name, Type reflectedClass, string signature, MemberTypes type, Type[] genericArguments)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }

            AssemblyName asmname = reflectedClass.Assembly.GetName();

            asmname.Version = new Version(_version, 0, 0, 0);

            string fullName = asmname.ToString();
                               
            string str2 = reflectedClass.FullName;
            Type t = typeof(int).Assembly.GetType("System.Reflection.MemberInfoSerializationHolder");

            info.SetType(t);

            for (int i = 0; i < genericArguments.Length; ++i)
            {
                genericArguments[i] = new FakeType(genericArguments[i], _version);
            }

            // This is here to prevent a de-serialization bug
            if (genericArguments.Length > 0)
            {
                info.AddValue("DUMMY", genericArguments[0]);
            }
            info.AddValue("GenericArguments", genericArguments, typeof(Type[]));
            info.AddValue("Name", name, typeof(string));
            info.AddValue("AssemblyName", fullName, typeof(string));
            info.AddValue("ClassName", str2, typeof(string));
            info.AddValue("Signature", signature, typeof(string));
            info.AddValue("MemberType", (int)type);
        }
 public NodeInfo(Type type, string name, MemberTypes mtype, ParameterInfo[] parameters)
 {
     this.NodeType = type;
     this.Name = name;
     this.MemberType = mtype;
     this.Parameters = parameters;
 }
        public static void GetSerializationInfo(
            SerializationInfo info,
            String name,
            RuntimeType reflectedClass,
            String signature,
            String signature2,
            MemberTypes type,
            Type[] genericArguments)
        {
            if (info == null)
                throw new ArgumentNullException(nameof(info));
            Contract.EndContractBlock();

            String assemblyName = reflectedClass.Module.Assembly.FullName;
            String typeName = reflectedClass.FullName;

            info.SetType(typeof(MemberInfoSerializationHolder));
            info.AddValue("Name", name, typeof(String));
            info.AddValue("AssemblyName", assemblyName, typeof(String));
            info.AddValue("ClassName", typeName, typeof(String));
            info.AddValue("Signature", signature, typeof(String));
            info.AddValue("Signature2", signature2, typeof(String));
            info.AddValue("MemberType", (int)type);
            info.AddValue("GenericArguments", genericArguments, typeof(Type[]));
        }
Example #13
0
	protected override Expression Error_MemberLookupFailed (Type container_type, Type qualifier_type,
		Type queried_type, string name, string class_name, MemberTypes mt, BindingFlags bf)
	{
		Report.Error (1935, loc, "An implementation of `{0}' query expression pattern could not be found. " +
			"Are you missing `System.Linq' using directive or `System.Core.dll' assembly reference?",
			name);
		return null;
	}
 private static MemberInfo FindMember(Type t, string name, MemberTypes types)
 {
     return t
         .FindMembers(types, BindingFlags.Instance | BindingFlags.Public, Type.FilterNameIgnoreCase, name)
         .OrderByDescending(x => x.Name == name)
         .ThenByDescending(x => x.MemberType == MemberTypes.Property)
         .FirstOrDefault();
 }
Example #15
0
 internal JSPredefinedField(string name, MemberTypes memberType, GlobalObjectInstance globalObject)
     : base(name, 0, null)
 {
     m_memberType = memberType;
     m_globalObject = globalObject;
     // predefined fields cannot be crunched
     CanCrunch = false;
 }
Example #16
0
 protected AbstractEmitter(Type targetType, BindingFlags bindingFlags, MemberTypes memberTypes, Type[] parameterTypes, MemberInfo memberInfo)
 {
     _targetType = targetType;
     _bindingFlags = bindingFlags;
     _memberTypes = memberTypes;
     _parameterTypes = parameterTypes;
     _memberInfo = memberInfo;
 }
Example #17
0
        private object InvokeStaticMember(object[] arguments, MemberTypes memberTypes, string memberName = null)
        {
            var clazz = this.Class;

            var candidates = new List<MethodBase>();

            if ((memberTypes & MemberTypes.Constructor) != 0) {
                candidates.AddRange(clazz.GetConstructors(BindingFlags.Public | BindingFlags.Instance));
            }
            if ((memberTypes & MemberTypes.Method) != 0) {
                candidates.AddRange(
                    clazz.GetMethods(BindingFlags.Static | BindingFlags.Public)
                    .Where(mi => mi.Name == memberName));
            }
            if ((memberTypes & MemberTypes.Property) != 0) {
                candidates.AddRange(
                    clazz.GetProperties(BindingFlags.Static | BindingFlags.Public)
                    .Where(pi => pi.Name == memberName)
                    .SelectMany(pi => new MethodInfo[] { pi.GetGetMethod(), pi.GetSetMethod() })
                    .Where(mi => mi != null));
            }

            candidates = candidates.FindAll(mi => mi.GetParameters().Length == arguments.Length);

            foreach (var mi in candidates) {
                var pis = mi.GetParameters();
                bool accepted = true;
                for(int i = 0; i < pis.Length; i++) {
                    var pi = pis[i];
                    var arg = arguments[i];
                    if (!pi.ParameterType.IsAssignableFrom(arg.GetType())) {
                        accepted = false;
                        break;
                    }
                }
                if (accepted) { // we found a good candidate
                    if (mi is ConstructorInfo)
                        return ((ConstructorInfo)mi).Invoke(arguments);
                    else
                        return mi.Invoke(null, arguments);
                }
            }

            // if we've reached this point but we still have a partially matching method,
            // just try to forcefully cast the args to what the method expects
            if (candidates.Count > 0) {
                var mi = candidates[0];
                var miParams = mi.GetParameters();
                var newArgs = (object[])arguments.Clone();
                for (int i = 0; i < arguments.Length; i++) {
                    newArgs[i] = Convert.ChangeType(arguments[i], miParams[i].ParameterType);
                }
                return mi.Invoke(null, newArgs);

            }

            throw new MissingMemberException(String.Format("Could not find a compatible member named '{0}' in class '{1}'", memberName, this.Class));
        }
 public MappingDefinition AddMappingFromDocumentWithHeaders(Document doc,MemberTypes memberType=MemberTypes.Property)
 {
     if(!doc.HaveHeader) throw new InvalidDataException("document does not have headers");
     foreach (var header in doc.Header)
     {
         AddFieldMapping(header, header, memberType);
     }
     return this;
 }
Example #19
0
        public LazyMemberInfo(MemberTypes memberType, Func<MemberInfo[]> accessorsCreator)
        {
            EnsureSupportedMemberType(memberType, "memberType");
            Requires.NotNull(accessorsCreator, "accessorsCreator");

            this._memberType = memberType;
            this._accessors = null;
            this._accessorsCreator = accessorsCreator;
        }
        public static void Test_SerializedMemberParser_Should_Find_No_Members(MemberTypes memberInfoType, Type typeToParse)
        {
            //arranges
            IEnumerable objects = new SerializedMemberParser().Parse(memberInfoType, typeToParse);

            //assert
            //It should be empty but non-null
            Assert.IsNotNull(objects);
            Assert.IsEmpty(objects);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NamedIdMemberConvention" /> class.
        /// </summary>
        /// <param name="names">The names.</param>
        /// <param name="memberTypes">The member types.</param>
        /// <param name="bindingFlags">The binding flags.</param>
        /// <exception cref="System.ArgumentNullException"></exception>
        public NamedIdMemberConvention(IEnumerable<string> names, MemberTypes memberTypes, BindingFlags bindingFlags)
        {
            if (names == null)
            {
                throw new ArgumentNullException("names");
            }

            _names = names;
            _memberTypes = memberTypes;
            _bindingFlags = bindingFlags | BindingFlags.DeclaredOnly;
        }
Example #22
0
 internal c00010e(c000068 p0, c00007f p1, Type p2, string p3, bool p4, bool p5, MemberTypes p6, bool p7)
 {
     this.f000028 = p0;
     this.f000018 = p1;
     this.f00000d = p2;
     this.f000006 = p3;
     this.f00000a = p4;
     this.f000056 = p5;
     this.f000189 = p6;
     this.f0000a0 = p7;
 }
 public AutoCompleteItem(string displayName, string value, MemberTypes? memberType = null, Type type = null)
 {
     Should.NotBeNull(displayName, nameof(displayName));
     Should.NotBeNull(value, nameof(value));
     Type = type ?? typeof(object);
     DisplayName = memberType.HasValue
         ? $"{displayName} ({Type.Name} - {(memberType.Value == MemberTypes.Custom ? "Attached" : memberType.Value.ToString())})"
         : displayName;
     Value = value;
     MemberType = memberType.GetValueOrDefault(MemberTypes.Custom);
 }
	// Serialize a unity object.
	public static void Serialize(SerializationInfo info,
								 MemberTypes memberType,
								 String name, String signature,
								 Type containingType)
			{
				info.SetType(typeof(MemberInfoSerializationHolder));
				info.AddValue("Name", name);
				info.AddValue("AssemblyName", containingType.Assembly.FullName);
				info.AddValue("ClassName", containingType.FullName);
				info.AddValue("Signature", signature);
				info.AddValue("MemberType", (int)memberType);
			}
		public static void Serialize(SerializationInfo info, String name, Type klass, String signature, MemberTypes type, Type[] genericArguments)
		{
			info.SetType( typeof(MemberInfoSerializationHolder));

			info.AddValue("AssemblyName", klass.Module.Assembly.FullName, typeof(String));
			info.AddValue("ClassName", klass.FullName, typeof(String));

			info.AddValue("Name", name, typeof(String));
			info.AddValue("Signature", signature, typeof(String));
			info.AddValue("MemberType",(int)type);
			info.AddValue("GenericArguments", genericArguments, typeof (Type[]));
		}
Example #26
0
        public override MemberElement CreateMemberElement(TypeElement type, string memberName, string returnType, MemberTypes memberType, IncludeStatus includeStatus, VisibilityOverride visibilityOverride, SecurityTransparencyStatus securityTransparencyStatus)
        {
            // Identify the member by category (method/prop/field/event), name, and return type.  These
            // strings are what matched by ModelSigFormatter

            string memberSig = memberType.ToString() + " : " + memberName;
            if (returnType != null) memberSig = memberSig + " : " + returnType;

            CodeMemberElement member = new CodeMemberElement(includeStatus, visibilityOverride, securityTransparencyStatus, memberSig, returnType, memberType, memberName);
            (type as CodeTypeElement).m_members.Add(memberSig, member);
            return member;
        }
 public AutoCompleteItem(string displayName, string value, MemberTypes? memberType = null, Type type = null)
 {
     Should.NotBeNull(displayName, "displayName");
     Should.NotBeNull(value, "value");
     Type = type ?? typeof(object);
     DisplayName = memberType.HasValue
         ? string.Format("{0} ({1} - {2})", displayName, Type.Name,
             memberType.Value == MemberTypes.Custom ? "Attached" : memberType.Value.ToString())
         : displayName;
     Value = value;
     MemberType = memberType.GetValueOrDefault(MemberTypes.Custom);
 }
Example #28
0
        public ThinMember(ThinType declaringType, ThinMember memberToCopy)
        {
            _declaringType = declaringType;

            _memberNode = memberToCopy._memberNode;
            _memberFullName = memberToCopy._memberFullName;
            _returnType = memberToCopy._returnType;
            _memberType = memberToCopy._memberType;
            _includeStatus = memberToCopy._includeStatus;
            _visibility = memberToCopy._visibility;
            _securityTransparencyStatus = memberToCopy._securityTransparencyStatus;

            CheckVisibility();
        }
Example #29
0
        /// <summary>
        /// Get a list of the members of a group. 
        /// </summary>
        /// <remarks>
        /// The call must be signed on behalf of a Flickr member, and the ability to see the group membership will be determined by the Flickr member's group privileges.
        /// </remarks>
        /// <param name="groupId">Return a list of members for this group. The group must be viewable by the Flickr member on whose behalf the API call is made.</param>
        /// <param name="page">The page of the results to return (default is 1).</param>
        /// <param name="perPage">The number of members to return per page (default is 100, max is 500).</param>
        /// <param name="memberTypes">The types of members to be returned. Can be more than one.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void GroupsMembersGetListAsync(string groupId, int page, int perPage, MemberTypes memberTypes, Action<FlickrResult<MemberCollection>> callback)
        {
            CheckRequiresAuthentication();

            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.groups.members.getList");
            parameters.Add("api_key", apiKey);
            if (page > 0) parameters.Add("page", page.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (perPage > 0) parameters.Add("per_page", perPage.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (memberTypes != MemberTypes.None) parameters.Add("membertypes", UtilityMethods.MemberTypeToString(memberTypes));
            parameters.Add("group_id", groupId);

            GetResponseAsync<MemberCollection>(parameters, callback);
        }
	public static MemberInfo[] GetMember2(this Type type, string name, MemberTypes memberTypes, BindingFlags bindingFlags)
	{
		MemberInfo[] members = type.GetMember(name, memberTypes, bindingFlags);
		List<MemberInfo> membersList = new List<MemberInfo>();
		foreach (MemberInfo info in members)
		{
			if ((bindingFlags & BindingFlags.DeclaredOnly) != 0 && info.DeclaringType != type)
			{
				continue;
			}
			membersList.Add(info);
		}
		return membersList.ToArray();
	}