public static bool IsTypeNameInCollisionOnAssemblyLevel(string typeName, AssemblySpecificContext assemblyContext, ModuleSpecificContext mainModuleContext) { HashSet <string> usedNamespaces = new HashSet <string>(); foreach (string usedNamespace in assemblyContext.AssemblyNamespaceUsings) { usedNamespaces.Add(usedNamespace); } usedNamespaces.UnionWith(mainModuleContext.ModuleNamespaceUsings); List <string> typeCollisionNamespaces; if (mainModuleContext.CollisionTypesData.TryGetValue(typeName, out typeCollisionNamespaces)) { IEnumerable <string> namespacesIntersection = typeCollisionNamespaces.Intersect(usedNamespaces); if (namespacesIntersection.Count() > 1) { return(true); } } return(false); }
public WriterContext(AssemblySpecificContext assemblyContext, ModuleSpecificContext moduleContext, TypeSpecificContext typeContext, Dictionary <string, MethodSpecificContext> methodContexts, Dictionary <string, Statement> decompiledStatements) { this.AssemblyContext = assemblyContext; this.ModuleContext = moduleContext; this.TypeContext = typeContext; this.MethodContexts = methodContexts; this.DecompiledStatements = decompiledStatements; }
public WriterContext(AssemblySpecificContext assemblyContext, ModuleSpecificContext moduleContext, TypeSpecificContext typeContext, Dictionary<string, MethodSpecificContext> methodContexts, Dictionary<string, Statement> decompiledStatements) { this.AssemblyContext = assemblyContext; this.ModuleContext = moduleContext; this.TypeContext = typeContext; this.MethodContexts = methodContexts; this.DecompiledStatements = decompiledStatements; }
public WriterContext(AssemblySpecificContext assemblyContext, ModuleSpecificContext moduleContext, TypeSpecificContext typeContext, Dictionary <string, MethodSpecificContext> methodContexts, Dictionary <string, Statement> decompiledStatements) { base(); this.set_AssemblyContext(assemblyContext); this.set_ModuleContext(moduleContext); this.set_TypeContext(typeContext); this.set_MethodContexts(methodContexts); this.set_DecompiledStatements(decompiledStatements); return; }
public virtual void WriteModuleAttributes(ModuleDefinition module, IWriterContextService writerContextService, bool writeUsings = false, ICollection<string> attributesToIgnore = null) { AssemblySpecificContext assemblyContext = new AssemblySpecificContext(); SetAssemblyContext(assemblyContext); ModuleSpecificContext moduleContext = writerContextService.GetModuleContext(module, Language); SetModuleContext(moduleContext); WriteModuleAttributesInternal(module, moduleContext.ModuleNamespaceUsings, writeUsings, attributesToIgnore); }
public static ICollection <string> GetAssemblyAndModuleNamespaceUsings(AssemblySpecificContext assemblyContext, ModuleSpecificContext moduleContext) { ICollection <string> result = new HashSet <string>(); foreach (string namespaceUsing in assemblyContext.AssemblyNamespaceUsings) { result.Add(namespaceUsing); } foreach (string namespaceUsing in moduleContext.ModuleNamespaceUsings) { if (!result.Contains(namespaceUsing)) { result.Add(namespaceUsing); } } return(result); }
public DecompilationContext(MethodSpecificContext methodContext, TypeSpecificContext typeContext, ModuleSpecificContext moduleContext, AssemblySpecificContext assemblyContext, ILanguage language) { base(); this.set_MethodContext(methodContext); this.set_TypeContext(typeContext); this.set_ModuleContext(moduleContext); this.set_AssemblyContext(assemblyContext); this.set_Language(language); this.set_IsStopped(false); return; }
public DecompilationContext(MethodSpecificContext methodContext, TypeSpecificContext typeContext, ModuleSpecificContext moduleContext, AssemblySpecificContext assemblyContext, ILanguage language) { this.MethodContext = methodContext; this.TypeContext = typeContext; this.ModuleContext = moduleContext; this.AssemblyContext = assemblyContext; this.Language = language; this.IsStopped = false; }
protected abstract void SetAssemblyContext(AssemblySpecificContext assemblyContext);
protected override void SetAssemblyContext(AssemblySpecificContext assemblyContext) { writer.InternalAssemblyContext = assemblyContext; }