feature: first
All checks were successful
Build / Compute Version (push) Successful in 4s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 2m47s
Build / Build Nuget package (CringePlugins) (push) Successful in 5m31s
Build / Build Nuget package (NuGet) (push) Successful in 6m2s
Build / Build Nuget package (SharedCringe) (push) Successful in 7m25s
Build / Build Launcher (push) Successful in 9m11s
All checks were successful
Build / Compute Version (push) Successful in 4s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 2m47s
Build / Build Nuget package (CringePlugins) (push) Successful in 5m31s
Build / Build Nuget package (NuGet) (push) Successful in 6m2s
Build / Build Nuget package (SharedCringe) (push) Successful in 7m25s
Build / Build Launcher (push) Successful in 9m11s
This commit is contained in:
36
CringeLauncher/Patches/XmlRootWriterPatch.cs
Normal file
36
CringeLauncher/Patches/XmlRootWriterPatch.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection.Emit;
|
||||
using System.Xml;
|
||||
using HarmonyLib;
|
||||
using VRage;
|
||||
|
||||
namespace CringeLauncher.Patches;
|
||||
|
||||
[HarmonyPatch(typeof(CustomRootWriter), "Init")]
|
||||
public class XmlRootWriterPatch
|
||||
{
|
||||
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
var ins = instructions.ToList();
|
||||
|
||||
var index = ins.FindIndex(b =>
|
||||
b.opcode == OpCodes.Ldstr && b.operand is "xsi:type");
|
||||
ins[index].operand = "xsi";
|
||||
|
||||
ins.InsertRange(index + 1, new[]
|
||||
{
|
||||
new CodeInstruction(OpCodes.Ldstr, "type"),
|
||||
new CodeInstruction(OpCodes.Ldstr, "http://www.w3.org/2001/XMLSchema-instance")
|
||||
});
|
||||
|
||||
var instruction = ins[ins.FindIndex(b => b.opcode == OpCodes.Callvirt)];
|
||||
instruction.operand = AccessTools.Method(typeof(XmlWriter), "WriteAttributeString", new[]
|
||||
{
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string),
|
||||
typeof(string)
|
||||
});
|
||||
|
||||
return ins;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user