mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Migrate SCSI info from Eto.Forms to Avalonia.
This commit is contained in:
6
.idea/.idea.Aaru/.idea/contentModel.xml
generated
6
.idea/.idea.Aaru/.idea/contentModel.xml
generated
@@ -1254,6 +1254,7 @@
|
||||
<e p="PartitionSchemeModel.cs" t="Include" />
|
||||
<e p="PluginModel.cs" t="Include" />
|
||||
<e p="RootModel.cs" t="Include" />
|
||||
<e p="ScsiPageModel.cs" t="Include" />
|
||||
</e>
|
||||
<e p="obj" t="ExcludeRecursive">
|
||||
<e p="Debug" t="Include">
|
||||
@@ -1281,6 +1282,8 @@
|
||||
</e>
|
||||
<e p="ResourceHandler.cs" t="Include" />
|
||||
<e p="Tabs" t="Include">
|
||||
<e p="ScsiInfoTab.xaml" t="Include" />
|
||||
<e p="ScsiInfoTab.xaml.cs" t="Include" />
|
||||
<e p="tabAtaInfo.xeto" t="Include" />
|
||||
<e p="tabAtaInfo.xeto.cs" t="Include" />
|
||||
<e p="tabBlurayInfo.xeto" t="Include" />
|
||||
@@ -1293,8 +1296,6 @@
|
||||
<e p="tabDvdWritableInfo.xeto.cs" t="Include" />
|
||||
<e p="tabPcmciaInfo.xeto" t="Include" />
|
||||
<e p="tabPcmciaInfo.xeto.cs" t="Include" />
|
||||
<e p="tabScsiInfo.xeto" t="Include" />
|
||||
<e p="tabScsiInfo.xeto.cs" t="Include" />
|
||||
<e p="tabSdMmcInfo.xeto" t="Include" />
|
||||
<e p="tabSdMmcInfo.xeto.cs" t="Include" />
|
||||
<e p="tabXboxInfo.xeto" t="Include" />
|
||||
@@ -1309,6 +1310,7 @@
|
||||
<e p="LicenseDialogViewModel.cs" t="Include" />
|
||||
<e p="MainWindowViewModel.cs" t="Include" />
|
||||
<e p="PluginsDialogViewModel.cs" t="Include" />
|
||||
<e p="ScsiInfoViewModel.cs" t="Include" />
|
||||
<e p="SettingsDialogViewModel.cs" t="Include" />
|
||||
<e p="SplashWindowViewModel.cs" t="Include" />
|
||||
<e p="StatisticsDialogViewModel.cs" t="Include" />
|
||||
|
||||
@@ -352,6 +352,9 @@
|
||||
<Compile Update="Panels\ImageInfoPanel.xaml.cs">
|
||||
<DependentUpon>ImageInfoPanel.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Tabs\ScsiInfoTab.xaml.cs">
|
||||
<DependentUpon>ScsiInfoTab.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<UpToDateCheckInput Remove="Views\MainWindow.xaml" />
|
||||
|
||||
9
Aaru.Gui/Models/ScsiPageModel.cs
Normal file
9
Aaru.Gui/Models/ScsiPageModel.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Aaru.Gui.Models
|
||||
{
|
||||
public class ScsiPageModel
|
||||
{
|
||||
public byte[] Data;
|
||||
public string Page { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -114,6 +114,12 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
<TabItem IsVisible="{Binding !!ScsiInfo}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="SCSI" />
|
||||
</TabItem.Header>
|
||||
<ContentControl Content="{Binding ScsiInfo}" />
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||
<Button Command="{Binding EntropyCommand}">
|
||||
|
||||
@@ -97,6 +97,7 @@ namespace Aaru.Gui.Panels
|
||||
tabInfos.Pages.Add(tabAtaInfo);
|
||||
}
|
||||
|
||||
/*
|
||||
if(devInfo.ScsiInquiryData != null)
|
||||
{
|
||||
var tabScsiInfo = new tabScsiInfo();
|
||||
@@ -310,6 +311,7 @@ namespace Aaru.Gui.Panels
|
||||
txtMediumDensity.Text = DensitySupport.PrettifyMediumType(devInfo.MediumDensitySupport);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
var tabSdMmcInfo = new tabSdMmcInfo();
|
||||
|
||||
|
||||
97
Aaru.Gui/Tabs/ScsiInfoTab.xaml
Normal file
97
Aaru.Gui/Tabs/ScsiInfoTab.xaml
Normal file
@@ -0,0 +1,97 @@
|
||||
<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.ScsiInfoTab">
|
||||
<Design.DataContext>
|
||||
<vm:ScsiInfoViewModel />
|
||||
</Design.DataContext>
|
||||
<TabControl>
|
||||
<TabItem IsVisible="{Binding !!InquiryData}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="INQUIRY" />
|
||||
</TabItem.Header>
|
||||
<StackPanel>
|
||||
<TextBlock Text="SCSI INQUIRY" HorizontalAlignment="Center" />
|
||||
<TextBox Text="{Binding ScsiInquiryText}" IsReadOnly="True" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Command="{Binding SaveInquiryBinaryCommand}">
|
||||
<TextBlock Text="Save binary to file" />
|
||||
</Button>
|
||||
<Button Command="{Binding SaveInquiryTextCommand}">
|
||||
<TextBlock Text="Save text to file" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem IsVisible="{Binding !!ModeSensePages.Count}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="MODE SENSE" />
|
||||
</TabItem.Header>
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<DataGrid HorizontalAlignment="Left" VerticalAlignment="Stretch" Items="{Binding ModeSensePages}"
|
||||
SelectedItem="{Binding SelectedModeSensePage}" IsReadOnly="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Page" Binding="{Binding Page}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<TextBox HorizontalAlignment="Right" VerticalAlignment="Stretch" Text="{Binding ModeSensePageText}"
|
||||
IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Command="{Binding SaveModeSense6Command}">
|
||||
<TextBlock Text="Save MODE SENSE (6) response to file" />
|
||||
</Button>
|
||||
<Button Command="{Binding SaveModeSense10Command}">
|
||||
<TextBlock Text="Save MODE SENSE (10) response to file" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem IsVisible="{Binding !!EvpdPages.Count}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="EVPD" />
|
||||
</TabItem.Header>
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<DataGrid HorizontalAlignment="Left" VerticalAlignment="Stretch" Items="{Binding EvpdPages}"
|
||||
SelectedItem="{Binding SelectedEvpdPage}" IsReadOnly="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Page" Binding="{Binding Page}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<TextBox HorizontalAlignment="Right" VerticalAlignment="Stretch" Text="{Binding EvpdPageText}"
|
||||
IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Command="{Binding SaveEvpdPageCommand}">
|
||||
<TextBlock Text="Save EVPD page to file" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem IsVisible="{Binding !!MmcFeatures.Count}">
|
||||
<TabItem.Header>
|
||||
<TextBlock Text="MMC FEATURES" />
|
||||
</TabItem.Header>
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<DataGrid HorizontalAlignment="Left" VerticalAlignment="Stretch" Items="{Binding MmcFeatures}"
|
||||
SelectedItem="{Binding SelectedMmcFeature}" IsReadOnly="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Feature" Binding="{Binding Page}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<TextBox HorizontalAlignment="Right" VerticalAlignment="Stretch" Text="{Binding MmcFeatureText}"
|
||||
IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Command="{Binding SaveMmcFeaturesCommand}">
|
||||
<TextBlock Text="Save MMC GET CONFIGURATION response to file" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</UserControl>
|
||||
12
Aaru.Gui/Tabs/ScsiInfoTab.xaml.cs
Normal file
12
Aaru.Gui/Tabs/ScsiInfoTab.xaml.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Aaru.Gui.Tabs
|
||||
{
|
||||
public class ScsiInfoTab : UserControl
|
||||
{
|
||||
public ScsiInfoTab() => InitializeComponent();
|
||||
|
||||
void InitializeComponent() => AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!--
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ============================================================================
|
||||
//
|
||||
// Filename : tabScsiInfo.xeto
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Device information.
|
||||
//
|
||||
// ==[ Description ] ==========================================================
|
||||
//
|
||||
// Defines the structure for the SCSI 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="SCSI" Visible="False" xmlns="http://schema.picoe.ca/eto.forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<TabControl>
|
||||
<TabPage ID="tabScsiInquiry" Text="INQUIRY">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Center">
|
||||
<Label ID="lblScsiInquiry" Text="SCSI INQUIRY"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True">
|
||||
<TextArea ID="txtScsiInquiry" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Right" VerticalAlignment="Bottom">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Button ID="btnSaveInquiryBinary" Text="Save binary to file" Click="OnBtnSaveInquiryBinary"/>
|
||||
<Button ID="btnSaveInquiryText" Text="Save text to file" Click="OnBtnSaveInquiryText"/>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabScsiModeSense" Text="MODE SENSE" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayoutItem HorizontalAlignment="Left" VerticalAlignment="Stretch" Expand="True">
|
||||
<TreeGridView ID="treeModeSensePages"
|
||||
SelectedItemChanged="OnTreeModePagesSelectedItemChanged"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Right" VerticalAlignment="Stretch" Expand="True">
|
||||
<TextArea ID="txtModeSensePage" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Right" VerticalAlignment="Bottom">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Button ID="btnSaveMode6" Text="Save MODE SENSE (6) response to file" Click="OnBtnSaveMode6"
|
||||
Visible="False"/>
|
||||
<Button ID="btnSaveMode10" Text="Save MODE SENSE (10) response to file" Click="OnBtnSaveMode10"
|
||||
Visible="False"/>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabScsiEvpd" Text="EVPD" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayoutItem HorizontalAlignment="Left" VerticalAlignment="Stretch" Expand="True">
|
||||
<TreeGridView ID="treeEvpdPages" SelectedItemChanged="OnTreeEvpdPagesSelectedItemChanged"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Right" VerticalAlignment="Stretch" Expand="True">
|
||||
<TextArea ID="txtEvpdPage" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Right" VerticalAlignment="Bottom">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Button ID="btnSaveEvpd" Text="Save EVPD page to file" Click="OnBtnSaveEvpd"/>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
<TabPage ID="tabMmcFeatures" Text="Features" Visible="False">
|
||||
<StackLayout Orientation="Vertical">
|
||||
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<StackLayoutItem HorizontalAlignment="Left" VerticalAlignment="Stretch" Expand="True">
|
||||
<TreeGridView ID="treeMmcFeatures"
|
||||
SelectedItemChanged="OnTreeMmcFeaturesSelectedItemChanged"/>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Right" VerticalAlignment="Stretch" Expand="True">
|
||||
<TextArea ID="txtMmcFeature" ReadOnly="True"/>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
<StackLayoutItem HorizontalAlignment="Right" VerticalAlignment="Bottom">
|
||||
<StackLayout Orientation="Horizontal">
|
||||
<Button ID="btnSaveMmcFeatures" Text="Save MMC GET CONFIGURATION response to file"
|
||||
Click="OnBtnSaveMmcFeatures"/>
|
||||
</StackLayout>
|
||||
</StackLayoutItem>
|
||||
</StackLayout>
|
||||
</TabPage>
|
||||
</TabControl>
|
||||
</TabPage>
|
||||
@@ -5,27 +5,34 @@ using System.Reactive;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Gui.Models;
|
||||
using Aaru.Gui.Tabs;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using ReactiveUI;
|
||||
using Schemas;
|
||||
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
|
||||
|
||||
namespace Aaru.Gui.ViewModels
|
||||
{
|
||||
public class ImageInfoViewModel
|
||||
public class ImageInfoViewModel : ViewModelBase
|
||||
{
|
||||
readonly IMediaImage _imageFormat;
|
||||
IFilter _filter;
|
||||
string _imagePath;
|
||||
readonly Window _view;
|
||||
|
||||
public ImageInfoViewModel(string imagePath, IFilter filter, IMediaImage imageFormat)
|
||||
public ImageInfoViewModel(string imagePath, IFilter filter, IMediaImage imageFormat, Window view)
|
||||
|
||||
{
|
||||
_imagePath = imagePath;
|
||||
_filter = filter;
|
||||
_imageFormat = imageFormat;
|
||||
_view = view;
|
||||
IAssetLoader assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
|
||||
MediaTagsList = new ObservableCollection<string>();
|
||||
SectorTagsList = new ObservableCollection<string>();
|
||||
@@ -145,7 +152,6 @@ namespace Aaru.Gui.ViewModels
|
||||
foreach(SectorTagType tag in imageFormat.Info.ReadableSectorTags.OrderBy(t => t))
|
||||
SectorTagsList.Add(tag.ToString());
|
||||
|
||||
/* TODO: tabScsiInfo
|
||||
PeripheralDeviceTypes scsiDeviceType = PeripheralDeviceTypes.DirectAccess;
|
||||
byte[] scsiInquiryData = null;
|
||||
Inquiry? scsiInquiry = null;
|
||||
@@ -177,13 +183,11 @@ namespace Aaru.Gui.ViewModels
|
||||
scsiMode = Modes.DecodeMode10(scsiModeSense10, scsiDeviceType);
|
||||
}
|
||||
|
||||
var tabScsiInfo = new tabScsiInfo();
|
||||
|
||||
tabScsiInfo.LoadData(scsiInquiryData, scsiInquiry, null, scsiMode, scsiDeviceType, scsiModeSense6,
|
||||
scsiModeSense10, null);
|
||||
|
||||
tabInfos.Pages.Add(tabScsiInfo);
|
||||
*/
|
||||
ScsiInfo = new ScsiInfoTab
|
||||
{
|
||||
DataContext = new ScsiInfoViewModel(scsiInquiryData, scsiInquiry, null, scsiMode, scsiDeviceType,
|
||||
scsiModeSense6, scsiModeSense10, null, _view)
|
||||
};
|
||||
|
||||
/* TODO: tabAtaInfo
|
||||
byte[] ataIdentify = null;
|
||||
@@ -644,6 +648,8 @@ namespace Aaru.Gui.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public ScsiInfoTab ScsiInfo { get; }
|
||||
|
||||
public Bitmap MediaLogo { get; }
|
||||
public string ImagePathText { get; }
|
||||
public string FilterText { get; }
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace Aaru.Gui.ViewModels
|
||||
? _genericOpticalIcon
|
||||
: _genericFolderIcon,
|
||||
FileName = Path.GetFileName(result[0]), Image = imageFormat,
|
||||
ViewModel = new ImageInfoViewModel(result[0], inputFilter, imageFormat)
|
||||
ViewModel = new ImageInfoViewModel(result[0], inputFilter, imageFormat, _view)
|
||||
};
|
||||
|
||||
// TODO: pnlImageInfo
|
||||
|
||||
@@ -1,107 +1,65 @@
|
||||
// /***************************************************************************
|
||||
// Aaru Data Preservation Suite
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : tabScsiInfo.xeto.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : Device information.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Implements the SCSI 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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Console;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Decoders.SCSI.MMC;
|
||||
using Eto.Forms;
|
||||
using Eto.Serialization.Xaml;
|
||||
using Aaru.Gui.Models;
|
||||
using Avalonia.Controls;
|
||||
using ReactiveUI;
|
||||
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
|
||||
|
||||
namespace Aaru.Gui.Tabs
|
||||
namespace Aaru.Gui.ViewModels
|
||||
{
|
||||
public class tabScsiInfo : TabPage
|
||||
public class ScsiInfoViewModel : ViewModelBase
|
||||
{
|
||||
byte[] configuration;
|
||||
Dictionary<byte, byte[]> evpdPages;
|
||||
Inquiry? inquiry;
|
||||
byte[] inquiryData;
|
||||
Modes.DecodedMode? mode;
|
||||
byte[] modeSense10;
|
||||
byte[] modeSense6;
|
||||
PeripheralDeviceTypes type;
|
||||
readonly byte[] _configuration;
|
||||
readonly byte[] _scsiModeSense10;
|
||||
readonly byte[] _scsiModeSense6;
|
||||
string _evpdPageText;
|
||||
string _mmcFeatureText;
|
||||
string _scsiModeSensePageText;
|
||||
object _selectedEvpdPage;
|
||||
object _selectedMmcFeature;
|
||||
object _selectedModeSensePage;
|
||||
Window _view;
|
||||
|
||||
public tabScsiInfo() => XamlReader.Load(this);
|
||||
|
||||
internal void LoadData(byte[] scsiInquiryData, Inquiry? scsiInquiry, Dictionary<byte, byte[]> scsiEvpdPages,
|
||||
Modes.DecodedMode? scsiMode, PeripheralDeviceTypes scsiType, byte[] scsiModeSense6,
|
||||
byte[] scsiModeSense10, byte[] mmcConfiguration)
|
||||
public ScsiInfoViewModel(byte[] scsiInquiryData, Inquiry? scsiInquiry, Dictionary<byte, byte[]> scsiEvpdPages,
|
||||
Modes.DecodedMode? scsiMode, PeripheralDeviceTypes scsiType, byte[] scsiModeSense6,
|
||||
byte[] scsiModeSense10, byte[] mmcConfiguration, Window view)
|
||||
{
|
||||
inquiryData = scsiInquiryData;
|
||||
inquiry = scsiInquiry;
|
||||
evpdPages = scsiEvpdPages;
|
||||
mode = scsiMode;
|
||||
type = scsiType;
|
||||
modeSense6 = scsiModeSense6;
|
||||
modeSense10 = scsiModeSense10;
|
||||
configuration = mmcConfiguration;
|
||||
InquiryData = scsiInquiryData;
|
||||
_scsiModeSense6 = scsiModeSense6;
|
||||
_scsiModeSense10 = scsiModeSense10;
|
||||
_configuration = mmcConfiguration;
|
||||
ModeSensePages = new ObservableCollection<ScsiPageModel>();
|
||||
EvpdPages = new ObservableCollection<ScsiPageModel>();
|
||||
MmcFeatures = new ObservableCollection<ScsiPageModel>();
|
||||
SaveInquiryBinaryCommand = ReactiveCommand.Create(ExecuteSaveInquiryBinaryCommand);
|
||||
SaveInquiryTextCommand = ReactiveCommand.Create(ExecuteSaveInquiryTextCommand);
|
||||
SaveModeSense6Command = ReactiveCommand.Create(ExecuteSaveModeSense6Command);
|
||||
SaveModeSense10Command = ReactiveCommand.Create(ExecuteSaveModeSense10Command);
|
||||
SaveEvpdPageCommand = ReactiveCommand.Create(ExecuteSaveEvpdPageCommand);
|
||||
SaveMmcFeaturesCommand = ReactiveCommand.Create(ExecuteSaveMmcFeaturesCommand);
|
||||
|
||||
if(inquiryData == null ||
|
||||
!inquiry.HasValue)
|
||||
if(InquiryData == null ||
|
||||
!scsiInquiry.HasValue)
|
||||
return;
|
||||
|
||||
Visible = true;
|
||||
txtScsiInquiry.Text = Decoders.SCSI.Inquiry.Prettify(inquiry);
|
||||
ScsiInquiryText = Decoders.SCSI.Inquiry.Prettify(scsiInquiry);
|
||||
|
||||
if(mode.HasValue)
|
||||
if(scsiMode.HasValue)
|
||||
{
|
||||
tabScsiModeSense.Visible = true;
|
||||
|
||||
var modePagesList = new TreeGridItemCollection();
|
||||
|
||||
treeModeSensePages.Columns.Add(new GridColumn
|
||||
ModeSensePages.Add(new ScsiPageModel
|
||||
{
|
||||
HeaderText = "Page", DataCell = new TextBoxCell(0)
|
||||
Page = "Header", Description = Modes.PrettifyModeHeader(scsiMode.Value.Header, scsiType)
|
||||
});
|
||||
|
||||
treeModeSensePages.AllowMultipleSelection = false;
|
||||
treeModeSensePages.ShowHeader = false;
|
||||
treeModeSensePages.DataStore = modePagesList;
|
||||
|
||||
modePagesList.Add(new TreeGridItem
|
||||
{
|
||||
Values = new object[]
|
||||
{
|
||||
"Header", Modes.PrettifyModeHeader(mode.Value.Header, type)
|
||||
}
|
||||
});
|
||||
|
||||
if(mode.Value.Pages != null)
|
||||
foreach(Modes.ModePage page in mode.Value.Pages.OrderBy(t => t.Page).ThenBy(t => t.Subpage))
|
||||
if(scsiMode.Value.Pages != null)
|
||||
foreach(Modes.ModePage page in scsiMode.Value.Pages.OrderBy(t => t.Page).ThenBy(t => t.Subpage))
|
||||
{
|
||||
string pageNumberText = page.Subpage == 0 ? $"MODE {page.Page:X2}h"
|
||||
: $"MODE {page.Page:X2} Subpage {page.Subpage:X2}";
|
||||
@@ -112,7 +70,7 @@ namespace Aaru.Gui.Tabs
|
||||
{
|
||||
case 0x00:
|
||||
{
|
||||
if(type == PeripheralDeviceTypes.MultiMediaDevice &&
|
||||
if(scsiType == PeripheralDeviceTypes.MultiMediaDevice &&
|
||||
page.Subpage == 0)
|
||||
decodedText = Modes.PrettifyModePage_00_SFF(page.PageResponse);
|
||||
else
|
||||
@@ -123,7 +81,7 @@ namespace Aaru.Gui.Tabs
|
||||
case 0x01:
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
decodedText = type == PeripheralDeviceTypes.MultiMediaDevice
|
||||
decodedText = scsiType == PeripheralDeviceTypes.MultiMediaDevice
|
||||
? Modes.PrettifyModePage_01_MMC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_01(page.PageResponse);
|
||||
else
|
||||
@@ -179,7 +137,7 @@ namespace Aaru.Gui.Tabs
|
||||
case 0x07:
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
decodedText = type == PeripheralDeviceTypes.MultiMediaDevice
|
||||
decodedText = scsiType == PeripheralDeviceTypes.MultiMediaDevice
|
||||
? Modes.PrettifyModePage_07_MMC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_07(page.PageResponse);
|
||||
else
|
||||
@@ -246,7 +204,7 @@ namespace Aaru.Gui.Tabs
|
||||
case 0x10:
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
decodedText = type == PeripheralDeviceTypes.SequentialAccess
|
||||
decodedText = scsiType == PeripheralDeviceTypes.SequentialAccess
|
||||
? Modes.PrettifyModePage_10_SSC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_10(page.PageResponse);
|
||||
else
|
||||
@@ -297,7 +255,7 @@ namespace Aaru.Gui.Tabs
|
||||
case 0x1C:
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
decodedText = type == PeripheralDeviceTypes.MultiMediaDevice
|
||||
decodedText = scsiType == PeripheralDeviceTypes.MultiMediaDevice
|
||||
? Modes.PrettifyModePage_1C_SFF(page.PageResponse)
|
||||
: Modes.PrettifyModePage_1C(page.PageResponse);
|
||||
else if(page.Subpage == 1)
|
||||
@@ -318,7 +276,7 @@ namespace Aaru.Gui.Tabs
|
||||
}
|
||||
case 0x21:
|
||||
{
|
||||
if(StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "CERTANCE")
|
||||
if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "CERTANCE")
|
||||
decodedText = Modes.PrettifyCertanceModePage_21(page.PageResponse);
|
||||
else
|
||||
goto default;
|
||||
@@ -327,7 +285,7 @@ namespace Aaru.Gui.Tabs
|
||||
}
|
||||
case 0x22:
|
||||
{
|
||||
if(StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "CERTANCE")
|
||||
if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "CERTANCE")
|
||||
decodedText = Modes.PrettifyCertanceModePage_22(page.PageResponse);
|
||||
else
|
||||
goto default;
|
||||
@@ -336,7 +294,7 @@ namespace Aaru.Gui.Tabs
|
||||
}
|
||||
case 0x24:
|
||||
{
|
||||
if(StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "IBM")
|
||||
if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "IBM")
|
||||
decodedText = Modes.PrettifyIBMModePage_24(page.PageResponse);
|
||||
else
|
||||
goto default;
|
||||
@@ -354,7 +312,7 @@ namespace Aaru.Gui.Tabs
|
||||
}
|
||||
case 0x2F:
|
||||
{
|
||||
if(StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "IBM")
|
||||
if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "IBM")
|
||||
decodedText = Modes.PrettifyIBMModePage_2F(page.PageResponse);
|
||||
else
|
||||
goto default;
|
||||
@@ -372,7 +330,7 @@ namespace Aaru.Gui.Tabs
|
||||
}
|
||||
case 0x3B:
|
||||
{
|
||||
if(StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "HP")
|
||||
if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "HP")
|
||||
decodedText = Modes.PrettifyHPModePage_3B(page.PageResponse);
|
||||
else
|
||||
goto default;
|
||||
@@ -381,7 +339,7 @@ namespace Aaru.Gui.Tabs
|
||||
}
|
||||
case 0x3C:
|
||||
{
|
||||
if(StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "HP")
|
||||
if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "HP")
|
||||
decodedText = Modes.PrettifyHPModePage_3C(page.PageResponse);
|
||||
else
|
||||
goto default;
|
||||
@@ -390,9 +348,9 @@ namespace Aaru.Gui.Tabs
|
||||
}
|
||||
case 0x3D:
|
||||
{
|
||||
if(StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "IBM")
|
||||
if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "IBM")
|
||||
decodedText = Modes.PrettifyIBMModePage_3D(page.PageResponse);
|
||||
else if(StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "HP")
|
||||
else if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "HP")
|
||||
decodedText = Modes.PrettifyHPModePage_3D(page.PageResponse);
|
||||
else
|
||||
goto default;
|
||||
@@ -401,9 +359,9 @@ namespace Aaru.Gui.Tabs
|
||||
}
|
||||
case 0x3E:
|
||||
{
|
||||
if(StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "FUJITSU")
|
||||
if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "FUJITSU")
|
||||
decodedText = Modes.PrettifyFujitsuModePage_3E(page.PageResponse);
|
||||
else if(StringHandlers.CToString(inquiry?.VendorIdentification).Trim() == "HP")
|
||||
else if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "HP")
|
||||
decodedText = Modes.PrettifyHPModePage_3E(page.PageResponse);
|
||||
else
|
||||
goto default;
|
||||
@@ -422,33 +380,16 @@ namespace Aaru.Gui.Tabs
|
||||
if(decodedText == null)
|
||||
decodedText = "Error decoding page, please open an issue.";
|
||||
|
||||
modePagesList.Add(new TreeGridItem
|
||||
ModeSensePages.Add(new ScsiPageModel
|
||||
{
|
||||
Values = new object[]
|
||||
{
|
||||
pageNumberText, decodedText
|
||||
}
|
||||
Page = pageNumberText, Description = decodedText
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(evpdPages != null)
|
||||
if(scsiEvpdPages != null)
|
||||
{
|
||||
tabScsiEvpd.Visible = true;
|
||||
treeEvpdPages.ShowHeader = false;
|
||||
|
||||
var evpdPagesList = new TreeGridItemCollection();
|
||||
|
||||
treeEvpdPages.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Page", DataCell = new TextBoxCell(0)
|
||||
});
|
||||
|
||||
treeEvpdPages.AllowMultipleSelection = false;
|
||||
treeEvpdPages.ShowHeader = false;
|
||||
treeEvpdPages.DataStore = evpdPagesList;
|
||||
|
||||
foreach(KeyValuePair<byte, byte[]> page in evpdPages.OrderBy(t => t.Key))
|
||||
foreach(KeyValuePair<byte, byte[]> page in scsiEvpdPages.OrderBy(t => t.Key))
|
||||
{
|
||||
string evpdPageTitle = "";
|
||||
string evpdDecodedPage = "";
|
||||
@@ -525,44 +466,44 @@ namespace Aaru.Gui.Tabs
|
||||
evpdDecodedPage = EVPD.DecodePageB4(page.Value);
|
||||
}
|
||||
else if(page.Key == 0xC0 &&
|
||||
StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() ==
|
||||
"quantum")
|
||||
StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
||||
Trim() == "quantum")
|
||||
{
|
||||
evpdPageTitle = "Quantum Firmware Build Information page";
|
||||
evpdDecodedPage = EVPD.PrettifyPage_C0_Quantum(page.Value);
|
||||
}
|
||||
else if(page.Key == 0xC0 &&
|
||||
StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() ==
|
||||
"seagate")
|
||||
StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
||||
Trim() == "seagate")
|
||||
{
|
||||
evpdPageTitle = "Seagate Firmware Numbers page";
|
||||
evpdDecodedPage = EVPD.PrettifyPage_C0_Seagate(page.Value);
|
||||
}
|
||||
else if(page.Key == 0xC0 &&
|
||||
StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() ==
|
||||
"ibm")
|
||||
StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
||||
Trim() == "ibm")
|
||||
{
|
||||
evpdPageTitle = "IBM Drive Component Revision Levels page";
|
||||
evpdDecodedPage = EVPD.PrettifyPage_C0_IBM(page.Value);
|
||||
}
|
||||
else if(page.Key == 0xC1 &&
|
||||
StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() ==
|
||||
"ibm")
|
||||
StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
||||
Trim() == "ibm")
|
||||
{
|
||||
evpdPageTitle = "IBM Drive Serial Numbers page";
|
||||
evpdDecodedPage = EVPD.PrettifyPage_C1_IBM(page.Value);
|
||||
}
|
||||
else if((page.Key == 0xC0 || page.Key == 0xC1) &&
|
||||
StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() ==
|
||||
"certance")
|
||||
StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
||||
Trim() == "certance")
|
||||
{
|
||||
evpdPageTitle = "Certance Drive Component Revision Levels page";
|
||||
evpdDecodedPage = EVPD.PrettifyPage_C0_C1_Certance(page.Value);
|
||||
}
|
||||
else if((page.Key == 0xC2 || page.Key == 0xC3 || page.Key == 0xC4 || page.Key == 0xC5 ||
|
||||
page.Key == 0xC6) &&
|
||||
StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() ==
|
||||
"certance")
|
||||
StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
||||
Trim() == "certance")
|
||||
{
|
||||
switch(page.Key)
|
||||
{
|
||||
@@ -592,8 +533,8 @@ namespace Aaru.Gui.Tabs
|
||||
}
|
||||
else if((page.Key == 0xC0 || page.Key == 0xC1 || page.Key == 0xC2 || page.Key == 0xC3 ||
|
||||
page.Key == 0xC4 || page.Key == 0xC5) &&
|
||||
StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() ==
|
||||
"hp")
|
||||
StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
||||
Trim() == "hp")
|
||||
{
|
||||
switch(page.Key)
|
||||
{
|
||||
@@ -626,8 +567,8 @@ namespace Aaru.Gui.Tabs
|
||||
evpdDecodedPage = EVPD.PrettifyPage_C0_to_C5_HP(page.Value);
|
||||
}
|
||||
else if(page.Key == 0xDF &&
|
||||
StringHandlers.CToString(inquiry.Value.VendorIdentification).ToLowerInvariant().Trim() ==
|
||||
"certance")
|
||||
StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).ToLowerInvariant().
|
||||
Trim() == "certance")
|
||||
{
|
||||
evpdPageTitle = "Certance drive status page";
|
||||
evpdDecodedPage = EVPD.PrettifyPage_DF_Certance(page.Value);
|
||||
@@ -644,32 +585,16 @@ namespace Aaru.Gui.Tabs
|
||||
page.Key);
|
||||
}
|
||||
|
||||
evpdPagesList.Add(new TreeGridItem
|
||||
EvpdPages.Add(new ScsiPageModel
|
||||
{
|
||||
Values = new object[]
|
||||
{
|
||||
evpdPageTitle, evpdDecodedPage, page.Value
|
||||
}
|
||||
Page = evpdPageTitle, Data = page.Value, Description = evpdDecodedPage
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(configuration != null)
|
||||
if(_configuration != null)
|
||||
{
|
||||
tabMmcFeatures.Visible = true;
|
||||
|
||||
var featuresList = new TreeGridItemCollection();
|
||||
|
||||
treeMmcFeatures.Columns.Add(new GridColumn
|
||||
{
|
||||
HeaderText = "Feature", DataCell = new TextBoxCell(0)
|
||||
});
|
||||
|
||||
treeMmcFeatures.AllowMultipleSelection = false;
|
||||
treeMmcFeatures.ShowHeader = false;
|
||||
treeMmcFeatures.DataStore = featuresList;
|
||||
|
||||
Features.SeparatedFeatures ftr = Features.Separate(configuration);
|
||||
Features.SeparatedFeatures ftr = Features.Separate(_configuration);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION length is {0} bytes",
|
||||
ftr.DataLength);
|
||||
@@ -924,219 +849,237 @@ namespace Aaru.Gui.Tabs
|
||||
break;
|
||||
}
|
||||
|
||||
featuresList.Add(new TreeGridItem
|
||||
MmcFeatures.Add(new ScsiPageModel
|
||||
{
|
||||
Values = new object[]
|
||||
{
|
||||
featureNumber, featureDescription
|
||||
}
|
||||
Page = featureNumber, Description = featureDescription
|
||||
});
|
||||
}
|
||||
else
|
||||
AaruConsole.DebugWriteLine("Device-Info command",
|
||||
"GET CONFIGURATION returned no feature descriptors");
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected void OnBtnSaveInquiryBinary(object sender, EventArgs e)
|
||||
public byte[] InquiryData { get; }
|
||||
public string ScsiInquiryText { get; }
|
||||
public ObservableCollection<ScsiPageModel> ModeSensePages { get; }
|
||||
public ObservableCollection<ScsiPageModel> EvpdPages { get; }
|
||||
public ObservableCollection<ScsiPageModel> MmcFeatures { get; }
|
||||
public ReactiveCommand<Unit, Unit> SaveInquiryBinaryCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> SaveInquiryTextCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> SaveModeSense6Command { get; }
|
||||
public ReactiveCommand<Unit, Unit> SaveModeSense10Command { get; }
|
||||
public ReactiveCommand<Unit, Unit> SaveEvpdPageCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> SaveMmcFeaturesCommand { get; }
|
||||
|
||||
public object SelectedModeSensePage
|
||||
{
|
||||
get => _selectedModeSensePage;
|
||||
set
|
||||
{
|
||||
if(value == _selectedModeSensePage)
|
||||
return;
|
||||
|
||||
if(value is ScsiPageModel pageModel)
|
||||
ModeSensePageText = pageModel.Description;
|
||||
|
||||
this.RaiseAndSetIfChanged(ref _selectedModeSensePage, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string ModeSensePageText
|
||||
{
|
||||
get => _scsiModeSensePageText;
|
||||
set => this.RaiseAndSetIfChanged(ref _scsiModeSensePageText, value);
|
||||
}
|
||||
|
||||
public object SelectedEvpdPage
|
||||
{
|
||||
get => _selectedEvpdPage;
|
||||
set
|
||||
{
|
||||
if(value == _selectedEvpdPage)
|
||||
return;
|
||||
|
||||
if(value is ScsiPageModel pageModel)
|
||||
EvpdPageText = pageModel.Description;
|
||||
|
||||
this.RaiseAndSetIfChanged(ref _selectedEvpdPage, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string EvpdPageText
|
||||
{
|
||||
get => _evpdPageText;
|
||||
set => this.RaiseAndSetIfChanged(ref _evpdPageText, value);
|
||||
}
|
||||
|
||||
public object SelectedMmcFeature
|
||||
{
|
||||
get => _selectedMmcFeature;
|
||||
set
|
||||
{
|
||||
if(value == _selectedMmcFeature)
|
||||
return;
|
||||
|
||||
if(value is ScsiPageModel pageModel)
|
||||
MmcFeatureText = pageModel.Description;
|
||||
|
||||
this.RaiseAndSetIfChanged(ref _selectedMmcFeature, value);
|
||||
}
|
||||
}
|
||||
|
||||
public string MmcFeatureText
|
||||
{
|
||||
get => _mmcFeatureText;
|
||||
set => this.RaiseAndSetIfChanged(ref _mmcFeatureText, value);
|
||||
}
|
||||
|
||||
protected async void ExecuteSaveInquiryBinaryCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters.Add(new FileFilter
|
||||
dlgSaveBinary.Filters.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new[]
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
},
|
||||
}),
|
||||
Name = "Binary"
|
||||
});
|
||||
|
||||
DialogResult result = dlgSaveBinary.ShowDialog(this);
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result != DialogResult.Ok)
|
||||
if(result is null)
|
||||
return;
|
||||
|
||||
var saveFs = new FileStream(dlgSaveBinary.FileName, FileMode.Create);
|
||||
saveFs.Write(inquiryData, 0, inquiryData.Length);
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
saveFs.Write(InquiryData, 0, InquiryData.Length);
|
||||
|
||||
saveFs.Close();
|
||||
}
|
||||
|
||||
protected void OnBtnSaveInquiryText(object sender, EventArgs e)
|
||||
protected async void ExecuteSaveInquiryTextCommand()
|
||||
{
|
||||
var dlgSaveText = new SaveFileDialog();
|
||||
|
||||
dlgSaveText.Filters.Add(new FileFilter
|
||||
dlgSaveText.Filters.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new[]
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.txt"
|
||||
},
|
||||
}),
|
||||
Name = "Text"
|
||||
});
|
||||
|
||||
DialogResult result = dlgSaveText.ShowDialog(this);
|
||||
string result = await dlgSaveText.ShowAsync(_view);
|
||||
|
||||
if(result != DialogResult.Ok)
|
||||
if(result is null)
|
||||
return;
|
||||
|
||||
var saveFs = new FileStream(dlgSaveText.FileName, FileMode.Create);
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
var saveSw = new StreamWriter(saveFs);
|
||||
saveSw.Write(txtScsiInquiry.Text);
|
||||
saveSw.Write(ScsiInquiryText);
|
||||
saveFs.Close();
|
||||
}
|
||||
|
||||
protected void OnBtnSaveMode6(object sender, EventArgs e)
|
||||
protected async void ExecuteSaveModeSense6Command()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters.Add(new FileFilter
|
||||
dlgSaveBinary.Filters.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new[]
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
},
|
||||
}),
|
||||
Name = "Binary"
|
||||
});
|
||||
|
||||
DialogResult result = dlgSaveBinary.ShowDialog(this);
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result != DialogResult.Ok)
|
||||
if(result is null)
|
||||
return;
|
||||
|
||||
var saveFs = new FileStream(dlgSaveBinary.FileName, FileMode.Create);
|
||||
saveFs.Write(modeSense6, 0, modeSense6.Length);
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
saveFs.Write(_scsiModeSense6, 0, _scsiModeSense6.Length);
|
||||
|
||||
saveFs.Close();
|
||||
}
|
||||
|
||||
protected void OnBtnSaveMode10(object sender, EventArgs e)
|
||||
protected async void ExecuteSaveModeSense10Command()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters.Add(new FileFilter
|
||||
dlgSaveBinary.Filters.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new[]
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
},
|
||||
}),
|
||||
Name = "Binary"
|
||||
});
|
||||
|
||||
DialogResult result = dlgSaveBinary.ShowDialog(this);
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result != DialogResult.Ok)
|
||||
if(result is null)
|
||||
return;
|
||||
|
||||
var saveFs = new FileStream(dlgSaveBinary.FileName, FileMode.Create);
|
||||
saveFs.Write(modeSense10, 0, modeSense10.Length);
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
saveFs.Write(_scsiModeSense10, 0, _scsiModeSense10.Length);
|
||||
|
||||
saveFs.Close();
|
||||
}
|
||||
|
||||
protected void OnTreeModePagesSelectedItemChanged(object sender, EventArgs e)
|
||||
protected async void ExecuteSaveEvpdPageCommand()
|
||||
{
|
||||
if(!(treeModeSensePages.SelectedItem is TreeGridItem item))
|
||||
return;
|
||||
|
||||
txtModeSensePage.Text = item.Values[1] as string;
|
||||
}
|
||||
|
||||
protected void OnTreeEvpdPagesSelectedItemChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(!(treeEvpdPages.SelectedItem is TreeGridItem item))
|
||||
return;
|
||||
|
||||
txtEvpdPage.Text = item.Values[1] as string;
|
||||
}
|
||||
|
||||
protected void OnBtnSaveEvpd(object sender, EventArgs e)
|
||||
{
|
||||
if(!(treeModeSensePages.SelectedItem is TreeGridItem item))
|
||||
return;
|
||||
|
||||
if(!(item.Values[2] is byte[] data))
|
||||
if(!(SelectedEvpdPage is ScsiPageModel pageModel))
|
||||
return;
|
||||
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters.Add(new FileFilter
|
||||
dlgSaveBinary.Filters.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new[]
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
},
|
||||
}),
|
||||
Name = "Binary"
|
||||
});
|
||||
|
||||
DialogResult result = dlgSaveBinary.ShowDialog(this);
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result != DialogResult.Ok)
|
||||
if(result is null)
|
||||
return;
|
||||
|
||||
var saveFs = new FileStream(dlgSaveBinary.FileName, FileMode.Create);
|
||||
saveFs.Write(data, 0, data.Length);
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
saveFs.Write(pageModel.Data, 0, pageModel.Data.Length);
|
||||
|
||||
saveFs.Close();
|
||||
}
|
||||
|
||||
protected void OnTreeMmcFeaturesSelectedItemChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(!(treeMmcFeatures.SelectedItem is TreeGridItem item))
|
||||
return;
|
||||
|
||||
txtMmcFeature.Text = item.Values[1] as string;
|
||||
}
|
||||
|
||||
protected void OnBtnSaveMmcFeatures(object sender, EventArgs e)
|
||||
protected async void ExecuteSaveMmcFeaturesCommand()
|
||||
{
|
||||
var dlgSaveBinary = new SaveFileDialog();
|
||||
|
||||
dlgSaveBinary.Filters.Add(new FileFilter
|
||||
dlgSaveBinary.Filters.Add(new FileDialogFilter
|
||||
{
|
||||
Extensions = new[]
|
||||
Extensions = new List<string>(new[]
|
||||
{
|
||||
"*.bin"
|
||||
},
|
||||
}),
|
||||
Name = "Binary"
|
||||
});
|
||||
|
||||
DialogResult result = dlgSaveBinary.ShowDialog(this);
|
||||
string result = await dlgSaveBinary.ShowAsync(_view);
|
||||
|
||||
if(result != DialogResult.Ok)
|
||||
if(result is null)
|
||||
return;
|
||||
|
||||
var saveFs = new FileStream(dlgSaveBinary.FileName, FileMode.Create);
|
||||
saveFs.Write(configuration, 0, configuration.Length);
|
||||
var saveFs = new FileStream(result, FileMode.Create);
|
||||
saveFs.Write(_configuration, 0, _configuration.Length);
|
||||
|
||||
saveFs.Close();
|
||||
}
|
||||
|
||||
#region XAML controls
|
||||
#pragma warning disable 169
|
||||
#pragma warning disable 649
|
||||
TabPage tabScsiInquiry;
|
||||
Label lblScsiInquiry;
|
||||
TextArea txtScsiInquiry;
|
||||
Button btnSaveInquiryBinary;
|
||||
Button btnSaveInquiryText;
|
||||
TabPage tabScsiModeSense;
|
||||
TreeGridView treeModeSensePages;
|
||||
TextArea txtModeSensePage;
|
||||
Button btnSaveMode6;
|
||||
Button btnSaveMode10;
|
||||
TabPage tabScsiEvpd;
|
||||
TreeGridView treeEvpdPages;
|
||||
TextArea txtEvpdPage;
|
||||
Button btnSaveEvpd;
|
||||
TabPage tabMmcFeatures;
|
||||
TreeGridView treeMmcFeatures;
|
||||
TextArea txtMmcFeature;
|
||||
Button btnSaveMmcFeatures;
|
||||
#pragma warning restore 169
|
||||
#pragma warning restore 649
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user