Skip to content

Commit c890466

Browse files
committed
Add idOffset parameter
1 parent ef61ef1 commit c890466

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

Confuser.Renamer/AnalyzePhase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ internal void Analyze(NameService service, ConfuserContext context, ProtectionPa
118118
var pass = parameters.GetParameter<string>(context, def, "password", null);
119119
if (pass != null)
120120
service.reversibleRenamer = new ReversibleRenamer(pass);
121+
122+
var idOffset = parameters.GetParameter<uint>(context, def, "idOffset", 0);
123+
if (idOffset != 0)
124+
service.SetNameId(idOffset);
125+
121126
service.SetCanRename(def, false);
122127
}
123128

Confuser.Renamer/NameService.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ public void Analyze(IDnlibDef def) {
145145
analyze.Analyze(this, context, ProtectionParameters.Empty, def, true);
146146
}
147147

148+
public void SetNameId(uint id) {
149+
for (int i = nameId.Length - 1; i >= 0; i--) {
150+
nameId[i] = (byte)(id & 0xff);
151+
id >>= 8;
152+
}
153+
}
154+
148155
void IncrementNameId() {
149156
for (int i = nameId.Length - 1; i >= 0; i--) {
150157
nameId[i]++;

0 commit comments

Comments
 (0)