mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Migrate media tags decoding window from Eto.Forms to Avalonia.
This commit is contained in:
4
.idea/.idea.Aaru/.idea/contentModel.xml
generated
4
.idea/.idea.Aaru/.idea/contentModel.xml
generated
@@ -1245,6 +1245,7 @@
|
|||||||
<e p="IsrcModel.cs" t="Include" />
|
<e p="IsrcModel.cs" t="Include" />
|
||||||
<e p="LbaModel.cs" t="Include" />
|
<e p="LbaModel.cs" t="Include" />
|
||||||
<e p="MediaStatsModel.cs" t="Include" />
|
<e p="MediaStatsModel.cs" t="Include" />
|
||||||
|
<e p="MediaTagModel.cs" t="Include" />
|
||||||
<e p="NameCountModel.cs" t="Include" />
|
<e p="NameCountModel.cs" t="Include" />
|
||||||
<e p="PartitionModel.cs" t="Include" />
|
<e p="PartitionModel.cs" t="Include" />
|
||||||
<e p="PartitionSchemeModel.cs" t="Include" />
|
<e p="PartitionSchemeModel.cs" t="Include" />
|
||||||
@@ -1296,6 +1297,7 @@
|
|||||||
<e p="BlurayInfoViewModel.cs" t="Include" />
|
<e p="BlurayInfoViewModel.cs" t="Include" />
|
||||||
<e p="CompactDiscInfoViewModel.cs" t="Include" />
|
<e p="CompactDiscInfoViewModel.cs" t="Include" />
|
||||||
<e p="ConsoleWindowViewModel.cs" t="Include" />
|
<e p="ConsoleWindowViewModel.cs" t="Include" />
|
||||||
|
<e p="DecodeMediaTagsViewModel.cs" t="Include" />
|
||||||
<e p="DvdInfoViewModel.cs" t="Include" />
|
<e p="DvdInfoViewModel.cs" t="Include" />
|
||||||
<e p="DvdWritableInfoViewModel.cs" t="Include" />
|
<e p="DvdWritableInfoViewModel.cs" t="Include" />
|
||||||
<e p="EncodingsDialogViewModel.cs" t="Include" />
|
<e p="EncodingsDialogViewModel.cs" t="Include" />
|
||||||
@@ -1322,6 +1324,8 @@
|
|||||||
<e p="AboutDialog.xaml.cs" t="Include" />
|
<e p="AboutDialog.xaml.cs" t="Include" />
|
||||||
<e p="ConsoleDialog.xaml" t="Include" />
|
<e p="ConsoleDialog.xaml" t="Include" />
|
||||||
<e p="ConsoleDialog.xaml.cs" t="Include" />
|
<e p="ConsoleDialog.xaml.cs" t="Include" />
|
||||||
|
<e p="DecodeMediaTagsWindow.xaml" t="Include" />
|
||||||
|
<e p="DecodeMediaTagsWindow.xaml.cs" t="Include" />
|
||||||
<e p="EncodingsDialog.xaml" t="Include" />
|
<e p="EncodingsDialog.xaml" t="Include" />
|
||||||
<e p="EncodingsDialog.xaml.cs" t="Include" />
|
<e p="EncodingsDialog.xaml.cs" t="Include" />
|
||||||
<e p="ImageChecksumWindow.xaml" t="Include" />
|
<e p="ImageChecksumWindow.xaml" t="Include" />
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?><!--
|
|
||||||
// /***************************************************************************
|
|
||||||
// The Disc Image Chef
|
|
||||||
// ============================================================================
|
|
||||||
//
|
|
||||||
// Filename : frmDecodeMediaTags.xeto
|
|
||||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
||||||
//
|
|
||||||
// Component : Form to decode media tags of images.
|
|
||||||
//
|
|
||||||
// ==[ Description ] ==========================================================
|
|
||||||
//
|
|
||||||
// Defines the structure for the decode media tags GUI window.
|
|
||||||
//
|
|
||||||
// ==[ 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
|
|
||||||
// ****************************************************************************/
|
|
||||||
-->
|
|
||||||
<Form xmlns="http://schema.picoe.ca/eto.forms" Title="Decode media tags" ClientSize="600, 450" Padding="10">
|
|
||||||
<StackLayout Orientation="Vertical" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
|
|
||||||
<StackLayout Orientation="Horizontal" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
|
|
||||||
<Label Text="Tag:" ID="lblTag"/>
|
|
||||||
<ComboBox ID="cmbTag" ReadOnly="True" SelectedIndexChanged="OnCmbTagSelectedIndexChanged"/>
|
|
||||||
</StackLayout>
|
|
||||||
<StackLayoutItem Expand="True">
|
|
||||||
<TabControl>
|
|
||||||
<TabPage Text="HexView" ID="tabPrintHex">
|
|
||||||
<TextArea ID="txtPrintHex"/>
|
|
||||||
</TabPage>
|
|
||||||
<TabPage Text="Decoded" ID="tabDecoded">
|
|
||||||
<TextArea ID="txtDecoded"/>
|
|
||||||
</TabPage>
|
|
||||||
</TabControl>
|
|
||||||
</StackLayoutItem>
|
|
||||||
</StackLayout>
|
|
||||||
</Form>
|
|
||||||
@@ -1,241 +0,0 @@
|
|||||||
// /***************************************************************************
|
|
||||||
// Aaru Data Preservation Suite
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Filename : frmDecodeMediaTags.xeto.cs
|
|
||||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
||||||
//
|
|
||||||
// Component : Form to decode media tags of images.
|
|
||||||
//
|
|
||||||
// --[ Description ] ----------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Implements media tag decode form.
|
|
||||||
//
|
|
||||||
// --[ 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.Collections.ObjectModel;
|
|
||||||
using System.Text;
|
|
||||||
using Aaru.CommonTypes.Enums;
|
|
||||||
using Aaru.CommonTypes.Interfaces;
|
|
||||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
|
||||||
using Aaru.Decoders.ATA;
|
|
||||||
using Aaru.Decoders.Bluray;
|
|
||||||
using Aaru.Decoders.CD;
|
|
||||||
using Aaru.Decoders.DVD;
|
|
||||||
using Aaru.Decoders.SCSI;
|
|
||||||
using Aaru.Decoders.SCSI.MMC;
|
|
||||||
using Aaru.Decoders.Xbox;
|
|
||||||
using Eto.Forms;
|
|
||||||
using Eto.Serialization.Xaml;
|
|
||||||
using BCA = Aaru.Decoders.Bluray.BCA;
|
|
||||||
using Cartridge = Aaru.Decoders.Bluray.Cartridge;
|
|
||||||
using DDS = Aaru.Decoders.DVD.DDS;
|
|
||||||
using DMI = Aaru.Decoders.Xbox.DMI;
|
|
||||||
using Inquiry = Aaru.Decoders.SCSI.Inquiry;
|
|
||||||
using Spare = Aaru.Decoders.DVD.Spare;
|
|
||||||
|
|
||||||
namespace Aaru.Gui.Forms
|
|
||||||
{
|
|
||||||
// TODO: Decode long sector components
|
|
||||||
// TODO: Panel with string representation of contents
|
|
||||||
public class frmDecodeMediaTags : Form
|
|
||||||
{
|
|
||||||
const int HEX_COLUMNS = 32;
|
|
||||||
readonly IMediaImage inputFormat;
|
|
||||||
readonly ObservableCollection<MediaTagWithData> lstTags;
|
|
||||||
|
|
||||||
public frmDecodeMediaTags(IMediaImage inputFormat)
|
|
||||||
{
|
|
||||||
this.inputFormat = inputFormat;
|
|
||||||
XamlReader.Load(this);
|
|
||||||
|
|
||||||
lstTags = new ObservableCollection<MediaTagWithData>();
|
|
||||||
cmbTag.ItemTextBinding = Binding.Property((MediaTagWithData p) => p.Tag.ToString());
|
|
||||||
cmbTag.ItemKeyBinding = Binding.Property((MediaTagWithData p) => p.Tag.ToString());
|
|
||||||
cmbTag.DataStore = lstTags;
|
|
||||||
tabDecoded.Visible = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnLoad(EventArgs e)
|
|
||||||
{
|
|
||||||
base.OnLoad(e);
|
|
||||||
|
|
||||||
foreach(MediaTagType tag in inputFormat.Info.ReadableMediaTags)
|
|
||||||
try
|
|
||||||
{
|
|
||||||
byte[] data = inputFormat.ReadDiskTag(tag);
|
|
||||||
|
|
||||||
lstTags.Add(new MediaTagWithData
|
|
||||||
{
|
|
||||||
Tag = tag, Data = data
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
//ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: More graphically aware decoders
|
|
||||||
void OnCmbTagSelectedIndexChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if(!(cmbTag.SelectedValue is MediaTagWithData tagWithData))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// TODO: Decoders should be able to handle tags with/without length header
|
|
||||||
txtPrintHex.Text = PrintHex.ByteArrayToHexArrayString(tagWithData.Data, HEX_COLUMNS);
|
|
||||||
tabDecoded.Visible = true;
|
|
||||||
|
|
||||||
switch(tagWithData.Tag)
|
|
||||||
{
|
|
||||||
case MediaTagType.CD_TOC:
|
|
||||||
txtDecoded.Text = TOC.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.CD_SessionInfo:
|
|
||||||
txtDecoded.Text = Session.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.CD_FullTOC:
|
|
||||||
txtDecoded.Text = FullTOC.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.CD_PMA:
|
|
||||||
txtDecoded.Text = PMA.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.CD_ATIP:
|
|
||||||
txtDecoded.Text = ATIP.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.CD_TEXT:
|
|
||||||
txtDecoded.Text = CDTextOnLeadIn.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.CD_MCN:
|
|
||||||
txtDecoded.Text = Encoding.ASCII.GetString(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.DVD_PFI:
|
|
||||||
txtDecoded.Text = PFI.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.DVD_CMI:
|
|
||||||
txtDecoded.Text = CSS_CPRM.PrettifyLeadInCopyright(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.DVDRAM_DDS:
|
|
||||||
txtDecoded.Text = DDS.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.DVDRAM_SpareArea:
|
|
||||||
txtDecoded.Text = Spare.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.DVDR_PFI:
|
|
||||||
txtDecoded.Text = PFI.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.HDDVD_MediumStatus:
|
|
||||||
txtDecoded.Text = PFI.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.BD_DI:
|
|
||||||
txtDecoded.Text = DI.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.BD_BCA:
|
|
||||||
txtDecoded.Text = BCA.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.BD_DDS:
|
|
||||||
txtDecoded.Text = Decoders.Bluray.DDS.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.BD_CartridgeStatus:
|
|
||||||
txtDecoded.Text = Cartridge.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.BD_SpareArea:
|
|
||||||
txtDecoded.Text = Decoders.Bluray.Spare.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.MMC_WriteProtection:
|
|
||||||
txtDecoded.Text = WriteProtect.PrettifyWriteProtectionStatus(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.MMC_DiscInformation:
|
|
||||||
txtDecoded.Text = DiscInformation.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.SCSI_INQUIRY:
|
|
||||||
txtDecoded.Text = Inquiry.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.SCSI_MODEPAGE_2A:
|
|
||||||
txtDecoded.Text = Modes.PrettifyModePage_2A(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.ATA_IDENTIFY:
|
|
||||||
case MediaTagType.ATAPI_IDENTIFY:
|
|
||||||
txtDecoded.Text = Identify.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.Xbox_SecuritySector:
|
|
||||||
txtDecoded.Text = SS.Prettify(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.SCSI_MODESENSE_6:
|
|
||||||
txtDecoded.Text = Modes.PrettifyModeHeader6(tagWithData.Data, PeripheralDeviceTypes.DirectAccess);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.SCSI_MODESENSE_10:
|
|
||||||
txtDecoded.Text = Modes.PrettifyModeHeader10(tagWithData.Data, PeripheralDeviceTypes.DirectAccess);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MediaTagType.Xbox_DMI:
|
|
||||||
txtDecoded.Text = DMI.IsXbox360(tagWithData.Data) ? DMI.PrettifyXbox360(tagWithData.Data)
|
|
||||||
: DMI.PrettifyXbox(tagWithData.Data);
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tabDecoded.Visible = false;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class MediaTagWithData
|
|
||||||
{
|
|
||||||
public MediaTagType Tag { get; set; }
|
|
||||||
public byte[] Data { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#region XAML IDs
|
|
||||||
Label lblTag;
|
|
||||||
ComboBox cmbTag;
|
|
||||||
TabPage tabPrintHex;
|
|
||||||
TextArea txtPrintHex;
|
|
||||||
TabPage tabDecoded;
|
|
||||||
TextArea txtDecoded;
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
12
Aaru.Gui/Models/MediaTagModel.cs
Normal file
12
Aaru.Gui/Models/MediaTagModel.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Aaru.CommonTypes.Enums;
|
||||||
|
|
||||||
|
namespace Aaru.Gui.Models
|
||||||
|
{
|
||||||
|
public class MediaTagModel
|
||||||
|
{
|
||||||
|
public MediaTagType Tag { get; set; }
|
||||||
|
public byte[] Data { get; set; }
|
||||||
|
public string Decoded { get; set; }
|
||||||
|
public string Name => Tag.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
218
Aaru.Gui/ViewModels/DecodeMediaTagsViewModel.cs
Normal file
218
Aaru.Gui/ViewModels/DecodeMediaTagsViewModel.cs
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Text;
|
||||||
|
using Aaru.CommonTypes.Enums;
|
||||||
|
using Aaru.CommonTypes.Interfaces;
|
||||||
|
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||||
|
using Aaru.Decoders.ATA;
|
||||||
|
using Aaru.Decoders.Bluray;
|
||||||
|
using Aaru.Decoders.CD;
|
||||||
|
using Aaru.Decoders.DVD;
|
||||||
|
using Aaru.Decoders.SCSI;
|
||||||
|
using Aaru.Decoders.SCSI.MMC;
|
||||||
|
using Aaru.Decoders.Xbox;
|
||||||
|
using Aaru.Gui.Models;
|
||||||
|
using ReactiveUI;
|
||||||
|
using BCA = Aaru.Decoders.Bluray.BCA;
|
||||||
|
using Cartridge = Aaru.Decoders.DVD.Cartridge;
|
||||||
|
using DDS = Aaru.Decoders.DVD.DDS;
|
||||||
|
using DMI = Aaru.Decoders.Xbox.DMI;
|
||||||
|
using Inquiry = Aaru.Decoders.SCSI.Inquiry;
|
||||||
|
using Spare = Aaru.Decoders.DVD.Spare;
|
||||||
|
|
||||||
|
namespace Aaru.Gui.ViewModels
|
||||||
|
{
|
||||||
|
public class DecodeMediaTagsViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
const int HEX_COLUMNS = 32;
|
||||||
|
string _decodedText;
|
||||||
|
bool _decodedVisible;
|
||||||
|
string _hexViewText;
|
||||||
|
|
||||||
|
MediaTagModel _selectedTag;
|
||||||
|
|
||||||
|
public DecodeMediaTagsViewModel(IMediaImage inputFormat)
|
||||||
|
{
|
||||||
|
TagsList = new ObservableCollection<MediaTagModel>();
|
||||||
|
|
||||||
|
foreach(MediaTagType tag in inputFormat.Info.ReadableMediaTags)
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] data = inputFormat.ReadDiskTag(tag);
|
||||||
|
|
||||||
|
TagsList.Add(new MediaTagModel
|
||||||
|
{
|
||||||
|
Tag = tag, Data = data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
//ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Title { get; }
|
||||||
|
public ObservableCollection<MediaTagModel> TagsList { get; }
|
||||||
|
|
||||||
|
public MediaTagModel SelectedTag
|
||||||
|
{
|
||||||
|
get => _selectedTag;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
this.RaiseAndSetIfChanged(ref _selectedTag, value);
|
||||||
|
|
||||||
|
if(value is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// TODO: Decoders should be able to handle tags with/without length header
|
||||||
|
HexViewText = PrintHex.ByteArrayToHexArrayString(value.Data, HEX_COLUMNS);
|
||||||
|
DecodedVisible = true;
|
||||||
|
|
||||||
|
if(value.Decoded != null)
|
||||||
|
{
|
||||||
|
DecodedText = value.Decoded;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(value.Tag)
|
||||||
|
{
|
||||||
|
case MediaTagType.CD_TOC:
|
||||||
|
DecodedText = TOC.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.CD_SessionInfo:
|
||||||
|
DecodedText = Session.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.CD_FullTOC:
|
||||||
|
DecodedText = FullTOC.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.CD_PMA:
|
||||||
|
DecodedText = PMA.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.CD_ATIP:
|
||||||
|
DecodedText = ATIP.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.CD_TEXT:
|
||||||
|
DecodedText = CDTextOnLeadIn.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.CD_MCN:
|
||||||
|
DecodedText = Encoding.ASCII.GetString(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.DVD_PFI:
|
||||||
|
DecodedText = PFI.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.DVD_CMI:
|
||||||
|
DecodedText = CSS_CPRM.PrettifyLeadInCopyright(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.DVDRAM_DDS:
|
||||||
|
DecodedText = DDS.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.DVDRAM_SpareArea:
|
||||||
|
DecodedText = Spare.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.DVDR_PFI:
|
||||||
|
DecodedText = PFI.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.HDDVD_MediumStatus:
|
||||||
|
DecodedText = PFI.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.BD_DI:
|
||||||
|
DecodedText = DI.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.BD_BCA:
|
||||||
|
DecodedText = BCA.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.BD_DDS:
|
||||||
|
DecodedText = Decoders.Bluray.DDS.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.BD_CartridgeStatus:
|
||||||
|
DecodedText = Cartridge.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.BD_SpareArea:
|
||||||
|
DecodedText = Decoders.Bluray.Spare.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.MMC_WriteProtection:
|
||||||
|
DecodedText = WriteProtect.PrettifyWriteProtectionStatus(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.MMC_DiscInformation:
|
||||||
|
DecodedText = DiscInformation.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.SCSI_INQUIRY:
|
||||||
|
DecodedText = Inquiry.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.SCSI_MODEPAGE_2A:
|
||||||
|
DecodedText = Modes.PrettifyModePage_2A(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.ATA_IDENTIFY:
|
||||||
|
case MediaTagType.ATAPI_IDENTIFY:
|
||||||
|
DecodedText = Identify.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.Xbox_SecuritySector:
|
||||||
|
DecodedText = SS.Prettify(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.SCSI_MODESENSE_6:
|
||||||
|
DecodedText = Modes.PrettifyModeHeader6(value.Data, PeripheralDeviceTypes.DirectAccess);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.SCSI_MODESENSE_10:
|
||||||
|
DecodedText = Modes.PrettifyModeHeader10(value.Data, PeripheralDeviceTypes.DirectAccess);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MediaTagType.Xbox_DMI:
|
||||||
|
DecodedText = DMI.IsXbox360(value.Data) ? DMI.PrettifyXbox360(value.Data)
|
||||||
|
: DMI.PrettifyXbox(value.Data);
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
DecodedVisible = false;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(DecodedText != null)
|
||||||
|
value.Decoded = DecodedText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string HexViewText
|
||||||
|
{
|
||||||
|
get => _hexViewText;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _hexViewText, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DecodedVisible
|
||||||
|
{
|
||||||
|
get => _decodedVisible;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _decodedVisible, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DecodedText
|
||||||
|
{
|
||||||
|
get => _decodedText;
|
||||||
|
set => this.RaiseAndSetIfChanged(ref _decodedText, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,15 +27,16 @@ namespace Aaru.Gui.ViewModels
|
|||||||
{
|
{
|
||||||
public class ImageInfoViewModel : ViewModelBase
|
public class ImageInfoViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
readonly IMediaImage _imageFormat;
|
readonly IMediaImage _imageFormat;
|
||||||
readonly string _imagePath;
|
readonly string _imagePath;
|
||||||
readonly Window _view;
|
readonly Window _view;
|
||||||
IFilter _filter;
|
DecodeMediaTagsWindow _decodeMediaTagsWindow;
|
||||||
ImageChecksumWindow _imageChecksumWindow;
|
IFilter _filter;
|
||||||
ImageConvertWindow _imageConvertWindow;
|
ImageChecksumWindow _imageChecksumWindow;
|
||||||
ImageEntropyWindow _imageEntropyWindow;
|
ImageConvertWindow _imageConvertWindow;
|
||||||
ImageVerifyWindow _imageVerifyWindow;
|
ImageEntropyWindow _imageEntropyWindow;
|
||||||
ViewSectorWindow _viewSectorWindow;
|
ImageVerifyWindow _imageVerifyWindow;
|
||||||
|
ViewSectorWindow _viewSectorWindow;
|
||||||
|
|
||||||
public ImageInfoViewModel(string imagePath, IFilter filter, IMediaImage imageFormat, Window view)
|
public ImageInfoViewModel(string imagePath, IFilter filter, IMediaImage imageFormat, Window view)
|
||||||
|
|
||||||
@@ -830,23 +831,22 @@ namespace Aaru.Gui.ViewModels
|
|||||||
|
|
||||||
protected void ExecuteDecodeMediaTagCommand()
|
protected void ExecuteDecodeMediaTagCommand()
|
||||||
{
|
{
|
||||||
/* TODO: frmDecodeMediaTags
|
if(_decodeMediaTagsWindow != null)
|
||||||
if(frmDecodeMediaTags != null)
|
|
||||||
{
|
{
|
||||||
frmDecodeMediaTags.Show();
|
_decodeMediaTagsWindow.Show();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
frmDecodeMediaTags = new frmDecodeMediaTags(imageFormat);
|
_decodeMediaTagsWindow = new DecodeMediaTagsWindow
|
||||||
|
|
||||||
frmDecodeMediaTags.Closed += (s, ea) =>
|
|
||||||
{
|
{
|
||||||
frmDecodeMediaTags = null;
|
DataContext = new DecodeMediaTagsViewModel(_imageFormat)
|
||||||
};
|
};
|
||||||
|
|
||||||
frmDecodeMediaTags.Show();
|
_decodeMediaTagsWindow.Closed += (sender, args) =>
|
||||||
*/
|
{
|
||||||
|
_decodeMediaTagsWindow = null;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
36
Aaru.Gui/Views/DecodeMediaTagsWindow.xaml
Normal file
36
Aaru.Gui/Views/DecodeMediaTagsWindow.xaml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="clr-namespace:Aaru.Gui.ViewModels;assembly=Aaru.Gui"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800"
|
||||||
|
d:DesignHeight="450" Width="480" Height="320" x:Class="Aaru.Gui.Views.DecodeMediaTagsWindow"
|
||||||
|
Icon="/Assets/aaru-logo.png" CanResize="False" Title="{Binding Title}">
|
||||||
|
<Design.DataContext>
|
||||||
|
<vm:DecodeMediaTagsViewModel />
|
||||||
|
</Design.DataContext>
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="Tag:" />
|
||||||
|
<ComboBox Items="{Binding TagsList}" SelectedItem="{Binding SelectedTag}">
|
||||||
|
<ComboBox.DataTemplates>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Name}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.DataTemplates>
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
<TabControl>
|
||||||
|
<TabItem>
|
||||||
|
<TabItem.Header>
|
||||||
|
<TextBlock Text="HexView" />
|
||||||
|
</TabItem.Header>
|
||||||
|
<TextBox IsReadOnly="True" Text="{Binding HexViewText}" />
|
||||||
|
</TabItem>
|
||||||
|
<TabItem IsVisible="{Binding DecodedVisible}">
|
||||||
|
<TabItem.Header>
|
||||||
|
<TextBlock Text="Decoded" />
|
||||||
|
</TabItem.Header>
|
||||||
|
<TextBox IsReadOnly="True" Text="{Binding DecodedText}" />
|
||||||
|
</TabItem>
|
||||||
|
</TabControl>
|
||||||
|
</StackPanel>
|
||||||
|
</Window>
|
||||||
19
Aaru.Gui/Views/DecodeMediaTagsWindow.xaml.cs
Normal file
19
Aaru.Gui/Views/DecodeMediaTagsWindow.xaml.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace Aaru.Gui.Views
|
||||||
|
{
|
||||||
|
public class DecodeMediaTagsWindow : Window
|
||||||
|
{
|
||||||
|
public DecodeMediaTagsWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
#if DEBUG
|
||||||
|
this.AttachDevTools();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitializeComponent() => AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user