private ExportedClass GetExportedClass(TypeDefinition td, AssemblyExports result) { ExportedClass exportedClass; if (!result.ClassesByName.TryGetValue(td.FullName, out exportedClass)) { TypeDefinition typeDefinition = td; while (!typeDefinition.HasGenericParameters && typeDefinition.IsNested) { typeDefinition = typeDefinition.DeclaringType; } exportedClass = new ExportedClass(td.FullName, typeDefinition.HasGenericParameters); result.ClassesByName.Add(exportedClass.FullTypeName, exportedClass); } return(exportedClass); }
internal void Refresh() { int num = 0; this.MethodsByExportName.Clear(); this._DuplicateExportMethods.Clear(); Dictionary <string, DuplicateExports> dictionary = new Dictionary <string, DuplicateExports>(); foreach (ExportedClass exportedClass in this.ClassesByName.Values) { List <ExportedMethod> exportedMethodList = new List <ExportedMethod>(exportedClass.Methods.Count); foreach (ExportedMethod method in exportedClass.Methods) { DuplicateExports duplicateExports; if (!dictionary.TryGetValue(method.ExportName, out duplicateExports)) { method.VTableOffset = num++; this.MethodsByExportName.Add(method.MemberName, method); dictionary.Add(method.ExportName, new DuplicateExports(method)); } else { exportedMethodList.Add(method); duplicateExports.Duplicates.Add(method); } } ExportedClass exportClassCopy = exportedClass; exportedMethodList.ForEach((Action <ExportedMethod>)(m => exportClassCopy.Methods.Remove(m))); exportedClass.Refresh(); } foreach (DuplicateExports duplicateExports in dictionary.Values) { if (duplicateExports.Duplicates.Count > 0) { this._DuplicateExportMethods.Add(duplicateExports); foreach (ExportedMethod duplicate in (IEnumerable <ExportedMethod>)duplicateExports.Duplicates) { this._DuplicateExportMethodsbyFullName.Add(AssemblyExports.GetKey(duplicate.ExportedClass.FullTypeName, duplicate.MemberName), duplicate); } } } this._DuplicateExportMethods.Sort((Comparison <DuplicateExports>)((l, r) => string.CompareOrdinal(l.UsedExport.ExportName, r.UsedExport.ExportName))); }