yck1509 / ConfuserEx

An open-source, free protector for .NET applications
http://yck1509.github.io/ConfuserEx/
Other
3.57k stars 1.64k forks source link

Exclude namespace with all secondary namespaces #442

Open ab-tools opened 8 years ago

ab-tools commented 8 years ago

Using the latest source code version I try to exclude a certain namespace with all secondary namespaces from obfuscation.

I do have this as main obfuscation attribute: [assembly: Obfuscation(Exclude = false, Feature = "1. anti debug;anti ildasm;constants(elements=SNPI);rename(mode=sequential)")]

Then I tried something like this: [assembly: Obfuscation(Exclude = true, ApplyToMembers = true, Feature = "2. namespace('NamespaceToExclude')")] Or this: [assembly: Obfuscation(Exclude = true, ApplyToMembers = true, Feature = "2. match('^AqlaSerializer.')")]

But either it does not work at all or it just excludes the type names, but not their members although I use ApplyToMembers = true.

Also the Wiki documentation syntax "namespace 'Test':-rename" seems not to work anymore at all (throws exception).

Seems like a simple task to just exclude a namespace with everything (other namespaces, types, members) below it, but I does not seem to get this to work...

Thanks in advance for your support again! Andreas

yck1509 commented 8 years ago

Hi, The syntax you're looking for is "2. namespace('NamespaceToExclude'):-rename". Since now ConfuserEx supports patterns in ObfuscationAttribute, the old syntax of excluding namespace is removed. The wiki would be updated once I released a new version.

ab-tools commented 8 years ago

Thanks for your reply, but I also tried the syntax you mention already.

But the problem is that using that only the 'NamespaceToExclude' is excluded itself, but not all subsidiary namespaces below that. As there are a lot of them involved I really don't want to exclude all of them individually.

I tried it also with ApplyToMembers, but that seemed not to help either.

How can I exclude a namespace with all subsidiary namespaces?

yck1509 commented 8 years ago

Hi, In the latest commit I've add the ability to use regex in namespace pattern. You can use it the do what you want.