Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Mono.Cecil Type Forwarding #68

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions Harmony/ForwardingAttributes/Mono.Cecil.Cil.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#if NETFRAMEWORK
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.Code))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ConstantDebugInformation))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.CustomDebugInformation))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.CustomDebugInformationKind))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.DebugInformation))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.Document))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.DocumentHashAlgorithm))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.DocumentLanguage))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.DocumentLanguageVendor))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.DocumentType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ExceptionHandler))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ExceptionHandlerType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.FlowControl))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ILProcessor))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ImageDebugDirectory))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ImageDebugHeader))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ImageDebugHeaderEntry))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ImageDebugType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ImportDebugInformation))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ImportTarget))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ImportTargetKind))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.Instruction))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.InstructionOffset))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ISymbolReader))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ISymbolReaderProvider))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ISymbolWriter))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ISymbolWriterProvider))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.MethodBody))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.MethodDebugInformation))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.OpCode))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.OpCodeType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.OperandType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.ScopeDebugInformation))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.SequencePoint))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.StackBehaviour))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.SymbolsNotFoundException))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.SymbolsNotMatchingException))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.VariableAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.VariableDebugInformation))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.VariableDefinition))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Cil.VariableReference))]
#endif
5 changes: 5 additions & 0 deletions Harmony/ForwardingAttributes/Mono.Cecil.Mdb.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#if NETFRAMEWORK
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(Mono.Cecil.Mdb.MdbReader))]
#endif
6 changes: 6 additions & 0 deletions Harmony/ForwardingAttributes/Mono.Cecil.Pdb.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#if NETFRAMEWORK
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(Mono.Cecil.Pdb.NativePdbReader))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Pdb.NativePdbWriter))]
#endif
8 changes: 8 additions & 0 deletions Harmony/ForwardingAttributes/Mono.Cecil.Rocks.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#if NETFRAMEWORK
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(Mono.Cecil.Rocks.IILVisitor))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Rocks.ILParser))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Rocks.ModuleDefinitionRocks))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Rocks.TypeDefinitionRocks))]
#endif
85 changes: 85 additions & 0 deletions Harmony/ForwardingAttributes/Mono.Cecil.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#if NETFRAMEWORK
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(Mono.Cecil.AssemblyAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.AssemblyDefinition))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.AssemblyHashAlgorithm))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.AssemblyNameDefinition))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.AssemblyNameReference))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.AssemblyResolutionException))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.CallSite))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.CustomAttribute))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.CustomAttributeArgument))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.CustomAttributeNamedArgument))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.EventAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.EventDefinition))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.EventReference))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ExportedType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.FieldAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.FieldDefinition))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.FieldReference))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.GenericParameter))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.GenericParameterAttributes))]
#if NET472
[assembly: TypeForwardedTo(typeof(Mono.Cecil.GenericParameterConstraint))]
#endif
[assembly: TypeForwardedTo(typeof(Mono.Cecil.GenericParameterType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.IAssemblyResolver))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ICustomAttributeProvider))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.IGenericParameterProvider))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.IMemberDefinition))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.IMetadataImporter))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.IMetadataImporterProvider))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.IMetadataResolver))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.IMetadataScope))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.IMetadataTokenProvider))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.IMethodSignature))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.InterfaceImplementation))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.IReflectionImporter))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.IReflectionImporterProvider))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ManifestResourceAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MarshalInfo))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MemberReference))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MetadataKind))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MetadataScopeType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MetadataToken))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MetadataType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MethodAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MethodCallingConvention))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MethodDefinition))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MethodImplAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MethodReference))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MethodReturnType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.MethodSemanticsAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ModuleAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ModuleCharacteristics))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ModuleDefinition))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ModuleKind))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ModuleParameters))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ModuleReference))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.NativeType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ParameterAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ParameterDefinition))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ParameterReference))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.PInvokeAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.PInvokeInfo))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.PropertyAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.PropertyDefinition))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.PropertyReference))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ReaderParameters))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ReadingMode))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ResolutionException))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.Resource))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.ResourceType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.SecurityAction))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.SecurityAttribute))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.SecurityDeclaration))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.TargetArchitecture))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.TargetRuntime))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.TokenType))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.TypeAttributes))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.TypeDefinition))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.TypeReference))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.TypeSystem))]
[assembly: TypeForwardedTo(typeof(Mono.Cecil.WriterParameters))]
#endif
5 changes: 5 additions & 0 deletions Harmony/ForwardingAttributes/Mono.Collections.Generic.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#if NETFRAMEWORK
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(Mono.Collections.Generic.Collection<>))]
#endif
18 changes: 18 additions & 0 deletions Harmony/ForwardingAttributes/Mono.CompilerServices.SymbolWriter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#if NETFRAMEWORK
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.AnonymousScopeEntry))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.CapturedScope))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.CapturedVariable))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.CodeBlockEntry))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.CompileUnitEntry))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.LineNumberEntry))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.LineNumberTable))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.LocalVariableEntry))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.MethodEntry))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.MonoSymbolFile))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.NamespaceEntry))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.OffsetTable))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.ScopeVariable))]
[assembly: TypeForwardedTo(typeof(Mono.CompilerServices.SymbolWriter.SourceFileEntry))]
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#if NETFRAMEWORK
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform))]
[assembly: TypeForwardedTo(typeof(MonoMod.RuntimeDetour.Platforms.DetourRuntimeNETCore30Platform))]
[assembly: TypeForwardedTo(typeof(MonoMod.RuntimeDetour.Platforms.DetourRuntimeNETCorePlatform))]
[assembly: TypeForwardedTo(typeof(MonoMod.RuntimeDetour.Platforms.DetourRuntimeNETPlatform))]
#endif
5 changes: 5 additions & 0 deletions Harmony/ForwardingAttributes/MonoMod.RuntimeDetour.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#if NETFRAMEWORK
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(MonoMod.RuntimeDetour.OnMethodCompiledEvent))]
#endif
6 changes: 6 additions & 0 deletions Harmony/ForwardingAttributes/MonoMod.Utils.Cil.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#if NETFRAMEWORK
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(MonoMod.Utils.Cil.CecilILGenerator))]
[assembly: TypeForwardedTo(typeof(MonoMod.Utils.Cil.ILGeneratorShim))]
#endif
11 changes: 11 additions & 0 deletions Harmony/ForwardingAttributes/MonoMod.Utils.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#if NETFRAMEWORK
using System.Runtime.CompilerServices;

[assembly: TypeForwardedTo(typeof(MonoMod.Utils.DMDEmitDynamicMethodGenerator))]
[assembly: TypeForwardedTo(typeof(MonoMod.Utils.DMDGenerator<>))]
[assembly: TypeForwardedTo(typeof(MonoMod.Utils.DynamicMethodDefinition))]
[assembly: TypeForwardedTo(typeof(MonoMod.Utils.Extensions))]
[assembly: TypeForwardedTo(typeof(MonoMod.Utils.ICallSiteGenerator))]
[assembly: TypeForwardedTo(typeof(MonoMod.Utils.ReflectionHelper))]
[assembly: TypeForwardedTo(typeof(MonoMod.Utils.Relinker))]
#endif
4 changes: 2 additions & 2 deletions Harmony/Harmony.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net35;net45;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net35;net45;net472;netstandard2.0;</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Product>HarmonyX</Product>
<Company>BepInEx</Company>
Expand Down Expand Up @@ -69,7 +69,7 @@
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all"/>

<!-- Reference MonoMod.RuntimeDetour for our detour needs -->
<PackageReference Include="MonoMod.RuntimeDetour" Version="22.3.23.4"/>
<PackageReference Include="MonoMod.RuntimeDetour" Version="22.6.3.1"/>

<!-- Reference SRE helpers for .NET Standard -->
<PackageReference Include="System.Reflection.Emit" Version="4.7.0" Condition="'$(TargetFramework)' == 'netstandard2.0'"/>
Expand Down