BerLib.BerEncoding.DecodeTag C# (CSharp) Метод

DecodeTag() публичный статический Метод

public static DecodeTag ( IBerInput input ) : BerTag
input IBerInput
Результат BerTag
        public static BerTag DecodeTag(IBerInput input)
        {
            var tagByte = input.ReadByte();
             var tag = new BerTag((byte)(tagByte & 0xE0), (uint)(tagByte & 0x1F));

             if(tag.Number == 0x1F)
            tag.Number = DecodeMultiByteInteger(input);

             return tag;
        }

Usage Example

Пример #1
0
        static int DecodeHeader(IBerInput input, BerTag expectedTag)
        {
            var tag = BerEncoding.DecodeTag(input);

            if (tag != expectedTag)
            {
                throw new BerException(4001, String.Format("Expected tag {0}, found tag {1}", tag, expectedTag));
            }

            return(BerEncoding.DecodeLength(input));
        }