From 315cd6eb44acd05bd1cda66575ec02db5ce22675 Mon Sep 17 00:00:00 2001 From: Samuele Lorefice Date: Tue, 25 Feb 2025 16:31:28 +0100 Subject: [PATCH] Added ToPointer ByteArray extension method --- BlendFile/ByteArrayExt.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BlendFile/ByteArrayExt.cs b/BlendFile/ByteArrayExt.cs index 10f41aa..43601d2 100644 --- a/BlendFile/ByteArrayExt.cs +++ b/BlendFile/ByteArrayExt.cs @@ -3,4 +3,7 @@ namespace BlendFile; public static class ByteArrayExt{ public static long ToMemAddr(this Byte[] bytes, bool isLittleEndian = true) => BitConverter.ToInt64(isLittleEndian == BitConverter.IsLittleEndian ? bytes : bytes.Reverse().ToArray(), 0); + + public static IntPtr ToPointer(this Byte[] bytes, bool isLittleEndian = true) => + new (BitConverter.ToInt64(isLittleEndian == BitConverter.IsLittleEndian ? bytes : bytes.Reverse().ToArray(), 0)); } \ No newline at end of file