Confuser.Core/PluginDiscovery.cs
/// <summary>
///     Adds plugins in the assembly to the protection list.
/// </summary>
/// <param name="context">The working context.</param>
/// <param name="protections">The working list of protections.</param>
/// <param name="packers">The working list of packers.</param>
/// <param name="components">The working list of components.</param>
/// <param name="asm">The assembly.</param>
// Token: 0x060001D3 RID: 467 RVA: 0x0000F594 File Offset: 0x0000D794
Adds plugins in the assembly to the protection list.
Adds plugins in the assembly to the protection list .
protected static void AddPlugins(ConfuserContext context, IList<Protection> protections, IList<Packer> packers, IList<ConfuserComponent> components, Assembly asm)
		{
			Module[] loadedModules = asm.GetLoadedModules();
			for (int j = 0; j < loadedModules.Length; j++)
			{
				Module module = loadedModules[j];
				Type[] types = module.GetTypes();
				for (int k = 0; k < types.Length; k++)
				{
					Type i = types[k];
					if (!i.IsAbstract && PluginDiscovery.HasAccessibleDefConstructor(i))
					{
						if (typeof(Protection).IsAssignableFrom(i))
						{
							try
							{
								protections.Add((Protection)Activator.CreateInstance(i));
								goto IL_126;
							}
							catch (Exception ex)
							{
								context.Logger.ErrorException("Failed to instantiate protection '" + i.Name + "'.", ex);
								goto IL_126;
							}
						}
						if (typeof(Packer).IsAssignableFrom(i))
						{
							try
							{
								packers.Add((Packer)Activator.CreateInstance(i));
								goto IL_126;
							}
							catch (Exception ex2)
							{
								context.Logger.ErrorException("Failed to instantiate packer '" + i.Name + "'.", ex2);
								goto IL_126;
							}
						}
						if (typeof(ConfuserComponent).IsAssignableFrom(i))
						{
							try
							{
								components.Add((ConfuserComponent)Activator.CreateInstance(i));
							}
							catch (Exception ex3)
							{
								context.Logger.ErrorException("Failed to instantiate component '" + i.Name + "'.", ex3);
							}
						}
					}
					IL_126:;
				}
			}
			context.CheckCancellation();
		}
protected static void AddPlugins ( ConfuserContext context , IList < Protection > protections , IList < Packer > packers , IList < ConfuserComponent > components , Assembly asm ) { Module [ ] loadedModules = asm . GetLoadedModules ( ) ; for ( int j = 0 ; j < loadedModules . Length ; j ++ ) { Module module = loadedModules [ j ] ; Type [ ] types = module . GetTypes ( ) ; for ( int k = 0 ; k < types . Length ; k ++ ) { Type i = types [ k ] ; if ( ! i . IsAbstract && PluginDiscovery . HasAccessibleDefConstructor ( i ) ) { if ( typeof ( Protection ) . IsAssignableFrom ( i ) ) { try { protections . Add ( ( Protection ) Activator . CreateInstance ( i ) ) ; goto IL_126 ; } catch ( Exception ex ) { context . Logger . ErrorException ( " " + i . Name + " " , ex ) ; goto IL_126 ; } } if ( typeof ( Packer ) . IsAssignableFrom ( i ) ) { try { packers . Add ( ( Packer ) Activator . CreateInstance ( i ) ) ; goto IL_126 ; } catch ( Exception ex2 ) { context . Logger . ErrorException ( " " + i . Name + " " , ex2 ) ; goto IL_126 ; } } if ( typeof ( ConfuserComponent ) . IsAssignableFrom ( i ) ) { try { components . Add ( ( ConfuserComponent ) Activator . CreateInstance ( i ) ) ; } catch ( Exception ex3 ) { context . Logger . ErrorException ( " " + i . Name + " " , ex3 ) ; } } } IL_126 : ; } } context . CheckCancellation ( ) ; }
Adds plugins in the assembly to the protection list.
Adds plugins in the assembly to the protection list .
context
ConfuserContext
The working context.
The working context .
protections
IList<Protection>
The working list of protections.
The working list of protections .
packers
IList<Packer>
The working list of packers.
The working list of packers .
components
IList<ConfuserComponent>
The working list of components.
The working list of components .
asm
Assembly
None