public static BerValue Read(BinaryReader reader, Int32 length, Byte code) { BerValue lResult; switch (code) { case Asn1.BITSTRING: lResult = new BerBinary(); break; case Asn1.ENUMERATED: lResult = new BerEnumerated(); break; case Asn1.BOOLEAN: lResult = new BerBoolean(); break; case Asn1.INTEGER: lResult = new BerInteger(); break; case Asn1.COUNTER: case Asn1.GAUGE: case Asn1.TIMETICKS: lResult = new BerUInteger(); break; case Asn1.LDAPREFERER: case Asn1.SET: case Asn1.SEQUENCE: lResult = new BerSequence(); break; case Asn1.IPADDRESS: lResult = new BerIpAddress(); break; case Asn1.OPAQUE: case Asn1.OCTETSTRING: lResult = new BerString(); break; default: if (code >= Asn1.LDAPSTARTRANGE && code <= Asn1.LDAPENDRANGE) { lResult = new BerSequence(); } else { lResult = new BerOther(); } break; } lResult.IntRead(reader, code, length); return(lResult); }
public static BerValue Read(BinaryReader reader, Int32 length, Byte code) { BerValue lResult; switch (code) { case Asn1.BITSTRING: lResult = new BerBinary(); break; case Asn1.ENUMERATED: lResult = new BerEnumerated(); break; case Asn1.BOOLEAN: lResult = new BerBoolean(); break; case Asn1.INTEGER: lResult = new BerInteger(); break; case Asn1.COUNTER: case Asn1.GAUGE: case Asn1.TIMETICKS: lResult = new BerUInteger(); break; case Asn1.LDAPREFERER: case Asn1.SET: case Asn1.SEQUENCE: lResult = new BerSequence(); break; case Asn1.IPADDRESS: lResult = new BerIpAddress(); break; case Asn1.OPAQUE: case Asn1.OCTETSTRING: lResult = new BerString(); break; default: if (code >= Asn1.LDAPSTARTRANGE && code <= Asn1.LDAPENDRANGE) lResult = new BerSequence(); else lResult = new BerOther(); break; } lResult.IntRead(reader, code, length); return lResult; }