mirror of
https://github.com/claunia/libexeinfo.git
synced 2025-12-16 19:14:24 +00:00
Add decoding for BeOS version resource.
This commit is contained in:
61
exeinfogui/BeOS/PanelBeVersion.xeto
Normal file
61
exeinfogui/BeOS/PanelBeVersion.xeto
Normal file
@@ -0,0 +1,61 @@
|
||||
<?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" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Top">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayoutItem>
|
||||
<Label ID="lblMajorVersion">Major version</Label>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||
<TextBox ID="txtMajorVersion" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayoutItem>
|
||||
<Label ID="lblMiddleVersion">Middle version</Label>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||
<TextBox ID="txtMiddleVersion" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayoutItem>
|
||||
<Label ID="lblMinorVersion">Minor version</Label>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||
<TextBox ID="txtMinorVersion" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayoutItem>
|
||||
<Label ID="lblVariety">Variety</Label>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||
<TextBox ID="txtVariety" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayoutItem>
|
||||
<Label ID="lblInternal">Internal</Label>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||
<TextBox ID="txtInternal" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayoutItem>
|
||||
<Label ID="lblShortInfo">Short information</Label>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||
<TextBox ID="txtShortInfo" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayoutItem>
|
||||
<Label ID="lblLongInfo">Long information</Label>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
|
||||
<TextArea ID="txtLongInfo" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</StackLayout>
|
||||
</Panel>
|
||||
39
exeinfogui/BeOS/PanelBeVersion.xeto.cs
Normal file
39
exeinfogui/BeOS/PanelBeVersion.xeto.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Text;
|
||||
using Eto.Forms;
|
||||
using Eto.Serialization.Xaml;
|
||||
using libexeinfo;
|
||||
using libexeinfo.BeOS;
|
||||
|
||||
namespace exeinfogui.BeOS
|
||||
{
|
||||
public class PanelBeVersion : Panel
|
||||
{
|
||||
TextBox txtInternal;
|
||||
TextArea txtLongInfo;
|
||||
TextBox txtMajorVersion;
|
||||
TextBox txtMiddleVersion;
|
||||
TextBox txtMinorVersion;
|
||||
TextBox txtShortInfo;
|
||||
TextBox txtVariety;
|
||||
|
||||
public PanelBeVersion()
|
||||
{
|
||||
XamlReader.Load(this);
|
||||
}
|
||||
|
||||
public void Update(byte[] data, bool bigEndian)
|
||||
{
|
||||
VersionInfo versionInfo = bigEndian
|
||||
? BigEndianMarshal.ByteArrayToStructureBigEndian<VersionInfo>(data)
|
||||
: BigEndianMarshal.ByteArrayToStructureLittleEndian<VersionInfo>(data);
|
||||
|
||||
txtMajorVersion.Text = $"{versionInfo.major}";
|
||||
txtMiddleVersion.Text = $"{versionInfo.middle}";
|
||||
txtMinorVersion.Text = $"{versionInfo.minor}";
|
||||
txtVariety.Text = $"{versionInfo.variety}";
|
||||
txtInternal.Text = $"{versionInfo.interna1}";
|
||||
txtShortInfo.Text = StringHandlers.CToString(versionInfo.short_info, Encoding.UTF8);
|
||||
txtLongInfo.Text = StringHandlers.CToString(versionInfo.long_info, Encoding.UTF8);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,11 +36,13 @@ namespace exeinfogui.BeOS
|
||||
{
|
||||
public class TabBeResources : TabPage
|
||||
{
|
||||
PanelHexDump panelHexDump;
|
||||
PanelText panelText;
|
||||
Panel pnlResource;
|
||||
TreeGridView treeResources;
|
||||
PanelBeIcon panelBeIcon;
|
||||
bool bigEndian;
|
||||
PanelBeIcon panelBeIcon;
|
||||
PanelBeVersion panelBeVersion;
|
||||
PanelHexDump panelHexDump;
|
||||
PanelText panelText;
|
||||
Panel pnlResource;
|
||||
TreeGridView treeResources;
|
||||
|
||||
public TabBeResources()
|
||||
{
|
||||
@@ -53,12 +55,13 @@ namespace exeinfogui.BeOS
|
||||
treeResources.AllowMultipleSelection = false;
|
||||
treeResources.SelectionChanged += TreeResourcesOnSelectionChanged;
|
||||
|
||||
panelHexDump = new PanelHexDump();
|
||||
panelText = new PanelText();
|
||||
panelBeIcon = new PanelBeIcon();
|
||||
panelHexDump = new PanelHexDump();
|
||||
panelText = new PanelText();
|
||||
panelBeIcon = new PanelBeIcon();
|
||||
panelBeVersion = new PanelBeVersion();
|
||||
}
|
||||
|
||||
public void Update(IEnumerable<ResourceTypeBlock> resources)
|
||||
public void Update(IEnumerable<ResourceTypeBlock> resources, bool bigEndian)
|
||||
{
|
||||
TreeGridItemCollection treeData = new TreeGridItemCollection();
|
||||
|
||||
@@ -84,6 +87,7 @@ namespace exeinfogui.BeOS
|
||||
}
|
||||
|
||||
treeResources.DataStore = treeData;
|
||||
this.bigEndian = bigEndian;
|
||||
}
|
||||
|
||||
void TreeResourcesOnSelectionChanged(object sender, EventArgs eventArgs)
|
||||
@@ -108,6 +112,10 @@ namespace exeinfogui.BeOS
|
||||
pnlResource.Content = panelBeIcon;
|
||||
panelBeIcon.Update(data, type);
|
||||
break;
|
||||
case Consts.B_VERSION_INFO_TYPE:
|
||||
pnlResource.Content = panelBeVersion;
|
||||
panelBeVersion.Update(data, bigEndian);
|
||||
break;
|
||||
default:
|
||||
pnlResource.Content = panelHexDump;
|
||||
panelHexDump.Update(data);
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace exeinfogui
|
||||
|
||||
if(((libexeinfo.PE)peExe).BeosResources != null)
|
||||
{
|
||||
tabBeResources.Update(((libexeinfo.PE)peExe).BeosResources);
|
||||
tabBeResources.Update(((libexeinfo.PE)peExe).BeosResources, peExe.IsBigEndian);
|
||||
tabBeResources.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user