Example #1
0
        /*Telerik Authorship*/
        private AssemblyStrongNameExtended GetAssemblyKey(AssemblyDefinition assemblyDefinition)
        {
            ModuleDefinition moduleDefinition = assemblyDefinition.MainModule;

            SpecialTypeAssembly special = moduleDefinition.IsReferenceAssembly() ? SpecialTypeAssembly.Reference : SpecialTypeAssembly.None;

            return(new AssemblyStrongNameExtended(assemblyDefinition.FullName, moduleDefinition.GetModuleArchitecture(), special));
        }
Example #2
0
        private string GetAssemblyKey(AssemblyDefinition assemblyDefinition)
        {
            ModuleDefinition moduleDefinition = assemblyDefinition.MainModule;

            return(new StringBuilder(assemblyDefinition.FullName).Append(",Architecture=").Append(moduleDefinition.GetModuleArchitecture()).ToString());
        }
		private Dictionary<string, List<string>> GetModuleCollisionTypesData(ModuleDefinition module, ILanguage language)
		{
			Dictionary<string, List<string>> collisionTypesData = new Dictionary<string, List<string>>(language.IdentifierComparer);
			Dictionary<string, string> typeNamesFirstOccurrence = new Dictionary<string, string>(language.IdentifierComparer);

			UpdateCollisionTypesDataWithTypes(collisionTypesData, typeNamesFirstOccurrence, module.Types);

			ICollection<AssemblyNameReference> dependingOnAssemblies = GetModuleDependsOnAnalysis(module);
			foreach (AssemblyNameReference assemblyNameReference in dependingOnAssemblies)
			{
				AssemblyDefinition referencedAssembly = module.AssemblyResolver.Resolve(assemblyNameReference, "", module.GetModuleArchitecture());

				if (referencedAssembly != null)
				{
					foreach (ModuleDefinition referencedModule in referencedAssembly.Modules)
					{
						UpdateCollisionTypesDataWithTypes(collisionTypesData, typeNamesFirstOccurrence, referencedModule.Types);
					}
				}
			}

			return collisionTypesData;
		}
		public static string GetModuleArchitecturePropertyValue(ModuleDefinition module, bool separateAnyCPU = false)
		{
			switch (module.GetModuleArchitecture())
			{
				case TargetArchitecture.AMD64:
					return "x64";
				case TargetArchitecture.I386:
					return "x86";
				case TargetArchitecture.IA64:
					return "Itanium";
				default:
                    if (separateAnyCPU)
                    {
                        return "Any CPU";
                    }
                    else
                    {
					    return "AnyCPU";
                    }
			}
		}
		private Dictionary<string, HashSet<string>> GetModuleNamespaceHierarchy(ModuleDefinition module, ILanguage language)
		{
			Dictionary<string, HashSet<string>> namespaceHierarchy = new Dictionary<string, HashSet<string>>(language.IdentifierComparer);

			UpdateNamespaceHiearchyDataWithTypes(namespaceHierarchy, module.Types);

			ICollection<AssemblyNameReference> dependingOnAssemblies = GetModuleDependsOnAnalysis(module);
			foreach (AssemblyNameReference assemblyNameReference in dependingOnAssemblies)
			{
				AssemblyDefinition referencedAssembly = module.AssemblyResolver.Resolve(assemblyNameReference, "", module.GetModuleArchitecture());

				if (referencedAssembly != null)
				{
					UpdateNamespaceHiearchyDataWithTypes(namespaceHierarchy, referencedAssembly.MainModule.Types);
				}
			}

			return namespaceHierarchy;
		}