mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Separate Lisa tag decoding from Lisa filesystem and added
Priam tags.
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using DiscImageChef.Decoders;
|
||||
|
||||
namespace DiscImageChef.Filesystems.LisaFS
|
||||
{
|
||||
@@ -214,47 +215,15 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="tag">Sector tag.</param>
|
||||
/// <param name="decoded">Decoded sector tag.</param>
|
||||
Errno DecodeTag(byte[] tag, out Tag decoded)
|
||||
Errno DecodeTag(byte[] tag, out LisaTag.PriamTag decoded)
|
||||
{
|
||||
decoded = new Tag();
|
||||
decoded = new LisaTag.PriamTag();
|
||||
LisaTag.PriamTag? pmTag = LisaTag.DecodeTag(tag);
|
||||
|
||||
if(tag.Length == 12)
|
||||
{
|
||||
decoded.version = BigEndianBitConverter.ToUInt16(tag, 0x00);
|
||||
decoded.unknown = BigEndianBitConverter.ToUInt16(tag, 0x02);
|
||||
decoded.fileID = BigEndianBitConverter.ToInt16(tag, 0x04);
|
||||
decoded.relBlock = BigEndianBitConverter.ToUInt16(tag, 0x06);
|
||||
decoded.nextBlock = BigEndianBitConverter.ToUInt16(tag, 0x08);
|
||||
decoded.nextBlock &= 0x7FF;
|
||||
decoded.prevBlock = BigEndianBitConverter.ToUInt16(tag, 0x0A);
|
||||
decoded.prevBlock &= 0x7FF;
|
||||
|
||||
if(decoded.nextBlock == 0x7FF)
|
||||
decoded.isLast = true;
|
||||
if(decoded.prevBlock == 0x7FF)
|
||||
decoded.isFirst = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
decoded.version = BigEndianBitConverter.ToUInt16(tag, 0x00);
|
||||
decoded.unknown = BigEndianBitConverter.ToUInt16(tag, 0x02);
|
||||
decoded.fileID = BigEndianBitConverter.ToInt16(tag, 0x04);
|
||||
decoded.usedBytes = BigEndianBitConverter.ToUInt16(tag, 0x06);
|
||||
decoded.absoluteBlock = BigEndianBitConverter.ToUInt32(tag, 0x07);
|
||||
decoded.absoluteBlock &= 0xFFFFFF;
|
||||
decoded.checksum = tag[0x0B];
|
||||
decoded.relBlock = BigEndianBitConverter.ToUInt16(tag, 0x0C);
|
||||
decoded.nextBlock = BigEndianBitConverter.ToUInt32(tag, 0x0D);
|
||||
decoded.nextBlock &= 0xFFFFFF;
|
||||
decoded.prevBlock = BigEndianBitConverter.ToUInt32(tag, 0x10);
|
||||
decoded.prevBlock &= 0xFFFFFF;
|
||||
|
||||
if(decoded.nextBlock == 0xFFFFFF)
|
||||
decoded.isLast = true;
|
||||
if(decoded.prevBlock == 0xFFFFFF)
|
||||
decoded.isFirst = true;
|
||||
}
|
||||
if(!pmTag.HasValue)
|
||||
return Errno.InvalidArgument;
|
||||
|
||||
decoded = pmTag.Value;
|
||||
return Errno.NoError;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user