diff --git a/src/libplctag/INativeTag.cs b/src/libplctag/INativeTag.cs
index adebe3ef..3f889052 100644
--- a/src/libplctag/INativeTag.cs
+++ b/src/libplctag/INativeTag.cs
@@ -33,6 +33,7 @@ interface INativeTag
sbyte plc_tag_get_int8(int tag, int offset);
int plc_tag_get_int_attribute(int tag, string attrib_name, int default_value);
int plc_tag_set_int_attribute(int tag, string attrib_name, int new_value);
+ int plc_tag_get_byte_array_attribute(int tag, string attrib_name, byte[] buffer, int buffer_length);
int plc_tag_get_size(int tag);
int plc_tag_set_size(int tag, int new_size);
ushort plc_tag_get_uint16(int tag, int offset);
diff --git a/src/libplctag/NativeTag.cs b/src/libplctag/NativeTag.cs
index 99045602..282823d7 100644
--- a/src/libplctag/NativeTag.cs
+++ b/src/libplctag/NativeTag.cs
@@ -35,6 +35,7 @@ class NativeTag : INativeTag
public int plc_tag_abort(Int32 tag) => plctag.plc_tag_abort(tag);
public int plc_tag_get_int_attribute(Int32 tag, string attrib_name, int default_value) => plctag.plc_tag_get_int_attribute(tag, attrib_name, default_value);
public int plc_tag_set_int_attribute(Int32 tag, string attrib_name, int new_value) => plctag.plc_tag_set_int_attribute(tag, attrib_name, new_value);
+ public int plc_tag_get_byte_array_attribute(Int32 tag, string attrib_name, byte[] buffer, int buffer_length) => plctag.plc_tag_get_byte_array_attribute(tag, attrib_name, buffer, buffer_length);
public UInt64 plc_tag_get_uint64(Int32 tag, int offset) => plctag.plc_tag_get_uint64(tag, offset);
public Int64 plc_tag_get_int64(Int32 tag, int offset) => plctag.plc_tag_get_int64(tag, offset);
public int plc_tag_set_uint64(Int32 tag, int offset, UInt64 val) => plctag.plc_tag_set_uint64(tag, offset, val);
diff --git a/src/libplctag/NativeTagWrapper.cs b/src/libplctag/NativeTagWrapper.cs
index 068b372a..a0482c48 100644
--- a/src/libplctag/NativeTagWrapper.cs
+++ b/src/libplctag/NativeTagWrapper.cs
@@ -528,6 +528,20 @@ private void SetIntAttribute(string attributeName, int value)
ThrowIfStatusNotOk(result);
}
+ public byte[] GetByteArrayAttribute(string attributeName)
+ {
+ ThrowIfAlreadyDisposed();
+
+ var bufferLengthAttributeName = attributeName + ".length";
+ var bufferLength = GetIntAttribute(bufferLengthAttributeName);
+ var buffer = new byte[bufferLength];
+
+ var result = (Status)_native.plc_tag_get_byte_array_attribute(nativeTagHandle, attributeName, buffer, buffer.Length);
+ ThrowIfStatusNotOk(result);
+
+ return buffer;
+ }
+
private void SetDebugLevel(DebugLevel level)
{
_native.plc_tag_set_debug_level((int)level);
diff --git a/src/libplctag/Tag.cs b/src/libplctag/Tag.cs
index d9ce568e..71e6a9ed 100644
--- a/src/libplctag/Tag.cs
+++ b/src/libplctag/Tag.cs
@@ -405,6 +405,10 @@ public uint? StringTotalLength
public void GetBuffer(byte[] buffer) => _tag.GetBuffer(buffer);
public void SetBuffer(byte[] newBuffer) => _tag.SetBuffer(newBuffer);
+ ///
+ /// This function retrieves an attribute of the raw tag byte array.
+ ///
+ public byte[] GetByteArrayAttribute(string attributeName) => _tag.GetByteArrayAttribute(attributeName);
public int GetSize() => _tag.GetSize();
public void SetSize(int newSize) => _tag.SetSize(newSize);
diff --git a/src/libplctag/libplctag.csproj b/src/libplctag/libplctag.csproj
index 07bac8ca..ba7a9e98 100644
--- a/src/libplctag/libplctag.csproj
+++ b/src/libplctag/libplctag.csproj
@@ -18,7 +18,7 @@
-
+