/// Extract information about all types in the specified assembly, searchDirs might be used to resolve dependencies. static public AssemblyTypeInfoGenerator.ClassInfo[] ExtractAssemblyTypeInfo(BuildTarget targetPlatform, bool isEditor, string assemblyPathName, string[] searchDirs) { try { var target = ModuleManager.GetTargetStringFromBuildTarget(targetPlatform); var extension = ModuleManager.GetCompilationExtension(target); var extraPaths = extension.GetCompilerExtraAssemblyPaths(isEditor, assemblyPathName); if (extraPaths != null && extraPaths.Length > 0) { var dirs = new List <string>(searchDirs); dirs.AddRange(extraPaths); searchDirs = dirs.ToArray(); } var assemblyResolver = extension.GetAssemblyResolver(isEditor, assemblyPathName, searchDirs); AssemblyTypeInfoGenerator gen; if (assemblyResolver == null) { gen = new AssemblyTypeInfoGenerator(assemblyPathName, searchDirs); } else { gen = new AssemblyTypeInfoGenerator(assemblyPathName, assemblyResolver); } return(gen.GatherClassInfo()); } catch (System.Exception ex) { throw new Exception("ExtractAssemblyTypeInfo: Failed to process " + assemblyPathName + ", " + ex); } }
private AssemblyTypeInfoGenerator.FieldInfo?GetFieldInfo(TypeDefinition type, FieldDefinition field, bool isDeclaringTypeGenericInstance, Dictionary <TypeReference, TypeReference> genericInstanceTypeMap) { AssemblyTypeInfoGenerator.FieldInfo?result; if (!this.WillSerialize(field)) { result = null; } else { AssemblyTypeInfoGenerator.FieldInfo value = default(AssemblyTypeInfoGenerator.FieldInfo); value.name = field.Name; TypeReference type2; if (isDeclaringTypeGenericInstance) { type2 = this.ResolveGenericInstanceType(field.FieldType, genericInstanceTypeMap); } else { type2 = field.FieldType; } value.type = this.GetMonoEmbeddedFullTypeNameFor(type2); value.flags = AssemblyTypeInfoGenerator.FieldInfoFlags.None; CustomAttribute fixedBufferAttribute = AssemblyTypeInfoGenerator.GetFixedBufferAttribute(field); if (fixedBufferAttribute != null) { value.flags |= AssemblyTypeInfoGenerator.FieldInfoFlags.FixedBuffer; value.fixedBufferLength = AssemblyTypeInfoGenerator.GetFixedBufferLength(fixedBufferAttribute); value.fixedBufferTypename = AssemblyTypeInfoGenerator.GetFixedBufferTypename(fixedBufferAttribute); } result = new AssemblyTypeInfoGenerator.FieldInfo?(value); } return(result); }
public static AssemblyTypeInfoGenerator.ClassInfo[] ExtractAssemblyTypeInfo(BuildTarget targetPlatform, bool isEditor, string assemblyPathName, string[] searchDirs) { if (CSharpLanguage.GetUseMicrosoftCSharpCompiler(targetPlatform, isEditor, assemblyPathName)) { WSASDK wSASDK = EditorUserBuildSettings.wsaSDK; if (wSASDK == WSASDK.UniversalSDK81) { wSASDK = WSASDK.SDK81; } string nETCoreFrameworkReferencesDirectory = MicrosoftCSharpCompiler.GetNETCoreFrameworkReferencesDirectory(wSASDK); searchDirs = new List <string>(searchDirs) { nETCoreFrameworkReferencesDirectory }.ToArray(); } AssemblyTypeInfoGenerator.ClassInfo[] result; try { AssemblyTypeInfoGenerator assemblyTypeInfoGenerator = new AssemblyTypeInfoGenerator(assemblyPathName, searchDirs); result = assemblyTypeInfoGenerator.GatherClassInfo(); } catch (Exception ex) { throw new Exception(string.Concat(new object[] { "ExtractAssemblyTypeInfo: Failed to process ", assemblyPathName, ", ", ex })); } return(result); }
/// Extract information about all types in the specified assembly, searchDirs might be used to resolve dependencies. static public AssemblyTypeInfoGenerator.ClassInfo[] ExtractAssemblyTypeInfo(BuildTarget targetPlatform, bool isEditor, string assemblyPathName, string[] searchDirs) { try { AssemblyTypeInfoGenerator gen = new AssemblyTypeInfoGenerator(assemblyPathName, searchDirs); return(gen.GatherClassInfo()); } catch (System.Exception ex) { throw new Exception("ExtractAssemblyTypeInfo: Failed to process " + assemblyPathName + ", " + ex); } }
public static AssemblyTypeInfoGenerator.ClassInfo[] ExtractAssemblyTypeInfo(BuildTarget targetPlatform, bool isEditor, string assemblyPathName, string[] searchDirs) { AssemblyTypeInfoGenerator.ClassInfo[] result; try { string targetStringFromBuildTarget = ModuleManager.GetTargetStringFromBuildTarget(targetPlatform); ICompilationExtension compilationExtension = ModuleManager.GetCompilationExtension(targetStringFromBuildTarget); string[] compilerExtraAssemblyPaths = compilationExtension.GetCompilerExtraAssemblyPaths(isEditor, assemblyPathName); if (compilerExtraAssemblyPaths != null && compilerExtraAssemblyPaths.Length > 0) { List <string> list = new List <string>(searchDirs); list.AddRange(compilerExtraAssemblyPaths); searchDirs = list.ToArray(); } IAssemblyResolver assemblyResolver = compilationExtension.GetAssemblyResolver(isEditor, assemblyPathName, searchDirs); AssemblyTypeInfoGenerator assemblyTypeInfoGenerator; if (assemblyResolver == null) { assemblyTypeInfoGenerator = new AssemblyTypeInfoGenerator(assemblyPathName, searchDirs); } else { assemblyTypeInfoGenerator = new AssemblyTypeInfoGenerator(assemblyPathName, assemblyResolver); } result = assemblyTypeInfoGenerator.GatherClassInfo(); } catch (Exception ex) { throw new Exception(string.Concat(new object[] { "ExtractAssemblyTypeInfo: Failed to process ", assemblyPathName, ", ", ex })); } return(result); }
/// Extract information about all types in the specified assembly, searchDirs might be used to resolve dependencies. static public AssemblyTypeInfoGenerator.ClassInfo[] ExtractAssemblyTypeInfo(BuildTarget targetPlatform, bool isEditor, string assemblyPathName, string[] searchDirs) { try { var assemblyResolverData = GetAssemblyResolver(targetPlatform, isEditor, assemblyPathName, searchDirs); AssemblyTypeInfoGenerator gen; if (assemblyResolverData.Resolver == null) { gen = new AssemblyTypeInfoGenerator(assemblyPathName, assemblyResolverData.SearchDirs); } else { gen = new AssemblyTypeInfoGenerator(assemblyPathName, assemblyResolverData.Resolver); } return(gen.GatherClassInfo()); } catch (System.Exception ex) { throw new Exception("ExtractAssemblyTypeInfo: Failed to process " + assemblyPathName + ", " + ex); } }