Added auto prop sending

- updated readme
This commit is contained in:
Sandoun
2023-06-15 20:49:14 +02:00
parent 62f4a48bf9
commit 7864915967
4 changed files with 48 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MewtocolNet.Logging;
using MewtocolNet.RegisterAttributes;
using MewtocolNet.Registers;
namespace MewtocolNet {
@@ -194,6 +195,12 @@ namespace MewtocolNet {
}
internal void PropertyRegisterWasSet (string propName, object value) {
SetRegister(propName, value);
}
#endregion
#region Register Adding

View File

@@ -38,7 +38,9 @@ namespace MewtocolNet.RegisterAttributes
/// <summary>
/// Use this on the setter method of a property to enable automatic property register writing
/// </summary>
public static void AutoSetter<T> (object value, ref T privateField) {
public void AutoSetter<T> (object value, ref T privateField, [CallerMemberName] string propName = null) {
PLCInterface.PropertyRegisterWasSet(propName, value);
if(value is IRegister reg) {