private void UpdateSelectedPassInfo() { CorruptorPass selectedPass = FileCorruptorProgram.Corruptor.CorruptorPasses[selectedPassIdentifier]; if (selectedPass != null) { tb_pass_identifier.Text = selectedPass.Identifier; tb_pass_interval.Text = selectedPass.Interval.ToString(); tb_pass_chunk_size.Text = selectedPass.ChunkSize.ToString(); tb_pass_start_address.Text = selectedPass.StartAddress.ToString(); tb_pass_end_address.Text = selectedPass.EndAddress.ToString(); tb_pass_writevalue_max.Text = selectedPass.WriteValueMax.ToString(); tb_pass_writevalue_min.Text = selectedPass.WriteValueMin.ToString(); } }
private void UpdatePassesListBox() { lb_passes.Items.Clear(); var passes = FileCorruptorProgram.Corruptor.CorruptorPasses; foreach (KeyValuePair <string, CorruptorPass> pass in passes) { string identifier = pass.Key; CorruptorPass file = pass.Value; lb_passes.Items.Add(identifier); } if (selectedPassIdentifier == null && lb_passes.Items.Count > 0) { lb_passes.SelectedIndex = 0; } }
private void btn_create_new_pass_Click(object sender, EventArgs e) { CorruptorPass corruptorPass = new CorruptorPass() { Identifier = tb_pass_identifier.Text, Interval = Convert.ToInt32(tb_pass_interval.Text), ChunkSize = Convert.ToInt32(tb_pass_chunk_size.Text), StartAddress = Convert.ToInt32(tb_pass_start_address.Text), EndAddress = Convert.ToInt32(tb_pass_end_address.Text), WriteValueMin = Convert.ToByte(tb_pass_writevalue_min.Text), WriteValueMax = Convert.ToByte(tb_pass_writevalue_max.Text) }; FileCorruptorProgram.Corruptor.CorruptorPasses.Add(corruptorPass.Identifier, corruptorPass); selectedPassIdentifier = corruptorPass.Identifier; UpdatePassesListBox(); UpdateSelectedPassInfo(); }