// /** // * File: ObjectIdentifier.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; using System.Linq; namespace ln.snmp.types { public class ObjectIdentifier : Variable { public int[] OIDValue { get; set; } public ObjectIdentifier() :base(new Identifier(IdentifierClass.UNIVERSAL,false,6)) { } public ObjectIdentifier(int[] oid) : this() { OIDValue = oid; } public ObjectIdentifier(string oid) : this() { int[] ioid = oid.Split(new char[] { '.' }, StringSplitOptions.None).Select((x)=> int.Parse(x)).ToArray(); OIDValue = ioid; } public override byte[] Bytes { get => BasicEncodingRules.EncodeOID(OIDValue); set => OIDValue = BasicEncodingRules.DecodeOID(value); } public override object Value { get => OIDValue; set => OIDValue = value as int[]; } } }