Example #1
0
		internal void SetAttribute(AssemblyBuilder asm, CustomAttributeBuilder cab)
		{
			Universe u = cab.Constructor.Module.universe;
			Type type = cab.Constructor.DeclaringType;
			if (copyright == null && type == u.System_Reflection_AssemblyCopyrightAttribute)
			{
				copyright = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
			}
			else if (trademark == null && type == u.System_Reflection_AssemblyTrademarkAttribute)
			{
				trademark = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
			}
			else if (product == null && type == u.System_Reflection_AssemblyProductAttribute)
			{
				product = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
			}
			else if (company == null && type == u.System_Reflection_AssemblyCompanyAttribute)
			{
				company = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
			}
			else if (description == null && type == u.System_Reflection_AssemblyDescriptionAttribute)
			{
				description = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
			}
			else if (title == null && type == u.System_Reflection_AssemblyTitleAttribute)
			{
				title = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
			}
			else if (informationalVersion == null && type == u.System_Reflection_AssemblyInformationalVersionAttribute)
			{
				informationalVersion = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
			}
			else if (fileVersion == null && type == u.System_Reflection_AssemblyFileVersionAttribute)
			{
				fileVersion = (string)cab.DecodeBlob(asm).GetConstructorArgument(0);
			}
		}
		internal ModuleBuilder CreateModuleBuilder()
		{
			AssemblyName name = new AssemblyName();
			name.Name = assemblyName;
			if (options.keyPair != null)
			{
				name.KeyPair = options.keyPair;
			}
			else if (options.publicKey != null)
			{
				name.SetPublicKey(options.publicKey);
			}
			name.Version = options.version;
			assemblyBuilder = 
				StaticCompiler.Universe
					.DefineDynamicAssembly(name, AssemblyBuilderAccess.ReflectionOnly, assemblyDir);
			ModuleBuilder moduleBuilder;
			moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName, assemblyFile, this.EmitDebugInfo);
			if(this.EmitStackTraceInfo)
			{
				AttributeHelper.SetSourceFile(moduleBuilder, null);
			}
			if(this.EmitDebugInfo || this.EmitStackTraceInfo)
			{
				CustomAttributeBuilder debugAttr = new CustomAttributeBuilder(JVM.Import(typeof(DebuggableAttribute)).GetConstructor(new Type[] { Types.Boolean, Types.Boolean }), new object[] { true, this.EmitDebugInfo });
				assemblyBuilder.SetCustomAttribute(debugAttr);
			}
			AttributeHelper.SetRuntimeCompatibilityAttribute(assemblyBuilder);
			if(options.baseAddress != 0)
			{
				moduleBuilder.__ImageBase = options.baseAddress;
			}
			if(options.fileAlignment != 0)
			{
				moduleBuilder.__FileAlignment = options.fileAlignment;
			}
			if(options.highentropyva)
			{
				moduleBuilder.__DllCharacteristics |= DllCharacteristics.HighEntropyVA;
			}
			return moduleBuilder;
		}
Example #3
0
		internal ManifestModule(AssemblyBuilder assembly)
			: base(assembly.universe)
		{
			this.assembly = assembly;
		}
 internal ManifestModule(AssemblyBuilder assembly)
     : base(assembly.universe)
 {
     this.assembly = assembly;
 }
Example #5
0
		private AssemblyBuilder DefineDynamicAssemblyImpl(AssemblyName name, AssemblyBuilderAccess access, string dir, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions)
		{
			AssemblyBuilder asm = new AssemblyBuilder(this, name, dir, requiredPermissions, optionalPermissions, refusedPermissions);
			assemblies.Add(asm);
			return asm;
 		}