public override sealed async Task <T> ReadResponse(IResponseReader reader)
        {
            var line = await reader.ReadLine();

            StorageCommandResult result;
            T actualResult;

            if (Util.TryParseStorageCommandResult(line.Parts[0], out result) && TryConvertResult(result, out actualResult))
            {
                return(actualResult);
            }
            throw Util.CreateUnexpectedResponseLine(this, line.Line);
        }
Example #2
0
        public override async Task <bool> ReadResponse(IResponseReader reader)
        {
            var responseLine = await reader.ReadLine();

            if (responseLine.Parts[0] == "DELETED")
            {
                return(true);
            }
            if (responseLine.Parts[0] == "NOT_FOUND")
            {
                return(false);
            }
            throw Util.CreateUnexpectedResponseLine(this, responseLine.Line);
        }
        public override async Task <ulong?> ReadResponse(IResponseReader reader)
        {
            var line = await reader.ReadLine();

            if (line.Parts[0] == "NOT_FOUND")
            {
                return(null);
            }
            ulong result;

            if (ulong.TryParse(line.Parts[0], out result))
            {
                return(result);
            }
            throw Util.CreateUnexpectedResponseLine(this, line.Line);
        }