public void UpdateFtpTextToDtoConversion(string text) { bool hasExceptionHappened = false; try { GsmCommunicationText = text; GsmCommunicationToJson = _converter.GsmCommunicationToJson(text); } catch (Exception e) { GsmCommunicationToJson = $"GsmCommunicationToJson Conversion didn't work: {e}/{e.InnerException}"; hasExceptionHappened = true; } try { if (!hasExceptionHappened) { BusinessObjectResult = _converter.GsmCommunicationJsonToBusinessObject(GsmCommunicationToJson); BusinessObject = BusinessObjectResult.BusinessObjectRoot; BusinessObjectJson = JsonConvert.SerializeObject(BusinessObject, Formatting.Indented); } else { BusinessObjectJson = $"GsmCommunicationJsonToBusinessObject Conversion didn't work."; } } catch (Exception e) { BusinessObjectJson = $"GsmCommunicationJsonToBusinessObject Conversion didn't work: {e}/{e.InnerException}"; hasExceptionHappened = true; } if (!hasExceptionHappened) { IsFileAConfigurationMessage = IsConfigurationMessage(BusinessObject); if (IsFileAConfigurationMessage) { DeviceConfiguration = _converter.BusinessObjectToDeviceConfiguration(BusinessObject); DeviceConfigurationJson = JsonConvert.SerializeObject(DeviceConfiguration, Formatting.Indented); } else { DeviceConfiguration = null; ChannelIds = BusinessObject.Measurements.DataPointsByChannel.Keys.ToArray(); var measurementValuesByTimeStamp = new Dictionary <DateTime, float[]>(); for (var i = 0; i < ChannelIds.Length; i++) { KeyValuePair <int, List <DataPoint> > dataPointsPerChannel = BusinessObject.Measurements.DataPointsByChannel.ToArray()[i]; foreach (DataPoint dataPoint in dataPointsPerChannel.Value) { if (!measurementValuesByTimeStamp.ContainsKey(dataPoint.Time)) { measurementValuesByTimeStamp.Add(dataPoint.Time, new float[ChannelIds.Length]); } measurementValuesByTimeStamp[dataPoint.Time][i] = dataPoint.Value; } } Measurements = new List <BlazorMeasurement>(); foreach ((DateTime id, float[] values) in measurementValuesByTimeStamp) { Measurements.Add(new BlazorMeasurement { Time = id, Values = values }); } } } else { DeviceConfigurationJson = "Conversion didn't work with given data"; } }