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


C# System.AssemblyLoadEventArgs类代码示例

本文整理汇总了C#中System.AssemblyLoadEventArgs的典型用法代码示例。如果您正苦于以下问题:C# AssemblyLoadEventArgs类的具体用法?C# AssemblyLoadEventArgs怎么用?C# AssemblyLoadEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: LoadDebugging

        void LoadDebugging(object sender, AssemblyLoadEventArgs args, string name)
        {
            // we'll output the full assemblyName
            Console.WriteLine("{0} was loaded:", args.LoadedAssembly.FullName);

            // can skip the first 2 frames,
            // they just have the event handlers for assem load
            StackTrace stackTrace = new StackTrace(2);
            StackFrame[] frames = stackTrace.GetFrames();

            // dump the stack
            foreach (StackFrame frame in frames)
            {
                MethodBase method = frame.GetMethod();
                ParameterInfo[] parameters = method.GetParameters();
                StringBuilder parString = new StringBuilder();
                for (int i = 0; i < parameters.Length; i++)
                {
                    ParameterInfo par = parameters[i];
                    if (i > 0)
                        parString.Append(", ");

                    parString.Append(par.ParameterType.ToString());
                }

                Console.WriteLine(" at {0}.{1}({2})",
                method.DeclaringType.Name,
                method.Name,
                parString.ToString());
            }
        }
开发者ID:fernandolucasrodriguez,项目名称:qit,代码行数:31,代码来源:AssemblyLoadMonitor.cs

示例2: CurrentDomain_AssemblyLoad

 static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
 {
     Assembly assembly = args.LoadedAssembly;
     lock (assemblies) {
         assemblies[assembly.FullName] = assembly;
     }
 }
开发者ID:kanbang,项目名称:Colt,代码行数:7,代码来源:AssemblyLocator.cs

示例3: OnAssemblyLoad

        private void OnAssemblyLoad(object sender, AssemblyLoadEventArgs args)
        {
            if (args.LoadedAssembly.GlobalAssemblyCache)
                return;

            Trace.TraceInformation("Assembly Loaded... {0}", args.LoadedAssembly.Location);

            if (args.LoadedAssembly.Location.StartsWith(_pluginFolder.FullName, StringComparison.InvariantCultureIgnoreCase))
            {
                try
                {
                    RegisterWithCheck(args.LoadedAssembly);

                    var types = args.LoadedAssembly.GetExportedTypes();

                    if (types.Any())
                    {
                        foreach (var type in types)
                        {
                            Trace.TraceInformation("Type exported: {0}", type.FullName);
                        }
                    }
                    else
                    {
                        Trace.TraceInformation("No types exported by Assembly: '{0}'",
                            args.LoadedAssembly.GetName().Name);
                    }
                }
                catch (Exception ex)
                {
                    Trace.TraceInformation(ex.Message);
                }
            }
        }
开发者ID:jpolvora,项目名称:MvcLib.MyGet,代码行数:34,代码来源:PluginStorage.cs

示例4: LoadDebugging

        void LoadDebugging(object sender, AssemblyLoadEventArgs args, string name)
        {
            // can skip the first 2 frames,
            // they just have the event handlers for assem load
            StackTrace stackTrace = new StackTrace(2);
            StackFrame[] frames = stackTrace.GetFrames();

            // dump the stack
            foreach (StackFrame frame in frames)
            {
                MethodBase method = frame.GetMethod();
                ParameterInfo[] parameters = method.GetParameters();
                StringBuilder parString = new StringBuilder();
                for (int i = 0; i < parameters.Length; i++)
                {
                    ParameterInfo par = parameters[i];
                    if (i > 0)
                        parString.Append(", ");

                    parString.Append(par.ParameterType.ToString());
                }

                //LoggerFactory.Default.Log(AssemblyLoadMonitorLogID, " at " + method.DeclaringType.Name + "." + method.Name + "(" + parString.ToString() + ")");
            }
        }
开发者ID:fernandolucasrodriguez,项目名称:qit,代码行数:25,代码来源:AssemblyLoadMonitor.cs

示例5: CurrentDomain_AssemblyLoad

 /// <summary>
 /// Handles the AssemblyLoad event of the AppDomain.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="args">The <see cref="AssemblyLoadEventArgs"/> instance containing the event data.</param>
 private void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
 {
     lock (this)
     {
         UpdateMap();
     }
 }
开发者ID:dheep-purdessy,项目名称:ignite,代码行数:12,代码来源:LoadedAssembliesResolver.cs

示例6: OnAssemblyLoaded

        private static void OnAssemblyLoaded(object sender, AssemblyLoadEventArgs args)
        {
            _assembliesByName[args.LoadedAssembly.FullName] = args.LoadedAssembly;
            _assembliesByIndex.Add(args.LoadedAssembly);

            _cachedTypes = new Dictionary<string, Type>();
        }
开发者ID:x4maT,项目名称:fullserializer,代码行数:7,代码来源:fsTypeCache.cs

示例7: OnAssemblyLoad

    private void OnAssemblyLoad(object sender, AssemblyLoadEventArgs args) {
        Assembly a = args.LoadedAssembly;

        // Ignore GAC assemblies
        if (a.GlobalAssemblyCache)
            return;

        // Ignore assemblies that don't start with our prefix
        string name = a.GetName().Name;
        if (!StringUtil.StringStartsWith(name, BuildManager.AssemblyNamePrefix))
            return;

        // Go through all the assemblies it references
        foreach (AssemblyName assemblyName in a.GetReferencedAssemblies()) {

            // Ignore references that don't start with our prefix
            if (!StringUtil.StringStartsWith(assemblyName.Name, BuildManager.AssemblyNamePrefix))
                continue;

            lock (_dependentAssemblies) {
                // Check whether we already have an ArrayList for this reference
                ArrayList dependentList = _dependentAssemblies[assemblyName.Name] as ArrayList;
                if (dependentList == null) {
                    // If not, create one and add it to the hashtable
                    dependentList = new ArrayList();
                    _dependentAssemblies[assemblyName.Name] = dependentList;
                }

                // Add the assembly that just got loaded as a dependent
                Debug.Assert(!dependentList.Contains(name));
                dependentList.Add(name);
            }
        }
    }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:34,代码来源:BuildResultCache.cs

示例8: AssemblyLoaded

            private void AssemblyLoaded(object sender, AssemblyLoadEventArgs args) {
                // !!! BUG on .Net 2 SP1: going further breaks DefineDynamicAssembly in very strange manner, so don't process dynamic assemblies
                // simple test:
                // AppDomain.CurrentDomain.DefineDynamicAssembly(new System.Reflection.AssemblyName("dynBoxed" + Guid.NewGuid().ToString()), System.Reflection.Emit.AssemblyBuilderAccess.Run);
                // previous workaround using RegisterAssemblyForNonAutoRegistration/ShouldSkipAssemblyTypeAutoRegistration
                // is deficient, there may be dynamic assemblies irrelevant to IIOPNet.
                // So this patch is simple and universal:
                if (args.LoadedAssembly is System.Reflection.Emit.AssemblyBuilder)
                    return;

                RegisterTypes(args.LoadedAssembly);
                AssemblyName[] refAssemblies =
                    args.LoadedAssembly.GetReferencedAssemblies();
                if (refAssemblies != null) {
                    for (int i = 0; i <refAssemblies.Length; i++) {
                        try {
                            if (refAssemblies[i] != null) {
                                Assembly.Load(refAssemblies[i]); // this will call AssemblyLoaded for this assembly
                            }
                        } catch (BadImageFormatException) {
                            Trace.WriteLine("bad format -> ignoring assembly " + refAssemblies[i].FullName);
                            // ignore assembly
                        } catch (FileNotFoundException) {
                            Trace.WriteLine("missing -> ignoring assembly " + refAssemblies[i].FullName);
                            // ignore assembly
                        } catch (System.Security.SecurityException) {
                            Trace.WriteLine("security problem -> ignoring assembly " + refAssemblies[i].FullName);
                            // ignore assembly
                        }
                    }
                }
            }
开发者ID:JnS-Software-LLC,项目名称:iiop-net,代码行数:32,代码来源:Repository.cs

示例9: CurrentDomain_AssemblyLoad

 void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
 {
     foreach (var type in args.LoadedAssembly.GetTypes().Where(
             type => type.GetCustomAttributes(typeof(GuidAttribute), true).Any()))
     {
         this.types.TryAdd(type.GUID, type);
     }
 }
开发者ID:TheSoftweyrGroup,项目名称:Softweyr.EventStore,代码行数:8,代码来源:XmlDataContractSerialization.cs

示例10: CurrentDomain_AssemblyLoad

		private void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
		{
			if (IsPluginAssembly(args.LoadedAssembly))
			{
				var plugin = CreatePluginFromAssembly(args.LoadedAssembly);
				PublishPlugin(plugin);
			}
		}
开发者ID:maritaria,项目名称:HotBot,代码行数:8,代码来源:AssemblyPluginLoader.cs

示例11: AssemblyLoaded

#pragma warning restore 1591 // Xml Comments

        void AssemblyLoaded(object sender, AssemblyLoadEventArgs args)
        {
            var assembly = args.LoadedAssembly;
            if (!assembly.IsDynamic)
            {
                AvailableAssemblies.Add(AssemblyInfoFromAssembly(assembly));
            }
        }
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:10,代码来源:AppDomainAssemblyProvider.cs

示例12: OnAssemblyLoad

 private static void OnAssemblyLoad(object sender, AssemblyLoadEventArgs args)
 {
     var asm = args.LoadedAssembly;
     if (!asm.IsDynamic)
     {
         Log.LogVerbose(nameof(PackageAssemblyHandler), $"Assembly loaded: {asm.Location}");
     }
 }
开发者ID:Orckestra,项目名称:C1-CMS,代码行数:8,代码来源:PackageAssemblyHandler.cs

示例13: AssemblyLoadedInCurrentDomain

        public void AssemblyLoadedInCurrentDomain()
        {
            AssemblyLoadEventArgs assemblyEvent = new AssemblyLoadEventArgs(Assembly.GetAssembly(GetType()));
            BinaryDataFactory binaryDataFactory = new BinaryDataFactory();
            binaryDataFactory.OnAssemblyLoadInCurrentDomain(null, assemblyEvent);

            Assert.That(binaryDataFactory.shortNames.Count, Is.GreaterThanOrEqualTo(4));
            Assert.That(binaryDataFactory.typeMap.Count, Is.GreaterThanOrEqualTo(4));
        }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:9,代码来源:ClientTests.cs

示例14: CurrentDomain_AssemblyLoad

 static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
 {
     if (!args.LoadedAssembly.GetName().Name.Contains("Proxies_"))
     {
         ConsoleColor CurrentColor = Console.ForegroundColor;
         Console.ForegroundColor = ConsoleColor.Yellow;
         Console.WriteLine(string.Format("Loading {0}.dll", args.LoadedAssembly.GetName().Name));
         Console.ForegroundColor = CurrentColor;
     }
 }
开发者ID:JackFong,项目名称:FreeRadical,代码行数:10,代码来源:Program.cs

示例15: CurrentDomain_AssemblyLoad

 private static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
 {
     try
     {
         Logger.Log.DebugFormat("Assembly loaded: {0}", args.LoadedAssembly);
     }
     catch
     {
     }
 }
开发者ID:tgmayfield,项目名称:svn-monitor,代码行数:10,代码来源:Program.cs


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