Decode "TF" system area.

This commit is contained in:
2019-07-28 18:32:15 +01:00
parent 0271ea582e
commit 24920776ed
4 changed files with 86 additions and 0 deletions

View File

@@ -1,9 +1,20 @@
using System;
using DiscImageChef.Helpers;
namespace DiscImageChef.Filesystems.ISO9660
{
public partial class ISO9660
{
DateTime? DecodeIsoDateTime(byte[] timestamp)
{
switch(timestamp?.Length)
{
case 7: return DecodeIsoDateTime(Marshal.ByteArrayToStructureLittleEndian<IsoTimestamp>(timestamp));
case 17: return DateHandlers.Iso9660ToDateTime(timestamp);
default: return null;
}
}
DateTime? DecodeIsoDateTime(IsoTimestamp timestamp)
{
try

View File

@@ -528,6 +528,65 @@ namespace DiscImageChef.Filesystems.ISO9660
break;
case RRIP_TIMESTAMPS:
byte tfLength = data[systemAreaOff + 2];
Timestamps timestamps =
Marshal.ByteArrayToStructureLittleEndian<Timestamps>(data, systemAreaOff,
Marshal.SizeOf<Timestamps>());
int tfOff = systemAreaOff + Marshal.SizeOf<Timestamps>();
int tfLen = timestamps.flags.HasFlag(TimestampFlags.LongFormat) ? 17 : 7;
if(timestamps.flags.HasFlag(TimestampFlags.Creation))
{
entry.RripCreation = new byte[tfLen];
Array.Copy(data, tfOff, entry.RripCreation, 0, tfLen);
tfOff += tfLen;
}
if(timestamps.flags.HasFlag(TimestampFlags.Modification))
{
entry.RripModify = new byte[tfLen];
Array.Copy(data, tfOff, entry.RripModify, 0, tfLen);
tfOff += tfLen;
}
if(timestamps.flags.HasFlag(TimestampFlags.Access))
{
entry.RripAccess = new byte[tfLen];
Array.Copy(data, tfOff, entry.RripAccess, 0, tfLen);
tfOff += tfLen;
}
if(timestamps.flags.HasFlag(TimestampFlags.AttributeChange))
{
entry.RripAttributeChange = new byte[tfLen];
Array.Copy(data, tfOff, entry.RripAttributeChange, 0, tfLen);
tfOff += tfLen;
}
if(timestamps.flags.HasFlag(TimestampFlags.Backup))
{
entry.RripBackup = new byte[tfLen];
Array.Copy(data, tfOff, entry.RripBackup, 0, tfLen);
tfOff += tfLen;
}
if(timestamps.flags.HasFlag(TimestampFlags.Expiration))
{
entry.RripExpiration = new byte[tfLen];
Array.Copy(data, tfOff, entry.RripExpiration, 0, tfLen);
tfOff += tfLen;
}
if(timestamps.flags.HasFlag(TimestampFlags.Effective))
{
entry.RripEffective = new byte[tfLen];
Array.Copy(data, tfOff, entry.RripEffective, 0, tfLen);
}
systemAreaOff += tfLength;
break;
case RRIP_SPARSE:
case SUSP_CONTINUATION:
case SUSP_PADDING:

View File

@@ -186,6 +186,15 @@ namespace DiscImageChef.Filesystems.ISO9660
stat.DeviceNo = (entry.PosixDeviceNumber.Value.dev_t_high << 32) +
entry.PosixDeviceNumber.Value.dev_t_low;
if(entry.RripModify != null) stat.LastWriteTimeUtc = DecodeIsoDateTime(entry.RripModify);
if(entry.RripAccess != null) stat.AccessTimeUtc = DecodeIsoDateTime(entry.RripAccess);
if(entry.RripAttributeChange != null)
stat.StatusChangeTimeUtc = DecodeIsoDateTime(entry.RripAttributeChange);
if(entry.RripBackup != null) stat.BackupTimeUtc = DecodeIsoDateTime(entry.RripBackup);
if(entry.AssociatedFile is null || entry.AssociatedFile.Extent == 0 || entry.AssociatedFile.Size == 0)
return Errno.NoError;

View File

@@ -74,6 +74,13 @@ namespace DiscImageChef.Filesystems.ISO9660
public PosixDeviceNumber? PosixDeviceNumber;
public DecodedDirectoryEntry ResourceFork;
public byte[] RockRidgeAlternateName;
public byte[] RripAccess;
public byte[] RripAttributeChange;
public byte[] RripBackup;
public byte[] RripCreation;
public byte[] RripEffective;
public byte[] RripExpiration;
public byte[] RripModify;
public uint Size;
public DateTime? Timestamp;
public ushort VolumeSequenceNumber;