internal void WriteToApi(Raw.GLedAPIv1_0_0Wrapper api) { if (dirty) { // This is a workaround to avoid some zones/divisions not getting configured (issue #9). // Calling SetLedData twice will actually allow all zones to be set. api.SetLedData(this); api.SetLedData(this); dirty = false; } }
internal MotherboardLedLayoutImpl(Raw.GLedAPIv1_0_0Wrapper api, int maxDivisions) { this.Length = maxDivisions; myLayout = new Lazy <LedType[]>(() => { byte[] rawLayout = api.GetLedLayout(maxDivisions); if (maxDivisions != rawLayout.Length) { throw new GLedAPIException(string.Format("GetLedLayout({0}) returned {1} divisions", maxDivisions, rawLayout.Length)); } LedType[] layout = new LedType[rawLayout.Length]; for (int i = 0; i < layout.Length; i++) { layout[i] = (LedType)rawLayout[i]; } return(layout); }); }