2020-04-17 21:45:50 +01:00
|
|
|
// /***************************************************************************
|
|
|
|
|
// Aaru Data Preservation Suite
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Filename : SdMmcInfoViewModel.cs
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
|
|
|
|
// Component : GUI view models.
|
|
|
|
|
//
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// View model and code for the SecureDigital / MultiMediaCard information tab.
|
|
|
|
|
//
|
|
|
|
|
// --[ 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/>.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2024-12-19 10:45:18 +00:00
|
|
|
// Copyright © 2011-2025 Natalia Portillo
|
2020-04-17 21:45:50 +01:00
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
using Aaru.CommonTypes.Enums;
|
2022-03-07 07:36:44 +00:00
|
|
|
using JetBrains.Annotations;
|
2022-11-15 15:58:43 +00:00
|
|
|
|
|
|
|
|
namespace Aaru.Gui.ViewModels.Tabs;
|
2022-03-07 07:36:44 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public sealed class SdMmcInfoViewModel
|
2020-04-12 17:53:16 +01:00
|
|
|
{
|
2023-10-03 23:27:57 +01:00
|
|
|
public SdMmcInfoViewModel(DeviceType deviceType, [CanBeNull] byte[] cid, [CanBeNull] byte[] csd,
|
|
|
|
|
[CanBeNull] byte[] ocr, [CanBeNull] byte[] extendedCsd, [CanBeNull] byte[] scr)
|
2020-04-12 17:53:16 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
switch(deviceType)
|
2020-04-12 17:53:16 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
case DeviceType.MMC:
|
2020-04-12 17:53:16 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
//Text = "MultiMediaCard";
|
2020-04-12 17:53:16 +01:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(cid != null) CidText = Decoders.MMC.Decoders.PrettifyCID(cid);
|
2020-04-12 17:53:16 +01:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(csd != null) CsdText = Decoders.MMC.Decoders.PrettifyCSD(csd);
|
2020-04-12 17:53:16 +01:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(ocr != null) OcrText = Decoders.MMC.Decoders.PrettifyOCR(ocr);
|
2020-04-12 17:53:16 +01:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(extendedCsd != null) ExtendedCsdText = Decoders.MMC.Decoders.PrettifyExtendedCSD(extendedCsd);
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
2020-04-12 17:53:16 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
case DeviceType.SecureDigital:
|
|
|
|
|
{
|
|
|
|
|
//Text = "SecureDigital";
|
2020-04-12 17:53:16 +01:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(cid != null) CidText = Decoders.SecureDigital.Decoders.PrettifyCID(cid);
|
2020-04-12 17:53:16 +01:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(csd != null) CsdText = Decoders.SecureDigital.Decoders.PrettifyCSD(csd);
|
2020-04-12 17:53:16 +01:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(ocr != null) OcrText = Decoders.SecureDigital.Decoders.PrettifyOCR(ocr);
|
2020-04-12 17:53:16 +01:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(scr != null) ScrText = Decoders.SecureDigital.Decoders.PrettifySCR(scr);
|
2020-04-12 17:53:16 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2020-04-12 17:53:16 +01:00
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
public string CidText { get; }
|
|
|
|
|
public string CsdText { get; }
|
|
|
|
|
public string OcrText { get; }
|
|
|
|
|
public string ExtendedCsdText { get; }
|
|
|
|
|
public string ScrText { get; }
|
2020-04-12 17:53:16 +01:00
|
|
|
}
|