diff --git a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ISO/ISODataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ISO/ISODataFormat.cs index 9ee1df0c..37c9fdb7 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ISO/ISODataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ISO/ISODataFormat.cs @@ -237,7 +237,7 @@ namespace UniversalEditor.DataFormats.FileSystem.ISO return descriptor; } - private DateTime ReadDECDateTime(IO.Reader br) + private DateTime? ReadDECDateTime(IO.Reader br) { string szYear = br.ReadFixedLengthString(4); // Year from 1 to 9999. string szMonth = br.ReadFixedLengthString(2); // Month from 1 to 12. @@ -267,23 +267,34 @@ namespace UniversalEditor.DataFormats.FileSystem.ISO } catch (Exception ex) { - return DateTime.Now; + return null; } } - private void WriteDECDateTime(IO.Writer bw, DateTime dt) + private void WriteDECDateTime(IO.Writer bw, DateTime? dt) { - bw.WriteFixedLengthString(dt.Year.ToString(), 4, ' '); - bw.WriteFixedLengthString(dt.Month.ToString(), 2, ' '); - bw.WriteFixedLengthString(dt.Day.ToString(), 2, ' '); - bw.WriteFixedLengthString(dt.Hour.ToString(), 2, ' '); - bw.WriteFixedLengthString(dt.Minute.ToString(), 2, ' '); - bw.WriteFixedLengthString(dt.Second.ToString(), 2, ' '); - bw.WriteFixedLengthString(dt.Millisecond.ToString(), 2, ' '); + if (dt == null) + { + bw.WriteFixedLengthString("0000000000000000"); + } + else + { + bw.WriteFixedLengthString(dt.Value.Year.ToString(), 4, ' '); + bw.WriteFixedLengthString(dt.Value.Month.ToString(), 2, ' '); + bw.WriteFixedLengthString(dt.Value.Day.ToString(), 2, ' '); + bw.WriteFixedLengthString(dt.Value.Hour.ToString(), 2, ' '); + bw.WriteFixedLengthString(dt.Value.Minute.ToString(), 2, ' '); + bw.WriteFixedLengthString(dt.Value.Second.ToString(), 2, ' '); + bw.WriteFixedLengthString(dt.Value.Millisecond.ToString(), 2, ' '); + } // Time zone offset from GMT in 15 minute intervals, starting at interval -48 (west) and running up to // interval 52 (east). So value 0 indicates interval -48 which equals GMT-12 hours, and value 100 // indicates interval 52 which equals GMT+13 hours. byte timeZoneOffset = 0; + + if (dt != null) + { + } bw.WriteByte(timeZoneOffset); } diff --git a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ISO/Internal/PrimaryVolumeDescriptor.cs b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ISO/Internal/PrimaryVolumeDescriptor.cs index 80b089e8..ca554e66 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ISO/Internal/PrimaryVolumeDescriptor.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.FileSystem/DataFormats/FileSystem/ISO/Internal/PrimaryVolumeDescriptor.cs @@ -5,144 +5,144 @@ using System.Text; namespace UniversalEditor.DataFormats.FileSystem.ISO.Internal { - internal struct PrimaryVolumeDescriptor - { - /// - /// Always 0x00. - /// - public byte unused1; - /// - /// The name of the system that can act upon sectors 0x00-0x0F for the volume. - /// - public string systemName; - /// - /// Identification of this volume. - /// - public string volumeName; - /// - /// All zeroes. - /// - public ulong unused2; - /// - /// Number of Logical Blocks in which the volume is recorded. - /// - public uint volumeSpaceSize; - /// - /// All zeroes. - /// - public byte[] unused3; - /// - /// The size of the set in this logical volume (number of disks). - /// - public ushort volumeSetSize; - /// - /// The number of this disk in the Volume Set. - /// - public ushort volumeSequenceNumber; - /// - /// The size in bytes of a logical block. NB: This means that a logical block on a CD could be something - /// other than 2 KiB! - /// - public ushort logicalBlockSize; - /// - /// The size in bytes of the path table. - /// - public uint pathTableSize; - /// - /// LBA location of the path table. The path table pointed to contains only little-endian values. - /// - public uint pathTableLocationTypeL; - /// - /// LBA location of the optional path table. The path table pointed to contains only little-endian values. - /// Zero means that no optional path table exists. - /// - public uint optionalPathTableLocationTypeL; - /// - /// LBA location of the path table. The path table pointed to contains only big-endian values. - /// - public uint pathTableLocationTypeM; - /// - /// LBA location of the optional path table. The path table pointed to contains only big-endian values. Zero - /// means that no optional path table exists. - /// - public uint optionalPathTableLocationTypeM; + internal struct PrimaryVolumeDescriptor + { + /// + /// Always 0x00. + /// + public byte unused1; + /// + /// The name of the system that can act upon sectors 0x00-0x0F for the volume. + /// + public string systemName; + /// + /// Identification of this volume. + /// + public string volumeName; + /// + /// All zeroes. + /// + public ulong unused2; + /// + /// Number of Logical Blocks in which the volume is recorded. + /// + public uint volumeSpaceSize; + /// + /// All zeroes. + /// + public byte[] unused3; + /// + /// The size of the set in this logical volume (number of disks). + /// + public ushort volumeSetSize; + /// + /// The number of this disk in the Volume Set. + /// + public ushort volumeSequenceNumber; + /// + /// The size in bytes of a logical block. NB: This means that a logical block on a CD could be something + /// other than 2 KiB! + /// + public ushort logicalBlockSize; + /// + /// The size in bytes of the path table. + /// + public uint pathTableSize; + /// + /// LBA location of the path table. The path table pointed to contains only little-endian values. + /// + public uint pathTableLocationTypeL; + /// + /// LBA location of the optional path table. The path table pointed to contains only little-endian values. + /// Zero means that no optional path table exists. + /// + public uint optionalPathTableLocationTypeL; + /// + /// LBA location of the path table. The path table pointed to contains only big-endian values. + /// + public uint pathTableLocationTypeM; + /// + /// LBA location of the optional path table. The path table pointed to contains only big-endian values. Zero + /// means that no optional path table exists. + /// + public uint optionalPathTableLocationTypeM; - /// - /// Note that this is not an LBA address, it is the actual Directory Record, which contains a zero-length - /// Directory Identifier, hence the fixed 34 byte size. - /// - public byte[] rootDirectoryEntry; + /// + /// Note that this is not an LBA address, it is the actual Directory Record, which contains a zero-length + /// Directory Identifier, hence the fixed 34 byte size. + /// + public byte[] rootDirectoryEntry; - /// - /// Identifier of the volume set of which this volume is a member. - /// - public string volumeSet; - /// - /// The volume publisher. For extended publisher information, the first byte should be 0x5F, followed by the - /// filename of a file in the root directory. If not specified, all bytes should be 0x20. - /// - public string publisher; - /// - /// The identifier of the person(s) who prepared the data for this volume. For extended preparation - /// information, the first byte should be 0x5F, followed by the filename of a file in the root directory. If - /// not specified, all bytes should be 0x20. - /// - public string dataPreparer; - /// - /// Identifies how the data are recorded on this volume. For extended information, the first byte should be - /// 0x5F, followed by the filename of a file in the root directory. If not specified, all bytes should be - /// 0x20. - /// - public string application; - /// - /// Filename of a file in the root directory that contains copyright information for this volume set. If not - /// specified, all bytes should be 0x20. - /// - public string copyrightFile; - /// - /// Filename of a file in the root directory that contains abstract information for this volume set. If not - /// specified, all bytes should be 0x20. - /// - public string abstractFile; - /// - /// Filename of a file in the root directory that contains bibliographic information for this volume set. If - /// not specified, all bytes should be 0x20. - /// - public string bibliographicFile; + /// + /// Identifier of the volume set of which this volume is a member. + /// + public string volumeSet; + /// + /// The volume publisher. For extended publisher information, the first byte should be 0x5F, followed by the + /// filename of a file in the root directory. If not specified, all bytes should be 0x20. + /// + public string publisher; + /// + /// The identifier of the person(s) who prepared the data for this volume. For extended preparation + /// information, the first byte should be 0x5F, followed by the filename of a file in the root directory. If + /// not specified, all bytes should be 0x20. + /// + public string dataPreparer; + /// + /// Identifies how the data are recorded on this volume. For extended information, the first byte should be + /// 0x5F, followed by the filename of a file in the root directory. If not specified, all bytes should be + /// 0x20. + /// + public string application; + /// + /// Filename of a file in the root directory that contains copyright information for this volume set. If not + /// specified, all bytes should be 0x20. + /// + public string copyrightFile; + /// + /// Filename of a file in the root directory that contains abstract information for this volume set. If not + /// specified, all bytes should be 0x20. + /// + public string abstractFile; + /// + /// Filename of a file in the root directory that contains bibliographic information for this volume set. If + /// not specified, all bytes should be 0x20. + /// + public string bibliographicFile; - /// - /// The date and time of when the volume was created. - /// - public DateTime timestampVolumeCreation; - /// - /// The date and time of when the volume was modified. - /// - public DateTime timestampVolumeModification; - /// - /// The date and time after which this volume is considered to be obsolete. If not specified, then the - /// volume is never considered to be obsolete. - /// - public DateTime timestampVolumeExpiration; - /// - /// The date and time after which the volume may be used. If not specified, the volume may be used - /// immediately. - /// - public DateTime timestampVolumeEffective; - /// - /// The directory records and path table version (always 0x01). - /// - public byte fileStructureVersion; - /// - /// Always 0x00. - /// - public byte unused4; - /// - /// 512 bytes. Contents not defined by ISO 9660. - /// - public byte[] applicationSpecific; - /// - /// 653 bytes. Reserved by ISO. - /// - public byte[] reserved; - } + /// + /// The date and time of when the volume was created. + /// + public DateTime? timestampVolumeCreation; + /// + /// The date and time of when the volume was modified. + /// + public DateTime? timestampVolumeModification; + /// + /// The date and time after which this volume is considered to be obsolete. If not specified, then the + /// volume is never considered to be obsolete. + /// + public DateTime? timestampVolumeExpiration; + /// + /// The date and time after which the volume may be used. If not specified, the volume may be used + /// immediately. + /// + public DateTime? timestampVolumeEffective; + /// + /// The directory records and path table version (always 0x01). + /// + public byte fileStructureVersion; + /// + /// Always 0x00. + /// + public byte unused4; + /// + /// 512 bytes. Contents not defined by ISO 9660. + /// + public byte[] applicationSpecific; + /// + /// 653 bytes. Reserved by ISO. + /// + public byte[] reserved; + } }