Пример #1
0
 public EventKey(TypeKey typeKey, EventDefinition evt)
     : this(typeKey, evt.EventType.FullName, evt.Name, evt.AddMethod != null ? evt.AddMethod.Attributes : 0)
 {
 }
Пример #2
0
        public InheritMap(Project project)
        {
            this.project = project;

            // cache for assemblies not in the project
            project.Cache = new AssemblyCache(project);

            foreach (AssemblyInfo info in project)
            {
                foreach (TypeDefinition type in info.GetAllTypeDefinitions())
                {
                    if (type.FullName == "<Module>")
                    {
                        continue;
                    }

                    TypeKey typeKey = new TypeKey(type);

                    baseTypes [typeKey] = GetBaseTypes(type);

                    int i = 0;
                    int j;

                    MethodKey[] methods = GetVirtualMethods(project.Cache, type);
                    while (i < methods.Length)
                    {
                        MethodGroup group;
                        var         left = methods [i];
                        if (!methodGroups.TryGetValue(left, out group))
                        {
                            group = null;
                        }

                        for (j = i + 1; j < methods.Length; j++)
                        {
                            var right = methods [j];
                            if (!MethodsMatch(left, right))
                            {
                                continue;
                            }

                            // found an override

                            // see if either method is already in a group
                            if (group != null)
                            {
                                group = AddToGroup(group, right);
                            }
                            else if (methodGroups.TryGetValue(right, out group))
                            {
                                group = AddToGroup(group, left);
                            }
                            else
                            {
                                group = new MethodGroup();

                                group = AddToGroup(group, left);
                                group = AddToGroup(group, right);
                            }

                            // if the group isn't already external, see if it should be
                            Debug.Assert(group != null, "should have a group by now");
                            if (!group.External && !project.Contains(right.TypeKey))
                            {
                                group.External = true;
                            }
                        }

                        // if the group isn't already external, see if it should be
                        if (group != null && !group.External && !project.Contains(left.TypeKey))
                        {
                            group.External = true;
                        }

                        // move on to the next thing that doesn't match
                        i++;
                    }
                }
            }
        }
Пример #3
0
        public void UpdateType(TypeKey key, ObfuscationStatus status, string text)
        {
            ObfuscatedClass c = GetClass(key);

            c.Update(status, text);
        }
Пример #4
0
 public TypeKey[] GetBaseTypes(TypeKey typeKey)
 {
     return(baseTypes [typeKey]);
 }
Пример #5
0
 /// <summary>
 /// Returns whether the project contains a given type.
 /// </summary>
 internal bool Contains(TypeKey type)
 {
     return(assemblyMap.ContainsKey(type.Scope));
 }
Пример #6
0
 public override int GetHashCode()
 {
     return(TypeKey.GetHashCode() ^ Type.GetHashCode() ^ Name.GetHashCode());
 }
Пример #7
0
 private int CalcHashCode()
 {
     return(TypeKey.GetHashCode() ^ base.GetHashCode());
 }
Пример #8
0
 public EventKey(TypeKey typeKey, EventDefinition evt)
     : this(typeKey, evt.EventType.FullName, evt.Name, evt)
 {
 }