private void buttonX1_Click(object sender, EventArgs e) { try { if (superValidator1.Validate() && comboBoxEx2.SelectedItem != null) { ElementType el = (ElementType)((ComboItem)comboBoxEx2.SelectedItem).Tag; string name = textBoxX1.Text; string value = textBoxX2.Text; if (el == ElementType.SEQUENCE) { ASNEl = new ASNElement(el, name); } else { ASNEl = new ASNElement(el, name, value); } this.Close(); } } catch (Exception ex) { Log.ShowInfo(ex.Message, "ADD ASN.1"); } }
void AddNodes(Node n, ASNElement e) { foreach (ASNElement el in e.Childs) { Node nd = ASNode(el); n.Nodes.Add(nd); AddNodes(nd, el); } }
Node ASNode(ASNElement el) { Node c = new Node(); c.Text = el.Name; if (!string.IsNullOrEmpty(el.Value)) { c.Text += " : " + el.Value; } c.Tooltip = "Type : " + el.EType.ToString(); c.Style = GetNodeStyle(el.EType); c.Tag = el; return(c); }
private void buttonX4_Click(object sender, EventArgs e) { try { AddASNElFrm frm = new AddASNElFrm(); frm.ShowDialog(); if (frm.ASNEl != null) { Node nd = advTree1.SelectedNode; if (nd != null && nd != node1 && nd != node2) { if (nd.Tag != null) { if (nd.Tag is ASNElement) { ASNElement el = (ASNElement)nd.Tag; if (el.EType == ElementType.SEQUENCE) { if (el.AddElement(frm.ASNEl)) { Node c = ASNode(frm.ASNEl); nd.Nodes.Add(c); } } else { Log.ShowInfo("Only Sequence can contain child asn.1 elements", "ADD ASN.1"); } } } } else if (nd == node2) { Elements.Add(frm.ASNEl); Node c = ASNode(frm.ASNEl); nd.Nodes.Add(c); } } } catch (Exception ex) { Log.LogEx(ex); } }