private void SetData(NanoData n) { _captureMode = DataUtil.GetItem <int>("captureMode"); IpAddress = n.IpAddress; _token = n.Token; _layout = n.Layout; Brightness = n.Brightness; var nanoType = n.Type; _streamMode = nanoType == "NL29" ? 2 : 1; _basePath = "http://" + IpAddress + ":16021/api/v1/" + _token; Id = n.Id; }
private static NanoLayout MergeLayouts(NanoLayout newLayout, NanoLayout existing) { if (newLayout == null) { throw new ArgumentException("Invalid argument."); } if (existing == null) { return(newLayout); } var posData = new List <PanelLayout>(); var output = newLayout; if (existing.PositionData == null) { return(output); } // Loop through each panel in the new position data, find existing info and copy foreach (var nl in newLayout.PositionData) { foreach (var el in existing.PositionData.Where(s => s.PanelId == nl.PanelId)) { nl.TargetSector = el.TargetSector; nl.TargetSectorV2 = el.TargetSectorV2; // If normal sector is set, but v2 is not, do some crude math and get the new sector if (nl.TargetSector != -1 && nl.TargetSectorV2 == -1) { nl.TargetSectorV2 = nl.TargetSector / 12 * 28; } } posData.Add(nl); } output.PositionData = posData; return(output); }