public HexEditor(string tagName, byte[] data, int bytesPerElem) { InitializeComponent(); EditView textView = new TextView(statusStrip1, bytesPerElem); textView.Initialize(); textView.SetRawData(data); textView.Modified += (s, e) => { _modified = true; }; _views.Add(textView.TabPage, textView); viewTabs.TabPages.Add(textView.TabPage); EditView hexView = null; if (!IsMono()) { hexView = new HexView(statusStrip1, bytesPerElem); hexView.Initialize(); hexView.SetRawData(data); hexView.Modified += (s, e) => { _modified = true; }; _views.Add(hexView.TabPage, hexView); viewTabs.TabPages.Add(hexView.TabPage); } if (bytesPerElem > 1 || IsMono()) { textView.Activate(); viewTabs.SelectedTab = textView.TabPage; } else { hexView.Activate(); viewTabs.SelectedTab = hexView.TabPage; } viewTabs.Deselected += (o, e) => { _previousPage = e.TabPage; }; viewTabs.Selecting += HandleTabChanged; this.Text = "Editing: " + tagName; _bytesPerElem = bytesPerElem; _data = new byte[data.Length]; Array.Copy(data, _data, data.Length); }
public HexEditor (string tagName, byte[] data, int bytesPerElem) { InitializeComponent(); EditView textView = new TextView(statusStrip1, bytesPerElem); textView.Initialize(); textView.SetRawData(data); textView.Modified += (s, e) => { _modified = true; }; _views.Add(textView.TabPage, textView); viewTabs.TabPages.Add(textView.TabPage); EditView hexView = null; if (!IsMono()) { hexView = new HexView(statusStrip1, bytesPerElem); hexView.Initialize(); hexView.SetRawData(data); hexView.Modified += (s, e) => { _modified = true; }; _views.Add(hexView.TabPage, hexView); viewTabs.TabPages.Add(hexView.TabPage); } if (bytesPerElem > 1 || IsMono()) { textView.Activate(); viewTabs.SelectedTab = textView.TabPage; } else { hexView.Activate(); viewTabs.SelectedTab = hexView.TabPage; } viewTabs.Deselected += (o, e) => { _previousPage = e.TabPage; }; viewTabs.Selecting += HandleTabChanged; this.Text = "Editing: " + tagName; _bytesPerElem = bytesPerElem; _data = new byte[data.Length]; Array.Copy(data, _data, data.Length); }