/// <summary> /// Создает копию данного объекта /// </summary> /// <returns></returns> public Indicator Clone() { Indicator ind = new Indicator(); ind.address = address; ind.con = con; ind.correctOffset = correctOffset; ind.fact = fact; ind.indicatorType = indicatorType; ind.jack = jack; ind.offset = offset; ind.offsetPp.OffsetOfBits = offsetPp.OffsetOfBits; ind.offsetPp.OffsetOfByte = offsetPp.OffsetOfByte; ind.offsetThr.OffsetOfBits = offsetThr.OffsetOfBits; ind.offsetThr.OffsetOfByte = offsetThr.OffsetOfByte; ind.pointPos = pointPos; ind.thr_max = thr_max; ind.thr_min = thr_min; return ind; }
/// <summary> /// Инициализирует блок отображения /// </summary> /// <param name="eprom">Eprom устройства из которого необходимо выделить конфигурацию блока отображения</param> /// <returns>Блок отображения</returns> public Block CreateBlock(Eprom eprom) { Block block = new Block(); for (int i = 0; i < 16; i++) { Indicator indicator = new Indicator(); indicator.Jack = GetJackFromIndex(i + 1); indicator.Con = eprom[1][i * 16 + 0]; indicator.Address = eprom[1][i * 16 + 1]; indicator.Offset = eprom[1][i * 16 + 2]; indicator.OffsetThr.TotalOffset = eprom[1][i * 16 + 3]; indicator.OffsetPp.TotalOffset = eprom[1][i * 16 + 5]; indicator.PointPosition = eprom[1][i * 16 + 6]; switch (eprom[1][i * 16 + 7]) { case 1: indicator.IndicatorType = IndicatorType.Column32; break; case 2: indicator.IndicatorType = IndicatorType.Column32Bipolar; break; case 3: indicator.IndicatorType = IndicatorType.ThreeDigit; break; case 4: indicator.IndicatorType = IndicatorType.FourDigit; break; case 5: indicator.IndicatorType = IndicatorType.FiveDigit; break; case 6: indicator.IndicatorType = IndicatorType.Clock; break; } byte[] factArray = new byte[4]; byte[] CorrectoffsetArray = new byte[4]; byte[] minArray = new byte[4]; byte[] maxArray = new byte[4]; for (int ind = 0; ind < 4; ind++) { factArray[ind] = eprom[2][i * 16 + ind]; CorrectoffsetArray[ind] = eprom[2][(i * 16) + (ind + 4)]; minArray[ind] = eprom[2][(i * 16) + (ind + 8)]; minArray[ind] = eprom[2][(i * 16) + (ind + 12)]; } float fact = BitConverter.ToSingle(factArray, 0); int correct = BitConverter.ToInt32(CorrectoffsetArray, 0); int min = BitConverter.ToInt32(minArray, 0); int max = BitConverter.ToInt32(maxArray, 0); indicator.Fact = fact; indicator.CorrectOffset = correct; indicator.Thr_MIN = min; indicator.Thr_MAX = max; block.Indicators.Add(indicator); } block.Address = eprom[0][0x18]; block.Speed = eprom[0][0x10]; block.TypeCRC = eprom[0][0x11]; block.SpeedOpros = eprom[0][0xe0]; InitBlockCommonOptions(block, eprom); return block; }