diff --git a/BSIPA.sln b/BSIPA.sln
index 548da4f3..34c5c3a7 100644
--- a/BSIPA.sln
+++ b/BSIPA.sln
@@ -5,18 +5,18 @@ VisualStudioVersion = 15.0.27428.2043
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA", "IPA\IPA.csproj", "{14092533-98BB-40A4-9AFC-27BB75672A70}"
ProjectSection(ProjectDependencies) = postProject
- {D1C61AF5-0D2D-4752-8203-1C6929025F7C} = {D1C61AF5-0D2D-4752-8203-1C6929025F7C}
- {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71} = {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}
+ {5AD344F0-01A0-4CA8-92E5-9D095737744D} = {5AD344F0-01A0-4CA8-92E5-9D095737744D}
+ {2A1AF16B-27F1-46E0-9A95-181516BC1CB7} = {2A1AF16B-27F1-46E0-9A95-181516BC1CB7}
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
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSBuildTasks", "MSBuildTasks\MSBuildTasks.csproj", "{F08C3C7A-3221-432E-BAB8-32BCE58408C8}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA.Loader", "IPA.Loader\IPA.Loader.csproj", "{5AD344F0-01A0-4CA8-92E5-9D095737744D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA.Injector", "IPA.Injector\IPA.Injector.csproj", "{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -27,14 +27,6 @@ Global
{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
@@ -43,6 +35,14 @@ Global
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5AD344F0-01A0-4CA8-92E5-9D095737744D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5AD344F0-01A0-4CA8-92E5-9D095737744D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5AD344F0-01A0-4CA8-92E5-9D095737744D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5AD344F0-01A0-4CA8-92E5-9D095737744D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/IPA.Injector/Bootstrapper.cs b/IPA.Injector/Bootstrapper.cs
new file mode 100644
index 00000000..1d0f2261
--- /dev/null
+++ b/IPA.Injector/Bootstrapper.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using UnityEngine;
+
+namespace IPA.Injector
+{
+ class Bootstrapper : MonoBehaviour
+ {
+ public event Action Destroyed = delegate {};
+
+ void Awake()
+ {
+ //if (Environment.CommandLine.Contains("--verbose"))
+ //{
+ Ipa.Injector.Windows.WinConsole.Initialize();
+ //}
+ }
+
+ void Start()
+ {
+ Destroy(gameObject);
+ }
+ void OnDestroy()
+ {
+ Destroyed();
+ }
+ }
+}
diff --git a/IPA.Injector/ConsoleWindow.cs b/IPA.Injector/ConsoleWindow.cs
new file mode 100644
index 00000000..1121d765
--- /dev/null
+++ b/IPA.Injector/ConsoleWindow.cs
@@ -0,0 +1,104 @@
+using System;
+using System.Collections;
+using System.Runtime.InteropServices;
+using System.IO;
+using System.Text;
+using Microsoft.Win32.SafeHandles;
+
+namespace Ipa.Injector.Windows
+{
+ // https://stackoverflow.com/a/48864902/3117125
+ static class WinConsole
+ {
+ static public void Initialize(bool alwaysCreateNewConsole = true)
+ {
+ bool consoleAttached = true;
+ if (alwaysCreateNewConsole
+ || (AttachConsole(ATTACH_PARRENT) == 0
+ && Marshal.GetLastWin32Error() != ERROR_ACCESS_DENIED))
+ {
+ consoleAttached = AllocConsole() != 0;
+ }
+
+ if (consoleAttached)
+ {
+ InitializeOutStream();
+ InitializeInStream();
+ }
+ }
+
+ private static void InitializeOutStream()
+ {
+ var fs = CreateFileStream("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, FileAccess.Write);
+ if (fs != null)
+ {
+ var writer = new StreamWriter(fs) { AutoFlush = true };
+ Console.SetOut(writer);
+ Console.SetError(writer);
+ }
+ }
+
+ private static void InitializeInStream()
+ {
+ var fs = CreateFileStream("CONIN$", GENERIC_READ, FILE_SHARE_READ, FileAccess.Read);
+ if (fs != null)
+ {
+ Console.SetIn(new StreamReader(fs));
+ }
+ }
+
+ private static FileStream CreateFileStream(string name, uint win32DesiredAccess, uint win32ShareMode,
+ FileAccess dotNetFileAccess)
+ {
+ var file = new SafeFileHandle(CreateFileW(name, win32DesiredAccess, win32ShareMode, IntPtr.Zero, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero), true);
+ if (!file.IsInvalid)
+ {
+ var fs = new FileStream(file, dotNetFileAccess);
+ return fs;
+ }
+ return null;
+ }
+
+ #region Win API Functions and Constants
+ [DllImport("kernel32.dll",
+ EntryPoint = "AllocConsole",
+ SetLastError = true,
+ CharSet = CharSet.Auto,
+ CallingConvention = CallingConvention.StdCall)]
+ private static extern int AllocConsole();
+
+ [DllImport("kernel32.dll",
+ EntryPoint = "AttachConsole",
+ SetLastError = true,
+ CharSet = CharSet.Auto,
+ CallingConvention = CallingConvention.StdCall)]
+ private static extern UInt32 AttachConsole(UInt32 dwProcessId);
+
+ [DllImport("kernel32.dll",
+ EntryPoint = "CreateFileW",
+ SetLastError = true,
+ CharSet = CharSet.Auto,
+ CallingConvention = CallingConvention.StdCall)]
+ private static extern IntPtr CreateFileW(
+ string lpFileName,
+ UInt32 dwDesiredAccess,
+ UInt32 dwShareMode,
+ IntPtr lpSecurityAttributes,
+ UInt32 dwCreationDisposition,
+ UInt32 dwFlagsAndAttributes,
+ IntPtr hTemplateFile
+ );
+
+ private const UInt32 GENERIC_WRITE = 0x40000000;
+ private const UInt32 GENERIC_READ = 0x80000000;
+ private const UInt32 FILE_SHARE_READ = 0x00000001;
+ private const UInt32 FILE_SHARE_WRITE = 0x00000002;
+ private const UInt32 OPEN_EXISTING = 0x00000003;
+ private const UInt32 FILE_ATTRIBUTE_NORMAL = 0x80;
+ private const UInt32 ERROR_ACCESS_DENIED = 5;
+
+ private const UInt32 ATTACH_PARRENT = 0xFFFFFFFF;
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/IPA.Injector/IPA.Injector.csproj b/IPA.Injector/IPA.Injector.csproj
new file mode 100644
index 00000000..e8e044a1
--- /dev/null
+++ b/IPA.Injector/IPA.Injector.csproj
@@ -0,0 +1,82 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {2A1AF16B-27F1-46E0-9A95-181516BC1CB7}
+ Library
+ Properties
+ IPA.Injector
+ IPA.Injector
+ v4.6
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+ False
+ ..\..\..\..\..\..\Game Library\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll
+ False
+
+
+
+
+
+
+
+
+
+
+ {5ad344f0-01a0-4ca8-92e5-9d095737744d}
+ IPA.Loader
+
+
+
+
+ Libraries\Included\0Harmony.dll
+ Always
+
+
+ Libraries\Mono\I18N.dll
+ Always
+
+
+ Libraries\Mono\I18N.West.dll
+ Always
+
+
+ Libraries\Mono\System.Runtime.Serialization.dll
+ Always
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/IllusionInjector/Injector.cs b/IPA.Injector/Injector.cs
similarity index 57%
rename from IllusionInjector/Injector.cs
rename to IPA.Injector/Injector.cs
index d70a6ec6..a36e2cb0 100644
--- a/IllusionInjector/Injector.cs
+++ b/IPA.Injector/Injector.cs
@@ -1,49 +1,63 @@
-using System;
-using System.IO;
-using System.Reflection;
-using UnityEngine;
-
-namespace IllusionInjector
-{
- public static class Injector
- {
- private static bool injected = false;
- public static void Inject()
- {
- if (!injected)
- {
- injected = true;
- AppDomain.CurrentDomain.AssemblyResolve += AssemblyLibLoader;
- var bootstrapper = new GameObject("Bootstrapper").AddComponent();
- bootstrapper.Destroyed += Bootstrapper_Destroyed;
- }
- }
-
- private static string libsDir;
- private static Assembly AssemblyLibLoader(object source, ResolveEventArgs e)
- {
- if (libsDir == null)
- libsDir = Path.Combine(Environment.CurrentDirectory, "Libs");
-
- var asmName = new AssemblyName(e.Name);
- //Logger.log.Debug($"Resolving library {asmName}");
-
- var testFilen = Path.Combine(libsDir, $"{asmName.Name}.{asmName.Version}.dll");
- //Logger.log.Debug($"Looking for file {testFilen}");
-
- if (File.Exists(testFilen))
- {
- return Assembly.LoadFile(testFilen);
- }
-
- //Logger.log.Error($"Could not load library {asmName}");
-
- return null;
- }
-
- private static void Bootstrapper_Destroyed()
- {
- PluginComponent.Create();
- }
- }
-}
+using IPA.Loader;
+using IPA.Logging;
+using System;
+using System.IO;
+using System.Reflection;
+using UnityEngine;
+using static IPA.Logging.Logger;
+using Logger = IPA.Logging.Logger;
+
+namespace IPA.Injector
+{
+ public static class Injector
+ {
+ private static bool injected = false;
+ public static void Inject()
+ {
+ if (!injected)
+ {
+ injected = true;
+ AppDomain.CurrentDomain.AssemblyResolve += AssemblyLibLoader;
+ var bootstrapper = new GameObject("Bootstrapper").AddComponent();
+ bootstrapper.Destroyed += Bootstrapper_Destroyed;
+ }
+ }
+
+ private static string libsDir;
+ private static Assembly AssemblyLibLoader(object source, ResolveEventArgs e)
+ {
+ if (libsDir == null)
+ libsDir = Path.Combine(Environment.CurrentDirectory, "Libs");
+
+ var asmName = new AssemblyName(e.Name);
+ Log(Level.Debug, $"Resolving library {asmName}");
+
+ var testFilen = Path.Combine(libsDir, $"{asmName.Name}.{asmName.Version}.dll");
+ Log(Level.Debug, $"Looking for file {testFilen}");
+
+ if (File.Exists(testFilen))
+ return Assembly.LoadFile(testFilen);
+
+ Log(Level.Critical, $"Could not load library {asmName}");
+
+ return null;
+ }
+ private static void Log(Level lvl, string message)
+ { // multiple proxy methods to delay loading of assemblies until it's done
+ if (Logger.LogCreated)
+ AssemblyLibLoaderCallLogger(lvl, message);
+ else
+ if (((byte)lvl & (byte)StandardLogger.PrintFilter) != 0)
+ Console.WriteLine($"[{lvl}] {message}");
+ }
+ private static void AssemblyLibLoaderCallLogger(Level lvl, string message)
+ {
+ Logger.log.Log(lvl, message);
+ }
+
+ private static void Bootstrapper_Destroyed()
+ {
+ PluginComponent.Create();
+ }
+ }
+}
diff --git a/IllusionInjector/PostBuild.msbuild b/IPA.Injector/PostBuild.msbuild
similarity index 73%
rename from IllusionInjector/PostBuild.msbuild
rename to IPA.Injector/PostBuild.msbuild
index 72841a21..20f1fccb 100644
--- a/IllusionInjector/PostBuild.msbuild
+++ b/IPA.Injector/PostBuild.msbuild
@@ -10,22 +10,22 @@
-
-
-
-
+
+
+
-
+
-
+
-
+
+
diff --git a/IllusionInjector/Properties/AssemblyInfo.cs b/IPA.Injector/Properties/AssemblyInfo.cs
similarity index 64%
rename from IllusionInjector/Properties/AssemblyInfo.cs
rename to IPA.Injector/Properties/AssemblyInfo.cs
index e967a81a..bae971d5 100644
--- a/IllusionInjector/Properties/AssemblyInfo.cs
+++ b/IPA.Injector/Properties/AssemblyInfo.cs
@@ -1,40 +1,37 @@
-using System.Resources;
-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("IllusionInjector")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("IllusionInjector")]
-[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("400a540a-d21f-4609-966b-206059b6e73b")]
-[assembly: InternalsVisibleTo("IllusionPlugin")]
-
-// 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")]
-[assembly: NeutralResourcesLanguage("en")]
-
+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("IPA.Injector")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("IPA.Injector")]
+[assembly: AssemblyCopyright("Copyright © 2018")]
+[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("2a1af16b-27f1-46e0-9a95-181516bc1cb7")]
+[assembly: InternalsVisibleTo("IPA.Loader")]
+
+// 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.9.0")]
+[assembly: AssemblyFileVersion("3.9.0")]
diff --git a/IPA.Loader/IPA.Loader.csproj b/IPA.Loader/IPA.Loader.csproj
new file mode 100644
index 00000000..c15ab9df
--- /dev/null
+++ b/IPA.Loader/IPA.Loader.csproj
@@ -0,0 +1,97 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {5AD344F0-01A0-4CA8-92E5-9D095737744D}
+ Library
+ Properties
+ IPA
+ IPA.Loader
+ v4.6
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ true
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ true
+
+
+
+
+
+
+
+
+
+
+
+ ..\..\..\..\..\..\Game Library\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll
+ False
+
+
+ ..\..\..\..\..\..\Game Library\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UnityWebRequestModule.dll
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.9.1.8
+
+
+ 0.9.6.4
+
+
+ 11.0.2
+
+
+
+
+
\ No newline at end of file
diff --git a/IllusionPlugin/IniFile.cs b/IPA.Loader/IniFile.cs
similarity index 99%
rename from IllusionPlugin/IniFile.cs
rename to IPA.Loader/IniFile.cs
index b8f47bce..94ff4f3f 100644
--- a/IllusionPlugin/IniFile.cs
+++ b/IPA.Loader/IniFile.cs
@@ -4,7 +4,7 @@ using System.IO;
using System.Runtime.InteropServices;
using System.Text;
-namespace IllusionPlugin
+namespace IPA
{
///
/// Create a New INI file to store or load data
diff --git a/IllusionInjector/BeatSaber/CompositeBSPlugin.cs b/IPA.Loader/Loader/Composite/CompositeBSPlugin.cs
similarity index 95%
rename from IllusionInjector/BeatSaber/CompositeBSPlugin.cs
rename to IPA.Loader/Loader/Composite/CompositeBSPlugin.cs
index 96d6ddf0..98169fad 100644
--- a/IllusionInjector/BeatSaber/CompositeBSPlugin.cs
+++ b/IPA.Loader/Loader/Composite/CompositeBSPlugin.cs
@@ -1,14 +1,14 @@
-using IllusionPlugin;
-using IllusionPlugin.BeatSaber;
+using IPA;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.SceneManagement;
-using Logger = IllusionInjector.Logging.Logger;
+using Logger = IPA.Logging.Logger;
-namespace IllusionInjector {
+namespace IPA.Loader.Composite
+{
public class CompositeBSPlugin : IBeatSaberPlugin
{
IEnumerable plugins;
diff --git a/IllusionInjector/IPA/CompositeIPAPlugin.cs b/IPA.Loader/Loader/Composite/CompositeIPAPlugin.cs
similarity index 94%
rename from IllusionInjector/IPA/CompositeIPAPlugin.cs
rename to IPA.Loader/Loader/Composite/CompositeIPAPlugin.cs
index 001677a6..c70714b6 100644
--- a/IllusionInjector/IPA/CompositeIPAPlugin.cs
+++ b/IPA.Loader/Loader/Composite/CompositeIPAPlugin.cs
@@ -1,13 +1,15 @@
-using IllusionPlugin;
-using System;
+using System;
using System.Collections.Generic;
+using IPA;
+using IPA.Old;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.SceneManagement;
-using Logger = IllusionInjector.Logging.Logger;
+using Logger = IPA.Logging.Logger;
-namespace IllusionInjector {
+namespace IPA.Loader.Composite
+{
#pragma warning disable CS0618 // Type or member is obsolete
public class CompositeIPAPlugin : IPlugin
{
diff --git a/IllusionInjector/PluginComponent.cs b/IPA.Loader/Loader/PluginComponent.cs
similarity index 84%
rename from IllusionInjector/PluginComponent.cs
rename to IPA.Loader/Loader/PluginComponent.cs
index 2c8140fa..07e1e054 100644
--- a/IllusionInjector/PluginComponent.cs
+++ b/IPA.Loader/Loader/PluginComponent.cs
@@ -3,8 +3,11 @@ using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.SceneManagement;
+using IPA.Loader;
+using IPA.Loader.Composite;
+using IPA.Logging;
-namespace IllusionInjector
+namespace IPA.Loader
{
public class PluginComponent : MonoBehaviour
{
@@ -14,6 +17,13 @@ namespace IllusionInjector
public static PluginComponent Create()
{
+ Application.logMessageReceived += delegate (string condition, string stackTrace, LogType type)
+ {
+ var level = UnityLogInterceptor.LogTypeToLevel(type);
+ UnityLogInterceptor.UnityLogger.Log(level, $"{condition.Trim()}");
+ UnityLogInterceptor.UnityLogger.Log(level, $"{stackTrace.Trim()}");
+ };
+
return new GameObject("IPA_PluginManager").AddComponent();
}
@@ -23,9 +33,7 @@ namespace IllusionInjector
bsPlugins = new CompositeBSPlugin(PluginManager.BSPlugins);
ipaPlugins = new CompositeIPAPlugin(PluginManager.Plugins);
-
- // this has no relevance since there is a new mod updater system
- //gameObject.AddComponent(); // AFTER plugins are loaded, but before most things
+
gameObject.AddComponent();
bsPlugins.OnApplicationStart();
diff --git a/IllusionInjector/PluginManager.cs b/IPA.Loader/Loader/PluginManager.cs
similarity index 71%
rename from IllusionInjector/PluginManager.cs
rename to IPA.Loader/Loader/PluginManager.cs
index 14c67222..72e477e1 100644
--- a/IllusionInjector/PluginManager.cs
+++ b/IPA.Loader/Loader/PluginManager.cs
@@ -1,8 +1,9 @@
-using IllusionInjector.Logging;
-using IllusionInjector.Updating;
-using IllusionInjector.Utilities;
-using IllusionPlugin;
-using IllusionPlugin.BeatSaber;
+using IPA;
+using IPA.Logging;
+using IPA.Old;
+using IPA.Updating;
+using IPA.Utilities;
+using Mono.Cecil;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -13,9 +14,8 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
-using LoggerBase = IllusionPlugin.Logging.Logger;
-namespace IllusionInjector
+namespace IPA.Loader
{
public static class PluginManager
{
@@ -176,6 +176,50 @@ namespace IllusionInjector
try
{
+ #region Fix assemblies for refactor
+
+ var module = ModuleDefinition.ReadModule(file);
+ bool modifiedModule = false;
+ foreach (var @ref in module.AssemblyReferences)
+ { // fix assembly references
+ if (@ref.Name == "IllusionPlugin" || @ref.Name == "IllusionInjector")
+ {
+ @ref.Name = "IPA.Loader";
+ modifiedModule = true;
+ }
+ }
+ if (modifiedModule)
+ { // types don't need to be fixed if it's already referencing the new version
+ foreach (var @ref in module.GetTypeReferences())
+ { // fix type references
+ if (@ref.FullName == "IllusionPlugin.IPlugin") @ref.Namespace = "IPA.Old"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionPlugin.IEnhancedPlugin") @ref.Namespace = "IPA.Old"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionPlugin.IBeatSaberPlugin") @ref.Namespace = "IPA"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionPlugin.IEnhancedBeatSaberPlugin") @ref.Namespace = "IPA"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionPlugin.BeatSaber.ModsaberModInfo") @ref.Namespace = "IPA"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionPlugin.IniFile") @ref.Namespace = "IPA"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionPlugin.IModPrefs") @ref.Namespace = "IPA"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionPlugin.ModPrefs") @ref.Namespace = "IPA"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionPlugin.Utils.ReflectionUtil") @ref.Namespace = "IPA.Utilities"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionPlugin.Logging.Logger") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionPlugin.Logging.LogPrinter") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionInjector.PluginManager") @ref.Namespace = "IPA.Loader"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionInjector.PluginComponent") @ref.Namespace = "IPA.Loader"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionInjector.CompositeBSPlugin") @ref.Namespace = "IPA.Loader.Composite"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionInjector.CompositeIPAPlugin") @ref.Namespace = "IPA.Loader.Composite"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionInjector.Logging.UnityLogInterceptor") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionInjector.Logging.StandardLogger") @ref.Namespace = "IPA.Logging"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionInjector.Updating.SelfPlugin") @ref.Namespace = "IPA.Updating"; //@ref.Name = "";
+ if (@ref.FullName == "IllusionInjector.Updating.Backup.BackupUnit") @ref.Namespace = "IPA.Updating.Backup"; //@ref.Name = "";
+ if (@ref.Namespace == "IllusionInjector.Utilities") @ref.Namespace = "IPA.Utilities"; //@ref.Name = "";
+ if (@ref.Namespace == "IllusionInjector.Logging.Printers") @ref.Namespace = "IPA.Logging.Printers"; //@ref.Name = "";
+ if (@ref.Namespace == "IllusionInjector.Updating.ModsaberML") @ref.Namespace = "IPA.Updating.ModsaberML"; //@ref.Name = "";
+ }
+ module.Write(file);
+ }
+
+ #endregion
+
Assembly assembly = Assembly.LoadFrom(file);
foreach (Type t in assembly.GetTypes())
@@ -191,13 +235,13 @@ namespace IllusionInjector
var initArgs = new List
-
diff --git a/IPA.Tests/updater_test.json b/IPA.Tests/updater_test.json
deleted file mode 100644
index 19df2e06..00000000
--- a/IPA.Tests/updater_test.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "bsipa-test-plugin",
- "version": "0.0.1",
- "approved": true,
- "title": "BSIPA Test Plugin",
- "description": "",
- "type": "mod",
- "published": "2018-08-02T03:12:18.805Z",
- "gameVersion": "0.11.2",
- "gameVersionID": "5b626bb15d243a0008b8886e",
- "oldVersions": [],
- "dependsOn": [],
- "conflictsWith": [],
- "files": {
- "steam": {
- "hash": "a94e7eea2f656b2830a86000ee222b6cb06f8da5",
- "files": {
- "Plugins/": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
- "Plugins/RandomSong.dll": "64ee1ecfeda73c550004bdb5123c7ac47a45e428"
- },
- "url": "https://www.modsaber.ml/cdn/randomsong/1.0.0-default.zip"
- }
- },
- "weight": 7,
- "author": "danike",
- "authorID": "5b62723f288b110008291cb9"
-}
\ No newline at end of file
diff --git a/IPA/IPA.csproj b/IPA/IPA.csproj
index f55672d3..705e0703 100644
--- a/IPA/IPA.csproj
+++ b/IPA/IPA.csproj
@@ -13,6 +13,21 @@
512
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
AnyCPU
@@ -39,23 +54,10 @@
favicon.ico
+
+ IPA.Program
+
-
- ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll
- True
-
-
- ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Mdb.dll
- False
-
-
- ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Pdb.dll
- False
-
-
- ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Rocks.dll
- False
-
@@ -77,7 +79,6 @@
-
@@ -85,6 +86,23 @@
+
+
+ 0.9.6.4
+
+
+
+
+ False
+ Microsoft .NET Framework 4.6.2 %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
-
\ No newline at end of file
diff --git a/IllusionInjector/Logging/UnityLogInterceptor.cs b/IllusionInjector/Logging/UnityLogInterceptor.cs
deleted file mode 100644
index 64e42926..00000000
--- a/IllusionInjector/Logging/UnityLogInterceptor.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using UnityEngine;
-using LoggerBase = IllusionPlugin.Logging.Logger;
-
-namespace IllusionInjector.Logging
-{
- public class UnityLogInterceptor
- {
- public static LoggerBase Unitylogger = new StandardLogger("UnityEngine");
-
- public static LoggerBase.Level LogTypeToLevel(LogType type)
- {
- switch (type)
- {
- case LogType.Assert:
- return LoggerBase.Level.Debug;
- case LogType.Error:
- return LoggerBase.Level.Error;
- case LogType.Exception:
- return LoggerBase.Level.Critical;
- case LogType.Log:
- return LoggerBase.Level.Info;
- case LogType.Warning:
- return LoggerBase.Level.Warning;
- default:
- return LoggerBase.Level.Info;
- }
- }
- }
-}
diff --git a/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache b/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache
deleted file mode 100644
index 484972a6..00000000
--- a/IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache
+++ /dev/null
@@ -1 +0,0 @@
-dae758b90b096a39aa928b136ec952d8ed591e5d
diff --git a/IllusionInjector/packages.config b/IllusionInjector/packages.config
deleted file mode 100644
index 71c37d6d..00000000
--- a/IllusionInjector/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/IllusionPlugin/IllusionPlugin.XML b/IllusionPlugin/IllusionPlugin.XML
deleted file mode 100644
index 493113b0..00000000
--- a/IllusionPlugin/IllusionPlugin.XML
+++ /dev/null
@@ -1,178 +0,0 @@
-
-
-
- IllusionPlugin
-
-
-
-
- Gets a list of executables this plugin should be excuted on (without the file ending)
-
- { "PlayClub", "PlayClubStudio" }
-
-
-
- Create a New INI file to store or load data
-
-
-
-
- INIFile Constructor.
-
-
-
-
-
- Write Data to the INI File
-
-
- Section name
-
- Key Name
-
- Value Name
-
-
-
- Read Data Value From the Ini File
-
-
-
-
-
-
-
-
- Interface for generic Illusion unity plugins. Every class that implements this will be loaded if the DLL is placed at
- data/Managed/Plugins.
-
-
-
-
- Gets the name of the plugin.
-
-
-
-
- Gets the version of the plugin.
-
-
-
-
- Gets invoked when the application is started.
-
-
-
-
- Gets invoked when the application is closed.
-
-
-
-
- Gets invoked whenever a level is loaded.
-
-
-
-
-
- Gets invoked after the first update cycle after a level was loaded.
-
-
-
-
-
- Gets invoked on every graphic update.
-
-
-
-
- Gets invoked on ever physics update.
-
-
-
-
- Allows to get and set preferences for your mod.
-
-
-
-
- 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.
-
-
-
-
- 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.
-
-
-
-
- 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.
-
-
-
-
- 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.
-
-
-
-
- Checks whether or not a key exists in the ini.
-
- Section of the key.
- Name of the key.
-
-
-
-
- Sets a float in the ini.
-
- Section of the key.
- Name of the key.
- Value that should be written.
-
-
-
- Sets an int in the ini.
-
- Section of the key.
- Name of the key.
- Value that should be written.
-
-
-
- Sets a string in the ini.
-
- Section of the key.
- Name of the key.
- Value that should be written.
-
-
-
- Sets a bool in the ini.
-
- Section of the key.
- Name of the key.
- Value that should be written.
-
-
-
diff --git a/IllusionPlugin/IllusionPlugin.csproj b/IllusionPlugin/IllusionPlugin.csproj
deleted file mode 100644
index f5f34363..00000000
--- a/IllusionPlugin/IllusionPlugin.csproj
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}
- Library
- Properties
- IllusionPlugin
- IllusionPlugin
- v4.6
- 512
-
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- false
-
-
- none
- true
- bin\Release\
- TRACE
- prompt
- 4
- bin\Release\IllusionPlugin.XML
- false
- true
-
-
-
-
-
-
- ..\Libs\UnityEngine.CoreModule.dll
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/IllusionPlugin/obj/Debug/IllusionPlugin.csproj.CoreCompileInputs.cache b/IllusionPlugin/obj/Debug/IllusionPlugin.csproj.CoreCompileInputs.cache
deleted file mode 100644
index 2a6cf0f9..00000000
--- a/IllusionPlugin/obj/Debug/IllusionPlugin.csproj.CoreCompileInputs.cache
+++ /dev/null
@@ -1 +0,0 @@
-77d5fd2376e4df56c59ee712f4f804807c24fc6f