Fody sucks :)
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v9.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v9.0": {
|
||||
"Ceciler.Launcher/1.0.0": {
|
||||
"dependencies": {
|
||||
"Ceciler.Interfaces": "1.0.0",
|
||||
"Mono.Cecil": "0.11.6"
|
||||
},
|
||||
"runtime": {
|
||||
"Ceciler.Launcher.dll": {}
|
||||
}
|
||||
},
|
||||
"Mono.Cecil/0.11.6": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Mono.Cecil.Mdb.dll": {
|
||||
"assemblyVersion": "0.11.6.0",
|
||||
"fileVersion": "0.11.6.0"
|
||||
},
|
||||
"lib/netstandard2.0/Mono.Cecil.Pdb.dll": {
|
||||
"assemblyVersion": "0.11.6.0",
|
||||
"fileVersion": "0.11.6.0"
|
||||
},
|
||||
"lib/netstandard2.0/Mono.Cecil.Rocks.dll": {
|
||||
"assemblyVersion": "0.11.6.0",
|
||||
"fileVersion": "0.11.6.0"
|
||||
},
|
||||
"lib/netstandard2.0/Mono.Cecil.dll": {
|
||||
"assemblyVersion": "0.11.6.0",
|
||||
"fileVersion": "0.11.6.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Ceciler.Interfaces/1.0.0": {
|
||||
"runtime": {
|
||||
"Ceciler.Interfaces.dll": {
|
||||
"assemblyVersion": "1.0.0.0",
|
||||
"fileVersion": "1.0.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"Ceciler.Launcher/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Mono.Cecil/0.11.6": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-f33RkDtZO8VlGXCtmQIviOtxgnUdym9xx/b1p9h91CRGOsJFxCFOFK1FDbVt1OCf1aWwYejUFa2MOQyFWTFjbA==",
|
||||
"path": "mono.cecil/0.11.6",
|
||||
"hashPath": "mono.cecil.0.11.6.nupkg.sha512"
|
||||
},
|
||||
"Ceciler.Interfaces/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net9.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "9.0.0"
|
||||
},
|
||||
"configProperties": {
|
||||
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
|
||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<Virtuosity/>
|
||||
</Weavers>
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="Virtuosity" minOccurs="0" maxOccurs="1" type="xs:anyType" />
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -22,17 +22,6 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.IO.Hashing" Version="9.0.5"/>
|
||||
<PackageReference Include="FastCloner" Version="3.3.4"/>
|
||||
<!--
|
||||
We are using Fody to make all methods virtual, this is a perfect use case for us to allow modders to override
|
||||
any behaviour they need and replace any classes.
|
||||
-->
|
||||
<PackageReference Include="Fody" Version="6.9.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Virtuosity.Fody" Version="3.1.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -48,6 +37,10 @@
|
||||
<!-- BuildType options - LOCAL, DEBUG, RELEASE, BLEEDING_EDGE, BLEEDING_EDGE_MODS - *must be all caps*-->
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="AfterEverythingDone" AfterTargets="PostBuildEvent">
|
||||
<Exec ConsoleToMsBuild="true" Command="..\..\Ceciler\Ceciler.Launcher.exe $(OutDir)SPTarkov.Server.Core.dll ..\..\Patches\Ceciler.Virtualizer\bin\$(Configuration)\$(TargetFramework)\Ceciler.Virtualizer.dll"/>
|
||||
</Target>
|
||||
|
||||
<!-- Generates the ProgramStatics class with the build information -->
|
||||
<Target Name="GenerateProgramStatics" BeforeTargets="BeforeBuild">
|
||||
<WriteLinesToFile File="Utils/ProgramStatics.Generated.cs" Lines="
using SPTarkov.Server.Core.Models.Enums%3B

namespace SPTarkov.Server.Core.Utils%3B

public static partial class ProgramStatics
{
 private static string? _sptVersion = "$(SptVersion)"%3B
 private static string? _commit = "$(SptCommit)"%3B
 private static double? _buildTime = $(SptBuildTime)%3B
 private static EntryType? BuildType = EntryType.$(SptBuildType)%3B
}
" Overwrite="true"/>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Ceciler.Interfaces">
|
||||
<HintPath>..\..\Ceciler\Ceciler.Interfaces.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Mono.Cecil" Version="0.11.6" >
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,78 @@
|
||||
using Ceciler.Interfaces;
|
||||
using Mono.Cecil;
|
||||
|
||||
namespace Ceciler.Virtualizer;
|
||||
|
||||
public class VirtualizerPatch : IPatcher
|
||||
{
|
||||
public void Patch(ModuleDefinition module)
|
||||
{
|
||||
foreach (var typeDefinition in module.Types)
|
||||
{
|
||||
foreach (var typeDefinitionMethod in typeDefinition.Methods)
|
||||
{
|
||||
if (typeDefinitionMethod == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeDefinitionMethod.IsConstructor)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (typeDefinitionMethod.IsFinal && typeDefinitionMethod.IsVirtual)
|
||||
{
|
||||
typeDefinitionMethod.IsFinal = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeDefinitionMethod.IsFinal)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeDefinitionMethod.IsVirtual)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeDefinitionMethod.IsStatic)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeDefinitionMethod.IsPrivate)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (MethodIsSerializationCallback(typeDefinitionMethod))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
typeDefinitionMethod.IsVirtual = true;
|
||||
typeDefinitionMethod.IsNewSlot = true;
|
||||
}
|
||||
}
|
||||
module.Write();
|
||||
}
|
||||
|
||||
static bool MethodIsSerializationCallback(MethodDefinition method)
|
||||
{
|
||||
return ContainsAttribute(method.CustomAttributes, "OnSerializingAttribute")
|
||||
|| ContainsAttribute(method.CustomAttributes, "OnSerializedAttribute")
|
||||
|| ContainsAttribute(method.CustomAttributes, "OnDeserializingAttribute")
|
||||
|| ContainsAttribute(method.CustomAttributes, "OnDeserializedAttribute");
|
||||
}
|
||||
|
||||
public static bool ContainsAttribute(IEnumerable<CustomAttribute> attributes, string attributeName) =>
|
||||
attributes.Any(attribute => attribute.Constructor.DeclaringType.Name == attributeName);
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Virtualizer"; }
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPTarkov.Server", "SPTarkov.Server\SPTarkov.Server.csproj", "{1F5ED9C6-8B1F-4776-85AB-B387CBBC5557}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPTarkov.Server.Core", "Libraries\SPTarkov.Server.Core\SPTarkov.Server.Core.csproj", "{AC8643DC-8779-4B4A-BBDA-2D4CC466F765}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{20A5EBD3-75D1-4E06-8240-09EEF874017A} = {20A5EBD3-75D1-4E06-8240-09EEF874017A}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{6C0681F9-4013-4579-82DA-0A9297984FD3}"
|
||||
EndProject
|
||||
@@ -29,6 +32,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SPTarkov.Reflection", "Libr
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JsonExtensionDataGenerator", "Tools\JsonExtensionDataGenerator\JsonExtensionDataGenerator.csproj", "{6F4670CD-6861-47A8-9A02-2B63AD73A929}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Patches", "Patches", "{9E41CD5A-271C-4294-AAF9-8EB379311416}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ceciler.Virtualizer", "Patches\Ceciler.Virtualizer\Ceciler.Virtualizer.csproj", "{20A5EBD3-75D1-4E06-8240-09EEF874017A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -79,6 +86,10 @@ Global
|
||||
{6F4670CD-6861-47A8-9A02-2B63AD73A929}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6F4670CD-6861-47A8-9A02-2B63AD73A929}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6F4670CD-6861-47A8-9A02-2B63AD73A929}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{20A5EBD3-75D1-4E06-8240-09EEF874017A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{20A5EBD3-75D1-4E06-8240-09EEF874017A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{20A5EBD3-75D1-4E06-8240-09EEF874017A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{20A5EBD3-75D1-4E06-8240-09EEF874017A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -92,5 +103,6 @@ Global
|
||||
{C24B1FEB-F8AC-434E-998D-5DA4D1687295} = {587959C2-5AFA-4B77-B327-566610F9A289}
|
||||
{9073A593-A2F5-471E-9678-B896A7226FD4} = {F084DDFD-89F3-44F9-89C3-5CA11F4CDEEF}
|
||||
{6F4670CD-6861-47A8-9A02-2B63AD73A929} = {587959C2-5AFA-4B77-B327-566610F9A289}
|
||||
{20A5EBD3-75D1-4E06-8240-09EEF874017A} = {9E41CD5A-271C-4294-AAF9-8EB379311416}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Reference in New Issue
Block a user