mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Final cleanup of DiscImageChef.Filesystems.
This commit is contained in:
@@ -77,8 +77,7 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
CurrentEncoding.GetString(vdMagic) == CDI_MAGIC;
|
||||
}
|
||||
|
||||
public override void GetInformation(ImagePlugin imagePlugin, Partition partition,
|
||||
out string information)
|
||||
public override void GetInformation(ImagePlugin imagePlugin, Partition partition, out string information)
|
||||
{
|
||||
information = "";
|
||||
StringBuilder isoMetadata = new StringBuilder();
|
||||
@@ -179,8 +178,7 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
}
|
||||
else if(cdi)
|
||||
fsvd =
|
||||
BigEndianMarshal
|
||||
.ByteArrayToStructureBigEndian<FileStructureVolumeDescriptor>(vdSector);
|
||||
BigEndianMarshal.ByteArrayToStructureBigEndian<FileStructureVolumeDescriptor>(vdSector);
|
||||
else
|
||||
{
|
||||
IntPtr ptr = Marshal.AllocHGlobal(2048);
|
||||
@@ -194,14 +192,16 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
{
|
||||
IntPtr ptr = Marshal.AllocHGlobal(2048);
|
||||
Marshal.Copy(vdSector, 0, ptr, 2048);
|
||||
PrimaryVolumeDescriptor svd = (PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor));
|
||||
PrimaryVolumeDescriptor svd =
|
||||
(PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
|
||||
// Check if this is Joliet
|
||||
if(svd.escape_sequences[0] == '%' && svd.escape_sequences[1] == '/')
|
||||
if(svd.escape_sequences[2] == '@' || svd.escape_sequences[2] == 'C' ||
|
||||
svd.escape_sequences[2] == 'E') jolietvd = svd;
|
||||
else DicConsole.WriteLine("ISO9660 plugin", "Found unknown supplementary volume descriptor");
|
||||
else
|
||||
DicConsole.WriteLine("ISO9660 plugin", "Found unknown supplementary volume descriptor");
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -302,7 +302,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
|
||||
ushort nextSignature = BigEndianBitConverter.ToUInt16(sa, saOff);
|
||||
|
||||
switch(nextSignature) {
|
||||
switch(nextSignature)
|
||||
{
|
||||
// Easy, contains size field
|
||||
case APPLE_MAGIC:
|
||||
apple = true;
|
||||
@@ -344,7 +345,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
{
|
||||
nextSignature = BigEndianBitConverter.ToUInt16(sa, saOff);
|
||||
|
||||
switch(nextSignature) {
|
||||
switch(nextSignature)
|
||||
{
|
||||
case APPLE_MAGIC:
|
||||
if(sa[saOff + 3] == 1 && sa[saOff + 2] == 7) apple = true;
|
||||
else apple |= sa[saOff + 3] != 1;
|
||||
@@ -352,8 +354,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
case SUSP_CONTINUATION when saOff + sa[saOff + 2] <= saLen:
|
||||
byte[] ce = new byte[sa[saOff + 2]];
|
||||
Array.Copy(sa, saOff, ce, 0, ce.Length);
|
||||
ContinuationArea ca =
|
||||
BigEndianMarshal.ByteArrayToStructureBigEndian<ContinuationArea>(ce);
|
||||
ContinuationArea ca = BigEndianMarshal
|
||||
.ByteArrayToStructureBigEndian<ContinuationArea>(ce);
|
||||
contareas.Add(ca);
|
||||
break;
|
||||
case SUSP_REFERENCE when saOff + sa[saOff + 2] <= saLen:
|
||||
@@ -371,8 +373,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
|
||||
ziso |= nextSignature == ZISO_MAGIC;
|
||||
amiga |= nextSignature == AMIGA_MAGIC;
|
||||
aaip |= nextSignature == AAIP_MAGIC ||
|
||||
nextSignature == AAIP_MAGIC_OLD && sa[saOff + 3] == 1 && sa[saOff + 2] >= 9;
|
||||
aaip |= nextSignature == AAIP_MAGIC || nextSignature == AAIP_MAGIC_OLD &&
|
||||
sa[saOff + 3] == 1 && sa[saOff + 2] >= 9;
|
||||
|
||||
saOff += sa[saOff + 2];
|
||||
|
||||
@@ -394,7 +396,7 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
foreach(ContinuationArea ca in contareas)
|
||||
{
|
||||
uint caLen = (ca.ca_length_be + ca.offset_be) /
|
||||
(highSierra ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size);
|
||||
(highSierra ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size);
|
||||
if((ca.ca_length_be + ca.offset_be) %
|
||||
(highSierra ? hsvd.Value.logical_block_size : pvd.Value.logical_block_size) > 0) caLen++;
|
||||
|
||||
@@ -407,7 +409,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
{
|
||||
ushort nextSignature = BigEndianBitConverter.ToUInt16(caData, caOff);
|
||||
|
||||
switch(nextSignature) {
|
||||
switch(nextSignature)
|
||||
{
|
||||
// Apple never said to include its extensions inside a continuation area, but just in case
|
||||
case APPLE_MAGIC:
|
||||
if(caData[caOff + 3] == 1 && caData[caOff + 2] == 7) apple = true;
|
||||
@@ -428,8 +431,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
|
||||
ziso |= nextSignature == ZISO_MAGIC;
|
||||
amiga |= nextSignature == AMIGA_MAGIC;
|
||||
aaip |= nextSignature == AAIP_MAGIC ||
|
||||
nextSignature == AAIP_MAGIC_OLD && caData[caOff + 3] == 1 && caData[caOff + 2] >= 9;
|
||||
aaip |= nextSignature == AAIP_MAGIC || nextSignature == AAIP_MAGIC_OLD && caData[caOff + 3] == 1 &&
|
||||
caData[caOff + 2] >= 9;
|
||||
|
||||
caOff += caData[caOff + 2];
|
||||
}
|
||||
@@ -555,7 +558,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
|
||||
IntPtr ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
||||
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
||||
ElToritoValidationEntry valentry = (ElToritoValidationEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoValidationEntry));
|
||||
ElToritoValidationEntry valentry =
|
||||
(ElToritoValidationEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoValidationEntry));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
|
||||
if(valentry.signature != EL_TORITO_MAGIC) goto exit_torito;
|
||||
@@ -564,11 +568,13 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
|
||||
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
||||
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
||||
ElToritoInitialEntry initialEntry = (ElToritoInitialEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoInitialEntry));
|
||||
ElToritoInitialEntry initialEntry =
|
||||
(ElToritoInitialEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoInitialEntry));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
initialEntry.boot_type = (ElToritoEmulation)((byte)initialEntry.boot_type & 0xF);
|
||||
|
||||
byte[] bootImage = imagePlugin.ReadSectors(initialEntry.load_rba + partition.Start, initialEntry.sector_count);
|
||||
byte[] bootImage =
|
||||
imagePlugin.ReadSectors(initialEntry.load_rba + partition.Start, initialEntry.sector_count);
|
||||
|
||||
isoMetadata.AppendLine("----------------------");
|
||||
isoMetadata.AppendLine("EL TORITO INFORMATION:");
|
||||
@@ -620,11 +626,12 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
const int SECTION_COUNTER = 2;
|
||||
|
||||
while(toritoOff < vdSector.Length && (vdSector[toritoOff] == (byte)ElToritoIndicator.Header ||
|
||||
vdSector[toritoOff] == (byte)ElToritoIndicator.LastHeader))
|
||||
vdSector[toritoOff] == (byte)ElToritoIndicator.LastHeader))
|
||||
{
|
||||
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
||||
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
||||
ElToritoSectionHeaderEntry sectionHeader = (ElToritoSectionHeaderEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoSectionHeaderEntry));
|
||||
ElToritoSectionHeaderEntry sectionHeader =
|
||||
(ElToritoSectionHeaderEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoSectionHeaderEntry));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
toritoOff += EL_TORITO_ENTRY_SIZE;
|
||||
|
||||
@@ -637,16 +644,16 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
{
|
||||
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
||||
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
||||
ElToritoSectionEntry sectionEntry = (ElToritoSectionEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoSectionEntry));
|
||||
ElToritoSectionEntry sectionEntry =
|
||||
(ElToritoSectionEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoSectionEntry));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
toritoOff += EL_TORITO_ENTRY_SIZE;
|
||||
|
||||
isoMetadata.AppendFormat("\tEntry {0}:", entryCounter);
|
||||
if(sectionEntry.bootable == ElToritoIndicator.Bootable)
|
||||
{
|
||||
bootImage =
|
||||
imagePlugin.ReadSectors(sectionEntry.load_rba + partition.Start,
|
||||
sectionEntry.sector_count);
|
||||
bootImage = imagePlugin.ReadSectors(sectionEntry.load_rba + partition.Start,
|
||||
sectionEntry.sector_count);
|
||||
isoMetadata.AppendFormat("\t\tBootable on {0}", sectionHeader.platform_id).AppendLine();
|
||||
isoMetadata.AppendFormat("\t\tBootable image starts at sector {0} and runs for {1} sectors",
|
||||
sectionEntry.load_rba, sectionEntry.sector_count).AppendLine();
|
||||
@@ -684,8 +691,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
sectionEntry.selection_criteria_type).AppendLine();
|
||||
isoMetadata.AppendFormat("\t\tSystem type: 0x{0:X2}", sectionEntry.system_type)
|
||||
.AppendLine();
|
||||
isoMetadata.AppendFormat("\t\tBootable image's SHA1: {0}",
|
||||
sha1Ctx.Data(bootImage, out _)).AppendLine();
|
||||
isoMetadata.AppendFormat("\t\tBootable image's SHA1: {0}", sha1Ctx.Data(bootImage, out _))
|
||||
.AppendLine();
|
||||
}
|
||||
else isoMetadata.AppendLine("\t\tNot bootable");
|
||||
|
||||
@@ -700,7 +707,8 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
{
|
||||
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
||||
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
||||
ElToritoSectionEntryExtension sectionExtension = (ElToritoSectionEntryExtension)
|
||||
ElToritoSectionEntryExtension sectionExtension =
|
||||
(ElToritoSectionEntryExtension)
|
||||
Marshal.PtrToStructure(ptr, typeof(ElToritoSectionEntryExtension));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
toritoOff += EL_TORITO_ENTRY_SIZE;
|
||||
|
||||
@@ -38,6 +38,49 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
{
|
||||
public partial class ISO9660
|
||||
{
|
||||
static DecodedVolumeDescriptor DecodeVolumeDescriptor(FileStructureVolumeDescriptor pvd)
|
||||
{
|
||||
DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor
|
||||
{
|
||||
SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim('\0'),
|
||||
VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim('\0'),
|
||||
VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim('\0'),
|
||||
PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim('\0'),
|
||||
DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim('\0'),
|
||||
ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim('\0')
|
||||
};
|
||||
|
||||
if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) decodedVD.CreationTime = DateTime.MinValue;
|
||||
else decodedVD.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date);
|
||||
|
||||
if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00)
|
||||
decodedVD.HasModificationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasModificationTime = true;
|
||||
decodedVD.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date);
|
||||
}
|
||||
|
||||
if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) decodedVD.HasExpirationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasExpirationTime = true;
|
||||
decodedVD.ExpirationTime = DateHandlers.HighSierraToDateTime(pvd.expiration_date);
|
||||
}
|
||||
|
||||
if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVD.HasEffectiveTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasEffectiveTime = true;
|
||||
decodedVD.EffectiveTime = DateHandlers.HighSierraToDateTime(pvd.effective_date);
|
||||
}
|
||||
|
||||
decodedVD.Blocks = pvd.volume_space_size;
|
||||
decodedVD.BlockSize = pvd.logical_block_size;
|
||||
|
||||
return decodedVD;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct FileStructureVolumeDescriptor
|
||||
{
|
||||
@@ -115,48 +158,5 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
public byte file_no;
|
||||
public byte reserved2;
|
||||
}
|
||||
|
||||
static DecodedVolumeDescriptor DecodeVolumeDescriptor(FileStructureVolumeDescriptor pvd)
|
||||
{
|
||||
DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor
|
||||
{
|
||||
SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim('\0'),
|
||||
VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim('\0'),
|
||||
VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim('\0'),
|
||||
PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim('\0'),
|
||||
DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim('\0'),
|
||||
ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim('\0')
|
||||
};
|
||||
|
||||
if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00)
|
||||
decodedVD.CreationTime = DateTime.MinValue;
|
||||
else decodedVD.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date);
|
||||
|
||||
if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) decodedVD.HasModificationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasModificationTime = true;
|
||||
decodedVD.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date);
|
||||
}
|
||||
|
||||
if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) decodedVD.HasExpirationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasExpirationTime = true;
|
||||
decodedVD.ExpirationTime = DateHandlers.HighSierraToDateTime(pvd.expiration_date);
|
||||
}
|
||||
|
||||
if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVD.HasEffectiveTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasEffectiveTime = true;
|
||||
decodedVD.EffectiveTime = DateHandlers.HighSierraToDateTime(pvd.effective_date);
|
||||
}
|
||||
|
||||
decodedVD.Blocks = pvd.volume_space_size;
|
||||
decodedVD.BlockSize = pvd.logical_block_size;
|
||||
|
||||
return decodedVD;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,49 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
{
|
||||
public partial class ISO9660
|
||||
{
|
||||
static DecodedVolumeDescriptor DecodeVolumeDescriptor(HighSierraPrimaryVolumeDescriptor pvd)
|
||||
{
|
||||
DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor
|
||||
{
|
||||
SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim('\0'),
|
||||
VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim('\0'),
|
||||
VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim('\0'),
|
||||
PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim('\0'),
|
||||
DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim('\0'),
|
||||
ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim('\0')
|
||||
};
|
||||
|
||||
if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) decodedVD.CreationTime = DateTime.MinValue;
|
||||
else decodedVD.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date);
|
||||
|
||||
if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00)
|
||||
decodedVD.HasModificationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasModificationTime = true;
|
||||
decodedVD.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date);
|
||||
}
|
||||
|
||||
if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) decodedVD.HasExpirationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasExpirationTime = true;
|
||||
decodedVD.ExpirationTime = DateHandlers.HighSierraToDateTime(pvd.expiration_date);
|
||||
}
|
||||
|
||||
if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVD.HasEffectiveTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasEffectiveTime = true;
|
||||
decodedVD.EffectiveTime = DateHandlers.HighSierraToDateTime(pvd.effective_date);
|
||||
}
|
||||
|
||||
decodedVD.Blocks = pvd.volume_space_size;
|
||||
decodedVD.BlockSize = pvd.logical_block_size;
|
||||
|
||||
return decodedVD;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct HighSierraPrimaryVolumeDescriptor
|
||||
{
|
||||
@@ -107,48 +150,5 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
public byte name_len;
|
||||
// Followed by name[name_len] and then system area until length arrives
|
||||
}
|
||||
|
||||
static DecodedVolumeDescriptor DecodeVolumeDescriptor(HighSierraPrimaryVolumeDescriptor pvd)
|
||||
{
|
||||
DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor
|
||||
{
|
||||
SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim('\0'),
|
||||
VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim('\0'),
|
||||
VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim('\0'),
|
||||
PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim('\0'),
|
||||
DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim('\0'),
|
||||
ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim('\0')
|
||||
};
|
||||
|
||||
if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00)
|
||||
decodedVD.CreationTime = DateTime.MinValue;
|
||||
else decodedVD.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date);
|
||||
|
||||
if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) decodedVD.HasModificationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasModificationTime = true;
|
||||
decodedVD.ModificationTime = DateHandlers.HighSierraToDateTime(pvd.modification_date);
|
||||
}
|
||||
|
||||
if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) decodedVD.HasExpirationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasExpirationTime = true;
|
||||
decodedVD.ExpirationTime = DateHandlers.HighSierraToDateTime(pvd.expiration_date);
|
||||
}
|
||||
|
||||
if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVD.HasEffectiveTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasEffectiveTime = true;
|
||||
decodedVD.EffectiveTime = DateHandlers.HighSierraToDateTime(pvd.effective_date);
|
||||
}
|
||||
|
||||
decodedVD.Blocks = pvd.volume_space_size;
|
||||
decodedVD.BlockSize = pvd.logical_block_size;
|
||||
|
||||
return decodedVD;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,49 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
{
|
||||
public partial class ISO9660
|
||||
{
|
||||
static DecodedVolumeDescriptor DecodeVolumeDescriptor(PrimaryVolumeDescriptor pvd)
|
||||
{
|
||||
DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor
|
||||
{
|
||||
SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim('\0'),
|
||||
VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim('\0'),
|
||||
VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim('\0'),
|
||||
PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim('\0'),
|
||||
DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim('\0'),
|
||||
ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim('\0')
|
||||
};
|
||||
|
||||
if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) decodedVD.CreationTime = DateTime.MinValue;
|
||||
else decodedVD.CreationTime = DateHandlers.Iso9660ToDateTime(pvd.creation_date);
|
||||
|
||||
if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00)
|
||||
decodedVD.HasModificationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasModificationTime = true;
|
||||
decodedVD.ModificationTime = DateHandlers.Iso9660ToDateTime(pvd.modification_date);
|
||||
}
|
||||
|
||||
if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) decodedVD.HasExpirationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasExpirationTime = true;
|
||||
decodedVD.ExpirationTime = DateHandlers.Iso9660ToDateTime(pvd.expiration_date);
|
||||
}
|
||||
|
||||
if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVD.HasEffectiveTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasEffectiveTime = true;
|
||||
decodedVD.EffectiveTime = DateHandlers.Iso9660ToDateTime(pvd.effective_date);
|
||||
}
|
||||
|
||||
decodedVD.Blocks = pvd.volume_space_size;
|
||||
decodedVD.BlockSize = pvd.logical_block_size;
|
||||
|
||||
return decodedVD;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct PrimaryVolumeDescriptor
|
||||
{
|
||||
@@ -165,48 +208,5 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
public ushort parent_dirno;
|
||||
// Followed by name[name_len]
|
||||
}
|
||||
|
||||
static DecodedVolumeDescriptor DecodeVolumeDescriptor(PrimaryVolumeDescriptor pvd)
|
||||
{
|
||||
DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor
|
||||
{
|
||||
SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim('\0'),
|
||||
VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim('\0'),
|
||||
VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim('\0'),
|
||||
PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim('\0'),
|
||||
DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim('\0'),
|
||||
ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim('\0')
|
||||
};
|
||||
|
||||
if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00)
|
||||
decodedVD.CreationTime = DateTime.MinValue;
|
||||
else decodedVD.CreationTime = DateHandlers.Iso9660ToDateTime(pvd.creation_date);
|
||||
|
||||
if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) decodedVD.HasModificationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasModificationTime = true;
|
||||
decodedVD.ModificationTime = DateHandlers.Iso9660ToDateTime(pvd.modification_date);
|
||||
}
|
||||
|
||||
if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) decodedVD.HasExpirationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasExpirationTime = true;
|
||||
decodedVD.ExpirationTime = DateHandlers.Iso9660ToDateTime(pvd.expiration_date);
|
||||
}
|
||||
|
||||
if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVD.HasEffectiveTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasEffectiveTime = true;
|
||||
decodedVD.EffectiveTime = DateHandlers.Iso9660ToDateTime(pvd.effective_date);
|
||||
}
|
||||
|
||||
decodedVD.Blocks = pvd.volume_space_size;
|
||||
decodedVD.BlockSize = pvd.logical_block_size;
|
||||
|
||||
return decodedVD;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,21 +57,24 @@ namespace DiscImageChef.Filesystems.ISO9660
|
||||
decodedVD.CreationTime = DateTime.MinValue;
|
||||
else decodedVD.CreationTime = DateHandlers.Iso9660ToDateTime(jolietvd.creation_date);
|
||||
|
||||
if(jolietvd.modification_date[0] < 0x31 || jolietvd.modification_date[0] > 0x39) decodedVD.HasModificationTime = false;
|
||||
if(jolietvd.modification_date[0] < 0x31 || jolietvd.modification_date[0] > 0x39)
|
||||
decodedVD.HasModificationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasModificationTime = true;
|
||||
decodedVD.ModificationTime = DateHandlers.Iso9660ToDateTime(jolietvd.modification_date);
|
||||
}
|
||||
|
||||
if(jolietvd.expiration_date[0] < 0x31 || jolietvd.expiration_date[0] > 0x39) decodedVD.HasExpirationTime = false;
|
||||
if(jolietvd.expiration_date[0] < 0x31 || jolietvd.expiration_date[0] > 0x39)
|
||||
decodedVD.HasExpirationTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasExpirationTime = true;
|
||||
decodedVD.ExpirationTime = DateHandlers.Iso9660ToDateTime(jolietvd.expiration_date);
|
||||
}
|
||||
|
||||
if(jolietvd.effective_date[0] < 0x31 || jolietvd.effective_date[0] > 0x39) decodedVD.HasEffectiveTime = false;
|
||||
if(jolietvd.effective_date[0] < 0x31 || jolietvd.effective_date[0] > 0x39)
|
||||
decodedVD.HasEffectiveTime = false;
|
||||
else
|
||||
{
|
||||
decodedVD.HasEffectiveTime = true;
|
||||
|
||||
Reference in New Issue
Block a user