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)
{
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();
if(page.UTC) sb.AppendLine("\tDrive's time is UTC");
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);
ImageInfo.ImageApplication = "CopyQM";
ImageInfo.ImageCreationTime = DateHandlers.DOSToDateTime(header.date, header.time);
ImageInfo.ImageCreationTime = DateHandlers.DosToDateTime(header.date, header.time);
ImageInfo.ImageLastModificationTime = ImageInfo.ImageCreationTime;
ImageInfo.ImageName = header.volumeLabel;
ImageInfo.ImageSize = (ulong)(stream.Length - 133 - header.commentLength);

View File

@@ -281,7 +281,7 @@ namespace DiscImageChef.DiscImages
clusterCache = new Dictionary<ulong, byte[]>();
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.Sectors = qHdr.size / 512;
ImageInfo.SectorSize = 512;

View File

@@ -369,9 +369,9 @@ namespace DiscImageChef.DiscImages
DicConsole.DebugWriteLine("SuperCardPro plugin", "ImageInfo.imageComments = \"{0}\"",
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}",
ImageInfo.ImageCreationTime);

View File

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

View File

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

View File

@@ -484,10 +484,10 @@ namespace DiscImageChef.Filesystems.CPM
if(statCache.TryGetValue(file1, out fInfo)) statCache.Remove(file1);
else fInfo = new FileEntryInfo();
if(atime) fInfo.AccessTime = DateHandlers.CPMToDateTime(dateEntry.date1);
else fInfo.CreationTime = DateHandlers.CPMToDateTime(dateEntry.date1);
if(atime) fInfo.AccessTime = 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);
}
@@ -497,10 +497,10 @@ namespace DiscImageChef.Filesystems.CPM
if(statCache.TryGetValue(file2, out fInfo)) statCache.Remove(file2);
else fInfo = new FileEntryInfo();
if(atime) fInfo.AccessTime = DateHandlers.CPMToDateTime(dateEntry.date3);
else fInfo.CreationTime = DateHandlers.CPMToDateTime(dateEntry.date3);
if(atime) fInfo.AccessTime = 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);
}
@@ -510,10 +510,10 @@ namespace DiscImageChef.Filesystems.CPM
if(statCache.TryGetValue(file3, out fInfo)) statCache.Remove(file3);
else fInfo = new FileEntryInfo();
if(atime) fInfo.AccessTime = DateHandlers.CPMToDateTime(dateEntry.date5);
else fInfo.CreationTime = DateHandlers.CPMToDateTime(dateEntry.date5);
if(atime) fInfo.AccessTime = 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);
}
@@ -543,9 +543,9 @@ namespace DiscImageChef.Filesystems.CPM
ctime[0] = trdPartyDateEntry.create1[0];
ctime[1] = trdPartyDateEntry.create1[1];
fInfo.AccessTime = DateHandlers.CPMToDateTime(trdPartyDateEntry.access1);
fInfo.CreationTime = DateHandlers.CPMToDateTime(ctime);
fInfo.LastWriteTime = DateHandlers.CPMToDateTime(trdPartyDateEntry.modify1);
fInfo.AccessTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.access1);
fInfo.CreationTime = DateHandlers.CpmToDateTime(ctime);
fInfo.LastWriteTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.modify1);
statCache.Add(file1, fInfo);
}
@@ -559,9 +559,9 @@ namespace DiscImageChef.Filesystems.CPM
ctime[0] = trdPartyDateEntry.create2[0];
ctime[1] = trdPartyDateEntry.create2[1];
fInfo.AccessTime = DateHandlers.CPMToDateTime(trdPartyDateEntry.access2);
fInfo.CreationTime = DateHandlers.CPMToDateTime(ctime);
fInfo.LastWriteTime = DateHandlers.CPMToDateTime(trdPartyDateEntry.modify2);
fInfo.AccessTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.access2);
fInfo.CreationTime = DateHandlers.CpmToDateTime(ctime);
fInfo.LastWriteTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.modify2);
statCache.Add(file2, fInfo);
}
@@ -575,9 +575,9 @@ namespace DiscImageChef.Filesystems.CPM
ctime[0] = trdPartyDateEntry.create3[0];
ctime[1] = trdPartyDateEntry.create3[1];
fInfo.AccessTime = DateHandlers.CPMToDateTime(trdPartyDateEntry.access3);
fInfo.CreationTime = DateHandlers.CPMToDateTime(ctime);
fInfo.LastWriteTime = DateHandlers.CPMToDateTime(trdPartyDateEntry.modify3);
fInfo.AccessTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.access3);
fInfo.CreationTime = DateHandlers.CpmToDateTime(ctime);
fInfo.LastWriteTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.modify3);
statCache.Add(file3, fInfo);
}
@@ -660,12 +660,12 @@ namespace DiscImageChef.Filesystems.CPM
};
if(labelCreationDate != null)
{
XmlFsType.CreationDate = DateHandlers.CPMToDateTime(labelCreationDate);
XmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate);
XmlFsType.CreationDateSpecified = true;
}
if(labelUpdateDate != null)
{
XmlFsType.ModificationDate = DateHandlers.CPMToDateTime(labelUpdateDate);
XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate);
XmlFsType.ModificationDateSpecified = true;
}
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} heads per cylinder", efsSb.sb_heads).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} free blocks", efsSb.sb_tfree).AppendLine();
sb.AppendFormat("{0} free inodes", efsSb.sb_tinode).AppendLine();
@@ -241,7 +241,7 @@ namespace DiscImageChef.Filesystems
Dirty = efsSb.sb_dirty > 0,
VolumeName = StringHandlers.CToString(efsSb.sb_fname, CurrentEncoding),
VolumeSerial = $"{efsSb.sb_checksum:X8}",
CreationDate = DateHandlers.UNIXToDateTime(efsSb.sb_time),
CreationDate = DateHandlers.UnixToDateTime(efsSb.sb_time),
CreationDateSpecified = true
};
}

View File

@@ -1333,7 +1333,7 @@ namespace DiscImageChef.Filesystems
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);
XmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Volume created on {0}", XmlFsType.CreationDate).AppendLine();
@@ -1341,13 +1341,13 @@ namespace DiscImageChef.Filesystems
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;
sb.AppendFormat("Volume last modified on {0}", XmlFsType.ModificationDate).AppendLine();
}
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();
break;

View File

@@ -265,7 +265,7 @@ namespace DiscImageChef.Filesystems
}
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_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
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;
@@ -319,9 +319,9 @@ namespace DiscImageChef.Filesystems
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("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();
XmlFsType.ModificationDate = DateHandlers.UNIXToDateTime(ufs_sb.fs_old_time);
XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(ufs_sb.fs_old_time);
XmlFsType.ModificationDateSpecified = true;
sbInformation.AppendFormat("{0} blocks in volume ({1} bytes)", ufs_sb.fs_old_size,
(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();
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();
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();
@@ -416,9 +416,9 @@ namespace DiscImageChef.Filesystems
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 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();
XmlFsType.ModificationDate = DateHandlers.UNIXToDateTime(ufs_sb.fs_time);
XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(ufs_sb.fs_time);
XmlFsType.ModificationDateSpecified = true;
sbInformation.AppendFormat("{0} blocks ({1} bytes)", ufs_sb.fs_size, ufs_sb.fs_size * ufs_sb.fs_fsize)
.AppendLine();
@@ -431,7 +431,7 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("{0} inodes pending of being freed", ufs_sb.fs_pendinginodes).AppendLine();
}
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();
else if(fs_type_sun86) sbInformation.AppendFormat("{0} sectors/track", ufs_sb.fs_state).AppendLine();
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)
.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();
}
if(ufs_sb.fs_old_nrpos > 0)

View File

@@ -142,8 +142,8 @@ namespace DiscImageChef.Filesystems
.AppendLine();
// sb.AppendFormat("Filesystem type: \"{0}\"", hpfs_bpb.fs_type).AppendLine();
DateTime lastChk = DateHandlers.UNIXToDateTime(hpfsSb.last_chkdsk);
DateTime lastOptim = DateHandlers.UNIXToDateTime(hpfsSb.last_optim);
DateTime lastChk = DateHandlers.UnixToDateTime(hpfsSb.last_chkdsk);
DateTime lastOptim = DateHandlers.UnixToDateTime(hpfsSb.last_optim);
sb.AppendFormat("HPFS version: {0}", hpfsSb.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)
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;
else
{
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;
else
{
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;
else
{
decodedVD.HasEffectiveTime = true;
decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(pvd.effective_date);
decodedVD.EffectiveTime = DateHandlers.Iso9660ToDateTime(pvd.effective_date);
}
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)
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;
else
{
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;
else
{
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;
else
{
decodedVD.HasEffectiveTime = true;
decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(jolietvd.effective_date);
decodedVD.EffectiveTime = DateHandlers.Iso9660ToDateTime(jolietvd.effective_date);
}
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_state != 0) sb.AppendLine("Volume is dirty");
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();
if(jfsSb.s_version == 1)
sb.AppendFormat("Volume name: {0}", CurrentEncoding.GetString(jfsSb.s_fpack)).AppendLine();
@@ -234,7 +234,7 @@ namespace DiscImageChef.Filesystems
Bootable = true,
VolumeName = CurrentEncoding.GetString(jfsSb.s_version == 1 ? jfsSb.s_fpack : jfsSb.s_label),
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
};
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_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();
sb.AppendFormat("Volume has {0} blocks of {1} bytes each (total {2} bytes)", LocusSb.s_fsize, blockSize,
LocusSb.s_fsize * blockSize).AppendLine();
@@ -350,7 +350,7 @@ namespace DiscImageChef.Filesystems
Clusters = LocusSb.s_fsize,
// Sometimes it uses one, or the other. Use the bigger
VolumeName = string.IsNullOrEmpty(s_fsmnt) ? s_fpack : s_fsmnt,
ModificationDate = DateHandlers.UNIXToDateTime(LocusSb.s_time),
ModificationDate = DateHandlers.UnixToDateTime(LocusSb.s_time),
ModificationDateSpecified = true,
Dirty = !LocusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN) || LocusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY),
FreeClusters = LocusSb.s_tfree,

View File

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

View File

@@ -173,12 +173,12 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Volume label: \"{0}\"",
StringHandlers.SpacePaddedToString(homeblock.volname, CurrentEncoding)).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)
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();
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.AppendLine("Flags:");
sb.AppendFormat("Window: {0}", homeblock.window).AppendLine();
@@ -229,12 +229,12 @@ namespace DiscImageChef.Filesystems
};
if(homeblock.credate > 0)
{
XmlFsType.CreationDate = DateHandlers.VMSToDateTime(homeblock.credate);
XmlFsType.CreationDate = DateHandlers.VmsToDateTime(homeblock.credate);
XmlFsType.CreationDateSpecified = true;
}
if(homeblock.revdate > 0)
{
XmlFsType.ModificationDate = DateHandlers.VMSToDateTime(homeblock.revdate);
XmlFsType.ModificationDate = DateHandlers.VmsToDateTime(homeblock.revdate);
XmlFsType.ModificationDateSpecified = true;
}

View File

@@ -247,16 +247,16 @@ namespace DiscImageChef.Filesystems
*/
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
{
Type = "QNX4 filesystem",
Clusters = (long)partition.Length,
ClusterSize = 512,
CreationDate = DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_ftime),
CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime),
CreationDateSpecified = true,
ModificationDate = DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_mtime),
ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_mtime),
ModificationDateSpecified = true
};
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.AppendFormat("Checksum: 0x{0:X8}", qnxSb.checksum).AppendLine();
sb.AppendFormat("Serial: 0x{0:X16}", qnxSb.checksum).AppendLine();
sb.AppendFormat("Created on {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.ctime)).AppendLine();
sb.AppendFormat("Last mounted on {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.atime)).AppendLine();
sb.AppendFormat("Created on {0}", DateHandlers.UnixUnsignedToDateTime(qnxSb.ctime)).AppendLine();
sb.AppendFormat("Last mounted on {0}", DateHandlers.UnixUnsignedToDateTime(qnxSb.atime)).AppendLine();
sb.AppendFormat("Flags: 0x{0:X8}", qnxSb.flags).AppendLine();
sb.AppendFormat("Version1: 0x{0:X4}", qnxSb.version1).AppendLine();
sb.AppendFormat("Version2: 0x{0:X4}", qnxSb.version2).AppendLine();
@@ -228,9 +228,9 @@ namespace DiscImageChef.Filesystems
FreeClusters = qnxSb.freeBlocks,
FreeClustersSpecified = true,
VolumeSerial = $"{qnxSb.serial:X16}",
CreationDate = DateHandlers.UNIXUnsignedToDateTime(qnxSb.ctime),
CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.ctime),
CreationDateSpecified = true,
ModificationDate = DateHandlers.UNIXUnsignedToDateTime(qnxSb.atime),
ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.atime),
ModificationDateSpecified = true
};
//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("Disk is owned by group {0} user {1}", rbf9000Sb.rid_group, rbf9000Sb.rid_owner)
.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();
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))
.AppendLine();
@@ -281,9 +281,9 @@ namespace DiscImageChef.Filesystems
Bootable = rbf9000Sb.rid_bootfile > 0,
ClusterSize = rbf9000Sb.rid_blocksize,
Clusters = rbf9000Sb.rid_totblocks,
CreationDate = DateHandlers.UNIXToDateTime(rbf9000Sb.rid_ctime),
CreationDate = DateHandlers.UnixToDateTime(rbf9000Sb.rid_ctime),
CreationDateSpecified = true,
ModificationDate = DateHandlers.UNIXToDateTime(rbf9000Sb.rid_mtime),
ModificationDate = DateHandlers.UnixToDateTime(rbf9000Sb.rid_mtime),
ModificationDateSpecified = true,
VolumeName = StringHandlers.CToString(rbf9000Sb.rid_name, CurrentEncoding),
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))
.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 name: {0}", StringHandlers.CToString(rbfSb.dd_nam, CurrentEncoding))
.AppendLine();
@@ -327,7 +327,7 @@ namespace DiscImageChef.Filesystems
Bootable = LSNToUInt32(rbfSb.dd_bt) > 0 && rbfSb.dd_bsz > 0,
ClusterSize = rbfSb.dd_bit * (256 << rbfSb.dd_lsnsize),
Clusters = LSNToUInt32(rbfSb.dd_tot),
CreationDate = DateHandlers.OS9ToDateTime(rbfSb.dd_dat),
CreationDate = DateHandlers.Os9ToDateTime(rbfSb.dd_dat),
CreationDateSpecified = true,
VolumeName = StringHandlers.CToString(rbfSb.dd_nam, CurrentEncoding),
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("Root directory resides on block {0}", reiserSb.root_block).AppendLine();
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();
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)
.AppendLine();
sbInformation.AppendFormat("Volume created on {0}",
DateHandlers.UNIXUnsignedToDateTime(rootBlock.datecreated).AddYears(8))
DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8))
.AppendLine();
sbInformation.AppendFormat("Bitmap starts in block {0}", rootBlock.bitmapbase).AppendLine();
sbInformation.AppendFormat("Admin space container starts in block {0}", rootBlock.adminspacecontainer)
@@ -150,7 +150,7 @@ namespace DiscImageChef.Filesystems
XmlFsType = new FileSystemType
{
CreationDate = DateHandlers.UNIXUnsignedToDateTime(rootBlock.datecreated).AddYears(8),
CreationDate = DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8),
CreationDateSpecified = true,
Clusters = rootBlock.totalblocks,
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 has {0} bytes", sqSb.bytes_used).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();
sbInformation.AppendFormat("Volume has {0} inodes", sqSb.inodes).AppendLine();
switch(sqSb.compression)
@@ -177,7 +177,7 @@ namespace DiscImageChef.Filesystems
XmlFsType = new FileSystemType
{
Type = "Squash file system",
CreationDate = DateHandlers.UNIXUnsignedToDateTime(sqSb.mkfs_time),
CreationDate = DateHandlers.UnixUnsignedToDateTime(sqSb.mkfs_time),
CreationDateSpecified = true,
Clusters =
(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_fmod > 0) sb.AppendLine("Superblock is being modified");
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();
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;
}
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_fmod > 0) sb.AppendLine("Superblock is being modified");
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();
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;
}
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_fmod > 0) sb.AppendLine("Superblock is being modified");
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();
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;
}
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_fmod > 0) sb.AppendLine("Superblock is being modified");
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();
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;
}
sb.AppendFormat("Volume name: {0}", v7_sb.s_fname).AppendLine();

View File

@@ -145,7 +145,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
DeviceNo = 0,
GID = 0,
Inode = 0,
LastWriteTimeUtc = DateHandlers.UCSDPascalToDateTime(entry.mtime),
LastWriteTimeUtc = DateHandlers.UcsdPascalToDateTime(entry.mtime),
Length = (entry.lastBlock - entry.firstBlock) * device.GetSectorSize() + entry.lastBytes,
Links = 1,
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} files", volEntry.files).AppendLine();
sbInformation
.AppendFormat("Volume last booted at {0}", DateHandlers.UCSDPascalToDateTime(volEntry.lastBoot))
.AppendFormat("Volume last booted at {0}", DateHandlers.UcsdPascalToDateTime(volEntry.lastBoot))
.AppendLine();
information = sbInformation.ToString();

View File

@@ -468,7 +468,7 @@ namespace DiscImageChef.Filesystems
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.centiseconds, timestamp.hundredsMicroseconds,
timestamp.microseconds);

View File

@@ -206,7 +206,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("{0} data blocks in volume", unicosSb.s_fsize).AppendLine();
sb.AppendFormat("Root resides on inode {0}", unicosSb.s_root).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)
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))
@@ -220,7 +220,7 @@ namespace DiscImageChef.Filesystems
ClusterSize = 4096,
Clusters = unicosSb.s_fsize,
VolumeName = StringHandlers.CToString(unicosSb.s_fname, CurrentEncoding),
ModificationDate = DateHandlers.UNIXToDateTime(unicosSb.s_time),
ModificationDate = DateHandlers.UnixToDateTime(unicosSb.s_time),
ModificationDateSpecified = true
};
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 UUID {0}", volInfo.uuid).AppendLine();
sbInformation
.AppendFormat("Volume created on {0}", DateHandlers.UNIXUnsignedToDateTime(ctimeSecs, ctimeNanoSecs))
.AppendFormat("Volume created on {0}", DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs))
.AppendLine();
sbInformation.AppendFormat("Volume last modified on {0}",
DateHandlers.UNIXUnsignedToDateTime(mtimeSecs, mtimeNanoSecs)).AppendLine();
DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs)).AppendLine();
information = sbInformation.ToString();
XmlFsType = new FileSystemType
{
Type = "VMware file system",
CreationDate = DateHandlers.UNIXUnsignedToDateTime(ctimeSecs, ctimeNanoSecs),
CreationDate = DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs),
CreationDateSpecified = true,
ModificationDate = DateHandlers.UNIXUnsignedToDateTime(mtimeSecs, mtimeNanoSecs),
ModificationDate = DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs),
ModificationDateSpecified = true,
Clusters = volInfo.size * 256 / 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 blocks", vxSb.vs_free).AppendLine();
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}",
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");
information = sbInformation.ToString();
@@ -260,9 +260,9 @@ namespace DiscImageChef.Filesystems
XmlFsType = new FileSystemType
{
Type = "Veritas file system",
CreationDate = DateHandlers.UNIXUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime),
CreationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime),
CreationDateSpecified = true,
ModificationDate = DateHandlers.UNIXUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime),
ModificationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime),
ModificationDateSpecified = true,
Clusters = vxSb.vs_size,
ClusterSize = vxSb.vs_bsize,

View File

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

View File

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

View File

@@ -189,9 +189,9 @@ namespace DiscImageChef.Filesystems
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();
XmlFsType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(supblk.mkfs_t);
XmlFsType.CreationDate = DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t);
XmlFsType.CreationDateSpecified = true;
}
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)
sb.AppendFormat("Last mounted on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.mount_t))
sb.AppendFormat("Last mounted on {0}", DateHandlers.UnixUnsignedToDateTime(supblk.mount_t))
.AppendLine();
if(supblk.max_mount_c != -1)
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_inv > 0)
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
sb.AppendFormat("Last checked on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.check_t))
sb.AppendFormat("Last checked on {0}", DateHandlers.UnixUnsignedToDateTime(supblk.check_t))
.AppendLine();
else
{
@@ -295,9 +295,9 @@ namespace DiscImageChef.Filesystems
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();
XmlFsType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(supblk.write_t);
XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(supblk.write_t);
XmlFsType.ModificationDateSpecified = true;
}
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("First error occurred on {0}, last on {1}",
DateHandlers.UNIXUnsignedToDateTime(supblk.first_error_t),
DateHandlers.UNIXUnsignedToDateTime(supblk.last_error_t)).AppendLine();
DateHandlers.UnixUnsignedToDateTime(supblk.first_error_t),
DateHandlers.UnixUnsignedToDateTime(supblk.last_error_t)).AppendLine();
sb.AppendFormat("First error inode is {0}, last is {1}", supblk.first_error_inode,
supblk.last_error_inode).AppendLine();
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);
AppleDoubleFileDates dates =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleFileDates>(dates_b);
creationTime = DateHandlers.UNIXUnsignedToDateTime(dates.creationDate);
lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(dates.modificationDate);
creationTime = DateHandlers.UnixUnsignedToDateTime(dates.creationDate);
lastWriteTime = DateHandlers.UnixUnsignedToDateTime(dates.modificationDate);
break;
case AppleDoubleEntryID.FileInfo:
fs.Seek(entry.offset, SeekOrigin.Begin);
@@ -615,15 +615,15 @@ namespace DiscImageChef.Filters
{
AppleDoubleUNIXFileInfo unixinfo =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleUNIXFileInfo>(finfo);
creationTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.creationDate);
lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(unixinfo.modificationDate);
creationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate);
lastWriteTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.modificationDate);
}
else if(DOSHome.SequenceEqual(header.homeFilesystem))
{
AppleDoubleDOSFileInfo dosinfo =
BigEndianMarshal.ByteArrayToStructureBigEndian<AppleDoubleDOSFileInfo>(finfo);
lastWriteTime =
DateHandlers.DOSToDateTime(dosinfo.modificationDate, dosinfo.modificationTime);
DateHandlers.DosToDateTime(dosinfo.modificationDate, dosinfo.modificationTime);
}
break;
case AppleDoubleEntryID.ResourceFork:

View File

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

View File

@@ -135,7 +135,7 @@ namespace DiscImageChef.Filters
isize = BitConverter.ToUInt32(isize_b, 0);
decompressedSize = isize;
creationTime = DateHandlers.UNIXUnsignedToDateTime(mtime);
creationTime = DateHandlers.UnixUnsignedToDateTime(mtime);
lastWriteTime = creationTime;
zStream = new ForcedSeekStream<GZipStream>(decompressedSize, dataStream, CompressionMode.Decompress);
opened = true;
@@ -161,7 +161,7 @@ namespace DiscImageChef.Filters
isize = BitConverter.ToUInt32(isize_b, 0);
decompressedSize = isize;
creationTime = DateHandlers.UNIXUnsignedToDateTime(mtime);
creationTime = DateHandlers.UnixUnsignedToDateTime(mtime);
lastWriteTime = creationTime;
zStream = new ForcedSeekStream<GZipStream>(decompressedSize, dataStream, CompressionMode.Decompress);
opened = true;
@@ -189,7 +189,7 @@ namespace DiscImageChef.Filters
decompressedSize = isize;
FileInfo fi = new FileInfo(path);
creationTime = fi.CreationTimeUtc;
lastWriteTime = DateHandlers.UNIXUnsignedToDateTime(mtime);
lastWriteTime = DateHandlers.UnixUnsignedToDateTime(mtime);
zStream = new ForcedSeekStream<GZipStream>(decompressedSize, dataStream, CompressionMode.Decompress);
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 MacEpoch = new DateTime(1904, 1, 1, 0, 0, 0);
static readonly DateTime UNIXEpoch = new DateTime(1970, 1, 1, 0, 0, 0);
// Day 0 of Julian Date system
static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0);
/// <summary>
/// Day 0 of Julian Date system
/// </summary>
static readonly DateTime JulianEpoch = new DateTime(1858, 11, 17, 0, 0, 0);
static readonly DateTime AmigaEpoch = new DateTime(1978, 1, 1, 0, 0, 0);
/// <summary>
/// Converts a Macintosh timestamp to a .NET DateTime
/// </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>
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>
/// Converts a Lisa timestamp to a .NET DateTime
/// </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>
public static DateTime LisaToDateTime(uint LisaTimeStamp)
public static DateTime LisaToDateTime(uint lisaTimeStamp)
{
return LisaEpoch.AddSeconds(LisaTimeStamp);
return LisaEpoch.AddSeconds(lisaTimeStamp);
}
/// <summary>
/// Converts a UNIX timestamp to a .NET DateTime
/// </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>
public static DateTime UNIXToDateTime(int UNIXTimeStamp)
public static DateTime UnixToDateTime(int unixTimeStamp)
{
return UNIXEpoch.AddSeconds(UNIXTimeStamp);
return UnixEpoch.AddSeconds(unixTimeStamp);
}
/// <summary>
/// Converts a UNIX timestamp to a .NET DateTime
/// </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>
public static DateTime UNIXToDateTime(long UNIXTimeStamp)
public static DateTime UnixToDateTime(long unixTimeStamp)
{
return UNIXEpoch.AddSeconds(UNIXTimeStamp);
return UnixEpoch.AddSeconds(unixTimeStamp);
}
/// <summary>
/// Converts a UNIX timestamp to a .NET DateTime
/// </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>
public static DateTime UNIXUnsignedToDateTime(uint UNIXTimeStamp)
public static DateTime UnixUnsignedToDateTime(uint unixTimeStamp)
{
return UNIXEpoch.AddSeconds(UNIXTimeStamp);
return UnixEpoch.AddSeconds(unixTimeStamp);
}
/// <summary>
@@ -101,103 +103,95 @@ namespace DiscImageChef
/// <param name="seconds">Seconds since 1st Jan. 1970)</param>
/// <param name="nanoseconds">Nanoseconds</param>
/// <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>
/// Converts a UNIX timestamp to a .NET DateTime
/// </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>
public static DateTime UNIXUnsignedToDateTime(ulong UNIXTimeStamp)
public static DateTime UnixUnsignedToDateTime(ulong unixTimeStamp)
{
return UNIXEpoch.AddSeconds(UNIXTimeStamp);
return UnixEpoch.AddSeconds(unixTimeStamp);
}
/// <summary>
/// Converts a High Sierra Format timestamp to a .NET DateTime
/// </summary>
/// <param name="VDDateTime">High Sierra Format timestamp</param>
/// <param name="vdDateTime">High Sierra Format timestamp</param>
/// <returns>.NET DateTime</returns>
public static DateTime HighSierraToDateTime(byte[] VDDateTime)
public static DateTime HighSierraToDateTime(byte[] vdDateTime)
{
byte[] isotime = new byte[17];
Array.Copy(VDDateTime, 0, isotime, 0, 16);
return ISO9660ToDateTime(isotime);
Array.Copy(vdDateTime, 0, isotime, 0, 16);
return Iso9660ToDateTime(isotime);
}
// TODO: Timezone
/// <summary>
/// Converts an ISO9660 timestamp to a .NET DateTime
/// </summary>
/// <param name="VDDateTime">ISO9660 timestamp</param>
/// <param name="vdDateTime">ISO9660 timestamp</param>
/// <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[] fourcharvalue = new byte[4];
fourcharvalue[0] = VDDateTime[0];
fourcharvalue[1] = VDDateTime[1];
fourcharvalue[2] = VDDateTime[2];
fourcharvalue[3] = VDDateTime[3];
fourcharvalue[0] = vdDateTime[0];
fourcharvalue[1] = vdDateTime[1];
fourcharvalue[2] = vdDateTime[2];
fourcharvalue[3] = vdDateTime[3];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "year = \"{0}\"",
StringHandlers.CToString(fourcharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(fourcharvalue, Encoding.ASCII), out year)) year = 0;
// year = Convert.ToInt32(StringHandlers.CToString(fourcharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(fourcharvalue, Encoding.ASCII), out int year)) year = 0;
twocharvalue[0] = VDDateTime[4];
twocharvalue[1] = VDDateTime[5];
twocharvalue[0] = vdDateTime[4];
twocharvalue[1] = vdDateTime[5];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "month = \"{0}\"",
StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out month)) month = 0;
// month = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out int month)) month = 0;
twocharvalue[0] = VDDateTime[6];
twocharvalue[1] = VDDateTime[7];
twocharvalue[0] = vdDateTime[6];
twocharvalue[1] = vdDateTime[7];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "day = \"{0}\"",
StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out day)) day = 0;
// day = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out int day)) day = 0;
twocharvalue[0] = VDDateTime[8];
twocharvalue[1] = VDDateTime[9];
twocharvalue[0] = vdDateTime[8];
twocharvalue[1] = vdDateTime[9];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hour = \"{0}\"",
StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out hour)) hour = 0;
// hour = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out int hour)) hour = 0;
twocharvalue[0] = VDDateTime[10];
twocharvalue[1] = VDDateTime[11];
twocharvalue[0] = vdDateTime[10];
twocharvalue[1] = vdDateTime[11];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "minute = \"{0}\"",
StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out minute)) minute = 0;
// minute = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out int minute)) minute = 0;
twocharvalue[0] = VDDateTime[12];
twocharvalue[1] = VDDateTime[13];
twocharvalue[0] = vdDateTime[12];
twocharvalue[1] = vdDateTime[13];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "second = \"{0}\"",
StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out second)) second = 0;
// second = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out int second)) second = 0;
twocharvalue[0] = VDDateTime[14];
twocharvalue[1] = VDDateTime[15];
twocharvalue[0] = vdDateTime[14];
twocharvalue[1] = vdDateTime[15];
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hundredths = \"{0}\"",
StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out hundredths)) hundredths = 0;
// hundredths = Convert.ToInt32(StringHandlers.CToString(twocharvalue, Encoding.ASCII));
if(!int.TryParse(StringHandlers.CToString(twocharvalue, Encoding.ASCII), out int hundredths)) hundredths = 0;
DicConsole.DebugWriteLine("ISO9600ToDateTime handler",
"decodedDT = new DateTime({0}, {1}, {2}, {3}, {4}, {5}, {6}, DateTimeKind.Unspecified);",
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);
return decodedDT;
return decodedDt;
}
/// <summary>
@@ -206,7 +200,7 @@ namespace DiscImageChef
/// <param name="vmsDate">VMS timestamp (tenths of microseconds since day 0 of the Julian Date)</param>
/// <returns>.NET DateTime</returns>
/// <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
return JulianEpoch.AddMilliseconds(delta);
@@ -231,7 +225,7 @@ namespace DiscImageChef
/// </summary>
/// <param name="dateRecord">UCSD Pascal timestamp</param>
/// <returns>.NET DateTime</returns>
public static DateTime UCSDPascalToDateTime(short dateRecord)
public static DateTime UcsdPascalToDateTime(short dateRecord)
{
int year = ((dateRecord & 0xFE00) >> 9) + 1900;
int day = (dateRecord & 0x01F0) >> 4;
@@ -249,7 +243,7 @@ namespace DiscImageChef
/// <param name="date">Date</param>
/// <param name="time">Time</param>
/// <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 month = (date & 0x1E0) >> 5;
@@ -276,7 +270,7 @@ namespace DiscImageChef
/// </summary>
/// <param name="timestamp">CP/M timestamp</param>
/// <returns>.NET DateTime</returns>
public static DateTime CPMToDateTime(byte[] timestamp)
public static DateTime CpmToDateTime(byte[] timestamp)
{
ushort days = BitConverter.ToUInt16(timestamp, 0);
int hours = timestamp[2];
@@ -303,7 +297,7 @@ namespace DiscImageChef
/// <param name="hundredsOfMicroseconds">Hundreds of microseconds</param>
/// <param name="microseconds">Microseconds</param>
/// <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 microseconds)
{
@@ -330,11 +324,11 @@ namespace DiscImageChef
/// <summary>
/// Convers a Solaris high resolution timestamp to .NET DateTime
/// </summary>
/// <param name="HRTimeStamp">Solaris high resolution timestamp</param>
/// <param name="hrTimeStamp">Solaris high resolution timestamp</param>
/// <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>
@@ -342,21 +336,21 @@ namespace DiscImageChef
/// </summary>
/// <param name="date">OS-9 timestamp</param>
/// <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;
DateTime os9date;
DateTime os9Date;
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], 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>

View File

@@ -246,7 +246,7 @@ namespace DiscImageChef.Partitions
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);
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);
@@ -275,7 +275,7 @@ namespace DiscImageChef.Partitions
};
if(dkl8.dkl_vtoc.v_timestamp[i] != 0)
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())
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,
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,
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);
@@ -344,7 +344,7 @@ namespace DiscImageChef.Partitions
};
if(dkl16.dkl_vtoc.v_timestamp[i] != 0)
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())
partitions.Add(part);
}

View File

@@ -272,7 +272,7 @@ namespace DiscImageChef.Partitions
DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.v_part[{0}].p_size = {1}", i,
vtocOld.v_part[i].p_size);
DicConsole.DebugWriteLine("VTOC plugin", "vtocOld.timestamp[{0}] = {1}", i,
DateHandlers.UNIXToDateTime(vtocOld.timestamp[i]));
DateHandlers.UnixToDateTime(vtocOld.timestamp[i]));
}
}
else
@@ -294,7 +294,7 @@ namespace DiscImageChef.Partitions
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.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_RONLY)) info += " (read-only)";
if(timestamps[i] != 0)
info += $" created on {DateHandlers.UNIXToDateTime(timestamps[i])}";
info += $" created on {DateHandlers.UnixToDateTime(timestamps[i])}";
part.Description = "UNIX slice" + info + ".";