protected override void SaveCurrentInfo() { Log.LogInfo("Save Target Bias ..."); Log.LogInfo("Save Target Bias ..."); BoardCurrents current = new BoardCurrents { BoardName = DataMember.BoardName }; foreach (var seat in Seats) { SeatInit curs = new SeatInit() { Sn = SnDict[seat], Position = seat, CurrentDac0 = CalBias[seat * 100 + 0], CurrentDac1 = CalBias[seat * 100 + 1], CurrentDac2 = CalBias[seat * 100 + 2], CurrentDac3 = CalBias[seat * 100 + 3], Icc0 = InitIccSet[seat] }; current.SlotInit.Add(curs); } TempInit.SaveCalData(current); }
public void TestSaveCalData() { var temp = new InitTemp(_path); var current = new BoardCurrents { BoardName = "a" }; current.SlotInit.Add( new SeatInit { Sn = "X1", Position = 1, CurrentDac0 = 1, Icc0 = 1 }); current.SlotInit.Add( new SeatInit { Sn = "X2", Position = 2, CurrentDac0 = 1, Icc0 = 1 }); current.SlotInit.Add( new SeatInit { Sn = "X3", Position = 3, CurrentDac0 = 1, Icc0 = 1 }); temp.SaveCalData(current); SeatInit seat; var res = temp.GetCalData("a", 1, out seat); Assert.AreEqual(res, true); Assert.AreEqual(seat.Sn, "X1"); res = temp.GetCalData("a", 2, out seat); Assert.AreEqual(res, true); Assert.AreEqual(seat.Sn, "X2"); res = temp.GetCalData("a", 3, out seat); Assert.AreEqual(res, true); Assert.AreEqual(seat.Sn, "X3"); res = temp.GetCalData("a", 4, out seat); Assert.AreEqual(res, false); res = temp.GetCalData("b", 1, out seat); Assert.AreEqual(res, false); }
public void SaveCalData(BoardCurrents current) { var boardName = current.BoardName; var result = from x in _boardCurrents where x.BoardName == boardName select x; var boardCurrentses = result as BoardCurrents[] ?? result.ToArray(); var curs = boardCurrentses.Any() ? boardCurrentses.ToArray() : null; if (curs != null) { foreach (var cur in curs) { _boardCurrents.Remove(cur); } } _boardCurrents.Add(current); Utility.Dump(_tempFile, _boardCurrents); }