public object ToData(ChaosInvocationResp resp) { if (resp.Exception != null) { throw new RemotingException(resp.Exception); } if (string.IsNullOrEmpty(resp.DataTypeFullName)) { return(null); } if (resp.Data == null) { return(null); } if (resp.Data.Length <= 0) { return(null); } var dataType = _typeFinder.Find(resp.DataTypeFullName); return(_serializer.Deserialize(dataType, resp.Data)); }
private ChaosInvocationResp ToChaosInvocationResp(ChaosInvocation invocation, object returnValue) { var invocationReply = new ChaosInvocationResp() { DataTypeFullName = invocation.ReturnTypeFullName }; if (invocation.IsReturnTask) { var taskResult = returnValue.GetTaskResult(); invocationReply.Data = _serializer.Serialize(taskResult.value); } else { invocationReply.Data = _serializer.Serialize(returnValue); } return(invocationReply); }
private void ClientOnOnMessage(object sender, MessageEventArgs e) { _reply = (ChaosInvocationResp)_binarySerializer.Deserialize(typeof(ChaosInvocationResp), e.RawData); _singal.Set(); }