protected override RequestResponse <Result> DeserializeMessage(ResponseBodyStream data) { if (data.OperationResult != OperationResult.Ok) { throw new Exception($"{nameof(ListRequest)} failed with result code {data.OperationResult}"); } var res = new Result { OperationResult = data.OperationResult, Revision = Revision.FromStream(data), FullPath = _fullPath }; if ((Options & Option.TotalSpace) != 0) { res.TotalSpace = data.ReadULong(); } if ((Options & Option.UsedSpace) != 0) { res.UsedSpace = data.ReadULong(); } res.FingerPrint = data.ReadBytesByLength(); res.Item = Deserialize(data, _fullPath); return(new RequestResponse <Result> { Ok = data.OperationResult == OperationResult.Ok, Result = res }); }
protected override RequestResponse <Result> DeserializeMessage(ResponseBodyStream data) { switch (data.OperationResult) { case OperationResult.Ok: break; case OperationResult.NotExists: //throw new NotFoundException($"{nameof(ListRequest)} failed with result code {data.OperationResult}", HttpStatusCode.NotFound); throw new RequestException(_fullPath) { StatusCode = HttpStatusCode.NotFound }; default: throw new Exception($"{nameof(ListRequest)} failed with result code {data.OperationResult}"); } var res = new Result { OperationResult = data.OperationResult, Revision = Revision.FromStream(data), FullPath = _fullPath }; if ((Options & Option.TotalSpace) != 0) { res.TotalSpace = data.ReadULong(); } if ((Options & Option.UsedSpace) != 0) { res.UsedSpace = data.ReadULong(); } res.FingerPrint = data.ReadBytesByLength(); res.Item = Deserialize(data, _fullPath); return(new RequestResponse <Result> { Ok = data.OperationResult == OperationResult.Ok, Result = res }); }
protected override RequestResponse <Result> DeserializeMessage(ResponseBodyStream data) { var opres = (OpResult)(int)data.OperationResult; if (opres == OpResult.Ok) { return(new RequestResponse <Result> { Ok = true, Result = new Result { OperationResult = data.OperationResult, OneRevision = Revision.FromStream(data), TwoRevision = Revision.FromStream(data) } }); } throw new Exception($"{nameof(MoveRequest)} failed with result code {opres}"); }