public void Import(CurveLibraryRecord clr, bool updateIfPresent = false) { Load(false); if (_dataTable == null) { return; } var rowArray = _dataTable.Select(GetSelectString(clr.Manufacturer, clr.LightCount, clr.Color, clr.Controller)); if ((rowArray.Length != 0) && !updateIfPresent) { return; } var curveDataStrings = new List <string>(); Array.ForEach(clr.CurveData, b => curveDataStrings.Add(b.ToString(CultureInfo.InvariantCulture))); if (rowArray.Length == 0) { var row = _dataTable.NewRow(); row[ManufacturerCol] = clr.Manufacturer; row[LightCountCol] = clr.LightCount; row[ColorCol] = clr.Color; row[ControllerCol] = clr.Controller; row[CurveDataCol] = string.Join("|", curveDataStrings.ToArray()); _dataTable.Rows.Add(row); } else { rowArray[0][CurveDataCol] = string.Join("|", curveDataStrings.ToArray()); } _modified = true; }
public void Import(CurveLibraryRecord clr, bool updateIfPresent = false) { Load(false); if (_dataTable == null) { return; } var rowArray = _dataTable.Select(GetSelectString(clr.Manufacturer, clr.LightCount, clr.Color, clr.Controller)); if ((rowArray.Length != 0) && !updateIfPresent) { return; } var curveDataStrings = new List<string>(); Array.ForEach(clr.CurveData, b => curveDataStrings.Add(b.ToString(CultureInfo.InvariantCulture))); if (rowArray.Length == 0) { var row = _dataTable.NewRow(); row[ManufacturerCol] = clr.Manufacturer; row[LightCountCol] = clr.LightCount; row[ColorCol] = clr.Color; row[ControllerCol] = clr.Controller; row[CurveDataCol] = string.Join("|", curveDataStrings.ToArray()); _dataTable.Rows.Add(row); } else { rowArray[0][CurveDataCol] = string.Join("|", curveDataStrings.ToArray()); } _modified = true; }