mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Migrate image info from Eto.Forms to Avalonia.
This commit is contained in:
491
.idea/.idea.Aaru/.idea/contentModel.xml
generated
491
.idea/.idea.Aaru/.idea/contentModel.xml
generated
File diff suppressed because it is too large
Load Diff
@@ -349,6 +349,9 @@
|
||||
<Compile Update="Views\ConsoleDialog.xaml.cs">
|
||||
<DependentUpon>ConsoleDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Panels\ImageInfoPanel.xaml.cs">
|
||||
<DependentUpon>ImageInfoPanel.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<UpToDateCheckInput Remove="Views\MainWindow.xaml" />
|
||||
|
||||
@@ -191,102 +191,104 @@ namespace Aaru.Gui.Forms
|
||||
if(selectedItem.Values.Length < 4)
|
||||
return;
|
||||
|
||||
if(selectedItem.Values[3] is pnlImageInfo imageInfo)
|
||||
{
|
||||
var image = selectedItem.Values[5] as IMediaImage;
|
||||
/*
|
||||
if(selectedItem.Values[3] is pnlImageInfo imageInfo)
|
||||
{
|
||||
var image = selectedItem.Values[5] as IMediaImage;
|
||||
|
||||
// TODO: Global pool of forms
|
||||
treeImagesMenu.Items.Add(new SeparatorMenuItem());
|
||||
// TODO: Global pool of forms
|
||||
treeImagesMenu.Items.Add(new SeparatorMenuItem());
|
||||
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "Calculate entropy"
|
||||
};
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "Calculate entropy"
|
||||
};
|
||||
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
new frmImageEntropy(image).Show();
|
||||
};
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
new frmImageEntropy(image).Show();
|
||||
};
|
||||
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "Verify"
|
||||
};
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "Verify"
|
||||
};
|
||||
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
new frmImageVerify(image).Show();
|
||||
};
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
new frmImageVerify(image).Show();
|
||||
};
|
||||
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "Checksum"
|
||||
};
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "Checksum"
|
||||
};
|
||||
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
new frmImageChecksum(image).Show();
|
||||
};
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
new frmImageChecksum(image).Show();
|
||||
};
|
||||
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "Convert to..."
|
||||
};
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "Convert to..."
|
||||
};
|
||||
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
new frmImageConvert(image, selectedItem.Values[2] as string).Show();
|
||||
};
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
new frmImageConvert(image, selectedItem.Values[2] as string).Show();
|
||||
};
|
||||
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "Create CICM XML sidecar..."
|
||||
};
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "Create CICM XML sidecar..."
|
||||
};
|
||||
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
// TODO: Pass thru chosen default encoding
|
||||
new frmImageSidecar(image, selectedItem.Values[2] as string, ((IFilter)selectedItem.Values[4]).Id,
|
||||
null).Show();
|
||||
};
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
// TODO: Pass thru chosen default encoding
|
||||
new frmImageSidecar(image, selectedItem.Values[2] as string, ((IFilter)selectedItem.Values[4]).Id,
|
||||
null).Show();
|
||||
};
|
||||
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "View sectors"
|
||||
};
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "View sectors"
|
||||
};
|
||||
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
new frmPrintHex(image).Show();
|
||||
};
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
new frmPrintHex(image).Show();
|
||||
};
|
||||
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
|
||||
if(!image.Info.ReadableMediaTags.Any())
|
||||
return;
|
||||
if(!image.Info.ReadableMediaTags.Any())
|
||||
return;
|
||||
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "Decode media tags"
|
||||
};
|
||||
menuItem = new ButtonMenuItem
|
||||
{
|
||||
Text = "Decode media tags"
|
||||
};
|
||||
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
new frmDecodeMediaTags(image).Show();
|
||||
};
|
||||
menuItem.Click += (a, b) =>
|
||||
{
|
||||
new frmDecodeMediaTags(image).Show();
|
||||
};
|
||||
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
}
|
||||
treeImagesMenu.Items.Add(menuItem);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// TODO
|
||||
@@ -360,8 +362,7 @@ namespace Aaru.Gui.Forms
|
||||
{
|
||||
logo == null ? null : new Bitmap(logo),
|
||||
$"{Path.GetFileName(dlgOpenImage.FileName)} ({imageFormat.Info.MediaType})",
|
||||
dlgOpenImage.FileName, new pnlImageInfo(dlgOpenImage.FileName, inputFilter, imageFormat),
|
||||
inputFilter, imageFormat
|
||||
dlgOpenImage.FileName, null, inputFilter, imageFormat
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
19
Aaru.Gui/Models/DumpHardwareModel.cs
Normal file
19
Aaru.Gui/Models/DumpHardwareModel.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace Aaru.Gui.Models
|
||||
{
|
||||
public class DumpHardwareModel
|
||||
{
|
||||
public string Manufacturer { get; set; }
|
||||
|
||||
public string Model { get; set; }
|
||||
|
||||
public string Revision { get; set; }
|
||||
|
||||
public string Serial { get; set; }
|
||||
|
||||
public string SoftwareName { get; set; }
|
||||
public string SoftwareVersion { get; set; }
|
||||
public string OperatingSystem { get; set; }
|
||||
public ulong Start { get; set; }
|
||||
public ulong End { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Gui.ViewModels;
|
||||
using Avalonia.Media.Imaging;
|
||||
|
||||
namespace Aaru.Gui.Models
|
||||
@@ -13,5 +14,6 @@ namespace Aaru.Gui.Models
|
||||
public Bitmap Icon { get; set; }
|
||||
public ObservableCollection<RootModel> PartitionSchemesOrFileSystems { get; }
|
||||
public IMediaImage Image { get; set; }
|
||||
public ImageInfoViewModel ViewModel { get; set; }
|
||||
}
|
||||
}
|
||||
142
Aaru.Gui/Panels/ImageInfoPanel.xaml
Normal file
142
Aaru.Gui/Panels/ImageInfoPanel.xaml
Normal file
@@ -0,0 +1,142 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:Aaru.Gui.ViewModels" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Aaru.Gui.Panels.ImageInfoPanel">
|
||||
<Design.DataContext>
|
||||
<vm:ImageInfoViewModel />
|
||||
</Design.DataContext>
|
||||
<StackPanel>
|
||||
<Image Width="128" Height="128" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Source="{Binding MediaLogo}" />
|
||||
<TextBlock Text="Image information" FontWeight="Bold" />
|
||||
<TextBlock Text="{Binding ImagePathText}" /> <TextBlock Text="{Binding FilterText}" />
|
||||
<TextBlock Text="{Binding ImageIdentifiedText}" />
|
||||
<TabControl>
|
||||
<TabItem>
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="General" />
|
||||
</TabItem.Header>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding ImageFormatText}" IsVisible="{Binding !!ImageFormatText}" />
|
||||
<TextBlock Text="{Binding ApplicationText}" IsVisible="{Binding !!ApplicationText}" />
|
||||
<TextBlock Text="{Binding ImageSizeText}" IsVisible="{Binding !!ImageSizeText}" />
|
||||
<TextBlock Text="{Binding SectorsText}" IsVisible="{Binding !!SectorsText}" />
|
||||
<TextBlock Text="{Binding CreatorText}" IsVisible="{Binding !!CreatorText}" />
|
||||
<TextBlock Text="{Binding CreationTimeText}" IsVisible="{Binding !!CreationTimeText}" />
|
||||
<TextBlock Text="{Binding LastModificationTimeText}"
|
||||
IsVisible="{Binding !!LastModificationTimeText}" />
|
||||
<TextBlock Text="{Binding MediaTypeText}" IsVisible="{Binding !!MediaTypeText}" />
|
||||
<TextBlock Text="{Binding HasPartitionsText}" IsVisible="{Binding !!HasPartitionsText}" />
|
||||
<TextBlock Text="{Binding HasSessionsText}" IsVisible="{Binding !!HasSessionsText}" />
|
||||
<TextBlock Text="Comments:" IsVisible="{Binding !!CommentsText}" FontWeight="Bold" />
|
||||
<TextBox IsReadOnly="True" TextWrapping="Wrap" Text="{Binding CommentsText}"
|
||||
IsVisible="{Binding !!CommentsText}" />
|
||||
<TextBlock Text="Media information" FontWeight="Bold" IsVisible="{Binding MediaInformationVisible}" />
|
||||
<TextBlock Text="{Binding MediaSequenceText}" IsVisible="{Binding !!MediaSequenceText}" />
|
||||
<TextBlock Text="{Binding MediaTitleText}" IsVisible="{Binding !!MediaTitleText}" />
|
||||
<TextBlock Text="{Binding MediaManufacturerText}" IsVisible="{Binding !!MediaManufacturerText}" />
|
||||
<TextBlock Text="{Binding MediaModelText}" IsVisible="{Binding !!MediaModelText}" />
|
||||
<TextBlock Text="{Binding MediaSerialNumberText}" IsVisible="{Binding !!MediaSerialNumberText}" />
|
||||
<TextBlock Text="{Binding MediaBarcodeText}" IsVisible="{Binding !!MediaBarcodeText}" />
|
||||
<TextBlock Text="{Binding MediaPartNumberText}" IsVisible="{Binding !!MediaPartNumberText}" />
|
||||
<TextBlock Text="Drive information" FontWeight="Bold" IsVisible="{Binding DriveInformationVisible}" />
|
||||
<TextBlock Text="{Binding DriveManufacturerText}" IsVisible="{Binding !!DriveManufacturerText}" />
|
||||
<TextBlock Text="{Binding DriveModelText}" IsVisible="{Binding !!DriveModelText}" />
|
||||
<TextBlock Text="{Binding DriveSerialNumberText}" IsVisible="{Binding !!DriveSerialNumberText}" />
|
||||
<TextBlock Text="{Binding DriveFirmwareRevisionText}"
|
||||
IsVisible="{Binding !!DriveFirmwareRevisionText}" />
|
||||
<TextBlock Text="{Binding MediaGeometryText}" IsVisible="{Binding !!MediaGeometryText}" />
|
||||
<TextBlock Text="Readable media tags" FontWeight="Bold" IsVisible="{Binding !!MediaTagsList.Count}" />
|
||||
<DataGrid Items="{Binding MediaTagsList}" IsVisible="{Binding !!MediaTagsList.Count}"
|
||||
IsReadOnly="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Tag" Binding="{Binding .}" Width="Auto" IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<TextBlock Text="Readable sector tags" FontWeight="Bold"
|
||||
IsVisible="{Binding !!SectorTagsList.Count}" />
|
||||
<DataGrid Items="{Binding SectorTagsList}" IsVisible="{Binding !!SectorTagsList.Count}"
|
||||
IsReadOnly="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Tag" Binding="{Binding .}" Width="Auto" IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem IsVisible="{Binding !!Sessions.Count}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="Sessions" />
|
||||
</TabItem.Header>
|
||||
<DataGrid Items="{Binding Sessions}" IsVisible="{Binding !!Sessions.Count}" IsReadOnly="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Session" Binding="{Binding SessionSequence}" Width="Auto" />
|
||||
<DataGridTextColumn Header="First track" Binding="{Binding StartTrack}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Last track" Binding="{Binding EndTrack}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Start" Binding="{Binding StartSector}" Width="Auto" />
|
||||
<DataGridTextColumn Header="End" Binding="{Binding EndSector}" Width="Auto" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
<TabItem IsVisible="{Binding !!Tracks.Count}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="Tracks" />
|
||||
</TabItem.Header>
|
||||
<DataGrid Items="{Binding Tracks}" IsVisible="{Binding !!Tracks.Count}" IsReadOnly="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Track" Binding="{Binding TrackSequence}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Type" Binding="{Binding TrackType}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Bps" Binding="{Binding TrackBytesPerSector}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Raw bps" Binding="{Binding TrackRawBytesPerSector}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Subchannel" Binding="{Binding TrackSubchannelType}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Pregap" Binding="{Binding TrackPregap}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Start" Binding="{Binding TrackStartSector}" Width="Auto" />
|
||||
<DataGridTextColumn Header="End" Binding="{Binding TrackEndSector}" Width="Auto" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
<TabItem IsVisible="{Binding !!DumpHardwareList.Count}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="Dump hardware" />
|
||||
</TabItem.Header>
|
||||
<DataGrid Items="{Binding DumpHardwareList}" IsVisible="{Binding !!DumpHardwareList.Count}"
|
||||
IsReadOnly="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Manufacturer" Binding="{Binding Manufacturer}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Model" Binding="{Binding Model}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Revision" Binding="{Binding Revision}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Serial" Binding="{Binding Serial}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Software" Binding="{Binding SoftwareName}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Version" Binding="{Binding SoftwareVersion}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Operating system" Binding="{Binding OperatingSystem}" Width="Auto" />
|
||||
<DataGridTextColumn Header="Start" Binding="{Binding TrackStartSector}" Width="Auto" />
|
||||
<DataGridTextColumn Header="End" Binding="{Binding TrackEndSector}" Width="Auto" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||
<Button Command="{Binding EntropyCommand}">
|
||||
<TextBlock Text="Calculate entropy" />
|
||||
</Button>
|
||||
<Button Command="{Binding VerifyCommand}">
|
||||
<TextBlock Text="Verify" />
|
||||
</Button>
|
||||
<Button Command="{Binding ChecksumCommand}">
|
||||
<TextBlock Text="Checksum" />
|
||||
</Button>
|
||||
<Button Command="{Binding ConvertCommand}">
|
||||
<TextBlock Text="Convert to..." />
|
||||
</Button>
|
||||
<Button Command="{Binding CreateSidecarCommand}">
|
||||
<TextBlock Text="Create CICM XML sidecar..." />
|
||||
</Button>
|
||||
<Button Command="{Binding ViewSectorsCommand}">
|
||||
<TextBlock Text="View sectors" />
|
||||
</Button>
|
||||
<Button Command="{Binding DecodeMediaTagCommand}">
|
||||
<TextBlock Text="Decode media tags" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
12
Aaru.Gui/Panels/ImageInfoPanel.xaml.cs
Normal file
12
Aaru.Gui/Panels/ImageInfoPanel.xaml.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Aaru.Gui.Panels
|
||||
{
|
||||
public class ImageInfoPanel : UserControl
|
||||
{
|
||||
public ImageInfoPanel() => InitializeComponent();
|
||||
|
||||
void InitializeComponent() => AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!--
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ============================================================================
|
||||
//
|
||||
// Filename : pnlImageInfo.xeto
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Image information.
|
||||
//
|
||||
// ==[ Description ] ==========================================================
|
||||
//
|
||||
// Defines the structure for the image information.
|
||||
//
|
||||
// ==[ License ] ==============================================================
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ============================================================================
|
||||
// Copyright © 2011-2020 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
-->
|
||||
<Panel xmlns:local="clr-namespace:Aaru.Gui.Controls;assembly=Aaru.Gui"
|
||||
xmlns="http://schema.picoe.ca/eto.forms">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<ImageView ID="imgMediaLogo" Visible="False"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<local:SvgImageView ID="svgMediaLogo" Visible="False"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Center">
|
||||
<Label ID="lblImageInfo" Text="Image information"/>
|
||||
</StackLayoutItem>
|
||||
<Label ID="lblImagePath" Visible="False"/>
|
||||
<Label ID="lblFilter" Visible="False"/>
|
||||
<Label ID="lblImageFormat" Visible="False"/>
|
||||
<TabControl ID="tabInfos">
|
||||
<TabPage Text="General">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<Label ID="lblApplication" Visible="False"/>
|
||||
<Label ID="lblImageSize" Visible="False"/>
|
||||
<Label ID="lblSectors" Visible="False"/>
|
||||
<Label ID="lblCreator" Visible="False"/>
|
||||
<Label ID="lblCreationTime" Visible="False"/>
|
||||
<Label ID="lblLastModificationTime" Visible="False"/>
|
||||
<Label ID="lblMediaType" Visible="False"/>
|
||||
<Label ID="lblHasPartitions" Visible="False"/>
|
||||
<Label ID="lblHasSessions" Visible="False"/>
|
||||
<GroupBox Text="Comments:" Visible="False" ID="grpComments">
|
||||
<TextArea ID="txtComments" ReadOnly="True"/>
|
||||
</GroupBox>
|
||||
<GroupBox Text="Media information" Visible="False" ID="grpMediaInfo">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<Label ID="lblMediaSequence" Visible="False"/>
|
||||
<Label ID="lblMediaTitle" Visible="False"/>
|
||||
<Label ID="lblMediaManufacturer" Visible="False"/>
|
||||
<Label ID="lblMediaModel" Visible="False"/>
|
||||
<Label ID="lblMediaSerialNumber" Visible="False"/>
|
||||
<Label ID="lblMediaBarcode" Visible="False"/>
|
||||
<Label ID="lblMediaPartNumber" Visible="False"/>
|
||||
</StackLayout>
|
||||
</GroupBox>
|
||||
<GroupBox Text="Drive information" Visible="False" ID="grpDriveInfo">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<Label ID="lblDriveManufacturer" Visible="False"/>
|
||||
<Label ID="lblDriveModel" Visible="False"/>
|
||||
<Label ID="lblDriveSerialNumber" Visible="False"/>
|
||||
<Label ID="lblDriveFirmwareRevision" Visible="False"/>
|
||||
<Label ID="lblMediaGeometry" Visible="False"/>
|
||||
</StackLayout>
|
||||
</GroupBox>
|
||||
<GroupBox Text="Readable media tags" ID="grpMediaTags">
|
||||
<TreeGridView ID="treeMediaTags"/>
|
||||
</GroupBox>
|
||||
<GroupBox Text="Readable sector tags" ID="grpSectorTags">
|
||||
<TreeGridView ID="treeSectorTags"/>
|
||||
</GroupBox>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabSessions" Text="Sessions" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||
<TreeGridView ID="treeSessions"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabTracks" Text="Tracks" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||
<TreeGridView ID="treeTracks"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabDumpHardware" Text="Dump hardware" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||
<TreeGridView ID="treeDumpHardware"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
</TabControl>
|
||||
<StackLayoutItem HorizontalAlignment="Right" Expand="True">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Button ID="btnEntropy" Text="Calculate entropy" Click="OnBtnEntropy"/>
|
||||
<Button ID="btnVerify" Text="Verify" Click="OnBtnVerify"/>
|
||||
<Button ID="btnChecksum" Text="Checksum" Click="OnBtnChecksum"/>
|
||||
<Button ID="btnConvert" Text="Convert to..." Click="OnBtnConvert"/>
|
||||
<Button ID="btnCreateSidecar" Text="Create CICM XML sidecar..." Click="OnBtnCreateSidecar"/>
|
||||
<Button ID="btnViewSectors" Text="View sectors" Click="OnBtnViewSectors"/>
|
||||
<Button ID="btnDecodeMediaTags" Text="Decode media tags" Click="OnBtnDecodeMediaTags"/>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</Panel>
|
||||
@@ -1,294 +1,151 @@
|
||||
// /***************************************************************************
|
||||
// Aaru Data Preservation Suite
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : pnlImageInfo.xeto.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Image information.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Implements the image information panel.
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright © 2011-2020 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Reactive;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Decoders.DVD;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Decoders.Xbox;
|
||||
using Aaru.Gui.Controls;
|
||||
using Aaru.Gui.Forms;
|
||||
using Aaru.Gui.Tabs;
|
||||
using Eto.Drawing;
|
||||
using Eto.Forms;
|
||||
using Eto.Serialization.Xaml;
|
||||
using Aaru.Gui.Models;
|
||||
using Avalonia;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using ReactiveUI;
|
||||
using Schemas;
|
||||
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
|
||||
using Session = Aaru.CommonTypes.Structs.Session;
|
||||
|
||||
namespace Aaru.Gui.Panels
|
||||
namespace Aaru.Gui.ViewModels
|
||||
{
|
||||
public class pnlImageInfo : Panel
|
||||
public class ImageInfoViewModel
|
||||
{
|
||||
readonly IFilter filter;
|
||||
readonly IMediaImage imageFormat;
|
||||
readonly string imagePath;
|
||||
frmDecodeMediaTags frmDecodeMediaTags;
|
||||
frmImageChecksum frmImageChecksum;
|
||||
frmImageConvert frmImageConvert;
|
||||
frmImageEntropy frmImageEntropy;
|
||||
frmImageSidecar frmImageSidecar;
|
||||
frmImageVerify frmImageVerify;
|
||||
frmPrintHex frmPrintHex;
|
||||
readonly IMediaImage _imageFormat;
|
||||
IFilter _filter;
|
||||
string _imagePath;
|
||||
|
||||
public ImageInfoViewModel(string imagePath, IFilter filter, IMediaImage imageFormat)
|
||||
|
||||
public pnlImageInfo(string imagePath, IFilter filter, IMediaImage imageFormat)
|
||||
{
|
||||
this.imagePath = imagePath;
|
||||
this.filter = filter;
|
||||
this.imageFormat = imageFormat;
|
||||
XamlReader.Load(this);
|
||||
_imagePath = imagePath;
|
||||
_filter = filter;
|
||||
_imageFormat = imageFormat;
|
||||
IAssetLoader assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
|
||||
MediaTagsList = new ObservableCollection<string>();
|
||||
SectorTagsList = new ObservableCollection<string>();
|
||||
Sessions = new ObservableCollection<Session>();
|
||||
Tracks = new ObservableCollection<Track>();
|
||||
DumpHardwareList = new ObservableCollection<DumpHardwareModel>();
|
||||
EntropyCommand = ReactiveCommand.Create(ExecuteEntropyCommand);
|
||||
VerifyCommand = ReactiveCommand.Create(ExecuteVerifyCommand);
|
||||
ChecksumCommand = ReactiveCommand.Create(ExecuteChecksumCommand);
|
||||
ConvertCommand = ReactiveCommand.Create(ExecuteConvertCommand);
|
||||
CreateSidecarCommand = ReactiveCommand.Create(ExecuteCreateSidecarCommand);
|
||||
ViewSectorsCommand = ReactiveCommand.Create(ExecuteViewSectorsCommand);
|
||||
DecodeMediaTagCommand = ReactiveCommand.Create(ExecuteDecodeMediaTagCommand);
|
||||
|
||||
Stream logo =
|
||||
ResourceHandler.GetResourceStream($"Aaru.Gui.Assets.Logos.Media.{imageFormat.Info.MediaType}.svg");
|
||||
var genericHddIcon =
|
||||
new Bitmap(assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-harddisk.png")));
|
||||
|
||||
/* if(logo != null)
|
||||
{
|
||||
svgMediaLogo.SvgStream = logo;
|
||||
svgMediaLogo.Visible = true;
|
||||
}
|
||||
else
|
||||
{*/
|
||||
logo = ResourceHandler.GetResourceStream($"Aaru.Gui.Assets.Logos.Media.{imageFormat.Info.MediaType}.png");
|
||||
var genericOpticalIcon =
|
||||
new Bitmap(assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-optical.png")));
|
||||
|
||||
if(logo != null)
|
||||
{
|
||||
imgMediaLogo.Image = new Bitmap(logo);
|
||||
imgMediaLogo.Visible = true;
|
||||
}
|
||||
var genericFolderIcon =
|
||||
new Bitmap(assets.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/inode-directory.png")));
|
||||
|
||||
//}
|
||||
var mediaResource = new Uri($"avares://Aaru.Gui/Assets/Logos/Media/{imageFormat.Info.MediaType}.png");
|
||||
|
||||
lblImagePath.Text = $"Path: {imagePath}";
|
||||
lblFilter.Text = $"Filter: {filter.Name}";
|
||||
lblImageFormat.Text = $"Image format identified by {imageFormat.Name} ({imageFormat.Id}).";
|
||||
MediaLogo = assets.Exists(mediaResource)
|
||||
? new Bitmap(assets.Open(mediaResource))
|
||||
: imageFormat.Info.XmlMediaType == XmlMediaType.BlockMedia
|
||||
? genericHddIcon
|
||||
: imageFormat.Info.XmlMediaType == XmlMediaType.OpticalDisc
|
||||
? genericOpticalIcon
|
||||
: genericFolderIcon;
|
||||
|
||||
lblImageFormat.Text = !string.IsNullOrWhiteSpace(imageFormat.Info.Version)
|
||||
? $"Format: {imageFormat.Format} version {imageFormat.Info.Version}"
|
||||
: $"Format: {imageFormat.Format}";
|
||||
ImagePathText = $"Path: {imagePath}";
|
||||
FilterText = $"Filter: {filter.Name}";
|
||||
ImageIdentifiedText = $"Image format identified by {imageFormat.Name} ({imageFormat.Id}).";
|
||||
|
||||
lblImageSize.Text = $"Image without headers is {imageFormat.Info.ImageSize} bytes long";
|
||||
ImageFormatText = !string.IsNullOrWhiteSpace(imageFormat.Info.Version)
|
||||
? $"Format: {imageFormat.Format} version {imageFormat.Info.Version}"
|
||||
: $"Format: {imageFormat.Format}";
|
||||
|
||||
lblSectors.Text =
|
||||
ImageSizeText = $"Image without headers is {imageFormat.Info.ImageSize} bytes long";
|
||||
|
||||
SectorsText =
|
||||
$"Contains a media of {imageFormat.Info.Sectors} sectors with a maximum sector size of {imageFormat.Info.SectorSize} bytes (if all sectors are of the same size this would be {imageFormat.Info.Sectors * imageFormat.Info.SectorSize} bytes)";
|
||||
|
||||
lblMediaType.Text =
|
||||
MediaTypeText =
|
||||
$"Contains a media of type {imageFormat.Info.MediaType} and XML type {imageFormat.Info.XmlMediaType}";
|
||||
|
||||
lblHasPartitions.Text = $"{(imageFormat.Info.HasPartitions ? "Has" : "Doesn't have")} partitions";
|
||||
lblHasSessions.Text = $"{(imageFormat.Info.HasSessions ? "Has" : "Doesn't have")} sessions";
|
||||
HasPartitionsText = $"{(imageFormat.Info.HasPartitions ? "Has" : "Doesn't have")} partitions";
|
||||
HasSessionsText = $"{(imageFormat.Info.HasSessions ? "Has" : "Doesn't have")} sessions";
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Application))
|
||||
{
|
||||
lblApplication.Visible = true;
|
||||
|
||||
lblApplication.Text = !string.IsNullOrWhiteSpace(imageFormat.Info.ApplicationVersion)
|
||||
? $"Was created with {imageFormat.Info.Application} version {imageFormat.Info.ApplicationVersion}"
|
||||
: $"Was created with {imageFormat.Info.Application}";
|
||||
}
|
||||
ApplicationText = !string.IsNullOrWhiteSpace(imageFormat.Info.ApplicationVersion)
|
||||
? $"Was created with {imageFormat.Info.Application} version {imageFormat.Info.ApplicationVersion}"
|
||||
: $"Was created with {imageFormat.Info.Application}";
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Creator))
|
||||
{
|
||||
lblCreator.Visible = true;
|
||||
lblCreator.Text = $"Created by: {imageFormat.Info.Creator}";
|
||||
}
|
||||
CreatorText = $"Created by: {imageFormat.Info.Creator}";
|
||||
|
||||
if(imageFormat.Info.CreationTime != DateTime.MinValue)
|
||||
{
|
||||
lblCreationTime.Visible = true;
|
||||
lblCreationTime.Text = $"Created on {imageFormat.Info.CreationTime}";
|
||||
}
|
||||
CreationTimeText = $"Created on {imageFormat.Info.CreationTime}";
|
||||
|
||||
if(imageFormat.Info.LastModificationTime != DateTime.MinValue)
|
||||
{
|
||||
lblLastModificationTime.Visible = true;
|
||||
lblLastModificationTime.Text = $"Last modified on {imageFormat.Info.LastModificationTime}";
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Comments))
|
||||
{
|
||||
grpComments.Visible = true;
|
||||
txtComments.Text = imageFormat.Info.Comments;
|
||||
}
|
||||
LastModificationTimeText = $"Last modified on {imageFormat.Info.LastModificationTime}";
|
||||
|
||||
if(imageFormat.Info.MediaSequence != 0 &&
|
||||
imageFormat.Info.LastMediaSequence != 0)
|
||||
{
|
||||
lblMediaSequence.Visible = true;
|
||||
|
||||
lblMediaSequence.Text =
|
||||
MediaSequenceText =
|
||||
$"Media is number {imageFormat.Info.MediaSequence} on a set of {imageFormat.Info.LastMediaSequence} medias";
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaTitle))
|
||||
{
|
||||
lblMediaTitle.Visible = true;
|
||||
lblMediaTitle.Text = $"Media title: {imageFormat.Info.MediaTitle}";
|
||||
}
|
||||
MediaTitleText = $"Media title: {imageFormat.Info.MediaTitle}";
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaManufacturer))
|
||||
{
|
||||
lblMediaManufacturer.Visible = true;
|
||||
lblMediaManufacturer.Text = $"Media manufacturer: {imageFormat.Info.MediaManufacturer}";
|
||||
}
|
||||
MediaManufacturerText = $"Media manufacturer: {imageFormat.Info.MediaManufacturer}";
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaModel))
|
||||
{
|
||||
lblMediaModel.Visible = true;
|
||||
lblMediaModel.Text = $"Media model: {imageFormat.Info.MediaModel}";
|
||||
}
|
||||
MediaModelText = $"Media model: {imageFormat.Info.MediaModel}";
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaSerialNumber))
|
||||
{
|
||||
lblMediaSerialNumber.Visible = true;
|
||||
lblMediaSerialNumber.Text = $"Media serial number: {imageFormat.Info.MediaSerialNumber}";
|
||||
}
|
||||
MediaSerialNumberText = $"Media serial number: {imageFormat.Info.MediaSerialNumber}";
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaBarcode))
|
||||
{
|
||||
lblMediaBarcode.Visible = true;
|
||||
lblMediaBarcode.Text = $"Media barcode: {imageFormat.Info.MediaBarcode}";
|
||||
}
|
||||
MediaBarcodeText = $"Media barcode: {imageFormat.Info.MediaBarcode}";
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaPartNumber))
|
||||
{
|
||||
lblMediaPartNumber.Visible = true;
|
||||
lblMediaPartNumber.Text = $"Media part number: {imageFormat.Info.MediaPartNumber}";
|
||||
}
|
||||
MediaPartNumberText = $"Media part number: {imageFormat.Info.MediaPartNumber}";
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveManufacturer))
|
||||
{
|
||||
lblDriveManufacturer.Visible = true;
|
||||
lblDriveManufacturer.Text = $"Drive manufacturer: {imageFormat.Info.DriveManufacturer}";
|
||||
}
|
||||
DriveManufacturerText = $"Drive manufacturer: {imageFormat.Info.DriveManufacturer}";
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveModel))
|
||||
{
|
||||
lblDriveModel.Visible = true;
|
||||
lblDriveModel.Text = $"Drive model: {imageFormat.Info.DriveModel}";
|
||||
}
|
||||
DriveModelText = $"Drive model: {imageFormat.Info.DriveModel}";
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveSerialNumber))
|
||||
{
|
||||
lblDriveSerialNumber.Visible = true;
|
||||
lblDriveSerialNumber.Text = $"Drive serial number: {imageFormat.Info.DriveSerialNumber}";
|
||||
}
|
||||
DriveSerialNumberText = $"Drive serial number: {imageFormat.Info.DriveSerialNumber}";
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveFirmwareRevision))
|
||||
{
|
||||
lblDriveFirmwareRevision.Visible = true;
|
||||
lblDriveFirmwareRevision.Text = $"Drive firmware info: {imageFormat.Info.DriveFirmwareRevision}";
|
||||
}
|
||||
DriveFirmwareRevisionText = $"Drive firmware info: {imageFormat.Info.DriveFirmwareRevision}";
|
||||
|
||||
if(imageFormat.Info.Cylinders > 0 &&
|
||||
imageFormat.Info.Heads > 0 &&
|
||||
imageFormat.Info.SectorsPerTrack > 0 &&
|
||||
imageFormat.Info.XmlMediaType != XmlMediaType.OpticalDisc &&
|
||||
(!(imageFormat is ITapeImage tapeImage) || !tapeImage.IsTape))
|
||||
{
|
||||
lblMediaGeometry.Visible = true;
|
||||
|
||||
lblMediaGeometry.Text =
|
||||
MediaGeometryText =
|
||||
$"Media geometry: {imageFormat.Info.Cylinders} cylinders, {imageFormat.Info.Heads} heads, {imageFormat.Info.SectorsPerTrack} sectors per track";
|
||||
}
|
||||
|
||||
grpMediaInfo.Visible = lblMediaSequence.Visible || lblMediaTitle.Visible ||
|
||||
lblMediaManufacturer.Visible ||
|
||||
lblMediaModel.Visible || lblMediaSerialNumber.Visible ||
|
||||
lblMediaBarcode.Visible ||
|
||||
lblMediaPartNumber.Visible;
|
||||
|
||||
grpDriveInfo.Visible = lblDriveManufacturer.Visible || lblDriveModel.Visible ||
|
||||
lblDriveSerialNumber.Visible || lblDriveFirmwareRevision.Visible ||
|
||||
lblMediaGeometry.Visible;
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||
imageFormat.Info.ReadableMediaTags.Count > 0)
|
||||
{
|
||||
var mediaTagList = new TreeGridItemCollection();
|
||||
|
||||
treeMediaTags.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Tag", DataCell = new TextBoxCell(0)
|
||||
});
|
||||
|
||||
treeMediaTags.AllowMultipleSelection = false;
|
||||
treeMediaTags.ShowHeader = false;
|
||||
treeMediaTags.DataStore = mediaTagList;
|
||||
|
||||
foreach(MediaTagType tag in imageFormat.Info.ReadableMediaTags.OrderBy(t => t))
|
||||
mediaTagList.Add(new TreeGridItem
|
||||
{
|
||||
Values = new object[]
|
||||
{
|
||||
tag.ToString()
|
||||
}
|
||||
});
|
||||
|
||||
grpMediaTags.Visible = true;
|
||||
}
|
||||
MediaTagsList.Add(tag.ToString());
|
||||
|
||||
if(imageFormat.Info.ReadableSectorTags != null &&
|
||||
imageFormat.Info.ReadableSectorTags.Count > 0)
|
||||
{
|
||||
var sectorTagList = new TreeGridItemCollection();
|
||||
|
||||
treeSectorTags.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Tag", DataCell = new TextBoxCell(0)
|
||||
});
|
||||
|
||||
treeSectorTags.AllowMultipleSelection = false;
|
||||
treeSectorTags.ShowHeader = false;
|
||||
treeSectorTags.DataStore = sectorTagList;
|
||||
|
||||
foreach(SectorTagType tag in imageFormat.Info.ReadableSectorTags.OrderBy(t => t))
|
||||
sectorTagList.Add(new TreeGridItem
|
||||
{
|
||||
Values = new object[]
|
||||
{
|
||||
tag.ToString()
|
||||
}
|
||||
});
|
||||
|
||||
grpSectorTags.Visible = true;
|
||||
}
|
||||
SectorTagsList.Add(tag.ToString());
|
||||
|
||||
/* TODO: tabScsiInfo
|
||||
PeripheralDeviceTypes scsiDeviceType = PeripheralDeviceTypes.DirectAccess;
|
||||
byte[] scsiInquiryData = null;
|
||||
Inquiry? scsiInquiry = null;
|
||||
@@ -326,7 +183,9 @@ namespace Aaru.Gui.Panels
|
||||
scsiModeSense10, null);
|
||||
|
||||
tabInfos.Pages.Add(tabScsiInfo);
|
||||
*/
|
||||
|
||||
/* TODO: tabAtaInfo
|
||||
byte[] ataIdentify = null;
|
||||
byte[] atapiIdentify = null;
|
||||
|
||||
@@ -341,7 +200,8 @@ namespace Aaru.Gui.Panels
|
||||
var tabAtaInfo = new tabAtaInfo();
|
||||
tabAtaInfo.LoadData(ataIdentify, atapiIdentify, null);
|
||||
tabInfos.Pages.Add(tabAtaInfo);
|
||||
|
||||
*/
|
||||
/* TODO: tabCompactDiscInfo
|
||||
byte[] toc = null;
|
||||
TOC.CDTOC? decodedToc = null;
|
||||
byte[] fullToc = null;
|
||||
@@ -473,7 +333,8 @@ namespace Aaru.Gui.Panels
|
||||
decodedFullToc, decodedCdText, null, mediaCatalogueNumber, null);
|
||||
|
||||
tabInfos.Pages.Add(tabCompactDiscInfo);
|
||||
|
||||
*/
|
||||
/* TODO: tabDvdInfo
|
||||
byte[] dvdPfi = null;
|
||||
byte[] dvdDmi = null;
|
||||
byte[] dvdCmi = null;
|
||||
@@ -510,6 +371,8 @@ namespace Aaru.Gui.Panels
|
||||
null, decodedPfi);
|
||||
|
||||
tabInfos.Pages.Add(tabDvdInfo);
|
||||
*/
|
||||
/* TODO: tabDvdWritableinfo
|
||||
|
||||
byte[] dvdRamDds = null;
|
||||
byte[] dvdRamCartridgeStatus = null;
|
||||
@@ -591,6 +454,8 @@ namespace Aaru.Gui.Panels
|
||||
null, dvdPlusAdip, dvdPlusDcb);
|
||||
|
||||
tabInfos.Pages.Add(tabDvdWritableInfo);
|
||||
*/
|
||||
/* TODO: tabBlurayInfo
|
||||
|
||||
byte[] blurayBurstCuttingArea = null;
|
||||
byte[] blurayCartridgeStatus = null;
|
||||
@@ -634,6 +499,8 @@ namespace Aaru.Gui.Panels
|
||||
bluraySpareAreaInformation, blurayPowResources, blurayTrackResources, null, null);
|
||||
|
||||
tabInfos.Pages.Add(tabBlurayInfo);
|
||||
*/
|
||||
/* TODO: tabXboxInfo
|
||||
|
||||
byte[] xboxDmi = null;
|
||||
byte[] xboxSecuritySector = null;
|
||||
@@ -653,6 +520,8 @@ namespace Aaru.Gui.Panels
|
||||
var tabXboxInfo = new tabXboxInfo();
|
||||
tabXboxInfo.LoadData(null, xboxDmi, xboxSecuritySector, decodedXboxSecuritySector);
|
||||
tabInfos.Pages.Add(tabXboxInfo);
|
||||
*/
|
||||
/* TODO: tabPcmciaInfo
|
||||
|
||||
byte[] pcmciaCis = null;
|
||||
|
||||
@@ -663,6 +532,8 @@ namespace Aaru.Gui.Panels
|
||||
var tabPcmciaInfo = new tabPcmciaInfo();
|
||||
tabPcmciaInfo.LoadData(pcmciaCis);
|
||||
tabInfos.Pages.Add(tabPcmciaInfo);
|
||||
*/
|
||||
/* TODO: tabSdMmcInfo
|
||||
|
||||
DeviceType deviceType = DeviceType.Unknown;
|
||||
byte[] cid = null;
|
||||
@@ -730,57 +601,15 @@ namespace Aaru.Gui.Panels
|
||||
var tabSdMmcInfo = new tabSdMmcInfo();
|
||||
tabSdMmcInfo.LoadData(deviceType, cid, csd, ocr, extendedCsd, scr);
|
||||
tabInfos.Pages.Add(tabSdMmcInfo);
|
||||
|
||||
*/
|
||||
if(imageFormat is IOpticalMediaImage opticalMediaImage)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(opticalMediaImage.Sessions != null &&
|
||||
opticalMediaImage.Sessions.Count > 0)
|
||||
{
|
||||
var sessionList = new TreeGridItemCollection();
|
||||
|
||||
treeSessions.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Session", DataCell = new TextBoxCell(0)
|
||||
});
|
||||
|
||||
treeSessions.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "First track", DataCell = new TextBoxCell(1)
|
||||
});
|
||||
|
||||
treeSessions.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Last track", DataCell = new TextBoxCell(2)
|
||||
});
|
||||
|
||||
treeSessions.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Start", DataCell = new TextBoxCell(3)
|
||||
});
|
||||
|
||||
treeSessions.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "End", DataCell = new TextBoxCell(4)
|
||||
});
|
||||
|
||||
treeSessions.AllowMultipleSelection = false;
|
||||
treeSessions.ShowHeader = true;
|
||||
treeSessions.DataStore = sessionList;
|
||||
|
||||
foreach(Session session in opticalMediaImage.Sessions)
|
||||
sessionList.Add(new TreeGridItem
|
||||
{
|
||||
Values = new object[]
|
||||
{
|
||||
session.SessionSequence, session.StartTrack, session.EndTrack, session.StartSector,
|
||||
session.EndSector
|
||||
}
|
||||
});
|
||||
|
||||
tabSessions.Visible = true;
|
||||
}
|
||||
Sessions.Add(session);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -791,66 +620,8 @@ namespace Aaru.Gui.Panels
|
||||
{
|
||||
if(opticalMediaImage.Tracks != null &&
|
||||
opticalMediaImage.Tracks.Count > 0)
|
||||
{
|
||||
var tracksList = new TreeGridItemCollection();
|
||||
|
||||
treeTracks.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Track", DataCell = new TextBoxCell(0)
|
||||
});
|
||||
|
||||
treeTracks.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Type", DataCell = new TextBoxCell(1)
|
||||
});
|
||||
|
||||
treeTracks.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Bps", DataCell = new TextBoxCell(2)
|
||||
});
|
||||
|
||||
treeTracks.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Raw bps", DataCell = new TextBoxCell(3)
|
||||
});
|
||||
|
||||
treeTracks.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Subchannel", DataCell = new TextBoxCell(4)
|
||||
});
|
||||
|
||||
treeTracks.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Pregap", DataCell = new TextBoxCell(5)
|
||||
});
|
||||
|
||||
treeTracks.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Start", DataCell = new TextBoxCell(6)
|
||||
});
|
||||
|
||||
treeTracks.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "End", DataCell = new TextBoxCell(7)
|
||||
});
|
||||
|
||||
treeTracks.AllowMultipleSelection = false;
|
||||
treeTracks.ShowHeader = true;
|
||||
treeTracks.DataStore = tracksList;
|
||||
|
||||
foreach(Track track in opticalMediaImage.Tracks)
|
||||
tracksList.Add(new TreeGridItem
|
||||
{
|
||||
Values = new object[]
|
||||
{
|
||||
track.TrackSequence, track.TrackType, track.TrackBytesPerSector,
|
||||
track.TrackRawBytesPerSector, track.TrackSubchannelType, track.TrackPregap,
|
||||
track.TrackStartSector, track.TrackEndSector
|
||||
}
|
||||
});
|
||||
|
||||
tabTracks.Visible = true;
|
||||
}
|
||||
Tracks.Add(track);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -858,73 +629,71 @@ namespace Aaru.Gui.Panels
|
||||
}
|
||||
}
|
||||
|
||||
if(imageFormat.DumpHardware == null)
|
||||
if(imageFormat.DumpHardware is null)
|
||||
return;
|
||||
|
||||
var dumpHardwareList = new TreeGridItemCollection();
|
||||
|
||||
treeDumpHardware.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Manufacturer", DataCell = new TextBoxCell(0)
|
||||
});
|
||||
|
||||
treeDumpHardware.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Model", DataCell = new TextBoxCell(1)
|
||||
});
|
||||
|
||||
treeDumpHardware.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Serial", DataCell = new TextBoxCell(2)
|
||||
});
|
||||
|
||||
treeDumpHardware.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Software", DataCell = new TextBoxCell(3)
|
||||
});
|
||||
|
||||
treeDumpHardware.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Version", DataCell = new TextBoxCell(4)
|
||||
});
|
||||
|
||||
treeDumpHardware.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Operating system", DataCell = new TextBoxCell(5)
|
||||
});
|
||||
|
||||
treeDumpHardware.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Start", DataCell = new TextBoxCell(6)
|
||||
});
|
||||
|
||||
treeDumpHardware.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "End", DataCell = new TextBoxCell(7)
|
||||
});
|
||||
|
||||
treeDumpHardware.AllowMultipleSelection = false;
|
||||
treeDumpHardware.ShowHeader = true;
|
||||
treeDumpHardware.DataStore = dumpHardwareList;
|
||||
|
||||
foreach(DumpHardwareType dump in imageFormat.DumpHardware)
|
||||
{
|
||||
foreach(ExtentType extent in dump.Extents)
|
||||
dumpHardwareList.Add(new TreeGridItem
|
||||
DumpHardwareList.Add(new DumpHardwareModel
|
||||
{
|
||||
Values = new object[]
|
||||
{
|
||||
dump.Manufacturer, dump.Model, dump.Serial, dump.Software.Name, dump.Software.Version,
|
||||
dump.Software.OperatingSystem, extent.Start, extent.End
|
||||
}
|
||||
Manufacturer = dump.Manufacturer, Model = dump.Model, Serial = dump.Serial,
|
||||
SoftwareName = dump.Software.Name, SoftwareVersion = dump.Software.Version,
|
||||
OperatingSystem = dump.Software.OperatingSystem, Start = extent.Start, End = extent.End
|
||||
});
|
||||
}
|
||||
|
||||
tabDumpHardware.Visible = true;
|
||||
}
|
||||
|
||||
protected void OnBtnEntropy(object sender, EventArgs e)
|
||||
public Bitmap MediaLogo { get; }
|
||||
public string ImagePathText { get; }
|
||||
public string FilterText { get; }
|
||||
public string ImageIdentifiedText { get; }
|
||||
public string MediaTypeText { get; set; }
|
||||
public string SectorsText { get; set; }
|
||||
public string HasPartitionsText { get; set; }
|
||||
public string HasSessionsText { get; set; }
|
||||
public string ApplicationText { get; set; }
|
||||
public string CreatorText { get; set; }
|
||||
public string CreationTimeText { get; set; }
|
||||
public string LastModificationTimeText { get; set; }
|
||||
public string MediaSequenceText { get; set; }
|
||||
public string MediaTitleText { get; set; }
|
||||
public string MediaManufacturerText { get; set; }
|
||||
public string MediaModelText { get; set; }
|
||||
public string MediaSerialNumberText { get; set; }
|
||||
public string MediaBarcodeText { get; set; }
|
||||
public string MediaPartNumberText { get; set; }
|
||||
public string CommentsText => _imageFormat.Info.Comments;
|
||||
public string DriveManufacturerText { get; set; }
|
||||
public string DriveModelText { get; set; }
|
||||
public string DriveSerialNumberText { get; set; }
|
||||
public string DriveFirmwareRevisionText { get; set; }
|
||||
public string MediaGeometryText { get; set; }
|
||||
public ObservableCollection<string> MediaTagsList { get; }
|
||||
public ObservableCollection<string> SectorTagsList { get; }
|
||||
public string ImageSizeText { get; set; }
|
||||
public string ImageFormatText { get; set; }
|
||||
public ObservableCollection<Session> Sessions { get; }
|
||||
public ObservableCollection<Track> Tracks { get; }
|
||||
public ObservableCollection<DumpHardwareModel> DumpHardwareList { get; }
|
||||
public ReactiveCommand<Unit, Unit> EntropyCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> VerifyCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> ChecksumCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> ConvertCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> CreateSidecarCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> ViewSectorsCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> DecodeMediaTagCommand { get; }
|
||||
public bool DriveInformationVisible => DriveManufacturerText != null || DriveModelText != null ||
|
||||
DriveSerialNumberText != null || DriveFirmwareRevisionText != null ||
|
||||
MediaGeometryText != null;
|
||||
public bool MediaInformationVisible => MediaSequenceText != null || MediaTitleText != null ||
|
||||
MediaManufacturerText != null || MediaModelText != null ||
|
||||
MediaSerialNumberText != null || MediaBarcodeText != null ||
|
||||
MediaPartNumberText != null;
|
||||
|
||||
protected void ExecuteEntropyCommand()
|
||||
{
|
||||
/* TODO: frmImageEntropy
|
||||
if(frmImageEntropy != null)
|
||||
{
|
||||
frmImageEntropy.Show();
|
||||
@@ -940,10 +709,12 @@ namespace Aaru.Gui.Panels
|
||||
};
|
||||
|
||||
frmImageEntropy.Show();
|
||||
*/
|
||||
}
|
||||
|
||||
protected void OnBtnVerify(object sender, EventArgs e)
|
||||
protected void ExecuteVerifyCommand()
|
||||
{
|
||||
/* TODO: frmImageVerify
|
||||
if(frmImageVerify != null)
|
||||
{
|
||||
frmImageVerify.Show();
|
||||
@@ -959,10 +730,12 @@ namespace Aaru.Gui.Panels
|
||||
};
|
||||
|
||||
frmImageVerify.Show();
|
||||
*/
|
||||
}
|
||||
|
||||
protected void OnBtnChecksum(object sender, EventArgs e)
|
||||
protected void ExecuteChecksumCommand()
|
||||
{
|
||||
/* TODO: frmImageChecksum
|
||||
if(frmImageChecksum != null)
|
||||
{
|
||||
frmImageChecksum.Show();
|
||||
@@ -978,10 +751,12 @@ namespace Aaru.Gui.Panels
|
||||
};
|
||||
|
||||
frmImageChecksum.Show();
|
||||
*/
|
||||
}
|
||||
|
||||
protected void OnBtnConvert(object sender, EventArgs e)
|
||||
protected void ExecuteConvertCommand()
|
||||
{
|
||||
/* TODO: frmImageConvert
|
||||
if(frmImageConvert != null)
|
||||
{
|
||||
frmImageConvert.Show();
|
||||
@@ -997,10 +772,12 @@ namespace Aaru.Gui.Panels
|
||||
};
|
||||
|
||||
frmImageConvert.Show();
|
||||
*/
|
||||
}
|
||||
|
||||
protected void OnBtnCreateSidecar(object sender, EventArgs e)
|
||||
protected void ExecuteCreateSidecarCommand()
|
||||
{
|
||||
/* TODO: frmImageSidecar
|
||||
if(frmImageSidecar != null)
|
||||
{
|
||||
frmImageSidecar.Show();
|
||||
@@ -1017,10 +794,12 @@ namespace Aaru.Gui.Panels
|
||||
};
|
||||
|
||||
frmImageSidecar.Show();
|
||||
*/
|
||||
}
|
||||
|
||||
protected void OnBtnViewSectors(object sender, EventArgs e)
|
||||
protected void ExecuteViewSectorsCommand()
|
||||
{
|
||||
/* TODO: frmPrintHex
|
||||
if(frmPrintHex != null)
|
||||
{
|
||||
frmPrintHex.Show();
|
||||
@@ -1036,10 +815,12 @@ namespace Aaru.Gui.Panels
|
||||
};
|
||||
|
||||
frmPrintHex.Show();
|
||||
*/
|
||||
}
|
||||
|
||||
protected void OnBtnDecodeMediaTags(object sender, EventArgs e)
|
||||
protected void ExecuteDecodeMediaTagCommand()
|
||||
{
|
||||
/* TODO: frmDecodeMediaTags
|
||||
if(frmDecodeMediaTags != null)
|
||||
{
|
||||
frmDecodeMediaTags.Show();
|
||||
@@ -1055,61 +836,7 @@ namespace Aaru.Gui.Panels
|
||||
};
|
||||
|
||||
frmDecodeMediaTags.Show();
|
||||
*/
|
||||
}
|
||||
|
||||
#region XAML controls
|
||||
#pragma warning disable 169
|
||||
#pragma warning disable 649
|
||||
TabControl tabInfos;
|
||||
Label lblImagePath;
|
||||
Label lblFilter;
|
||||
Label lblImageFormat;
|
||||
Label lblApplication;
|
||||
Label lblImageSize;
|
||||
Label lblSectors;
|
||||
Label lblCreator;
|
||||
Label lblCreationTime;
|
||||
Label lblLastModificationTime;
|
||||
Label lblMediaType;
|
||||
Label lblHasPartitions;
|
||||
Label lblHasSessions;
|
||||
Label lblComments;
|
||||
TextArea txtComments;
|
||||
Label lblMediaSequence;
|
||||
Label lblMediaTitle;
|
||||
Label lblMediaManufacturer;
|
||||
Label lblMediaModel;
|
||||
Label lblMediaSerialNumber;
|
||||
Label lblMediaBarcode;
|
||||
Label lblMediaPartNumber;
|
||||
Label lblDriveManufacturer;
|
||||
Label lblDriveModel;
|
||||
Label lblDriveSerialNumber;
|
||||
Label lblDriveFirmwareRevision;
|
||||
Label lblMediaGeometry;
|
||||
GroupBox grpComments;
|
||||
GroupBox grpMediaInfo;
|
||||
GroupBox grpDriveInfo;
|
||||
GroupBox grpMediaTags;
|
||||
TreeGridView treeMediaTags;
|
||||
GroupBox grpSectorTags;
|
||||
TreeGridView treeSectorTags;
|
||||
TabPage tabSessions;
|
||||
TreeGridView treeSessions;
|
||||
TabPage tabTracks;
|
||||
TreeGridView treeTracks;
|
||||
TabPage tabDumpHardware;
|
||||
TreeGridView treeDumpHardware;
|
||||
ImageView imgMediaLogo;
|
||||
SvgImageView svgMediaLogo;
|
||||
Button btnEntropy;
|
||||
Button btnVerify;
|
||||
Button btnChecksum;
|
||||
Button btnConvert;
|
||||
Button btnViewSectors;
|
||||
Button btnDecodeMediaTags;
|
||||
#pragma warning restore 169
|
||||
#pragma warning restore 649
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ using Aaru.Console;
|
||||
using Aaru.Core;
|
||||
using Aaru.Database;
|
||||
using Aaru.Gui.Models;
|
||||
using Aaru.Gui.Panels;
|
||||
using Aaru.Gui.Views;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
@@ -37,7 +38,11 @@ namespace Aaru.Gui.ViewModels
|
||||
readonly ImagesRootModel _imagesRoot;
|
||||
readonly MainWindow _view;
|
||||
ConsoleWindow _consoleWindow;
|
||||
bool _devicesSupported;
|
||||
|
||||
public object _contentPanel;
|
||||
bool _devicesSupported;
|
||||
public object _treeViewSelectedItem;
|
||||
public int count = 0;
|
||||
|
||||
public MainWindowViewModel(MainWindow view)
|
||||
{
|
||||
@@ -52,6 +57,7 @@ namespace Aaru.Gui.ViewModels
|
||||
_view = view;
|
||||
TreeRoot = new ObservableCollection<RootModel>();
|
||||
_assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
|
||||
ContentPanel = Greeting;
|
||||
|
||||
_imagesRoot = new ImagesRootModel
|
||||
{
|
||||
@@ -110,6 +116,30 @@ namespace Aaru.Gui.ViewModels
|
||||
public ReactiveCommand<Unit, Unit> SettingsCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> OpenCommand { get; }
|
||||
|
||||
public object ContentPanel
|
||||
{
|
||||
get => _contentPanel;
|
||||
set => this.RaiseAndSetIfChanged(ref _contentPanel, value);
|
||||
}
|
||||
|
||||
public object TreeViewSelectedItem
|
||||
{
|
||||
get => _treeViewSelectedItem;
|
||||
set
|
||||
{
|
||||
if(value == _treeViewSelectedItem)
|
||||
return;
|
||||
|
||||
if(value is ImageModel imageModel)
|
||||
ContentPanel = new ImageInfoPanel
|
||||
{
|
||||
DataContext = imageModel.ViewModel
|
||||
};
|
||||
|
||||
this.RaiseAndSetIfChanged(ref _treeViewSelectedItem, value);
|
||||
}
|
||||
}
|
||||
|
||||
internal void ExecuteAboutCommand()
|
||||
{
|
||||
var dialog = new AboutDialog();
|
||||
@@ -237,7 +267,8 @@ namespace Aaru.Gui.ViewModels
|
||||
: imageFormat.Info.XmlMediaType == XmlMediaType.OpticalDisc
|
||||
? _genericOpticalIcon
|
||||
: _genericFolderIcon,
|
||||
FileName = Path.GetFileName(result[0]), Image = imageFormat
|
||||
FileName = Path.GetFileName(result[0]), Image = imageFormat,
|
||||
ViewModel = new ImageInfoViewModel(result[0], inputFilter, imageFormat)
|
||||
};
|
||||
|
||||
// TODO: pnlImageInfo
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" /><ColumnDefinition Width="5" /><ColumnDefinition Width="6*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TreeView Items="{Binding TreeRoot}">
|
||||
<TreeView Items="{Binding TreeRoot}" SelectedItem="{Binding TreeViewSelectedItem}">
|
||||
<TreeView.DataTemplates>
|
||||
<TreeDataTemplate DataType="models:DevicesRootModel" ItemsSource="{Binding Devices}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
@@ -77,8 +77,9 @@
|
||||
</TreeView.DataTemplates>
|
||||
</TreeView>
|
||||
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" />
|
||||
<TextBlock Grid.Column="2" Text="{Binding Greeting}" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
<ContentControl Grid.Column="2" Content="{Binding ContentPanel}" HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
Reference in New Issue
Block a user