private void btnRemove_Click(object sender, EventArgs e) { if (lstFormats.SelectedIndex >= 0 && lstFormats.SelectedIndex < lstFormats.Items.Count) { FormatLine f = (FormatLine)lstFormats.Items[lstFormats.SelectedIndex]; bytes_used -= f.getSize(); UpdateControls(); lstFormats.Items.RemoveAt(lstFormats.SelectedIndex); } }
private void btnAdd_Click(object sender, EventArgs e) { FormatLine f = new FormatLine(); f.count = cmbCount.Text; f.type = cmbType.Text; f.group = cmbGroup.Text; f.display = cmbFormat.Text; lstFormats.Items.Add(f); }
private void btnAdd_Click(object sender, EventArgs e) { FormatLine f = new FormatLine(); f.display = cmbFormat.Text; if (cmbFormat.Text == "decimal") { if (cmbSigned.Text == "unsigned") { f.display = "unsigned"; } } f.count = cmbCount.Text; f.group = cmbGroup.Text; bytes_used += f.getSize(); UpdateControls(); lstFormats.Items.Add(f); }
private void Edit(int index) { MessageFormat m = null; if (index < 0) return; m = parentForm.GetMessageFormat(index); txtLength.Text = m.Length.ToString("X"); txtName.Text = m.Name; byte[] id = { m.IdHigh, m.IdLow }; try { txtID.Text = ushort.Parse(Format.AsUnsignedDecimal(id)).ToString("X"); } catch { } if (m.FormatString == "%" || m.FormatString == "") return; string[] tokens = m.FormatString.Split(' '); if (tokens.Length < 2) return; if (tokens[0] == "call") { cmbFormatType.SelectedIndex = 2; txtExternalFile.Text = tokens[1]; } else if (tokens[0] == "*") { cmbFormatType.SelectedIndex = 0; try { int.Parse(tokens[1]); cmbUniformGroup.Text = tokens[1]; } catch { } switch (tokens[2]) { case "b": cmbUniformFormat.Text = "binary"; break; case "h": cmbUniformFormat.Text = "hex"; break; case "d": cmbUniformFormat.Text = "decimal"; cmbUniformSigned.Text = "signed"; break; case "u": cmbUniformFormat.Text = "decimal"; cmbUniformSigned.Text = "unsigned"; break; } } else { cmbFormatType.SelectedIndex = 1; string formatline = ""; for (int i = 0; i < tokens.Length; i++) { formatline += tokens[i] + " "; if (i % 3 == 2) { formatline = formatline.Trim(); FormatLine f = new FormatLine(formatline); bytes_used += f.getSize(); lstFormats.Items.Add(f); formatline = ""; } } } UpdateControls(); }
private void btnAdd_Click(object sender, EventArgs e) { FormatLine f = new FormatLine(); f.display = cmbFormat.Text; if (cmbFormat.Text == "decimal") if (cmbSigned.Text == "unsigned") f.display = "unsigned"; f.count = cmbCount.Text; f.group = cmbGroup.Text; bytes_used += f.getSize(); UpdateControls(); lstFormats.Items.Add(f); }
private void Edit(int index) { MessageFormat m = null; if (index < 0) { return; } m = parentForm.GetMessageFormat(index); txtLength.Text = m.Length.ToString("X"); txtName.Text = m.Name; byte[] id = { m.IdHigh, m.IdLow }; try { txtID.Text = ushort.Parse(Format.AsUnsignedDecimal(id)).ToString("X"); } catch { } if (m.FormatString == "%" || m.FormatString == "") { return; } string[] tokens = m.FormatString.Split(' '); if (tokens.Length < 2) { return; } if (tokens[0] == "call") { cmbFormatType.SelectedIndex = 2; txtExternalFile.Text = tokens[1]; } else if (tokens[0] == "*") { cmbFormatType.SelectedIndex = 0; try { int.Parse(tokens[1]); cmbUniformGroup.Text = tokens[1]; } catch { } switch (tokens[2]) { case "b": cmbUniformFormat.Text = "binary"; break; case "h": cmbUniformFormat.Text = "hex"; break; case "d": cmbUniformFormat.Text = "decimal"; cmbUniformSigned.Text = "signed"; break; case "u": cmbUniformFormat.Text = "decimal"; cmbUniformSigned.Text = "unsigned"; break; } } else { cmbFormatType.SelectedIndex = 1; string formatline = ""; for (int i = 0; i < tokens.Length; i++) { formatline += tokens[i] + " "; if (i % 3 == 2) { formatline = formatline.Trim(); FormatLine f = new FormatLine(formatline); bytes_used += f.getSize(); lstFormats.Items.Add(f); formatline = ""; } } } UpdateControls(); }