private TwilioWorkState DeserializeStep(IReceivedData receivedData) { var state = new TwilioWorkState { ReceivedData = receivedData }; try { state.TextMessage = state.ReceivedData.ContentType switch { Constants.HeaderValueForLetter => _serializationProvider .Deserialize <TextMessage>(state.ReceivedData.Letter.Body), _ => _serializationProvider .Deserialize <TextMessage>(state.ReceivedData.Data) }; if (state.ReceivedData.Data.Length > 0 && (state.TextMessage != null || state.ReceivedData.Letter != null)) { state.DeserializeStepSuccess = true; } } catch { state.DeserializeStepSuccess = false; } return(state); }
public SendEmailState SendEmailDeserialize(IReceivedData receivedData) { var state = new SendEmailState { ReceivedData = receivedData }; try { state.SendEmail = state.ReceivedData.ContentType switch { Constants.HeaderValueForLetter => _serializationProvider .Deserialize <SendEmail>(state.ReceivedData.Letter.Body), _ => _serializationProvider .Deserialize <SendEmail>(state.ReceivedData.Data) }; state.StepSuccess[SendEmailDeserializeStepKey] = state.SendEmail != default || state.SendEmail != null; } catch (Exception ex) { _logger.LogError(ex, SendEmailDeserializeError); state.StepSuccess[SendEmailDeserializeStepKey] = false; } return(state); }
private async Task <WorkState> DeserializeStepAsync(IReceivedData receivedData) { var state = new WorkState { ReceivedData = receivedData }; try { state.Message = state.ReceivedData.ContentType switch { HouseofCat.RabbitMQ.Constants.HeaderValueForLetter => await receivedData .GetTypeFromJsonAsync <Message>() .ConfigureAwait(false), _ => await receivedData .GetTypeFromJsonAsync <Message>(decrypt : false, decompress : false) .ConfigureAwait(false), }; if (state.ReceivedData.Data.Length > 0 && (state.Message != null || state.ReceivedData.Letter != null)) { state.DeserializeStepSuccess = true; } } catch { } return(state); }
private WorkState DeserializeStep(IReceivedData receivedData) { var state = new WorkState { ReceivedData = receivedData }; try { state.Message = state.ReceivedData.ContentType switch { HouseofCat.RabbitMQ.Constants.HeaderValueForLetter => _serializationProvider .Deserialize <Message>(state.ReceivedData.Letter.Body), _ => _serializationProvider .Deserialize <Message>(state.ReceivedData.Data), }; if (state.ReceivedData.Data.Length > 0 && (state.Message != null || state.ReceivedData.Letter != null)) { state.DeserializeStepSuccess = true; } } catch { } return(state); }
public void Add(Guid guid, DateTime receiveTime, string senderName, IReceivedData receivedData, bool completed, bool replaceIfExisting = true) { System.Diagnostics.Debug.WriteLine($"Added {guid} from {senderName} to db"); if (ContainsKey(guid)) { if (replaceIfExisting) { Remove(guid); } else { return; } } HistoryRow r = new HistoryRow() { Id = guid, ReceiveTime = receiveTime, RemoteDeviceName = senderName, Data = receivedData, Completed = completed, }; data.Insert(r); }