2017-12-21 02:03:21 +00:00
|
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:23 +00:00
|
|
|
|
// Aaru Data Preservation Suite
|
2017-12-21 02:03:21 +00:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : 30_Apple.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
|
|
|
|
|
// Component : Device structures decoders.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Decodes Apple MODE PAGE 30h: Apple OEM String.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library 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
|
|
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2022-12-03 16:07:08 +00:00
|
|
|
|
// Copyright © 2011-2023 Natalia Portillo
|
2017-12-21 02:03:21 +00:00
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2017-12-22 02:04:18 +00:00
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2017-12-21 02:03:21 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
2022-11-15 15:58:41 +00:00
|
|
|
|
namespace Aaru.Decoders.SCSI;
|
|
|
|
|
|
|
2022-03-06 13:29:37 +00:00
|
|
|
|
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
|
|
|
|
|
|
SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
|
|
|
|
|
public static partial class Modes
|
2017-12-21 02:03:21 +00:00
|
|
|
|
{
|
2022-03-06 13:29:37 +00:00
|
|
|
|
#region Apple Mode Page 0x30: Apple OEM String
|
2023-09-29 18:27:27 +01:00
|
|
|
|
static readonly byte[] AppleOEMString = "APPLE COMPUTER, INC."u8.ToArray();
|
2017-12-21 02:03:21 +00:00
|
|
|
|
|
2022-03-06 13:29:37 +00:00
|
|
|
|
public static bool IsAppleModePage_30(byte[] pageResponse)
|
|
|
|
|
|
{
|
|
|
|
|
|
if((pageResponse?[0] & 0x40) == 0x40)
|
|
|
|
|
|
return false;
|
2017-12-21 02:03:21 +00:00
|
|
|
|
|
2022-03-06 13:29:37 +00:00
|
|
|
|
if((pageResponse?[0] & 0x3F) != 0x30)
|
|
|
|
|
|
return false;
|
2017-12-21 02:03:21 +00:00
|
|
|
|
|
2022-03-06 13:29:37 +00:00
|
|
|
|
if(pageResponse[1] + 2 != pageResponse.Length)
|
|
|
|
|
|
return false;
|
2017-12-21 02:03:21 +00:00
|
|
|
|
|
2022-03-06 13:29:37 +00:00
|
|
|
|
if(pageResponse.Length != 30)
|
|
|
|
|
|
return false;
|
2017-12-21 02:03:21 +00:00
|
|
|
|
|
2022-11-15 15:58:41 +00:00
|
|
|
|
byte[] str = new byte[20];
|
2022-03-06 13:29:37 +00:00
|
|
|
|
Array.Copy(pageResponse, 10, str, 0, 20);
|
2017-12-21 02:03:21 +00:00
|
|
|
|
|
2022-03-06 13:29:37 +00:00
|
|
|
|
return AppleOEMString.SequenceEqual(str);
|
2017-12-21 02:03:21 +00:00
|
|
|
|
}
|
2022-03-06 13:29:37 +00:00
|
|
|
|
#endregion Apple Mode Page 0x30: Apple OEM String
|
2017-12-21 02:03:21 +00:00
|
|
|
|
}
|