mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Migrate dvd info from Eto.Forms to Avalonia.
This commit is contained in:
5
.idea/.idea.Aaru/.idea/contentModel.xml
generated
5
.idea/.idea.Aaru/.idea/contentModel.xml
generated
@@ -1279,12 +1279,12 @@
|
|||||||
<e p="AtaInfoTab.xaml.cs" t="Include" />
|
<e p="AtaInfoTab.xaml.cs" t="Include" />
|
||||||
<e p="CompactDiscInfoTab.xaml" t="Include" />
|
<e p="CompactDiscInfoTab.xaml" t="Include" />
|
||||||
<e p="CompactDiscInfoTab.xaml.cs" t="Include" />
|
<e p="CompactDiscInfoTab.xaml.cs" t="Include" />
|
||||||
|
<e p="DvdInfoTab.xaml" t="Include" />
|
||||||
|
<e p="DvdInfoTab.xaml.cs" t="Include" />
|
||||||
<e p="ScsiInfoTab.xaml" t="Include" />
|
<e p="ScsiInfoTab.xaml" t="Include" />
|
||||||
<e p="ScsiInfoTab.xaml.cs" t="Include" />
|
<e p="ScsiInfoTab.xaml.cs" t="Include" />
|
||||||
<e p="tabBlurayInfo.xeto" t="Include" />
|
<e p="tabBlurayInfo.xeto" t="Include" />
|
||||||
<e p="tabBlurayInfo.xeto.cs" t="Include" />
|
<e p="tabBlurayInfo.xeto.cs" t="Include" />
|
||||||
<e p="tabDvdInfo.xeto" t="Include" />
|
|
||||||
<e p="tabDvdInfo.xeto.cs" t="Include" />
|
|
||||||
<e p="tabDvdWritableInfo.xeto" t="Include" />
|
<e p="tabDvdWritableInfo.xeto" t="Include" />
|
||||||
<e p="tabDvdWritableInfo.xeto.cs" t="Include" />
|
<e p="tabDvdWritableInfo.xeto.cs" t="Include" />
|
||||||
<e p="tabPcmciaInfo.xeto" t="Include" />
|
<e p="tabPcmciaInfo.xeto" t="Include" />
|
||||||
@@ -1300,6 +1300,7 @@
|
|||||||
<e p="AtaInfoViewModel.cs" t="Include" />
|
<e p="AtaInfoViewModel.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="DvdInfoViewModel.cs" t="Include" />
|
||||||
<e p="EncodingsDialogViewModel.cs" t="Include" />
|
<e p="EncodingsDialogViewModel.cs" t="Include" />
|
||||||
<e p="ImageInfoViewModel.cs" t="Include" />
|
<e p="ImageInfoViewModel.cs" t="Include" />
|
||||||
<e p="LicenseDialogViewModel.cs" t="Include" />
|
<e p="LicenseDialogViewModel.cs" t="Include" />
|
||||||
|
|||||||
@@ -132,6 +132,12 @@
|
|||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
<ContentControl Content="{Binding CompactDiscInfo}" />
|
<ContentControl Content="{Binding CompactDiscInfo}" />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
<TabItem IsVisible="{Binding !!DvdInfo}">
|
||||||
|
<TabItem.Header>
|
||||||
|
<TextBlock Text="DVD / HD DVD" />
|
||||||
|
</TabItem.Header>
|
||||||
|
<ContentControl Content="{Binding DvdInfo}" />
|
||||||
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||||
<Button Command="{Binding EntropyCommand}">
|
<Button Command="{Binding EntropyCommand}">
|
||||||
|
|||||||
@@ -120,26 +120,28 @@ namespace Aaru.Gui.Panels
|
|||||||
|
|
||||||
tabSsc.Visible = grpDensitySupport.Visible || grpMediumSupport.Visible || btnSaveDensitySupport.Visible ||
|
tabSsc.Visible = grpDensitySupport.Visible || grpMediumSupport.Visible || btnSaveDensitySupport.Visible ||
|
||||||
btnSaveMediumSupport.Visible;
|
btnSaveMediumSupport.Visible;
|
||||||
/*
|
|
||||||
var tabCompactDiscInfo = new tabCompactDiscInfo();
|
|
||||||
|
|
||||||
tabCompactDiscInfo.LoadData(scsiInfo.Toc, scsiInfo.Atip, scsiInfo.CompactDiscInformation, scsiInfo.Session,
|
/*
|
||||||
scsiInfo.RawToc, this.scsiInfo.Pma, this.scsiInfo.CdTextLeadIn,
|
var tabCompactDiscInfo = new tabCompactDiscInfo();
|
||||||
this.scsiInfo.DecodedToc, this.scsiInfo.DecodedAtip,
|
|
||||||
this.scsiInfo.DecodedSession, this.scsiInfo.FullToc,
|
|
||||||
this.scsiInfo.DecodedCdTextLeadIn, this.scsiInfo.DecodedCompactDiscInformation,
|
|
||||||
this.scsiInfo.Mcn, this.scsiInfo.Isrcs);
|
|
||||||
|
|
||||||
tabInfos.Pages.Add(tabCompactDiscInfo);
|
tabCompactDiscInfo.LoadData(scsiInfo.Toc, scsiInfo.Atip, scsiInfo.CompactDiscInformation, scsiInfo.Session,
|
||||||
*/
|
scsiInfo.RawToc, this.scsiInfo.Pma, this.scsiInfo.CdTextLeadIn,
|
||||||
var tabDvdInfo = new tabDvdInfo();
|
this.scsiInfo.DecodedToc, this.scsiInfo.DecodedAtip,
|
||||||
|
this.scsiInfo.DecodedSession, this.scsiInfo.FullToc,
|
||||||
|
this.scsiInfo.DecodedCdTextLeadIn, this.scsiInfo.DecodedCompactDiscInformation,
|
||||||
|
this.scsiInfo.Mcn, this.scsiInfo.Isrcs);
|
||||||
|
|
||||||
tabDvdInfo.LoadData(scsiInfo.MediaType, scsiInfo.DvdPfi, scsiInfo.DvdDmi, scsiInfo.DvdCmi,
|
tabInfos.Pages.Add(tabCompactDiscInfo);
|
||||||
scsiInfo.HddvdCopyrightInformation, scsiInfo.DvdBca, scsiInfo.DvdAacs,
|
*/
|
||||||
this.scsiInfo.DecodedPfi);
|
/*
|
||||||
|
var tabDvdInfo = new tabDvdInfo();
|
||||||
|
|
||||||
tabInfos.Pages.Add(tabDvdInfo);
|
tabDvdInfo.LoadData(scsiInfo.MediaType, scsiInfo.DvdPfi, scsiInfo.DvdDmi, scsiInfo.DvdCmi,
|
||||||
|
scsiInfo.HddvdCopyrightInformation, scsiInfo.DvdBca, scsiInfo.DvdAacs,
|
||||||
|
this.scsiInfo.DecodedPfi);
|
||||||
|
|
||||||
|
tabInfos.Pages.Add(tabDvdInfo);
|
||||||
|
*/
|
||||||
var tabXboxInfo = new tabXboxInfo();
|
var tabXboxInfo = new tabXboxInfo();
|
||||||
|
|
||||||
tabXboxInfo.LoadData(scsiInfo.XgdInfo, scsiInfo.DvdDmi, scsiInfo.XboxSecuritySector,
|
tabXboxInfo.LoadData(scsiInfo.XgdInfo, scsiInfo.DvdDmi, scsiInfo.XboxSecuritySector,
|
||||||
|
|||||||
33
Aaru.Gui/Tabs/DvdInfoTab.xaml
Normal file
33
Aaru.Gui/Tabs/DvdInfoTab.xaml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<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.Tabs.DvdInfoTab">
|
||||||
|
<Design.DataContext>
|
||||||
|
<vm:DvdInfoViewModel />
|
||||||
|
</Design.DataContext>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock IsVisible="{Binding !!DvdPfiText}" Text="Physical Format Information" />
|
||||||
|
<TextBox IsReadOnly="True" IsVisible="{Binding !!DvdPfiText}" Text="{Binding DvdPfiText}" />
|
||||||
|
<TextBlock IsVisible="{Binding !!DvdCmiText}" Text="Copyright Management Information" />
|
||||||
|
<TextBox IsReadOnly="True" IsVisible="{Binding !!DvdCmiText}" Text="{Binding DvdCmiText}" />
|
||||||
|
<Button Command="{Binding SaveDvdPfiCommand}" IsVisible="{Binding SaveDvdPfiVisible}">
|
||||||
|
<TextBlock Text="Save Physical Format Information" />
|
||||||
|
</Button>
|
||||||
|
<Button Command="{Binding SaveDvdDmiCommand}" IsVisible="{Binding SaveDvdDmiVisible}">
|
||||||
|
<TextBlock Text="Save Disc Manufacturer Information" />
|
||||||
|
</Button>
|
||||||
|
<Button Command="{Binding SaveDvdCmiCommand}" IsVisible="{Binding SaveDvdCmiVisible}">
|
||||||
|
<TextBlock Text="Save Copyright Management Information" />
|
||||||
|
</Button>
|
||||||
|
<Button Command="{Binding SaveHdDvdCmiCommand}" IsVisible="{Binding SaveHdDvdCmiVisible}">
|
||||||
|
<TextBlock Text="Save Copyright Management Information" />
|
||||||
|
</Button>
|
||||||
|
<Button Command="{Binding SaveDvdBcaCommand}" IsVisible="{Binding SaveDvdBcaVisible}">
|
||||||
|
<TextBlock Text="Save Burst Cutting Area" />
|
||||||
|
</Button>
|
||||||
|
<Button Command="{Binding SaveDvdAacsCommand}" IsVisible="{Binding SaveDvdAacsVisible}">
|
||||||
|
<TextBlock Text="Save AACS Information" />
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</UserControl>
|
||||||
12
Aaru.Gui/Tabs/DvdInfoTab.xaml.cs
Normal file
12
Aaru.Gui/Tabs/DvdInfoTab.xaml.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace Aaru.Gui.Tabs
|
||||||
|
{
|
||||||
|
public class DvdInfoTab : UserControl
|
||||||
|
{
|
||||||
|
public DvdInfoTab() => InitializeComponent();
|
||||||
|
|
||||||
|
void InitializeComponent() => AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?><!--
|
|
||||||
// /***************************************************************************
|
|
||||||
// The Disc Image Chef
|
|
||||||
// ============================================================================
|
|
||||||
//
|
|
||||||
// Filename : tabDvdInfo.xeto
|
|
||||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
||||||
//
|
|
||||||
// Component : Media information.
|
|
||||||
//
|
|
||||||
// ==[ Description ] ==========================================================
|
|
||||||
//
|
|
||||||
// Defines the structure for the DVD media 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
|
|
||||||
// ****************************************************************************/
|
|
||||||
-->
|
|
||||||
<TabPage xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Text="DVD"
|
|
||||||
Visible="False">
|
|
||||||
<StackLayout Orientation="Vertical">
|
|
||||||
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
|
||||||
<GroupBox ID="grpDvdPfi" Text="Physical Format Information" Visible="False">
|
|
||||||
<TextArea ID="txtDvdPfi" ReadOnly="True"/>
|
|
||||||
</GroupBox>
|
|
||||||
</StackLayoutItem>
|
|
||||||
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
|
||||||
<GroupBox ID="grpDvdCmi" Text="Copyright Management Information" Visible="False">
|
|
||||||
<TextArea ID="txtDvdCmi" ReadOnly="True"/>
|
|
||||||
</GroupBox>
|
|
||||||
</StackLayoutItem>
|
|
||||||
<Button Click="OnBtnSaveDvdPfiClick" ID="btnSaveDvdPfi" Text="Save Physical Format Information"
|
|
||||||
Visible="False"/>
|
|
||||||
<Button Click="OnBtnSaveDvdDmiClick" ID="btnSaveDvdDmi" Text="Save Disc Manufacturer Information"
|
|
||||||
Visible="False"/>
|
|
||||||
<Button Click="OnBtnSaveDvdCmiClick" ID="btnSaveDvdCmi" Text="Save Copyright Management Information"
|
|
||||||
Visible="False"/>
|
|
||||||
<Button Click="OnBtnSaveHdDvdCmiClick" ID="btnSaveHdDvdCmi" Text="Save Copyright Management Information"
|
|
||||||
Visible="False"/>
|
|
||||||
<Button Click="OnBtnSaveDvdBcaClick" ID="btnSaveDvdBca" Text="Save Burst Cutting Area" Visible="False"/>
|
|
||||||
<Button Click="OnBtnSaveDvdAacsClick" ID="btnSaveDvdAacs" Text="Save AACS Information" Visible="False"/>
|
|
||||||
</StackLayout>
|
|
||||||
</TabPage>
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
// /***************************************************************************
|
|
||||||
// Aaru Data Preservation Suite
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Filename : tabDvdInfo.xeto.cs
|
|
||||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
||||||
//
|
|
||||||
// Component : Media information.
|
|
||||||
//
|
|
||||||
// --[ Description ] ----------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Implements the DVD media 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
|
|
||||||
// ****************************************************************************/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using Aaru.CommonTypes;
|
|
||||||
using Aaru.Decoders.DVD;
|
|
||||||
using Eto.Forms;
|
|
||||||
using Eto.Serialization.Xaml;
|
|
||||||
|
|
||||||
namespace Aaru.Gui.Tabs
|
|
||||||
{
|
|
||||||
public class tabDvdInfo : TabPage
|
|
||||||
{
|
|
||||||
byte[] DvdAacs;
|
|
||||||
byte[] DvdBca;
|
|
||||||
byte[] DvdCmi;
|
|
||||||
byte[] DvdDmi;
|
|
||||||
byte[] DvdPfi;
|
|
||||||
byte[] HddvdCopyrightInformation;
|
|
||||||
|
|
||||||
public tabDvdInfo() => XamlReader.Load(this);
|
|
||||||
|
|
||||||
internal void LoadData(MediaType mediaType, byte[] pfi, byte[] dmi, byte[] cmi, byte[] hdCopyrightInformation,
|
|
||||||
byte[] bca, byte[] aacs, PFI.PhysicalFormatInformation? decodedPfi)
|
|
||||||
{
|
|
||||||
DvdPfi = pfi;
|
|
||||||
DvdDmi = dmi;
|
|
||||||
DvdCmi = cmi;
|
|
||||||
HddvdCopyrightInformation = hdCopyrightInformation;
|
|
||||||
DvdBca = bca;
|
|
||||||
DvdAacs = aacs;
|
|
||||||
|
|
||||||
switch(mediaType)
|
|
||||||
{
|
|
||||||
case MediaType.HDDVDROM:
|
|
||||||
case MediaType.HDDVDRAM:
|
|
||||||
case MediaType.HDDVDR:
|
|
||||||
case MediaType.HDDVDRW:
|
|
||||||
case MediaType.HDDVDRDL:
|
|
||||||
case MediaType.HDDVDRWDL:
|
|
||||||
Text = "HD DVD";
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Text = "DVD";
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(decodedPfi.HasValue)
|
|
||||||
{
|
|
||||||
grpDvdPfi.Visible = true;
|
|
||||||
txtDvdPfi.Text = PFI.Prettify(decodedPfi);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(cmi != null)
|
|
||||||
{
|
|
||||||
grpDvdCmi.Visible = true;
|
|
||||||
txtDvdCmi.Text = CSS_CPRM.PrettifyLeadInCopyright(cmi);
|
|
||||||
btnSaveDvdCmi.Visible = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
btnSaveDvdPfi.Visible = pfi != null;
|
|
||||||
btnSaveDvdDmi.Visible = dmi != null;
|
|
||||||
btnSaveDvdCmi.Visible = cmi != null;
|
|
||||||
btnSaveHdDvdCmi.Visible = hdCopyrightInformation != null;
|
|
||||||
btnSaveDvdBca.Visible = bca != null;
|
|
||||||
btnSaveDvdAacs.Visible = aacs != null;
|
|
||||||
|
|
||||||
Visible = grpDvdPfi.Visible || grpDvdCmi.Visible || btnSaveDvdPfi.Visible ||
|
|
||||||
btnSaveDvdDmi.Visible ||
|
|
||||||
btnSaveDvdCmi.Visible || btnSaveHdDvdCmi.Visible || btnSaveDvdBca.Visible ||
|
|
||||||
btnSaveDvdAacs.Visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SaveElement(byte[] data)
|
|
||||||
{
|
|
||||||
var dlgSaveBinary = new SaveFileDialog();
|
|
||||||
|
|
||||||
dlgSaveBinary.Filters.Add(new FileFilter
|
|
||||||
{
|
|
||||||
Extensions = new[]
|
|
||||||
{
|
|
||||||
"*.bin"
|
|
||||||
},
|
|
||||||
Name = "Binary"
|
|
||||||
});
|
|
||||||
|
|
||||||
DialogResult result = dlgSaveBinary.ShowDialog(this);
|
|
||||||
|
|
||||||
if(result != DialogResult.Ok)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var saveFs = new FileStream(dlgSaveBinary.FileName, FileMode.Create);
|
|
||||||
saveFs.Write(data, 0, data.Length);
|
|
||||||
|
|
||||||
saveFs.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void OnBtnSaveDvdPfiClick(object sender, EventArgs e) => SaveElement(DvdPfi);
|
|
||||||
|
|
||||||
protected void OnBtnSaveDvdDmiClick(object sender, EventArgs e) => SaveElement(DvdDmi);
|
|
||||||
|
|
||||||
protected void OnBtnSaveDvdCmiClick(object sender, EventArgs e) => SaveElement(DvdCmi);
|
|
||||||
|
|
||||||
protected void OnBtnSaveHdDvdCmiClick(object sender, EventArgs e) => SaveElement(HddvdCopyrightInformation);
|
|
||||||
|
|
||||||
protected void OnBtnSaveDvdBcaClick(object sender, EventArgs e) => SaveElement(DvdBca);
|
|
||||||
|
|
||||||
protected void OnBtnSaveDvdAacsClick(object sender, EventArgs e) => SaveElement(DvdAacs);
|
|
||||||
|
|
||||||
#region XAML controls
|
|
||||||
#pragma warning disable 169
|
|
||||||
#pragma warning disable 649
|
|
||||||
GroupBox grpDvdPfi;
|
|
||||||
TextArea txtDvdPfi;
|
|
||||||
GroupBox grpDvdCmi;
|
|
||||||
TextArea txtDvdCmi;
|
|
||||||
GroupBox grpHdDvdCmi;
|
|
||||||
TextArea txtHdDvdCmi;
|
|
||||||
Button btnSaveDvdPfi;
|
|
||||||
Button btnSaveDvdDmi;
|
|
||||||
Button btnSaveDvdCmi;
|
|
||||||
Button btnSaveHdDvdCmi;
|
|
||||||
Button btnSaveDvdBca;
|
|
||||||
Button btnSaveDvdAacs;
|
|
||||||
#pragma warning restore 169
|
|
||||||
#pragma warning restore 649
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
122
Aaru.Gui/ViewModels/DvdInfoViewModel.cs
Normal file
122
Aaru.Gui/ViewModels/DvdInfoViewModel.cs
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reactive;
|
||||||
|
using Aaru.CommonTypes;
|
||||||
|
using Aaru.Decoders.DVD;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using ReactiveUI;
|
||||||
|
|
||||||
|
namespace Aaru.Gui.ViewModels
|
||||||
|
{
|
||||||
|
public class DvdInfoViewModel
|
||||||
|
{
|
||||||
|
readonly byte[] _dvdAacs;
|
||||||
|
readonly byte[] _dvdBca;
|
||||||
|
readonly byte[] _dvdCmi;
|
||||||
|
readonly byte[] _dvdDmi;
|
||||||
|
readonly byte[] _dvdPfi;
|
||||||
|
readonly byte[] _hddvdCopyrightInformation;
|
||||||
|
readonly Window _view;
|
||||||
|
|
||||||
|
public DvdInfoViewModel(MediaType mediaType, byte[] pfi, byte[] dmi, byte[] cmi, byte[] hdCopyrightInformation,
|
||||||
|
byte[] bca, byte[] aacs, PFI.PhysicalFormatInformation? decodedPfi, Window view)
|
||||||
|
{
|
||||||
|
_dvdPfi = pfi;
|
||||||
|
_dvdDmi = dmi;
|
||||||
|
_dvdCmi = cmi;
|
||||||
|
_hddvdCopyrightInformation = hdCopyrightInformation;
|
||||||
|
_dvdBca = bca;
|
||||||
|
_dvdAacs = aacs;
|
||||||
|
_view = view;
|
||||||
|
SaveDvdPfiCommand = ReactiveCommand.Create(ExecuteSaveDvdPfiCommand);
|
||||||
|
SaveDvdDmiCommand = ReactiveCommand.Create(ExecuteSaveDvdDmiCommand);
|
||||||
|
SaveDvdCmiCommand = ReactiveCommand.Create(ExecuteSaveDvdCmiCommand);
|
||||||
|
SaveHdDvdCmiCommand = ReactiveCommand.Create(ExecuteSaveHdDvdCmiCommand);
|
||||||
|
SaveDvdBcaCommand = ReactiveCommand.Create(ExecuteSaveDvdBcaCommand);
|
||||||
|
SaveDvdAacsCommand = ReactiveCommand.Create(ExecuteSaveDvdAacsCommand);
|
||||||
|
|
||||||
|
/* TODO: Pass back
|
||||||
|
switch(mediaType)
|
||||||
|
{
|
||||||
|
case MediaType.HDDVDROM:
|
||||||
|
case MediaType.HDDVDRAM:
|
||||||
|
case MediaType.HDDVDR:
|
||||||
|
case MediaType.HDDVDRW:
|
||||||
|
case MediaType.HDDVDRDL:
|
||||||
|
case MediaType.HDDVDRWDL:
|
||||||
|
Text = "HD DVD";
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Text = "DVD";
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(decodedPfi.HasValue)
|
||||||
|
DvdPfiText = PFI.Prettify(decodedPfi);
|
||||||
|
|
||||||
|
if(cmi != null)
|
||||||
|
DvdCmiText = CSS_CPRM.PrettifyLeadInCopyright(cmi);
|
||||||
|
|
||||||
|
SaveDvdPfiVisible = pfi != null;
|
||||||
|
SaveDvdDmiVisible = dmi != null;
|
||||||
|
SaveDvdCmiVisible = cmi != null;
|
||||||
|
SaveHdDvdCmiVisible = hdCopyrightInformation != null;
|
||||||
|
SaveDvdBcaVisible = bca != null;
|
||||||
|
SaveDvdAacsVisible = aacs != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReactiveCommand<Unit, Unit> SaveDvdPfiCommand { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> SaveDvdDmiCommand { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> SaveDvdCmiCommand { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> SaveHdDvdCmiCommand { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> SaveDvdBcaCommand { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> SaveDvdAacsCommand { get; }
|
||||||
|
public string DvdPfiText { get; }
|
||||||
|
public string DvdCmiText { get; }
|
||||||
|
public bool SaveDvdPfiVisible { get; }
|
||||||
|
public bool SaveDvdDmiVisible { get; }
|
||||||
|
public bool SaveDvdCmiVisible { get; }
|
||||||
|
public bool SaveHdDvdCmiVisible { get; }
|
||||||
|
public bool SaveDvdBcaVisible { get; }
|
||||||
|
public bool SaveDvdAacsVisible { get; }
|
||||||
|
|
||||||
|
async void SaveElement(byte[] data)
|
||||||
|
{
|
||||||
|
var dlgSaveBinary = new SaveFileDialog();
|
||||||
|
|
||||||
|
dlgSaveBinary.Filters.Add(new FileDialogFilter
|
||||||
|
{
|
||||||
|
Extensions = new List<string>(new[]
|
||||||
|
{
|
||||||
|
"*.bin"
|
||||||
|
}),
|
||||||
|
Name = "Binary"
|
||||||
|
});
|
||||||
|
|
||||||
|
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||||
|
|
||||||
|
if(result is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var saveFs = new FileStream(result, FileMode.Create);
|
||||||
|
saveFs.Write(data, 0, data.Length);
|
||||||
|
|
||||||
|
saveFs.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ExecuteSaveDvdPfiCommand() => SaveElement(_dvdPfi);
|
||||||
|
|
||||||
|
protected void ExecuteSaveDvdDmiCommand() => SaveElement(_dvdDmi);
|
||||||
|
|
||||||
|
protected void ExecuteSaveDvdCmiCommand() => SaveElement(_dvdCmi);
|
||||||
|
|
||||||
|
protected void ExecuteSaveHdDvdCmiCommand() => SaveElement(_hddvdCopyrightInformation);
|
||||||
|
|
||||||
|
protected void ExecuteSaveDvdBcaCommand() => SaveElement(_dvdBca);
|
||||||
|
|
||||||
|
protected void ExecuteSaveDvdAacsCommand() => SaveElement(_dvdAacs);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ using Aaru.CommonTypes.Interfaces;
|
|||||||
using Aaru.CommonTypes.Structs;
|
using Aaru.CommonTypes.Structs;
|
||||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||||
using Aaru.Decoders.CD;
|
using Aaru.Decoders.CD;
|
||||||
|
using Aaru.Decoders.DVD;
|
||||||
using Aaru.Decoders.SCSI;
|
using Aaru.Decoders.SCSI;
|
||||||
using Aaru.Gui.Models;
|
using Aaru.Gui.Models;
|
||||||
using Aaru.Gui.Tabs;
|
using Aaru.Gui.Tabs;
|
||||||
@@ -340,7 +341,6 @@ namespace Aaru.Gui.ViewModels
|
|||||||
mediaCatalogueNumber, null, _view)
|
mediaCatalogueNumber, null, _view)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* TODO: tabDvdInfo
|
|
||||||
byte[] dvdPfi = null;
|
byte[] dvdPfi = null;
|
||||||
byte[] dvdDmi = null;
|
byte[] dvdDmi = null;
|
||||||
byte[] dvdCmi = null;
|
byte[] dvdCmi = null;
|
||||||
@@ -371,13 +371,12 @@ namespace Aaru.Gui.ViewModels
|
|||||||
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_BCA))
|
imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_BCA))
|
||||||
dvdBca = imageFormat.ReadDiskTag(MediaTagType.DVD_BCA);
|
dvdBca = imageFormat.ReadDiskTag(MediaTagType.DVD_BCA);
|
||||||
|
|
||||||
var tabDvdInfo = new tabDvdInfo();
|
DvdInfo = new DvdInfoTab
|
||||||
|
{
|
||||||
|
DataContext = new DvdInfoViewModel(imageFormat.Info.MediaType, dvdPfi, dvdDmi, dvdCmi,
|
||||||
|
hddvdCopyrightInformation, dvdBca, null, decodedPfi, _view)
|
||||||
|
};
|
||||||
|
|
||||||
tabDvdInfo.LoadData(imageFormat.Info.MediaType, dvdPfi, dvdDmi, dvdCmi, hddvdCopyrightInformation, dvdBca,
|
|
||||||
null, decodedPfi);
|
|
||||||
|
|
||||||
tabInfos.Pages.Add(tabDvdInfo);
|
|
||||||
*/
|
|
||||||
/* TODO: tabDvdWritableinfo
|
/* TODO: tabDvdWritableinfo
|
||||||
|
|
||||||
byte[] dvdRamDds = null;
|
byte[] dvdRamDds = null;
|
||||||
@@ -653,6 +652,7 @@ namespace Aaru.Gui.ViewModels
|
|||||||
public ScsiInfoTab ScsiInfo { get; }
|
public ScsiInfoTab ScsiInfo { get; }
|
||||||
public AtaInfoTab AtaInfo { get; }
|
public AtaInfoTab AtaInfo { get; }
|
||||||
public CompactDiscInfoTab CompactDiscInfo { get; }
|
public CompactDiscInfoTab CompactDiscInfo { get; }
|
||||||
|
public DvdInfoTab DvdInfo { get; }
|
||||||
public Bitmap MediaLogo { get; }
|
public Bitmap MediaLogo { get; }
|
||||||
public string ImagePathText { get; }
|
public string ImagePathText { get; }
|
||||||
public string FilterText { get; }
|
public string FilterText { get; }
|
||||||
|
|||||||
Reference in New Issue
Block a user