Files
BQP/srcs/RobotNet10/Components/RobotNet10.ScriptEditor/Helpers/Webcil/WasmWebcilWrapper.cs
2026-07-13 09:25:40 +07:00

22 lines
614 B
C#

using System.Reflection;
namespace RobotNet10.ScriptEditor.Helpers.Webcil;
public class WasmWebcilWrapper
{
private static readonly FieldInfo FieldInfoPrefix = typeof(WebcilWasmWrapper).GetField("s_wasmWrapperPrefix", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField)!;
public static byte[] GetPrefix()
{
#if NET7_0_OR_GREATER
return GetPrefixValue<ReadOnlyMemory<byte>>().ToArray();
#else
return GetPrefixValue<byte[]>();
#endif
}
private static T GetPrefixValue<T>()
{
return (T)FieldInfoPrefix.GetValue(null)!;
}
}