Migrate device info panel from Eto.Forms to Avalonia.

This commit is contained in:
2020-04-15 04:40:24 +01:00
parent b81d7180b5
commit e5a73f86de
10 changed files with 1338 additions and 887 deletions

View File

@@ -1263,14 +1263,14 @@
</e>
</e>
<e p="Panels" t="Include">
<e p="DeviceInfoPanel.xaml" t="Include" />
<e p="DeviceInfoPanel.xaml.cs" t="Include" />
<e p="FileSystemPanel.xaml" t="Include" />
<e p="FileSystemPanel.xaml.cs" t="Include" />
<e p="ImageInfoPanel.xaml" t="Include" />
<e p="ImageInfoPanel.xaml.cs" t="Include" />
<e p="PartitionPanel.xaml" t="Include" />
<e p="PartitionPanel.xaml.cs" t="Include" />
<e p="pnlDeviceInfo.xeto" t="Include" />
<e p="pnlDeviceInfo.xeto.cs" t="Include" />
<e p="pnlScsiInfo.xeto" t="Include" />
<e p="pnlScsiInfo.xeto.cs" t="Include" />
<e p="SubdirectoryPanel.xaml" t="Include" />
@@ -1305,6 +1305,7 @@
<e p="CompactDiscInfoViewModel.cs" t="Include" />
<e p="ConsoleWindowViewModel.cs" t="Include" />
<e p="DecodeMediaTagsViewModel.cs" t="Include" />
<e p="DeviceInfoViewModel.cs" t="Include" />
<e p="DvdInfoViewModel.cs" t="Include" />
<e p="DvdWritableInfoViewModel.cs" t="Include" />
<e p="EncodingsDialogViewModel.cs" t="Include" />

View File

@@ -41,7 +41,6 @@ using Aaru.Gui.Panels;
using Eto.Drawing;
using Eto.Forms;
using Eto.Serialization.Xaml;
using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo;
namespace Aaru.Gui.Forms
{
@@ -220,38 +219,6 @@ namespace Aaru.Gui.Forms
switch(selectedItem.Values[3])
{
case null when selectedItem.Parent == devicesRoot:
try
{
var dev = new Device((string)selectedItem.Values[2]);
if(dev.IsRemote)
Statistics.AddRemote(dev.RemoteApplication, dev.RemoteVersion, dev.RemoteOperatingSystem,
dev.RemoteOperatingSystemVersion, dev.RemoteArchitecture);
if(dev.Error)
{
selectedItem.Values[3] = $"Error {dev.LastError} opening device";
return;
}
var devInfo = new DeviceInfo(dev);
selectedItem.Values[3] = new pnlDeviceInfo(devInfo);
splMain.Panel2 = (Panel)selectedItem.Values[3];
dev.Close();
}
catch(SystemException ex)
{
selectedItem.Values[3] = ex.Message;
lblError.Text = ex.Message;
splMain.Panel2 = lblError;
AaruConsole.ErrorWriteLine(ex.Message);
}
break;
case string devErrorMessage when selectedItem.Parent == devicesRoot:
lblError.Text = devErrorMessage;
splMain.Panel2 = lblError;

View File

@@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
using Aaru.Gui.ViewModels;
using Avalonia.Media.Imaging;
namespace Aaru.Gui.Models
@@ -7,9 +8,10 @@ namespace Aaru.Gui.Models
{
public DeviceModel() => Media = new ObservableCollection<MediaModel>();
public Bitmap Icon { get; set; }
public string Name { get; set; }
public string Path { get; set; }
public Bitmap Icon { get; set; }
public string Name { get; set; }
public string Path { get; set; }
public DeviceInfoViewModel ViewModel { get; set; }
public ObservableCollection<MediaModel> Media { get; }
}

View File

@@ -0,0 +1,344 @@
<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.DeviceInfoPanel">
<Design.DataContext>
<vm:DeviceInfoViewModel />
</Design.DataContext>
<StackPanel Orientation="Vertical">
<TextBlock Text="Device information" />
<TabControl>
<TabItem>
<TabItem.Header>
<TextBlock Text="General" />
</TabItem.Header>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Device type" /> <TextBox Text="{Binding DeviceType}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Manufacturer" /> <TextBox Text="{Binding Manufacturer}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Model" /> <TextBox Text="{Binding Model}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Revision" /> <TextBox Text="{Binding Revision}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Serial number" /> <TextBox Text="{Binding Serial}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Peripheral device type" />
<TextBox Text="{Binding ScsiType}" IsReadOnly="True" />
</StackPanel>
<CheckBox IsChecked="{Binding RemovableChecked}" IsEnabled="False">
<TextBlock Text="Removable media" />
</CheckBox>
<CheckBox IsChecked="{Binding UsbConnected}" IsEnabled="False">
<TextBlock Text="Connected by USB" />
</CheckBox>
</StackPanel>
</TabItem>
<TabItem IsVisible="{Binding UsbVisible}">
<TabItem.Header>
<TextBlock Text="USB" />
</TabItem.Header>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Vendor ID" /> <TextBox Text="{Binding UsbVendorId}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Product ID" /> <TextBox Text="{Binding UsbProductId}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Manufacturer" />
<TextBox Text="{Binding UsbManufacturer}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Product" /> <TextBox Text="{Binding UsbProduct}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Serial number" /> <TextBox Text="{Binding UsbSerial}" IsReadOnly="True" />
</StackPanel>
<Button Command="{Binding SaveUsbDescriptorsCommand}"
IsVisible="{Binding SaveUsbDescriptorsEnabled}">
<TextBlock Text="Save descriptors to file" />
</Button>
</StackPanel>
</TabItem>
<TabItem IsVisible="{Binding FirewireVisible}">
<TabItem.Header>
<TextBlock Text="FireWire" />
</TabItem.Header>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Vendor ID" /> <TextBox Text="{Binding FirewireVendorId}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Model ID" /> <TextBox Text="{Binding FirewireModelId}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Manufacturer" />
<TextBox Text="{Binding FirewireManufacturer}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Model" /> <TextBox Text="{Binding FirewireModel}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="GUID" /> <TextBox Text="{Binding FirewireGuid}" IsReadOnly="True" />
</StackPanel>
</StackPanel>
</TabItem>
<TabItem IsVisible="{Binding PlextorVisible}">
<TabItem.Header>
<TextBlock Text="Plextor" />
</TabItem.Header>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Vertical" IsVisible="{Binding PlextorEepromVisible}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Total loaded discs:" />
<TextBox Text="{Binding PlextorDiscs}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Time spent reading CDs" />
<TextBox Text="{Binding PlextorCdReadTime}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Time spent writing CDs" />
<TextBox Text="{Binding PlextorCdWriteTime}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Vertical" IsVisible="{Binding PlextorDvdTimesVisible}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Time spent reading DVDs" />
<TextBox Text="{Binding PlextorDvdReadTime}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Time spent writing DVDs" />
<TextBox Text="{Binding PlextorDvdWriteTime}" IsReadOnly="True" />
</StackPanel>
</StackPanel>
</StackPanel>
<CheckBox IsChecked="{Binding PlextorPoweRec}" IsEnabled="False">
<TextBlock Text="Supports PoweRec" />
</CheckBox>
<CheckBox IsChecked="{Binding PlextorPoweRecEnabled}" IsEnabled="False"
IsVisible="{Binding PlextorPoweRec}">
<TextBlock Text="PoweRec is enabled" />
</CheckBox>
<StackPanel Orientation="Vertical" IsVisible="{Binding PlextorPoweRecEnabled}">
<StackPanel Orientation="Vertical" IsVisible="{Binding PlextorPoweRecRecommendedVisible}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Recommended speed" />
<TextBox Text="{Binding PlextorPoweRecRecommended}" IsReadOnly="True" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" IsVisible="{Binding PlextorPoweRecSelectedVisible}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Selected PoweRec speed for currently inserted media:" />
<TextBox Text="{Binding PlextorPoweRecSelected}" IsReadOnly="True" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" IsVisible="{Binding PlextorPoweRecMaxVisible}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Maximum PoweRec speed for currently inserted media" />
<TextBox Text="{Binding PlextorPoweRecMax}" IsReadOnly="True" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" IsVisible="{Binding PlextorPoweRecLastVisible}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Last PoweRec used speed" />
<TextBox Text="{Binding PlextorPoweRecLast}" IsReadOnly="True" />
</StackPanel>
</StackPanel>
</StackPanel>
<CheckBox IsChecked="{Binding PlextorSilentMode}" IsEnabled="False">
<TextBlock Text="Supports SilentMode" />
</CheckBox>
<CheckBox IsChecked="{Binding PlextorSilentModeEnabled}" IsEnabled="False"
IsVisible="{Binding PlextorSilentMode}">
<TextBlock Text="SilentMode is enabled" />
</CheckBox>
<StackPanel Orientation="Vertical" IsVisible="{Binding PlextorSilentModeEnabled}">
<TextBlock Text="{Binding PlextorSilentModeAccessTime}" />
<StackPanel Orientation="Horizontal">
<TextBlock Text="CD read speed limited to" />
<TextBox Text="{Binding PlextorSilentModeCdReadSpeedLimit}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="CD write speed limited to" />
<TextBox Text="{Binding PlextorSilentModeCdWriteSpeedLimit}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Vertical"
IsVisible="{Binding PlextorSilentModeDvdReadSpeedLimitVisible}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="DVD read speed limited to" />
<TextBox Text="{Binding PlextorSilentModeDvdReadSpeedLimit}" IsReadOnly="True" />
</StackPanel>
</StackPanel>
</StackPanel>
<CheckBox IsChecked="{Binding PlextorGigaRec}" IsEnabled="False">
<TextBlock Text="Supports GigaRec" />
</CheckBox>
<CheckBox IsChecked="{Binding PlextorSecuRec}" IsEnabled="False">
<TextBlock Text="Supports SpeedRead" />
</CheckBox>
<CheckBox IsChecked="{Binding PlextorSpeedRead}" IsEnabled="False">
<TextBlock Text="SpeedRead is enabled" />
</CheckBox>
<CheckBox IsChecked="{Binding PlextorSpeedEnabled}" IsEnabled="False">
<TextBlock Text="Supports PoweRec" />
</CheckBox>
<CheckBox IsChecked="{Binding PlextorHiding}" IsEnabled="False">
<TextBlock Text="Supports hiding CD-Rs and sessions" />
</CheckBox>
<StackPanel Orientation="Vertical" IsVisible="{Binding PlextorHiding}">
<CheckBox IsChecked="{Binding PlextorHidesRecordables}" IsEnabled="False">
<TextBlock Text="Is hiding CD-Rs" />
</CheckBox>
<CheckBox IsChecked="{Binding PlextorHidesSessions}" IsEnabled="False">
<TextBlock Text="Is forcing only first session" />
</CheckBox>
</StackPanel>
<CheckBox IsChecked="{Binding PlextorVariRec}" IsEnabled="False">
<TextBlock Text="Supports VariRec" />
</CheckBox>
<StackPanel Orientation="Vertical" IsVisible="{Binding PlextorDvd}">
<CheckBox IsChecked="{Binding PlextorVariRecDvd}" IsEnabled="False">
<TextBlock Text="Supports VariRec on DVDs" />
</CheckBox>
<CheckBox IsChecked="{Binding PlextorBitSetting}" IsEnabled="False">
<TextBlock Text="Supports bitsetting DVD+R book type" />
</CheckBox>
<CheckBox IsChecked="{Binding PlextorBitSettingDl}" IsEnabled="False">
<TextBlock Text="Supports bitsetting DVD+R DL book type" />
</CheckBox>
<CheckBox IsChecked="{Binding PlextorDvdPlusWriteTest}" IsEnabled="False">
<TextBlock Text="Supports test writing DVD+" />
</CheckBox>
</StackPanel>
</StackPanel>
</TabItem>
<TabItem IsVisible="{Binding Kreon}">
<TabItem.Header>
<TextBlock Text="Kreon" />
</TabItem.Header>
<StackPanel Orientation="Vertical">
<CheckBox IsChecked="{Binding KreonChallengeResponse}" IsEnabled="False">
<TextBlock Text="Can do challenge/response with Xbox discs" />
</CheckBox>
<CheckBox IsChecked="{Binding KreonDecryptSs}" IsEnabled="False">
<TextBlock Text="Can read and decrypt SS from Xbox discs" />
</CheckBox>
<CheckBox IsChecked="{Binding KreonXtremeUnlock}" IsEnabled="False">
<TextBlock Text="Can set xtreme unlock state with Xbox discs" />
</CheckBox>
<CheckBox IsChecked="{Binding KreonWxripperUnlock}" IsEnabled="False">
<TextBlock Text="Can set wxripper unlock state with Xbox discs" />
</CheckBox>
<CheckBox IsChecked="{Binding KreonChallengeResponse360}" IsEnabled="False">
<TextBlock Text="Can do challenge/response with Xbox 360 discs" />
</CheckBox>
<CheckBox IsChecked="{Binding KreonDecryptSs360}" IsEnabled="False">
<TextBlock Text="Can read and decrypt SS from Xbox 360 discs" />
</CheckBox>
<CheckBox IsChecked="{Binding KreonXtremeUnlock360}" IsEnabled="False">
<TextBlock Text="Can set xtreme unlock state with Xbox 360 discs" />
</CheckBox>
<CheckBox IsChecked="{Binding KreonWxripperUnlock360}" IsEnabled="False">
<TextBlock Text="Can set wxripper unlock state with Xbox 360 discs" />
</CheckBox>
<CheckBox IsChecked="{Binding KreonLock}" IsEnabled="False">
<TextBlock Text="Can set locked state" />
</CheckBox>
<CheckBox IsChecked="{Binding KreonErrorSkipping}" IsEnabled="False">
<TextBlock Text="Can skip read errors" />
</CheckBox>
</StackPanel>
</TabItem>
<TabItem IsVisible="{Binding Ssc}">
<TabItem.Header>
<TextBlock Text="SSC" />
</TabItem.Header>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Vertical" IsVisible="{Binding BlockLimits}">
<TextBlock Text="{Binding MinBlockSize}" IsVisible="{Binding !!MinBlockSize}" />
<TextBlock Text="{Binding MaxBlockSize}" IsVisible="{Binding !!MaxBlockSize}" />
<TextBlock Text="{Binding BlockSizeGranularity}" IsVisible="{Binding !!BlockSizeGranularity}" />
</StackPanel>
<StackPanel Orientation="Vertical" IsVisible="{Binding !!Densities}">
<TextBlock Text="Densities supported by device:" />
<TextBox Text="{Binding Densities}" IsReadOnly="True" />
</StackPanel>
<StackPanel Orientation="Vertical" IsVisible="{Binding !!{Binding MediumTypes}}">
<TextBlock Text="Medium types supported by device:" />
<TextBox Text="{Binding MediumTypes}" IsReadOnly="True" />
</StackPanel>
<TextBox Text="{Binding MediumDensity}" IsReadOnly="True" IsVisible="{Binding !!MediumDensity}" />
</StackPanel>
</TabItem>
<TabItem IsVisible="{Binding SecureDigital}">
<TabItem.Header>
<TextBlock Text="{Binding SdMmcText}" />
</TabItem.Header>
<TabControl>
<TabItem IsVisible="{Binding !!Cid}">
<TabItem.Header>
<TextBlock Text="CID" />
</TabItem.Header>
<TextBox Text="{Binding Cid}" IsReadOnly="True" />
</TabItem>
<TabItem IsVisible="{Binding !!Csd}">
<TabItem.Header>
<TextBlock Text="CSD" />
</TabItem.Header>
<TextBox Text="{Binding Csd}" IsReadOnly="True" />
</TabItem>
<TabItem IsVisible="{Binding !!Ocr}">
<TabItem.Header>
<TextBlock Text="OCR" />
</TabItem.Header>
<TextBox Text="{Binding Ocr}" IsReadOnly="True" />
</TabItem>
<TabItem IsVisible="{Binding !!ExtendedCsd}">
<TabItem.Header>
<TextBlock Text="Extended CSD" />
</TabItem.Header>
<TextBox Text="{Binding ExtendedCsd}" IsReadOnly="True" />
</TabItem>
<TabItem IsVisible="{Binding !!Scr}">
<TabItem.Header>
<TextBlock Text="SCR" />
</TabItem.Header>
<TextBox Text="{Binding Scr}" IsReadOnly="True" />
</TabItem>
</TabControl>
</TabItem>
<TabItem IsVisible="{Binding !!PcmciaInfo}">
<TabItem.Header>
<TextBlock Text="PCMCIA" />
</TabItem.Header>
<ContentControl Content="{Binding PcmciaInfo}" />
</TabItem>
<TabItem IsVisible="{Binding !!AtaInfo}">
<TabItem.Header>
<TextBlock Text="ATA/ATAPI" />
</TabItem.Header>
<ContentControl Content="{Binding AtaInfo}" />
</TabItem>
<TabItem IsVisible="{Binding !!ScsiInfo}">
<TabItem.Header>
<TextBlock Text="SCSI" />
</TabItem.Header>
<ContentControl Content="{Binding ScsiInfo}" />
</TabItem>
<TabItem IsVisible="{Binding !!SdMmcInfo}">
<TabItem.Header>
<TextBlock Text="SD/MMC" />
</TabItem.Header>
<ContentControl Content="{Binding SdMmcInfo}" />
</TabItem>
</TabControl>
</StackPanel>
</UserControl>

View File

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

View File

@@ -1,376 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><!--
// /***************************************************************************
// The Disc Image Chef
// ============================================================================
//
// Filename : pnlDeviceInfo.xeto
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Device information panel.
//
// ==[ Description ] ==========================================================
//
// Defines the structure for the device 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
// ****************************************************************************/
-->
<Panel xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Center">
<Label ID="lblDeviceInfo" Text="Device information"/>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True" VerticalAlignment="Stretch">
<TabControl ID="tabInfos">
<TabPage ID="tabGeneral" Text="General">
<StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblType" Text="Device type"/>
<TextBox ID="txtType" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblManufacturer" Text="Manufacturer"/>
<TextBox ID="txtManufacturer" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblModel" Text="Model"/>
<TextBox ID="txtModel" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblRevision" Text="Revision"/>
<TextBox ID="txtRevision" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblSerial" Text="Serial number"/>
<TextBox ID="txtSerial" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblScsiType" Text="Peripheral device type"/>
<TextBox ID="txtScsiType" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<CheckBox ID="chkRemovable" Text="Removable media" Enabled="False"/>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<CheckBox ID="chkUsb" Text="Connected by USB" Enabled="False"/>
</StackLayoutItem>
</StackLayout>
</TabPage>
<TabPage ID="tabUsb" Text="USB" Visible="False">
<StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblUsbVendorId" Text="Vendor ID"/>
<TextBox ID="txtUsbVendorId" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblUsbProductId" Text="Product ID"/>
<TextBox ID="txtUsbProductId" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblUsbManufacturer" Text="Manufacturer"/>
<TextBox ID="txtUsbManufacturer" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblUsbProduct" Text="Product"/>
<TextBox ID="txtUsbProduct" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblUsbSerial" Text="Serial number"/>
<TextBox ID="txtUsbSerial" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Right">
<Button Text="Save descriptors to file" Click="OnBtnSaveUsbDescriptors"
ID="btnSaveUsbDescriptors"/>
</StackLayoutItem>
</StackLayout>
</TabPage>
<TabPage ID="tabFirewire" Text="FireWire" Visible="False">
<StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblFirewireVendorId" Text="Vendor ID"/>
<TextBox ID="txtFirewireVendorId" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblFirewireModelId" Text="Model ID"/>
<TextBox ID="txtFirewireModelId" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblFirewireManufacturer" Text="Manufacturer"/>
<TextBox ID="txtFirewireManufacturer" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblFirewireModel" Text="Model"/>
<TextBox ID="txtFirewireModel" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblFirewireGuid" Text="GUID"/>
<TextBox ID="txtFirewireGuid" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
</StackLayout>
</TabPage>
<TabPage ID="tabPlextor" Text="Plextor" Visible="False">
<StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Vertical" ID="stkPlextorEeprom" Visible="False">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblPlextorDiscs" Text="Total loaded discs:"/>
<TextBox ID="txtPlextorDiscs" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblPlextorCdReadTime" Text="Time spent reading CDs"/>
<TextBox ID="txtPlextorCdReadTime" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblPlextorCdWriteTime" Text="Time spent writing CDs"/>
<TextBox ID="txtPlextorCdWriteTime" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Vertical" ID="stkPlextorDvdTimes" Visible="false">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblPlextorDvdReadTime" Text="Time spent reading DVDs"/>
<TextBox ID="txtPlextorDvdReadTime" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblPlextorDvdWriteTime" Text="Time spent writing DVDs"/>
<TextBox ID="txtPlextorDvdWriteTime" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
</StackLayout>
</StackLayoutItem>
</StackLayout>
</StackLayoutItem>
<CheckBox ID="chkPlextorPoweRec" Text="Supports PoweRec" Enabled="False"/>
<CheckBox ID="chkPlextorPoweRecEnabled" Text="PoweRec is enabled" Enabled="False"
Visible="False"/>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Vertical" ID="stkPlextorPoweRecEnabled" Visible="False">
<StackLayout Orientation="Vertical" ID="stkPlextorPoweRecRecommended" Visible="False">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblPlextorPoweRecRecommended" Text="Recommended speed"/>
<TextBox ID="txtPlextorPoweRecRecommended" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
</StackLayout>
<StackLayout Orientation="Vertical" ID="stkPlextorPoweRecSelected" Visible="False">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblPlextorPoweRecSelected"
Text="Selected PoweRec speed for currently inserted media:"/>
<TextBox ID="txtPlextorPoweRecSelected" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
</StackLayout>
<StackLayout Orientation="Vertical" ID="stkPlextorPoweRecMax" Visible="False">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblPlextorPoweRecMax"
Text="Maximum PoweRec speed for currently inserted media"/>
<TextBox ID="txtPlextorPoweRecMax" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
</StackLayout>
<StackLayout Orientation="Vertical" ID="stkPlextorPoweRecLast" Visible="False">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblPlextorPoweRecLast" Text="Last PoweRec used speed"/>
<TextBox ID="txtPlextorPoweRecLast" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
</StackLayout>
</StackLayout>
</StackLayoutItem>
<CheckBox ID="chkPlextorSilentMode" Text="Supports SilentMode" Enabled="False"/>
<CheckBox ID="chkPlextorSilentModeEnabled" Text="SilentMode is enabled" Enabled="False"
Visible="False"/>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Vertical" ID="stkPlextorSilentModeEnabled" Visible="False">
<StackLayoutItem HorizontalAlignment="Stretch">
<Label ID="lblPlextorSilentModeAccessTime" Text="Access time is fast/slow"/>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblPlextorSilentModeCdReadSpeedLimit"
Text="CD read speed limited to"/>
<TextBox ID="txtPlextorSilentModeCdReadSpeedLimit" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblPlextorSilentModeCdWriteSpeedLimit"
Text="CD write speed limited to"/>
<TextBox ID="txtPlextorSilentModeCdWriteSpeedLimit" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
<StackLayout Orientation="Vertical" ID="stkPlextorSilentModeDvdReadSpeedLimit"
Visible="False">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label ID="lblPlextorSilentModeDvdReadSpeedLimit"
Text="DVD read speed limited to"/>
<TextBox ID="txtPlextorSilentModeDvdReadSpeedLimit" ReadOnly="True"/>
</StackLayout>
</StackLayoutItem>
</StackLayout>
</StackLayout>
</StackLayoutItem>
<CheckBox ID="chkPlextorGigaRec" Text="Supports GigaRec" Enabled="False"/>
<CheckBox ID="chkPlextorSecuRec" Text="Supports SecuRec" Enabled="False"/>
<CheckBox ID="chkPlextorSpeedRead" Text="Supports SpeedRead" Enabled="False"/>
<CheckBox ID="chkPlextorSpeedEnabled" Text="SpeedRead is enabled" Enabled="False"
Visible="False"/>
<CheckBox ID="chkPlextorHiding" Text="Supports hiding CD-Rs and sessions" Enabled="False"/>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Vertical" ID="stkPlextorHiding" Visible="False">
<StackLayoutItem HorizontalAlignment="Stretch">
<CheckBox ID="chkPlextorHidesRecordables" Text="Is hiding CD-Rs" Enabled="False"/>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<CheckBox ID="chkPlextorHidesSessions" Text="Is forcing only first session"
Enabled="False"/>
</StackLayoutItem>
</StackLayout>
</StackLayoutItem>
<CheckBox ID="chkPlextorVariRec" Text="Supports VariRec" Enabled="False"/>
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Vertical" ID="stkPlextorDvd" Visible="False">
<StackLayoutItem HorizontalAlignment="Stretch">
<CheckBox ID="chkPlextorVariRecDvd" Text="Supports VariRec on DVDs"
Enabled="False"/>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<CheckBox ID="chkPlextorBitSetting" Text="Supports bitsetting DVD+R book type"
Enabled="False"/>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<CheckBox ID="chkPlextorBitSettingDl" Text="Supports bitsetting DVD+R DL book type"
Enabled="False"/>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch">
<CheckBox ID="chkPlextorDvdPlusWriteTest" Text="Supports test writing DVD+"
Enabled="False"/>
</StackLayoutItem>
</StackLayout>
</StackLayoutItem>
</StackLayout>
</TabPage>
<TabPage ID="tabKreon" Text="Kreon" Visible="False">
<StackLayout Orientation="Vertical">
<CheckBox ID="chkKreonChallengeResponse" Text="Can do challenge/response with Xbox discs"
Enabled="False"/>
<CheckBox ID="chkKreonDecryptSs" Text="Can read and descrypt SS from Xbox discs"
Enabled="False"/>
<CheckBox ID="chkKreonXtremeUnlock" Text="Can set xtreme unlock state with Xbox discs"
Enabled="False"/>
<CheckBox ID="chkKreonWxripperUnlock" Text="Can set wxripper unlock state with Xbox discs"
Enabled="False"/>
<CheckBox ID="chkKreonChallengeResponse360" Text="Can do challenge/response with Xbox 360 discs"
Enabled="False"/>
<CheckBox ID="chkKreonDecryptSs360" Text="Can read and descrypt SS from Xbox 360 discs"
Enabled="False"/>
<CheckBox ID="chkKreonXtremeUnlock360" Text="Can set xtreme unlock state with Xbox 360 discs"
Enabled="False"/>
<CheckBox ID="chkKreonWxripperUnlock360"
Text="Can set wxripper unlock state with Xbox 360 discs" Enabled="False"/>
<CheckBox ID="chkKreonLock" Text="Can set locked state" Enabled="False"/>
<CheckBox ID="chkKreonErrorSkipping" Text="Can skip read errors" Enabled="False"/>
</StackLayout>
</TabPage>
<TabPage ID="tabSsc" Text="SSC" Visible="False">
<StackLayout Orientation="Vertical">
<StackLayout Orientation="Vertical" ID="stkBlockLimits" Visible="False">
<Label ID="lblMinBlockSize" Visible="False"/>
<Label ID="lblMaxBlockSize" Visible="False"/>
<Label ID="lblBlockSizeGranularity" Visible="False"/>
</StackLayout>
<StackLayout Orientation="Vertical" ID="stkDensities" Visible="False">
<Label ID="lblDensities" Text="Densities supported by device:"/>
<TextArea ID="txtDensities" ReadOnly="True"/>
</StackLayout>
<StackLayout Orientation="Vertical" ID="stkMediaTypes" Visible="False">
<Label ID="lblMediumTypes" Text="Medium types supported by device:"/>
<TextArea ID="txtMediumTypes" ReadOnly="True"/>
</StackLayout>
<TextArea ID="txtMediumDensity" ReadOnly="True" Visible="False"/>
</StackLayout>
</TabPage>
<TabPage ID="tabSecureDigital" Text="SD/MMC" Visible="False">
<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>
</TabControl>
</StackLayoutItem>
</StackLayout>
</Panel>

View File

@@ -1,470 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : pnlDeviceInfo.xeto.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Device information.
//
// --[ Description ] ----------------------------------------------------------
//
// Implements the device 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 Aaru.Core.Devices.Info;
using Aaru.Gui.Tabs;
using Eto.Forms;
using Eto.Serialization.Xaml;
namespace Aaru.Gui.Panels
{
public class pnlDeviceInfo : Panel
{
readonly DeviceInfo devInfo;
public pnlDeviceInfo(DeviceInfo devInfo)
{
XamlReader.Load(this);
this.devInfo = devInfo;
txtType.Text = devInfo.Type.ToString();
txtManufacturer.Text = devInfo.Manufacturer;
txtModel.Text = devInfo.Model;
txtRevision.Text = devInfo.FirmwareRevision;
txtSerial.Text = devInfo.Serial;
txtScsiType.Text = devInfo.ScsiType.ToString();
chkRemovable.Checked = devInfo.IsRemovable;
chkUsb.Checked = devInfo.IsUsb;
if(devInfo.IsUsb)
{
tabUsb.Visible = true;
btnSaveUsbDescriptors.Enabled = devInfo.UsbDescriptors != null;
txtUsbVendorId.Text = $"{devInfo.UsbVendorId:X4}";
txtUsbProductId.Text = $"{devInfo.UsbProductId:X4}";
txtUsbManufacturer.Text = devInfo.UsbManufacturerString;
txtUsbProduct.Text = devInfo.UsbProductString;
txtUsbSerial.Text = devInfo.UsbSerialString;
}
if(devInfo.IsFireWire)
{
tabFirewire.Visible = true;
txtFirewireVendorId.Text = $"{devInfo.FireWireVendor:X4}";
txtFirewireModelId.Text = $"{devInfo.FireWireModel:X4}";
txtFirewireManufacturer.Text = devInfo.FireWireVendorName;
txtFirewireModel.Text = devInfo.FireWireModelName;
txtFirewireGuid.Text = $"{devInfo.FireWireGuid:X16}";
}
/*
if(devInfo.IsPcmcia)
{
var tabPcmciaInfo = new tabPcmciaInfo();
tabPcmciaInfo.LoadData(devInfo.Cis);
tabInfos.Pages.Add(tabPcmciaInfo);
}
*/
/*
if(devInfo.AtaIdentify != null ||
devInfo.AtapiIdentify != null)
{
var tabAtaInfo = new tabAtaInfo();
tabAtaInfo.LoadData(devInfo.AtaIdentify, devInfo.AtapiIdentify, devInfo.AtaMcptError);
tabInfos.Pages.Add(tabAtaInfo);
}
*/
/*
if(devInfo.ScsiInquiryData != null)
{
var tabScsiInfo = new tabScsiInfo();
tabScsiInfo.LoadData(devInfo.ScsiInquiryData, devInfo.ScsiInquiry, devInfo.ScsiEvpdPages,
devInfo.ScsiMode, devInfo.ScsiType, devInfo.ScsiModeSense6,
devInfo.ScsiModeSense10, devInfo.MmcConfiguration);
tabInfos.Pages.Add(tabScsiInfo);
if(devInfo.PlextorFeatures != null)
{
tabPlextor.Visible = true;
if(devInfo.PlextorFeatures.Eeprom != null)
{
stkPlextorEeprom.Visible = true;
txtPlextorDiscs.Text = $"{devInfo.PlextorFeatures.Discs}";
txtPlextorCdReadTime.Text = TimeSpan.FromSeconds(devInfo.PlextorFeatures.CdReadTime).ToString();
txtPlextorCdWriteTime.Text =
TimeSpan.FromSeconds(devInfo.PlextorFeatures.CdWriteTime).ToString();
if(devInfo.PlextorFeatures.IsDvd)
{
stkPlextorDvdTimes.Visible = true;
txtPlextorDvdReadTime.Text =
TimeSpan.FromSeconds(devInfo.PlextorFeatures.DvdReadTime).ToString();
txtPlextorDvdWriteTime.Text =
TimeSpan.FromSeconds(devInfo.PlextorFeatures.DvdWriteTime).ToString();
}
}
chkPlextorPoweRec.Checked = devInfo.PlextorFeatures.PoweRec;
if(devInfo.PlextorFeatures.PoweRec)
{
chkPlextorPoweRecEnabled.Visible = true;
chkPlextorPoweRecEnabled.Checked = devInfo.PlextorFeatures.PoweRecEnabled;
if(devInfo.PlextorFeatures.PoweRecEnabled)
{
stkPlextorPoweRecEnabled.Visible = true;
if(devInfo.PlextorFeatures.PoweRecRecommendedSpeed > 0)
{
stkPlextorPoweRecRecommended.Visible = true;
txtPlextorPoweRecRecommended.Text =
$"{devInfo.PlextorFeatures.PoweRecRecommendedSpeed} Kb/sec.";
}
if(devInfo.PlextorFeatures.PoweRecSelected > 0)
{
stkPlextorPoweRecSelected.Visible = true;
txtPlextorPoweRecSelected.Text = $"{devInfo.PlextorFeatures.PoweRecSelected} Kb/sec.";
}
if(devInfo.PlextorFeatures.PoweRecMax > 0)
{
stkPlextorPoweRecMax.Visible = true;
txtPlextorPoweRecMax.Text = $"{devInfo.PlextorFeatures.PoweRecMax} Kb/sec.";
}
if(devInfo.PlextorFeatures.PoweRecLast > 0)
{
stkPlextorPoweRecLast.Visible = true;
txtPlextorPoweRecLast.Text = $"{devInfo.PlextorFeatures.PoweRecLast} Kb/sec.";
}
}
}
chkPlextorSilentMode.Checked = devInfo.PlextorFeatures.SilentMode;
if(devInfo.PlextorFeatures.SilentMode)
{
chkPlextorSilentModeEnabled.Visible = true;
chkPlextorSilentModeEnabled.Checked = devInfo.PlextorFeatures.SilentModeEnabled;
if(devInfo.PlextorFeatures.SilentModeEnabled)
{
lblPlextorSilentModeAccessTime.Text = devInfo.PlextorFeatures.AccessTimeLimit == 2
? "\tAccess time is slow"
: "\tAccess time is fast";
txtPlextorSilentModeCdReadSpeedLimit.Text =
devInfo.PlextorFeatures.CdReadSpeedLimit > 0
? $"{devInfo.PlextorFeatures.CdReadSpeedLimit}x" : "unlimited";
txtPlextorSilentModeCdWriteSpeedLimit.Text =
devInfo.PlextorFeatures.CdWriteSpeedLimit > 0
? $"{devInfo.PlextorFeatures.CdReadSpeedLimit}x" : "unlimited";
if(devInfo.PlextorFeatures.IsDvd)
{
stkPlextorSilentModeDvdReadSpeedLimit.Visible = true;
txtPlextorSilentModeDvdReadSpeedLimit.Text =
devInfo.PlextorFeatures.DvdReadSpeedLimit > 0
? $"{devInfo.PlextorFeatures.DvdReadSpeedLimit}x" : "unlimited";
}
}
}
chkPlextorGigaRec.Checked = devInfo.PlextorFeatures.GigaRec;
chkPlextorSecuRec.Checked = devInfo.PlextorFeatures.SecuRec;
chkPlextorSpeedRead.Checked = devInfo.PlextorFeatures.SpeedRead;
if(devInfo.PlextorFeatures.SpeedRead)
{
chkPlextorSpeedEnabled.Visible = true;
chkPlextorSpeedEnabled.Checked = devInfo.PlextorFeatures.SpeedReadEnabled;
}
chkPlextorHiding.Checked = devInfo.PlextorFeatures.Hiding;
if(devInfo.PlextorFeatures.Hiding)
{
stkPlextorHiding.Visible = true;
chkPlextorHidesRecordables.Checked = devInfo.PlextorFeatures.HidesRecordables;
chkPlextorHidesSessions.Checked = devInfo.PlextorFeatures.HidesSessions;
}
chkPlextorVariRec.Checked = devInfo.PlextorFeatures.VariRec;
if(devInfo.PlextorFeatures.IsDvd)
{
stkPlextorDvd.Visible = true;
chkPlextorVariRecDvd.Checked = devInfo.PlextorFeatures.VariRecDvd;
chkPlextorBitSetting.Checked = devInfo.PlextorFeatures.BitSetting;
chkPlextorBitSettingDl.Checked = devInfo.PlextorFeatures.BitSettingDl;
chkPlextorDvdPlusWriteTest.Checked = devInfo.PlextorFeatures.DvdPlusWriteTest;
}
}
if(devInfo.ScsiInquiry?.KreonPresent == true)
{
tabKreon.Visible = true;
chkKreonChallengeResponse.Checked = devInfo.KreonFeatures.HasFlag(KreonFeatures.ChallengeResponse);
chkKreonDecryptSs.Checked = devInfo.KreonFeatures.HasFlag(KreonFeatures.DecryptSs);
chkKreonXtremeUnlock.Checked = devInfo.KreonFeatures.HasFlag(KreonFeatures.XtremeUnlock);
chkKreonWxripperUnlock.Checked = devInfo.KreonFeatures.HasFlag(KreonFeatures.WxripperUnlock);
chkKreonChallengeResponse360.Checked =
devInfo.KreonFeatures.HasFlag(KreonFeatures.ChallengeResponse360);
chkKreonDecryptSs360.Checked = devInfo.KreonFeatures.HasFlag(KreonFeatures.DecryptSs360);
chkKreonXtremeUnlock360.Checked = devInfo.KreonFeatures.HasFlag(KreonFeatures.XtremeUnlock360);
chkKreonWxripperUnlock360.Checked = devInfo.KreonFeatures.HasFlag(KreonFeatures.WxripperUnlock360);
chkKreonLock.Checked = devInfo.KreonFeatures.HasFlag(KreonFeatures.Lock);
chkKreonErrorSkipping.Checked = devInfo.KreonFeatures.HasFlag(KreonFeatures.ErrorSkipping);
}
if(devInfo.BlockLimits != null)
{
BlockLimits.BlockLimitsData? blockLimits = BlockLimits.Decode(devInfo.BlockLimits);
if(blockLimits.HasValue)
{
tabSsc.Visible = true;
if(blockLimits.Value.minBlockLen == blockLimits.Value.maxBlockLen)
{
lblMinBlockSize.Visible = true;
lblMinBlockSize.Text =
$"Device's block size is fixed at {blockLimits.Value.minBlockLen} bytes";
}
else
{
lblMinBlockSize.Visible = true;
lblMaxBlockSize.Visible = true;
lblMaxBlockSize.Text = blockLimits.Value.maxBlockLen > 0
? $"Device's maximum block size is {blockLimits.Value.maxBlockLen} bytes"
: "Device does not specify a maximum block size";
lblMinBlockSize.Text =
$"Device's minimum block size is {blockLimits.Value.minBlockLen} bytes";
if(blockLimits.Value.granularity > 0)
{
lblBlockSizeGranularity.Visible = true;
lblBlockSizeGranularity.Text =
$"Device's needs a block size granularity of 2^{blockLimits.Value.granularity} ({Math.Pow(2, blockLimits.Value.granularity)}) bytes";
}
}
}
}
if(devInfo.DensitySupport != null)
if(devInfo.DensitySupportHeader.HasValue)
{
stkDensities.Visible = true;
txtDensities.Text = DensitySupport.PrettifyDensity(devInfo.DensitySupportHeader);
}
if(devInfo.MediumDensitySupport != null)
{
if(devInfo.MediaTypeSupportHeader.HasValue)
{
stkMediaTypes.Visible = true;
txtMediumTypes.Text = DensitySupport.PrettifyMediumType(devInfo.MediaTypeSupportHeader);
}
txtMediumDensity.Visible = true;
txtMediumDensity.Text = DensitySupport.PrettifyMediumType(devInfo.MediumDensitySupport);
}
}
*/
/*
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)
{
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(devInfo.UsbDescriptors, 0, devInfo.UsbDescriptors.Length);
saveFs.Close();
}
#region XAML controls
#pragma warning disable 169
#pragma warning disable 649
Label lblDeviceInfo;
TabControl tabInfos;
TabPage tabGeneral;
Label lblType;
TextBox txtType;
Label lblManufacturer;
TextBox txtManufacturer;
Label lblModel;
TextBox txtModel;
Label lblRevision;
TextBox txtRevision;
Label lblSerial;
TextBox txtSerial;
Label lblScsiType;
TextBox txtScsiType;
CheckBox chkRemovable;
CheckBox chkUsb;
TabPage tabKreon;
CheckBox chkKreonChallengeResponse;
CheckBox chkKreonDecryptSs;
CheckBox chkKreonXtremeUnlock;
CheckBox chkKreonWxripperUnlock;
CheckBox chkKreonChallengeResponse360;
CheckBox chkKreonDecryptSs360;
CheckBox chkKreonXtremeUnlock360;
CheckBox chkKreonWxripperUnlock360;
CheckBox chkKreonLock;
CheckBox chkKreonErrorSkipping;
TabPage tabPlextor;
StackLayout stkPlextorEeprom;
Label lblPlextorDiscs;
TextBox txtPlextorDiscs;
Label lblPlextorCdReadTime;
TextBox txtPlextorCdReadTime;
Label lblPlextorCdWriteTime;
TextBox txtPlextorCdWriteTime;
StackLayout stkPlextorDvdTimes;
Label lblPlextorDvdReadTime;
TextBox txtPlextorDvdReadTime;
Label lblPlextorDvdWriteTime;
TextBox txtPlextorDvdWriteTime;
CheckBox chkPlextorPoweRec;
CheckBox chkPlextorPoweRecEnabled;
StackLayout stkPlextorPoweRecEnabled;
StackLayout stkPlextorPoweRecRecommended;
Label lblPlextorPoweRecRecommended;
TextBox txtPlextorPoweRecRecommended;
StackLayout stkPlextorPoweRecSelected;
Label lblPlextorPoweRecSelected;
TextBox txtPlextorPoweRecSelected;
StackLayout stkPlextorPoweRecMax;
Label lblPlextorPoweRecMax;
TextBox txtPlextorPoweRecMax;
StackLayout stkPlextorPoweRecLast;
Label lblPlextorPoweRecLast;
TextBox txtPlextorPoweRecLast;
CheckBox chkPlextorSilentMode;
CheckBox chkPlextorSilentModeEnabled;
StackLayout stkPlextorSilentModeEnabled;
Label lblPlextorSilentModeAccessTime;
Label lblPlextorSilentModeCdReadSpeedLimit;
TextBox txtPlextorSilentModeCdReadSpeedLimit;
StackLayout stkPlextorSilentModeDvdReadSpeedLimit;
Label lblPlextorSilentModeDvdReadSpeedLimit;
TextBox txtPlextorSilentModeDvdReadSpeedLimit;
Label lblPlextorSilentModeCdWriteSpeedLimit;
TextBox txtPlextorSilentModeCdWriteSpeedLimit;
CheckBox chkPlextorGigaRec;
CheckBox chkPlextorSecuRec;
CheckBox chkPlextorSpeedRead;
CheckBox chkPlextorSpeedEnabled;
CheckBox chkPlextorHiding;
StackLayout stkPlextorHiding;
CheckBox chkPlextorHidesRecordables;
CheckBox chkPlextorHidesSessions;
CheckBox chkPlextorVariRec;
StackLayout stkPlextorDvd;
CheckBox chkPlextorVariRecDvd;
CheckBox chkPlextorBitSetting;
CheckBox chkPlextorBitSettingDl;
CheckBox chkPlextorDvdPlusWriteTest;
TabPage tabSsc;
Label lblMinBlockSize;
Label lblMaxBlockSize;
Label lblBlockSizeGranularity;
StackLayout stkDensities;
Label lblDensities;
TextArea txtDensities;
StackLayout stkMediaTypes;
Label lblMediumTypes;
TextArea txtMediumTypes;
TextArea txtMediumDensity;
TabPage tabUsb;
Label lblUsbVendorId;
TextBox txtUsbVendorId;
Label lblUsbProductId;
TextBox txtUsbProductId;
Label lblUsbManufacturer;
TextBox txtUsbManufacturer;
Label lblUsbProduct;
TextBox txtUsbProduct;
Label lblUsbSerial;
TextBox txtUsbSerial;
Button btnSaveUsbDescriptors;
TabPage tabFirewire;
Label lblFirewireVendorId;
TextBox txtFirewireVendorId;
Label lblFirewireModelId;
TextBox txtFirewireModelId;
Label lblFirewireManufacturer;
TextBox txtFirewireManufacturer;
Label lblFirewireModel;
TextBox txtFirewireModel;
Label lblFirewireGuid;
TextBox txtFirewireGuid;
#pragma warning restore 169
#pragma warning restore 649
#endregion
}
}

View File

@@ -0,0 +1,923 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reactive;
using Aaru.Decoders.SCSI.SSC;
using Aaru.Devices;
using Aaru.Gui.Tabs;
using Avalonia.Controls;
using ReactiveUI;
using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo;
namespace Aaru.Gui.ViewModels
{
public class DeviceInfoViewModel : ViewModelBase
{
readonly Window _view;
readonly DeviceInfo devInfo;
AtaInfoTab _ataInfo;
string _blockLimits;
string _blockSizeGranularity;
string _cid;
string _csd;
string _densities;
string _deviceType;
string _extendedCsd;
string _firewireGuid;
string _firewireManufacturer;
string _firewireModel;
string _firewireModelId;
string _firewireVendorId;
bool _firewireVisible;
bool _kreon;
bool _kreonChallengeResponse;
bool _kreonChallengeResponse360;
bool _kreonDecryptSs;
bool _kreonDecryptSs360;
bool _kreonErrorSkipping;
bool _kreonLock;
bool _kreonWxripperUnlock;
bool _kreonWxripperUnlock360;
bool _kreonXtremeUnlock;
bool _kreonXtremeUnlock360;
string _manufacturer;
string _maxBlockSize;
string _mediumDensity;
string _mediumTypes;
string _minBlockSize;
string _model;
string _ocr;
PcmciaInfoTab _pcmciaInfo;
bool _plextorBitSetting;
bool _plextorBitSettingDl;
string _plextorCdReadTime;
string _plextorCdWriteTime;
string _plextorDiscs;
string _plextorDvd;
bool _plextorDvdPlusWriteTest;
string _plextorDvdReadTime;
bool _plextorDvdTimesVisible;
string _plextorDvdWriteTime;
bool _plextorEepromVisible;
bool _plextorGigaRec;
bool _plextorHidesRecordables;
bool _plextorHidesSessions;
bool _plextorHiding;
bool _plextorPoweRec;
bool _plextorPoweRecEnabled;
string _plextorPoweRecLast;
bool _plextorPoweRecLastVisible;
string _plextorPoweRecMax;
bool _plextorPoweRecMaxVisible;
string _plextorPoweRecRecommended;
bool _plextorPoweRecRecommendedVisible;
string _plextorPoweRecSelected;
bool _plextorPoweRecSelectedVisible;
bool _plextorSecuRec;
bool _plextorSilentMode;
string _plextorSilentModeAccessTime;
string _plextorSilentModeCdReadSpeedLimit;
string _plextorSilentModeCdWriteSpeedLimit;
string _plextorSilentModeDvdReadSpeedLimit;
bool _plextorSilentModeDvdReadSpeedLimitVisible;
bool _plextorSilentModeEnabled;
bool _plextorSpeedEnabled;
bool _plextorSpeedRead;
bool _plextorVariRec;
bool _plextorVariRecDvd;
bool _plextorVisible;
bool _removable;
string _revision;
bool _saveUsbDescriptorsEnabled;
string _scr;
ScsiInfoTab _scsiInfo;
string _scsiType;
string _sdMm;
SdMmcInfoTab _sdMmcInfo;
string _secureDigital;
string _serial;
bool _ssc;
string _usbConnected;
string _usbManufacturer;
string _usbProduct;
string _usbProductId;
string _usbSerial;
string _usbVendorId;
bool _usbVisible;
public DeviceInfoViewModel(DeviceInfo devInfo, Window view)
{
SaveUsbDescriptorsCommand = ReactiveCommand.Create(ExecuteSaveUsbDescriptorsCommand);
_view = view;
this.devInfo = devInfo;
DeviceType = devInfo.Type.ToString();
Manufacturer = devInfo.Manufacturer;
Model = devInfo.Model;
Revision = devInfo.FirmwareRevision;
Serial = devInfo.Serial;
ScsiType = devInfo.ScsiType.ToString();
Removable = devInfo.IsRemovable;
UsbVisible = devInfo.IsUsb;
if(devInfo.IsUsb)
{
UsbVisible = true;
SaveUsbDescriptorsEnabled = devInfo.UsbDescriptors != null;
UsbVendorId = $"{devInfo.UsbVendorId:X4}";
UsbProductId = $"{devInfo.UsbProductId:X4}";
UsbManufacturer = devInfo.UsbManufacturerString;
UsbProduct = devInfo.UsbProductString;
UsbSerial = devInfo.UsbSerialString;
}
if(devInfo.IsFireWire)
{
FirewireVisible = true;
FirewireVendorId = $"{devInfo.FireWireVendor:X4}";
FirewireModelId = $"{devInfo.FireWireModel:X4}";
FirewireManufacturer = devInfo.FireWireVendorName;
FirewireModel = devInfo.FireWireModelName;
FirewireGuid = $"{devInfo.FireWireGuid:X16}";
}
if(devInfo.IsPcmcia)
{
PcmciaInfo = new PcmciaInfoTab
{
DataContext = new PcmciaInfoViewModel(devInfo.Cis, _view)
};
}
if(devInfo.AtaIdentify != null ||
devInfo.AtapiIdentify != null)
{
AtaInfo = new AtaInfoTab
{
DataContext =
new AtaInfoViewModel(devInfo.AtaIdentify, devInfo.AtapiIdentify, devInfo.AtaMcptError, _view)
};
}
if(devInfo.ScsiInquiryData != null)
{
ScsiInfo = new ScsiInfoTab
{
DataContext = new ScsiInfoViewModel(devInfo.ScsiInquiryData, devInfo.ScsiInquiry,
devInfo.ScsiEvpdPages, devInfo.ScsiMode, devInfo.ScsiType,
devInfo.ScsiModeSense6, devInfo.ScsiModeSense10,
devInfo.MmcConfiguration, _view)
};
if(devInfo.PlextorFeatures != null)
{
PlextorVisible = true;
if(devInfo.PlextorFeatures.Eeprom != null)
{
PlextorEepromVisible = true;
PlextorDiscs = $"{devInfo.PlextorFeatures.Discs}";
PlextorCdReadTime = TimeSpan.FromSeconds(devInfo.PlextorFeatures.CdReadTime).ToString();
PlextorCdWriteTime = TimeSpan.FromSeconds(devInfo.PlextorFeatures.CdWriteTime).ToString();
if(devInfo.PlextorFeatures.IsDvd)
{
PlextorDvdTimesVisible = true;
PlextorDvdReadTime = TimeSpan.FromSeconds(devInfo.PlextorFeatures.DvdReadTime).ToString();
PlextorDvdWriteTime = TimeSpan.FromSeconds(devInfo.PlextorFeatures.DvdWriteTime).ToString();
}
}
PlextorPoweRec = devInfo.PlextorFeatures.PoweRec;
if(devInfo.PlextorFeatures.PoweRec)
{
PlextorPoweRecEnabled = devInfo.PlextorFeatures.PoweRecEnabled;
if(devInfo.PlextorFeatures.PoweRecEnabled)
{
PlextorPoweRecEnabled = true;
if(devInfo.PlextorFeatures.PoweRecRecommendedSpeed > 0)
{
PlextorPoweRecRecommendedVisible = true;
PlextorPoweRecRecommended =
$"{devInfo.PlextorFeatures.PoweRecRecommendedSpeed} Kb/sec.";
}
if(devInfo.PlextorFeatures.PoweRecSelected > 0)
{
PlextorPoweRecSelectedVisible = true;
PlextorPoweRecSelected = $"{devInfo.PlextorFeatures.PoweRecSelected} Kb/sec.";
}
if(devInfo.PlextorFeatures.PoweRecMax > 0)
{
PlextorPoweRecMaxVisible = true;
PlextorPoweRecMax = $"{devInfo.PlextorFeatures.PoweRecMax} Kb/sec.";
}
if(devInfo.PlextorFeatures.PoweRecLast > 0)
{
PlextorPoweRecLastVisible = true;
PlextorPoweRecLast = $"{devInfo.PlextorFeatures.PoweRecLast} Kb/sec.";
}
}
}
PlextorSilentMode = devInfo.PlextorFeatures.SilentMode;
if(devInfo.PlextorFeatures.SilentMode)
{
PlextorSilentModeEnabled = devInfo.PlextorFeatures.SilentModeEnabled;
if(devInfo.PlextorFeatures.SilentModeEnabled)
{
PlextorSilentModeAccessTime = devInfo.PlextorFeatures.AccessTimeLimit == 2
? "\tAccess time is slow" : "\tAccess time is fast";
PlextorSilentModeCdReadSpeedLimit =
devInfo.PlextorFeatures.CdReadSpeedLimit > 0
? $"{devInfo.PlextorFeatures.CdReadSpeedLimit}x" : "unlimited";
PlextorSilentModeCdWriteSpeedLimit =
devInfo.PlextorFeatures.CdWriteSpeedLimit > 0
? $"{devInfo.PlextorFeatures.CdReadSpeedLimit}x" : "unlimited";
if(devInfo.PlextorFeatures.IsDvd)
{
PlextorSilentModeDvdReadSpeedLimitVisible = true;
PlextorSilentModeDvdReadSpeedLimit =
devInfo.PlextorFeatures.DvdReadSpeedLimit > 0
? $"{devInfo.PlextorFeatures.DvdReadSpeedLimit}x" : "unlimited";
}
}
}
PlextorGigaRec = devInfo.PlextorFeatures.GigaRec;
PlextorSecuRec = devInfo.PlextorFeatures.SecuRec;
PlextorSpeedRead = devInfo.PlextorFeatures.SpeedRead;
if(devInfo.PlextorFeatures.SpeedRead)
{
PlextorSpeedEnabled = devInfo.PlextorFeatures.SpeedReadEnabled;
}
PlextorHiding = devInfo.PlextorFeatures.Hiding;
if(devInfo.PlextorFeatures.Hiding)
{
PlextorHidesRecordables = devInfo.PlextorFeatures.HidesRecordables;
PlextorHidesSessions = devInfo.PlextorFeatures.HidesSessions;
}
PlextorVariRec = devInfo.PlextorFeatures.VariRec;
if(devInfo.PlextorFeatures.IsDvd)
{
PlextorVariRecDvd = devInfo.PlextorFeatures.VariRecDvd;
PlextorBitSetting = devInfo.PlextorFeatures.BitSetting;
PlextorBitSettingDl = devInfo.PlextorFeatures.BitSettingDl;
PlextorDvdPlusWriteTest = devInfo.PlextorFeatures.DvdPlusWriteTest;
}
}
if(devInfo.ScsiInquiry?.KreonPresent == true)
{
Kreon = true;
KreonChallengeResponse = devInfo.KreonFeatures.HasFlag(KreonFeatures.ChallengeResponse);
KreonDecryptSs = devInfo.KreonFeatures.HasFlag(KreonFeatures.DecryptSs);
KreonXtremeUnlock = devInfo.KreonFeatures.HasFlag(KreonFeatures.XtremeUnlock);
KreonWxripperUnlock = devInfo.KreonFeatures.HasFlag(KreonFeatures.WxripperUnlock);
KreonChallengeResponse360 = devInfo.KreonFeatures.HasFlag(KreonFeatures.ChallengeResponse360);
KreonDecryptSs360 = devInfo.KreonFeatures.HasFlag(KreonFeatures.DecryptSs360);
KreonXtremeUnlock360 = devInfo.KreonFeatures.HasFlag(KreonFeatures.XtremeUnlock360);
KreonWxripperUnlock360 = devInfo.KreonFeatures.HasFlag(KreonFeatures.WxripperUnlock360);
KreonLock = devInfo.KreonFeatures.HasFlag(KreonFeatures.Lock);
KreonErrorSkipping = devInfo.KreonFeatures.HasFlag(KreonFeatures.ErrorSkipping);
}
if(devInfo.BlockLimits != null)
{
BlockLimits.BlockLimitsData?
blockLimits = Decoders.SCSI.SSC.BlockLimits.Decode(devInfo.BlockLimits);
if(blockLimits.HasValue)
{
Ssc = true;
if(blockLimits.Value.minBlockLen == blockLimits.Value.maxBlockLen)
{
MinBlockSize = $"Device's block size is fixed at {blockLimits.Value.minBlockLen} bytes";
}
else
{
MaxBlockSize = blockLimits.Value.maxBlockLen > 0
? $"Device's maximum block size is {blockLimits.Value.maxBlockLen} bytes"
: "Device does not specify a maximum block size";
MinBlockSize = $"Device's minimum block size is {blockLimits.Value.minBlockLen} bytes";
if(blockLimits.Value.granularity > 0)
{
BlockSizeGranularity =
$"Device's needs a block size granularity of 2^{blockLimits.Value.granularity} ({Math.Pow(2, blockLimits.Value.granularity)}) bytes";
}
}
}
}
if(devInfo.DensitySupport != null)
if(devInfo.DensitySupportHeader.HasValue)
{
Densities = DensitySupport.PrettifyDensity(devInfo.DensitySupportHeader);
}
if(devInfo.MediumDensitySupport != null)
{
if(devInfo.MediaTypeSupportHeader.HasValue)
{
MediumTypes = DensitySupport.PrettifyMediumType(devInfo.MediaTypeSupportHeader);
}
MediumDensity = DensitySupport.PrettifyMediumType(devInfo.MediumDensitySupport);
}
}
SdMmcInfo = new SdMmcInfoTab
{
DataContext = new SdMmcInfoViewModel(devInfo.Type, devInfo.CID, devInfo.CSD, devInfo.OCR,
devInfo.ExtendedCSD, devInfo.SCR)
};
}
public ReactiveCommand<Unit, Unit> SaveUsbDescriptorsCommand { get; }
public string DeviceType
{
get => _deviceType;
set => this.RaiseAndSetIfChanged(ref _deviceType, value);
}
public string Manufacturer
{
get => _manufacturer;
set => this.RaiseAndSetIfChanged(ref _manufacturer, value);
}
public string Model
{
get => _model;
set => this.RaiseAndSetIfChanged(ref _model, value);
}
public string Revision
{
get => _revision;
set => this.RaiseAndSetIfChanged(ref _revision, value);
}
public string Serial
{
get => _serial;
set => this.RaiseAndSetIfChanged(ref _serial, value);
}
public string ScsiType
{
get => _scsiType;
set => this.RaiseAndSetIfChanged(ref _scsiType, value);
}
public bool Removable
{
get => _removable;
set => this.RaiseAndSetIfChanged(ref _removable, value);
}
public string UsbConnected
{
get => _usbConnected;
set => this.RaiseAndSetIfChanged(ref _usbConnected, value);
}
public bool UsbVisible
{
get => _usbVisible;
set => this.RaiseAndSetIfChanged(ref _usbVisible, value);
}
public string UsbVendorId
{
get => _usbVendorId;
set => this.RaiseAndSetIfChanged(ref _usbVendorId, value);
}
public string UsbProductId
{
get => _usbProductId;
set => this.RaiseAndSetIfChanged(ref _usbProductId, value);
}
public string UsbManufacturer
{
get => _usbManufacturer;
set => this.RaiseAndSetIfChanged(ref _usbManufacturer, value);
}
public string UsbProduct
{
get => _usbProduct;
set => this.RaiseAndSetIfChanged(ref _usbProduct, value);
}
public string UsbSerial
{
get => _usbSerial;
set => this.RaiseAndSetIfChanged(ref _usbSerial, value);
}
public bool SaveUsbDescriptorsEnabled
{
get => _saveUsbDescriptorsEnabled;
set => this.RaiseAndSetIfChanged(ref _saveUsbDescriptorsEnabled, value);
}
public bool FirewireVisible
{
get => _firewireVisible;
set => this.RaiseAndSetIfChanged(ref _firewireVisible, value);
}
public string FirewireVendorId
{
get => _firewireVendorId;
set => this.RaiseAndSetIfChanged(ref _firewireVendorId, value);
}
public string FirewireModelId
{
get => _firewireModelId;
set => this.RaiseAndSetIfChanged(ref _firewireModelId, value);
}
public string FirewireManufacturer
{
get => _firewireManufacturer;
set => this.RaiseAndSetIfChanged(ref _firewireManufacturer, value);
}
public string FirewireModel
{
get => _firewireModel;
set => this.RaiseAndSetIfChanged(ref _firewireModel, value);
}
public string FirewireGuid
{
get => _firewireGuid;
set => this.RaiseAndSetIfChanged(ref _firewireGuid, value);
}
public bool PlextorVisible
{
get => _plextorVisible;
set => this.RaiseAndSetIfChanged(ref _plextorVisible, value);
}
public bool PlextorEepromVisible
{
get => _plextorEepromVisible;
set => this.RaiseAndSetIfChanged(ref _plextorEepromVisible, value);
}
public string PlextorDiscs
{
get => _plextorDiscs;
set => this.RaiseAndSetIfChanged(ref _plextorDiscs, value);
}
public string PlextorCdReadTime
{
get => _plextorCdReadTime;
set => this.RaiseAndSetIfChanged(ref _plextorCdReadTime, value);
}
public string PlextorCdWriteTime
{
get => _plextorCdWriteTime;
set => this.RaiseAndSetIfChanged(ref _plextorCdWriteTime, value);
}
public bool PlextorDvdTimesVisible
{
get => _plextorDvdTimesVisible;
set => this.RaiseAndSetIfChanged(ref _plextorDvdTimesVisible, value);
}
public string PlextorDvdReadTime
{
get => _plextorDvdReadTime;
set => this.RaiseAndSetIfChanged(ref _plextorDvdReadTime, value);
}
public string PlextorDvdWriteTime
{
get => _plextorDvdWriteTime;
set => this.RaiseAndSetIfChanged(ref _plextorDvdWriteTime, value);
}
public bool PlextorPoweRec
{
get => _plextorPoweRec;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRec, value);
}
public bool PlextorPoweRecEnabled
{
get => _plextorPoweRecEnabled;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecEnabled, value);
}
public bool PlextorPoweRecRecommendedVisible
{
get => _plextorPoweRecRecommendedVisible;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecRecommendedVisible, value);
}
public string PlextorPoweRecRecommended
{
get => _plextorPoweRecRecommended;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecRecommended, value);
}
public bool PlextorPoweRecSelectedVisible
{
get => _plextorPoweRecSelectedVisible;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecSelectedVisible, value);
}
public string PlextorPoweRecSelected
{
get => _plextorPoweRecSelected;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecSelected, value);
}
public bool PlextorPoweRecMaxVisible
{
get => _plextorPoweRecMaxVisible;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecMaxVisible, value);
}
public string PlextorPoweRecMax
{
get => _plextorPoweRecMax;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecMax, value);
}
public bool PlextorPoweRecLastVisible
{
get => _plextorPoweRecLastVisible;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecLastVisible, value);
}
public string PlextorPoweRecLast
{
get => _plextorPoweRecLast;
set => this.RaiseAndSetIfChanged(ref _plextorPoweRecLast, value);
}
public bool PlextorSilentMode
{
get => _plextorSilentMode;
set => this.RaiseAndSetIfChanged(ref _plextorSilentMode, value);
}
public bool PlextorSilentModeEnabled
{
get => _plextorSilentModeEnabled;
set => this.RaiseAndSetIfChanged(ref _plextorSilentModeEnabled, value);
}
public string PlextorSilentModeAccessTime
{
get => _plextorSilentModeAccessTime;
set => this.RaiseAndSetIfChanged(ref _plextorSilentModeAccessTime, value);
}
public string PlextorSilentModeCdReadSpeedLimit
{
get => _plextorSilentModeCdReadSpeedLimit;
set => this.RaiseAndSetIfChanged(ref _plextorSilentModeCdReadSpeedLimit, value);
}
public string PlextorSilentModeCdWriteSpeedLimit
{
get => _plextorSilentModeCdWriteSpeedLimit;
set => this.RaiseAndSetIfChanged(ref _plextorSilentModeCdWriteSpeedLimit, value);
}
public bool PlextorSilentModeDvdReadSpeedLimitVisible
{
get => _plextorSilentModeDvdReadSpeedLimitVisible;
set => this.RaiseAndSetIfChanged(ref _plextorSilentModeDvdReadSpeedLimitVisible, value);
}
public string PlextorSilentModeDvdReadSpeedLimit
{
get => _plextorSilentModeDvdReadSpeedLimit;
set => this.RaiseAndSetIfChanged(ref _plextorSilentModeDvdReadSpeedLimit, value);
}
public bool PlextorGigaRec
{
get => _plextorGigaRec;
set => this.RaiseAndSetIfChanged(ref _plextorGigaRec, value);
}
public bool PlextorSecuRec
{
get => _plextorSecuRec;
set => this.RaiseAndSetIfChanged(ref _plextorSecuRec, value);
}
public bool PlextorSpeedRead
{
get => _plextorSpeedRead;
set => this.RaiseAndSetIfChanged(ref _plextorSpeedRead, value);
}
public bool PlextorSpeedEnabled
{
get => _plextorSpeedEnabled;
set => this.RaiseAndSetIfChanged(ref _plextorSpeedEnabled, value);
}
public bool PlextorHiding
{
get => _plextorHiding;
set => this.RaiseAndSetIfChanged(ref _plextorHiding, value);
}
public bool PlextorHidesRecordables
{
get => _plextorHidesRecordables;
set => this.RaiseAndSetIfChanged(ref _plextorHidesRecordables, value);
}
public bool PlextorHidesSessions
{
get => _plextorHidesSessions;
set => this.RaiseAndSetIfChanged(ref _plextorHidesSessions, value);
}
public bool PlextorVariRec
{
get => _plextorVariRec;
set => this.RaiseAndSetIfChanged(ref _plextorVariRec, value);
}
public string PlextorDvd
{
get => _plextorDvd;
set => this.RaiseAndSetIfChanged(ref _plextorDvd, value);
}
public bool PlextorVariRecDvd
{
get => _plextorVariRecDvd;
set => this.RaiseAndSetIfChanged(ref _plextorVariRecDvd, value);
}
public bool PlextorBitSetting
{
get => _plextorBitSetting;
set => this.RaiseAndSetIfChanged(ref _plextorBitSetting, value);
}
public bool PlextorBitSettingDl
{
get => _plextorBitSettingDl;
set => this.RaiseAndSetIfChanged(ref _plextorBitSettingDl, value);
}
public bool PlextorDvdPlusWriteTest
{
get => _plextorDvdPlusWriteTest;
set => this.RaiseAndSetIfChanged(ref _plextorDvdPlusWriteTest, value);
}
public bool Kreon
{
get => _kreon;
set => this.RaiseAndSetIfChanged(ref _kreon, value);
}
public bool KreonChallengeResponse
{
get => _kreonChallengeResponse;
set => this.RaiseAndSetIfChanged(ref _kreonChallengeResponse, value);
}
public bool KreonDecryptSs
{
get => _kreonDecryptSs;
set => this.RaiseAndSetIfChanged(ref _kreonDecryptSs, value);
}
public bool KreonXtremeUnlock
{
get => _kreonXtremeUnlock;
set => this.RaiseAndSetIfChanged(ref _kreonXtremeUnlock, value);
}
public bool KreonWxripperUnlock
{
get => _kreonWxripperUnlock;
set => this.RaiseAndSetIfChanged(ref _kreonWxripperUnlock, value);
}
public bool KreonChallengeResponse360
{
get => _kreonChallengeResponse360;
set => this.RaiseAndSetIfChanged(ref _kreonChallengeResponse360, value);
}
public bool KreonDecryptSs360
{
get => _kreonDecryptSs360;
set => this.RaiseAndSetIfChanged(ref _kreonDecryptSs360, value);
}
public bool KreonXtremeUnlock360
{
get => _kreonXtremeUnlock360;
set => this.RaiseAndSetIfChanged(ref _kreonXtremeUnlock360, value);
}
public bool KreonWxripperUnlock360
{
get => _kreonWxripperUnlock360;
set => this.RaiseAndSetIfChanged(ref _kreonWxripperUnlock360, value);
}
public bool KreonLock
{
get => _kreonLock;
set => this.RaiseAndSetIfChanged(ref _kreonLock, value);
}
public bool KreonErrorSkipping
{
get => _kreonErrorSkipping;
set => this.RaiseAndSetIfChanged(ref _kreonErrorSkipping, value);
}
public bool Ssc
{
get => _ssc;
set => this.RaiseAndSetIfChanged(ref _ssc, value);
}
public string BlockLimits
{
get => _blockLimits;
set => this.RaiseAndSetIfChanged(ref _blockLimits, value);
}
public string MinBlockSize
{
get => _minBlockSize;
set => this.RaiseAndSetIfChanged(ref _minBlockSize, value);
}
public string MaxBlockSize
{
get => _maxBlockSize;
set => this.RaiseAndSetIfChanged(ref _maxBlockSize, value);
}
public string BlockSizeGranularity
{
get => _blockSizeGranularity;
set => this.RaiseAndSetIfChanged(ref _blockSizeGranularity, value);
}
public string Densities
{
get => _densities;
set => this.RaiseAndSetIfChanged(ref _densities, value);
}
public string MediumTypes
{
get => _mediumTypes;
set => this.RaiseAndSetIfChanged(ref _mediumTypes, value);
}
public string MediumDensity
{
get => _mediumDensity;
set => this.RaiseAndSetIfChanged(ref _mediumDensity, value);
}
public string SecureDigital
{
get => _secureDigital;
set => this.RaiseAndSetIfChanged(ref _secureDigital, value);
}
public string SdMm
{
get => _sdMm;
set => this.RaiseAndSetIfChanged(ref _sdMm, value);
}
public string Cid
{
get => _cid;
set => this.RaiseAndSetIfChanged(ref _cid, value);
}
public string Csd
{
get => _csd;
set => this.RaiseAndSetIfChanged(ref _csd, value);
}
public string Ocr
{
get => _ocr;
set => this.RaiseAndSetIfChanged(ref _ocr, value);
}
public string ExtendedCsd
{
get => _extendedCsd;
set => this.RaiseAndSetIfChanged(ref _extendedCsd, value);
}
public string Scr
{
get => _scr;
set => this.RaiseAndSetIfChanged(ref _scr, value);
}
public PcmciaInfoTab PcmciaInfo
{
get => _pcmciaInfo;
set => this.RaiseAndSetIfChanged(ref _pcmciaInfo, value);
}
public ScsiInfoTab ScsiInfo
{
get => _scsiInfo;
set => this.RaiseAndSetIfChanged(ref _scsiInfo, value);
}
public AtaInfoTab AtaInfo
{
get => _ataInfo;
set => this.RaiseAndSetIfChanged(ref _ataInfo, value);
}
public SdMmcInfoTab SdMmcInfo
{
get => _sdMmcInfo;
set => this.RaiseAndSetIfChanged(ref _sdMmcInfo, value);
}
async void ExecuteSaveUsbDescriptorsCommand()
{
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(devInfo.UsbDescriptors, 0, devInfo.UsbDescriptors.Length);
saveFs.Close();
}
}
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reactive;
@@ -25,6 +26,7 @@ using Avalonia.Platform;
using MessageBox.Avalonia;
using MessageBox.Avalonia.Enums;
using ReactiveUI;
using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo;
using PlatformID = Aaru.CommonTypes.Interop.PlatformID;
namespace Aaru.Gui.ViewModels
@@ -166,6 +168,8 @@ namespace Aaru.Gui.ViewModels
if(value == _treeViewSelectedItem)
return;
this.RaiseAndSetIfChanged(ref _treeViewSelectedItem, value);
if(value is ImageModel imageModel)
ContentPanel = new ImageInfoPanel
{
@@ -192,7 +196,49 @@ namespace Aaru.Gui.ViewModels
};
}
this.RaiseAndSetIfChanged(ref _treeViewSelectedItem, value);
if(value is DeviceModel deviceModel)
{
if(deviceModel.ViewModel is null)
{
try
{
var dev = new Device(deviceModel.Path);
if(dev.IsRemote)
Statistics.AddRemote(dev.RemoteApplication, dev.RemoteVersion,
dev.RemoteOperatingSystem, dev.RemoteOperatingSystemVersion,
dev.RemoteArchitecture);
if(dev.Error)
{
ContentPanel = $"Error {dev.LastError} opening device";
return;
}
var devInfo = new DeviceInfo(dev);
deviceModel.ViewModel = new DeviceInfoViewModel(devInfo, _view);
dev.Close();
}
catch(SystemException ex)
{
if(Debugger.IsAttached)
throw;
ContentPanel = ex.Message;
AaruConsole.ErrorWriteLine(ex.Message);
return;
}
}
ContentPanel = new DeviceInfoPanel
{
DataContext = deviceModel.ViewModel
};
}
}
}
@@ -625,8 +671,9 @@ namespace Aaru.Gui.ViewModels
AaruConsole.WriteLine("Refreshing devices");
_devicesRoot.Devices.Clear();
foreach(DeviceInfo device in Device.ListDevices().Where(d => d.Supported).OrderBy(d => d.Vendor).
ThenBy(d => d.Model))
foreach(Devices.DeviceInfo device in Device.
ListDevices().Where(d => d.Supported).OrderBy(d => d.Vendor).
ThenBy(d => d.Model))
{
AaruConsole.DebugWriteLine("Main window",
"Found supported device model {0} by manufacturer {1} on bus {2} and path {3}",

View File

@@ -231,6 +231,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=ecsd/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=eeprom/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=EVPD/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Firewire/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=formatlayers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=getconfiguration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=hddvd/@EntryIndexedValue">True</s:Boolean>