mirror of
https://github.com/claunia/libexeinfo.git
synced 2025-12-16 19:14:24 +00:00
Add GUI.
This commit is contained in:
42
exeinfogui/MainForm.xeto
Normal file
42
exeinfogui/MainForm.xeto
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Form xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ExeInfo GUI" ClientSize="400, 350" Padding="10">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label ID="lblFile">File:</Label>
|
||||
<StackLayoutItem Expand="True">
|
||||
<TextBox ID="txtFile" ReadOnly="True" />
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Right">
|
||||
<Button ID="btnLoad" Click="OnBtnLoadClick">Load</Button>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Label ID="lblType">Type:</Label>
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
|
||||
<TextBox ID="txtType" ReadOnly="True" />
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<Label ID="lblInformation">Type:</Label>
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||
<TextArea ID="txtInformation" ReadOnly="True" />
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
<Form.Menu>
|
||||
<MenuBar>
|
||||
<MenuBar.QuitItem>
|
||||
<ButtonMenuItem ID="mnuQuit" Text="Quit" Shortcut="CommonModifier+Q" Click="OnMnuQuitClick" />
|
||||
</MenuBar.QuitItem>
|
||||
<MenuBar.AboutItem>
|
||||
<ButtonMenuItem ID="mnuAbout" Text="About..." Click="OnMnuAboutClick" />
|
||||
</MenuBar.AboutItem>
|
||||
</MenuBar>
|
||||
</Form.Menu>
|
||||
</Form>
|
||||
87
exeinfogui/MainForm.xeto.cs
Normal file
87
exeinfogui/MainForm.xeto.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Eto.Forms;
|
||||
using Eto.Serialization.Xaml;
|
||||
using libexeinfo;
|
||||
|
||||
namespace exeinfogui
|
||||
{
|
||||
public class MainForm : Form
|
||||
{
|
||||
TextBox txtFile;
|
||||
TextBox txtType;
|
||||
TextArea txtInformation;
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
XamlReader.Load(this);
|
||||
}
|
||||
|
||||
protected void OnBtnLoadClick(object sender, EventArgs e)
|
||||
{
|
||||
txtFile.Text = "";
|
||||
txtType.Text = "";
|
||||
txtInformation.Text ="";
|
||||
|
||||
OpenFileDialog dlgOpen = new OpenFileDialog {Title = "Choose executable file", MultiSelect = false};
|
||||
|
||||
if(dlgOpen.ShowDialog(this) != DialogResult.Ok) return;
|
||||
|
||||
txtFile.Text = dlgOpen.FileName;
|
||||
|
||||
FileStream exeFs = File.Open(dlgOpen.FileName, FileMode.Open, FileAccess.Read);
|
||||
|
||||
MZ mzExe = new MZ(exeFs);
|
||||
NE neExe = new NE(exeFs);
|
||||
AtariST stExe = new AtariST(exeFs);
|
||||
LX lxExe = new LX(exeFs);
|
||||
COFF coffExe = new COFF(exeFs);
|
||||
PE peExe = new PE(exeFs);
|
||||
|
||||
if(mzExe.IsMZ)
|
||||
{
|
||||
if(neExe.IsNE)
|
||||
{
|
||||
txtType.Text = "New Executable (NE)";
|
||||
txtInformation.Text = neExe.GetInfo();
|
||||
}
|
||||
else if(lxExe.IsLX)
|
||||
{
|
||||
txtType.Text = "Linear eXecutable (LX)";
|
||||
txtInformation.Text = lxExe.GetInfo();
|
||||
}
|
||||
else if(peExe.IsPE)
|
||||
{
|
||||
txtType.Text = "Portable Executable (PE)";
|
||||
txtInformation.Text = peExe.GetInfo();
|
||||
}
|
||||
else
|
||||
txtType.Text = "DOS Executable (MZ)";
|
||||
|
||||
txtInformation.Text += mzExe.GetInfo();
|
||||
}
|
||||
else if(stExe.IsAtariST)
|
||||
{
|
||||
txtType.Text = "Atari ST executable";
|
||||
txtInformation.Text = stExe.GetInfo();
|
||||
}
|
||||
else if(coffExe.IsCOFF)
|
||||
{
|
||||
txtType.Text = "Common Object File Format (COFF)";
|
||||
txtInformation.Text = coffExe.GetInfo();
|
||||
}
|
||||
else
|
||||
txtType.Text = "Format not recognized";
|
||||
}
|
||||
|
||||
protected void OnMnuAboutClick(object sender, EventArgs e)
|
||||
{
|
||||
new AboutDialog().ShowDialog(this);
|
||||
}
|
||||
|
||||
protected void OnMnuQuitClick(object sender, EventArgs e)
|
||||
{
|
||||
Application.Instance.Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
20
exeinfogui/exeinfogui.csproj
Normal file
20
exeinfogui/exeinfogui.csproj
Normal file
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net461</TargetFramework>
|
||||
<RootNamespace>exeinfogui</RootNamespace>
|
||||
<PackageVersion>1.0</PackageVersion>
|
||||
<Title>exeinfogui</Title>
|
||||
<Copyright>Copyright © 2018</Copyright>
|
||||
<Description>Description of exeinfogui</Description>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Eto.Forms" Version="2.4.1" />
|
||||
<PackageReference Include="Eto.Serialization.Xaml" Version="2.4.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\libexeinfo\libexeinfo.csproj">
|
||||
<Project>{5DD22357-AEA1-4B1D-9CAB-F51873A3A5D0}</Project>
|
||||
<Name>libexeinfo</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user