Fix #183
This commit is contained in:
yck1509 2015-03-01 01:25:43 +08:00
Родитель 209f52f0ce
Коммит 92fe49a767
11 изменённых файлов: 28 добавлений и 28 удалений

Просмотреть файл

@ -101,7 +101,7 @@ namespace Confuser.Renamer {
return;
foreach (IRenamer renamer in service.Renamers)
renamer.Analyze(context, service, def);
renamer.Analyze(context, service, parameters, def);
}
void Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, TypeDef type) {

Просмотреть файл

@ -9,7 +9,7 @@ namespace Confuser.Renamer.Analyzers {
wpfAnalyzer.AnalyzeBAMLElement += AnalyzeBAMLElement;
}
public void Analyze(ConfuserContext context, INameService service, IDnlibDef def) {
public void Analyze(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
var type = def as TypeDef;
if (type == null || type.DeclaringType != null)
return;
@ -105,11 +105,11 @@ namespace Confuser.Renamer.Analyzers {
}
public void PreRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PreRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
//
}
public void PostRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PostRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
//
}
}

Просмотреть файл

@ -8,7 +8,7 @@ namespace Confuser.Renamer.Analyzers {
internal class InterReferenceAnalyzer : IRenamer {
// i.e. Inter-Assembly References, e.g. InternalVisibleToAttributes
public void Analyze(ConfuserContext context, INameService service, IDnlibDef def) {
public void Analyze(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
var module = def as ModuleDefMD;
if (module == null) return;
@ -44,11 +44,11 @@ namespace Confuser.Renamer.Analyzers {
}
}
public void PreRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PreRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
//
}
public void PostRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PostRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
//
}
}

Просмотреть файл

@ -6,7 +6,7 @@ using dnlib.DotNet.Emit;
namespace Confuser.Renamer.Analyzers {
internal class LdtokenEnumAnalyzer : IRenamer {
public void Analyze(ConfuserContext context, INameService service, IDnlibDef def) {
public void Analyze(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
var method = def as MethodDef;
if (method == null || !method.HasBody)
return;
@ -59,11 +59,11 @@ namespace Confuser.Renamer.Analyzers {
}
}
public void PreRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PreRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
//
}
public void PostRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PostRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
//
}

Просмотреть файл

@ -9,7 +9,7 @@ namespace Confuser.Renamer.Analyzers {
internal class ResourceAnalyzer : IRenamer {
static readonly Regex ResourceNamePattern = new Regex("^(.*)\\.resources$");
public void Analyze(ConfuserContext context, INameService service, IDnlibDef def) {
public void Analyze(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
var module = def as ModuleDef;
if (module == null) return;
@ -60,11 +60,11 @@ namespace Confuser.Renamer.Analyzers {
}
}
public void PreRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PreRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
//
}
public void PostRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PostRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
//
}
}

Просмотреть файл

@ -10,7 +10,7 @@ using dnlib.DotNet.MD;
namespace Confuser.Renamer.Analyzers {
internal class TypeBlobAnalyzer : IRenamer {
public void Analyze(ConfuserContext context, INameService service, IDnlibDef def) {
public void Analyze(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
var module = def as ModuleDefMD;
if (module == null) return;
@ -84,11 +84,11 @@ namespace Confuser.Renamer.Analyzers {
}
}
public void PreRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PreRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
//
}
public void PostRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PostRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
//
}

Просмотреть файл

@ -7,7 +7,7 @@ using dnlib.DotNet;
namespace Confuser.Renamer.Analyzers {
internal class VTableAnalyzer : IRenamer {
public void Analyze(ConfuserContext context, INameService service, IDnlibDef def) {
public void Analyze(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
VTable vTbl;
if (def is TypeDef) {
@ -56,11 +56,11 @@ namespace Confuser.Renamer.Analyzers {
}
}
public void PreRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PreRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
//
}
public void PostRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PostRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
var method = def as MethodDef;
if (method == null || !method.IsVirtual || method.Overrides.Count == 0)
return;

Просмотреть файл

@ -23,7 +23,7 @@ namespace Confuser.Renamer.Analyzers {
internal Dictionary<string, List<IBAMLReference>> bamlRefs = new Dictionary<string, List<IBAMLReference>>(StringComparer.OrdinalIgnoreCase);
public event Action<BAMLAnalyzer, BamlElement> AnalyzeBAMLElement;
public void Analyze(ConfuserContext context, INameService service, IDnlibDef def) {
public void Analyze(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
var method = def as MethodDef;
if (method != null) {
if (!method.HasBody)
@ -37,9 +37,9 @@ namespace Confuser.Renamer.Analyzers {
}
}
public void PreRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PreRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
var module = def as ModuleDefMD;
if (module == null)
if (module == null || !parameters.GetParameter<bool>(context, def, "renXaml", true))
return;
var wpfResInfo = context.Annotations.Get<Dictionary<string, Dictionary<string, BamlDocument>>>(module, BAMLKey);
@ -63,7 +63,7 @@ namespace Confuser.Renamer.Analyzers {
}
}
public void PostRename(ConfuserContext context, INameService service, IDnlibDef def) {
public void PostRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def) {
var module = def as ModuleDefMD;
if (module == null)
return;

Просмотреть файл

@ -4,8 +4,8 @@ using dnlib.DotNet;
namespace Confuser.Renamer {
public interface IRenamer {
void Analyze(ConfuserContext context, INameService service, IDnlibDef def);
void PreRename(ConfuserContext context, INameService service, IDnlibDef def);
void PostRename(ConfuserContext context, INameService service, IDnlibDef def);
void Analyze(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def);
void PreRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def);
void PostRename(ConfuserContext context, INameService service, ProtectionParameters parameters, IDnlibDef def);
}
}

Просмотреть файл

@ -24,7 +24,7 @@ namespace Confuser.Renamer {
foreach (IRenamer renamer in service.Renamers) {
foreach (IDnlibDef def in parameters.Targets)
renamer.PostRename(context, service, def);
renamer.PostRename(context, service, parameters, def);
context.CheckCancellation();
}
}

Просмотреть файл

@ -23,7 +23,7 @@ namespace Confuser.Renamer {
context.Logger.Debug("Renaming...");
foreach (IRenamer renamer in service.Renamers) {
foreach (IDnlibDef def in parameters.Targets)
renamer.PreRename(context, service, def);
renamer.PreRename(context, service, parameters, def);
context.CheckCancellation();
}