mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Migrate sd/mmc 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
@@ -1290,8 +1290,8 @@
|
||||
<e p="PcmciaInfoTab.xaml.cs" t="Include" />
|
||||
<e p="ScsiInfoTab.xaml" t="Include" />
|
||||
<e p="ScsiInfoTab.xaml.cs" t="Include" />
|
||||
<e p="tabSdMmcInfo.xeto" t="Include" />
|
||||
<e p="tabSdMmcInfo.xeto.cs" t="Include" />
|
||||
<e p="SdMmcInfo.xaml" t="Include" />
|
||||
<e p="SdMmcInfo.xaml.cs" t="Include" />
|
||||
<e p="tabXboxInfo.xeto" t="Include" />
|
||||
<e p="tabXboxInfo.xeto.cs" t="Include" />
|
||||
</e>
|
||||
@@ -1311,6 +1311,7 @@
|
||||
<e p="PcmciaInfoViewModel.cs" t="Include" />
|
||||
<e p="PluginsDialogViewModel.cs" t="Include" />
|
||||
<e p="ScsiInfoViewModel.cs" t="Include" />
|
||||
<e p="SdMmcInfoViewModel.cs" t="Include" />
|
||||
<e p="SettingsDialogViewModel.cs" t="Include" />
|
||||
<e p="SplashWindowViewModel.cs" t="Include" />
|
||||
<e p="StatisticsDialogViewModel.cs" t="Include" />
|
||||
|
||||
@@ -156,6 +156,12 @@
|
||||
</TabItem.Header>
|
||||
<ContentControl Content="{Binding PcmciaInfo}" />
|
||||
</TabItem>
|
||||
<TabItem IsVisible="{Binding !!SdMmcInfo}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="SD / MMC" />
|
||||
</TabItem.Header>
|
||||
<ContentControl Content="{Binding SdMmcInfo}" />
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||
<Button Command="{Binding EntropyCommand}">
|
||||
|
||||
@@ -311,13 +311,14 @@ namespace Aaru.Gui.Panels
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
var tabSdMmcInfo = new tabSdMmcInfo();
|
||||
|
||||
tabSdMmcInfo.LoadData(devInfo.Type, devInfo.CID, devInfo.CSD, devInfo.OCR, devInfo.ExtendedCSD,
|
||||
devInfo.SCR);
|
||||
|
||||
tabInfos.Pages.Add(tabSdMmcInfo);
|
||||
*/
|
||||
}
|
||||
|
||||
protected void OnBtnSaveUsbDescriptors(object sender, EventArgs e)
|
||||
|
||||
41
Aaru.Gui/Tabs/SdMmcInfo.xaml
Normal file
41
Aaru.Gui/Tabs/SdMmcInfo.xaml
Normal file
@@ -0,0 +1,41 @@
|
||||
<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.SdMmcInfoTab">
|
||||
<Design.DataContext>
|
||||
<vm:SdMmcInfoViewModel />
|
||||
</Design.DataContext>
|
||||
<TabControl>
|
||||
<TabItem IsVisible="{Binding !!CidText}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="CID" />
|
||||
</TabItem.Header>
|
||||
<TextBox IsReadOnly="True" Text="{Binding CidText}" />
|
||||
</TabItem>
|
||||
<TabItem IsVisible="{Binding !!CsdText}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="CSD" />
|
||||
</TabItem.Header>
|
||||
<TextBox IsReadOnly="True" Text="{Binding CsdText}" />
|
||||
</TabItem>
|
||||
<TabItem IsVisible="{Binding !!OcrText}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="OCR" />
|
||||
</TabItem.Header>
|
||||
<TextBox IsReadOnly="True" Text="{Binding OcrText}" />
|
||||
</TabItem>
|
||||
<TabItem IsVisible="{Binding !!ExtendedCsdText}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="Extended CSD" />
|
||||
</TabItem.Header>
|
||||
<TextBox IsReadOnly="True" Text="{Binding ExtendedCsdText}" />
|
||||
</TabItem>
|
||||
<TabItem IsVisible="{Binding !!ScrText}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="SCR" />
|
||||
</TabItem.Header>
|
||||
<TextBox IsReadOnly="True" Text="{Binding ScrText}" />
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</UserControl>
|
||||
12
Aaru.Gui/Tabs/SdMmcInfo.xaml.cs
Normal file
12
Aaru.Gui/Tabs/SdMmcInfo.xaml.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Aaru.Gui.Tabs
|
||||
{
|
||||
public class SdMmcInfoTab : UserControl
|
||||
{
|
||||
public SdMmcInfoTab() => InitializeComponent();
|
||||
|
||||
void InitializeComponent() => AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!--
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ============================================================================
|
||||
//
|
||||
// Filename : tabSdMmcInfo.xeto
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Device information.
|
||||
//
|
||||
// ==[ Description ] ==========================================================
|
||||
//
|
||||
// Defines the structure for the SecureDigital/MultiMediaCard device 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="SD/MMC" Visible="False" xmlns="http://schema.picoe.ca/eto.forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<TabControl>
|
||||
<TabPage ID="tabCid" Text="CID" Visible="False">
|
||||
<TextArea ID="txtCid" ReadOnly="True"/>
|
||||
</TabPage>
|
||||
<TabPage ID="tabCsd" Text="CSD" Visible="False">
|
||||
<TextArea ID="txtCsd" ReadOnly="True"/>
|
||||
</TabPage>
|
||||
<TabPage ID="tabOcr" Text="OCR" Visible="False">
|
||||
<TextArea ID="txtOcr" ReadOnly="True"/>
|
||||
</TabPage>
|
||||
<TabPage ID="tabExtendedCsd" Text="Extended CSD" Visible="False">
|
||||
<TextArea ID="txtExtendedCsd" ReadOnly="True"/>
|
||||
</TabPage>
|
||||
<TabPage ID="tabScr" Text="SCR" Visible="False">
|
||||
<TextArea ID="txtScr" ReadOnly="True"/>
|
||||
</TabPage>
|
||||
</TabControl>
|
||||
</TabPage>
|
||||
@@ -1,132 +0,0 @@
|
||||
// /***************************************************************************
|
||||
// Aaru Data Preservation Suite
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : tabSdMmcInfo.xeto.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Device information.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Implements the SecureDigital/MultiMediaCard device 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 Aaru.CommonTypes.Enums;
|
||||
using Eto.Forms;
|
||||
using Eto.Serialization.Xaml;
|
||||
|
||||
namespace Aaru.Gui.Tabs
|
||||
{
|
||||
public class tabSdMmcInfo : TabPage
|
||||
{
|
||||
public tabSdMmcInfo() => XamlReader.Load(this);
|
||||
|
||||
internal void LoadData(DeviceType deviceType, byte[] cid, byte[] csd, byte[] ocr, byte[] extendedCsd,
|
||||
byte[] scr)
|
||||
{
|
||||
switch(deviceType)
|
||||
{
|
||||
case DeviceType.MMC:
|
||||
{
|
||||
Text = "MultiMediaCard";
|
||||
|
||||
if(cid != null)
|
||||
{
|
||||
tabCid.Visible = true;
|
||||
txtCid.Text = Decoders.MMC.Decoders.PrettifyCID(cid);
|
||||
}
|
||||
|
||||
if(csd != null)
|
||||
{
|
||||
tabCsd.Visible = true;
|
||||
txtCid.Text = Decoders.MMC.Decoders.PrettifyCSD(csd);
|
||||
}
|
||||
|
||||
if(ocr != null)
|
||||
{
|
||||
tabOcr.Visible = true;
|
||||
txtCid.Text = Decoders.MMC.Decoders.PrettifyOCR(ocr);
|
||||
}
|
||||
|
||||
if(extendedCsd != null)
|
||||
{
|
||||
tabExtendedCsd.Visible = true;
|
||||
txtCid.Text = Decoders.MMC.Decoders.PrettifyExtendedCSD(extendedCsd);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case DeviceType.SecureDigital:
|
||||
{
|
||||
Text = "SecureDigital";
|
||||
|
||||
if(cid != null)
|
||||
{
|
||||
tabCid.Visible = true;
|
||||
|
||||
txtCid.Text = Decoders.SecureDigital.Decoders.PrettifyCID(cid);
|
||||
}
|
||||
|
||||
if(csd != null)
|
||||
{
|
||||
tabCsd.Visible = true;
|
||||
|
||||
txtCid.Text = Decoders.SecureDigital.Decoders.PrettifyCSD(csd);
|
||||
}
|
||||
|
||||
if(ocr != null)
|
||||
{
|
||||
tabOcr.Visible = true;
|
||||
txtCid.Text = Decoders.SecureDigital.Decoders.PrettifyOCR(ocr);
|
||||
}
|
||||
|
||||
if(scr != null)
|
||||
{
|
||||
tabScr.Visible = true;
|
||||
txtCid.Text = Decoders.SecureDigital.Decoders.PrettifySCR(scr);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Visible = tabCid.Visible || tabCsd.Visible || tabOcr.Visible || tabExtendedCsd.Visible || tabScr.Visible;
|
||||
}
|
||||
|
||||
#region XAML controls
|
||||
#pragma warning disable 169
|
||||
#pragma warning disable 649
|
||||
TabPage tabCid;
|
||||
TextArea txtCid;
|
||||
TabPage tabCsd;
|
||||
TextArea txtCsd;
|
||||
TabPage tabOcr;
|
||||
TextArea txtOcr;
|
||||
TabPage tabExtendedCsd;
|
||||
TextArea txtExtendedCsd;
|
||||
TabPage tabScr;
|
||||
TextArea txtScr;
|
||||
#pragma warning restore 169
|
||||
#pragma warning restore 649
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -535,7 +535,6 @@ namespace Aaru.Gui.ViewModels
|
||||
DataContext = new PcmciaInfoViewModel(pcmciaCis, _view)
|
||||
};
|
||||
|
||||
/* TODO: SD/MMC
|
||||
DeviceType deviceType = DeviceType.Unknown;
|
||||
byte[] cid = null;
|
||||
byte[] csd = null;
|
||||
@@ -599,10 +598,11 @@ namespace Aaru.Gui.ViewModels
|
||||
deviceType = DeviceType.MMC;
|
||||
}
|
||||
|
||||
var tabSdMmcInfo = new tabSdMmcInfo();
|
||||
tabSdMmcInfo.LoadData(deviceType, cid, csd, ocr, extendedCsd, scr);
|
||||
tabInfos.Pages.Add(tabSdMmcInfo);
|
||||
*/
|
||||
SdMmcInfo = new SdMmcInfoTab
|
||||
{
|
||||
DataContext = new SdMmcInfoViewModel(deviceType, cid, csd, ocr, extendedCsd, scr)
|
||||
};
|
||||
|
||||
if(imageFormat is IOpticalMediaImage opticalMediaImage)
|
||||
{
|
||||
try
|
||||
@@ -652,6 +652,7 @@ namespace Aaru.Gui.ViewModels
|
||||
public DvdWritableInfoTab DvdWritableInfo { get; }
|
||||
public BlurayInfoTab BlurayInfo { get; }
|
||||
public PcmciaInfoTab PcmciaInfo { get; }
|
||||
public SdMmcInfoTab SdMmcInfo { get; }
|
||||
public Bitmap MediaLogo { get; }
|
||||
public string ImagePathText { get; }
|
||||
public string FilterText { get; }
|
||||
|
||||
57
Aaru.Gui/ViewModels/SdMmcInfoViewModel.cs
Normal file
57
Aaru.Gui/ViewModels/SdMmcInfoViewModel.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Aaru.CommonTypes.Enums;
|
||||
|
||||
namespace Aaru.Gui.ViewModels
|
||||
{
|
||||
public class SdMmcInfoViewModel
|
||||
{
|
||||
public SdMmcInfoViewModel(DeviceType deviceType, byte[] cid, byte[] csd, byte[] ocr, byte[] extendedCsd,
|
||||
byte[] scr)
|
||||
{
|
||||
switch(deviceType)
|
||||
{
|
||||
case DeviceType.MMC:
|
||||
{
|
||||
//Text = "MultiMediaCard";
|
||||
|
||||
if(cid != null)
|
||||
CidText = Decoders.MMC.Decoders.PrettifyCID(cid);
|
||||
|
||||
if(csd != null)
|
||||
CsdText = Decoders.MMC.Decoders.PrettifyCSD(csd);
|
||||
|
||||
if(ocr != null)
|
||||
OcrText = Decoders.MMC.Decoders.PrettifyOCR(ocr);
|
||||
|
||||
if(extendedCsd != null)
|
||||
ExtendedCsdText = Decoders.MMC.Decoders.PrettifyExtendedCSD(extendedCsd);
|
||||
}
|
||||
|
||||
break;
|
||||
case DeviceType.SecureDigital:
|
||||
{
|
||||
//Text = "SecureDigital";
|
||||
|
||||
if(cid != null)
|
||||
CidText = Decoders.SecureDigital.Decoders.PrettifyCID(cid);
|
||||
|
||||
if(csd != null)
|
||||
CsdText = Decoders.SecureDigital.Decoders.PrettifyCSD(csd);
|
||||
|
||||
if(ocr != null)
|
||||
OcrText = Decoders.SecureDigital.Decoders.PrettifyOCR(ocr);
|
||||
|
||||
if(scr != null)
|
||||
ScrText = Decoders.SecureDigital.Decoders.PrettifySCR(scr);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public string CidText { get; }
|
||||
public string CsdText { get; }
|
||||
public string OcrText { get; }
|
||||
public string ExtendedCsdText { get; }
|
||||
public string ScrText { get; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user