Exemple #1
0
        private void espMItemExtract_Click(object sender, EventArgs e)
        {
            TreeView             tv   = GetCurrentTreeView();
            TreeNode             node = tv.SelectedNode;
            TreeNodeInstanceBind bind = node.Tag as TreeNodeInstanceBind;

            if (bind == null)
            {
                ShowEror("节点绑定Tag对象类型不为{0},操作不支持!", typeof(TreeNodeInstanceBind).FullName);
            }
            else
            {
                byte[] fileBytes = new byte[0];

                if (bind.NodeType.IsSubclassOf(typeof(ESPDataBase)))
                {
                    ESPDataBase instance = bind.NodeItem as ESPDataBase;
                    if (instance != null)
                    {
                        fileBytes = instance.GetNetworkBytes();
                    }
                }
                else if (bind.NodeType.Equals(typeof(byte[])))
                {
                    fileBytes = bind.NodeItem as byte[];
                }
                if (fileBytes.Length > 0)
                {
                    SaveBinDataToFileDialog(this, fileBytes);
                }
            }
        }
Exemple #2
0
        private void NodeTagSet_Load(object sender, EventArgs e)
        {
            if (BindInstance == null)
            {
                return;
            }

            tbxNodeType.Text    = BindInstance.NodeType.AssemblyQualifiedName;
            tbxNodeSubType.Text = BindInstance.SubType != null ? BindInstance.SubType.AssemblyQualifiedName : "";

            tbxStartIndex.Text  = BindInstance.StoreIndex.ToString();
            tbxStoreLength.Text = BindInstance.StoreLength.ToString();

            cbxIsESPData.Checked = BindInstance.IsESPData;
            if (BindInstance.NodeType.IsSubclassOf(typeof(ESPDataBase)))
            {
                ESPDataBase instance = BindInstance.NodeItem as ESPDataBase;
                if (instance != null)
                {
                    tbxNodeItem.Text = SpecUtil.ByteArrayToHexString(instance.GetNetworkBytes());
                }
            }
            else if (BindInstance.NodeType.Equals(typeof(byte[])))
            {
                byte[] targetBytes = BindInstance.NodeItem as byte[];
                if (targetBytes != null && targetBytes.Length > 0)
                {
                    tbxNodeItem.Text = SpecUtil.ByteArrayToHexString(targetBytes);
                }
            }
            else
            {
                tbxNodeItem.Text = BindInstance.NodeItem.ToString();
            }
        }