Add gui panel to hex dump unknown ne resources by default.

This commit is contained in:
2018-03-03 19:12:36 +00:00
parent b78157bf4d
commit 2b4c73a78c
3 changed files with 44 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ namespace exeinfogui.NE
Panel pnlResource;
TreeGridItemCollection treeData;
TreeGridView treeResources;
PanelHexDump panelHexDump;
public TabNeResources()
{
@@ -56,6 +57,7 @@ namespace exeinfogui.NE
panelWin16Version = new PanelWin16Version();
panelNeStrings = new PanelNeStrings();
panelNeAccelerators = new PanelNeAccelerators();
panelHexDump=new PanelHexDump();
}
public void Update(IEnumerable<libexeinfo.NE.ResourceType> resourceTypes, libexeinfo.NE.TargetOS os)
@@ -116,7 +118,8 @@ namespace exeinfogui.NE
panelNeAccelerators.Update(data, libexeinfo.NE.TargetOS.OS2);
break;
default:
pnlResource.Content = null;
pnlResource.Content = panelHexDump;
panelHexDump.Update(data);
break;
}
}

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Panel xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Center">
<Label>Hex dump</Label>
</StackLayoutItem>
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextArea ID="txtHexDump" ReadOnly="True" Wrap="True"/>
</StackLayoutItem>
</StackLayout>
</Panel>

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Net.Sockets;
using Eto.Forms;
using Eto.Drawing;
using Eto.Serialization.Xaml;
namespace exeinfogui
{
public class PanelHexDump : Panel
{
TextArea txtHexDump;
public PanelHexDump()
{
XamlReader.Load(this);
}
public void Update(byte[] data)
{
txtHexDump.Text = "";
for(long pos = 0; pos < data.LongLength; pos++)
{
if(pos > 0 && pos % 4 == 0) txtHexDump.Text += " ";
txtHexDump.Text += $"{data[pos]:X2} ";
}
}
}
}