forked from yck1509/ConfuserEx
-
-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #470 Improved handling of sibling interfaces * Merged redundant linq calls
- Loading branch information
Showing
15 changed files
with
190 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Tests/470_ImplementationInBaseClass.Test/470_ImplementationInBaseClass.Test.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net461</TargetFramework> | ||
<RootNamespace>ImplementationInBaseClass.Test</RootNamespace> | ||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Confuser.UnitTest\Confuser.UnitTest.csproj" /> | ||
<ProjectReference Include="..\470_ImplementationInBaseClass\470_ImplementationInBaseClass.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Confuser.Core; | ||
using Confuser.Core.Project; | ||
using Confuser.Renamer; | ||
using Confuser.UnitTest; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace ImplementationInBaseClass.Test | ||
{ | ||
public class RenameTest : TestBase | ||
{ | ||
public RenameTest(ITestOutputHelper outputHelper) : base(outputHelper) { } | ||
|
||
[Theory] | ||
[MemberData(nameof(ResolveNameData))] | ||
[Trait("Category", "Protection")] | ||
[Trait("Protection", "rename")] | ||
[Trait("Issue", "https://github.com/mkaring/ConfuserEx/issues/470")] | ||
public async Task ResolveNameLoop(RenameMode mode, bool flatten) => | ||
await Run( | ||
new[] { | ||
"470_ImplementationInBaseClass.exe" | ||
}, | ||
new[] { | ||
"Called MyMethod", | ||
"Called MyMethod", | ||
"Called MyMethod", | ||
"Called MyMethod" | ||
}, | ||
new SettingItem<Protection>("rename") { | ||
{ "mode", mode.ToString() }, | ||
{ "renPublic", "true" }, | ||
{ "flatten", flatten.ToString() } | ||
}, | ||
$"_{mode}_{flatten}" | ||
); | ||
|
||
public static IEnumerable<object[]> ResolveNameData() { | ||
foreach (var renameMode in new[] { RenameMode.Unicode, RenameMode.Sequential }) | ||
foreach (var flatten in new[] { true, false }) | ||
yield return new object[] { renameMode, flatten }; | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
Tests/470_ImplementationInBaseClass/470_ImplementationInBaseClass.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net461</TargetFramework> | ||
<RootNamespace>ImplementationInBaseClass</RootNamespace> | ||
<LangVersion>7.3</LangVersion> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace ImplementationInBaseClass { | ||
public interface IMyInterfaceA { | ||
void MyMethod(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace ImplementationInBaseClass { | ||
public interface IMyInterfaceB { | ||
void MyMethod(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace ImplementationInBaseClass { | ||
public interface IMyInterfaceC { | ||
void MyMethod(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using System; | ||
|
||
namespace ImplementationInBaseClass { | ||
internal abstract class MyBaseClass { | ||
public void MyMethod() => Console.WriteLine("Called " + nameof(MyMethod)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace ImplementationInBaseClass { | ||
internal class MyClassA : MyBaseClass, IMyInterfaceA { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace ImplementationInBaseClass { | ||
internal class MyClassB : MyBaseClass, IMyInterfaceB { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace ImplementationInBaseClass { | ||
internal class MyClassB2 : MyBaseClass, IMyInterfaceB { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace ImplementationInBaseClass { | ||
internal class MyClassC : MyBaseClass, IMyInterfaceC { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
|
||
namespace ImplementationInBaseClass { | ||
internal class Program { | ||
internal static int Main(string[] args) { | ||
Console.WriteLine("START"); | ||
|
||
var classA = new MyClassA(); | ||
classA.MyMethod(); | ||
|
||
var classB = new MyClassB(); | ||
classB.MyMethod(); | ||
|
||
var classB2 = new MyClassB2(); | ||
classB2.MyMethod(); | ||
|
||
var classC = new MyClassC(); | ||
classC.MyMethod(); | ||
|
||
Console.WriteLine("END"); | ||
return 42; | ||
} | ||
} | ||
} |