2017-05-19 20:28:49 +01:00
|
|
|
// /***************************************************************************
|
2016-08-21 19:23:58 +01:00
|
|
|
// The Disc Image Chef
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Filename : LisaTag.cs
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
// Component : Device structures decoders.
|
2016-08-21 19:23:58 +01:00
|
|
|
//
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
// Decodes Apple Lisa tags.
|
2016-08-21 19:23:58 +01:00
|
|
|
//
|
|
|
|
|
// --[ 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/>.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2017-12-19 03:50:57 +00:00
|
|
|
// Copyright © 2011-2018 Natalia Portillo
|
2016-08-21 19:23:58 +01:00
|
|
|
// ****************************************************************************/
|
2017-12-19 19:33:46 +00:00
|
|
|
|
2016-08-21 19:23:58 +01:00
|
|
|
using System;
|
2017-12-22 02:04:18 +00:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2017-12-19 19:33:46 +00:00
|
|
|
|
2016-08-21 19:23:58 +01:00
|
|
|
namespace DiscImageChef.Decoders
|
|
|
|
|
{
|
2017-12-22 02:04:18 +00:00
|
|
|
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
|
|
|
|
[SuppressMessage("ReSharper", "NotAccessedField.Global")]
|
|
|
|
|
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
2016-08-21 19:23:58 +01:00
|
|
|
public static class LisaTag
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// LisaOS tag as stored on Apple Profile and FileWare disks (20 bytes)
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
|
|
|
|
public struct ProfileTag
|
|
|
|
|
{
|
|
|
|
|
/// <summary>0x00, Lisa OS version number</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public ushort Version;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>0x02 bits 7 to 6, kind of info in this block</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public byte Kind;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>0x02 bits 5 to 0, reserved</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public byte Reserved;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>0x03, disk volume number</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public byte Volume;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>0x04, file ID</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public short FileId;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x06 bit 7, checksum valid?
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public bool ValidChk;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x06 bits 6 to 0, used bytes in block
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public ushort UsedBytes;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x08, 3 bytes, absolute page number
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public uint AbsPage;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x0B, checksum of data
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public byte Checksum;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x0C, relative page number
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public ushort RelPage;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x0E, 3 bytes, next block, 0xFFFFFF if it's last block
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public uint NextBlock;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x11, 3 bytes, previous block, 0xFFFFFF if it's first block
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public uint PrevBlock;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
/// <summary>On-memory value for easy first block search.</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public bool IsFirst;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>On-memory value for easy last block search.</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public bool IsLast;
|
2017-12-19 20:33:03 +00:00
|
|
|
}
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// LisaOS tag as stored on Priam DataTower disks (24 bytes)
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
|
|
|
|
public struct PriamTag
|
|
|
|
|
{
|
|
|
|
|
/// <summary>0x00, Lisa OS version number</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public ushort Version;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>0x02 bits 7 to 6, kind of info in this block</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public byte Kind;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>0x02 bits 5 to 0, reserved</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public byte Reserved;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>0x03, disk volume number</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public byte Volume;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>0x04, file ID</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public short FileId;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x06 bit 7, checksum valid?
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public bool ValidChk;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x06 bits 6 to 0, used bytes in block
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public ushort UsedBytes;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x08, 3 bytes, absolute page number
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public uint AbsPage;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x0B, checksum of data
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public byte Checksum;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x0C, relative page number
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public ushort RelPage;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x0E, 3 bytes, next block, 0xFFFFFF if it's last block
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public uint NextBlock;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x11, 3 bytes, previous block, 0xFFFFFF if it's first block
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public uint PrevBlock;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x14, disk size
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public uint DiskSize;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
/// <summary>On-memory value for easy first block search.</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public bool IsFirst;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>On-memory value for easy last block search.</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public bool IsLast;
|
2016-08-21 19:23:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// LisaOS tag as stored on Apple Sony disks (12 bytes)
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
|
|
|
|
public struct SonyTag
|
|
|
|
|
{
|
|
|
|
|
/// <summary>0x00, Lisa OS version number</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public ushort Version;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>0x02 bits 7 to 6, kind of info in this block</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public byte Kind;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>0x02 bits 5 to 0, reserved</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public byte Reserved;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>0x03, disk volume number</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public byte Volume;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>0x04, file ID</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public short FileId;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x06, relative page number
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public ushort RelPage;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x08, 3 bytes, next block, 0x7FF if it's last block, 0x8000 set if block is valid
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public ushort NextBlock;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>
|
2017-12-23 18:31:38 +00:00
|
|
|
/// 0x0A, 3 bytes, previous block, 0x7FF if it's first block
|
2016-08-21 19:23:58 +01:00
|
|
|
/// </summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public ushort PrevBlock;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
/// <summary>On-memory value for easy first block search.</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public bool IsFirst;
|
2016-08-21 19:23:58 +01:00
|
|
|
/// <summary>On-memory value for easy last block search.</summary>
|
2017-12-22 02:04:18 +00:00
|
|
|
public bool IsLast;
|
2016-08-21 19:23:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static SonyTag? DecodeSonyTag(byte[] tag)
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
if(tag == null || tag.Length != 12) return null;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
SonyTag snTag = new SonyTag();
|
|
|
|
|
|
|
|
|
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
|
|
|
|
|
2017-12-22 02:04:18 +00:00
|
|
|
snTag.Version = BigEndianBitConverter.ToUInt16(tag, 0);
|
|
|
|
|
snTag.Kind = (byte)((tag[2] & 0xC0) >> 6);
|
|
|
|
|
snTag.Reserved = (byte)(tag[2] & 0x3F);
|
|
|
|
|
snTag.Volume = tag[3];
|
|
|
|
|
snTag.FileId = BigEndianBitConverter.ToInt16(tag, 4);
|
|
|
|
|
snTag.RelPage = BigEndianBitConverter.ToUInt16(tag, 6);
|
|
|
|
|
snTag.NextBlock = (ushort)(BigEndianBitConverter.ToUInt16(tag, 8) & 0x7FF);
|
|
|
|
|
snTag.PrevBlock = (ushort)(BigEndianBitConverter.ToUInt16(tag, 10) & 0x7FF);
|
2016-08-21 19:23:58 +01:00
|
|
|
|
2017-12-22 02:04:18 +00:00
|
|
|
snTag.IsLast = snTag.NextBlock == 0x7FF;
|
|
|
|
|
snTag.IsFirst = snTag.PrevBlock == 0x7FF;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
return snTag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ProfileTag? DecodeProfileTag(byte[] tag)
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
if(tag == null || tag.Length != 20) return null;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
ProfileTag phTag = new ProfileTag();
|
|
|
|
|
|
|
|
|
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
|
|
|
|
|
|
|
|
|
byte[] tmp = new byte[4];
|
|
|
|
|
|
2017-12-22 02:04:18 +00:00
|
|
|
phTag.Version = BigEndianBitConverter.ToUInt16(tag, 0);
|
|
|
|
|
phTag.Kind = (byte)((tag[2] & 0xC0) >> 6);
|
|
|
|
|
phTag.Reserved = (byte)(tag[2] & 0x3F);
|
|
|
|
|
phTag.Volume = tag[3];
|
|
|
|
|
phTag.FileId = BigEndianBitConverter.ToInt16(tag, 4);
|
|
|
|
|
phTag.ValidChk |= (tag[6] & 0x80) == 0x80;
|
|
|
|
|
phTag.UsedBytes = (ushort)(BigEndianBitConverter.ToUInt16(tag, 6) & 0x7FFF);
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
tmp[0] = 0x00;
|
|
|
|
|
tmp[1] = tag[8];
|
|
|
|
|
tmp[2] = tag[9];
|
|
|
|
|
tmp[3] = tag[10];
|
2017-12-22 02:04:18 +00:00
|
|
|
phTag.AbsPage = BigEndianBitConverter.ToUInt32(tmp, 0);
|
2016-08-21 19:23:58 +01:00
|
|
|
|
2017-12-22 02:04:18 +00:00
|
|
|
phTag.Checksum = tag[11];
|
|
|
|
|
phTag.RelPage = BigEndianBitConverter.ToUInt16(tag, 12);
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
tmp[0] = 0x00;
|
|
|
|
|
tmp[1] = tag[14];
|
|
|
|
|
tmp[2] = tag[15];
|
|
|
|
|
tmp[3] = tag[16];
|
2017-12-22 02:04:18 +00:00
|
|
|
phTag.NextBlock = BigEndianBitConverter.ToUInt32(tmp, 0);
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
tmp[0] = 0x00;
|
|
|
|
|
tmp[1] = tag[17];
|
|
|
|
|
tmp[2] = tag[18];
|
|
|
|
|
tmp[3] = tag[19];
|
2017-12-22 02:04:18 +00:00
|
|
|
phTag.PrevBlock = BigEndianBitConverter.ToUInt32(tmp, 0);
|
2016-08-21 19:23:58 +01:00
|
|
|
|
2017-12-22 02:04:18 +00:00
|
|
|
phTag.IsLast = phTag.NextBlock == 0xFFFFFF;
|
|
|
|
|
phTag.IsFirst = phTag.PrevBlock == 0xFFFFFF;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
return phTag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static PriamTag? DecodePriamTag(byte[] tag)
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
if(tag == null || tag.Length != 24) return null;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
PriamTag pmTag = new PriamTag();
|
|
|
|
|
|
|
|
|
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
|
|
|
|
|
|
|
|
|
byte[] tmp = new byte[4];
|
|
|
|
|
|
2017-12-22 02:04:18 +00:00
|
|
|
pmTag.Version = BigEndianBitConverter.ToUInt16(tag, 0);
|
|
|
|
|
pmTag.Kind = (byte)((tag[2] & 0xC0) >> 6);
|
|
|
|
|
pmTag.Reserved = (byte)(tag[2] & 0x3F);
|
|
|
|
|
pmTag.Volume = tag[3];
|
|
|
|
|
pmTag.FileId = BigEndianBitConverter.ToInt16(tag, 4);
|
|
|
|
|
pmTag.ValidChk |= (tag[6] & 0x80) == 0x80;
|
|
|
|
|
pmTag.UsedBytes = (ushort)(BigEndianBitConverter.ToUInt16(tag, 6) & 0x7FFF);
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
tmp[0] = 0x00;
|
|
|
|
|
tmp[1] = tag[8];
|
|
|
|
|
tmp[2] = tag[9];
|
|
|
|
|
tmp[3] = tag[10];
|
2017-12-22 02:04:18 +00:00
|
|
|
pmTag.AbsPage = BigEndianBitConverter.ToUInt32(tmp, 0);
|
2016-08-21 19:23:58 +01:00
|
|
|
|
2017-12-22 02:04:18 +00:00
|
|
|
pmTag.Checksum = tag[11];
|
|
|
|
|
pmTag.RelPage = BigEndianBitConverter.ToUInt16(tag, 12);
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
tmp[0] = 0x00;
|
|
|
|
|
tmp[1] = tag[14];
|
|
|
|
|
tmp[2] = tag[15];
|
|
|
|
|
tmp[3] = tag[16];
|
2017-12-22 02:04:18 +00:00
|
|
|
pmTag.NextBlock = BigEndianBitConverter.ToUInt32(tmp, 0);
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
tmp[0] = 0x00;
|
|
|
|
|
tmp[1] = tag[17];
|
|
|
|
|
tmp[2] = tag[18];
|
|
|
|
|
tmp[3] = tag[19];
|
2017-12-22 02:04:18 +00:00
|
|
|
pmTag.PrevBlock = BigEndianBitConverter.ToUInt32(tmp, 0);
|
2016-08-21 19:23:58 +01:00
|
|
|
|
2017-12-22 02:04:18 +00:00
|
|
|
pmTag.DiskSize = BigEndianBitConverter.ToUInt32(tag, 20);
|
2016-08-21 19:23:58 +01:00
|
|
|
|
2017-12-22 02:04:18 +00:00
|
|
|
pmTag.IsLast = pmTag.NextBlock == 0xFFFFFF;
|
|
|
|
|
pmTag.IsFirst = pmTag.PrevBlock == 0xFFFFFF;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
return pmTag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static PriamTag? DecodeTag(byte[] tag)
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
if(tag == null) return null;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
2017-12-21 16:07:20 +00:00
|
|
|
PriamTag pmTag;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
switch(tag.Length)
|
|
|
|
|
{
|
|
|
|
|
case 12:
|
|
|
|
|
SonyTag? snTag = DecodeSonyTag(tag);
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
if(snTag == null) return null;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
pmTag = new PriamTag();
|
2017-12-22 02:04:18 +00:00
|
|
|
pmTag.AbsPage = 0;
|
|
|
|
|
pmTag.Checksum = 0;
|
|
|
|
|
pmTag.DiskSize = 0;
|
|
|
|
|
pmTag.FileId = snTag.Value.FileId;
|
|
|
|
|
pmTag.Kind = snTag.Value.Kind;
|
|
|
|
|
pmTag.NextBlock = snTag.Value.NextBlock;
|
|
|
|
|
pmTag.PrevBlock = snTag.Value.PrevBlock;
|
|
|
|
|
pmTag.RelPage = snTag.Value.RelPage;
|
|
|
|
|
pmTag.Reserved = snTag.Value.Reserved;
|
|
|
|
|
pmTag.UsedBytes = 0;
|
|
|
|
|
pmTag.ValidChk = false;
|
|
|
|
|
pmTag.Version = snTag.Value.Version;
|
|
|
|
|
pmTag.Volume = snTag.Value.Volume;
|
|
|
|
|
pmTag.IsFirst = snTag.Value.IsFirst;
|
|
|
|
|
pmTag.IsLast = snTag.Value.IsLast;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
return pmTag;
|
|
|
|
|
case 20:
|
|
|
|
|
ProfileTag? phTag = DecodeProfileTag(tag);
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
if(phTag == null) return null;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
pmTag = new PriamTag();
|
2017-12-22 02:04:18 +00:00
|
|
|
pmTag.AbsPage = phTag.Value.AbsPage;
|
|
|
|
|
pmTag.Checksum = phTag.Value.Checksum;
|
|
|
|
|
pmTag.DiskSize = 0;
|
|
|
|
|
pmTag.FileId = phTag.Value.FileId;
|
|
|
|
|
pmTag.Kind = phTag.Value.Kind;
|
|
|
|
|
pmTag.NextBlock = phTag.Value.NextBlock;
|
|
|
|
|
pmTag.PrevBlock = phTag.Value.PrevBlock;
|
|
|
|
|
pmTag.RelPage = phTag.Value.RelPage;
|
|
|
|
|
pmTag.Reserved = phTag.Value.Reserved;
|
|
|
|
|
pmTag.UsedBytes = phTag.Value.UsedBytes;
|
|
|
|
|
pmTag.ValidChk = phTag.Value.ValidChk;
|
|
|
|
|
pmTag.Version = phTag.Value.Version;
|
|
|
|
|
pmTag.Volume = phTag.Value.Volume;
|
|
|
|
|
pmTag.IsFirst = phTag.Value.IsFirst;
|
|
|
|
|
pmTag.IsLast = phTag.Value.IsLast;
|
2016-08-21 19:23:58 +01:00
|
|
|
|
|
|
|
|
return pmTag;
|
2017-12-19 20:33:03 +00:00
|
|
|
case 24: return DecodePriamTag(tag);
|
|
|
|
|
default: return null;
|
2016-08-21 19:23:58 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
}
|