From 30aaeecafc12096e3fe7b865520440f54bb9b8b2 Mon Sep 17 00:00:00 2001 From: "Mr. eXoDia" Date: Fri, 22 May 2015 21:17:57 +0200 Subject: [PATCH] dictionary to make sure plugins can override the default deobfuscators --- de4dot.cui/Program.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/de4dot.cui/Program.cs b/de4dot.cui/Program.cs index a92e10cf..ad2bdb47 100644 --- a/de4dot.cui/Program.cs +++ b/de4dot.cui/Program.cs @@ -51,7 +51,7 @@ namespace de4dot.cui { return plugins; } - public static IList GetPlugins(string directory, IList local) { + public static void GetPlugins(string directory, ref Dictionary result) { var plugins = new List(); try { var files = Directory.GetFiles(directory, "deobfuscator.*.dll", SearchOption.TopDirectoryOnly); @@ -60,8 +60,8 @@ namespace de4dot.cui { } catch { } - plugins.AddRange(local); - return plugins; + foreach(var p in plugins) + result[p.Type] = p; } static IList CreateDeobfuscatorInfos() { @@ -88,8 +88,12 @@ namespace de4dot.cui { new de4dot.code.deobfuscators.Spices_Net.DeobfuscatorInfo(), new de4dot.code.deobfuscators.Xenocode.DeobfuscatorInfo(), }; + var dict = new Dictionary(); + foreach (var d in local) + dict[d.Type] = d; string pluginDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin"); - return GetPlugins(pluginDir, local); + GetPlugins(pluginDir, ref dict); + return new List(dict.Values); } public static int Main(string[] args) {