private ulong ReadUInt64(CborSimpleType simpleType)
        {
            if ((byte)simpleType < 24)
            {
                return(Convert.ToUInt64((byte)simpleType));
            }

            switch ((byte)simpleType)
            {
            case 24:
                return(Convert.ToUInt64(_reader.ReadByte()));

            case 25:
                return(Convert.ToUInt64(_reader.ReadUInt16BE()));

            case 26:
                return(Convert.ToUInt64(_reader.ReadUInt32BE()));

            case 27:
                return(_reader.ReadUInt64BE());

            case 28:
            case 29:
            case 30:
                throw new InvalidDataException();     // unassigned

            default:
                throw new InvalidOperationException($"Invalid simple type ({(int)simpleType}) passed to {nameof(ReadUInt64)}");
            }
        }
Exemplo n.º 2
0
 public CborSimpleToken(CborMajorType majorType, byte simpleType)
     : base(majorType)
 {
     SimpleType = (CborSimpleType)simpleType;
 }
Exemplo n.º 3
0
 public CborSimpleToken(CborMajorType majorType, CborSimpleType simpleType)
     : base(majorType)
 {
     SimpleType = simpleType;
 }