34 lines
851 B
C#
34 lines
851 B
C#
|
// /**
|
|||
|
// * 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;
|
|||
|
namespace ln.snmp.types
|
|||
|
{
|
|||
|
public class Boolean : Variable
|
|||
|
{
|
|||
|
public bool BooleanValue { get; set; }
|
|||
|
|
|||
|
public Boolean()
|
|||
|
: base(new Identifier(IdentifierClass.UNIVERSAL, false, 1))
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|