private void button1_Click(object sender, EventArgs e) { _stop = false; listBox1.Items.Clear(); UpdateListBoxInvoke("Start..."); //Формирование списка под ошибки foreach (var current in _statusCurrent) { current.Value = 0; } //Скрыть элеметы управления UpdateEnableToolsInvoke(false); //Установить параметры прогресс бара progressBar1.Maximum = (int)numericUpDown1.Value; progressBar1.Value = 0; _testListInput.Clear(); _testListOutput.Clear(); _writeStatus.Clear(); _readStatus.Clear(); _readOutput.Clear(); _readInput.Clear(); _tempValueOutput.Clear(); foreach (var current in _statusCurrent) { if (!_testListInput.ContainsKey(current.AddrInput)) { _testListInput.Add(current.AddrInput, 0); } if (!_testListOutput.ContainsKey(current.AddrOutput)) { _testListOutput.Add(current.AddrOutput, 0); } if (!_writeStatus.ContainsKey(current.AddrOutput)) { _writeStatus.Add(current.AddrOutput, false); } if (!_readStatus.ContainsKey(current.AddrOutput)) { _readStatus.Add(current.AddrOutput, false); } if (!_readInput.ContainsKey(current.AddrInput)) { _readInput.Add(current.AddrInput, false); } if (!_readOutput.ContainsKey(current.AddrOutput)) { _readOutput.Add(current.AddrOutput, false); } if (!_tempValueOutput.ContainsKey(current.AddrOutput)) { _tempValueOutput.Add(current.AddrOutput, 0); } } CycleCheack xxxCycleCheack = Start; xxxCycleCheack.Invoke(); }
//Сравниваем private void Varification() { if (!_readInput.ContainsValue(false) && !_readOutput.ContainsValue(false)) { foreach (var current in _statusCurrent) { if (_tempValueOutput[current.AddrOutput] != _testListOutput[current.AddrOutput]) { //Добавить ошибку } //Получаем значение бита var input = (_testListInput[current.AddrInput] & (1 << Convert.ToUInt16(current.BitInput))) >> Convert.ToUInt16(current.BitInput); var output = (_testListOutput[current.AddrOutput] & (1 << Convert.ToUInt16(current.BitOutput))) >> Convert.ToUInt16(current.BitOutput); if (input != output) { current.Value++; } _readStatus[current.AddrOutput] = true; } } //Проверка if (!_readStatus.ContainsValue(false)) { foreach (var status in _readInput.Keys.ToList()) { _readInput[status] = false; } foreach (var status in _readOutput.Keys.ToList()) { _readOutput[status] = false; } foreach (var status in _readStatus.Keys.ToList()) { _readStatus[status] = false; } CycleCheack xxxCycleCheack = Start; xxxCycleCheack.Invoke(); } }