Skip to content
This repository has been archived by the owner on Jan 27, 2019. It is now read-only.

renaming in random order #372

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Confuser.Renamer/RenamePhase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using Confuser.Core;
using Confuser.Core.Services;
using dnlib.DotNet;

namespace Confuser.Renamer {
Expand All @@ -28,7 +29,12 @@ protected override void Execute(ConfuserContext context, ProtectionParameters pa
}

var pdbDocs = new HashSet<string>();
foreach (IDnlibDef def in parameters.Targets.WithProgress(context.Logger)) {

var rng = context.Registry.GetService<IRandomService>().GetRandomGenerator(Parent.Id);
int randMax = parameters.Targets.Count;
var targets = parameters.Targets.OrderBy(x => rng.NextInt32(randMax)).ToArray().WithProgress(context.Logger);

foreach (IDnlibDef def in targets) {
if (def is ModuleDef && parameters.GetParameter(context, def, "rickroll", false))
RickRoller.CommenceRickroll(context, (ModuleDef)def);

Expand Down Expand Up @@ -101,4 +107,4 @@ protected override void Execute(ConfuserContext context, ProtectionParameters pa
}
}
}
}
}