Refactor solution layout

This commit is contained in:
Katy Coe
2020-02-06 02:51:42 +01:00
parent 66b8e30586
commit e971cb8502
49 changed files with 72 additions and 50 deletions

View File

@@ -12,12 +12,12 @@
<Company>Noisy Cow Studios</Company> <Company>Noisy Cow Studios</Company>
<Product>Il2CppInspector Command-Line Edition</Product> <Product>Il2CppInspector Command-Line Edition</Product>
<Copyright>(c) 2017-2020 Katy Coe - www.djkaty.com - www.github.com/djkaty</Copyright> <Copyright>(c) 2017-2020 Katy Coe - www.djkaty.com - www.github.com/djkaty</Copyright>
<PackageId>Il2CppDumper</PackageId> <PackageId>Il2CppInspector.CLI</PackageId>
<Authors>Katy Coe</Authors> <Authors>Katy Coe</Authors>
<AssemblyName>Il2CppInspector</AssemblyName>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Il2CppInspector\Il2CppInspector.csproj" />
<DotNetCliToolReference Include="Microsoft.NETCore.Runtime.CoreCLR" Version="2.0.0" /> <DotNetCliToolReference Include="Microsoft.NETCore.Runtime.CoreCLR" Version="2.0.0" />
<DotNetCliToolReference Include="Microsoft.NETCore.DotNetHostPolicy" Version="2.0.0" /> <DotNetCliToolReference Include="Microsoft.NETCore.DotNetHostPolicy" Version="2.0.0" />
</ItemGroup> </ItemGroup>
@@ -27,18 +27,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Properties\Resources.Designer.cs"> <ProjectReference Include="..\Il2CppInspector.Common\Il2CppInspector.csproj" />
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -9,8 +9,9 @@ using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using CommandLine; using CommandLine;
using Il2CppInspector.Reflection; using Il2CppInspector.Reflection;
using Il2CppInspector.Outputs;
namespace Il2CppInspector namespace Il2CppInspector.CLI
{ {
public class App public class App
{ {
@@ -163,7 +164,7 @@ namespace Il2CppInspector
// C# signatures output // C# signatures output
using (var signaturesDumperTimer = new Benchmark("Generate C# code")) { using (var signaturesDumperTimer = new Benchmark("Generate C# code")) {
var writer = new Il2CppCSharpDumper(model) { var writer = new CSharpCodeStubs(model) {
ExcludedNamespaces = options.ExcludedNamespaces.ToList(), ExcludedNamespaces = options.ExcludedNamespaces.ToList(),
SuppressMetadata = options.SuppressMetadata, SuppressMetadata = options.SuppressMetadata,
MustCompile = options.MustCompile MustCompile = options.MustCompile
@@ -215,7 +216,7 @@ namespace Il2CppInspector
// IDA Python script output // IDA Python script output
using (var scriptDumperTimer = new Benchmark("IDA Python Script Dumper")) { using (var scriptDumperTimer = new Benchmark("IDA Python Script Dumper")) {
var idaWriter = new Il2CppIDAScriptDumper(model); var idaWriter = new IDAPythonScript(model);
idaWriter.WriteScriptToFile(options.PythonOutFile); idaWriter.WriteScriptToFile(options.PythonOutFile);
} }
} }

View File

@@ -0,0 +1,8 @@
{
"profiles": {
"Il2CppDumper": {
"commandName": "Project",
"commandLineArgs": "--bin f:\\source\\repos\\il2cppinspector\\il2cpptests\\testbinaries\\hearthstone-ios-15.6.35747\\hearthstone-ios-15.6.35747 --metadata f:\\source\\repos\\il2cppinspector\\il2cpptests\\testbinaries\\hearthstone-ios-15.6.35747\\global-metadata.dat -c f:\\source\\repos\\il2cppinspector\\il2cpptests\\testbinaries\\hearthstone-ios-15.6.35747\\project -p f:\\source\\repos\\il2cppinspector\\il2cpptests\\testbinaries\\Hearthstone-ios-15.6.35747\\ida.py -j -n"
}
}
}

View File

@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>Il2CppInspector.Common</AssemblyName>
<Authors>Katy Coe</Authors>
<Version>2.0</Version>
<Company>Noisy Cow Studios</Company>
<Product>Il2CppInspector Shared Library</Product>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bin2Object\Bin2Object\Bin2Object.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@@ -3,25 +3,22 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.InteropServices.ComTypes;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using Il2CppDumper.Properties; using Il2CppInspector.Properties;
using Il2CppInspector.Reflection; using Il2CppInspector.Reflection;
using Assembly = Il2CppInspector.Reflection.Assembly; using Assembly = Il2CppInspector.Reflection.Assembly;
using CustomAttributeData = Il2CppInspector.Reflection.CustomAttributeData; using CustomAttributeData = Il2CppInspector.Reflection.CustomAttributeData;
using MethodInfo = Il2CppInspector.Reflection.MethodInfo; using MethodInfo = Il2CppInspector.Reflection.MethodInfo;
using TypeInfo = Il2CppInspector.Reflection.TypeInfo; using TypeInfo = Il2CppInspector.Reflection.TypeInfo;
namespace Il2CppInspector namespace Il2CppInspector.Outputs
{ {
public class Il2CppCSharpDumper public class CSharpCodeStubs
{ {
private readonly Il2CppModel model; private readonly Il2CppModel model;
@@ -43,7 +40,7 @@ namespace Il2CppInspector
private HashSet<CustomAttributeData> usedAssemblyAttributes = new HashSet<CustomAttributeData>(); private HashSet<CustomAttributeData> usedAssemblyAttributes = new HashSet<CustomAttributeData>();
private readonly object usedAssemblyAttributesLock = new object(); private readonly object usedAssemblyAttributesLock = new object();
public Il2CppCSharpDumper(Il2CppModel model) => this.model = model; public CSharpCodeStubs(Il2CppModel model) => this.model = model;
public void WriteSingleFile(string outFile) => WriteSingleFile(outFile, t => t.Index); public void WriteSingleFile(string outFile) => WriteSingleFile(outFile, t => t.Index);

View File

@@ -9,14 +9,14 @@ using System.IO;
using System.Text; using System.Text;
using Il2CppInspector.Reflection; using Il2CppInspector.Reflection;
namespace Il2CppInspector namespace Il2CppInspector.Outputs
{ {
public class Il2CppIDAScriptDumper public class IDAPythonScript
{ {
private readonly Il2CppModel model; private readonly Il2CppModel model;
private StreamWriter writer; private StreamWriter writer;
public Il2CppIDAScriptDumper(Il2CppModel model) => this.model = model; public IDAPythonScript(Il2CppModel model) => this.model = model;
public void WriteScriptToFile(string outputFile) { public void WriteScriptToFile(string outputFile) {
using var fs = new FileStream(outputFile, FileMode.Create); using var fs = new FileStream(outputFile, FileMode.Create);

View File

@@ -8,7 +8,7 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Il2CppDumper.Properties { namespace Il2CppInspector.Properties {
using System; using System;
@@ -39,7 +39,7 @@ namespace Il2CppDumper.Properties {
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Il2CppDumper.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Il2CppInspector.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
@@ -69,10 +69,10 @@ namespace Il2CppDumper.Properties {
/// &lt;PropertyGroup&gt; /// &lt;PropertyGroup&gt;
/// &lt;Configuration Condition=&quot; &apos;$(Configuration)&apos; == &apos;&apos; &quot;&gt;Debug&lt;/Configuration&gt; /// &lt;Configuration Condition=&quot; &apos;$(Configuration)&apos; == &apos;&apos; &quot;&gt;Debug&lt;/Configuration&gt;
/// &lt;Platform Condition=&quot; &apos;$(Platform)&apos; == &apos;&apos; &quot;&gt;AnyCPU&lt;/Platform&gt; /// &lt;Platform Condition=&quot; &apos;$(Platform)&apos; == &apos;&apos; &quot;&gt;AnyCPU&lt;/Platform&gt;
/// &lt;ProjectGuid&gt;%PROJECTGUID%&lt;/ProjectGuid&gt; /// &lt;ProjectGuid&gt;{%PROJECTGUID%}&lt;/ProjectGuid&gt;
/// &lt;!--&lt;ProductVersion/&gt;--&gt; /// &lt;!--&lt;ProductVersion/&gt;--&gt;
/// &lt;!--&lt;SchemaVersion/&gt;--&gt; /// &lt;!--&lt;SchemaVersion/&gt;--&gt;
/// &lt;Outp [rest of string was truncated]&quot;;. /// &lt;OutputType&gt;Li [rest of string was truncated]&quot;;.
/// </summary> /// </summary>
internal static string CsProjTemplate { internal static string CsProjTemplate {
get { get {

View File

@@ -5,11 +5,17 @@ VisualStudioVersion = 16.0.29409.12
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bin2Object", "Bin2Object\Bin2Object\Bin2Object.csproj", "{55382D6C-01B6-4AFD-850C-7A79DAB6F270}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bin2Object", "Bin2Object\Bin2Object\Bin2Object.csproj", "{55382D6C-01B6-4AFD-850C-7A79DAB6F270}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Il2CppInspector", "Il2CppInspector\Il2CppInspector.csproj", "{E4721466-CC6F-47EB-AD48-F4DE70D77E5C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Il2CppInspector", "Il2CppInspector.Common\Il2CppInspector.csproj", "{E4721466-CC6F-47EB-AD48-F4DE70D77E5C}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Il2CppDumper", "Il2CppDumper\Il2CppDumper.csproj", "{EA4C27DF-4640-48DF-8CAF-5587884CAF30}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Il2CppInspector.CLI", "Il2CppInspector.CLI\Il2CppInspector.CLI.csproj", "{EA4C27DF-4640-48DF-8CAF-5587884CAF30}"
ProjectSection(ProjectDependencies) = postProject
{E4721466-CC6F-47EB-AD48-F4DE70D77E5C} = {E4721466-CC6F-47EB-AD48-F4DE70D77E5C}
EndProjectSection
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Il2CppTests", "Il2CppTests\Il2CppTests.csproj", "{389E4BDF-A749-4554-848B-32B3B6EE5684}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Il2CppTests", "Il2CppTests\Il2CppTests.csproj", "{389E4BDF-A749-4554-848B-32B3B6EE5684}"
ProjectSection(ProjectDependencies) = postProject
{E4721466-CC6F-47EB-AD48-F4DE70D77E5C} = {E4721466-CC6F-47EB-AD48-F4DE70D77E5C}
EndProjectSection
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{46226B08-22BA-455E-8B99-F496E90EDCBC}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{46226B08-22BA-455E-8B99-F496E90EDCBC}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject

View File

@@ -1,15 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bin2Object\Bin2Object\Bin2Object.csproj" />
</ItemGroup>
</Project>

View File

@@ -78,7 +78,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Il2CppDumper\Il2CppDumper.csproj" /> <ProjectReference Include="..\Il2CppInspector.Common\Il2CppInspector.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Il2CppInspector.Reflection; using Il2CppInspector.Reflection;
using Il2CppInspector.Outputs;
using NUnit.Framework; using NUnit.Framework;
namespace Il2CppInspector namespace Il2CppInspector
@@ -57,7 +58,7 @@ namespace Il2CppInspector
// Dump each image in the binary separately // Dump each image in the binary separately
int i = 0; int i = 0;
foreach (var il2cpp in inspectors) foreach (var il2cpp in inspectors)
new Il2CppCSharpDumper(new Il2CppModel(il2cpp)) { new CSharpCodeStubs(new Il2CppModel(il2cpp)) {
ExcludedNamespaces = excludedNamespaces, ExcludedNamespaces = excludedNamespaces,
SuppressMetadata = false, SuppressMetadata = false,
MustCompile = true MustCompile = true