当前位置: 首页>>代码示例>>C#>>正文


C# AssemblyBuilder.GetName方法代码示例

本文整理汇总了C#中System.Reflection.Emit.AssemblyBuilder.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# AssemblyBuilder.GetName方法的具体用法?C# AssemblyBuilder.GetName怎么用?C# AssemblyBuilder.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reflection.Emit.AssemblyBuilder的用法示例。


在下文中一共展示了AssemblyBuilder.GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TypeGenerator

        static TypeGenerator()
        {
            var assemblyName = new AssemblyName { Name = "Siege.DynamicTypes" };
            AppDomain thisDomain = Thread.GetDomain();

            assemblyBuilder = thisDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave);
            module = assemblyBuilder.DefineDynamicModule(assemblyBuilder.GetName().Name,
                                                         assemblyBuilder.GetName().Name +
                                                         ".dll");
        }
开发者ID:rexwhitten,项目名称:Siege,代码行数:10,代码来源:TypeGenerator.cs

示例2: Verify

		/// <summary>
		/// Verifies an assembly based on an <see cref="AssemblyBuilder" /> instance.
		/// </summary>
		/// <param name="assemblyBuilder">The <see cref="AssemblyBuilder" /> instance.</param>
		/// <exception cref="ArgumentNullException">Thrown if <c>assemblyBuilder</c> is <c>null</c>.</exception>
		/// <exception cref="FileNotFoundException">Thrown if the given file does not exist.</exception>
		/// <exception cref="VerificationException">Thrown if the assembly has verification errors.</exception>
		public static void Verify(AssemblyBuilder assemblyBuilder)
		{
			var assemblyName = assemblyBuilder.GetName().Name;
			assemblyName += assemblyBuilder.EntryPoint != null ? ".exe" : ".dll";

			var localPath = new Uri(assemblyBuilder.GetName().CodeBase).LocalPath;
			var directoryName = Path.GetDirectoryName(localPath);

			if (directoryName != null)
				InternalVerify(Path.Combine(directoryName, assemblyName));
		}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:18,代码来源:AssemblyVerification.cs

示例3: EmitHelper

 public EmitHelper()
 {
     string guid = Guid.NewGuid().ToString();
     this.fileName = guid + ".dll";
     AssemblyName assemblyName = new AssemblyName(guid);
     assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Save);
     module = assemblyBuilder.DefineDynamicModule(assemblyBuilder.GetName().Name, fileName, false);
 }
开发者ID:Aestek,项目名称:IrisMailer,代码行数:8,代码来源:EmitHelper.cs

示例4: Verify

		/// <summary>
		/// Verifies an assembly based on an <see cref="AssemblyBuilder" /> instance.
		/// </summary>
		/// <param name="assemblyBuilder">The <see cref="AssemblyBuilder" /> instance.</param>
		/// <exception cref="ArgumentNullException">Thrown if <c>assemblyBuilder</c> is <c>null</c>.</exception>
		/// <exception cref="FileNotFoundException">Thrown if the given file does not exist.</exception>
		/// <exception cref="VerificationException">Thrown if the assembly has verification errors.</exception>
		public static void Verify(AssemblyBuilder assemblyBuilder)
		{
			//assemblyBuilder.CheckParameterForNull("assemblyBuilder");

			string assemblyName = assemblyBuilder.GetName().Name;

			if(assemblyBuilder.EntryPoint != null)
			{
				assemblyName += ".exe";
			}
			else
			{
				assemblyName += ".dll";
			}

			AssemblyVerification.InternalVerify(Path.Combine(
				Path.GetDirectoryName(new Uri(assemblyBuilder.GetName().CodeBase).LocalPath),
				assemblyName));
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:26,代码来源:AssemblyVerification.cs

示例5: Initialize

        private void Initialize()
        {
            var name = new AssemblyName(outputFilename);

            assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.RunAndSave);

            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyBuilder.GetName().Name, outputPath,
                                                                              true);

            RootContext.InitializeForBuild(moduleBuilder);
        }
开发者ID:robertsundstrom,项目名称:vb-lite-compiler,代码行数:11,代码来源:CodeGenerator.cs

示例6: AlgorithmCompiler

        public AlgorithmCompiler(bool IsDecryptState)
        {
            this.IsDecryptState = IsDecryptState;

            lock (GlobalLock)
            {
                if(assemblyName == null)
                {
                    assemblyName = new AssemblyName();
                    assemblyName.Name = "__AlgorithmCompiler__" + GlobalInitialized++;
                    asmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
                    modBuilder = asmBuilder.DefineDynamicModule(asmBuilder.GetName().Name);
                }
            }
        }
开发者ID:PavilionVI,项目名称:SecureSocketProtocol,代码行数:15,代码来源:AlgorithmCompiler.cs

示例7: DynamicAssemblyInfo

        public DynamicAssemblyInfo(string name)
        {
            var assemblyName = new AssemblyName(
                name
                );

            _assemblyBuilder = Thread.GetDomain().DefineDynamicAssembly(
                assemblyName,
                AssemblyBuilderAccess.RunAndSave
                );

            _moduleBuilder = _assemblyBuilder.DefineDynamicModule(
                _assemblyBuilder.GetName().Name,
                false
                );
        }
开发者ID:blake2002,项目名称:FluentIL-1,代码行数:16,代码来源:DynamicAssemblyInfo.cs

示例8: Verify

        public static void Verify(AssemblyBuilder assemblyBuilder)
        {
            if (assemblyBuilder == null)
            {
                throw new ArgumentNullException("assemblyBuilder");
            }

            var assemblyName = assemblyBuilder.GetName().Name;

            if (assemblyBuilder.EntryPoint != null)
            {
                assemblyName += ".exe";
            }
            else
            {
                assemblyName += ".dll";
            }

            AssemblyVerification.Verify(Path.Combine(Directory.GetCurrentDirectory(), assemblyName));
        }
开发者ID:JasonBock,项目名称:AssemblyVerifier,代码行数:20,代码来源:AssemblyVerification.cs

示例9: InitializeAssembly

        /// <summary>
        /// Initialize static objects
        /// </summary>
        private static void InitializeAssembly()
        {
            //check to see if we've already instantiated
            //the static objects
            if (asmBuilder == null) {
                //create a new dynamic assembly
                AssemblyName assembly = new AssemblyName();
                assembly.Name = "AnonymousTypeExentions";

                //get the current application domain
                AppDomain domain = Thread.GetDomain();

                //get a module builder object
                asmBuilder = domain.DefineDynamicAssembly(assembly,
                    AssemblyBuilderAccess.Run);
                modBuilder = asmBuilder.DefineDynamicModule(
                    asmBuilder.GetName().Name, false
                    );
            }
        }
开发者ID:dalinhuang,项目名称:cndreams,代码行数:23,代码来源:TypeMerger.cs

示例10: GenerateModuleBuilder

 public ModuleBuilder GenerateModuleBuilder(AssemblyBuilder assemblyBuilder)
 {
     return assemblyBuilder.DefineDynamicModule(assemblyBuilder.GetName().Name, false);
 }
开发者ID:dotnetprogrammr,项目名称:TypeFactory,代码行数:4,代码来源:AssemblyManager.cs

示例11: InitializeCompiler

        private void InitializeCompiler()
        {
            lock (_barrier)
            {
                if (_asm == null)
                {
                    try
                    {
#if TRACE
                        _asm = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(Vault.GetAssemblyName()), AssemblyBuilderAccess.RunAndSave);
                        _mod = _asm.DefineDynamicModule(Vault.GetAssemblyName() + ".dll", true);

                        // do not use DomainUnload here because it never gets fired for default domain
                        AppDomain.CurrentDomain.ProcessExit += (o, e) =>
                        {
                            try
                            {
                                if (_asm != null)
                                {
                                    _asm.Save(_asm.GetName().Name + ".dll");
                                }
                            }
                            catch(Exception ex)
                            {
                                MTLog.Say("Asm dumper has faced an unexpected exception: " + ex);
                            }
                        };
#else
                        _asm = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(Vault.GetClassName()), AssemblyBuilderAccess.Run);
                        _mod = _asm.DefineDynamicModule(Vault.GetClassName() + ".dll", false);
#endif
                        _asm.SetCustomAttribute(new CustomAttributeBuilder(
                            typeof(GuidAttribute).GetConstructors().Single(),
                            Vault.Id.ToString().MkArray()));
                    }
                    catch (Exception ex)
                    {
                        MTLog.Say("Compiler initialization failed: " + ex);
                        _isPermanentlyBroken = true;
                    }
                }
            }

            GetCompiledAsync();
        }
开发者ID:xeno-by,项目名称:elf4b,代码行数:45,代码来源:VaultCompiler.cs

示例12: CreateModule

 private static ModuleBuilder CreateModule(AssemblyBuilder builder)
 {
     var theName = builder.GetName();
     return builder.DefineDynamicModule(theName.Name, theName.Name + ".dll");
 }
开发者ID:gamlerhart,项目名称:db4opad,代码行数:5,代码来源:CodeGenerator.cs

示例13: SerializationMethodGeneratorManager

		private SerializationMethodGeneratorManager( bool isDebuggable, bool isCollectable, AssemblyBuilder assemblyBuilder )
		{
			this._isDebuggable = isDebuggable;

			string assemblyName;
			if ( assemblyBuilder != null )
			{
				assemblyName =
#if !NETSTANDARD1_1 && !NETSTANDARD1_3
					assemblyBuilder.GetName( false ).Name;
#else
					assemblyBuilder.GetName().Name;
#endif // !NETSTANDARD1_1 && !NETSTANDARD1_3
				this._assembly = assemblyBuilder;
			}
			else
			{
				assemblyName = typeof( SerializationMethodGeneratorManager ).Namespace + ".GeneratedSerealizers" + Interlocked.Increment( ref _assemblySequence );
				var dedicatedAssemblyBuilder =
#if !NETSTANDARD1_1 && !NETSTANDARD1_3
					AppDomain.CurrentDomain.DefineDynamicAssembly(
						new AssemblyName( assemblyName ),
						isDebuggable
						? AssemblyBuilderAccess.RunAndSave
#if !NETFX_35
						: ( isCollectable ? AssemblyBuilderAccess.RunAndCollect : AssemblyBuilderAccess.Run )
#else
						: AssemblyBuilderAccess.Run
#endif // !NETFX_35
#if DEBUG
						,
						SerializerDebugging.DumpDirectory
#endif // DEBUG
					);
#else
					AssemblyBuilder.DefineDynamicAssembly(
						new AssemblyName( assemblyName ),
						isCollectable ? AssemblyBuilderAccess.RunAndCollect : AssemblyBuilderAccess.Run
					);
#endif // !NETSTANDARD1_1 && !NETSTANDARD1_3

				SetUpAssemblyBuilderAttributes( dedicatedAssemblyBuilder, isDebuggable );
				this._assembly = dedicatedAssemblyBuilder;
			}

#if !NETSTANDARD1_1 && !NETSTANDARD1_3
			if ( isDebuggable )
			{
				this._module = this._assembly.DefineDynamicModule( assemblyName, assemblyName + ".dll", true );
			}
			else
			{
				this._module = this._assembly.DefineDynamicModule( assemblyName, true );
			}
#else
			this._module = this._assembly.DefineDynamicModule( assemblyName );
#endif // !NETSTANDARD1_1 && !NETSTANDARD1_3
		}
开发者ID:msgpack,项目名称:msgpack-cli,代码行数:58,代码来源:SerializationMethodGeneratorManager.cs

示例14: Save

        private static void Save(AssemblyBuilder assembly, ProxyContext context)
        {
            if ((context.Access & AssemblyBuilderAccess.Save) == AssemblyBuilderAccess.Save)
            {
                assembly.Save(assembly.GetName().Name + ".dll");

                if (context.Verify)
                {
                    AssemblyVerification.Verify(assembly);
                }
            }
        }
开发者ID:JasonBock,项目名称:DynamicProxies,代码行数:12,代码来源:ProxyBuilder.cs

示例15: DefaultSerializationMethodGeneratorManager

		private DefaultSerializationMethodGeneratorManager( bool isDebuggable, bool isCollectable, AssemblyBuilder assemblyBuilder )
		{
			this._isDebuggable = isDebuggable;

			string assemblyName;
			if ( assemblyBuilder != null )
			{
				assemblyName = assemblyBuilder.GetName( false ).Name;
				this._assembly = assemblyBuilder;
			}
			else
			{
				assemblyName = typeof( DefaultSerializationMethodGeneratorManager ).Namespace + ".GeneratedSerealizers" + Interlocked.Increment( ref _assemblySequence );
				var dedicatedAssemblyBuilder =
					AppDomain.CurrentDomain.DefineDynamicAssembly(
						new AssemblyName( assemblyName ),
#if !SILVERLIGHT
						isDebuggable
						? AssemblyBuilderAccess.RunAndSave
#if !NETFX_35
						: ( isCollectable ? AssemblyBuilderAccess.RunAndCollect : AssemblyBuilderAccess.Run )
#else
						: AssemblyBuilderAccess.Run
#endif
#else
						AssemblyBuilderAccess.Run 
#endif
					);

				SetUpAssemblyBuilderAttributes( dedicatedAssemblyBuilder, isDebuggable );
				this._assembly = dedicatedAssemblyBuilder;
			}

#if SILVERLIGHT
			this._module = this._assembly.DefineDynamicModule( assemblyName, true );
#else
			if ( isDebuggable )
			{
				this._module = this._assembly.DefineDynamicModule( assemblyName, assemblyName + ".dll", true );
			}
			else
			{
				this._module = this._assembly.DefineDynamicModule( assemblyName, true );
			}
#endif // else SILVERLIGHT
		}
开发者ID:gezidan,项目名称:ZYSOCKET,代码行数:46,代码来源:DefaultSerializationMethodGeneratorManager.cs


注:本文中的System.Reflection.Emit.AssemblyBuilder.GetName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。