private static AssemblyBuilderHelper GetAssemblyBuilder(Type type, string suffix) { AssemblyBuilderHelper ab = GlobalAssemblyBuilder; if (ab == null) { string assemblyDir = AppDomain.CurrentDomain.BaseDirectory; // Dynamic modules are locationless, so ignore them. // _ModuleBuilder is the base type for both // ModuleBuilder and InternalModuleBuilder classes. // if (!(type.Module is _ModuleBuilder)) { assemblyDir = Path.GetDirectoryName(type.Module.FullyQualifiedName); } string fullName = type.FullName; if (type.IsGenericType) { fullName = AbstractClassBuilder.GetTypeFullName(type); } ab = new AssemblyBuilderHelper(assemblyDir + "\\" + fullName + "." + suffix + ".dll"); } return(ab); }
private static AssemblyBuilderHelper GetAssemblyBuilder(Type type, string suffix) { var ab = GlobalAssemblyBuilder; if (ab == null) { #if SILVERLIGHT var assemblyDir = "."; #else var assemblyDir = AppDomain.CurrentDomain.BaseDirectory; // Dynamic modules are locationless, so ignore them. // _ModuleBuilder is the base type for both // ModuleBuilder and InternalModuleBuilder classes. // if (!(type.Module is ModuleBuilder) && type.Module.FullyQualifiedName != null && type.Module.FullyQualifiedName.IndexOf('<') < 0) { assemblyDir = Path.GetDirectoryName(type.Module.FullyQualifiedName); } #endif var fullName = type.FullName; if (type.IsGenericType) { fullName = AbstractClassBuilder.GetTypeFullName(type); } fullName = fullName.Replace('<', '_').Replace('>', '_'); ab = new AssemblyBuilderHelper(Path.Combine(assemblyDir, fullName + "." + suffix + ".dll")); } return(ab); }
static AssemblyBuilderHelper GetAssemblyBuilder(Type type, string suffix) { var assemblyDir = AppDomain.CurrentDomain.BaseDirectory; // Dynamic modules are locationless, so ignore them. // _ModuleBuilder is the base type for both // ModuleBuilder and InternalModuleBuilder classes. // if ( #if !NETCOREAPP2_0 && !NETCOREAPP2_1 && !NETCOREAPP2_2 !(type.Module is _ModuleBuilder) && #endif type.Module.FullyQualifiedName.IndexOf('<') < 0) { assemblyDir = Path.GetDirectoryName(type.Module.FullyQualifiedName); } var fullName = type.FullName; if (type.IsGenericTypeEx()) { fullName = AbstractClassBuilder.GetTypeFullName(type); } Debug.Assert(fullName != null, $"{nameof(fullName)} != null"); Debug.Assert(assemblyDir != null, $"{nameof(assemblyDir)} != null"); fullName = fullName.Replace('<', '_').Replace('>', '_'); return(new AssemblyBuilderHelper(Path.Combine(assemblyDir, $"{fullName}.{suffix}.dll"))); }