Add new rename mode for not changing the name (#170)
* Add rename mode to keep the names the same * Added new rename mode to unit test
This commit is contained in:
Родитель
039726eb7b
Коммит
9d089178ec
|
@ -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.");
|
||||
|
|
|
@ -11,6 +11,10 @@ namespace Confuser.Renamer {
|
|||
Sequential = 0x11,
|
||||
Reversible = 0x12,
|
||||
|
||||
Debug = 0x20
|
||||
/// <summary>Add a underscore to the name to mark that it would be renamed.</summary>
|
||||
Debug = 0x20,
|
||||
|
||||
/// <summary>Keep the names as they are.</summary>
|
||||
Retain = Int32.MaxValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace _123_InheritCustomAttr.Test {
|
|||
}
|
||||
|
||||
public static IEnumerable<object[]> 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 };
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace DynamicTypeRename.Test {
|
|||
}
|
||||
|
||||
public static IEnumerable<object[]> 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 };
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче