DOCUMENTATION: DateTime handlers.

This commit is contained in:
2017-12-23 03:59:48 +00:00
parent efea6e8b33
commit 3d38e01fdc
39 changed files with 221 additions and 227 deletions

View File

@@ -121,7 +121,7 @@ namespace DiscImageChef.Decoders.SCSI
if(page.WT) if(page.WT)
{ {
sb.AppendFormat("\tDrive's date/time is: {0}", DateHandlers.UNIXUnsignedToDateTime(page.WorldTime)) sb.AppendFormat("\tDrive's date/time is: {0}", DateHandlers.UnixUnsignedToDateTime(page.WorldTime))
.AppendLine(); .AppendLine();
if(page.UTC) sb.AppendLine("\tDrive's time is UTC"); if(page.UTC) sb.AppendLine("\tDrive's time is UTC");
if(page.NTP) sb.AppendLine("\tDrive's time is synchronized with a NTP source"); if(page.NTP) sb.AppendLine("\tDrive's time is synchronized with a NTP source");

View File

@@ -325,7 +325,7 @@ namespace DiscImageChef.DiscImages
calculatedDataCrc == header.crc); calculatedDataCrc == header.crc);
ImageInfo.ImageApplication = "CopyQM"; ImageInfo.ImageApplication = "CopyQM";
ImageInfo.ImageCreationTime = DateHandlers.DOSToDateTime(header.date, header.time); ImageInfo.ImageCreationTime = DateHandlers.DosToDateTime(header.date, header.time);
ImageInfo.ImageLastModificationTime = ImageInfo.ImageCreationTime; ImageInfo.ImageLastModificationTime = ImageInfo.ImageCreationTime;
ImageInfo.ImageName = header.volumeLabel; ImageInfo.ImageName = header.volumeLabel;
ImageInfo.ImageSize = (ulong)(stream.Length - 133 - header.commentLength); ImageInfo.ImageSize = (ulong)(stream.Length - 133 - header.commentLength);

View File

@@ -281,7 +281,7 @@ namespace DiscImageChef.DiscImages
clusterCache = new Dictionary<ulong, byte[]>(); clusterCache = new Dictionary<ulong, byte[]>();
ImageInfo.ImageCreationTime = imageFilter.GetCreationTime(); ImageInfo.ImageCreationTime = imageFilter.GetCreationTime();
ImageInfo.ImageLastModificationTime = qHdr.mtime > 0 ? DateHandlers.UNIXUnsignedToDateTime(qHdr.mtime) : imageFilter.GetLastWriteTime(); ImageInfo.ImageLastModificationTime = qHdr.mtime > 0 ? DateHandlers.UnixUnsignedToDateTime(qHdr.mtime) : imageFilter.GetLastWriteTime();
ImageInfo.ImageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); ImageInfo.ImageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
ImageInfo.Sectors = qHdr.size / 512; ImageInfo.Sectors = qHdr.size / 512;
ImageInfo.SectorSize = 512; ImageInfo.SectorSize = 512;

View File

@@ -369,9 +369,9 @@ namespace DiscImageChef.DiscImages
DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageComments = \"{0}\"", DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageComments = \"{0}\"",
ImageInfo.ImageComments); ImageInfo.ImageComments);
ImageInfo.ImageCreationTime = footer.creationTime != 0 ? DateHandlers.UNIXToDateTime(footer.creationTime) : imageFilter.GetCreationTime(); ImageInfo.ImageCreationTime = footer.creationTime != 0 ? DateHandlers.UnixToDateTime(footer.creationTime) : imageFilter.GetCreationTime();
ImageInfo.ImageLastModificationTime = footer.modificationTime != 0 ? DateHandlers.UNIXToDateTime(footer.modificationTime) : imageFilter.GetLastWriteTime(); ImageInfo.ImageLastModificationTime = footer.modificationTime != 0 ? DateHandlers.UnixToDateTime(footer.modificationTime) : imageFilter.GetLastWriteTime();
DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageCreationTime = {0}", DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageCreationTime = {0}",
ImageInfo.ImageCreationTime); ImageInfo.ImageCreationTime);

View File

@@ -105,8 +105,8 @@ namespace DiscImageChef.Filesystems.CPM
if(string.IsNullOrEmpty(path) || string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) == 0) if(string.IsNullOrEmpty(path) || string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) == 0)
{ {
if(labelCreationDate != null) stat.CreationTime = DateHandlers.CPMToDateTime(labelCreationDate); if(labelCreationDate != null) stat.CreationTime = DateHandlers.CpmToDateTime(labelCreationDate);
if(labelUpdateDate != null) stat.StatusChangeTime = DateHandlers.CPMToDateTime(labelUpdateDate); if(labelUpdateDate != null) stat.StatusChangeTime = DateHandlers.CpmToDateTime(labelUpdateDate);
stat.Attributes = FileAttributes.Directory; stat.Attributes = FileAttributes.Directory;
stat.BlockSize = XmlFsType.ClusterSize; stat.BlockSize = XmlFsType.ClusterSize;
return Errno.NoError; return Errno.NoError;

View File

@@ -1038,9 +1038,9 @@ namespace DiscImageChef.Filesystems.CPM
if(thirdPartyTimestamps) sb.AppendLine("Volume uses third party timestamps"); if(thirdPartyTimestamps) sb.AppendLine("Volume uses third party timestamps");
if(labelCreationDate != null) if(labelCreationDate != null)
sb.AppendFormat("Volume created on {0}", DateHandlers.CPMToDateTime(labelCreationDate)).AppendLine(); sb.AppendFormat("Volume created on {0}", DateHandlers.CpmToDateTime(labelCreationDate)).AppendLine();
if(labelUpdateDate != null) if(labelUpdateDate != null)
sb.AppendFormat("Volume updated on {0}", DateHandlers.CPMToDateTime(labelUpdateDate)).AppendLine(); sb.AppendFormat("Volume updated on {0}", DateHandlers.CpmToDateTime(labelUpdateDate)).AppendLine();
XmlFsType = new FileSystemType(); XmlFsType = new FileSystemType();
XmlFsType.Bootable |= workingDefinition.sofs > 0 || workingDefinition.ofs > 0; XmlFsType.Bootable |= workingDefinition.sofs > 0 || workingDefinition.ofs > 0;
@@ -1049,12 +1049,12 @@ namespace DiscImageChef.Filesystems.CPM
else XmlFsType.Clusters = (long)(partition.End - partition.Start); else XmlFsType.Clusters = (long)(partition.End - partition.Start);
if(labelCreationDate != null) if(labelCreationDate != null)
{ {
XmlFsType.CreationDate = DateHandlers.CPMToDateTime(labelCreationDate); XmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate);
XmlFsType.CreationDateSpecified = true; XmlFsType.CreationDateSpecified = true;
} }
if(labelUpdateDate != null) if(labelUpdateDate != null)
{ {
XmlFsType.ModificationDate = DateHandlers.CPMToDateTime(labelUpdateDate); XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate);
XmlFsType.ModificationDateSpecified = true; XmlFsType.ModificationDateSpecified = true;
} }
XmlFsType.Type = "CP/M"; XmlFsType.Type = "CP/M";

View File

@@ -484,10 +484,10 @@ namespace DiscImageChef.Filesystems.CPM
if(statCache.TryGetValue(file1, out fInfo)) statCache.Remove(file1); if(statCache.TryGetValue(file1, out fInfo)) statCache.Remove(file1);
else fInfo = new FileEntryInfo(); else fInfo = new FileEntryInfo();
if(atime) fInfo.AccessTime = DateHandlers.CPMToDateTime(dateEntry.date1); if(atime) fInfo.AccessTime = DateHandlers.CpmToDateTime(dateEntry.date1);
else fInfo.CreationTime = DateHandlers.CPMToDateTime(dateEntry.date1); else fInfo.CreationTime = DateHandlers.CpmToDateTime(dateEntry.date1);
fInfo.LastWriteTime = DateHandlers.CPMToDateTime(dateEntry.date2); fInfo.LastWriteTime = DateHandlers.CpmToDateTime(dateEntry.date2);
statCache.Add(file1, fInfo); statCache.Add(file1, fInfo);
} }
@@ -497,10 +497,10 @@ namespace DiscImageChef.Filesystems.CPM
if(statCache.TryGetValue(file2, out fInfo)) statCache.Remove(file2); if(statCache.TryGetValue(file2, out fInfo)) statCache.Remove(file2);
else fInfo = new FileEntryInfo(); else fInfo = new FileEntryInfo();
if(atime) fInfo.AccessTime = DateHandlers.CPMToDateTime(dateEntry.date3); if(atime) fInfo.AccessTime = DateHandlers.CpmToDateTime(dateEntry.date3);
else fInfo.CreationTime = DateHandlers.CPMToDateTime(dateEntry.date3); else fInfo.CreationTime = DateHandlers.CpmToDateTime(dateEntry.date3);
fInfo.LastWriteTime = DateHandlers.CPMToDateTime(dateEntry.date4); fInfo.LastWriteTime = DateHandlers.CpmToDateTime(dateEntry.date4);
statCache.Add(file2, fInfo); statCache.Add(file2, fInfo);
} }
@@ -510,10 +510,10 @@ namespace DiscImageChef.Filesystems.CPM
if(statCache.TryGetValue(file3, out fInfo)) statCache.Remove(file3); if(statCache.TryGetValue(file3, out fInfo)) statCache.Remove(file3);
else fInfo = new FileEntryInfo(); else fInfo = new FileEntryInfo();
if(atime) fInfo.AccessTime = DateHandlers.CPMToDateTime(dateEntry.date5); if(atime) fInfo.AccessTime = DateHandlers.CpmToDateTime(dateEntry.date5);
else fInfo.CreationTime = DateHandlers.CPMToDateTime(dateEntry.date5); else fInfo.CreationTime = DateHandlers.CpmToDateTime(dateEntry.date5);
fInfo.LastWriteTime = DateHandlers.CPMToDateTime(dateEntry.date6); fInfo.LastWriteTime = DateHandlers.CpmToDateTime(dateEntry.date6);
statCache.Add(file3, fInfo); statCache.Add(file3, fInfo);
} }
@@ -543,9 +543,9 @@ namespace DiscImageChef.Filesystems.CPM
ctime[0] = trdPartyDateEntry.create1[0]; ctime[0] = trdPartyDateEntry.create1[0];
ctime[1] = trdPartyDateEntry.create1[1]; ctime[1] = trdPartyDateEntry.create1[1];
fInfo.AccessTime = DateHandlers.CPMToDateTime(trdPartyDateEntry.access1); fInfo.AccessTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.access1);
fInfo.CreationTime = DateHandlers.CPMToDateTime(ctime); fInfo.CreationTime = DateHandlers.CpmToDateTime(ctime);
fInfo.LastWriteTime = DateHandlers.CPMToDateTime(trdPartyDateEntry.modify1); fInfo.LastWriteTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.modify1);
statCache.Add(file1, fInfo); statCache.Add(file1, fInfo);
} }
@@ -559,9 +559,9 @@ namespace DiscImageChef.Filesystems.CPM
ctime[0] = trdPartyDateEntry.create2[0]; ctime[0] = trdPartyDateEntry.create2[0];
ctime[1] = trdPartyDateEntry.create2[1]; ctime[1] = trdPartyDateEntry.create2[1];
fInfo.AccessTime = DateHandlers.CPMToDateTime(trdPartyDateEntry.access2); fInfo.AccessTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.access2);
fInfo.CreationTime = DateHandlers.CPMToDateTime(ctime); fInfo.CreationTime = DateHandlers.CpmToDateTime(ctime);
fInfo.LastWriteTime = DateHandlers.CPMToDateTime(trdPartyDateEntry.modify2); fInfo.LastWriteTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.modify2);
statCache.Add(file2, fInfo); statCache.Add(file2, fInfo);
} }
@@ -575,9 +575,9 @@ namespace DiscImageChef.Filesystems.CPM
ctime[0] = trdPartyDateEntry.create3[0]; ctime[0] = trdPartyDateEntry.create3[0];
ctime[1] = trdPartyDateEntry.create3[1]; ctime[1] = trdPartyDateEntry.create3[1];
fInfo.AccessTime = DateHandlers.CPMToDateTime(trdPartyDateEntry.access3); fInfo.AccessTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.access3);
fInfo.CreationTime = DateHandlers.CPMToDateTime(ctime); fInfo.CreationTime = DateHandlers.CpmToDateTime(ctime);
fInfo.LastWriteTime = DateHandlers.CPMToDateTime(trdPartyDateEntry.modify3); fInfo.LastWriteTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.modify3);
statCache.Add(file3, fInfo); statCache.Add(file3, fInfo);
} }
@@ -660,12 +660,12 @@ namespace DiscImageChef.Filesystems.CPM
}; };
if(labelCreationDate != null) if(labelCreationDate != null)
{ {
XmlFsType.CreationDate = DateHandlers.CPMToDateTime(labelCreationDate); XmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate);
XmlFsType.CreationDateSpecified = true; XmlFsType.CreationDateSpecified = true;
} }
if(labelUpdateDate != null) if(labelUpdateDate != null)
{ {
XmlFsType.ModificationDate = DateHandlers.CPMToDateTime(labelUpdateDate); XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate);
XmlFsType.ModificationDateSpecified = true; XmlFsType.ModificationDateSpecified = true;
} }
if(!string.IsNullOrEmpty(label)) XmlFsType.VolumeName = label; if(!string.IsNullOrEmpty(label)) XmlFsType.VolumeName = label;

View File

@@ -216,7 +216,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("{0} sectors per track", efsSb.sb_sectors).AppendLine(); sb.AppendFormat("{0} sectors per track", efsSb.sb_sectors).AppendLine();
sb.AppendFormat("{0} heads per cylinder", efsSb.sb_heads).AppendLine(); sb.AppendFormat("{0} heads per cylinder", efsSb.sb_heads).AppendLine();
sb.AppendFormat("{0} cylinder groups", efsSb.sb_ncg).AppendLine(); sb.AppendFormat("{0} cylinder groups", efsSb.sb_ncg).AppendLine();
sb.AppendFormat("Volume created on {0}", DateHandlers.UNIXToDateTime(efsSb.sb_time)).AppendLine(); sb.AppendFormat("Volume created on {0}", DateHandlers.UnixToDateTime(efsSb.sb_time)).AppendLine();
sb.AppendFormat("{0} bytes on bitmap", efsSb.sb_bmsize).AppendLine(); sb.AppendFormat("{0} bytes on bitmap", efsSb.sb_bmsize).AppendLine();
sb.AppendFormat("{0} free blocks", efsSb.sb_tfree).AppendLine(); sb.AppendFormat("{0} free blocks", efsSb.sb_tfree).AppendLine();
sb.AppendFormat("{0} free inodes", efsSb.sb_tinode).AppendLine(); sb.AppendFormat("{0} free inodes", efsSb.sb_tinode).AppendLine();
@@ -241,7 +241,7 @@ namespace DiscImageChef.Filesystems
Dirty = efsSb.sb_dirty > 0, Dirty = efsSb.sb_dirty > 0,
VolumeName = StringHandlers.CToString(efsSb.sb_fname, CurrentEncoding), VolumeName = StringHandlers.CToString(efsSb.sb_fname, CurrentEncoding),
VolumeSerial = $"{efsSb.sb_checksum:X8}", VolumeSerial = $"{efsSb.sb_checksum:X8}",
CreationDate = DateHandlers.UNIXToDateTime(efsSb.sb_time), CreationDate = DateHandlers.UnixToDateTime(efsSb.sb_time),
CreationDateSpecified = true CreationDateSpecified = true
}; };
} }

View File

@@ -1333,7 +1333,7 @@ namespace DiscImageChef.Filesystems
if(entry.ctime > 0 && entry.cdate > 0) if(entry.ctime > 0 && entry.cdate > 0)
{ {
XmlFsType.CreationDate = DateHandlers.DOSToDateTime(entry.cdate, entry.ctime); XmlFsType.CreationDate = DateHandlers.DosToDateTime(entry.cdate, entry.ctime);
if(entry.ctime_ms > 0) XmlFsType.CreationDate = XmlFsType.CreationDate.AddMilliseconds(entry.ctime_ms * 10); if(entry.ctime_ms > 0) XmlFsType.CreationDate = XmlFsType.CreationDate.AddMilliseconds(entry.ctime_ms * 10);
XmlFsType.CreationDateSpecified = true; XmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Volume created on {0}", XmlFsType.CreationDate).AppendLine(); sb.AppendFormat("Volume created on {0}", XmlFsType.CreationDate).AppendLine();
@@ -1341,13 +1341,13 @@ namespace DiscImageChef.Filesystems
if(entry.mtime > 0 && entry.mdate > 0) if(entry.mtime > 0 && entry.mdate > 0)
{ {
XmlFsType.ModificationDate = DateHandlers.DOSToDateTime(entry.mdate, entry.mtime); XmlFsType.ModificationDate = DateHandlers.DosToDateTime(entry.mdate, entry.mtime);
XmlFsType.ModificationDateSpecified = true; XmlFsType.ModificationDateSpecified = true;
sb.AppendFormat("Volume last modified on {0}", XmlFsType.ModificationDate).AppendLine(); sb.AppendFormat("Volume last modified on {0}", XmlFsType.ModificationDate).AppendLine();
} }
if(entry.adate > 0) if(entry.adate > 0)
sb.AppendFormat("Volume last accessed on {0:d}", DateHandlers.DOSToDateTime(entry.adate, 0)) sb.AppendFormat("Volume last accessed on {0:d}", DateHandlers.DosToDateTime(entry.adate, 0))
.AppendLine(); .AppendLine();
break; break;

View File

@@ -265,7 +265,7 @@ namespace DiscImageChef.Filesystems
} }
if((ufs_sb.fs_maxfilesize & 0xFFFFFFFF) > SunOSEpoch && if((ufs_sb.fs_maxfilesize & 0xFFFFFFFF) > SunOSEpoch &&
DateHandlers.UNIXUnsignedToDateTime(ufs_sb.fs_maxfilesize & 0xFFFFFFFF) < DateTime.Now) DateHandlers.UnixUnsignedToDateTime(ufs_sb.fs_maxfilesize & 0xFFFFFFFF) < DateTime.Now)
{ {
fs_type_42bsd = false; fs_type_42bsd = false;
fs_type_sun = true; fs_type_sun = true;
@@ -273,7 +273,7 @@ namespace DiscImageChef.Filesystems
} }
// This is for sure, as it is shared with a sectors/track with non-x86 SunOS, Epoch is absurdly high for that // This is for sure, as it is shared with a sectors/track with non-x86 SunOS, Epoch is absurdly high for that
if(ufs_sb.fs_old_npsect > SunOSEpoch && DateHandlers.UNIXToDateTime(ufs_sb.fs_old_npsect) < DateTime.Now if(ufs_sb.fs_old_npsect > SunOSEpoch && DateHandlers.UnixToDateTime(ufs_sb.fs_old_npsect) < DateTime.Now
) )
{ {
fs_type_42bsd = false; fs_type_42bsd = false;
@@ -319,9 +319,9 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("inode-block LBA: {0}", ufs_sb.fs_iblkno).AppendLine(); sbInformation.AppendFormat("inode-block LBA: {0}", ufs_sb.fs_iblkno).AppendLine();
sbInformation.AppendFormat("First data block LBA: {0}", ufs_sb.fs_dblkno).AppendLine(); sbInformation.AppendFormat("First data block LBA: {0}", ufs_sb.fs_dblkno).AppendLine();
sbInformation.AppendFormat("Cylinder group offset in cylinder: {0}", ufs_sb.fs_old_cgoffset).AppendLine(); sbInformation.AppendFormat("Cylinder group offset in cylinder: {0}", ufs_sb.fs_old_cgoffset).AppendLine();
sbInformation.AppendFormat("Volume last written on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_old_time)) sbInformation.AppendFormat("Volume last written on {0}", DateHandlers.UnixToDateTime(ufs_sb.fs_old_time))
.AppendLine(); .AppendLine();
XmlFsType.ModificationDate = DateHandlers.UNIXToDateTime(ufs_sb.fs_old_time); XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(ufs_sb.fs_old_time);
XmlFsType.ModificationDateSpecified = true; XmlFsType.ModificationDateSpecified = true;
sbInformation.AppendFormat("{0} blocks in volume ({1} bytes)", ufs_sb.fs_old_size, sbInformation.AppendFormat("{0} blocks in volume ({1} bytes)", ufs_sb.fs_old_size,
(long)ufs_sb.fs_old_size * ufs_sb.fs_fsize).AppendLine(); (long)ufs_sb.fs_old_size * ufs_sb.fs_fsize).AppendLine();
@@ -358,7 +358,7 @@ namespace DiscImageChef.Filesystems
if(fs_type_sun) sbInformation.AppendFormat("{0} sectors/track", ufs_sb.fs_old_npsect).AppendLine(); if(fs_type_sun) sbInformation.AppendFormat("{0} sectors/track", ufs_sb.fs_old_npsect).AppendLine();
else if(fs_type_sun86) else if(fs_type_sun86)
sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_old_npsect)) sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UnixToDateTime(ufs_sb.fs_old_npsect))
.AppendLine(); .AppendLine();
sbInformation.AppendFormat("Hardware sector interleave: {0}", ufs_sb.fs_old_interleave).AppendLine(); sbInformation.AppendFormat("Hardware sector interleave: {0}", ufs_sb.fs_old_interleave).AppendLine();
sbInformation.AppendFormat("Sector 0 skew: {0}/track", ufs_sb.fs_old_trackskew).AppendLine(); sbInformation.AppendFormat("Sector 0 skew: {0}/track", ufs_sb.fs_old_trackskew).AppendLine();
@@ -416,9 +416,9 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("{0} free inodes", ufs_sb.fs_cstotal.cs_nifree).AppendLine(); sbInformation.AppendFormat("{0} free inodes", ufs_sb.fs_cstotal.cs_nifree).AppendLine();
sbInformation.AppendFormat("{0} free frags", ufs_sb.fs_cstotal.cs_nffree).AppendLine(); sbInformation.AppendFormat("{0} free frags", ufs_sb.fs_cstotal.cs_nffree).AppendLine();
sbInformation.AppendFormat("{0} free clusters", ufs_sb.fs_cstotal.cs_numclusters).AppendLine(); sbInformation.AppendFormat("{0} free clusters", ufs_sb.fs_cstotal.cs_numclusters).AppendLine();
sbInformation.AppendFormat("Volume last written on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_time)) sbInformation.AppendFormat("Volume last written on {0}", DateHandlers.UnixToDateTime(ufs_sb.fs_time))
.AppendLine(); .AppendLine();
XmlFsType.ModificationDate = DateHandlers.UNIXToDateTime(ufs_sb.fs_time); XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(ufs_sb.fs_time);
XmlFsType.ModificationDateSpecified = true; XmlFsType.ModificationDateSpecified = true;
sbInformation.AppendFormat("{0} blocks ({1} bytes)", ufs_sb.fs_size, ufs_sb.fs_size * ufs_sb.fs_fsize) sbInformation.AppendFormat("{0} blocks ({1} bytes)", ufs_sb.fs_size, ufs_sb.fs_size * ufs_sb.fs_fsize)
.AppendLine(); .AppendLine();
@@ -431,7 +431,7 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("{0} inodes pending of being freed", ufs_sb.fs_pendinginodes).AppendLine(); sbInformation.AppendFormat("{0} inodes pending of being freed", ufs_sb.fs_pendinginodes).AppendLine();
} }
if(fs_type_sun) if(fs_type_sun)
sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_old_npsect)) sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UnixToDateTime(ufs_sb.fs_old_npsect))
.AppendLine(); .AppendLine();
else if(fs_type_sun86) sbInformation.AppendFormat("{0} sectors/track", ufs_sb.fs_state).AppendLine(); else if(fs_type_sun86) sbInformation.AppendFormat("{0} sectors/track", ufs_sb.fs_state).AppendLine();
else if(fs_type_44bsd) else if(fs_type_44bsd)
@@ -440,7 +440,7 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("Maximum length of a symbolic link: {0}", ufs_sb.fs_maxsymlinklen) sbInformation.AppendFormat("Maximum length of a symbolic link: {0}", ufs_sb.fs_maxsymlinklen)
.AppendLine(); .AppendLine();
sbInformation.AppendFormat("A file can be {0} bytes at max", ufs_sb.fs_maxfilesize).AppendLine(); sbInformation.AppendFormat("A file can be {0} bytes at max", ufs_sb.fs_maxfilesize).AppendLine();
sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UNIXToDateTime(ufs_sb.fs_state)) sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UnixToDateTime(ufs_sb.fs_state))
.AppendLine(); .AppendLine();
} }
if(ufs_sb.fs_old_nrpos > 0) if(ufs_sb.fs_old_nrpos > 0)

View File

@@ -142,8 +142,8 @@ namespace DiscImageChef.Filesystems
.AppendLine(); .AppendLine();
// sb.AppendFormat("Filesystem type: \"{0}\"", hpfs_bpb.fs_type).AppendLine(); // sb.AppendFormat("Filesystem type: \"{0}\"", hpfs_bpb.fs_type).AppendLine();
DateTime lastChk = DateHandlers.UNIXToDateTime(hpfsSb.last_chkdsk); DateTime lastChk = DateHandlers.UnixToDateTime(hpfsSb.last_chkdsk);
DateTime lastOptim = DateHandlers.UNIXToDateTime(hpfsSb.last_optim); DateTime lastOptim = DateHandlers.UnixToDateTime(hpfsSb.last_optim);
sb.AppendFormat("HPFS version: {0}", hpfsSb.version).AppendLine(); sb.AppendFormat("HPFS version: {0}", hpfsSb.version).AppendLine();
sb.AppendFormat("Functional version: {0}", hpfsSb.func_version).AppendLine(); sb.AppendFormat("Functional version: {0}", hpfsSb.func_version).AppendLine();

View File

@@ -180,27 +180,27 @@ namespace DiscImageChef.Filesystems.ISO9660
if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00) if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00)
decodedVD.CreationTime = DateTime.MinValue; decodedVD.CreationTime = DateTime.MinValue;
else decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(pvd.creation_date); else decodedVD.CreationTime = DateHandlers.Iso9660ToDateTime(pvd.creation_date);
if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) decodedVD.HasModificationTime = false; if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00) decodedVD.HasModificationTime = false;
else else
{ {
decodedVD.HasModificationTime = true; decodedVD.HasModificationTime = true;
decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(pvd.modification_date); decodedVD.ModificationTime = DateHandlers.Iso9660ToDateTime(pvd.modification_date);
} }
if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) decodedVD.HasExpirationTime = false; if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00) decodedVD.HasExpirationTime = false;
else else
{ {
decodedVD.HasExpirationTime = true; decodedVD.HasExpirationTime = true;
decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(pvd.expiration_date); decodedVD.ExpirationTime = DateHandlers.Iso9660ToDateTime(pvd.expiration_date);
} }
if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVD.HasEffectiveTime = false; if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00) decodedVD.HasEffectiveTime = false;
else else
{ {
decodedVD.HasEffectiveTime = true; decodedVD.HasEffectiveTime = true;
decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(pvd.effective_date); decodedVD.EffectiveTime = DateHandlers.Iso9660ToDateTime(pvd.effective_date);
} }
decodedVD.Blocks = pvd.volume_space_size; decodedVD.Blocks = pvd.volume_space_size;

View File

@@ -55,27 +55,27 @@ namespace DiscImageChef.Filesystems.ISO9660
if(jolietvd.creation_date[0] < 0x31 || jolietvd.creation_date[0] > 0x39) if(jolietvd.creation_date[0] < 0x31 || jolietvd.creation_date[0] > 0x39)
decodedVD.CreationTime = DateTime.MinValue; decodedVD.CreationTime = DateTime.MinValue;
else decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(jolietvd.creation_date); 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 else
{ {
decodedVD.HasModificationTime = true; decodedVD.HasModificationTime = true;
decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(jolietvd.modification_date); 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 else
{ {
decodedVD.HasExpirationTime = true; decodedVD.HasExpirationTime = true;
decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(jolietvd.expiration_date); 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 else
{ {
decodedVD.HasEffectiveTime = true; decodedVD.HasEffectiveTime = true;
decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(jolietvd.effective_date); decodedVD.EffectiveTime = DateHandlers.Iso9660ToDateTime(jolietvd.effective_date);
} }
decodedVD.Blocks = jolietvd.volume_space_size; decodedVD.Blocks = jolietvd.volume_space_size;

View File

@@ -219,7 +219,7 @@ namespace DiscImageChef.Filesystems
if(jfsSb.s_flags.HasFlag(JFS_Flags.AIX)) sb.AppendLine("Volume supports AIX"); if(jfsSb.s_flags.HasFlag(JFS_Flags.AIX)) sb.AppendLine("Volume supports AIX");
if(jfsSb.s_state != 0) sb.AppendLine("Volume is dirty"); if(jfsSb.s_state != 0) sb.AppendLine("Volume is dirty");
sb.AppendFormat("Volume was last updated on {0}", sb.AppendFormat("Volume was last updated on {0}",
DateHandlers.UNIXUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec)) DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec))
.AppendLine(); .AppendLine();
if(jfsSb.s_version == 1) if(jfsSb.s_version == 1)
sb.AppendFormat("Volume name: {0}", CurrentEncoding.GetString(jfsSb.s_fpack)).AppendLine(); sb.AppendFormat("Volume name: {0}", CurrentEncoding.GetString(jfsSb.s_fpack)).AppendLine();
@@ -234,7 +234,7 @@ namespace DiscImageChef.Filesystems
Bootable = true, Bootable = true,
VolumeName = CurrentEncoding.GetString(jfsSb.s_version == 1 ? jfsSb.s_fpack : jfsSb.s_label), VolumeName = CurrentEncoding.GetString(jfsSb.s_version == 1 ? jfsSb.s_fpack : jfsSb.s_label),
VolumeSerial = $"{jfsSb.s_uuid}", VolumeSerial = $"{jfsSb.s_uuid}",
ModificationDate = DateHandlers.UNIXUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec), ModificationDate = DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec),
ModificationDateSpecified = true ModificationDateSpecified = true
}; };
if(jfsSb.s_state != 0) XmlFsType.Dirty = true; if(jfsSb.s_state != 0) XmlFsType.Dirty = true;

View File

@@ -314,7 +314,7 @@ namespace DiscImageChef.Filesystems
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fmod = {0}", LocusSb.s_fmod); DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fmod = {0}", LocusSb.s_fmod);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_version = {0}", LocusSb.s_version); DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_version = {0}", LocusSb.s_version);
sb.AppendFormat("Superblock last modified on {0}", DateHandlers.UNIXToDateTime(LocusSb.s_time)) sb.AppendFormat("Superblock last modified on {0}", DateHandlers.UnixToDateTime(LocusSb.s_time))
.AppendLine(); .AppendLine();
sb.AppendFormat("Volume has {0} blocks of {1} bytes each (total {2} bytes)", LocusSb.s_fsize, blockSize, sb.AppendFormat("Volume has {0} blocks of {1} bytes each (total {2} bytes)", LocusSb.s_fsize, blockSize,
LocusSb.s_fsize * blockSize).AppendLine(); LocusSb.s_fsize * blockSize).AppendLine();
@@ -350,7 +350,7 @@ namespace DiscImageChef.Filesystems
Clusters = LocusSb.s_fsize, Clusters = LocusSb.s_fsize,
// Sometimes it uses one, or the other. Use the bigger // Sometimes it uses one, or the other. Use the bigger
VolumeName = string.IsNullOrEmpty(s_fsmnt) ? s_fpack : s_fsmnt, VolumeName = string.IsNullOrEmpty(s_fsmnt) ? s_fpack : s_fsmnt,
ModificationDate = DateHandlers.UNIXToDateTime(LocusSb.s_time), ModificationDate = DateHandlers.UnixToDateTime(LocusSb.s_time),
ModificationDateSpecified = true, ModificationDateSpecified = true,
Dirty = !LocusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN) || LocusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY), Dirty = !LocusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN) || LocusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY),
FreeClusters = LocusSb.s_tfree, FreeClusters = LocusSb.s_tfree,

View File

@@ -182,10 +182,10 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Volume UUID: {0}", nilfsSb.uuid).AppendLine(); sb.AppendFormat("Volume UUID: {0}", nilfsSb.uuid).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(nilfsSb.volume_name, CurrentEncoding)) sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(nilfsSb.volume_name, CurrentEncoding))
.AppendLine(); .AppendLine();
sb.AppendFormat("Volume created on {0}", DateHandlers.UNIXUnsignedToDateTime(nilfsSb.ctime)).AppendLine(); sb.AppendFormat("Volume created on {0}", DateHandlers.UnixUnsignedToDateTime(nilfsSb.ctime)).AppendLine();
sb.AppendFormat("Volume last mounted on {0}", DateHandlers.UNIXUnsignedToDateTime(nilfsSb.mtime)) sb.AppendFormat("Volume last mounted on {0}", DateHandlers.UnixUnsignedToDateTime(nilfsSb.mtime))
.AppendLine(); .AppendLine();
sb.AppendFormat("Volume last written on {0}", DateHandlers.UNIXUnsignedToDateTime(nilfsSb.wtime)) sb.AppendFormat("Volume last written on {0}", DateHandlers.UnixUnsignedToDateTime(nilfsSb.wtime))
.AppendLine(); .AppendLine();
information = sb.ToString(); information = sb.ToString();
@@ -196,9 +196,9 @@ namespace DiscImageChef.Filesystems
ClusterSize = 1 << (int)(nilfsSb.log_block_size + 10), ClusterSize = 1 << (int)(nilfsSb.log_block_size + 10),
VolumeName = StringHandlers.CToString(nilfsSb.volume_name, CurrentEncoding), VolumeName = StringHandlers.CToString(nilfsSb.volume_name, CurrentEncoding),
VolumeSerial = nilfsSb.uuid.ToString(), VolumeSerial = nilfsSb.uuid.ToString(),
CreationDate = DateHandlers.UNIXUnsignedToDateTime(nilfsSb.ctime), CreationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.ctime),
CreationDateSpecified = true, CreationDateSpecified = true,
ModificationDate = DateHandlers.UNIXUnsignedToDateTime(nilfsSb.wtime), ModificationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.wtime),
ModificationDateSpecified = true ModificationDateSpecified = true
}; };
if(nilfsSb.creator_os == 0) XmlFsType.SystemIdentifier = "Linux"; if(nilfsSb.creator_os == 0) XmlFsType.SystemIdentifier = "Linux";

View File

@@ -173,12 +173,12 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Volume label: \"{0}\"", sb.AppendFormat("Volume label: \"{0}\"",
StringHandlers.SpacePaddedToString(homeblock.volname, CurrentEncoding)).AppendLine(); StringHandlers.SpacePaddedToString(homeblock.volname, CurrentEncoding)).AppendLine();
sb.AppendFormat("Drive serial number: 0x{0:X8}", homeblock.serialnum).AppendLine(); sb.AppendFormat("Drive serial number: 0x{0:X8}", homeblock.serialnum).AppendLine();
sb.AppendFormat("Volume was created on {0}", DateHandlers.VMSToDateTime(homeblock.credate)).AppendLine(); sb.AppendFormat("Volume was created on {0}", DateHandlers.VmsToDateTime(homeblock.credate)).AppendLine();
if(homeblock.revdate > 0) if(homeblock.revdate > 0)
sb.AppendFormat("Volume was last modified on {0}", DateHandlers.VMSToDateTime(homeblock.revdate)) sb.AppendFormat("Volume was last modified on {0}", DateHandlers.VmsToDateTime(homeblock.revdate))
.AppendLine(); .AppendLine();
if(homeblock.copydate > 0) if(homeblock.copydate > 0)
sb.AppendFormat("Volume copied on {0}", DateHandlers.VMSToDateTime(homeblock.copydate)).AppendLine(); sb.AppendFormat("Volume copied on {0}", DateHandlers.VmsToDateTime(homeblock.copydate)).AppendLine();
sb.AppendFormat("Checksums: 0x{0:X4} and 0x{1:X4}", homeblock.checksum1, homeblock.checksum2).AppendLine(); sb.AppendFormat("Checksums: 0x{0:X4} and 0x{1:X4}", homeblock.checksum1, homeblock.checksum2).AppendLine();
sb.AppendLine("Flags:"); sb.AppendLine("Flags:");
sb.AppendFormat("Window: {0}", homeblock.window).AppendLine(); sb.AppendFormat("Window: {0}", homeblock.window).AppendLine();
@@ -229,12 +229,12 @@ namespace DiscImageChef.Filesystems
}; };
if(homeblock.credate > 0) if(homeblock.credate > 0)
{ {
XmlFsType.CreationDate = DateHandlers.VMSToDateTime(homeblock.credate); XmlFsType.CreationDate = DateHandlers.VmsToDateTime(homeblock.credate);
XmlFsType.CreationDateSpecified = true; XmlFsType.CreationDateSpecified = true;
} }
if(homeblock.revdate > 0) if(homeblock.revdate > 0)
{ {
XmlFsType.ModificationDate = DateHandlers.VMSToDateTime(homeblock.revdate); XmlFsType.ModificationDate = DateHandlers.VmsToDateTime(homeblock.revdate);
XmlFsType.ModificationDateSpecified = true; XmlFsType.ModificationDateSpecified = true;
} }

View File

@@ -247,16 +247,16 @@ namespace DiscImageChef.Filesystems
*/ */
information = information =
$"QNX4 filesystem\nCreated on {DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_ftime)}\n"; $"QNX4 filesystem\nCreated on {DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime)}\n";
XmlFsType = new FileSystemType XmlFsType = new FileSystemType
{ {
Type = "QNX4 filesystem", Type = "QNX4 filesystem",
Clusters = (long)partition.Length, Clusters = (long)partition.Length,
ClusterSize = 512, ClusterSize = 512,
CreationDate = DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_ftime), CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime),
CreationDateSpecified = true, CreationDateSpecified = true,
ModificationDate = DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_mtime), ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_mtime),
ModificationDateSpecified = true ModificationDateSpecified = true
}; };
XmlFsType.Bootable |= qnxSb.boot.di_size != 0 || qnxSb.altBoot.di_size != 0; XmlFsType.Bootable |= qnxSb.boot.di_size != 0 || qnxSb.altBoot.di_size != 0;

View File

@@ -205,8 +205,8 @@ namespace DiscImageChef.Filesystems
sb.AppendLine("QNX6 filesystem"); sb.AppendLine("QNX6 filesystem");
sb.AppendFormat("Checksum: 0x{0:X8}", qnxSb.checksum).AppendLine(); sb.AppendFormat("Checksum: 0x{0:X8}", qnxSb.checksum).AppendLine();
sb.AppendFormat("Serial: 0x{0:X16}", qnxSb.checksum).AppendLine(); sb.AppendFormat("Serial: 0x{0:X16}", qnxSb.checksum).AppendLine();
sb.AppendFormat("Created on {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.ctime)).AppendLine(); sb.AppendFormat("Created on {0}", DateHandlers.UnixUnsignedToDateTime(qnxSb.ctime)).AppendLine();
sb.AppendFormat("Last mounted on {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.atime)).AppendLine(); sb.AppendFormat("Last mounted on {0}", DateHandlers.UnixUnsignedToDateTime(qnxSb.atime)).AppendLine();
sb.AppendFormat("Flags: 0x{0:X8}", qnxSb.flags).AppendLine(); sb.AppendFormat("Flags: 0x{0:X8}", qnxSb.flags).AppendLine();
sb.AppendFormat("Version1: 0x{0:X4}", qnxSb.version1).AppendLine(); sb.AppendFormat("Version1: 0x{0:X4}", qnxSb.version1).AppendLine();
sb.AppendFormat("Version2: 0x{0:X4}", qnxSb.version2).AppendLine(); sb.AppendFormat("Version2: 0x{0:X4}", qnxSb.version2).AppendLine();
@@ -228,9 +228,9 @@ namespace DiscImageChef.Filesystems
FreeClusters = qnxSb.freeBlocks, FreeClusters = qnxSb.freeBlocks,
FreeClustersSpecified = true, FreeClustersSpecified = true,
VolumeSerial = $"{qnxSb.serial:X16}", VolumeSerial = $"{qnxSb.serial:X16}",
CreationDate = DateHandlers.UNIXUnsignedToDateTime(qnxSb.ctime), CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.ctime),
CreationDateSpecified = true, CreationDateSpecified = true,
ModificationDate = DateHandlers.UNIXUnsignedToDateTime(qnxSb.atime), ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.atime),
ModificationDateSpecified = true ModificationDateSpecified = true
}; };
//xmlFSType.VolumeName = CurrentEncoding.GetString(qnxSb.volumeid); //xmlFSType.VolumeName = CurrentEncoding.GetString(qnxSb.volumeid);

View File

@@ -268,10 +268,10 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Root directory descriptor starts at block {0}", rbf9000Sb.rid_rootdir).AppendLine(); sb.AppendFormat("Root directory descriptor starts at block {0}", rbf9000Sb.rid_rootdir).AppendLine();
sb.AppendFormat("Disk is owned by group {0} user {1}", rbf9000Sb.rid_group, rbf9000Sb.rid_owner) sb.AppendFormat("Disk is owned by group {0} user {1}", rbf9000Sb.rid_group, rbf9000Sb.rid_owner)
.AppendLine(); .AppendLine();
sb.AppendFormat("Volume was created on {0}", DateHandlers.UNIXToDateTime(rbf9000Sb.rid_ctime)) sb.AppendFormat("Volume was created on {0}", DateHandlers.UnixToDateTime(rbf9000Sb.rid_ctime))
.AppendLine(); .AppendLine();
sb.AppendFormat("Volume's identification block was last written on {0}", sb.AppendFormat("Volume's identification block was last written on {0}",
DateHandlers.UNIXToDateTime(rbf9000Sb.rid_mtime)).AppendLine(); DateHandlers.UnixToDateTime(rbf9000Sb.rid_mtime)).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(rbf9000Sb.rid_name, CurrentEncoding)) sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(rbf9000Sb.rid_name, CurrentEncoding))
.AppendLine(); .AppendLine();
@@ -281,9 +281,9 @@ namespace DiscImageChef.Filesystems
Bootable = rbf9000Sb.rid_bootfile > 0, Bootable = rbf9000Sb.rid_bootfile > 0,
ClusterSize = rbf9000Sb.rid_blocksize, ClusterSize = rbf9000Sb.rid_blocksize,
Clusters = rbf9000Sb.rid_totblocks, Clusters = rbf9000Sb.rid_totblocks,
CreationDate = DateHandlers.UNIXToDateTime(rbf9000Sb.rid_ctime), CreationDate = DateHandlers.UnixToDateTime(rbf9000Sb.rid_ctime),
CreationDateSpecified = true, CreationDateSpecified = true,
ModificationDate = DateHandlers.UNIXToDateTime(rbf9000Sb.rid_mtime), ModificationDate = DateHandlers.UnixToDateTime(rbf9000Sb.rid_mtime),
ModificationDateSpecified = true, ModificationDateSpecified = true,
VolumeName = StringHandlers.CToString(rbf9000Sb.rid_name, CurrentEncoding), VolumeName = StringHandlers.CToString(rbf9000Sb.rid_name, CurrentEncoding),
VolumeSerial = $"{rbf9000Sb.rid_diskid:X8}" VolumeSerial = $"{rbf9000Sb.rid_diskid:X8}"
@@ -314,7 +314,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Root directory descriptor starts at block {0}", LSNToUInt32(rbfSb.dd_dir)) sb.AppendFormat("Root directory descriptor starts at block {0}", LSNToUInt32(rbfSb.dd_dir))
.AppendLine(); .AppendLine();
sb.AppendFormat("Disk is owned by user {0}", rbfSb.dd_own).AppendLine(); sb.AppendFormat("Disk is owned by user {0}", rbfSb.dd_own).AppendLine();
sb.AppendFormat("Volume was created on {0}", DateHandlers.OS9ToDateTime(rbfSb.dd_dat)).AppendLine(); sb.AppendFormat("Volume was created on {0}", DateHandlers.Os9ToDateTime(rbfSb.dd_dat)).AppendLine();
sb.AppendFormat("Volume attributes: {0:X2}", rbfSb.dd_att).AppendLine(); sb.AppendFormat("Volume attributes: {0:X2}", rbfSb.dd_att).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(rbfSb.dd_nam, CurrentEncoding)) sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(rbfSb.dd_nam, CurrentEncoding))
.AppendLine(); .AppendLine();
@@ -327,7 +327,7 @@ namespace DiscImageChef.Filesystems
Bootable = LSNToUInt32(rbfSb.dd_bt) > 0 && rbfSb.dd_bsz > 0, Bootable = LSNToUInt32(rbfSb.dd_bt) > 0 && rbfSb.dd_bsz > 0,
ClusterSize = rbfSb.dd_bit * (256 << rbfSb.dd_lsnsize), ClusterSize = rbfSb.dd_bit * (256 << rbfSb.dd_lsnsize),
Clusters = LSNToUInt32(rbfSb.dd_tot), Clusters = LSNToUInt32(rbfSb.dd_tot),
CreationDate = DateHandlers.OS9ToDateTime(rbfSb.dd_dat), CreationDate = DateHandlers.Os9ToDateTime(rbfSb.dd_dat),
CreationDateSpecified = true, CreationDateSpecified = true,
VolumeName = StringHandlers.CToString(rbfSb.dd_nam, CurrentEncoding), VolumeName = StringHandlers.CToString(rbfSb.dd_nam, CurrentEncoding),
VolumeSerial = $"{rbfSb.dd_dsk:X4}" VolumeSerial = $"{rbfSb.dd_dsk:X4}"

View File

@@ -172,7 +172,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("{0} bytes per block", reiserSb.blocksize).AppendLine(); sb.AppendFormat("{0} bytes per block", reiserSb.blocksize).AppendLine();
sb.AppendFormat("Root directory resides on block {0}", reiserSb.root_block).AppendLine(); sb.AppendFormat("Root directory resides on block {0}", reiserSb.root_block).AppendLine();
if(reiserSb.umount_state == 2) sb.AppendLine("Volume has not been cleanly umounted"); if(reiserSb.umount_state == 2) sb.AppendLine("Volume has not been cleanly umounted");
sb.AppendFormat("Volume last checked on {0}", DateHandlers.UNIXUnsignedToDateTime(reiserSb.last_check)) sb.AppendFormat("Volume last checked on {0}", DateHandlers.UnixUnsignedToDateTime(reiserSb.last_check))
.AppendLine(); .AppendLine();
if(reiserSb.version >= 2) if(reiserSb.version >= 2)
{ {

View File

@@ -132,7 +132,7 @@ namespace DiscImageChef.Filesystems
.AppendFormat("Volume has {0} blocks of {1} bytes each", rootBlock.totalblocks, rootBlock.blocksize) .AppendFormat("Volume has {0} blocks of {1} bytes each", rootBlock.totalblocks, rootBlock.blocksize)
.AppendLine(); .AppendLine();
sbInformation.AppendFormat("Volume created on {0}", sbInformation.AppendFormat("Volume created on {0}",
DateHandlers.UNIXUnsignedToDateTime(rootBlock.datecreated).AddYears(8)) DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8))
.AppendLine(); .AppendLine();
sbInformation.AppendFormat("Bitmap starts in block {0}", rootBlock.bitmapbase).AppendLine(); sbInformation.AppendFormat("Bitmap starts in block {0}", rootBlock.bitmapbase).AppendLine();
sbInformation.AppendFormat("Admin space container starts in block {0}", rootBlock.adminspacecontainer) sbInformation.AppendFormat("Admin space container starts in block {0}", rootBlock.adminspacecontainer)
@@ -150,7 +150,7 @@ namespace DiscImageChef.Filesystems
XmlFsType = new FileSystemType XmlFsType = new FileSystemType
{ {
CreationDate = DateHandlers.UNIXUnsignedToDateTime(rootBlock.datecreated).AddYears(8), CreationDate = DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8),
CreationDateSpecified = true, CreationDateSpecified = true,
Clusters = rootBlock.totalblocks, Clusters = rootBlock.totalblocks,
ClusterSize = (int)rootBlock.blocksize, ClusterSize = (int)rootBlock.blocksize,

View File

@@ -143,7 +143,7 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("Volume version {0}.{1}", sqSb.s_major, sqSb.s_minor).AppendLine(); sbInformation.AppendFormat("Volume version {0}.{1}", sqSb.s_major, sqSb.s_minor).AppendLine();
sbInformation.AppendFormat("Volume has {0} bytes", sqSb.bytes_used).AppendLine(); sbInformation.AppendFormat("Volume has {0} bytes", sqSb.bytes_used).AppendLine();
sbInformation.AppendFormat("Volume has {0} bytes per block", sqSb.block_size).AppendLine(); sbInformation.AppendFormat("Volume has {0} bytes per block", sqSb.block_size).AppendLine();
sbInformation.AppendFormat("Volume created on {0}", DateHandlers.UNIXUnsignedToDateTime(sqSb.mkfs_time)) sbInformation.AppendFormat("Volume created on {0}", DateHandlers.UnixUnsignedToDateTime(sqSb.mkfs_time))
.AppendLine(); .AppendLine();
sbInformation.AppendFormat("Volume has {0} inodes", sqSb.inodes).AppendLine(); sbInformation.AppendFormat("Volume has {0} inodes", sqSb.inodes).AppendLine();
switch(sqSb.compression) switch(sqSb.compression)
@@ -177,7 +177,7 @@ namespace DiscImageChef.Filesystems
XmlFsType = new FileSystemType XmlFsType = new FileSystemType
{ {
Type = "Squash file system", Type = "Squash file system",
CreationDate = DateHandlers.UNIXUnsignedToDateTime(sqSb.mkfs_time), CreationDate = DateHandlers.UnixUnsignedToDateTime(sqSb.mkfs_time),
CreationDateSpecified = true, CreationDateSpecified = true,
Clusters = Clusters =
(long)((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.SectorSize / sqSb.block_size), (long)((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.SectorSize / sqSb.block_size),

View File

@@ -424,11 +424,11 @@ namespace DiscImageChef.Filesystems
if(xnx_sb.s_ilock > 0) sb.AppendLine("inode cache is locked"); if(xnx_sb.s_ilock > 0) sb.AppendLine("inode cache is locked");
if(xnx_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified"); if(xnx_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified");
if(xnx_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only"); if(xnx_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only");
sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXToDateTime(xnx_sb.s_time)) sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UnixToDateTime(xnx_sb.s_time))
.AppendLine(); .AppendLine();
if(xnx_sb.s_time != 0) if(xnx_sb.s_time != 0)
{ {
XmlFsType.ModificationDate = DateHandlers.UNIXToDateTime(xnx_sb.s_time); XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(xnx_sb.s_time);
XmlFsType.ModificationDateSpecified = true; XmlFsType.ModificationDateSpecified = true;
} }
sb.AppendFormat("Volume name: {0}", xnx_sb.s_fname).AppendLine(); sb.AppendFormat("Volume name: {0}", xnx_sb.s_fname).AppendLine();
@@ -545,11 +545,11 @@ namespace DiscImageChef.Filesystems
if(sysv_sb.s_ilock > 0) sb.AppendLine("inode cache is locked"); if(sysv_sb.s_ilock > 0) sb.AppendLine("inode cache is locked");
if(sysv_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified"); if(sysv_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified");
if(sysv_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only"); if(sysv_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only");
sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(sysv_sb.s_time)) sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UnixUnsignedToDateTime(sysv_sb.s_time))
.AppendLine(); .AppendLine();
if(sysv_sb.s_time != 0) if(sysv_sb.s_time != 0)
{ {
XmlFsType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(sysv_sb.s_time); XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(sysv_sb.s_time);
XmlFsType.ModificationDateSpecified = true; XmlFsType.ModificationDateSpecified = true;
} }
sb.AppendFormat("Volume name: {0}", sysv_sb.s_fname).AppendLine(); sb.AppendFormat("Volume name: {0}", sysv_sb.s_fname).AppendLine();
@@ -608,11 +608,11 @@ namespace DiscImageChef.Filesystems
if(coh_sb.s_ilock > 0) sb.AppendLine("inode cache is locked"); if(coh_sb.s_ilock > 0) sb.AppendLine("inode cache is locked");
if(coh_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified"); if(coh_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified");
if(coh_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only"); if(coh_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only");
sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(coh_sb.s_time)) sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UnixUnsignedToDateTime(coh_sb.s_time))
.AppendLine(); .AppendLine();
if(coh_sb.s_time != 0) if(coh_sb.s_time != 0)
{ {
XmlFsType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(coh_sb.s_time); XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(coh_sb.s_time);
XmlFsType.ModificationDateSpecified = true; XmlFsType.ModificationDateSpecified = true;
} }
sb.AppendFormat("Volume name: {0}", coh_sb.s_fname).AppendLine(); sb.AppendFormat("Volume name: {0}", coh_sb.s_fname).AppendLine();
@@ -663,11 +663,11 @@ namespace DiscImageChef.Filesystems
if(v7_sb.s_ilock > 0) sb.AppendLine("inode cache is locked"); if(v7_sb.s_ilock > 0) sb.AppendLine("inode cache is locked");
if(v7_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified"); if(v7_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified");
if(v7_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only"); if(v7_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only");
sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(v7_sb.s_time)) sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UnixUnsignedToDateTime(v7_sb.s_time))
.AppendLine(); .AppendLine();
if(v7_sb.s_time != 0) if(v7_sb.s_time != 0)
{ {
XmlFsType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(v7_sb.s_time); XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(v7_sb.s_time);
XmlFsType.ModificationDateSpecified = true; XmlFsType.ModificationDateSpecified = true;
} }
sb.AppendFormat("Volume name: {0}", v7_sb.s_fname).AppendLine(); sb.AppendFormat("Volume name: {0}", v7_sb.s_fname).AppendLine();

View File

@@ -145,7 +145,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
DeviceNo = 0, DeviceNo = 0,
GID = 0, GID = 0,
Inode = 0, Inode = 0,
LastWriteTimeUtc = DateHandlers.UCSDPascalToDateTime(entry.mtime), LastWriteTimeUtc = DateHandlers.UcsdPascalToDateTime(entry.mtime),
Length = (entry.lastBlock - entry.firstBlock) * device.GetSectorSize() + entry.lastBytes, Length = (entry.lastBlock - entry.firstBlock) * device.GetSectorSize() + entry.lastBytes,
Links = 1, Links = 1,
Mode = 0x124, Mode = 0x124,

View File

@@ -138,7 +138,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
sbInformation.AppendFormat("Volume has {0} blocks", volEntry.blocks).AppendLine(); sbInformation.AppendFormat("Volume has {0} blocks", volEntry.blocks).AppendLine();
sbInformation.AppendFormat("Volume has {0} files", volEntry.files).AppendLine(); sbInformation.AppendFormat("Volume has {0} files", volEntry.files).AppendLine();
sbInformation sbInformation
.AppendFormat("Volume last booted at {0}", DateHandlers.UCSDPascalToDateTime(volEntry.lastBoot)) .AppendFormat("Volume last booted at {0}", DateHandlers.UcsdPascalToDateTime(volEntry.lastBoot))
.AppendLine(); .AppendLine();
information = sbInformation.ToString(); information = sbInformation.ToString();

View File

@@ -468,7 +468,7 @@ namespace DiscImageChef.Filesystems
static DateTime EcmaToDateTime(Timestamp timestamp) static DateTime EcmaToDateTime(Timestamp timestamp)
{ {
return DateHandlers.ECMAToDateTime(timestamp.typeAndZone, timestamp.year, timestamp.month, timestamp.day, return DateHandlers.EcmaToDateTime(timestamp.typeAndZone, timestamp.year, timestamp.month, timestamp.day,
timestamp.hour, timestamp.minute, timestamp.second, timestamp.hour, timestamp.minute, timestamp.second,
timestamp.centiseconds, timestamp.hundredsMicroseconds, timestamp.centiseconds, timestamp.hundredsMicroseconds,
timestamp.microseconds); timestamp.microseconds);

View File

@@ -206,7 +206,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("{0} data blocks in volume", unicosSb.s_fsize).AppendLine(); sb.AppendFormat("{0} data blocks in volume", unicosSb.s_fsize).AppendLine();
sb.AppendFormat("Root resides on inode {0}", unicosSb.s_root).AppendLine(); sb.AppendFormat("Root resides on inode {0}", unicosSb.s_root).AppendLine();
sb.AppendFormat("{0} inodes in volume", unicosSb.s_isize).AppendLine(); sb.AppendFormat("{0} inodes in volume", unicosSb.s_isize).AppendLine();
sb.AppendFormat("Volume last updated on {0}", DateHandlers.UNIXToDateTime(unicosSb.s_time)).AppendLine(); sb.AppendFormat("Volume last updated on {0}", DateHandlers.UnixToDateTime(unicosSb.s_time)).AppendLine();
if(unicosSb.s_error > 0) if(unicosSb.s_error > 0)
sb.AppendFormat("Volume is dirty, error code = 0x{0:X16}", unicosSb.s_error).AppendLine(); sb.AppendFormat("Volume is dirty, error code = 0x{0:X16}", unicosSb.s_error).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(unicosSb.s_fname, CurrentEncoding)) sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(unicosSb.s_fname, CurrentEncoding))
@@ -220,7 +220,7 @@ namespace DiscImageChef.Filesystems
ClusterSize = 4096, ClusterSize = 4096,
Clusters = unicosSb.s_fsize, Clusters = unicosSb.s_fsize,
VolumeName = StringHandlers.CToString(unicosSb.s_fname, CurrentEncoding), VolumeName = StringHandlers.CToString(unicosSb.s_fname, CurrentEncoding),
ModificationDate = DateHandlers.UNIXToDateTime(unicosSb.s_time), ModificationDate = DateHandlers.UnixToDateTime(unicosSb.s_time),
ModificationDateSpecified = true ModificationDateSpecified = true
}; };
XmlFsType.Dirty |= unicosSb.s_error > 0; XmlFsType.Dirty |= unicosSb.s_error > 0;

View File

@@ -135,19 +135,19 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("Volume size {0} bytes", volInfo.size * 256).AppendLine(); sbInformation.AppendFormat("Volume size {0} bytes", volInfo.size * 256).AppendLine();
sbInformation.AppendFormat("Volume UUID {0}", volInfo.uuid).AppendLine(); sbInformation.AppendFormat("Volume UUID {0}", volInfo.uuid).AppendLine();
sbInformation sbInformation
.AppendFormat("Volume created on {0}", DateHandlers.UNIXUnsignedToDateTime(ctimeSecs, ctimeNanoSecs)) .AppendFormat("Volume created on {0}", DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs))
.AppendLine(); .AppendLine();
sbInformation.AppendFormat("Volume last modified on {0}", sbInformation.AppendFormat("Volume last modified on {0}",
DateHandlers.UNIXUnsignedToDateTime(mtimeSecs, mtimeNanoSecs)).AppendLine(); DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs)).AppendLine();
information = sbInformation.ToString(); information = sbInformation.ToString();
XmlFsType = new FileSystemType XmlFsType = new FileSystemType
{ {
Type = "VMware file system", Type = "VMware file system",
CreationDate = DateHandlers.UNIXUnsignedToDateTime(ctimeSecs, ctimeNanoSecs), CreationDate = DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs),
CreationDateSpecified = true, CreationDateSpecified = true,
ModificationDate = DateHandlers.UNIXUnsignedToDateTime(mtimeSecs, mtimeNanoSecs), ModificationDate = DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs),
ModificationDateSpecified = true, ModificationDateSpecified = true,
Clusters = volInfo.size * 256 / imagePlugin.ImageInfo.SectorSize, Clusters = volInfo.size * 256 / imagePlugin.ImageInfo.SectorSize,
ClusterSize = (int)imagePlugin.ImageInfo.SectorSize, ClusterSize = (int)imagePlugin.ImageInfo.SectorSize,

View File

@@ -250,9 +250,9 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("Volume has {0} free inodes", vxSb.vs_ifree).AppendLine(); sbInformation.AppendFormat("Volume has {0} free inodes", vxSb.vs_ifree).AppendLine();
sbInformation.AppendFormat("Volume has {0} free blocks", vxSb.vs_free).AppendLine(); sbInformation.AppendFormat("Volume has {0} free blocks", vxSb.vs_free).AppendLine();
sbInformation.AppendFormat("Volume created on {0}", sbInformation.AppendFormat("Volume created on {0}",
DateHandlers.UNIXUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime)).AppendLine(); DateHandlers.UnixUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime)).AppendLine();
sbInformation.AppendFormat("Volume last modified on {0}", sbInformation.AppendFormat("Volume last modified on {0}",
DateHandlers.UNIXUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime)).AppendLine(); DateHandlers.UnixUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime)).AppendLine();
if(vxSb.vs_clean != 0) sbInformation.AppendLine("Volume is dirty"); if(vxSb.vs_clean != 0) sbInformation.AppendLine("Volume is dirty");
information = sbInformation.ToString(); information = sbInformation.ToString();
@@ -260,9 +260,9 @@ namespace DiscImageChef.Filesystems
XmlFsType = new FileSystemType XmlFsType = new FileSystemType
{ {
Type = "Veritas file system", Type = "Veritas file system",
CreationDate = DateHandlers.UNIXUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime), CreationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime),
CreationDateSpecified = true, CreationDateSpecified = true,
ModificationDate = DateHandlers.UNIXUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime), ModificationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime),
ModificationDateSpecified = true, ModificationDateSpecified = true,
Clusters = vxSb.vs_size, Clusters = vxSb.vs_size,
ClusterSize = vxSb.vs_bsize, ClusterSize = vxSb.vs_bsize,

View File

@@ -441,7 +441,7 @@ namespace DiscImageChef.Filesystems
for(int i = 0; i < item.elements; i++) for(int i = 0; i < item.elements; i++)
{ {
DateTime temp = DateTime temp =
DateHandlers.UNIXHrTimeToDateTime(BigEndianBitConverter.ToUInt64(nvlist, offset)); DateHandlers.UnixHrTimeToDateTime(BigEndianBitConverter.ToUInt64(nvlist, offset));
hrtimeArray[i] = temp; hrtimeArray[i] = temp;
offset += 8; offset += 8;
} }
@@ -451,7 +451,7 @@ namespace DiscImageChef.Filesystems
else else
{ {
item.value = item.value =
DateHandlers.UNIXHrTimeToDateTime(BigEndianBitConverter.ToUInt64(nvlist, offset)); DateHandlers.UnixHrTimeToDateTime(BigEndianBitConverter.ToUInt64(nvlist, offset));
offset += 8; offset += 8;
} }

View File

@@ -345,13 +345,13 @@ namespace DiscImageChef.Filesystems
sb.AppendLine(XmlFsType.Type); sb.AppendLine(XmlFsType.Type);
if(oldHdr.c_date > 0) if(oldHdr.c_date > 0)
{ {
XmlFsType.CreationDate = DateHandlers.UNIXToDateTime(oldHdr.c_date); XmlFsType.CreationDate = DateHandlers.UnixToDateTime(oldHdr.c_date);
XmlFsType.CreationDateSpecified = true; XmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine(); sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine();
} }
if(oldHdr.c_ddate > 0) if(oldHdr.c_ddate > 0)
{ {
XmlFsType.BackupDate = DateHandlers.UNIXToDateTime(oldHdr.c_ddate); XmlFsType.BackupDate = DateHandlers.UnixToDateTime(oldHdr.c_ddate);
XmlFsType.BackupDateSpecified = true; XmlFsType.BackupDateSpecified = true;
sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine(); sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine();
} }
@@ -363,13 +363,13 @@ namespace DiscImageChef.Filesystems
sb.AppendLine(XmlFsType.Type); sb.AppendLine(XmlFsType.Type);
if(aixHdr.c_date > 0) if(aixHdr.c_date > 0)
{ {
XmlFsType.CreationDate = DateHandlers.UNIXToDateTime(aixHdr.c_date); XmlFsType.CreationDate = DateHandlers.UnixToDateTime(aixHdr.c_date);
XmlFsType.CreationDateSpecified = true; XmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine(); sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine();
} }
if(aixHdr.c_ddate > 0) if(aixHdr.c_ddate > 0)
{ {
XmlFsType.BackupDate = DateHandlers.UNIXToDateTime(aixHdr.c_ddate); XmlFsType.BackupDate = DateHandlers.UnixToDateTime(aixHdr.c_ddate);
XmlFsType.BackupDateSpecified = true; XmlFsType.BackupDateSpecified = true;
sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine(); sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine();
} }
@@ -381,25 +381,25 @@ namespace DiscImageChef.Filesystems
sb.AppendLine(XmlFsType.Type); sb.AppendLine(XmlFsType.Type);
if(newHdr.c_ndate > 0) if(newHdr.c_ndate > 0)
{ {
XmlFsType.CreationDate = DateHandlers.UNIXToDateTime(newHdr.c_ndate); XmlFsType.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_ndate);
XmlFsType.CreationDateSpecified = true; XmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine(); sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine();
} }
else if(newHdr.c_date > 0) else if(newHdr.c_date > 0)
{ {
XmlFsType.CreationDate = DateHandlers.UNIXToDateTime(newHdr.c_date); XmlFsType.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_date);
XmlFsType.CreationDateSpecified = true; XmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine(); sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine();
} }
if(newHdr.c_nddate > 0) if(newHdr.c_nddate > 0)
{ {
XmlFsType.BackupDate = DateHandlers.UNIXToDateTime(newHdr.c_nddate); XmlFsType.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_nddate);
XmlFsType.BackupDateSpecified = true; XmlFsType.BackupDateSpecified = true;
sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine(); sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine();
} }
else if(newHdr.c_ddate > 0) else if(newHdr.c_ddate > 0)
{ {
XmlFsType.BackupDate = DateHandlers.UNIXToDateTime(newHdr.c_ddate); XmlFsType.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_ddate);
XmlFsType.BackupDateSpecified = true; XmlFsType.BackupDateSpecified = true;
sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine(); sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine();
} }

View File

@@ -189,9 +189,9 @@ namespace DiscImageChef.Filesystems
if(supblk.mkfs_t > 0) if(supblk.mkfs_t > 0)
{ {
sb.AppendFormat("Volume was created on {0} for {1}", DateHandlers.UNIXUnsignedToDateTime(supblk.mkfs_t), sb.AppendFormat("Volume was created on {0} for {1}", DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t),
extOs).AppendLine(); extOs).AppendLine();
XmlFsType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(supblk.mkfs_t); XmlFsType.CreationDate = DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t);
XmlFsType.CreationDateSpecified = true; XmlFsType.CreationDateSpecified = true;
} }
else sb.AppendFormat("Volume was created for {0}", extOs).AppendLine(); else sb.AppendFormat("Volume was created for {0}", extOs).AppendLine();
@@ -255,7 +255,7 @@ namespace DiscImageChef.Filesystems
if(supblk.mount_t > 0 || supblk.mount_c > 0) if(supblk.mount_t > 0 || supblk.mount_c > 0)
{ {
if(supblk.mount_t > 0) if(supblk.mount_t > 0)
sb.AppendFormat("Last mounted on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.mount_t)) sb.AppendFormat("Last mounted on {0}", DateHandlers.UnixUnsignedToDateTime(supblk.mount_t))
.AppendLine(); .AppendLine();
if(supblk.max_mount_c != -1) if(supblk.max_mount_c != -1)
sb.AppendFormat("Volume has been mounted {0} times of a maximum of {1} mounts before checking", sb.AppendFormat("Volume has been mounted {0} times of a maximum of {1} mounts before checking",
@@ -281,9 +281,9 @@ namespace DiscImageChef.Filesystems
if(supblk.check_t > 0) if(supblk.check_t > 0)
if(supblk.check_inv > 0) if(supblk.check_inv > 0)
sb.AppendFormat("Last checked on {0} (should check every {1} seconds)", sb.AppendFormat("Last checked on {0} (should check every {1} seconds)",
DateHandlers.UNIXUnsignedToDateTime(supblk.check_t), supblk.check_inv).AppendLine(); DateHandlers.UnixUnsignedToDateTime(supblk.check_t), supblk.check_inv).AppendLine();
else else
sb.AppendFormat("Last checked on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.check_t)) sb.AppendFormat("Last checked on {0}", DateHandlers.UnixUnsignedToDateTime(supblk.check_t))
.AppendLine(); .AppendLine();
else else
{ {
@@ -295,9 +295,9 @@ namespace DiscImageChef.Filesystems
if(supblk.write_t > 0) if(supblk.write_t > 0)
{ {
sb.AppendFormat("Last written on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.write_t)) sb.AppendFormat("Last written on {0}", DateHandlers.UnixUnsignedToDateTime(supblk.write_t))
.AppendLine(); .AppendLine();
XmlFsType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(supblk.write_t); XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(supblk.write_t);
XmlFsType.ModificationDateSpecified = true; XmlFsType.ModificationDateSpecified = true;
} }
else sb.AppendLine("Volume has never been written"); else sb.AppendLine("Volume has never been written");
@@ -415,8 +415,8 @@ namespace DiscImageChef.Filesystems
{ {
sb.AppendFormat("{0} errors registered", supblk.error_count).AppendLine(); sb.AppendFormat("{0} errors registered", supblk.error_count).AppendLine();
sb.AppendFormat("First error occurred on {0}, last on {1}", sb.AppendFormat("First error occurred on {0}, last on {1}",
DateHandlers.UNIXUnsignedToDateTime(supblk.first_error_t), DateHandlers.UnixUnsignedToDateTime(supblk.first_error_t),
DateHandlers.UNIXUnsignedToDateTime(supblk.last_error_t)).AppendLine(); DateHandlers.UnixUnsignedToDateTime(supblk.last_error_t)).AppendLine();
sb.AppendFormat("First error inode is {0}, last is {1}", supblk.first_error_inode, sb.AppendFormat("First error inode is {0}, last is {1}", supblk.first_error_inode,
supblk.last_error_inode).AppendLine(); supblk.last_error_inode).AppendLine();
sb.AppendFormat("First error block is {0}, last is {1}", supblk.first_error_block, sb.AppendFormat("First error block is {0}, last is {1}", supblk.first_error_block,

View File

@@ -590,8 +590,8 @@ namespace DiscImageChef.Filters
fs.Read(dates_b, 0, 16); fs.Read(dates_b, 0, 16);
AppleDoubleFileDates dates = AppleDoubleFileDates dates =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleFileDates>(dates_b); BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleFileDates>(dates_b);
creationTime = DateHandlers.UNIXUnsignedToDateTime(dates.creationDate); creationTime = DateHandlers.UnixUnsignedToDateTime(dates.creationDate);
lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(dates.modificationDate); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(dates.modificationDate);
break; break;
case AppleDoubleEntryID.FileInfo: case AppleDoubleEntryID.FileInfo:
fs.Seek(entry.offset, SeekOrigin.Begin); fs.Seek(entry.offset, SeekOrigin.Begin);
@@ -615,15 +615,15 @@ namespace DiscImageChef.Filters
{ {
AppleDoubleUNIXFileInfo unixinfo = AppleDoubleUNIXFileInfo unixinfo =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleUNIXFileInfo>(finfo); BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleUNIXFileInfo>(finfo);
creationTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.creationDate); creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate);
lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.modificationDate); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.modificationDate);
} }
else if(DOSHome.SequenceEqual(header.homeFilesystem)) else if(DOSHome.SequenceEqual(header.homeFilesystem))
{ {
AppleDoubleDOSFileInfo dosinfo = AppleDoubleDOSFileInfo dosinfo =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleDOSFileInfo>(finfo); BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleDOSFileInfo>(finfo);
lastWriteTime = lastWriteTime =
DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); DateHandlers.DosToDateTime(dosinfo.modificationDate, dosinfo.modificationTime);
} }
break; break;
case AppleDoubleEntryID.ResourceFork: case AppleDoubleEntryID.ResourceFork:

View File

@@ -315,8 +315,8 @@ namespace DiscImageChef.Filters
ms.Read(dates_b, 0, 16); ms.Read(dates_b, 0, 16);
AppleSingleFileDates dates = AppleSingleFileDates dates =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleFileDates>(dates_b); BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleFileDates>(dates_b);
creationTime = DateHandlers.UNIXUnsignedToDateTime(dates.creationDate); creationTime = DateHandlers.UnixUnsignedToDateTime(dates.creationDate);
lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(dates.modificationDate); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(dates.modificationDate);
break; break;
case AppleSingleEntryID.FileInfo: case AppleSingleEntryID.FileInfo:
ms.Seek(entry.offset, SeekOrigin.Begin); ms.Seek(entry.offset, SeekOrigin.Begin);
@@ -340,15 +340,15 @@ namespace DiscImageChef.Filters
{ {
AppleSingleUNIXFileInfo unixinfo = AppleSingleUNIXFileInfo unixinfo =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleUNIXFileInfo>(finfo); BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleUNIXFileInfo>(finfo);
creationTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.creationDate); creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate);
lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.modificationDate); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.modificationDate);
} }
else if(DOSHome.SequenceEqual(header.homeFilesystem)) else if(DOSHome.SequenceEqual(header.homeFilesystem))
{ {
AppleSingleDOSFileInfo dosinfo = AppleSingleDOSFileInfo dosinfo =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleDOSFileInfo>(finfo); BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleDOSFileInfo>(finfo);
lastWriteTime = lastWriteTime =
DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); DateHandlers.DosToDateTime(dosinfo.modificationDate, dosinfo.modificationTime);
} }
break; break;
case AppleSingleEntryID.ResourceFork: case AppleSingleEntryID.ResourceFork:
@@ -417,15 +417,15 @@ namespace DiscImageChef.Filters
{ {
AppleSingleUNIXFileInfo unixinfo = AppleSingleUNIXFileInfo unixinfo =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleUNIXFileInfo>(finfo); BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleUNIXFileInfo>(finfo);
creationTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.creationDate); creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate);
lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.modificationDate); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.modificationDate);
} }
else if(DOSHome.SequenceEqual(header.homeFilesystem)) else if(DOSHome.SequenceEqual(header.homeFilesystem))
{ {
AppleSingleDOSFileInfo dosinfo = AppleSingleDOSFileInfo dosinfo =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleDOSFileInfo>(finfo); BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleDOSFileInfo>(finfo);
lastWriteTime = lastWriteTime =
DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); DateHandlers.DosToDateTime(dosinfo.modificationDate, dosinfo.modificationTime);
} }
break; break;
case AppleSingleEntryID.ResourceFork: case AppleSingleEntryID.ResourceFork:
@@ -495,15 +495,15 @@ namespace DiscImageChef.Filters
{ {
AppleSingleUNIXFileInfo unixinfo = AppleSingleUNIXFileInfo unixinfo =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleUNIXFileInfo>(finfo); BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleUNIXFileInfo>(finfo);
creationTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.creationDate); creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate);
lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.modificationDate); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.modificationDate);
} }
else if(DOSHome.SequenceEqual(header.homeFilesystem)) else if(DOSHome.SequenceEqual(header.homeFilesystem))
{ {
AppleSingleDOSFileInfo dosinfo = AppleSingleDOSFileInfo dosinfo =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleDOSFileInfo>(finfo); BigEndianMarshal.ByteArrayToStructureBigEndian<AppleSingleDOSFileInfo>(finfo);
lastWriteTime = lastWriteTime =
DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime); DateHandlers.DosToDateTime(dosinfo.modificationDate, dosinfo.modificationTime);
} }
break; break;
case AppleSingleEntryID.ResourceFork: case AppleSingleEntryID.ResourceFork:

View File

@@ -135,7 +135,7 @@ namespace DiscImageChef.Filters
isize = BitConverter.ToUInt32(isize_b, 0); isize = BitConverter.ToUInt32(isize_b, 0);
decompressedSize = isize; decompressedSize = isize;
creationTime = DateHandlers.UNIXUnsignedToDateTime(mtime); creationTime = DateHandlers.UnixUnsignedToDateTime(mtime);
lastWriteTime = creationTime; lastWriteTime = creationTime;
zStream = new ForcedSeekStream<GZipStream>(decompressedSize, dataStream, CompressionMode.Decompress); zStream = new ForcedSeekStream<GZipStream>(decompressedSize, dataStream, CompressionMode.Decompress);
opened = true; opened = true;
@@ -161,7 +161,7 @@ namespace DiscImageChef.Filters
isize = BitConverter.ToUInt32(isize_b, 0); isize = BitConverter.ToUInt32(isize_b, 0);
decompressedSize = isize; decompressedSize = isize;
creationTime = DateHandlers.UNIXUnsignedToDateTime(mtime); creationTime = DateHandlers.UnixUnsignedToDateTime(mtime);
lastWriteTime = creationTime; lastWriteTime = creationTime;
zStream = new ForcedSeekStream<GZipStream>(decompressedSize, dataStream, CompressionMode.Decompress); zStream = new ForcedSeekStream<GZipStream>(decompressedSize, dataStream, CompressionMode.Decompress);
opened = true; opened = true;
@@ -189,7 +189,7 @@ namespace DiscImageChef.Filters
decompressedSize = isize; decompressedSize = isize;
FileInfo fi = new FileInfo(path); FileInfo fi = new FileInfo(path);
creationTime = fi.CreationTimeUtc; creationTime = fi.CreationTimeUtc;
lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(mtime); lastWriteTime = DateHandlers.UnixUnsignedToDateTime(mtime);
zStream = new ForcedSeekStream<GZipStream>(decompressedSize, dataStream, CompressionMode.Decompress); zStream = new ForcedSeekStream<GZipStream>(decompressedSize, dataStream, CompressionMode.Decompress);
opened = true; opened = true;
} }

View File

@@ -40,59 +40,61 @@ namespace DiscImageChef
{ {
static readonly DateTime LisaEpoch = new DateTime(1901, 1, 1, 0, 0, 0); static readonly DateTime LisaEpoch = new DateTime(1901, 1, 1, 0, 0, 0);
static readonly DateTime MacEpoch = new DateTime(1904, 1, 1, 0, 0, 0); static readonly DateTime MacEpoch = new DateTime(1904, 1, 1, 0, 0, 0);
static readonly DateTime UNIXEpoch = new DateTime(1970, 1, 1, 0, 0, 0); static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0);
// Day 0 of Julian Date system /// <summary>
/// Day 0 of Julian Date system
/// </summary>
static readonly DateTime JulianEpoch = new DateTime(1858, 11, 17, 0, 0, 0); static readonly DateTime JulianEpoch = new DateTime(1858, 11, 17, 0, 0, 0);
static readonly DateTime AmigaEpoch = new DateTime(1978, 1, 1, 0, 0, 0); static readonly DateTime AmigaEpoch = new DateTime(1978, 1, 1, 0, 0, 0);
/// <summary> /// <summary>
/// Converts a Macintosh timestamp to a .NET DateTime /// Converts a Macintosh timestamp to a .NET DateTime
/// </summary> /// </summary>
/// <param name="MacTimeStamp">Macintosh timestamp (seconds since 1st Jan. 1904)</param> /// <param name="macTimeStamp">Macintosh timestamp (seconds since 1st Jan. 1904)</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime MacToDateTime(ulong MacTimeStamp) public static DateTime MacToDateTime(ulong macTimeStamp)
{ {
return MacEpoch.AddTicks((long)(MacTimeStamp * 10000000)); return MacEpoch.AddTicks((long)(macTimeStamp * 10000000));
} }
/// <summary> /// <summary>
/// Converts a Lisa timestamp to a .NET DateTime /// Converts a Lisa timestamp to a .NET DateTime
/// </summary> /// </summary>
/// <param name="LisaTimeStamp">Lisa timestamp (seconds since 1st Jan. 1901)</param> /// <param name="lisaTimeStamp">Lisa timestamp (seconds since 1st Jan. 1901)</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime LisaToDateTime(uint LisaTimeStamp) public static DateTime LisaToDateTime(uint lisaTimeStamp)
{ {
return LisaEpoch.AddSeconds(LisaTimeStamp); return LisaEpoch.AddSeconds(lisaTimeStamp);
} }
/// <summary> /// <summary>
/// Converts a UNIX timestamp to a .NET DateTime /// Converts a UNIX timestamp to a .NET DateTime
/// </summary> /// </summary>
/// <param name="UNIXTimeStamp">UNIX timestamp (seconds since 1st Jan. 1970)</param> /// <param name="unixTimeStamp">UNIX timestamp (seconds since 1st Jan. 1970)</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime UNIXToDateTime(int UNIXTimeStamp) public static DateTime UnixToDateTime(int unixTimeStamp)
{ {
return UNIXEpoch.AddSeconds(UNIXTimeStamp); return UnixEpoch.AddSeconds(unixTimeStamp);
} }
/// <summary> /// <summary>
/// Converts a UNIX timestamp to a .NET DateTime /// Converts a UNIX timestamp to a .NET DateTime
/// </summary> /// </summary>
/// <param name="UNIXTimeStamp">UNIX timestamp (seconds since 1st Jan. 1970)</param> /// <param name="unixTimeStamp">UNIX timestamp (seconds since 1st Jan. 1970)</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime UNIXToDateTime(long UNIXTimeStamp) public static DateTime UnixToDateTime(long unixTimeStamp)
{ {
return UNIXEpoch.AddSeconds(UNIXTimeStamp); return UnixEpoch.AddSeconds(unixTimeStamp);
} }
/// <summary> /// <summary>
/// Converts a UNIX timestamp to a .NET DateTime /// Converts a UNIX timestamp to a .NET DateTime
/// </summary> /// </summary>
/// <param name="UNIXTimeStamp">UNIX timestamp (seconds since 1st Jan. 1970)</param> /// <param name="unixTimeStamp">UNIX timestamp (seconds since 1st Jan. 1970)</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime UNIXUnsignedToDateTime(uint UNIXTimeStamp) public static DateTime UnixUnsignedToDateTime(uint unixTimeStamp)
{ {
return UNIXEpoch.AddSeconds(UNIXTimeStamp); return UnixEpoch.AddSeconds(unixTimeStamp);
} }
/// <summary> /// <summary>
@@ -101,103 +103,95 @@ namespace DiscImageChef
/// <param name="seconds">Seconds since 1st Jan. 1970)</param> /// <param name="seconds">Seconds since 1st Jan. 1970)</param>
/// <param name="nanoseconds">Nanoseconds</param> /// <param name="nanoseconds">Nanoseconds</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime UNIXUnsignedToDateTime(uint seconds, uint nanoseconds) public static DateTime UnixUnsignedToDateTime(uint seconds, uint nanoseconds)
{ {
return UNIXEpoch.AddSeconds(seconds).AddTicks((long)nanoseconds / 100); return UnixEpoch.AddSeconds(seconds).AddTicks((long)nanoseconds / 100);
} }
/// <summary> /// <summary>
/// Converts a UNIX timestamp to a .NET DateTime /// Converts a UNIX timestamp to a .NET DateTime
/// </summary> /// </summary>
/// <param name="UNIXTimeStamp">UNIX timestamp (seconds since 1st Jan. 1970)</param> /// <param name="unixTimeStamp">UNIX timestamp (seconds since 1st Jan. 1970)</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime UNIXUnsignedToDateTime(ulong UNIXTimeStamp) public static DateTime UnixUnsignedToDateTime(ulong unixTimeStamp)
{ {
return UNIXEpoch.AddSeconds(UNIXTimeStamp); return UnixEpoch.AddSeconds(unixTimeStamp);
} }
/// <summary> /// <summary>
/// Converts a High Sierra Format timestamp to a .NET DateTime /// Converts a High Sierra Format timestamp to a .NET DateTime
/// </summary> /// </summary>
/// <param name="VDDateTime">High Sierra Format timestamp</param> /// <param name="vdDateTime">High Sierra Format timestamp</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime HighSierraToDateTime(byte[] VDDateTime) public static DateTime HighSierraToDateTime(byte[] vdDateTime)
{ {
byte[] isotime = new byte[17]; byte[] isotime = new byte[17];
Array.Copy(VDDateTime, 0, isotime, 0, 16); Array.Copy(vdDateTime, 0, isotime, 0, 16);
return ISO9660ToDateTime(isotime); return Iso9660ToDateTime(isotime);
} }
// TODO: Timezone // TODO: Timezone
/// <summary> /// <summary>
/// Converts an ISO9660 timestamp to a .NET DateTime /// Converts an ISO9660 timestamp to a .NET DateTime
/// </summary> /// </summary>
/// <param name="VDDateTime">ISO9660 timestamp</param> /// <param name="vdDateTime">ISO9660 timestamp</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime ISO9660ToDateTime(byte[] VDDateTime) public static DateTime Iso9660ToDateTime(byte[] vdDateTime)
{ {
int year, month, day, hour, minute, second, hundredths;
byte[] twocharvalue = new byte[2]; byte[] twocharvalue = new byte[2];
byte[] fourcharvalue = new byte[4]; byte[] fourcharvalue = new byte[4];
fourcharvalue[0] = VDDateTime[0]; fourcharvalue[0] = vdDateTime[0];
fourcharvalue[1] = VDDateTime[1]; fourcharvalue[1] = vdDateTime[1];
fourcharvalue[2] = VDDateTime[2]; fourcharvalue[2] = vdDateTime[2];
fourcharvalue[3] = VDDateTime[3]; fourcharvalue[3] = vdDateTime[3];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "year = \"{0}\"", DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "year = \"{0}\"",
StringHandlers.CToString(fourcharvalue, Encoding.ASCII)); StringHandlers.CToString(fourcharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(fourcharvalue, Encoding.ASCII), out year)) year = 0; if(!int.TryParse(StringHandlers.CToString(fourcharvalue, Encoding.ASCII), out int year)) year = 0;
// year = Convert.ToInt32(StringHandlers.CToString(fourcharvalue, Encoding.ASCII));
twocharvalue[0] = VDDateTime[4]; twocharvalue[0] = vdDateTime[4];
twocharvalue[1] = VDDateTime[5]; twocharvalue[1] = vdDateTime[5];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "month = \"{0}\"", DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "month = \"{0}\"",
StringHandlers.CToString(twocharvalue, Encoding.ASCII)); StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out month)) month = 0; if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out int month)) month = 0;
// month = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII));
twocharvalue[0] = VDDateTime[6]; twocharvalue[0] = vdDateTime[6];
twocharvalue[1] = VDDateTime[7]; twocharvalue[1] = vdDateTime[7];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "day = \"{0}\"", DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "day = \"{0}\"",
StringHandlers.CToString(twocharvalue, Encoding.ASCII)); StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out day)) day = 0; if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out int day)) day = 0;
// day = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII));
twocharvalue[0] = VDDateTime[8]; twocharvalue[0] = vdDateTime[8];
twocharvalue[1] = VDDateTime[9]; twocharvalue[1] = vdDateTime[9];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hour = \"{0}\"", DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hour = \"{0}\"",
StringHandlers.CToString(twocharvalue, Encoding.ASCII)); StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out hour)) hour = 0; if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out int hour)) hour = 0;
// hour = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII));
twocharvalue[0] = VDDateTime[10]; twocharvalue[0] = vdDateTime[10];
twocharvalue[1] = VDDateTime[11]; twocharvalue[1] = vdDateTime[11];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "minute = \"{0}\"", DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "minute = \"{0}\"",
StringHandlers.CToString(twocharvalue, Encoding.ASCII)); StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out minute)) minute = 0; if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out int minute)) minute = 0;
// minute = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII));
twocharvalue[0] = VDDateTime[12]; twocharvalue[0] = vdDateTime[12];
twocharvalue[1] = VDDateTime[13]; twocharvalue[1] = vdDateTime[13];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "second = \"{0}\"", DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "second = \"{0}\"",
StringHandlers.CToString(twocharvalue, Encoding.ASCII)); StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out second)) second = 0; if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out int second)) second = 0;
// second = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII));
twocharvalue[0] = VDDateTime[14]; twocharvalue[0] = vdDateTime[14];
twocharvalue[1] = VDDateTime[15]; twocharvalue[1] = vdDateTime[15];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hundredths = \"{0}\"", DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hundredths = \"{0}\"",
StringHandlers.CToString(twocharvalue, Encoding.ASCII)); StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out hundredths)) hundredths = 0; if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out int hundredths)) hundredths = 0;
// hundredths = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII));
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", DicConsole.DebugWriteLine("ISO9600ToDateTime handler",
"decodedDT = new DateTime({0}, {1}, {2}, {3}, {4}, {5}, {6}, DateTimeKind.Unspecified);", "decodedDT = new DateTime({0}, {1}, {2}, {3}, {4}, {5}, {6}, DateTimeKind.Unspecified);",
year, month, day, hour, minute, second, hundredths * 10); year, month, day, hour, minute, second, hundredths * 10);
DateTime decodedDT = new DateTime(year, month, day, hour, minute, second, hundredths * 10, DateTime decodedDt = new DateTime(year, month, day, hour, minute, second, hundredths * 10,
DateTimeKind.Unspecified); DateTimeKind.Unspecified);
return decodedDT; return decodedDt;
} }
/// <summary> /// <summary>
@@ -206,7 +200,7 @@ namespace DiscImageChef
/// <param name="vmsDate">VMS timestamp (tenths of microseconds since day 0 of the Julian Date)</param> /// <param name="vmsDate">VMS timestamp (tenths of microseconds since day 0 of the Julian Date)</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
/// <remarks>C# works in UTC, VMS on Julian Date, some displacement may occur on disks created outside UTC</remarks> /// <remarks>C# works in UTC, VMS on Julian Date, some displacement may occur on disks created outside UTC</remarks>
public static DateTime VMSToDateTime(ulong vmsDate) public static DateTime VmsToDateTime(ulong vmsDate)
{ {
double delta = vmsDate * 0.0001; // Tenths of microseconds to milliseconds, will lose some detail double delta = vmsDate * 0.0001; // Tenths of microseconds to milliseconds, will lose some detail
return JulianEpoch.AddMilliseconds(delta); return JulianEpoch.AddMilliseconds(delta);
@@ -231,7 +225,7 @@ namespace DiscImageChef
/// </summary> /// </summary>
/// <param name="dateRecord">UCSD Pascal timestamp</param> /// <param name="dateRecord">UCSD Pascal timestamp</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime UCSDPascalToDateTime(short dateRecord) public static DateTime UcsdPascalToDateTime(short dateRecord)
{ {
int year = ((dateRecord & 0xFE00) >> 9) + 1900; int year = ((dateRecord & 0xFE00) >> 9) + 1900;
int day = (dateRecord & 0x01F0) >> 4; int day = (dateRecord & 0x01F0) >> 4;
@@ -249,7 +243,7 @@ namespace DiscImageChef
/// <param name="date">Date</param> /// <param name="date">Date</param>
/// <param name="time">Time</param> /// <param name="time">Time</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime DOSToDateTime(ushort date, ushort time) public static DateTime DosToDateTime(ushort date, ushort time)
{ {
int year = ((date & 0xFE00) >> 9) + 1980; int year = ((date & 0xFE00) >> 9) + 1980;
int month = (date & 0x1E0) >> 5; int month = (date & 0x1E0) >> 5;
@@ -276,7 +270,7 @@ namespace DiscImageChef
/// </summary> /// </summary>
/// <param name="timestamp">CP/M timestamp</param> /// <param name="timestamp">CP/M timestamp</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime CPMToDateTime(byte[] timestamp) public static DateTime CpmToDateTime(byte[] timestamp)
{ {
ushort days = BitConverter.ToUInt16(timestamp, 0); ushort days = BitConverter.ToUInt16(timestamp, 0);
int hours = timestamp[2]; int hours = timestamp[2];
@@ -303,7 +297,7 @@ namespace DiscImageChef
/// <param name="hundredsOfMicroseconds">Hundreds of microseconds</param> /// <param name="hundredsOfMicroseconds">Hundreds of microseconds</param>
/// <param name="microseconds">Microseconds</param> /// <param name="microseconds">Microseconds</param>
/// <returns></returns> /// <returns></returns>
public static DateTime ECMAToDateTime(ushort typeAndTimeZone, short year, byte month, byte day, byte hour, public static DateTime EcmaToDateTime(ushort typeAndTimeZone, short year, byte month, byte day, byte hour,
byte minute, byte second, byte centiseconds, byte hundredsOfMicroseconds, byte minute, byte second, byte centiseconds, byte hundredsOfMicroseconds,
byte microseconds) byte microseconds)
{ {
@@ -330,11 +324,11 @@ namespace DiscImageChef
/// <summary> /// <summary>
/// Convers a Solaris high resolution timestamp to .NET DateTime /// Convers a Solaris high resolution timestamp to .NET DateTime
/// </summary> /// </summary>
/// <param name="HRTimeStamp">Solaris high resolution timestamp</param> /// <param name="hrTimeStamp">Solaris high resolution timestamp</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime UNIXHrTimeToDateTime(ulong HRTimeStamp) public static DateTime UnixHrTimeToDateTime(ulong hrTimeStamp)
{ {
return UNIXEpoch.AddTicks((long)(HRTimeStamp / 100)); return UnixEpoch.AddTicks((long)(hrTimeStamp / 100));
} }
/// <summary> /// <summary>
@@ -342,21 +336,21 @@ namespace DiscImageChef
/// </summary> /// </summary>
/// <param name="date">OS-9 timestamp</param> /// <param name="date">OS-9 timestamp</param>
/// <returns>.NET DateTime</returns> /// <returns>.NET DateTime</returns>
public static DateTime OS9ToDateTime(byte[] date) public static DateTime Os9ToDateTime(byte[] date)
{ {
if(date == null || date.Length != 3 && date.Length != 5) return DateTime.MinValue; if(date == null || date.Length != 3 && date.Length != 5) return DateTime.MinValue;
DateTime os9date; DateTime os9Date;
try try
{ {
os9date = date.Length == 5 os9Date = date.Length == 5
? new DateTime(1900 + date[0], date[1], date[2], date[3], date[4], 0) ? new DateTime(1900 + date[0], date[1], date[2], date[3], date[4], 0)
: new DateTime(1900 + date[0], date[1], date[2], 0, 0, 0); : new DateTime(1900 + date[0], date[1], date[2], 0, 0, 0);
} }
catch(ArgumentOutOfRangeException) { os9date = new DateTime(1900, 0, 0, 0, 0, 0); } catch(ArgumentOutOfRangeException) { os9Date = new DateTime(1900, 0, 0, 0, 0, 0); }
return os9date; return os9Date;
} }
/// <summary> /// <summary>

View File

@@ -246,7 +246,7 @@ namespace DiscImageChef.Partitions
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_part[{0}].p_flag = {1} ({2})", i, DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_part[{0}].p_flag = {1} ({2})", i,
dkl8.dkl_vtoc.v_part[i].p_flag, (ushort)dkl8.dkl_vtoc.v_part[i].p_flag); dkl8.dkl_vtoc.v_part[i].p_flag, (ushort)dkl8.dkl_vtoc.v_part[i].p_flag);
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_timestamp[{0}] = {1}", i, DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_timestamp[{0}] = {1}", i,
DateHandlers.UNIXToDateTime(dkl8.dkl_vtoc.v_timestamp[i])); DateHandlers.UnixToDateTime(dkl8.dkl_vtoc.v_timestamp[i]));
} }
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_magic = 0x{0:X4}", dkl8.dkl_magic); DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_magic = 0x{0:X4}", dkl8.dkl_magic);
@@ -275,7 +275,7 @@ namespace DiscImageChef.Partitions
}; };
if(dkl8.dkl_vtoc.v_timestamp[i] != 0) if(dkl8.dkl_vtoc.v_timestamp[i] != 0)
part.Description += part.Description +=
$"\nPartition timestamped on {DateHandlers.UNIXToDateTime(dkl8.dkl_vtoc.v_timestamp[i])}"; $"\nPartition timestamped on {DateHandlers.UnixToDateTime(dkl8.dkl_vtoc.v_timestamp[i])}";
if(part.Start < imagePlugin.GetSectors() && part.End <= imagePlugin.GetSectors()) if(part.Start < imagePlugin.GetSectors() && part.End <= imagePlugin.GetSectors())
partitions.Add(part); partitions.Add(part);
@@ -314,7 +314,7 @@ namespace DiscImageChef.Partitions
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_part[{0}].p_flag = {1} ({2})", i, DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_part[{0}].p_flag = {1} ({2})", i,
dkl16.dkl_vtoc.v_part[i].p_flag, (ushort)dkl16.dkl_vtoc.v_part[i].p_flag); dkl16.dkl_vtoc.v_part[i].p_flag, (ushort)dkl16.dkl_vtoc.v_part[i].p_flag);
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_timestamp[{0}] = {1}", i, DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_timestamp[{0}] = {1}", i,
DateHandlers.UNIXToDateTime(dkl16.dkl_vtoc.v_timestamp[i])); DateHandlers.UnixToDateTime(dkl16.dkl_vtoc.v_timestamp[i]));
} }
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_magic = 0x{0:X4}", dkl16.dkl_magic); DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_magic = 0x{0:X4}", dkl16.dkl_magic);
@@ -344,7 +344,7 @@ namespace DiscImageChef.Partitions
}; };
if(dkl16.dkl_vtoc.v_timestamp[i] != 0) if(dkl16.dkl_vtoc.v_timestamp[i] != 0)
part.Description += part.Description +=
$"\nPartition timestamped on {DateHandlers.UNIXToDateTime(dkl16.dkl_vtoc.v_timestamp[i])}"; $"\nPartition timestamped on {DateHandlers.UnixToDateTime(dkl16.dkl_vtoc.v_timestamp[i])}";
if(part.Start < imagePlugin.GetSectors() && part.End <= imagePlugin.GetSectors()) if(part.Start < imagePlugin.GetSectors() && part.End <= imagePlugin.GetSectors())
partitions.Add(part); partitions.Add(part);
} }

View File

@@ -272,7 +272,7 @@ namespace DiscImageChef.Partitions
DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_part[{0}].p_size = {1}", i, DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_part[{0}].p_size = {1}", i,
vtocOld.v_part[i].p_size); vtocOld.v_part[i].p_size);
DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.timestamp[{0}] = {1}", i, DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.timestamp[{0}] = {1}", i,
DateHandlers.UNIXToDateTime(vtocOld.timestamp[i])); DateHandlers.UnixToDateTime(vtocOld.timestamp[i]));
} }
} }
else else
@@ -294,7 +294,7 @@ namespace DiscImageChef.Partitions
vtoc.v_part[i].p_start); vtoc.v_part[i].p_start);
DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_part[{0}].p_size = {1}", i, vtoc.v_part[i].p_size); DicConsole.DebugWriteLine("VTOC plugin", "vtoc.v_part[{0}].p_size = {1}", i, vtoc.v_part[i].p_size);
DicConsole.DebugWriteLine("VTOC plugin", "vtoc.timestamp[{0}] = {1}", i, DicConsole.DebugWriteLine("VTOC plugin", "vtoc.timestamp[{0}] = {1}", i,
DateHandlers.UNIXToDateTime(vtoc.timestamp[i])); DateHandlers.UnixToDateTime(vtoc.timestamp[i]));
} }
} }
@@ -352,7 +352,7 @@ namespace DiscImageChef.Partitions
if(parts[i].p_flag.HasFlag(pFlag.V_REMAP)) info += " (alternate sector mapping)"; if(parts[i].p_flag.HasFlag(pFlag.V_REMAP)) info += " (alternate sector mapping)";
if(parts[i].p_flag.HasFlag(pFlag.V_RONLY)) info += " (read-only)"; if(parts[i].p_flag.HasFlag(pFlag.V_RONLY)) info += " (read-only)";
if(timestamps[i] != 0) if(timestamps[i] != 0)
info += $" created on {DateHandlers.UNIXToDateTime(timestamps[i])}"; info += $" created on {DateHandlers.UnixToDateTime(timestamps[i])}";
part.Description = "UNIX slice" + info + "."; part.Description = "UNIX slice" + info + ".";