private void InitializeSetWithScreenData(PsaParametersSet set, PeugeotScreen screen) { set.Type = PsaParametersSetTypeMapper.Get(screen.Name); set.OriginalName = screen.Name; foreach (PeugeotRawParameterPoint p in screen.Points) { PsaParameterData parameter = new PsaParameterData(p.ParameterName); // passed original type ID parameter.Type = DataTypeResolver2.GetType(p.ParameterName); parameter.OriginalName = p.ParameterName; parameter.HasTimestamps = false; parameter.Values.Add(p.Value); parameter.Units = UnitsConverter.Convert(p.Units); parameter.AdditionalSourceInfo = GenerateAdditionalSourceInfo(parameter.OriginalTypeId); set.Parameters.Add(parameter); } }
public PsaParametersSet Create() { PsaParametersSet set = new PsaParametersSet(); if (screens.Count == 0) { return(set); } string name = screens.FirstOrDefault().Name; set.Type = PsaParametersSetTypeMapper.Get(name); set.OriginalName = name; // assume all screens contain the same params, oherwise it's bad foreach (LexiaRawParameterPoint pt in screens.FirstOrDefault().Points) { if (!set.Parameters.Any(p => p.OriginalName.Equals(pt.ParameterName, StringComparison.OrdinalIgnoreCase))) { PsaParameterData newParamData = new PsaParameterData(pt.ParameterName); // passed originalType Id newParamData.OriginalName = pt.ParameterName; newParamData.AdditionalSourceInfo = GenerateAdditionalSourceInfo(newParamData.OriginalTypeId); newParamData.Type = DataTypeResolver2.GetType(pt.ParameterName); newParamData.HasTimestamps = false; newParamData.Units = UnitsConverter.Convert(pt.Units); set.Parameters.Add(newParamData); } } foreach (LexiaScreen screen in screens) { foreach (LexiaRawParameterPoint p in screen.Points) { PsaParameterData targetParamData = set.Parameters.First( param => param.OriginalName.Equals(p.ParameterName, StringComparison.OrdinalIgnoreCase)); targetParamData.Values.Add(p.Value); } } return(set); }