Browse Source

Moved non-Mono libraries to Libs/ folder

pull/46/head
Anairkoen Schno 5 years ago
parent
commit
f9af564cf8
16 changed files with 297 additions and 9 deletions
  1. +6
    -0
      BSIPA.sln
  2. +1
    -1
      IPA/IPA.csproj
  3. +4
    -0
      IPA/PatchContext.cs
  4. +4
    -0
      IPA/Program.cs
  5. +2
    -2
      IPA/Properties/AssemblyInfo.cs
  6. +8
    -0
      IllusionInjector/IllusionInjector.csproj
  7. +24
    -0
      IllusionInjector/Injector.cs
  8. +12
    -3
      IllusionInjector/PluginManager.cs
  9. +35
    -0
      IllusionInjector/PostBuild.msbuild
  10. +1
    -1
      IllusionInjector/Updating/SelfPlugin.cs
  11. +1
    -1
      IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache
  12. +1
    -1
      IllusionPlugin/obj/Debug/IllusionPlugin.csproj.CoreCompileInputs.cache
  13. +69
    -0
      MSBuildTasks/AssemblyRenameTask.cs
  14. +84
    -0
      MSBuildTasks/MSBuildTasks.csproj
  15. +36
    -0
      MSBuildTasks/Properties/AssemblyInfo.cs
  16. +9
    -0
      MSBuildTasks/packages.config

+ 6
- 0
BSIPA.sln View File

@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IllusionInjector", "Illusio
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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -37,6 +39,10 @@ Global
{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
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE


+ 1
- 1
IPA/IPA.csproj View File

@ -97,7 +97,7 @@
<ItemGroup>
<Dlls Include="$(SolutionDir)IllusionInjector\$(OutDir)**\*" />
</ItemGroup>
<Copy SourceFiles="@(Dlls)" DestinationFolder="$(OutputPath)IPA\Data\Managed" />
<Copy SourceFiles="@(Dlls)" DestinationFolder="$(OutputPath)IPA\%(RecursiveDir)" />
</Target>
<PropertyGroup>
<PostBuildEvent>


+ 4
- 0
IPA/PatchContext.cs View File

@ -15,9 +15,11 @@ namespace IPA
public string Executable { get; private set; }
public string DataPathSrc { get; private set; }
public string LibsPathSrc { get; private set; }
public string PluginsFolder { get; private set; }
public string ProjectName { get; private set; }
public string DataPathDst { get; private set; }
public string LibsPathDst { get; private set; }
public string ManagedPath { get; private set; }
public string EngineFile { get; private set; }
public string EngineWebRequestFile { get; private set; }
@ -40,9 +42,11 @@ namespace IPA
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.LibsPathSrc = Path.Combine(context.IPARoot, "Libs");
context.PluginsFolder = Path.Combine(context.ProjectRoot, "Plugins");
context.ProjectName = Path.GetFileNameWithoutExtension(context.Executable);
context.DataPathDst = Path.Combine(context.ProjectRoot, context.ProjectName + "_Data");
context.LibsPathDst = Path.Combine(context.ProjectRoot, "Libs");
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");


+ 4
- 0
IPA/Program.cs View File

@ -117,6 +117,10 @@ namespace IPA {
backup,
(from, to) => NativePluginInterceptor(from, to, new DirectoryInfo(nativePluginFolder), isFlat,
architecture));
CopyAll(new DirectoryInfo(context.LibsPathSrc), new DirectoryInfo(context.LibsPathDst), force,
backup,
(from, to) => NativePluginInterceptor(from, to, new DirectoryInfo(nativePluginFolder), isFlat,
architecture));
Console.WriteLine("Successfully updated files!");


+ 2
- 2
IPA/Properties/AssemblyInfo.cs View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 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.8.7.*")]
[assembly: AssemblyFileVersion("3.8.7")]
[assembly: AssemblyVersion("3.8.8.*")]
[assembly: AssemblyFileVersion("3.8.8")]

+ 8
- 0
IllusionInjector/IllusionInjector.csproj View File

@ -94,6 +94,11 @@
<Project>{e2848bfb-5432-42f4-8ae0-d2ec0cdf2f71}</Project>
<Name>IllusionPlugin</Name>
</ProjectReference>
<ProjectReference Include="..\MSBuildTasks\MSBuildTasks.csproj">
<Project>{f08c3c7a-3221-432e-bab8-32bce58408c8}</Project>
<Name>MSBuildTasks</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
@ -113,6 +118,9 @@
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<Target Name="AfterBuild">
<Exec Command="&quot;$(MSBuildBinPath)\MSBuild.exe&quot; &quot;$(MSBuildProjectDirectory)\PostBuild.msbuild&quot; /property:OPath=$(OutputPath) /property:Configuration=$(Configuration) /property:SolDir=$(SolutionDir)" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">


+ 24
- 0
IllusionInjector/Injector.cs View File

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Reflection;
using UnityEngine;
namespace IllusionInjector
@ -12,11 +13,34 @@ namespace IllusionInjector
if (!injected)
{
injected = true;
AppDomain.CurrentDomain.AssemblyResolve += AssemblyLibLoader;
var bootstrapper = new GameObject("Bootstrapper").AddComponent<Bootstrapper>();
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();


+ 12
- 3
IllusionInjector/PluginManager.cs View File

@ -65,6 +65,7 @@ namespace IllusionInjector
}
private static List<IPlugin> _ipaPlugins = null;
private static void LoadPlugins()
{
@ -190,13 +191,21 @@ namespace IllusionInjector
var initArgs = new List<object>();
var initParams = init.GetParameters();
LoggerBase modLogger = null;
IModPrefs modPrefs = null;
foreach (var param in initParams)
{
var ptype = param.ParameterType;
if (ptype.IsAssignableFrom(typeof(LoggerBase)))
initArgs.Add(new StandardLogger(bsPlugin.Name));
if (ptype.IsAssignableFrom(typeof(LoggerBase))) {
if (modLogger == null) modLogger = new StandardLogger(bsPlugin.Name);
initArgs.Add(modLogger);
}
else if (ptype.IsAssignableFrom(typeof(IModPrefs)))
initArgs.Add(new ModPrefs(bsPlugin));
{
if (modPrefs == null) modPrefs = new ModPrefs(bsPlugin);
initArgs.Add(modPrefs);
}
else
initArgs.Add(ptype.GetDefault());
}


+ 35
- 0
IllusionInjector/PostBuild.msbuild View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="PostBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<OPath></OPath>
<SolDir></SolDir>
</PropertyGroup>
<UsingTask TaskName="AssemblyRename" AssemblyFile="$(SolDir)MSBuildTasks\bin\$(Configuration)\MSBuildTasks.dll" />
<Target Name="PostBuild">
<Message Text="Relocating" Importance="normal" />
<ItemGroup>
<SystemFiles Include="$(OPath)I18N.*" />
<SystemFiles Include="$(OPath)IllusionInjector.*" />
<SystemFiles Include="$(OPath)IllusionPlugin.*" />
<SystemFiles Include="$(OPath)RequiredMonoLibs\**\*" />
<OldLibFiles Include="$(OPath)Libs\**\*" />
</ItemGroup>
<Move SourceFiles="@(SystemFiles)" DestinationFolder="$(OPath)Data\Managed" />
<RemoveDir Directories="$(OPath)RequiredMonoLibs" />
<Delete Files="@(OldLibFiles)" />
<RemoveDir Directories="$(OPath)Libs" />
<ItemGroup>
<LibFiles Include="$(OPath)**\*" Exclude="$(OPath)Data\**\*;$(OPath)Lib\**\*" />
</ItemGroup>
<Move SourceFiles="@(LibFiles)" DestinationFolder="$(OPath)Libs\" />
<RemoveDir Directories="$(OPath)IncludedLibs" />
<ItemGroup>
<ToRename Include="$(OPath)Libs\**\*.dll" />
</ItemGroup>
<AssemblyRename Assemblies="@(ToRename)" />
</Target>
</Project>

+ 1
- 1
IllusionInjector/Updating/SelfPlugin.cs View File

@ -12,7 +12,7 @@ namespace IllusionInjector.Updating
internal class SelfPlugin : IBeatSaberPlugin
{
internal const string IPA_Name = "Beat Saber IPA";
internal const string IPA_Version = "3.8.7";
internal const string IPA_Version = "3.8.8";
public string Name => IPA_Name;


+ 1
- 1
IllusionInjector/obj/Debug/IllusionInjector.csproj.CoreCompileInputs.cache View File

@ -1 +1 @@
71a44b54b01a27b264d5e56666d3bd427569aee5
dae758b90b096a39aa928b136ec952d8ed591e5d

+ 1
- 1
IllusionPlugin/obj/Debug/IllusionPlugin.csproj.CoreCompileInputs.cache View File

@ -1 +1 @@
9c8aaadb0a1830ce0d658b39574b7acf02507f4a
77d5fd2376e4df56c59ee712f4f804807c24fc6f

+ 69
- 0
MSBuildTasks/AssemblyRenameTask.cs View File

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mono.Cecil;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
using System.IO;
namespace MSBuildTasks
{
public class AssemblyRename : Task
{
private ITaskItem[] assemblies;
[Required]
public ITaskItem[] Assemblies
{
get => assemblies;
set => assemblies = value;
}
public override bool Execute()
{
foreach (ITaskItem assembly in Assemblies)
{
// ItemSpec holds the filename or path of an Item
if (assembly.ItemSpec.Length > 0)
{
if (!File.Exists(assembly.ItemSpec))
{
Log.LogMessage(MessageImportance.Normal, "No file at " + assembly.ItemSpec);
continue;
}
if (Path.GetExtension(assembly.ItemSpec) != ".dll")
{
Log.LogMessage(MessageImportance.Normal, assembly.ItemSpec + " not a DLL");
continue;
}
try
{
Log.LogMessage(MessageImportance.Normal, "Reading " + assembly.ItemSpec);
var module = ModuleDefinition.ReadModule(assembly.ItemSpec);
var asmName = module.Assembly.Name;
var name = asmName.Name;
var version = asmName.Version;
var newFilen = $"{name}.{version}.dll";
var newFilePath = Path.Combine(Path.GetDirectoryName(assembly.ItemSpec), newFilen);
Log.LogMessage(MessageImportance.Normal, $"Old file: {assembly.ItemSpec}, new file: {newFilePath}");
if (File.Exists(newFilePath))
File.Delete(newFilePath);
File.Move(assembly.ItemSpec, newFilePath);
}
catch (Exception e)
{
Log.LogErrorFromException(e);
}
}
}
return !Log.HasLoggedErrors;
}
}
}

+ 84
- 0
MSBuildTasks/MSBuildTasks.csproj View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F08C3C7A-3221-432E-BAB8-32BCE58408C8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MSBuildTasks</RootNamespace>
<AssemblyName>MSBuildTasks</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Build.Framework.15.8.166\lib\net46\Microsoft.Build.Framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Build.Utilities.Core.15.8.166\lib\net46\Microsoft.Build.Utilities.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Setup.Configuration.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.VisualStudio.Setup.Configuration.Interop.1.16.30\lib\net35\Microsoft.VisualStudio.Setup.Configuration.Interop.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Mdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Pdb, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Rocks, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\netstandard1.3\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyRenameTask.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

+ 36
- 0
MSBuildTasks/Properties/AssemblyInfo.cs View File

@ -0,0 +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("MSBuildTasks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MSBuildTasks")]
[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("f08c3c7a-3221-432e-bab8-32bce58408c8")]
// 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")]

+ 9
- 0
MSBuildTasks/packages.config View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Build.Framework" version="15.8.166" targetFramework="net46" />
<package id="Microsoft.Build.Utilities.Core" version="15.8.166" targetFramework="net46" />
<package id="Microsoft.VisualStudio.Setup.Configuration.Interop" version="1.16.30" targetFramework="net46" developmentDependency="true" />
<package id="Mono.Cecil" version="0.9.6.4" targetFramework="net46" />
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net46" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net46" />
</packages>

Loading…
Cancel
Save