Migrate compactdisc info from Eto.Forms to Avalonia.

This commit is contained in:
2020-04-12 14:19:12 +01:00
parent 915491f329
commit 65f8200d41
10 changed files with 410 additions and 342 deletions

View File

@@ -1250,6 +1250,7 @@
<e p="FileSystemModel.cs" t="Include" />
<e p="ImageModel.cs" t="Include" />
<e p="ImagesRootModel.cs" t="Include" />
<e p="IsrcModel.cs" t="Include" />
<e p="MediaStatsModel.cs" t="Include" />
<e p="NameCountModel.cs" t="Include" />
<e p="PartitionModel.cs" t="Include" />
@@ -1276,12 +1277,12 @@
<e p="Tabs" t="Include">
<e p="AtaInfoTab.xaml" t="Include" />
<e p="AtaInfoTab.xaml.cs" t="Include" />
<e p="CompactDiscInfoTab.xaml" t="Include" />
<e p="CompactDiscInfoTab.xaml.cs" t="Include" />
<e p="ScsiInfoTab.xaml" t="Include" />
<e p="ScsiInfoTab.xaml.cs" t="Include" />
<e p="tabBlurayInfo.xeto" t="Include" />
<e p="tabBlurayInfo.xeto.cs" t="Include" />
<e p="tabCompactDiscInfo.xeto" t="Include" />
<e p="tabCompactDiscInfo.xeto.cs" t="Include" />
<e p="tabDvdInfo.xeto" t="Include" />
<e p="tabDvdInfo.xeto.cs" t="Include" />
<e p="tabDvdWritableInfo.xeto" t="Include" />
@@ -1297,6 +1298,7 @@
<e p="ViewModels" t="Include">
<e p="AboutDialogViewModel.cs" t="Include" />
<e p="AtaInfoViewModel.cs" t="Include" />
<e p="CompactDiscInfoViewModel.cs" t="Include" />
<e p="ConsoleWindowViewModel.cs" t="Include" />
<e p="EncodingsDialogViewModel.cs" t="Include" />
<e p="ImageInfoViewModel.cs" t="Include" />

View File

@@ -0,0 +1,8 @@
namespace Aaru.Gui.Models
{
public class IsrcModel
{
public string Track { get; set; }
public string Isrc { get; set; }
}
}

View File

@@ -126,6 +126,12 @@
</TabItem.Header>
<ContentControl Content="{Binding AtaInfo}" />
</TabItem>
<TabItem IsVisible="{Binding !!CompactDiscInfo}">
<TabItem.Header>
<TextBlock Text="CompactDisc" />
</TabItem.Header>
<ContentControl Content="{Binding CompactDiscInfo}" />
</TabItem>
</TabControl>
<StackPanel Orientation="Horizontal" Spacing="5">
<Button Command="{Binding EntropyCommand}">

View File

@@ -120,7 +120,7 @@ namespace Aaru.Gui.Panels
tabSsc.Visible = grpDensitySupport.Visible || grpMediumSupport.Visible || btnSaveDensitySupport.Visible ||
btnSaveMediumSupport.Visible;
/*
var tabCompactDiscInfo = new tabCompactDiscInfo();
tabCompactDiscInfo.LoadData(scsiInfo.Toc, scsiInfo.Atip, scsiInfo.CompactDiscInformation, scsiInfo.Session,
@@ -131,7 +131,7 @@ namespace Aaru.Gui.Panels
this.scsiInfo.Mcn, this.scsiInfo.Isrcs);
tabInfos.Pages.Add(tabCompactDiscInfo);
*/
var tabDvdInfo = new tabDvdInfo();
tabDvdInfo.LoadData(scsiInfo.MediaType, scsiInfo.DvdPfi, scsiInfo.DvdDmi, scsiInfo.DvdCmi,

View File

@@ -0,0 +1,99 @@
<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.CompactDiscInfoTab">
<Design.DataContext>
<vm:CompactDiscInfoViewModel />
</Design.DataContext>
<TabControl>
<TabItem IsVisible="{Binding !!CdInformationText}">
<TabItem.Header>
<TextBlock Text="Information" />
</TabItem.Header>
<StackPanel>
<TextBox IsReadOnly="True" Text="{Binding CdInformationText}" />
<Button Command="{Binding SaveCdInformationCommand}">
<TextBlock Text="Save READ DISC INFORMATION response" />
</Button>
</StackPanel>
</TabItem>
<TabItem IsVisible="{Binding !!CdTocText}">
<TabItem.Header>
<TextBlock Text="TOC" />
</TabItem.Header>
<StackPanel>
<TextBox IsReadOnly="True" Text="{Binding CdTocText}" />
<Button Command="{Binding SaveCdTocCommand}">
<TextBlock Text="Save READ TOC response" />
</Button>
</StackPanel>
</TabItem>
<TabItem IsVisible="{Binding !!CdFullTocText}">
<TabItem.Header>
<TextBlock Text="TOC (full)" />
</TabItem.Header>
<StackPanel>
<TextBox IsReadOnly="True" Text="{Binding CdFullTocText}" />
<Button Command="{Binding SaveCdFullTocCommand}">
<TextBlock Text="Save READ RAW TOC response" />
</Button>
</StackPanel>
</TabItem>
<TabItem IsVisible="{Binding !!CdSessionText}">
<TabItem.Header>
<TextBlock Text="Session" />
</TabItem.Header>
<StackPanel>
<TextBox IsReadOnly="True" Text="{Binding CdSessionText}" />
<Button Command="{Binding SaveCdSessionCommand}">
<TextBlock Text="Save READ SESSION response" />
</Button>
</StackPanel>
</TabItem>
<TabItem IsVisible="{Binding !!CdTextText}">
<TabItem.Header>
<TextBlock Text="CD-TEXT" />
</TabItem.Header>
<StackPanel>
<TextBox IsReadOnly="True" Text="{Binding CdTextText}" />
<Button Command="{Binding SaveCdTextCommand}">
<TextBlock Text="Save Lead-In CD-TEXT" />
</Button>
</StackPanel>
</TabItem>
<TabItem IsVisible="{Binding !!CdAtipText}">
<TabItem.Header>
<TextBlock Text="ATIP" />
</TabItem.Header>
<StackPanel>
<TextBox IsReadOnly="True" Text="{Binding CdAtipText}" />
<Button Command="{Binding SaveCdAtipCommand}">
<TextBlock Text="Save READ ATIP response" />
</Button>
</StackPanel>
</TabItem>
<TabItem IsVisible="{Binding MiscellaneousVisible}">
<TabItem.Header>
<TextBlock Text="Miscellaneous" />
</TabItem.Header>
<StackPanel>
<StackPanel Orientation="Horizontal" IsVisible="{Binding !!McnText}">
<TextBlock Text="Media catalog number" /> <TextBox IsReadOnly="True" Text="{Binding CdAtipText}" />
</StackPanel>
<StackPanel IsVisible="{Binding !!IsrcList.Count}">
<TextBlock Text="ISRCs" />
<DataGrid Items="{Binding IsrcList}">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Track}" Header="Track" />
<DataGridTextColumn Binding="{Binding ISRC}" Header="Isrc" />
</DataGrid.Columns>
</DataGrid>
</StackPanel>
<Button Command="{Binding SaveCdPmaCommand}" IsVisible="{Binding CdPmaVisible}">
<TextBlock Text="Save READ PMA response" />
</Button>
</StackPanel>
</TabItem>
</TabControl>
</UserControl>

View File

@@ -0,0 +1,12 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Aaru.Gui.Tabs
{
public class CompactDiscInfoTab : UserControl
{
public CompactDiscInfoTab() => InitializeComponent();
void InitializeComponent() => AvaloniaXamlLoader.Load(this);
}
}

View File

@@ -1,103 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><!--
// /***************************************************************************
// The Disc Image Chef
// ============================================================================
//
// Filename : tabCompactDiscInfo.xeto
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Media information.
//
// ==[ Description ] ==========================================================
//
// Defines the structure for the Compact Disc 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 Text="CompactDisc" Visible="False" xmlns="http://schema.picoe.ca/eto.forms"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TabControl>
<TabPage ID="tabCdInformation" Text="Information" Visible="False">
<StackLayout Orientation="Vertical">
<StackLayoutItem Expand="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<TextArea ID="txtCdInformation" ReadOnly="True"/>
</StackLayoutItem>
<Button Click="OnBtnCdInformationClick" ID="btnCdInformation"
Text="Save READ DISC INFORMATION response"/>
</StackLayout>
</TabPage>
<TabPage ID="tabCdToc" Text="TOC" Visible="False">
<StackLayout Orientation="Vertical">
<StackLayoutItem Expand="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<TextArea ID="txtCdToc" ReadOnly="True"/>
</StackLayoutItem>
<Button Click="OnBtnCdTocClick" ID="btnCdToc" Text="Save READ TOC response"/>
</StackLayout>
</TabPage>
<TabPage ID="tabCdFullToc" Text="TOC (full)" Visible="False">
<StackLayout Orientation="Vertical">
<StackLayoutItem Expand="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<TextArea ID="txtCdFullToc" ReadOnly="True"/>
</StackLayoutItem>
<Button Click="OnBtnCdFullTocClick" ID="btnCdFullToc" Text="Save READ RAW TOC response"/>
</StackLayout>
</TabPage>
<TabPage ID="tabCdSession" Text="Session" Visible="False">
<StackLayout Orientation="Vertical">
<StackLayoutItem Expand="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<TextArea ID="txtCdSession" ReadOnly="True"/>
</StackLayoutItem>
<Button Click="OnBtnCdSessionClick" ID="btnCdSession" Text="Save READ SESSION response"/>
</StackLayout>
</TabPage>
<TabPage ID="tabCdText" Text="CD-TEXT" Visible="False">
<StackLayout Orientation="Vertical">
<StackLayoutItem Expand="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<TextArea ID="txtCdText" ReadOnly="True"/>
</StackLayoutItem>
<Button Click="OnBtnCdTextClick" ID="btnCdText" Text="Save Lead-In CD-TEXT"/>
</StackLayout>
</TabPage>
<TabPage ID="tabCdAtip" Text="ATIP" Visible="False">
<StackLayout Orientation="Vertical">
<StackLayoutItem Expand="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<TextArea ID="txtCdAtip" ReadOnly="True"/>
</StackLayoutItem>
<Button Click="OnBtnCdAtipClick" ID="btnCdAtip" Text="Save READ ATIP response"/>
</StackLayout>
</TabPage>
<TabPage ID="tabCdMisc" Text="Miscellaneous" Visible="False">
<StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal" ID="stkMcn" Visible="False">
<Label ID="lblMcn" Text="Media catalog number"/>
<TextBox ID="txtMcn" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
<GroupBox ID="grpIsrcs" Text="ISRCs" Visible="False">
<TreeGridView ID="grdIsrcs"/>
</GroupBox>
</StackLayoutItem>
<Button Click="OnBtnCdPmaClick" ID="btnCdPma" Text="Save READ PMA response" Visible="False"/>
</StackLayout>
</TabPage>
</TabControl>
</TabPage>

View File

@@ -1,228 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : tabCompactDiscInfo.xeto..cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Media information.
//
// --[ Description ] ----------------------------------------------------------
//
// Implements the Compact Disc 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.Collections.Generic;
using System.IO;
using Aaru.Decoders.CD;
using Aaru.Decoders.SCSI.MMC;
using Eto.Forms;
using Eto.Serialization.Xaml;
namespace Aaru.Gui.Tabs
{
public class tabCompactDiscInfo : TabPage
{
byte[] atipData;
byte[] cdTextLeadInData;
byte[] compactDiscInformationData;
byte[] pmaData;
byte[] rawTocData;
byte[] sessionData;
byte[] tocData;
public tabCompactDiscInfo() => XamlReader.Load(this);
internal void LoadData(byte[] toc, byte[] atip, byte[] compactDiscInformation, byte[] session, byte[] rawToc,
byte[] pma, byte[] cdTextLeadIn, TOC.CDTOC? decodedToc, ATIP.CDATIP? decodedAtip,
Session.CDSessionInfo? decodedSession, FullTOC.CDFullTOC? fullToc,
CDTextOnLeadIn.CDText? decodedCdTextLeadIn,
DiscInformation.StandardDiscInformation? decodedCompactDiscInformation, string mcn,
Dictionary<byte, string> isrcs)
{
tocData = toc;
atipData = atip;
compactDiscInformationData = compactDiscInformation;
sessionData = session;
rawTocData = rawToc;
pmaData = pma;
cdTextLeadInData = cdTextLeadIn;
if(decodedCompactDiscInformation.HasValue)
{
tabCdInformation.Visible = true;
txtCdInformation.Text = DiscInformation.Prettify000b(decodedCompactDiscInformation);
btnCdInformation.Visible = compactDiscInformation != null;
}
if(decodedToc.HasValue)
{
tabCdToc.Visible = true;
txtCdToc.Text = TOC.Prettify(decodedToc);
btnCdToc.Visible = toc != null;
}
if(fullToc.HasValue)
{
tabCdFullToc.Visible = true;
txtCdFullToc.Text = FullTOC.Prettify(fullToc);
btnCdFullToc.Visible = rawToc != null;
}
if(decodedSession.HasValue)
{
tabCdSession.Visible = true;
txtCdSession.Text = Session.Prettify(decodedSession);
btnCdSession.Visible = session != null;
}
if(decodedCdTextLeadIn.HasValue)
{
tabCdText.Visible = true;
txtCdText.Text = CDTextOnLeadIn.Prettify(decodedCdTextLeadIn);
btnCdText.Visible = cdTextLeadIn != null;
}
if(decodedAtip.HasValue)
{
tabCdAtip.Visible = true;
txtCdAtip.Text = ATIP.Prettify(atip);
btnCdAtip.Visible = atip != null;
}
if(!string.IsNullOrEmpty(mcn))
{
stkMcn.Visible = true;
txtMcn.Text = mcn;
}
if(isrcs != null &&
isrcs.Count > 0)
{
grpIsrcs.Visible = true;
var isrcsItems = new TreeGridItemCollection();
grdIsrcs.Columns.Add(new GridColumn
{
HeaderText = "ISRC", DataCell = new TextBoxCell(0)
});
grdIsrcs.Columns.Add(new GridColumn
{
HeaderText = "Track", DataCell = new TextBoxCell(0)
});
grdIsrcs.AllowMultipleSelection = false;
grdIsrcs.ShowHeader = true;
grdIsrcs.DataStore = isrcsItems;
foreach(KeyValuePair<byte, string> isrc in isrcs)
isrcsItems.Add(new TreeGridItem
{
Values = new object[]
{
isrc.Key.ToString(), isrc.Value
}
});
}
btnCdPma.Visible = pma != null;
tabCdMisc.Visible = stkMcn.Visible || grpIsrcs.Visible || btnCdPma.Visible;
Visible = tabCdInformation.Visible || tabCdToc.Visible || tabCdFullToc.Visible || tabCdSession.Visible ||
tabCdText.Visible || tabCdAtip.Visible || stkMcn.Visible || grpIsrcs.Visible ||
btnCdPma.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 OnBtnCdInformationClick(object sender, EventArgs e) => SaveElement(compactDiscInformationData);
protected void OnBtnCdTocClick(object sender, EventArgs e) => SaveElement(tocData);
protected void OnBtnCdFullTocClick(object sender, EventArgs e) => SaveElement(rawTocData);
protected void OnBtnCdSessionClick(object sender, EventArgs e) => SaveElement(sessionData);
protected void OnBtnCdTextClick(object sender, EventArgs e) => SaveElement(cdTextLeadInData);
protected void OnBtnCdAtipClick(object sender, EventArgs e) => SaveElement(atipData);
protected void OnBtnCdPmaClick(object sender, EventArgs e) => SaveElement(pmaData);
#region XAML controls
#pragma warning disable 169
#pragma warning disable 649
TabPage tabCdInformation;
TextArea txtCdInformation;
Button btnCdInformation;
TabPage tabCdToc;
TextArea txtCdToc;
Button btnCdToc;
TabPage tabCdFullToc;
TextArea txtCdFullToc;
Button btnCdFullToc;
TabPage tabCdSession;
TextArea txtCdSession;
Button btnCdSession;
TabPage tabCdText;
TextArea txtCdText;
Button btnCdText;
TabPage tabCdAtip;
TextArea txtCdAtip;
Button btnCdAtip;
TabPage tabCdMisc;
StackLayout stkMcn;
Label lblMcn;
TextBox txtMcn;
GroupBox grpIsrcs;
TreeGridView grdIsrcs;
Button btnCdPma;
#pragma warning restore 169
#pragma warning restore 649
#endregion
}
}

View File

@@ -0,0 +1,269 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Reactive;
using Aaru.Decoders.CD;
using Aaru.Decoders.SCSI.MMC;
using Aaru.Gui.Models;
using Avalonia.Controls;
using ReactiveUI;
namespace Aaru.Gui.ViewModels
{
public class CompactDiscInfoViewModel : ViewModelBase
{
readonly Window _view;
readonly byte[] _atipData;
readonly byte[] _cdTextLeadInData;
readonly byte[] _compactDiscInformationData;
readonly byte[] _pmaData;
readonly byte[] _rawTocData;
readonly byte[] _sessionData;
readonly byte[] _tocData;
public CompactDiscInfoViewModel(byte[] toc, byte[] atip, byte[] compactDiscInformation, byte[] session,
byte[] rawToc, byte[] pma, byte[] cdTextLeadIn, TOC.CDTOC? decodedToc,
ATIP.CDATIP? decodedAtip, Session.CDSessionInfo? decodedSession,
FullTOC.CDFullTOC? fullToc, CDTextOnLeadIn.CDText? decodedCdTextLeadIn,
DiscInformation.StandardDiscInformation? decodedCompactDiscInformation,
string mcn, Dictionary<byte, string> isrcs, Window view)
{
_tocData = toc;
_atipData = atip;
_compactDiscInformationData = compactDiscInformation;
_sessionData = session;
_rawTocData = rawToc;
_pmaData = pma;
_cdTextLeadInData = cdTextLeadIn;
_view = view;
IsrcList = new ObservableCollection<IsrcModel>();
SaveCdInformationCommand = ReactiveCommand.Create(ExecuteSaveCdInformationCommand);
SaveCdTocCommand = ReactiveCommand.Create(ExecuteSaveCdTocCommand);
SaveCdFullTocCommand = ReactiveCommand.Create(ExecuteSaveCdFullTocCommand);
SaveCdSessionCommand = ReactiveCommand.Create(ExecuteSaveCdSessionCommand);
SaveCdTextCommand = ReactiveCommand.Create(ExecuteSaveCdTextCommand);
SaveCdAtipCommand = ReactiveCommand.Create(ExecuteSaveCdAtipCommand);
SaveCdPmaCommand = ReactiveCommand.Create(ExecuteSaveCdPmaCommand);
if(decodedCompactDiscInformation.HasValue)
CdInformationText = DiscInformation.Prettify000b(decodedCompactDiscInformation);
if(decodedToc.HasValue)
CdTocText = TOC.Prettify(decodedToc);
if(fullToc.HasValue)
CdFullTocText = FullTOC.Prettify(fullToc);
if(decodedSession.HasValue)
CdSessionText = Session.Prettify(decodedSession);
if(decodedCdTextLeadIn.HasValue)
CdTextText = CDTextOnLeadIn.Prettify(decodedCdTextLeadIn);
if(decodedAtip.HasValue)
CdAtipText = ATIP.Prettify(atip);
if(!string.IsNullOrEmpty(mcn))
McnText = mcn;
if(isrcs != null &&
isrcs.Count > 0)
{
foreach(KeyValuePair<byte, string> isrc in isrcs)
IsrcList.Add(new IsrcModel
{
Track = isrc.Key.ToString(), Isrc = isrc.Value
});
}
MiscellaneousVisible = McnText != null || isrcs?.Count > 0 || pma != null;
CdPmaVisible = pma != null;
}
public string CdInformationText { get; }
public string CdTocText { get; }
public string CdFullTocText { get; }
public string CdSessionText { get; }
public string CdTextText { get; }
public string CdAtipText { get; }
public bool MiscellaneousVisible { get; }
public string McnText { get; }
public bool CdPmaVisible { get; }
public ReactiveCommand<Unit, Unit> SaveCdInformationCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCdTocCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCdFullTocCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCdSessionCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCdTextCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCdAtipCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCdPmaCommand { get; }
public ObservableCollection<IsrcModel> IsrcList { get; }
protected async void ExecuteSaveCdInformationCommand()
{
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(_compactDiscInformationData, 0, _compactDiscInformationData.Length);
saveFs.Close();
}
protected async void ExecuteSaveCdTocCommand()
{
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(_tocData, 0, _tocData.Length);
saveFs.Close();
}
protected async void ExecuteSaveCdFullTocCommand()
{
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(_rawTocData, 0, _rawTocData.Length);
saveFs.Close();
}
protected async void ExecuteSaveCdSessionCommand()
{
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(_sessionData, 0, _sessionData.Length);
saveFs.Close();
}
protected async void ExecuteSaveCdTextCommand()
{
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(_cdTextLeadInData, 0, _cdTextLeadInData.Length);
saveFs.Close();
}
protected async void ExecuteSaveCdAtipCommand()
{
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(_atipData, 0, _atipData.Length);
saveFs.Close();
}
protected async void ExecuteSaveCdPmaCommand()
{
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(_pmaData, 0, _pmaData.Length);
saveFs.Close();
}
}
}

View File

@@ -2,10 +2,12 @@ using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive;
using System.Text;
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.SCSI;
using Aaru.Gui.Models;
using Aaru.Gui.Tabs;
@@ -16,6 +18,7 @@ using Avalonia.Platform;
using ReactiveUI;
using Schemas;
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
using Session = Aaru.CommonTypes.Structs.Session;
namespace Aaru.Gui.ViewModels
{
@@ -205,7 +208,6 @@ namespace Aaru.Gui.ViewModels
DataContext = new AtaInfoViewModel(ataIdentify, atapiIdentify, null, _view)
};
/* TODO: tabCompactDiscInfo
byte[] toc = null;
TOC.CDTOC? decodedToc = null;
byte[] fullToc = null;
@@ -331,13 +333,13 @@ namespace Aaru.Gui.ViewModels
mediaCatalogueNumber = Encoding.UTF8.GetString(mcn);
}
var tabCompactDiscInfo = new tabCompactDiscInfo();
CompactDiscInfo = new CompactDiscInfoTab
{
DataContext = new CompactDiscInfoViewModel(toc, atip, null, null, fullToc, pma, cdtext, decodedToc,
decodedAtip, null, decodedFullToc, decodedCdText, null,
mediaCatalogueNumber, null, _view)
};
tabCompactDiscInfo.LoadData(toc, atip, null, null, fullToc, pma, cdtext, decodedToc, decodedAtip, null,
decodedFullToc, decodedCdText, null, mediaCatalogueNumber, null);
tabInfos.Pages.Add(tabCompactDiscInfo);
*/
/* TODO: tabDvdInfo
byte[] dvdPfi = null;
byte[] dvdDmi = null;
@@ -650,6 +652,7 @@ namespace Aaru.Gui.ViewModels
public ScsiInfoTab ScsiInfo { get; }
public AtaInfoTab AtaInfo { get; }
public CompactDiscInfoTab CompactDiscInfo { get; }
public Bitmap MediaLogo { get; }
public string ImagePathText { get; }
public string FilterText { get; }