Confuser.Core/Marker.cs
/// <summary>
///     Loads the assembly and marks the project.
/// </summary>
/// <param name="proj">The project.</param>
/// <param name="context">The working context.</param>
/// <returns><see cref="T:Confuser.Core.MarkerResult" /> storing the marked modules and packer information.</returns>
// Token: 0x06000193 RID: 403 RVA: 0x0000CFF0 File Offset: 0x0000B1F0
Loads the assembly and marks the project.
Loads the assembly and marks the project .
protected internal virtual MarkerResult MarkProject(ConfuserProject proj, ConfuserContext context)
		{
			Packer packer = null;
			Dictionary<string, string> packerParams = null;
			if (proj.Packer != null)
			{
				if (!this.packers.ContainsKey(proj.Packer.Id))
				{
					context.Logger.ErrorFormat("Cannot find packer with ID '{0}'.", new object[]
					{
						proj.Packer.Id
					});
					throw new ConfuserException(null);
				}
				if (proj.Debug)
				{
					context.Logger.Warn("Generated Debug symbols might not be usable with packers!");
				}
				packer = this.packers[proj.Packer.Id];
				packerParams = new Dictionary<string, string>(proj.Packer, StringComparer.OrdinalIgnoreCase);
			}
			List<Tuple<ProjectModule, ModuleDefMD>> modules = new List<Tuple<ProjectModule, ModuleDefMD>>();
			List<byte[]> extModules = new List<byte[]>();
			foreach (ProjectModule module3 in proj)
			{
				if (module3.IsExternal)
				{
					extModules.Add(module3.LoadRaw(proj.BaseDirectory));
				}
				else
				{
					ModuleDefMD modDef = module3.Resolve(proj.BaseDirectory, context.Resolver.DefaultModuleContext);
					context.CheckCancellation();
					if (proj.Debug)
					{
						modDef.LoadPdb();
					}
					context.Resolver.AddToCache(modDef);
					modules.Add(Tuple.Create<ProjectModule, ModuleDefMD>(module3, modDef));
				}
			}
			foreach (Tuple<ProjectModule, ModuleDefMD> module2 in modules)
			{
				context.Logger.InfoFormat("Loading '{0}'...", new object[]
				{
					module2.Item1.Path
				});
				Dictionary<Rule, PatternExpression> rules = this.ParseRules(proj, module2.Item1, context);
				context.Annotations.Set<StrongNameKey>(module2.Item2, Marker.SNKey, Marker.LoadSNKey(context, (module2.Item1.SNKeyPath == null) ? null : Path.Combine(proj.BaseDirectory, module2.Item1.SNKeyPath), module2.Item1.SNKeyPassword));
				context.Annotations.Set<Dictionary<Rule, PatternExpression>>(module2.Item2, Marker.RulesKey, rules);
				foreach (IDnlibDef def in module2.Item2.FindDefinitions())
				{
					this.ApplyRules(context, def, rules, null);
					context.CheckCancellation();
				}
				if (packerParams != null)
				{
					ProtectionParameters.GetParameters(context, module2.Item2)[packer] = packerParams;
				}
			}
			return new MarkerResult((from module in modules
			select module.Item2).ToList<ModuleDefMD>(), packer, extModules);
		}
protected internal virtual MarkerResult MarkProject ( ConfuserProject proj , ConfuserContext context ) { Packer packer = null ; Dictionary < string , string > packerParams = null ; if ( proj . Packer != null ) { if ( ! this . packers . ContainsKey ( proj . Packer . Id ) ) { context . Logger . ErrorFormat ( " " , new object [ ] { proj . Packer . Id } ) ; throw new ConfuserException ( null ) ; } if ( proj . Debug ) { context . Logger . Warn ( " " ) ; } packer = this . packers [ proj . Packer . Id ] ; packerParams = new Dictionary < string , string > ( proj . Packer , StringComparer . OrdinalIgnoreCase ) ; } List < Tuple < ProjectModule , ModuleDefMD > > modules = new List < Tuple < ProjectModule , ModuleDefMD > > ( ) ; List < byte [ ] > extModules = new List < byte [ ] > ( ) ; foreach ( ProjectModule module3 in proj ) { if ( module3 . IsExternal ) { extModules . Add ( module3 . LoadRaw ( proj . BaseDirectory ) ) ; } else { ModuleDefMD modDef = module3 . Resolve ( proj . BaseDirectory , context . Resolver . DefaultModuleContext ) ; context . CheckCancellation ( ) ; if ( proj . Debug ) { modDef . LoadPdb ( ) ; } context . Resolver . AddToCache ( modDef ) ; modules . Add ( Tuple . Create < ProjectModule , ModuleDefMD > ( module3 , modDef ) ) ; } } foreach ( Tuple < ProjectModule , ModuleDefMD > module2 in modules ) { context . Logger . InfoFormat ( " " , new object [ ] { module2 . Item1 . Path } ) ; Dictionary < Rule , PatternExpression > rules = this . ParseRules ( proj , module2 . Item1 , context ) ; context . Annotations . Set < StrongNameKey > ( module2 . Item2 , Marker . SNKey , Marker . LoadSNKey ( context , ( module2 . Item1 . SNKeyPath == null ) ? null : Path . Combine ( proj . BaseDirectory , module2 . Item1 . SNKeyPath ) , module2 . Item1 . SNKeyPassword ) ) ; context . Annotations . Set < Dictionary < Rule , PatternExpression > > ( module2 . Item2 , Marker . RulesKey , rules ) ; foreach ( IDnlibDef def in module2 . Item2 . FindDefinitions ( ) ) { this . ApplyRules ( context , def , rules , null ) ; context . CheckCancellation ( ) ; } if ( packerParams != null ) { ProtectionParameters . GetParameters ( context , module2 . Item2 ) [ packer ] = packerParams ; } } return new MarkerResult ( ( from module in modules select module . Item2 ) . ToList < ModuleDefMD > ( ) , packer , extModules ) ; }
Loads the assembly and marks the project.
Loads the assembly and marks the project .
0x06000193 RID: 403 RVA: 0x0000CFF0 File Offset: 0x0000B1F0
storing the marked modules and packer information.
0x06000193 RID : 403 RVA : 0x0000CFF0 File Offset : 0x0000B1F0 storing the marked modules and packer information .
proj
ConfuserProject
None
context
ConfuserContext
The working context.
The working context .