ln.snmp/types/Boolean.cs

37 lines
873 B
C#
Raw Normal View History

2019-03-04 06:50:05 +01:00
// /**
// * File: Boolean.cs
// * Author: haraldwolff
// *
// * This file and it's content is copyrighted by the Author and / or copyright holder.
// * Any use wihtout proper permission is illegal and may lead to legal actions.
// *
// *
// **/
using System;
2019-03-11 08:57:19 +01:00
using ln.snmp.asn1;
2019-03-04 06:50:05 +01:00
namespace ln.snmp.types
{
public class Boolean : Variable
{
public bool BooleanValue { get; set; }
public Boolean()
: base(new Identifier(IdentifierClass.UNIVERSAL, false, 1))
{
}
2019-03-11 08:57:19 +01:00
2019-03-04 06:50:05 +01:00
public override byte[] Bytes
{
get => BooleanValue ? new byte[] { 0xFF } : new byte[] { 0x00 };
set => BooleanValue = value[0] == 0 ? false : true;
}
public override object Value
{
get => BooleanValue;
set => BooleanValue = (bool)value;
}
}
}