This commit is contained in:
2018-02-25 02:53:18 +00:00
parent 952b61d1f8
commit 9dd6c1efa0
23 changed files with 390 additions and 1 deletions

42
exeinfogui/MainForm.xeto Normal file
View 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>

View 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();
}
}
}

View 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>