-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDataForm.cs
51 lines (47 loc) · 1.71 KB
/
DataForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
namespace MapleShark
{
public partial class DataForm : DockContent
{
public DataForm()
{
InitializeComponent();
}
public MainForm MainForm { get { return ParentForm as MainForm; } }
public HexBox HexBox { get { return mHex; } }
private void mHex_SelectionLengthChanged(object pSender, EventArgs pArgs)
{
if (mHex.SelectionLength == 0) MainForm.PropertyForm.Properties.SelectedObject = null;
else
{
byte[] buffer = null;
StructureNode match = null;
foreach (TreeNode node in MainForm.StructureForm.Tree.Nodes)
{
StructureNode realNode = node as StructureNode;
buffer = realNode.Buffer;
if (mHex.SelectionStart == realNode.Cursor && mHex.SelectionLength == realNode.Length)
{
match = realNode;
break;
}
}
MainForm.StructureForm.Tree.SelectedNode = match;
if (buffer != null) MainForm.PropertyForm.Properties.SelectedObject = new StructureSegment(buffer, (int)mHex.SelectionStart, (int)mHex.SelectionLength);
else MainForm.PropertyForm.Properties.SelectedObject = null;
}
}
private void mHex_KeyDown(object pSender, KeyEventArgs pArgs)
{
MainForm.CopyPacketHex(pArgs);
}
}
}