diff --git a/Confuser.Renamer/NameService.cs b/Confuser.Renamer/NameService.cs index 40224a5..6ce7bae 100644 --- a/Confuser.Renamer/NameService.cs +++ b/Confuser.Renamer/NameService.cs @@ -220,9 +220,11 @@ namespace Confuser.Renamer { if (mode == RenameMode.Empty) return ""; - if (mode == RenameMode.Debug) + if (mode == RenameMode.Debug || mode == RenameMode.Retain) { // When flattening there are issues, in case there is a . in the name of the assembly. - return MakeGenericName("_" + name.Replace('.', '_'), count); + newName = MakeGenericName(name.Replace('.', '_'), count); + return mode == RenameMode.Debug ? "_" + newName : newName; + } if (mode == RenameMode.Reversible) { if (reversibleRenamer == null) throw new ArgumentException("Password not provided for reversible renaming."); diff --git a/Confuser.Renamer/RenameMode.cs b/Confuser.Renamer/RenameMode.cs index 1deb56d..23a1e21 100644 --- a/Confuser.Renamer/RenameMode.cs +++ b/Confuser.Renamer/RenameMode.cs @@ -11,6 +11,10 @@ namespace Confuser.Renamer { Sequential = 0x11, Reversible = 0x12, - Debug = 0x20 + /// Add a underscore to the name to mark that it would be renamed. + Debug = 0x20, + + /// Keep the names as they are. + Retain = Int32.MaxValue } -} \ No newline at end of file +} diff --git a/Tests/123_InheritCustomAttr.Test/InheritCustomAttributeTest.cs b/Tests/123_InheritCustomAttr.Test/InheritCustomAttributeTest.cs index 6d5b815..b27c4f0 100644 --- a/Tests/123_InheritCustomAttr.Test/InheritCustomAttributeTest.cs +++ b/Tests/123_InheritCustomAttr.Test/InheritCustomAttributeTest.cs @@ -71,7 +71,7 @@ namespace _123_InheritCustomAttr.Test { } public static IEnumerable InheritCustomAttributeData() { - foreach (var renameMode in new string[] { nameof(RenameMode.Unicode), nameof(RenameMode.ASCII), nameof(RenameMode.Letters), nameof(RenameMode.Debug) }) + foreach (var renameMode in new string[] { nameof(RenameMode.Unicode), nameof(RenameMode.ASCII), nameof(RenameMode.Letters), nameof(RenameMode.Debug), nameof(RenameMode.Retain) }) foreach (var flatten in new bool[] { true, false }) yield return new object[] { renameMode, flatten }; } diff --git a/Tests/161_DynamicTypeRename.Test/RenameDynamicMethodTest.cs b/Tests/161_DynamicTypeRename.Test/RenameDynamicMethodTest.cs index 7858c3d..78406fa 100644 --- a/Tests/161_DynamicTypeRename.Test/RenameDynamicMethodTest.cs +++ b/Tests/161_DynamicTypeRename.Test/RenameDynamicMethodTest.cs @@ -71,7 +71,7 @@ namespace DynamicTypeRename.Test { } public static IEnumerable RenameDynamicTypeData() { - foreach (var renameMode in new string[] { nameof(RenameMode.Unicode), nameof(RenameMode.ASCII), nameof(RenameMode.Letters), nameof(RenameMode.Debug) }) + foreach (var renameMode in new string[] { nameof(RenameMode.Unicode), nameof(RenameMode.ASCII), nameof(RenameMode.Letters), nameof(RenameMode.Debug), nameof(RenameMode.Retain) }) foreach (var flatten in new bool[] { true, false }) yield return new object[] { renameMode, flatten }; }