/// <inheritdoc />
        public override async Task <string> DeserializeAsync(SmppReader reader, CancellationToken cancellationToken)
        {
            var result = await reader.ReadStringAsync();

            await reader.ReadByteAsync();

            return(result);
        }
Exemple #2
0
        /// <inheritdoc />
        public override async Task <byte> DeserializeAsync(SmppReader reader, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var result = await reader.ReadByteAsync();

            if (result < 0)
            {
                throw new SerializationException();
            }

            return((byte)result);
        }
        /// <inheritdoc />
        public override async Task <bool> DeserializeAsync(SmppReader reader, SmppSerializationSettings serializationSettings, CancellationToken cancellationToken)
        {
            var result = await reader.ReadByteAsync();

            if (result == 1)
            {
                return(true);
            }

            if (result == 0)
            {
                return(false);
            }

            throw new FormatException();
        }