Add option to disable creating new ParamDefs when renaming
This commit is contained in:
parent
b3e06c4ce6
commit
dcdbe25a0f
|
@ -39,6 +39,7 @@ namespace de4dot.code.renamer {
|
||||||
public bool RestorePropertiesFromNames { get; set; }
|
public bool RestorePropertiesFromNames { get; set; }
|
||||||
public bool RestoreEvents { get; set; }
|
public bool RestoreEvents { get; set; }
|
||||||
public bool RestoreEventsFromNames { get; set; }
|
public bool RestoreEventsFromNames { get; set; }
|
||||||
|
public bool DontCreateNewParamDefs { get; set; }
|
||||||
|
|
||||||
Modules modules;
|
Modules modules;
|
||||||
MemberInfos memberInfos = new MemberInfos();
|
MemberInfos memberInfos = new MemberInfos();
|
||||||
|
@ -321,7 +322,11 @@ namespace de4dot.code.renamer {
|
||||||
var paramInfo = memberInfos.param(param);
|
var paramInfo = memberInfos.param(param);
|
||||||
if (!paramInfo.gotNewName())
|
if (!paramInfo.gotNewName())
|
||||||
continue;
|
continue;
|
||||||
param.ParameterDef.CreateParamDef();
|
if (!param.ParameterDef.HasParamDef) {
|
||||||
|
if (DontCreateNewParamDefs)
|
||||||
|
continue;
|
||||||
|
param.ParameterDef.CreateParamDef();
|
||||||
|
}
|
||||||
param.ParameterDef.Name = paramInfo.newName;
|
param.ParameterDef.Name = paramInfo.newName;
|
||||||
if (isVerbose) {
|
if (isVerbose) {
|
||||||
if (param.IsReturnParameter)
|
if (param.IsReturnParameter)
|
||||||
|
|
|
@ -135,6 +135,9 @@ namespace de4dot.cui {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
miscOptions.Add(new NoArgOption(null, "dont-create-params", "Don't create method params when renaming", () => {
|
||||||
|
filesOptions.DontCreateNewParamDefs = true;
|
||||||
|
}));
|
||||||
miscOptions.Add(new NoArgOption(null, "dont-restore-props", "Don't restore properties/events", () => {
|
miscOptions.Add(new NoArgOption(null, "dont-restore-props", "Don't restore properties/events", () => {
|
||||||
filesOptions.RestorePropsEvents = false;
|
filesOptions.RestorePropsEvents = false;
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace de4dot.cui {
|
||||||
public IList<IObfuscatedFile> Files { get; set; }
|
public IList<IObfuscatedFile> Files { get; set; }
|
||||||
public IList<SearchDir> SearchDirs { get; set; }
|
public IList<SearchDir> SearchDirs { get; set; }
|
||||||
public bool DetectObfuscators { get; set; }
|
public bool DetectObfuscators { get; set; }
|
||||||
|
public bool DontCreateNewParamDefs { get; set; }
|
||||||
public bool RenameNamespaces { get; set; }
|
public bool RenameNamespaces { get; set; }
|
||||||
public bool RenameTypes { get; set; }
|
public bool RenameTypes { get; set; }
|
||||||
public bool RenameProperties { get; set; }
|
public bool RenameProperties { get; set; }
|
||||||
|
@ -385,6 +386,7 @@ namespace de4dot.cui {
|
||||||
if (!options.RenameSymbols)
|
if (!options.RenameSymbols)
|
||||||
return;
|
return;
|
||||||
var renamer = new Renamer(deobfuscatorContext, theFiles) {
|
var renamer = new Renamer(deobfuscatorContext, theFiles) {
|
||||||
|
DontCreateNewParamDefs = options.DontCreateNewParamDefs,
|
||||||
RenameNamespaces = options.RenameNamespaces,
|
RenameNamespaces = options.RenameNamespaces,
|
||||||
RenameTypes = options.RenameTypes,
|
RenameTypes = options.RenameTypes,
|
||||||
RenameProperties = options.RenameProperties,
|
RenameProperties = options.RenameProperties,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user