From ae26ee5d6215e0260df8a3179859415b88c7886d Mon Sep 17 00:00:00 2001 From: artman41 Date: Thu, 17 May 2018 01:15:23 +0100 Subject: [PATCH] removed `Launcher` from remote` --- IPA.Tests/ProgramTest.cs | 78 +- IPA.sln | 90 +- IPA/IPA.csproj | 192 ++--- IPA/PatchContext.cs | 116 +-- IPA/Patcher/Patcher.cs | 206 ++--- IPA/Program.cs | 774 +++++++++--------- IPA/Properties/AssemblyInfo.cs | 72 +- .../Debug/IPA.csproj.CoreCompileInputs.cache | 2 +- IllusionInjector/CompositePlugin.cs | 268 +++--- IllusionInjector/IllusionInjector.csproj | 136 +-- IllusionInjector/PluginComponent.cs | 192 ++--- IllusionInjector/PluginManager.cs | 308 +++---- ...ionInjector.csproj.CoreCompileInputs.cache | 2 +- IllusionPlugin/IPlugin.cs | 100 +-- IllusionPlugin/IllusionPlugin.csproj | 118 +-- IllusionPlugin/IniFile.cs | 202 ++--- IllusionPlugin/ModPrefs.cs | 334 ++++---- ...usionPlugin.csproj.CoreCompileInputs.cache | 2 +- Launcher/Launcher.csproj | 91 -- Launcher/Program.cs | 100 --- Launcher/Properties/AssemblyInfo.cs | 36 - Launcher/Properties/Resources.Designer.cs | 63 -- Launcher/Properties/Resources.resx | 117 --- Launcher/Properties/Settings.Designer.cs | 26 - Launcher/Properties/Settings.settings | 7 - Launcher/Resources.Designer.cs | 63 -- Launcher/Resources.resx | 121 --- .../Launcher.csproj.CoreCompileInputs.cache | 1 - Launcher/packages.config | 4 - Launcher/syringe.ico | Bin 32988 -> 0 bytes 30 files changed, 1596 insertions(+), 2225 deletions(-) delete mode 100644 Launcher/Launcher.csproj delete mode 100644 Launcher/Program.cs delete mode 100644 Launcher/Properties/AssemblyInfo.cs delete mode 100644 Launcher/Properties/Resources.Designer.cs delete mode 100644 Launcher/Properties/Resources.resx delete mode 100644 Launcher/Properties/Settings.Designer.cs delete mode 100644 Launcher/Properties/Settings.settings delete mode 100644 Launcher/Resources.Designer.cs delete mode 100644 Launcher/Resources.resx delete mode 100644 Launcher/obj/Debug/Launcher.csproj.CoreCompileInputs.cache delete mode 100644 Launcher/packages.config delete mode 100644 Launcher/syringe.ico diff --git a/IPA.Tests/ProgramTest.cs b/IPA.Tests/ProgramTest.cs index 902199ce..15716a23 100644 --- a/IPA.Tests/ProgramTest.cs +++ b/IPA.Tests/ProgramTest.cs @@ -1,39 +1,39 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Xunit; - -namespace IPA.Tests -{ - public class ProgramTest - { - [Theory] - // Unrelated path - [InlineData("test/from.dll", "test/to.dll", "native", false, new string[] { "test/to.dll" })] - - // Flat -> Not-Flat - [InlineData("native/from.dll", "native/to.dll", "native", false, new string[] { "native/x86/to.dll", "native/x86_64/to.dll" })] - - // Flat -> Flat - [InlineData("native/from.dll", "native/to.dll", "native", true, new string[] { "native/to.dll" })] - - // Not-Flat -> Flat - [InlineData("native/x86/from.dll", "native/x86/to.dll", "native", true, new string[] { })] - [InlineData("native/x86_64/from.dll", "native/x86_64/to.dll", "native", true, new string[] { "native/to.dll" })] - - // Not-flat -> Not-Flat - [InlineData("native/x86/from.dll", "native/x86/to.dll", "native", false, new string[] { "native/x86/to.dll" })] - [InlineData("native/x86_64/from.dll", "native/x86_64/to.dll", "native", false, new string[] { "native/x86_64/to.dll" })] - - public void CopiesCorrectly(string from, string to, string nativeFolder, bool isFlat, string[] expected) - { - var outcome = Program.NativePluginInterceptor(new FileInfo(from), new FileInfo(to), new DirectoryInfo(nativeFolder), isFlat, Program.Architecture.Unknown).Select(f => f.FullName).ToList(); - - var expectedPaths = expected.Select(e => new FileInfo(e)).Select(f => f.FullName).ToList(); - Assert.Equal(expectedPaths, outcome); - } - } -} +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace IPA.Tests +{ + public class ProgramTest + { + [Theory] + // Unrelated path + [InlineData("test/from.dll", "test/to.dll", "native", false, new string[] { "test/to.dll" })] + + // Flat -> Not-Flat + [InlineData("native/from.dll", "native/to.dll", "native", false, new string[] { "native/x86/to.dll", "native/x86_64/to.dll" })] + + // Flat -> Flat + [InlineData("native/from.dll", "native/to.dll", "native", true, new string[] { "native/to.dll" })] + + // Not-Flat -> Flat + [InlineData("native/x86/from.dll", "native/x86/to.dll", "native", true, new string[] { })] + [InlineData("native/x86_64/from.dll", "native/x86_64/to.dll", "native", true, new string[] { "native/to.dll" })] + + // Not-flat -> Not-Flat + [InlineData("native/x86/from.dll", "native/x86/to.dll", "native", false, new string[] { "native/x86/to.dll" })] + [InlineData("native/x86_64/from.dll", "native/x86_64/to.dll", "native", false, new string[] { "native/x86_64/to.dll" })] + + public void CopiesCorrectly(string from, string to, string nativeFolder, bool isFlat, string[] expected) + { + var outcome = Program.NativePluginInterceptor(new FileInfo(from), new FileInfo(to), new DirectoryInfo(nativeFolder), isFlat, Program.Architecture.Unknown).Select(f => f.FullName).ToList(); + + var expectedPaths = expected.Select(e => new FileInfo(e)).Select(f => f.FullName).ToList(); + Assert.Equal(expectedPaths, outcome); + } + } +} diff --git a/IPA.sln b/IPA.sln index 571cd9ff..4ada6d21 100644 --- a/IPA.sln +++ b/IPA.sln @@ -1,45 +1,45 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA", "IPA\IPA.csproj", "{14092533-98BB-40A4-9AFC-27BB75672A70}" - ProjectSection(ProjectDependencies) = postProject - {D1390268-F68B-4A55-B50D-EAD25756C8EF} = {D1390268-F68B-4A55-B50D-EAD25756C8EF} - {D1C61AF5-0D2D-4752-8203-1C6929025F7C} = {D1C61AF5-0D2D-4752-8203-1C6929025F7C} - {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71} = {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IllusionPlugin", "IllusionPlugin\IllusionPlugin.csproj", "{E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IllusionInjector", "IllusionInjector\IllusionInjector.csproj", "{D1C61AF5-0D2D-4752-8203-1C6929025F7C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA.Tests", "IPA.Tests\IPA.Tests.csproj", "{C66092B0-5C1E-44E9-B524-E0E8E1425379}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {14092533-98BB-40A4-9AFC-27BB75672A70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {14092533-98BB-40A4-9AFC-27BB75672A70}.Debug|Any CPU.Build.0 = Debug|Any CPU - {14092533-98BB-40A4-9AFC-27BB75672A70}.Release|Any CPU.ActiveCfg = Release|Any CPU - {14092533-98BB-40A4-9AFC-27BB75672A70}.Release|Any CPU.Build.0 = Release|Any CPU - {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}.Release|Any CPU.Build.0 = Release|Any CPU - {D1C61AF5-0D2D-4752-8203-1C6929025F7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D1C61AF5-0D2D-4752-8203-1C6929025F7C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D1C61AF5-0D2D-4752-8203-1C6929025F7C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D1C61AF5-0D2D-4752-8203-1C6929025F7C}.Release|Any CPU.Build.0 = Release|Any CPU - {C66092B0-5C1E-44E9-B524-E0E8E1425379}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C66092B0-5C1E-44E9-B524-E0E8E1425379}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C66092B0-5C1E-44E9-B524-E0E8E1425379}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C66092B0-5C1E-44E9-B524-E0E8E1425379}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA", "IPA\IPA.csproj", "{14092533-98BB-40A4-9AFC-27BB75672A70}" + ProjectSection(ProjectDependencies) = postProject + {D1390268-F68B-4A55-B50D-EAD25756C8EF} = {D1390268-F68B-4A55-B50D-EAD25756C8EF} + {D1C61AF5-0D2D-4752-8203-1C6929025F7C} = {D1C61AF5-0D2D-4752-8203-1C6929025F7C} + {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71} = {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IllusionPlugin", "IllusionPlugin\IllusionPlugin.csproj", "{E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IllusionInjector", "IllusionInjector\IllusionInjector.csproj", "{D1C61AF5-0D2D-4752-8203-1C6929025F7C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA.Tests", "IPA.Tests\IPA.Tests.csproj", "{C66092B0-5C1E-44E9-B524-E0E8E1425379}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {14092533-98BB-40A4-9AFC-27BB75672A70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {14092533-98BB-40A4-9AFC-27BB75672A70}.Debug|Any CPU.Build.0 = Debug|Any CPU + {14092533-98BB-40A4-9AFC-27BB75672A70}.Release|Any CPU.ActiveCfg = Release|Any CPU + {14092533-98BB-40A4-9AFC-27BB75672A70}.Release|Any CPU.Build.0 = Release|Any CPU + {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}.Release|Any CPU.Build.0 = Release|Any CPU + {D1C61AF5-0D2D-4752-8203-1C6929025F7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1C61AF5-0D2D-4752-8203-1C6929025F7C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1C61AF5-0D2D-4752-8203-1C6929025F7C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1C61AF5-0D2D-4752-8203-1C6929025F7C}.Release|Any CPU.Build.0 = Release|Any CPU + {C66092B0-5C1E-44E9-B524-E0E8E1425379}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C66092B0-5C1E-44E9-B524-E0E8E1425379}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C66092B0-5C1E-44E9-B524-E0E8E1425379}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C66092B0-5C1E-44E9-B524-E0E8E1425379}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/IPA/IPA.csproj b/IPA/IPA.csproj index 091bc07e..c4b5e3e9 100644 --- a/IPA/IPA.csproj +++ b/IPA/IPA.csproj @@ -1,97 +1,97 @@ - - - - - Debug - AnyCPU - {14092533-98BB-40A4-9AFC-27BB75672A70} - Exe - Properties - IPA - IPA - v3.5 - 512 - Client - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - none - true - bin\Release\ - TRACE - prompt - 4 - - - favicon.ico - - - - ..\packages\Mono.Cecil.0.9.6.4\lib\net35\Mono.Cecil.dll - True - - - ..\packages\Mono.Cecil.0.9.6.4\lib\net35\Mono.Cecil.Mdb.dll - False - - - ..\packages\Mono.Cecil.0.9.6.4\lib\net35\Mono.Cecil.Pdb.dll - False - - - ..\packages\Mono.Cecil.0.9.6.4\lib\net35\Mono.Cecil.Rocks.dll - False - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + AnyCPU + {14092533-98BB-40A4-9AFC-27BB75672A70} + Exe + Properties + IPA + IPA + v3.5 + 512 + Client + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + none + true + bin\Release\ + TRACE + prompt + 4 + + + favicon.ico + + + + ..\packages\Mono.Cecil.0.9.6.4\lib\net35\Mono.Cecil.dll + True + + + ..\packages\Mono.Cecil.0.9.6.4\lib\net35\Mono.Cecil.Mdb.dll + False + + + ..\packages\Mono.Cecil.0.9.6.4\lib\net35\Mono.Cecil.Pdb.dll + False + + + ..\packages\Mono.Cecil.0.9.6.4\lib\net35\Mono.Cecil.Rocks.dll + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/IPA/PatchContext.cs b/IPA/PatchContext.cs index 0f415bed..d058ba0a 100644 --- a/IPA/PatchContext.cs +++ b/IPA/PatchContext.cs @@ -1,58 +1,58 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; - -namespace IPA -{ - public class PatchContext - { - /// - /// Gets the filename of the executable. - /// - public string Executable { get; private set; } - - public string DataPathSrc { get; private set; } - public string PluginsFolder { get; private set; } - public string ProjectName { get; private set; } - public string DataPathDst { get; private set; } - public string ManagedPath { get; private set; } - public string EngineFile { get; private set; } - public string AssemblyFile { get; private set; } - public string[] Args { get; private set; } - public string ProjectRoot { get; private set; } - public string IPARoot { get; private set; } - public string ShortcutPath { get; private set; } - public string IPA { get; private set; } - public string BackupPath { get; private set; } - - private PatchContext() { } - - public static PatchContext Create(String[] args) - { - var context = new PatchContext(); - - context.Args = args; - context.Executable = args[0]; - context.ProjectRoot = new FileInfo(context.Executable).Directory.FullName; - context.IPARoot = Path.Combine(context.ProjectRoot, "IPA"); - context.IPA = Assembly.GetExecutingAssembly().Location ?? Path.Combine(context.ProjectRoot, "IPA.exe"); - context.DataPathSrc = Path.Combine(context.IPARoot, "Data"); - context.PluginsFolder = Path.Combine(context.ProjectRoot, "Plugins"); - context.ProjectName = Path.GetFileNameWithoutExtension(context.Executable); - context.DataPathDst = Path.Combine(context.ProjectRoot, context.ProjectName + "_Data"); - context.ManagedPath = Path.Combine(context.DataPathDst, "Managed"); - context.EngineFile = Path.Combine(context.ManagedPath, "UnityEngine.CoreModule.dll"); - context.AssemblyFile = Path.Combine(context.ManagedPath, "Assembly-CSharp.dll"); - context.BackupPath = Path.Combine(Path.Combine(context.IPARoot, "Backups"), context.ProjectName); - string shortcutName = $"{context.ProjectName} (Patch & Launch)"; - context.ShortcutPath = Path.Combine(context.ProjectRoot, shortcutName) + ".lnk"; - - Directory.CreateDirectory(context.BackupPath); - - return context; - } - } -} +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace IPA +{ + public class PatchContext + { + /// + /// Gets the filename of the executable. + /// + public string Executable { get; private set; } + + public string DataPathSrc { get; private set; } + public string PluginsFolder { get; private set; } + public string ProjectName { get; private set; } + public string DataPathDst { get; private set; } + public string ManagedPath { get; private set; } + public string EngineFile { get; private set; } + public string AssemblyFile { get; private set; } + public string[] Args { get; private set; } + public string ProjectRoot { get; private set; } + public string IPARoot { get; private set; } + public string ShortcutPath { get; private set; } + public string IPA { get; private set; } + public string BackupPath { get; private set; } + + private PatchContext() { } + + public static PatchContext Create(String[] args) + { + var context = new PatchContext(); + + context.Args = args; + context.Executable = args[0]; + context.ProjectRoot = new FileInfo(context.Executable).Directory.FullName; + context.IPARoot = Path.Combine(context.ProjectRoot, "IPA"); + context.IPA = Assembly.GetExecutingAssembly().Location ?? Path.Combine(context.ProjectRoot, "IPA.exe"); + context.DataPathSrc = Path.Combine(context.IPARoot, "Data"); + context.PluginsFolder = Path.Combine(context.ProjectRoot, "Plugins"); + context.ProjectName = Path.GetFileNameWithoutExtension(context.Executable); + context.DataPathDst = Path.Combine(context.ProjectRoot, context.ProjectName + "_Data"); + context.ManagedPath = Path.Combine(context.DataPathDst, "Managed"); + context.EngineFile = Path.Combine(context.ManagedPath, "UnityEngine.CoreModule.dll"); + context.AssemblyFile = Path.Combine(context.ManagedPath, "Assembly-CSharp.dll"); + context.BackupPath = Path.Combine(Path.Combine(context.IPARoot, "Backups"), context.ProjectName); + string shortcutName = $"{context.ProjectName} (Patch & Launch)"; + context.ShortcutPath = Path.Combine(context.ProjectRoot, shortcutName) + ".lnk"; + + Directory.CreateDirectory(context.BackupPath); + + return context; + } + } +} diff --git a/IPA/Patcher/Patcher.cs b/IPA/Patcher/Patcher.cs index 6401a67b..2826f1f8 100644 --- a/IPA/Patcher/Patcher.cs +++ b/IPA/Patcher/Patcher.cs @@ -1,103 +1,103 @@ -using Mono.Cecil; -using Mono.Cecil.Cil; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; - -namespace IPA.Patcher -{ - class PatchedModule - { - private static readonly string[] ENTRY_TYPES = { "Input", "Display" }; - - private FileInfo _File; - private ModuleDefinition _Module; - - internal struct PatchData { - public bool IsPatched; - public Version Version; - } - - public static PatchedModule Load(string engineFile) - { - return new PatchedModule(engineFile); - } - - private PatchedModule(string engineFile) - { - _File = new FileInfo(engineFile); - - LoadModules(); - } - - private void LoadModules() - { - var resolver = new DefaultAssemblyResolver(); - resolver.AddSearchDirectory(_File.DirectoryName); - - var parameters = new ReaderParameters - { - AssemblyResolver = resolver, - }; - - _Module = ModuleDefinition.ReadModule(_File.FullName, parameters); - } - - public PatchData Data - { - get - { - foreach (var @ref in _Module.AssemblyReferences) { - if (@ref.Name == "IllusionInjector") return new PatchData { IsPatched = true, Version = @ref.Version}; - } - return new PatchData { IsPatched = false, Version = null}; - } - } - - public void Patch(Version v) - { - // First, let's add the reference - var nameReference = new AssemblyNameReference("IllusionInjector", v); - var injectorPath = Path.Combine(_File.DirectoryName, "IllusionInjector.dll"); - var injector = ModuleDefinition.ReadModule(injectorPath); - - _Module.AssemblyReferences.Add(nameReference); - int patched = 0; - foreach(var type in FindEntryTypes()) - { - if(PatchType(type, injector)) - { - patched++; - } - } - - if(patched > 0) - { - _Module.Write(_File.FullName); - } else - { - throw new Exception("Could not find any entry type!"); - } - } - - private bool PatchType(TypeDefinition targetType, ModuleDefinition injector) - { - var targetMethod = targetType.Methods.FirstOrDefault(m => m.IsConstructor && m.IsStatic); - if (targetMethod != null) - { - var methodReference = _Module.Import(injector.GetType("IllusionInjector.Injector").Methods.First(m => m.Name == "Inject")); - targetMethod.Body.Instructions.Insert(0, Instruction.Create(OpCodes.Call, methodReference)); - return true; - } - return false; - } - - - private IEnumerable FindEntryTypes() - { - return _Module.GetTypes().Where(m => ENTRY_TYPES.Contains(m.Name)); - } - } -} +using Mono.Cecil; +using Mono.Cecil.Cil; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +namespace IPA.Patcher +{ + class PatchedModule + { + private static readonly string[] ENTRY_TYPES = { "Input", "Display" }; + + private FileInfo _File; + private ModuleDefinition _Module; + + internal struct PatchData { + public bool IsPatched; + public Version Version; + } + + public static PatchedModule Load(string engineFile) + { + return new PatchedModule(engineFile); + } + + private PatchedModule(string engineFile) + { + _File = new FileInfo(engineFile); + + LoadModules(); + } + + private void LoadModules() + { + var resolver = new DefaultAssemblyResolver(); + resolver.AddSearchDirectory(_File.DirectoryName); + + var parameters = new ReaderParameters + { + AssemblyResolver = resolver, + }; + + _Module = ModuleDefinition.ReadModule(_File.FullName, parameters); + } + + public PatchData Data + { + get + { + foreach (var @ref in _Module.AssemblyReferences) { + if (@ref.Name == "IllusionInjector") return new PatchData { IsPatched = true, Version = @ref.Version}; + } + return new PatchData { IsPatched = false, Version = null}; + } + } + + public void Patch(Version v) + { + // First, let's add the reference + var nameReference = new AssemblyNameReference("IllusionInjector", v); + var injectorPath = Path.Combine(_File.DirectoryName, "IllusionInjector.dll"); + var injector = ModuleDefinition.ReadModule(injectorPath); + + _Module.AssemblyReferences.Add(nameReference); + int patched = 0; + foreach(var type in FindEntryTypes()) + { + if(PatchType(type, injector)) + { + patched++; + } + } + + if(patched > 0) + { + _Module.Write(_File.FullName); + } else + { + throw new Exception("Could not find any entry type!"); + } + } + + private bool PatchType(TypeDefinition targetType, ModuleDefinition injector) + { + var targetMethod = targetType.Methods.FirstOrDefault(m => m.IsConstructor && m.IsStatic); + if (targetMethod != null) + { + var methodReference = _Module.Import(injector.GetType("IllusionInjector.Injector").Methods.First(m => m.Name == "Inject")); + targetMethod.Body.Instructions.Insert(0, Instruction.Create(OpCodes.Call, methodReference)); + return true; + } + return false; + } + + + private IEnumerable FindEntryTypes() + { + return _Module.GetTypes().Where(m => ENTRY_TYPES.Contains(m.Name)); + } + } +} diff --git a/IPA/Program.cs b/IPA/Program.cs index f6f8b873..f858cdca 100644 --- a/IPA/Program.cs +++ b/IPA/Program.cs @@ -1,388 +1,388 @@ -using IPA.Patcher; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Text; -using System.Text.RegularExpressions; -using System.Windows.Forms; - -namespace IPA { - public class Program { - public enum Architecture { - x86, - x64, - Unknown - } - - private static Version Version => new Version(Application.ProductVersion); - - static void Main(string[] args) { - PatchContext context; - - if (args.Length < 1 || !args[0].EndsWith(".exe")) { - //Fail("Drag an (executable) file on the exe!"); - context = PatchContext.Create(new[] { - new DirectoryInfo(Directory.GetCurrentDirectory()).GetFiles() - .First(o => o.FullName.EndsWith(".exe")) - .FullName - }); - } - else { - context = PatchContext.Create(args); - } - - try { - bool isRevert = args.Contains("--revert") || Keyboard.IsKeyDown(Keys.LMenu); - // Sanitizing - Validate(context); - - if (isRevert) { - Revert(context); - } - else { - Install(context); - StartIfNeedBe(context); - } - } - catch (Exception e) { - Fail(e.Message); - } - } - - private static void Validate(PatchContext c) { - if (!Directory.Exists(c.DataPathDst) || !File.Exists(c.EngineFile)) { - Fail("Game does not seem to be a Unity project. Could not find the libraries to patch."); - Console.WriteLine($"DataPath: {c.DataPathDst}"); - Console.WriteLine($"EngineFile: {c.EngineFile}"); - } - } - - private static void Install(PatchContext context) { - try { - var backup = new BackupUnit(context); - - #region Patch Version Check - - var patchedModule = PatchedModule.Load(context.EngineFile); - var isCurrentNewer = Version.CompareTo(patchedModule.Data.Version) > 0; - if (isCurrentNewer) { - Console.ForegroundColor = ConsoleColor.White; - Console.WriteLine( - $"Preparing for update, {(patchedModule.Data.Version == null ? "UnPatched" : patchedModule.Data.Version.ToString())} => {Version}"); - Console.WriteLine("--- Starting ---"); - Revert(context, new[] {"newVersion"}); - Console.ResetColor(); - - - #region File Copying - - Console.ForegroundColor = ConsoleColor.Magenta; - Console.WriteLine("Updating files... "); - var nativePluginFolder = Path.Combine(context.DataPathDst, "Plugins"); - bool isFlat = Directory.Exists(nativePluginFolder) && - Directory.GetFiles(nativePluginFolder).Any(f => f.EndsWith(".dll")); - bool force = !BackupManager.HasBackup(context) || context.Args.Contains("-f") || - context.Args.Contains("--force"); - var architecture = DetectArchitecture(context.Executable); - - Console.WriteLine("Architecture: {0}", architecture); - - CopyAll(new DirectoryInfo(context.DataPathSrc), new DirectoryInfo(context.DataPathDst), force, - backup, - (from, to) => NativePluginInterceptor(from, to, new DirectoryInfo(nativePluginFolder), isFlat, - architecture)); - - Console.WriteLine("Successfully updated files!"); - - #endregion - } - else { - Console.ForegroundColor = ConsoleColor.Red; - Console.WriteLine($"Files up to date @ Version {Version}!"); - Console.ResetColor(); - } - - #endregion - - #region Create Plugin Folder - - if (!Directory.Exists(context.PluginsFolder)) { - Console.ForegroundColor = ConsoleColor.DarkYellow; - Console.WriteLine("Creating plugins folder... "); - Directory.CreateDirectory(context.PluginsFolder); - Console.ResetColor(); - } - - #endregion - - #region Patching - - if (!patchedModule.Data.IsPatched || isCurrentNewer) { - Console.ForegroundColor = ConsoleColor.Yellow; - Console.WriteLine($"Patching UnityEngine.dll with Version {Application.ProductVersion}... "); - backup.Add(context.EngineFile); - patchedModule.Patch(Version); - Console.WriteLine("Done!"); - Console.ResetColor(); - } - - #endregion - - #region Virtualizing - - if (File.Exists(context.AssemblyFile)) { - var virtualizedModule = VirtualizedModule.Load(context.AssemblyFile); - if (!virtualizedModule.IsVirtualized) { - Console.ForegroundColor = ConsoleColor.Blue; - Console.WriteLine("Virtualizing Assembly-Csharp.dll... "); - backup.Add(context.AssemblyFile); - virtualizedModule.Virtualize(); - Console.WriteLine("Done!"); - Console.ResetColor(); - } - } - - #endregion - - #region Creating shortcut - /*if(!File.Exists(context.ShortcutPath)) - { - Console.Write("Creating shortcut to IPA ({0})... ", context.IPA); - try - { - Shortcut.Create( - fileName: context.ShortcutPath, - targetPath: context.IPA, - arguments: Args(context.Executable, "--launch"), - workingDirectory: context.ProjectRoot, - description: "Launches the game and makes sure it's in a patched state", - hotkey: "", - iconPath: context.Executable - ); - Console.WriteLine("Created"); - } catch (Exception e) - { - Console.Error.WriteLine("Failed to create shortcut, but game was patched!"); - } - }*/ - #endregion - } - catch (Exception e) { - Fail("Oops! This should not have happened.\n\n" + e); - } - - - Console.ForegroundColor = ConsoleColor.Green; - Console.WriteLine("Finished!"); - Console.ResetColor(); - Console.ReadLine(); - } - - private static void Revert(PatchContext context, string[] args = null) { - Console.ForegroundColor = ConsoleColor.Cyan; - bool isNewVersion = (args != null && args.Contains("newVersion")); - - Console.Write("Restoring backup... "); - if (BackupManager.Restore(context)) { - Console.WriteLine("Done!"); - } - else { - Console.WriteLine("Already vanilla!"); - } - - - if (File.Exists(context.ShortcutPath)) { - Console.WriteLine("Deleting shortcut..."); - File.Delete(context.ShortcutPath); - } - - Console.WriteLine(""); - Console.WriteLine("--- Done reverting ---"); - - if (!Environment.CommandLine.Contains("--nowait") && !isNewVersion) { - Console.WriteLine("\n\n[Press any key to quit]"); - Console.ReadKey(); - } - - Console.ResetColor(); - } - - private static void StartIfNeedBe(PatchContext context) { - var argList = context.Args.ToList(); - bool launch = argList.Remove("--launch"); - - argList.RemoveAt(0); - - if (launch) { - Process.Start(context.Executable, Args(argList.ToArray())); - } - } - - public static IEnumerable NativePluginInterceptor(FileInfo from, FileInfo to, - DirectoryInfo nativePluginFolder, bool isFlat, Architecture preferredArchitecture) { - if (to.FullName.StartsWith(nativePluginFolder.FullName)) { - var relevantBit = to.FullName.Substring(nativePluginFolder.FullName.Length + 1); - // Goes into the plugin folder! - bool isFileFlat = !relevantBit.StartsWith("x86"); - if (isFlat && !isFileFlat) { - // Flatten structure - bool is64Bit = relevantBit.StartsWith("x86_64"); - if (!is64Bit && preferredArchitecture == Architecture.x86) { - // 32 bit - yield return new FileInfo(Path.Combine(nativePluginFolder.FullName, - relevantBit.Substring("x86".Length + 1))); - } - else if (is64Bit && (preferredArchitecture == Architecture.x64 || - preferredArchitecture == Architecture.Unknown)) { - // 64 bit - yield return new FileInfo(Path.Combine(nativePluginFolder.FullName, - relevantBit.Substring("x86_64".Length + 1))); - } - else { - // Throw away - yield break; - } - } - else if (!isFlat && isFileFlat) { - // Deepen structure - yield return new FileInfo(Path.Combine(Path.Combine(nativePluginFolder.FullName, "x86"), - relevantBit)); - yield return new FileInfo(Path.Combine(Path.Combine(nativePluginFolder.FullName, "x86_64"), - relevantBit)); - } - else { - yield return to; - } - } - else { - yield return to; - } - } - - private static IEnumerable PassThroughInterceptor(FileInfo from, FileInfo to) { - yield return to; - } - - public static void CopyAll(DirectoryInfo source, DirectoryInfo target, bool aggressive, BackupUnit backup, - Func> interceptor = null) { - if (interceptor == null) { - interceptor = PassThroughInterceptor; - } - - // Copy each file into the new directory. - foreach (FileInfo fi in source.GetFiles()) { - foreach (var targetFile in interceptor(fi, new FileInfo(Path.Combine(target.FullName, fi.Name)))) { - if (!targetFile.Exists || targetFile.LastWriteTimeUtc < fi.LastWriteTimeUtc || aggressive) { - targetFile.Directory.Create(); - - Console.WriteLine(@"Copying {0}", targetFile.FullName); - backup.Add(targetFile); - fi.CopyTo(targetFile.FullName, true); - } - } - } - - // Copy each subdirectory using recursion. - foreach (DirectoryInfo diSourceSubDir in source.GetDirectories()) { - DirectoryInfo nextTargetSubDir = new DirectoryInfo(Path.Combine(target.FullName, diSourceSubDir.Name)); - CopyAll(diSourceSubDir, nextTargetSubDir, aggressive, backup, interceptor); - } - } - - - static void Fail(string message) { - Console.Error.Write("ERROR: " + message); - if (!Environment.CommandLine.Contains("--nowait")) { - Console.WriteLine("\n\n[Press any key to quit]"); - Console.ReadKey(); - } - - Environment.Exit(1); - } - - public static string Args(params string[] args) { - return string.Join(" ", args.Select(EncodeParameterArgument).ToArray()); - } - - /// - /// Encodes an argument for passing into a program - /// - /// The value that should be received by the program - /// The value which needs to be passed to the program for the original value - /// to come through - public static string EncodeParameterArgument(string original) { - if (string.IsNullOrEmpty(original)) - return original; - string value = Regex.Replace(original, @"(\\*)" + "\"", @"$1\$0"); - value = Regex.Replace(value, @"^(.*\s.*?)(\\*)$", "\"$1$2$2\""); - return value; - } - - public static Architecture DetectArchitecture(string assembly) { - using (var reader = new BinaryReader(File.OpenRead(assembly))) { - var header = reader.ReadUInt16(); - if (header == 0x5a4d) { - reader.BaseStream.Seek(60, SeekOrigin.Begin); // this location contains the offset for the PE header - var peOffset = reader.ReadUInt32(); - - reader.BaseStream.Seek(peOffset + 4, SeekOrigin.Begin); - var machine = reader.ReadUInt16(); - - if (machine == 0x8664) // IMAGE_FILE_MACHINE_AMD64 - return Architecture.x64; - else if (machine == 0x014c) // IMAGE_FILE_MACHINE_I386 - return Architecture.x86; - else if (machine == 0x0200) // IMAGE_FILE_MACHINE_IA64 - return Architecture.x64; - else - return Architecture.Unknown; - } - else { - // Not a supported binary - return Architecture.Unknown; - } - } - } - - public abstract class Keyboard { - [Flags] - private enum KeyStates { - None = 0, - Down = 1, - Toggled = 2 - } - - [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] - private static extern short GetKeyState(int keyCode); - - private static KeyStates GetKeyState(Keys key) { - KeyStates state = KeyStates.None; - - short retVal = GetKeyState((int) key); - - //If the high-order bit is 1, the key is down - //otherwise, it is up. - if ((retVal & 0x8000) == 0x8000) - state |= KeyStates.Down; - - //If the low-order bit is 1, the key is toggled. - if ((retVal & 1) == 1) - state |= KeyStates.Toggled; - - return state; - } - - public static bool IsKeyDown(Keys key) { - return KeyStates.Down == (GetKeyState(key) & KeyStates.Down); - } - - public static bool IsKeyToggled(Keys key) { - return KeyStates.Toggled == (GetKeyState(key) & KeyStates.Toggled); - } - } - } +using IPA.Patcher; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows.Forms; + +namespace IPA { + public class Program { + public enum Architecture { + x86, + x64, + Unknown + } + + private static Version Version => new Version(Application.ProductVersion); + + static void Main(string[] args) { + PatchContext context; + + if (args.Length < 1 || !args[0].EndsWith(".exe")) { + //Fail("Drag an (executable) file on the exe!"); + context = PatchContext.Create(new[] { + new DirectoryInfo(Directory.GetCurrentDirectory()).GetFiles() + .First(o => o.FullName.EndsWith(".exe")) + .FullName + }); + } + else { + context = PatchContext.Create(args); + } + + try { + bool isRevert = args.Contains("--revert") || Keyboard.IsKeyDown(Keys.LMenu); + // Sanitizing + Validate(context); + + if (isRevert) { + Revert(context); + } + else { + Install(context); + StartIfNeedBe(context); + } + } + catch (Exception e) { + Fail(e.Message); + } + } + + private static void Validate(PatchContext c) { + if (!Directory.Exists(c.DataPathDst) || !File.Exists(c.EngineFile)) { + Fail("Game does not seem to be a Unity project. Could not find the libraries to patch."); + Console.WriteLine($"DataPath: {c.DataPathDst}"); + Console.WriteLine($"EngineFile: {c.EngineFile}"); + } + } + + private static void Install(PatchContext context) { + try { + var backup = new BackupUnit(context); + + #region Patch Version Check + + var patchedModule = PatchedModule.Load(context.EngineFile); + var isCurrentNewer = Version.CompareTo(patchedModule.Data.Version) > 0; + if (isCurrentNewer) { + Console.ForegroundColor = ConsoleColor.White; + Console.WriteLine( + $"Preparing for update, {(patchedModule.Data.Version == null ? "UnPatched" : patchedModule.Data.Version.ToString())} => {Version}"); + Console.WriteLine("--- Starting ---"); + Revert(context, new[] {"newVersion"}); + Console.ResetColor(); + + + #region File Copying + + Console.ForegroundColor = ConsoleColor.Magenta; + Console.WriteLine("Updating files... "); + var nativePluginFolder = Path.Combine(context.DataPathDst, "Plugins"); + bool isFlat = Directory.Exists(nativePluginFolder) && + Directory.GetFiles(nativePluginFolder).Any(f => f.EndsWith(".dll")); + bool force = !BackupManager.HasBackup(context) || context.Args.Contains("-f") || + context.Args.Contains("--force"); + var architecture = DetectArchitecture(context.Executable); + + Console.WriteLine("Architecture: {0}", architecture); + + CopyAll(new DirectoryInfo(context.DataPathSrc), new DirectoryInfo(context.DataPathDst), force, + backup, + (from, to) => NativePluginInterceptor(from, to, new DirectoryInfo(nativePluginFolder), isFlat, + architecture)); + + Console.WriteLine("Successfully updated files!"); + + #endregion + } + else { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine($"Files up to date @ Version {Version}!"); + Console.ResetColor(); + } + + #endregion + + #region Create Plugin Folder + + if (!Directory.Exists(context.PluginsFolder)) { + Console.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine("Creating plugins folder... "); + Directory.CreateDirectory(context.PluginsFolder); + Console.ResetColor(); + } + + #endregion + + #region Patching + + if (!patchedModule.Data.IsPatched || isCurrentNewer) { + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine($"Patching UnityEngine.dll with Version {Application.ProductVersion}... "); + backup.Add(context.EngineFile); + patchedModule.Patch(Version); + Console.WriteLine("Done!"); + Console.ResetColor(); + } + + #endregion + + #region Virtualizing + + if (File.Exists(context.AssemblyFile)) { + var virtualizedModule = VirtualizedModule.Load(context.AssemblyFile); + if (!virtualizedModule.IsVirtualized) { + Console.ForegroundColor = ConsoleColor.Blue; + Console.WriteLine("Virtualizing Assembly-Csharp.dll... "); + backup.Add(context.AssemblyFile); + virtualizedModule.Virtualize(); + Console.WriteLine("Done!"); + Console.ResetColor(); + } + } + + #endregion + + #region Creating shortcut + /*if(!File.Exists(context.ShortcutPath)) + { + Console.Write("Creating shortcut to IPA ({0})... ", context.IPA); + try + { + Shortcut.Create( + fileName: context.ShortcutPath, + targetPath: context.IPA, + arguments: Args(context.Executable, "--launch"), + workingDirectory: context.ProjectRoot, + description: "Launches the game and makes sure it's in a patched state", + hotkey: "", + iconPath: context.Executable + ); + Console.WriteLine("Created"); + } catch (Exception e) + { + Console.Error.WriteLine("Failed to create shortcut, but game was patched!"); + } + }*/ + #endregion + } + catch (Exception e) { + Fail("Oops! This should not have happened.\n\n" + e); + } + + + Console.ForegroundColor = ConsoleColor.Green; + Console.WriteLine("Finished!"); + Console.ResetColor(); + Console.ReadLine(); + } + + private static void Revert(PatchContext context, string[] args = null) { + Console.ForegroundColor = ConsoleColor.Cyan; + bool isNewVersion = (args != null && args.Contains("newVersion")); + + Console.Write("Restoring backup... "); + if (BackupManager.Restore(context)) { + Console.WriteLine("Done!"); + } + else { + Console.WriteLine("Already vanilla!"); + } + + + if (File.Exists(context.ShortcutPath)) { + Console.WriteLine("Deleting shortcut..."); + File.Delete(context.ShortcutPath); + } + + Console.WriteLine(""); + Console.WriteLine("--- Done reverting ---"); + + if (!Environment.CommandLine.Contains("--nowait") && !isNewVersion) { + Console.WriteLine("\n\n[Press any key to quit]"); + Console.ReadKey(); + } + + Console.ResetColor(); + } + + private static void StartIfNeedBe(PatchContext context) { + var argList = context.Args.ToList(); + bool launch = argList.Remove("--launch"); + + argList.RemoveAt(0); + + if (launch) { + Process.Start(context.Executable, Args(argList.ToArray())); + } + } + + public static IEnumerable NativePluginInterceptor(FileInfo from, FileInfo to, + DirectoryInfo nativePluginFolder, bool isFlat, Architecture preferredArchitecture) { + if (to.FullName.StartsWith(nativePluginFolder.FullName)) { + var relevantBit = to.FullName.Substring(nativePluginFolder.FullName.Length + 1); + // Goes into the plugin folder! + bool isFileFlat = !relevantBit.StartsWith("x86"); + if (isFlat && !isFileFlat) { + // Flatten structure + bool is64Bit = relevantBit.StartsWith("x86_64"); + if (!is64Bit && preferredArchitecture == Architecture.x86) { + // 32 bit + yield return new FileInfo(Path.Combine(nativePluginFolder.FullName, + relevantBit.Substring("x86".Length + 1))); + } + else if (is64Bit && (preferredArchitecture == Architecture.x64 || + preferredArchitecture == Architecture.Unknown)) { + // 64 bit + yield return new FileInfo(Path.Combine(nativePluginFolder.FullName, + relevantBit.Substring("x86_64".Length + 1))); + } + else { + // Throw away + yield break; + } + } + else if (!isFlat && isFileFlat) { + // Deepen structure + yield return new FileInfo(Path.Combine(Path.Combine(nativePluginFolder.FullName, "x86"), + relevantBit)); + yield return new FileInfo(Path.Combine(Path.Combine(nativePluginFolder.FullName, "x86_64"), + relevantBit)); + } + else { + yield return to; + } + } + else { + yield return to; + } + } + + private static IEnumerable PassThroughInterceptor(FileInfo from, FileInfo to) { + yield return to; + } + + public static void CopyAll(DirectoryInfo source, DirectoryInfo target, bool aggressive, BackupUnit backup, + Func> interceptor = null) { + if (interceptor == null) { + interceptor = PassThroughInterceptor; + } + + // Copy each file into the new directory. + foreach (FileInfo fi in source.GetFiles()) { + foreach (var targetFile in interceptor(fi, new FileInfo(Path.Combine(target.FullName, fi.Name)))) { + if (!targetFile.Exists || targetFile.LastWriteTimeUtc < fi.LastWriteTimeUtc || aggressive) { + targetFile.Directory.Create(); + + Console.WriteLine(@"Copying {0}", targetFile.FullName); + backup.Add(targetFile); + fi.CopyTo(targetFile.FullName, true); + } + } + } + + // Copy each subdirectory using recursion. + foreach (DirectoryInfo diSourceSubDir in source.GetDirectories()) { + DirectoryInfo nextTargetSubDir = new DirectoryInfo(Path.Combine(target.FullName, diSourceSubDir.Name)); + CopyAll(diSourceSubDir, nextTargetSubDir, aggressive, backup, interceptor); + } + } + + + static void Fail(string message) { + Console.Error.Write("ERROR: " + message); + if (!Environment.CommandLine.Contains("--nowait")) { + Console.WriteLine("\n\n[Press any key to quit]"); + Console.ReadKey(); + } + + Environment.Exit(1); + } + + public static string Args(params string[] args) { + return string.Join(" ", args.Select(EncodeParameterArgument).ToArray()); + } + + /// + /// Encodes an argument for passing into a program + /// + /// The value that should be received by the program + /// The value which needs to be passed to the program for the original value + /// to come through + public static string EncodeParameterArgument(string original) { + if (string.IsNullOrEmpty(original)) + return original; + string value = Regex.Replace(original, @"(\\*)" + "\"", @"$1\$0"); + value = Regex.Replace(value, @"^(.*\s.*?)(\\*)$", "\"$1$2$2\""); + return value; + } + + public static Architecture DetectArchitecture(string assembly) { + using (var reader = new BinaryReader(File.OpenRead(assembly))) { + var header = reader.ReadUInt16(); + if (header == 0x5a4d) { + reader.BaseStream.Seek(60, SeekOrigin.Begin); // this location contains the offset for the PE header + var peOffset = reader.ReadUInt32(); + + reader.BaseStream.Seek(peOffset + 4, SeekOrigin.Begin); + var machine = reader.ReadUInt16(); + + if (machine == 0x8664) // IMAGE_FILE_MACHINE_AMD64 + return Architecture.x64; + else if (machine == 0x014c) // IMAGE_FILE_MACHINE_I386 + return Architecture.x86; + else if (machine == 0x0200) // IMAGE_FILE_MACHINE_IA64 + return Architecture.x64; + else + return Architecture.Unknown; + } + else { + // Not a supported binary + return Architecture.Unknown; + } + } + } + + public abstract class Keyboard { + [Flags] + private enum KeyStates { + None = 0, + Down = 1, + Toggled = 2 + } + + [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] + private static extern short GetKeyState(int keyCode); + + private static KeyStates GetKeyState(Keys key) { + KeyStates state = KeyStates.None; + + short retVal = GetKeyState((int) key); + + //If the high-order bit is 1, the key is down + //otherwise, it is up. + if ((retVal & 0x8000) == 0x8000) + state |= KeyStates.Down; + + //If the low-order bit is 1, the key is toggled. + if ((retVal & 1) == 1) + state |= KeyStates.Toggled; + + return state; + } + + public static bool IsKeyDown(Keys key) { + return KeyStates.Down == (GetKeyState(key) & KeyStates.Down); + } + + public static bool IsKeyToggled(Keys key) { + return KeyStates.Toggled == (GetKeyState(key) & KeyStates.Toggled); + } + } + } } \ No newline at end of file diff --git a/IPA/Properties/AssemblyInfo.cs b/IPA/Properties/AssemblyInfo.cs index 09496be4..56cf9359 100644 --- a/IPA/Properties/AssemblyInfo.cs +++ b/IPA/Properties/AssemblyInfo.cs @@ -1,36 +1,36 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Illusion Plugin Architecture")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Illusion Plugin Architecture")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("14092533-98bb-40a4-9afc-27bb75672a70")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.7")] -[assembly: AssemblyFileVersion("3.7")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Illusion Plugin Architecture")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Illusion Plugin Architecture")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("14092533-98bb-40a4-9afc-27bb75672a70")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("3.7")] +[assembly: AssemblyFileVersion("3.7")] diff --git a/IPA/obj/Debug/IPA.csproj.CoreCompileInputs.cache b/IPA/obj/Debug/IPA.csproj.CoreCompileInputs.cache index 48437bcb..f3c8d81c 100644 --- a/IPA/obj/Debug/IPA.csproj.CoreCompileInputs.cache +++ b/IPA/obj/Debug/IPA.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -f7c20aca6b99cd3b62d50a05d9bdca1eb41dca2a +65c33cfc23e8dcfc89c7fd78e8cd8344a2518294 diff --git a/IllusionInjector/CompositePlugin.cs b/IllusionInjector/CompositePlugin.cs index 77614d35..9c959c12 100644 --- a/IllusionInjector/CompositePlugin.cs +++ b/IllusionInjector/CompositePlugin.cs @@ -1,135 +1,135 @@ -using IllusionPlugin; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEngine; -using UnityEngine.SceneManagement; -using Logger = IllusionPlugin.Logger; - -namespace IllusionInjector { - public class CompositePlugin : IPlugin { - IEnumerable plugins; - - private delegate void CompositeCall(IPlugin plugin); - - private Logger debugLogger => PluginManager.debugLogger; - - public CompositePlugin(IEnumerable plugins) { - this.plugins = plugins; - } - - public void OnApplicationStart() { - Invoke(plugin => plugin.OnApplicationStart()); - } - - public void OnApplicationQuit() { - Invoke(plugin => plugin.OnApplicationQuit()); - } - - public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) { - foreach (var plugin1 in plugins.Where(o => o is IPluginNew)) { - var plugin = (IPluginNew) plugin1; - try { - plugin.OnSceneLoaded(scene, sceneMode); - } - catch (Exception ex) { - debugLogger.Exception($"{plugin.Name}: {ex}"); - } - } - } - - public void OnSceneUnloaded(Scene scene) { - foreach (var plugin1 in plugins.Where(o => o is IPluginNew)) { - var plugin = (IPluginNew) plugin1; - try { - plugin.OnSceneUnloaded(scene); - } - catch (Exception ex) { - debugLogger.Exception($"{plugin.Name}: {ex}"); - } - } - } - - public void OnActiveSceneChanged(Scene prevScene, Scene nextScene) { - foreach (var plugin1 in plugins.Where(o => o is IPluginNew)) { - var plugin = (IPluginNew) plugin1; - try { - plugin.OnActiveSceneChanged(prevScene, nextScene); - } - catch (Exception ex) { - debugLogger.Exception($"{plugin.Name}: {ex}"); - } - } - } - - - private void Invoke(CompositeCall callback) { - foreach (var plugin in plugins) { - try { - callback(plugin); - } - catch (Exception ex) { - debugLogger.Exception($"{plugin.Name}: {ex}"); - } - } - } - - - public void OnUpdate() { - Invoke(plugin => plugin.OnUpdate()); - } - - public void OnFixedUpdate() { - Invoke(plugin => plugin.OnFixedUpdate()); - } - - [Obsolete("Use OnSceneLoaded instead")] - public void OnLevelWasLoaded(int level) - { - foreach (var plugin in plugins) - { - try - { - plugin.OnLevelWasLoaded(level); - } - catch (Exception ex) - { - Console.WriteLine("{0}: {1}", plugin.Name, ex); - } - } - } - - [Obsolete("Use OnSceneLoaded instead")] - public void OnLevelWasInitialized(int level) - { - foreach (var plugin in plugins) - { - try - { - plugin.OnLevelWasInitialized(level); - } - catch (Exception ex) - { - Console.WriteLine("{0}: {1}", plugin.Name, ex); - } - } - } - - - public string Name { - get { throw new NotImplementedException(); } - } - - public string Version { - get { throw new NotImplementedException(); } - } - - public void OnLateUpdate() { - Invoke(plugin => { - if (plugin is IEnhancedPlugin) - ((IEnhancedPlugin) plugin).OnLateUpdate(); - }); - } - } +using IllusionPlugin; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine; +using UnityEngine.SceneManagement; +using Logger = IllusionPlugin.Logger; + +namespace IllusionInjector { + public class CompositePlugin : IPlugin { + IEnumerable plugins; + + private delegate void CompositeCall(IPlugin plugin); + + private Logger debugLogger => PluginManager.debugLogger; + + public CompositePlugin(IEnumerable plugins) { + this.plugins = plugins; + } + + public void OnApplicationStart() { + Invoke(plugin => plugin.OnApplicationStart()); + } + + public void OnApplicationQuit() { + Invoke(plugin => plugin.OnApplicationQuit()); + } + + public void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) { + foreach (var plugin1 in plugins.Where(o => o is IPluginNew)) { + var plugin = (IPluginNew) plugin1; + try { + plugin.OnSceneLoaded(scene, sceneMode); + } + catch (Exception ex) { + debugLogger.Exception($"{plugin.Name}: {ex}"); + } + } + } + + public void OnSceneUnloaded(Scene scene) { + foreach (var plugin1 in plugins.Where(o => o is IPluginNew)) { + var plugin = (IPluginNew) plugin1; + try { + plugin.OnSceneUnloaded(scene); + } + catch (Exception ex) { + debugLogger.Exception($"{plugin.Name}: {ex}"); + } + } + } + + public void OnActiveSceneChanged(Scene prevScene, Scene nextScene) { + foreach (var plugin1 in plugins.Where(o => o is IPluginNew)) { + var plugin = (IPluginNew) plugin1; + try { + plugin.OnActiveSceneChanged(prevScene, nextScene); + } + catch (Exception ex) { + debugLogger.Exception($"{plugin.Name}: {ex}"); + } + } + } + + + private void Invoke(CompositeCall callback) { + foreach (var plugin in plugins) { + try { + callback(plugin); + } + catch (Exception ex) { + debugLogger.Exception($"{plugin.Name}: {ex}"); + } + } + } + + + public void OnUpdate() { + Invoke(plugin => plugin.OnUpdate()); + } + + public void OnFixedUpdate() { + Invoke(plugin => plugin.OnFixedUpdate()); + } + + [Obsolete("Use OnSceneLoaded instead")] + public void OnLevelWasLoaded(int level) + { + foreach (var plugin in plugins) + { + try + { + plugin.OnLevelWasLoaded(level); + } + catch (Exception ex) + { + Console.WriteLine("{0}: {1}", plugin.Name, ex); + } + } + } + + [Obsolete("Use OnSceneLoaded instead")] + public void OnLevelWasInitialized(int level) + { + foreach (var plugin in plugins) + { + try + { + plugin.OnLevelWasInitialized(level); + } + catch (Exception ex) + { + Console.WriteLine("{0}: {1}", plugin.Name, ex); + } + } + } + + + public string Name { + get { throw new NotImplementedException(); } + } + + public string Version { + get { throw new NotImplementedException(); } + } + + public void OnLateUpdate() { + Invoke(plugin => { + if (plugin is IEnhancedPlugin) + ((IEnhancedPlugin) plugin).OnLateUpdate(); + }); + } + } } \ No newline at end of file diff --git a/IllusionInjector/IllusionInjector.csproj b/IllusionInjector/IllusionInjector.csproj index 98f3142b..aeb8f75b 100644 --- a/IllusionInjector/IllusionInjector.csproj +++ b/IllusionInjector/IllusionInjector.csproj @@ -1,69 +1,69 @@ - - - - - Debug - AnyCPU - {D1C61AF5-0D2D-4752-8203-1C6929025F7C} - Library - Properties - IllusionInjector - IllusionInjector - v3.5 - 512 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - none - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - ..\Libs\UnityEngine.dll - False - - - ..\Libs\UnityEngine.CoreModule.dll - - - - - - - - - - - - - - {e2848bfb-5432-42f4-8ae0-d2ec0cdf2f71} - IllusionPlugin - - - - + + + + + Debug + AnyCPU + {D1C61AF5-0D2D-4752-8203-1C6929025F7C} + Library + Properties + IllusionInjector + IllusionInjector + v3.5 + 512 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + none + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + ..\Libs\UnityEngine.dll + False + + + ..\Libs\UnityEngine.CoreModule.dll + + + + + + + + + + + + + + {e2848bfb-5432-42f4-8ae0-d2ec0cdf2f71} + IllusionPlugin + + + + \ No newline at end of file diff --git a/IllusionInjector/PluginComponent.cs b/IllusionInjector/PluginComponent.cs index f9b47e40..e79bc936 100644 --- a/IllusionInjector/PluginComponent.cs +++ b/IllusionInjector/PluginComponent.cs @@ -1,96 +1,96 @@ -using System; -using System.Collections.Generic; -using System.Text; -using UnityEngine; -using UnityEngine.SceneManagement; - -namespace IllusionInjector -{ - public class PluginComponent : MonoBehaviour - { - private CompositePlugin plugins; - private bool freshlyLoaded = false; - private bool quitting = false; - - public static PluginComponent Create() - { - return new GameObject("IPA_PluginManager").AddComponent(); - } - - void Awake() - { - DontDestroyOnLoad(gameObject); - - plugins = new CompositePlugin(PluginManager.Plugins); - plugins.OnApplicationStart(); - - SceneManager.activeSceneChanged += OnActiveSceneChanged; - SceneManager.sceneLoaded += OnSceneLoaded; - SceneManager.sceneUnloaded += OnSceneUnloaded; - } - - void Start() - { - OnLevelWasLoaded(Application.loadedLevel); - } - - void Update() - { - if (freshlyLoaded) - { - freshlyLoaded = false; - plugins.OnLevelWasInitialized(Application.loadedLevel); - } - plugins.OnUpdate(); - } - - void LateUpdate() - { - plugins.OnLateUpdate(); - } - - void FixedUpdate() - { - plugins.OnFixedUpdate(); - } - - void OnDestroy() - { - if (!quitting) - { - Create(); - } - } - - void OnApplicationQuit() - { - SceneManager.activeSceneChanged += OnActiveSceneChanged; - SceneManager.sceneLoaded += OnSceneLoaded; - SceneManager.sceneUnloaded += OnSceneUnloaded; - - plugins.OnApplicationQuit(); - - quitting = true; - } - - void OnLevelWasLoaded(int level) - { - plugins.OnLevelWasLoaded(level); - freshlyLoaded = true; - } - - void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) - { - plugins.OnSceneLoaded(scene, sceneMode); - } - - private void OnSceneUnloaded(Scene scene) { - plugins.OnSceneUnloaded(scene); - } - - private void OnActiveSceneChanged(Scene prevScene, Scene nextScene) { - plugins.OnActiveSceneChanged(prevScene, nextScene); - } - - } -} +using System; +using System.Collections.Generic; +using System.Text; +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace IllusionInjector +{ + public class PluginComponent : MonoBehaviour + { + private CompositePlugin plugins; + private bool freshlyLoaded = false; + private bool quitting = false; + + public static PluginComponent Create() + { + return new GameObject("IPA_PluginManager").AddComponent(); + } + + void Awake() + { + DontDestroyOnLoad(gameObject); + + plugins = new CompositePlugin(PluginManager.Plugins); + plugins.OnApplicationStart(); + + SceneManager.activeSceneChanged += OnActiveSceneChanged; + SceneManager.sceneLoaded += OnSceneLoaded; + SceneManager.sceneUnloaded += OnSceneUnloaded; + } + + void Start() + { + OnLevelWasLoaded(Application.loadedLevel); + } + + void Update() + { + if (freshlyLoaded) + { + freshlyLoaded = false; + plugins.OnLevelWasInitialized(Application.loadedLevel); + } + plugins.OnUpdate(); + } + + void LateUpdate() + { + plugins.OnLateUpdate(); + } + + void FixedUpdate() + { + plugins.OnFixedUpdate(); + } + + void OnDestroy() + { + if (!quitting) + { + Create(); + } + } + + void OnApplicationQuit() + { + SceneManager.activeSceneChanged += OnActiveSceneChanged; + SceneManager.sceneLoaded += OnSceneLoaded; + SceneManager.sceneUnloaded += OnSceneUnloaded; + + plugins.OnApplicationQuit(); + + quitting = true; + } + + void OnLevelWasLoaded(int level) + { + plugins.OnLevelWasLoaded(level); + freshlyLoaded = true; + } + + void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) + { + plugins.OnSceneLoaded(scene, sceneMode); + } + + private void OnSceneUnloaded(Scene scene) { + plugins.OnSceneUnloaded(scene); + } + + private void OnActiveSceneChanged(Scene prevScene, Scene nextScene) { + plugins.OnActiveSceneChanged(prevScene, nextScene); + } + + } +} diff --git a/IllusionInjector/PluginManager.cs b/IllusionInjector/PluginManager.cs index de9fb691..48270790 100644 --- a/IllusionInjector/PluginManager.cs +++ b/IllusionInjector/PluginManager.cs @@ -1,154 +1,154 @@ -using IllusionPlugin; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; - -namespace IllusionInjector -{ - public static class PluginManager - { - private static List _Plugins = null; - - internal static readonly Logger debugLogger = new Logger("IllusionInjector"); - - /// - /// Gets the list of loaded plugins and loads them if necessary. - /// - public static IEnumerable Plugins - { - get - { - if(_Plugins == null) - { - LoadPlugins(); - } - return _Plugins; - } - } - - - private static void LoadPlugins() - { - string pluginDirectory = Path.Combine(Environment.CurrentDirectory, "Plugins"); - - // Process.GetCurrentProcess().MainModule crashes the game and Assembly.GetEntryAssembly() is NULL, - // so we need to resort to P/Invoke - string exeName = Path.GetFileNameWithoutExtension(AppInfo.StartupPath); - debugLogger.Log(exeName); - _Plugins = new List(); - - if (!Directory.Exists(pluginDirectory)) return; - - if (!Directory.Exists(Path.Combine(pluginDirectory, ".cache"))) - { - Directory.CreateDirectory(Path.Combine(pluginDirectory, ".cache")); - } - else - { - foreach (string plugin in Directory.GetFiles(Path.Combine(pluginDirectory, ".cache"), "*")) - { - File.Delete(plugin); - } - } - - //Copy plugins to .cache - string[] originalPlugins = Directory.GetFiles(pluginDirectory, "*.dll"); - foreach (string s in originalPlugins) - { - string pluginCopy = pluginDirectory + "\\.cache" + s.Substring(s.LastIndexOf('\\')); - File.Copy(Path.Combine(pluginDirectory, s), pluginCopy); - } - - //Load copied plugins - string copiedPluginsDirectory = pluginDirectory + "\\.cache"; - string[] copiedPlugins = Directory.GetFiles(copiedPluginsDirectory, "*.dll"); - foreach (string s in copiedPlugins) - { - _Plugins.AddRange(LoadPluginsFromFile(s, exeName)); - } - - - // DEBUG - debugLogger.Log($"Running on Unity {UnityEngine.Application.unityVersion}"); - debugLogger.Log("-----------------------------"); - debugLogger.Log($"Loading plugins from {pluginDirectory} and found {_Plugins.Count}"); - debugLogger.Log("-----------------------------"); - foreach (var plugin in _Plugins) - { - debugLogger.Log($"{plugin.Name}: {plugin.Version}"); - if (!(plugin is IPluginNew)) { - debugLogger.Warning($"{plugin.Name} uses a Deprecated Interface! This may cause errors!"); - } - } - debugLogger.Log("-----------------------------"); - } - - private static IEnumerable LoadPluginsFromFile(string file, string exeName) - { - List plugins = new List(); - - if (!File.Exists(file) || !file.EndsWith(".dll", true, null)) - return plugins; - - try - { - Assembly assembly = Assembly.LoadFrom(file); - - foreach (Type t in assembly.GetTypes()) - { - if (t.GetInterface("IPlugin") != null) - { - try - { - - IPlugin pluginInstance = Activator.CreateInstance(t) as IPlugin; - string[] filter = null; - - if (pluginInstance is IEnhancedPlugin) - { - filter = ((IEnhancedPlugin)pluginInstance).Filter; - } - - if(filter == null || filter.Contains(exeName, StringComparer.OrdinalIgnoreCase)) - plugins.Add(pluginInstance); - } - catch (Exception e) - { - debugLogger.Exception($"Could not load plugin {t.FullName} in {Path.GetFileName(file)}! {e}"); - } - } - } - - } - catch (Exception e) - { - debugLogger.Error($"Could not load {Path.GetFileName(file)}! {e}"); - } - - return plugins; - } - - public class AppInfo - { - [DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = false)] - private static extern int GetModuleFileName(HandleRef hModule, StringBuilder buffer, int length); - private static HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero); - public static string StartupPath - { - get - { - StringBuilder stringBuilder = new StringBuilder(260); - GetModuleFileName(NullHandleRef, stringBuilder, stringBuilder.Capacity); - return stringBuilder.ToString(); - } - } - } - - } -} +using IllusionPlugin; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; + +namespace IllusionInjector +{ + public static class PluginManager + { + private static List _Plugins = null; + + internal static readonly Logger debugLogger = new Logger("IllusionInjector"); + + /// + /// Gets the list of loaded plugins and loads them if necessary. + /// + public static IEnumerable Plugins + { + get + { + if(_Plugins == null) + { + LoadPlugins(); + } + return _Plugins; + } + } + + + private static void LoadPlugins() + { + string pluginDirectory = Path.Combine(Environment.CurrentDirectory, "Plugins"); + + // Process.GetCurrentProcess().MainModule crashes the game and Assembly.GetEntryAssembly() is NULL, + // so we need to resort to P/Invoke + string exeName = Path.GetFileNameWithoutExtension(AppInfo.StartupPath); + debugLogger.Log(exeName); + _Plugins = new List(); + + if (!Directory.Exists(pluginDirectory)) return; + + if (!Directory.Exists(Path.Combine(pluginDirectory, ".cache"))) + { + Directory.CreateDirectory(Path.Combine(pluginDirectory, ".cache")); + } + else + { + foreach (string plugin in Directory.GetFiles(Path.Combine(pluginDirectory, ".cache"), "*")) + { + File.Delete(plugin); + } + } + + //Copy plugins to .cache + string[] originalPlugins = Directory.GetFiles(pluginDirectory, "*.dll"); + foreach (string s in originalPlugins) + { + string pluginCopy = pluginDirectory + "\\.cache" + s.Substring(s.LastIndexOf('\\')); + File.Copy(Path.Combine(pluginDirectory, s), pluginCopy); + } + + //Load copied plugins + string copiedPluginsDirectory = pluginDirectory + "\\.cache"; + string[] copiedPlugins = Directory.GetFiles(copiedPluginsDirectory, "*.dll"); + foreach (string s in copiedPlugins) + { + _Plugins.AddRange(LoadPluginsFromFile(s, exeName)); + } + + + // DEBUG + debugLogger.Log($"Running on Unity {UnityEngine.Application.unityVersion}"); + debugLogger.Log("-----------------------------"); + debugLogger.Log($"Loading plugins from {pluginDirectory} and found {_Plugins.Count}"); + debugLogger.Log("-----------------------------"); + foreach (var plugin in _Plugins) + { + debugLogger.Log($"{plugin.Name}: {plugin.Version}"); + if (!(plugin is IPluginNew)) { + debugLogger.Warning($"{plugin.Name} uses a Deprecated Interface! This may cause errors!"); + } + } + debugLogger.Log("-----------------------------"); + } + + private static IEnumerable LoadPluginsFromFile(string file, string exeName) + { + List plugins = new List(); + + if (!File.Exists(file) || !file.EndsWith(".dll", true, null)) + return plugins; + + try + { + Assembly assembly = Assembly.LoadFrom(file); + + foreach (Type t in assembly.GetTypes()) + { + if (t.GetInterface("IPlugin") != null) + { + try + { + + IPlugin pluginInstance = Activator.CreateInstance(t) as IPlugin; + string[] filter = null; + + if (pluginInstance is IEnhancedPlugin) + { + filter = ((IEnhancedPlugin)pluginInstance).Filter; + } + + if(filter == null || filter.Contains(exeName, StringComparer.OrdinalIgnoreCase)) + plugins.Add(pluginInstance); + } + catch (Exception e) + { + debugLogger.Exception($"Could not load plugin {t.FullName} in {Path.GetFileName(file)}! {e}"); + } + } + } + + } + catch (Exception e) + { + debugLogger.Error($"Could not load {Path.GetFileName(file)}! {e}"); + } + + return plugins; + } + + public class AppInfo + { + [DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = false)] + private static extern int GetModuleFileName(HandleRef hModule, StringBuilder buffer, int length); + private static HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero); + public static string StartupPath + { + get + { + StringBuilder stringBuilder = new StringBuilder(260); + GetModuleFileName(NullHandleRef, stringBuilder, stringBuilder.Capacity); + return stringBuilder.ToString(); + } + } + } + + } +} diff --git a/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache b/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache index 00efea32..7e88f8ec 100644 --- a/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache +++ b/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -207669803f9c3f5ead7136a41944fdaa372fd294 +c4f9eceab04df8633c0ae4f922a37f459ec45217 diff --git a/IllusionPlugin/IPlugin.cs b/IllusionPlugin/IPlugin.cs index 13338c7e..6aa5d179 100644 --- a/IllusionPlugin/IPlugin.cs +++ b/IllusionPlugin/IPlugin.cs @@ -1,50 +1,50 @@ -using System; -using System.Collections.Generic; -using System.Text; -using UnityEngine.SceneManagement; - -namespace IllusionPlugin -{ - /// - /// Interface for generic Illusion unity plugins. Every class that implements this will be loaded if the DLL is placed at - /// data/Managed/Plugins. - /// - public interface IPlugin - { - - /// - /// Gets the name of the plugin. - /// - string Name { get; } - - /// - /// Gets the version of the plugin. - /// - string Version { get; } - - /// - /// Gets invoked when the application is started. - /// - void OnApplicationStart(); - - /// - /// Gets invoked when the application is closed. - /// - void OnApplicationQuit(); - - /// - /// Gets invoked on every graphic update. - /// - void OnUpdate(); - - /// - /// Gets invoked on ever physics update. - /// - void OnFixedUpdate(); - - [Obsolete("Use OnSceneLoaded instead")] - void OnLevelWasLoaded(int level); - [Obsolete("Use OnSceneLoaded instead")] - void OnLevelWasInitialized(int level); - } -} +using System; +using System.Collections.Generic; +using System.Text; +using UnityEngine.SceneManagement; + +namespace IllusionPlugin +{ + /// + /// Interface for generic Illusion unity plugins. Every class that implements this will be loaded if the DLL is placed at + /// data/Managed/Plugins. + /// + public interface IPlugin + { + + /// + /// Gets the name of the plugin. + /// + string Name { get; } + + /// + /// Gets the version of the plugin. + /// + string Version { get; } + + /// + /// Gets invoked when the application is started. + /// + void OnApplicationStart(); + + /// + /// Gets invoked when the application is closed. + /// + void OnApplicationQuit(); + + /// + /// Gets invoked on every graphic update. + /// + void OnUpdate(); + + /// + /// Gets invoked on ever physics update. + /// + void OnFixedUpdate(); + + [Obsolete("Use OnSceneLoaded instead")] + void OnLevelWasLoaded(int level); + [Obsolete("Use OnSceneLoaded instead")] + void OnLevelWasInitialized(int level); + } +} diff --git a/IllusionPlugin/IllusionPlugin.csproj b/IllusionPlugin/IllusionPlugin.csproj index b2004142..8bf9a741 100644 --- a/IllusionPlugin/IllusionPlugin.csproj +++ b/IllusionPlugin/IllusionPlugin.csproj @@ -1,60 +1,60 @@ - - - - - Debug - AnyCPU - {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71} - Library - Properties - IllusionPlugin - IllusionPlugin - v3.5 - 512 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - none - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\IllusionPlugin.XML - - - - - - - ..\Libs\UnityEngine.CoreModule.dll - - - - - - - - - - - - - + + + + + Debug + AnyCPU + {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71} + Library + Properties + IllusionPlugin + IllusionPlugin + v3.5 + 512 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + none + true + bin\Release\ + TRACE + prompt + 4 + bin\Release\IllusionPlugin.XML + + + + + + + ..\Libs\UnityEngine.CoreModule.dll + + + + + + + + + + + + + \ No newline at end of file diff --git a/IllusionPlugin/IniFile.cs b/IllusionPlugin/IniFile.cs index 1c6a435b..cf60a61e 100644 --- a/IllusionPlugin/IniFile.cs +++ b/IllusionPlugin/IniFile.cs @@ -1,101 +1,101 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.InteropServices; -using System.Text; - -namespace IllusionPlugin -{ - /// - /// Create a New INI file to store or load data - /// - internal class IniFile - { - [DllImport("KERNEL32.DLL", EntryPoint = "GetPrivateProfileStringW", - SetLastError = true, - CharSet = CharSet.Unicode, ExactSpelling = true, - CallingConvention = CallingConvention.StdCall)] - private static extern int GetPrivateProfileString( - string lpSection, - string lpKey, - string lpDefault, - StringBuilder lpReturnString, - int nSize, - string lpFileName); - - [DllImport("KERNEL32.DLL", EntryPoint = "WritePrivateProfileStringW", - SetLastError = true, - CharSet = CharSet.Unicode, ExactSpelling = true, - CallingConvention = CallingConvention.StdCall)] - private static extern int WritePrivateProfileString( - string lpSection, - string lpKey, - string lpValue, - string lpFileName); - - /*private string _path = ""; - public string Path - { - get - { - return _path; - } - set - { - if (!File.Exists(value)) - File.WriteAllText(value, "", Encoding.Unicode); - _path = value; - } - }*/ - - private FileInfo _iniFileInfo; - public FileInfo IniFileInfo { - get => _iniFileInfo; - set { - _iniFileInfo = value; - if (_iniFileInfo.Exists) return; - _iniFileInfo.Directory?.Create(); - _iniFileInfo.Create(); - } - } - - /// - /// INIFile Constructor. - /// - /// - public IniFile(string iniPath) - { - IniFileInfo = new FileInfo(iniPath); - //this.Path = INIPath; - } - - /// - /// Write Data to the INI File - /// - /// - /// Section name - /// - /// Key Name - /// - /// Value Name - public void IniWriteValue(string Section, string Key, string Value) - { - WritePrivateProfileString(Section, Key, Value, IniFileInfo.FullName); - } - - /// - /// Read Data Value From the Ini File - /// - /// - /// - /// - /// - public string IniReadValue(string Section, string Key) - { - const int MAX_CHARS = 1023; - StringBuilder result = new StringBuilder(MAX_CHARS); - GetPrivateProfileString(Section, Key, "", result, MAX_CHARS, IniFileInfo.FullName); - return result.ToString(); - } - } -} +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Text; + +namespace IllusionPlugin +{ + /// + /// Create a New INI file to store or load data + /// + internal class IniFile + { + [DllImport("KERNEL32.DLL", EntryPoint = "GetPrivateProfileStringW", + SetLastError = true, + CharSet = CharSet.Unicode, ExactSpelling = true, + CallingConvention = CallingConvention.StdCall)] + private static extern int GetPrivateProfileString( + string lpSection, + string lpKey, + string lpDefault, + StringBuilder lpReturnString, + int nSize, + string lpFileName); + + [DllImport("KERNEL32.DLL", EntryPoint = "WritePrivateProfileStringW", + SetLastError = true, + CharSet = CharSet.Unicode, ExactSpelling = true, + CallingConvention = CallingConvention.StdCall)] + private static extern int WritePrivateProfileString( + string lpSection, + string lpKey, + string lpValue, + string lpFileName); + + /*private string _path = ""; + public string Path + { + get + { + return _path; + } + set + { + if (!File.Exists(value)) + File.WriteAllText(value, "", Encoding.Unicode); + _path = value; + } + }*/ + + private FileInfo _iniFileInfo; + public FileInfo IniFileInfo { + get => _iniFileInfo; + set { + _iniFileInfo = value; + if (_iniFileInfo.Exists) return; + _iniFileInfo.Directory?.Create(); + _iniFileInfo.Create(); + } + } + + /// + /// INIFile Constructor. + /// + /// + public IniFile(string iniPath) + { + IniFileInfo = new FileInfo(iniPath); + //this.Path = INIPath; + } + + /// + /// Write Data to the INI File + /// + /// + /// Section name + /// + /// Key Name + /// + /// Value Name + public void IniWriteValue(string Section, string Key, string Value) + { + WritePrivateProfileString(Section, Key, Value, IniFileInfo.FullName); + } + + /// + /// Read Data Value From the Ini File + /// + /// + /// + /// + /// + public string IniReadValue(string Section, string Key) + { + const int MAX_CHARS = 1023; + StringBuilder result = new StringBuilder(MAX_CHARS); + GetPrivateProfileString(Section, Key, "", result, MAX_CHARS, IniFileInfo.FullName); + return result.ToString(); + } + } +} diff --git a/IllusionPlugin/ModPrefs.cs b/IllusionPlugin/ModPrefs.cs index 91f3daf2..561eff11 100644 --- a/IllusionPlugin/ModPrefs.cs +++ b/IllusionPlugin/ModPrefs.cs @@ -1,167 +1,167 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; - -namespace IllusionPlugin -{ - /// - /// Allows to get and set preferences for your mod. - /// - public class ModPrefs { - internal static Dictionary ModPrefses { get; set; } = new Dictionary(); - - private IniFile Instance; - - public ModPrefs(IPlugin plugin) { - Instance = new IniFile(Path.Combine(Environment.CurrentDirectory, $"UserData/ModPrefs/{plugin.Name}.ini")); - ModPrefses.Add(plugin, this); - } - - /// - /// Gets a string from the ini. - /// - /// Section of the key. - /// Name of the key. - /// Value that should be used when no value is found. - /// Whether or not the default value should be written if no value is found. - /// - public string GetString(string section, string name, string defaultValue = "", bool autoSave = false) - { - var value = Instance.IniReadValue(section, name); - if (value != "") - return value; - else if (autoSave) - SetString(section, name, defaultValue); - - return defaultValue; - } - - /// - /// Gets an int from the ini. - /// - /// Section of the key. - /// Name of the key. - /// Value that should be used when no value is found. - /// Whether or not the default value should be written if no value is found. - /// - public int GetInt(string section, string name, int defaultValue = 0, bool autoSave = false) - { - if (int.TryParse(Instance.IniReadValue(section, name), out var value)) - return value; - else if (autoSave) - SetInt(section, name, defaultValue); - - return defaultValue; - } - - - /// - /// Gets a float from the ini. - /// - /// Section of the key. - /// Name of the key. - /// Value that should be used when no value is found. - /// Whether or not the default value should be written if no value is found. - /// - public float GetFloat(string section, string name, float defaultValue = 0f, bool autoSave = false) - { - if (float.TryParse(Instance.IniReadValue(section, name), out var value)) - return value; - else if (autoSave) - SetFloat(section, name, defaultValue); - - return defaultValue; - } - - /// - /// Gets a bool from the ini. - /// - /// Section of the key. - /// Name of the key. - /// Value that should be used when no value is found. - /// Whether or not the default value should be written if no value is found. - /// - public bool GetBool(string section, string name, bool defaultValue = false, bool autoSave = false) - { - string sVal = GetString(section, name, null); - if (sVal == "1" || sVal == "0") - { - return sVal == "1"; - } else if (autoSave) - { - SetBool(section, name, defaultValue); - } - - return defaultValue; - } - - - /// - /// Checks whether or not a key exists in the ini. - /// - /// Section of the key. - /// Name of the key. - /// - public bool HasKey(string section, string name) - { - return Instance.IniReadValue(section, name) != null; - } - - /// - /// Sets a float in the ini. - /// - /// Section of the key. - /// Name of the key. - /// Value that should be written. - public void SetFloat(string section, string name, float value) - { - Instance.IniWriteValue(section, name, value.ToString()); - } - - /// - /// Sets an int in the ini. - /// - /// Section of the key. - /// Name of the key. - /// Value that should be written. - public void SetInt(string section, string name, int value) - { - Instance.IniWriteValue(section, name, value.ToString()); - - } - - /// - /// Sets a string in the ini. - /// - /// Section of the key. - /// Name of the key. - /// Value that should be written. - public void SetString(string section, string name, string value) - { - Instance.IniWriteValue(section, name, value); - - } - - /// - /// Sets a bool in the ini. - /// - /// Section of the key. - /// Name of the key. - /// Value that should be written. - public void SetBool(string section, string name, bool value) - { - Instance.IniWriteValue(section, name, value ? "1" : "0"); - - } - - } - - public static class ModPrefsExtensions { - public static ModPrefs GetModPrefs(this IPlugin plugin) { - return ModPrefs.ModPrefses.First(o => o.Key == plugin).Value; - } - } -} +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace IllusionPlugin +{ + /// + /// Allows to get and set preferences for your mod. + /// + public class ModPrefs { + internal static Dictionary ModPrefses { get; set; } = new Dictionary(); + + private IniFile Instance; + + public ModPrefs(IPlugin plugin) { + Instance = new IniFile(Path.Combine(Environment.CurrentDirectory, $"UserData/ModPrefs/{plugin.Name}.ini")); + ModPrefses.Add(plugin, this); + } + + /// + /// Gets a string from the ini. + /// + /// Section of the key. + /// Name of the key. + /// Value that should be used when no value is found. + /// Whether or not the default value should be written if no value is found. + /// + public string GetString(string section, string name, string defaultValue = "", bool autoSave = false) + { + var value = Instance.IniReadValue(section, name); + if (value != "") + return value; + else if (autoSave) + SetString(section, name, defaultValue); + + return defaultValue; + } + + /// + /// Gets an int from the ini. + /// + /// Section of the key. + /// Name of the key. + /// Value that should be used when no value is found. + /// Whether or not the default value should be written if no value is found. + /// + public int GetInt(string section, string name, int defaultValue = 0, bool autoSave = false) + { + if (int.TryParse(Instance.IniReadValue(section, name), out var value)) + return value; + else if (autoSave) + SetInt(section, name, defaultValue); + + return defaultValue; + } + + + /// + /// Gets a float from the ini. + /// + /// Section of the key. + /// Name of the key. + /// Value that should be used when no value is found. + /// Whether or not the default value should be written if no value is found. + /// + public float GetFloat(string section, string name, float defaultValue = 0f, bool autoSave = false) + { + if (float.TryParse(Instance.IniReadValue(section, name), out var value)) + return value; + else if (autoSave) + SetFloat(section, name, defaultValue); + + return defaultValue; + } + + /// + /// Gets a bool from the ini. + /// + /// Section of the key. + /// Name of the key. + /// Value that should be used when no value is found. + /// Whether or not the default value should be written if no value is found. + /// + public bool GetBool(string section, string name, bool defaultValue = false, bool autoSave = false) + { + string sVal = GetString(section, name, null); + if (sVal == "1" || sVal == "0") + { + return sVal == "1"; + } else if (autoSave) + { + SetBool(section, name, defaultValue); + } + + return defaultValue; + } + + + /// + /// Checks whether or not a key exists in the ini. + /// + /// Section of the key. + /// Name of the key. + /// + public bool HasKey(string section, string name) + { + return Instance.IniReadValue(section, name) != null; + } + + /// + /// Sets a float in the ini. + /// + /// Section of the key. + /// Name of the key. + /// Value that should be written. + public void SetFloat(string section, string name, float value) + { + Instance.IniWriteValue(section, name, value.ToString()); + } + + /// + /// Sets an int in the ini. + /// + /// Section of the key. + /// Name of the key. + /// Value that should be written. + public void SetInt(string section, string name, int value) + { + Instance.IniWriteValue(section, name, value.ToString()); + + } + + /// + /// Sets a string in the ini. + /// + /// Section of the key. + /// Name of the key. + /// Value that should be written. + public void SetString(string section, string name, string value) + { + Instance.IniWriteValue(section, name, value); + + } + + /// + /// Sets a bool in the ini. + /// + /// Section of the key. + /// Name of the key. + /// Value that should be written. + public void SetBool(string section, string name, bool value) + { + Instance.IniWriteValue(section, name, value ? "1" : "0"); + + } + + } + + public static class ModPrefsExtensions { + public static ModPrefs GetModPrefs(this IPlugin plugin) { + return ModPrefs.ModPrefses.First(o => o.Key == plugin).Value; + } + } +} diff --git a/IllusionPlugin/obj/Debug/IllusionPlugin.csproj.CoreCompileInputs.cache b/IllusionPlugin/obj/Debug/IllusionPlugin.csproj.CoreCompileInputs.cache index a3afe4a3..77da6a5d 100644 --- a/IllusionPlugin/obj/Debug/IllusionPlugin.csproj.CoreCompileInputs.cache +++ b/IllusionPlugin/obj/Debug/IllusionPlugin.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -dd098bdf8443f9e98a9261f325ce0c78fe53aba4 +de4d7d5be2f255b6eb5fe16bec001496ad0c8963 diff --git a/Launcher/Launcher.csproj b/Launcher/Launcher.csproj deleted file mode 100644 index 41f8b12d..00000000 --- a/Launcher/Launcher.csproj +++ /dev/null @@ -1,91 +0,0 @@ - - - - - Debug - AnyCPU - {D1390268-F68B-4A55-B50D-EAD25756C8EF} - WinExe - Properties - Launcher - Launcher - v3.5 - 512 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - syringe.ico - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - \ No newline at end of file diff --git a/Launcher/Program.cs b/Launcher/Program.cs deleted file mode 100644 index 711fef76..00000000 --- a/Launcher/Program.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Text.RegularExpressions; -using System.Windows.Forms; - -namespace Launcher -{ - static class Program - { - private static string[] TABOO_NAMES = { - //"Start", - //"Update", - //"Awake", - //"OnDestroy" - }; - private static string[] ENTRY_TYPES = { "Display" }; - - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - try { - var execPath = Application.ExecutablePath; - var fileName = Path.GetFileNameWithoutExtension(execPath); - if (fileName.IndexOf("VR") == -1 && fileName.IndexOf("_") == -1) - { - Fail("File not named correctly!"); - } - - bool vrMode = fileName.IndexOf("VR") > 0; - string baseName = execPath.Substring(0, vrMode - ? execPath.LastIndexOf("VR") - : execPath.LastIndexOf("_")); - - string executable = baseName + ".exe"; - var file = new FileInfo(executable); - if (file.Exists) - { - var args = Environment.GetCommandLineArgs().ToList(); - if (vrMode) args.Add("--vr"); - EnsureIPA(executable); - StartGame(executable, args.ToArray()); - } - else - { - MessageBox.Show("Could not find: " + file.FullName, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } catch(Exception globalException) { - MessageBox.Show(globalException.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - } - - private static void EnsureIPA(string executable) - { - var processStart = new ProcessStartInfo("IPA.exe", EncodeParameterArgument(executable) + " --nowait"); - processStart.UseShellExecute = false; - processStart.CreateNoWindow = true; - processStart.RedirectStandardError = true; - - var process = Process.Start(processStart); - process.WaitForExit(); - if(process.ExitCode != 0) - { - Fail(process.StandardError.ReadToEnd()); - } - } - - private static void StartGame(string executable, string[] args) - { - var arguments = string.Join(" ", args.ToArray()); - Process.Start(executable, arguments); - } - - private static void Fail(string reason) { - throw new Exception(reason); - } - - /// - /// Encodes an argument for passing into a program - /// - /// The value that should be received by the program - /// The value which needs to be passed to the program for the original value - /// to come through - private static string EncodeParameterArgument(string original) - { - if (string.IsNullOrEmpty(original)) - return original; - string value = Regex.Replace(original, @"(\\*)" + "\"", @"$1\$0"); - value = Regex.Replace(value, @"^(.*\s.*?)(\\*)$", "\"$1$2$2\""); - return value; - } - - } -} diff --git a/Launcher/Properties/AssemblyInfo.cs b/Launcher/Properties/AssemblyInfo.cs deleted file mode 100644 index f7570c31..00000000 --- a/Launcher/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Launcher")] -[assembly: AssemblyDescription("Rename to [EXE]_Patched.exe or [EXE]VR.exe")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Launcher")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d590f676-c2c0-4b80-ae93-6edf274320e6")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Launcher/Properties/Resources.Designer.cs b/Launcher/Properties/Resources.Designer.cs deleted file mode 100644 index f20450db..00000000 --- a/Launcher/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Launcher.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Launcher.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Launcher/Properties/Resources.resx b/Launcher/Properties/Resources.resx deleted file mode 100644 index ffecec85..00000000 --- a/Launcher/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Launcher/Properties/Settings.Designer.cs b/Launcher/Properties/Settings.Designer.cs deleted file mode 100644 index 18739306..00000000 --- a/Launcher/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Launcher.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Launcher/Properties/Settings.settings b/Launcher/Properties/Settings.settings deleted file mode 100644 index abf36c5d..00000000 --- a/Launcher/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/Launcher/Resources.Designer.cs b/Launcher/Resources.Designer.cs deleted file mode 100644 index ce6216de..00000000 --- a/Launcher/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Launcher { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Launcher.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Launcher/Resources.resx b/Launcher/Resources.resx deleted file mode 100644 index 4d26a2af..00000000 --- a/Launcher/Resources.resx +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - \ No newline at end of file diff --git a/Launcher/obj/Debug/Launcher.csproj.CoreCompileInputs.cache b/Launcher/obj/Debug/Launcher.csproj.CoreCompileInputs.cache deleted file mode 100644 index 67d70831..00000000 --- a/Launcher/obj/Debug/Launcher.csproj.CoreCompileInputs.cache +++ /dev/null @@ -1 +0,0 @@ -7c6dbd91916854c83d27e1fd6e1b9ccedbe983b8 diff --git a/Launcher/packages.config b/Launcher/packages.config deleted file mode 100644 index 6f7c8833..00000000 --- a/Launcher/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Launcher/syringe.ico b/Launcher/syringe.ico deleted file mode 100644 index db70bbab55c99098dc823371e47368fdb3264068..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32988 zcmeHP30PFuy`QvsNt!lI+H}c#udns>tE~;f%s^sZnxr2M!=_2PeWZQny(W2y;F3g> zs1akr5SQ4RG>NhZ3=ANk4$QC(0}KoUiV6aX1{GzQ1sL{4Kt&Td{hvFW;c}gO8D<7d z=Ux5gJNKUD|NsAf=iIY#{zo9VLvW|S-(LXXBEb>}g9HM>qD52h4+sQrK-@zQO}&3Z zAc*^&K=1&>Q~B={2rB+tAXoxrAe%r6KOE2h;~C%?aGin5;*3Yj^3%kwOZw-MpwVP} zyR1N7R9TdcD%I&oo12n~^m^!RJpUiYUY?(N^n~^h(qt#1;+!N@t5cw|+~nsy9es6v z@_iWlvC=H0KAeDx6bTUSM>XY#QL$3C&6DxhK)qMku_}H#dwS;QOb}mKNVFK9YDI=v}MlPM=uvBG_NMOnPHGm&r*6`N1wH-8bRKoIo@M0#V{gCEfb>OKC_gJ^M!n;HqaZ65`i;}*=8e%* z;Q8w`l}BU~Ys-gWL|ffs$evb3Fjq1Su?b=u*83%eSyV?LT2 zkE79{9)u>ZqAR0)N>@1u^67ZR9%g#nauzrW!gI#%X0^ba4g;cz9M&H--kTy37JcfgM8onR*+=HTksK#nWzAXwP> z8zye@?(fz2Emv@ImF;S4TG?y9_=V|GquuX)y56mAo?vE%?%+ToG$s?wBn~b*M_fEIX-m^1(BCLDq@|TpR1} zBkjOl*a;R#zXgAh;Q>;HD-7}N@Noxjx{UGRKB^tufOc?sz(~z+xNMkf8Xg;G>l3MZ zb)fzwzLsCoZFkr6@Nk#-#?^sd^yLuR_F9_*mduR>hrR^|w9a*JY%csD)F-N`=#;SwEZg(aH`x$*% zZE&EC&Q=z45blTm#h%S8yhpxcul#(kkC?X1HwVEYV+vCzc@GkqUZisnC^YRRX$u*K zKGG$o+u`o#;77Z?Sn<%>nZ&Q{e%5^RobcQ{aWFLdDNl zJ9y@?zQtS^0(=Z1{)^B(TzM8M&E5S$kjT7ep=@`T9(Qr@&Z-(zT@rV+JU{7&?y_y6 z>IM5Zu!g;%R>hII|{MDhPJ)gMSp4%bMk+D%%I9>0s7l-0M zeh)=$e$}#l%j&0Zht2NR$;H8uVtn2(9%0-S1!*YZllRfq4KJe|Ti2qUk?XERZ(SGQ zZhLNrycMu7vD|kcm&}oW_0xg1r;f${QLmAY;`3N=2K5@8$$RpQ_M<)0^(e|iIUqQ>LMsOwJhmNh zVJB&XgBk6>L;3@Pakh}o!OpGgJgQHe4LeES5xM5$J<<)f{$TsoHCH`lTp$={3#}YL zpSU?3?IdHP2aOA};m7IpcJTj|gPHvSnIn15{J@cRVB>)HE$n!A?URm_^^`nT4sd@E zfj*9Y6Me8HLhUKo9L2FCa_ydvqBo$wZ+{DY5V>}vqvbp)-_EUTR_uyg_lzfD;<4}y zxQhXNPrxGh`NQv@@t%NVMVW3r>kc$H{15NH*6I#V6lKe{J6y<38MP|e0qj$Bv^WFh zWyYnuNvuO+U@s~I>n=PPhiY_6)N=O33l0@@L#EOx-1z)8_~9cX_@DHdn#T;y4Yo6W zMT$gGojyCNI9I;N5tZ1N?is(a)e`SEZ?^nWsq|~$_bbCbZP=#=>uzZ}iP}NGrM(IK zgw9CHsSs_hY}dup zm5+9`oH;ez-Ad^;fKrb?JpsBur0FJg%w+@C4rl3KBYC;nf=09VZmlx;?ZT|M-=QzB|NhEI@8meNxsiS& zV$)6Jve^JSuQP07yl?W$i5|c`?OQFy!Jc1}AImu>Hk*F)aQpLY`s~HS*&t|>)90ckK5bbfA08Lj z^l-%o3+HA-u-N=Ik+=NOzK5`Ws!t%1PK0x@;fcjvadZ^{!qy1MQrFLkI%>nG(dt*| z`rY|Fn+^FHIjE{6w#J=0nX=eyIFyuu>Z`D?al*WxQDWMlKA4MYE0R%K>`wIl+plV+ zufH&_J~Wt<5MkSs0S}M9{lSJKPgHAT_7^MVFTJz=#rI?X`VNZTvi8J6*ubnC{2sj} zVprVXw%lGDHhu+c03Kp*I}dBDHbkze-4nH%x=+Dgoy}*Qbkph&KijntZI6stKA(EH zWbcZ6Z3(P7=Ijs0CDWBOyiWjE4hlr@`zq}dz#R15lAOfnUBSjywlpU>@qDcs&u_JC zd7O=h`D;=&tldwPDe$^2*;zTva(G@^k|RqzuFay(j9{N!yhbv$H15WE!Iv+xN|S!J zNR?h1!MB>aV}tUiq9?+$*1EPv6@}@r_HICi=F{*yg?c+KqGM&MBc-Y& z&?~!{8MDLgzKq1%xRT7TaLDxCRKPkH))p&kEAyT*w=`-m_qJ2_4b>efg8SBFST^c4 zHII*7?*B8xH0o6%GOnP@f7Z`(uf2RYuA`&l8y55Vyrw!G%FWnI-P>Wfc$!*ETpu5V zwOhyk*eyG?q6rciXWjPzzPIV}Qz+T^-lWk%d?$br)}}p3uO2`lzNTArz*xPE!eCeV zbY!t2DZE~v17|@GQXGvAc2jGhn>S40qex$Owg2yQDe{EAhM!=~_n!evY9A!A^boJH z%5!D)EuYusqMKLIaGx3O@xXrDM%$W>a1Hb5TW|yljc?h~#pXxovYF492fAXgPkg~a zb|2Y5Ap-}^iU47I3{xiay}G<3hS7eW0zA0ky&TZ>PtvcL?gRW!S8!s*1HKijVVSaFI+w>B~F&_O+L>4UX1?Szb>n#wT*XZNO~ui9624!QDaX-wtujdl{^%8s<|p~| zdg+~ohxf-c9?e5d^_3U#Ugqnshu*EpiNED;+kj=A4+iLW7*emUXv8@Z8J2gFS(q-T>f!^(55|P25UOp%Dv&DvU^^Z+l z>25Gz8l{a$R;wkxRyzXm_&1eG`6|! z0Y0rS26>x*%}_n#HDKATGWKjMtDcc*mKVAV`KP5wk+Q87irg_vu^Gv~_+I~gtHUlX zYpUDz#CvbO`dQSbSIePt=OlwJFlzHE8Jq