Files
laatzen/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeCustomerText.cs
T

36 lines
948 B
C#

namespace Common.Hardware.WaterMeter.eRegister.Features
{
using System;
using System.Text;
public class ChangeCustomerText : Pam
{
public ChangeCustomerText() : base(10, ChangeCustomerText)
{
}
public ChangeCustomerText(Object text) : this()
=> this.Text = $"{text}".Trim();
public string Text
{
get => Encoding.ASCII.GetString(this.bytes, 1, 9);
set
{
var bytes = new byte[9];
if (!string.IsNullOrWhiteSpace(value))
{
var _bytes = Encoding.ASCII.GetBytes(value);
Array.Copy(_bytes, 0, bytes, 0, Math.Min(_bytes.Length, 9));
}
Array.Copy(bytes, 0, this.bytes, 1, 9);
}
}
public static implicit operator ChangeCustomerText(string value) => new ChangeCustomerText(value);
}
}