Exemplo n.º 1
0
        void InitGlobalFields()
        {
            if (tokenToGlobalField != null)
            {
                return;
            }
            tokenToGlobalField = new Dictionary <int, MField>();

            var tmpTokenToGlobalField = new Dictionary <int, FieldInfo>();
            var flags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

            foreach (var f in module.GetFields(flags))
            {
                tmpTokenToGlobalField[f.MetadataToken] = f;
            }
            foreach (var f in moduleType.Fields)
            {
                var token = (int)f.MDToken.Raw;
                tokenToGlobalField[token] = new MField(tmpTokenToGlobalField[token], f);
            }
        }
Exemplo n.º 2
0
        void InitFields()
        {
            if (tokenToField != null)
            {
                return;
            }
            tokenToField    = new Dictionary <int, MField>(typeDef.Fields.Count);
            fieldRefToField = new FieldDefDict <MField>();

            var tmpTokenToField = new Dictionary <int, FieldInfo>();
            var flags           = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

            foreach (var f in type.GetFields(flags))
            {
                tmpTokenToField[f.MetadataToken] = f;
            }
            foreach (var f in typeDef.Fields)
            {
                var token = (int)f.MDToken.Raw;
                var field = new MField(tmpTokenToField[token], f);
                tokenToField[token] = field;
                fieldRefToField.Add(field.fieldDef, field);
            }
        }
Exemplo n.º 3
0
		void InitFields() {
			if (tokenToField != null)
				return;
			tokenToField = new Dictionary<int, MField>(typeDef.Fields.Count);
			fieldRefToField = new FieldDefDict<MField>();

			var tmpTokenToField = new Dictionary<int, FieldInfo>();
			var flags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
			foreach (var f in type.GetFields(flags))
				tmpTokenToField[f.MetadataToken] = f;
			foreach (var f in typeDef.Fields) {
				var token = (int)f.MDToken.Raw;
				var field = new MField(tmpTokenToField[token], f);
				tokenToField[token] = field;
				fieldRefToField.Add(field.fieldDef, field);
			}
		}
Exemplo n.º 4
0
		void InitGlobalFields() {
			if (tokenToGlobalField != null)
				return;
			tokenToGlobalField = new Dictionary<int, MField>();

			var tmpTokenToGlobalField = new Dictionary<int, FieldInfo>();
			var flags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
			foreach (var f in module.GetFields(flags))
				tmpTokenToGlobalField[f.MetadataToken] = f;
			foreach (var f in moduleType.Fields) {
				var token = (int)f.MDToken.Raw;
				tokenToGlobalField[token] = new MField(tmpTokenToGlobalField[token], f);
			}
		}
Exemplo n.º 5
0
        void initFields()
        {
            if (tokenToField != null)
                return;
            tokenToField = new Dictionary<int, MField>(typeDefinition.Fields.Count);
            fieldReferenceToField = new Dictionary<FieldReferenceKey, MField>();

            var tmpTokenToField = new Dictionary<int, FieldInfo>();
            var flags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
            foreach (var f in type.GetFields(flags))
                tmpTokenToField[f.MetadataToken] = f;
            foreach (var f in typeDefinition.Fields) {
                var token = f.MetadataToken.ToInt32();
                var field = new MField(tmpTokenToField[token], f);
                tokenToField[token] = field;
                fieldReferenceToField[new FieldReferenceKey(field.fieldDefinition)] = field;
            }
        }