REFACTOR: Use string interpolation expression.

This commit is contained in:
2017-12-21 17:58:51 +00:00
parent a895700757
commit 4e6e8f340a
182 changed files with 766 additions and 1256 deletions

View File

@@ -560,7 +560,7 @@ namespace DiscImageChef.Filesystems
.AppendLine();
if(oldMap1.discId > 0)
{
xmlFSType.VolumeSerial = string.Format("{0:X4}", oldMap1.discId);
xmlFSType.VolumeSerial = $"{oldMap1.discId:X4}";
sbInformation.AppendFormat("Volume ID: {0:X4}", oldMap1.discId).AppendLine();
}
if(!ArrayHelpers.ArrayIsNullOrEmpty(namebytes))
@@ -666,7 +666,7 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("Volume flags: 0x{0:X4}", drSb.flags).AppendLine();
if(drSb.disc_id > 0)
{
xmlFSType.VolumeSerial = string.Format("{0:X4}", drSb.disc_id);
xmlFSType.VolumeSerial = $"{drSb.disc_id:X4}";
sbInformation.AppendFormat("Volume ID: {0:X4}", drSb.disc_id).AppendLine();
}
if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.disc_name))

View File

@@ -482,7 +482,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.VolumeName = diskName;
xmlFSType.Bootable = bsum == bootBlk.checksum;
// Useful as a serial
xmlFSType.VolumeSerial = string.Format("{0:X8}", rootBlk.checksum);
xmlFSType.VolumeSerial = $"{rootBlk.checksum:X8}";
}
static RootBlock MarshalRootBlock(byte[] block)

View File

@@ -302,7 +302,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.Type = "HFS";
xmlFSType.VolumeName = StringHandlers.PascalToString(MDB.drVN, CurrentEncoding);
if(MDB.drFndrInfo6 != 0 && MDB.drFndrInfo7 != 0)
xmlFSType.VolumeSerial = string.Format("{0:X8}{1:X8}", MDB.drFndrInfo6, MDB.drFndrInfo7);
xmlFSType.VolumeSerial = $"{MDB.drFndrInfo6:X8}{MDB.drFndrInfo7:X8}";
}
static byte[] Read2048SectorAs512(ImagePlugin imagePlugin, ulong LBA)

View File

@@ -274,7 +274,7 @@ namespace DiscImageChef.Filesystems
if(HPVH.signature == 0x482B) xmlFSType.Type = "HFS+";
if(HPVH.signature == 0x4858) xmlFSType.Type = "HFSX";
if(HPVH.drFndrInfo6 != 0 && HPVH.drFndrInfo7 != 0)
xmlFSType.VolumeSerial = string.Format("{0:X8}{1:X8}", HPVH.drFndrInfo6, HPVH.drFndrInfo7);
xmlFSType.VolumeSerial = $"{HPVH.drFndrInfo6:X8}{HPVH.drFndrInfo7:X8}";
xmlFSType.SystemIdentifier = Encoding.ASCII.GetString(HPVH.lastMountedVersion);
}
else

View File

@@ -249,8 +249,8 @@ namespace DiscImageChef.Filesystems
xmlFSType.FreeClusters = xmlFSType.Clusters - (long)(btrfsSb.bytes_used / btrfsSb.sectorsize);
xmlFSType.FreeClustersSpecified = true;
xmlFSType.VolumeName = btrfsSb.label;
xmlFSType.VolumeSerial = string.Format("{0}", btrfsSb.uuid);
xmlFSType.VolumeSetIdentifier = string.Format("{0}", btrfsSb.dev_item.device_uuid);
xmlFSType.VolumeSerial = $"{btrfsSb.uuid}";
xmlFSType.VolumeSetIdentifier = $"{btrfsSb.dev_item.device_uuid}";
xmlFSType.Type = Name;
}

View File

@@ -259,7 +259,7 @@ namespace DiscImageChef.Filesystems
.AppendLine();
xmlFSType.VolumeName = StringHandlers.CToString(cbmHdr.name, CurrentEncoding);
xmlFSType.VolumeSerial = string.Format("{0}", cbmHdr.diskId);
xmlFSType.VolumeSerial = $"{cbmHdr.diskId}";
}
else
{
@@ -282,7 +282,7 @@ namespace DiscImageChef.Filesystems
.AppendLine();
xmlFSType.VolumeName = StringHandlers.CToString(cbmBam.name, CurrentEncoding);
xmlFSType.VolumeSerial = string.Format("{0}", cbmBam.diskId);
xmlFSType.VolumeSerial = $"{cbmBam.diskId}";
}
information = sbInformation.ToString();

View File

@@ -250,7 +250,7 @@ namespace DiscImageChef.Filesystems.CPM
string extension = Encoding.ASCII.GetString(entry.extension).Trim();
// If user is != 0, append user to name to have identical filenames
if(user > 0) filename = string.Format("{0:X1}:{1}", user, filename);
if(user > 0) filename = $"{user:X1}:{filename}";
if(!string.IsNullOrEmpty(extension)) filename = filename + "." + extension;
int entryNo = (32 * entry.extentCounter + entry.extentCounterHigh) / (dpb.exm + 1);
@@ -344,7 +344,7 @@ namespace DiscImageChef.Filesystems.CPM
string extension = Encoding.ASCII.GetString(entry.extension).Trim();
// If user is != 0, append user to name to have identical filenames
if(user > 0) filename = string.Format("{0:X1}:{1}", user, filename);
if(user > 0) filename = $"{user:X1}:{filename}";
if(!string.IsNullOrEmpty(extension)) filename = filename + "." + extension;
int entryNo = (32 * entry.extentCounterHigh + entry.extentCounter) / (dpb.exm + 1);
@@ -423,7 +423,7 @@ namespace DiscImageChef.Filesystems.CPM
string extension = Encoding.ASCII.GetString(entry.extension).Trim();
// If user is != 0, append user to name to have identical filenames
if(user > 0) filename = string.Format("{0:X1}:{1}", user, filename);
if(user > 0) filename = $"{user:X1}:{filename}";
if(!string.IsNullOrEmpty(extension)) filename = filename + "." + extension;
// Do not repeat passwords

View File

@@ -240,7 +240,7 @@ namespace DiscImageChef.Filesystems
FreeClustersSpecified = true,
Dirty = efsSb.sb_dirty > 0,
VolumeName = StringHandlers.CToString(efsSb.sb_fname, CurrentEncoding),
VolumeSerial = string.Format("{0:X8}", efsSb.sb_checksum),
VolumeSerial = $"{efsSb.sb_checksum:X8}",
CreationDate = DateHandlers.UNIXToDateTime(efsSb.sb_time),
CreationDateSpecified = true
};

View File

@@ -878,7 +878,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Sector of backup FAT32 parameter block: {0}", Fat32BPB.backup_sector).AppendLine();
sb.AppendFormat("Drive number: 0x{0:X2}", Fat32BPB.drive_no).AppendLine();
sb.AppendFormat("Volume Serial Number: 0x{0:X8}", Fat32BPB.serial_no).AppendLine();
xmlFSType.VolumeSerial = string.Format("{0:X8}", Fat32BPB.serial_no);
xmlFSType.VolumeSerial = $"{Fat32BPB.serial_no:X8}";
if((Fat32BPB.flags & 0xF8) == 0x00)
{
@@ -1183,8 +1183,8 @@ namespace DiscImageChef.Filesystems
if(atariBPB.serial_no[0] == 0x49 && atariBPB.serial_no[1] == 0x48 && atariBPB.serial_no[2] == 0x43)
sb.AppendLine("Volume has been modified by Windows 9x/Me Volume Tracker.");
else
xmlFSType.VolumeSerial = string.Format("{0:X2}{1:X2}{2:X2}", atariBPB.serial_no[0],
atariBPB.serial_no[1], atariBPB.serial_no[2]);
xmlFSType.VolumeSerial =
$"{atariBPB.serial_no[0]:X2}{atariBPB.serial_no[1]:X2}{atariBPB.serial_no[2]:X2}";
xmlFSType.SystemIdentifier = StringHandlers.CToString(atariBPB.oem_name);
if(string.IsNullOrEmpty(xmlFSType.SystemIdentifier)) xmlFSType.SystemIdentifier = null;
@@ -1217,7 +1217,7 @@ namespace DiscImageChef.Filesystems
}
if(fakeBPB.signature == 0x28 || fakeBPB.signature == 0x29)
xmlFSType.VolumeSerial = string.Format("{0:X8}", fakeBPB.serial_no);
xmlFSType.VolumeSerial = $"{fakeBPB.serial_no:X8}";
}
if(xmlFSType.SystemIdentifier != null)

View File

@@ -217,7 +217,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.ClusterSize = hpfs_bpb.bps;
xmlFSType.Type = "HPFS";
xmlFSType.VolumeName = StringHandlers.CToString(hpfs_bpb.volume_label, CurrentEncoding);
xmlFSType.VolumeSerial = string.Format("{0:X8}", hpfs_bpb.serial_no);
xmlFSType.VolumeSerial = $"{hpfs_bpb.serial_no:X8}";
xmlFSType.SystemIdentifier = StringHandlers.CToString(hpfs_bpb.oem_name);
information = sb.ToString();

View File

@@ -235,7 +235,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.Bootable = true;
if(jfsSb.s_version == 1) xmlFSType.VolumeName = CurrentEncoding.GetString(jfsSb.s_fpack);
else xmlFSType.VolumeName = CurrentEncoding.GetString(jfsSb.s_label);
xmlFSType.VolumeSerial = string.Format("{0}", jfsSb.s_uuid);
xmlFSType.VolumeSerial = $"{jfsSb.s_uuid}";
xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec);
xmlFSType.ModificationDateSpecified = true;
if(jfsSb.s_state != 0) xmlFSType.Dirty = true;

View File

@@ -370,7 +370,7 @@ namespace DiscImageChef.Filesystems.LisaFS
xmlFSType.FreeClustersSpecified = true;
xmlFSType.Type = "LisaFS";
xmlFSType.VolumeName = info_mddf.volname;
xmlFSType.VolumeSerial = string.Format("{0:X16}", info_mddf.volid);
xmlFSType.VolumeSerial = $"{info_mddf.volid:X16}";
return;
}

View File

@@ -310,7 +310,7 @@ namespace DiscImageChef.Filesystems.LisaFS
xmlFSType.FreeClustersSpecified = true;
xmlFSType.Type = "LisaFS";
xmlFSType.VolumeName = mddf.volname;
xmlFSType.VolumeSerial = string.Format("{0:X16}", mddf.volid);
xmlFSType.VolumeSerial = $"{mddf.volid:X16}";
return Errno.NoError;
}

View File

@@ -156,7 +156,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.ClusterSize = ntfs_bb.spc * ntfs_bb.bps;
xmlFSType.Clusters = ntfs_bb.sectors / ntfs_bb.spc;
xmlFSType.VolumeSerial = string.Format("{0:X16}", ntfs_bb.serial_no);
xmlFSType.VolumeSerial = $"{ntfs_bb.serial_no:X16}";
xmlFSType.Type = "NTFS";
information = sb.ToString();

View File

@@ -387,7 +387,7 @@ namespace DiscImageChef.Filesystems
case "_": return "WiiFit";
}
return string.Format("unknown type '{0}'", discType);
return $"unknown type '{discType}'";
}
string RegionCodeToString(string regionCode)
@@ -412,7 +412,7 @@ namespace DiscImageChef.Filesystems
case "U": return "Australia";
}
return string.Format("unknown code '{0}'", regionCode);
return $"unknown code '{regionCode}'";
}
string PublisherCodeToString(string publisherCode)
@@ -442,7 +442,7 @@ namespace DiscImageChef.Filesystems
case "7D": return "Sierra";
}
return string.Format("Unknown publisher '{0}'", publisherCode);
return $"Unknown publisher '{publisherCode}'";
}
string PartitionTypeToString(uint type)
@@ -454,7 +454,7 @@ namespace DiscImageChef.Filesystems
case 2: return "channel";
}
return string.Format("unknown type {0}", type);
return $"unknown type {type}";
}
public override Errno Mount()

View File

@@ -249,7 +249,7 @@ namespace DiscImageChef.Filesystems
ClusterSize = homeblock.cluster * 512,
Clusters = (long)partition.Size / (homeblock.cluster * 512),
VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, CurrentEncoding),
VolumeSerial = string.Format("{0:X8}", homeblock.serialnum)
VolumeSerial = $"{homeblock.serialnum:X8}"
};
if(homeblock.credate > 0)
{

View File

@@ -250,8 +250,8 @@ namespace DiscImageChef.Filesystems
DicConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_status = {0}", qnxSb.altBoot.di_status);
*/
information = string.Format("QNX4 filesystem\nCreated on {0}\n",
DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_ftime));
information =
$"QNX4 filesystem\nCreated on {DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_ftime)}\n";
xmlFSType = new FileSystemType
{

View File

@@ -196,7 +196,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.FreeClusters = audiSb.freeBlocks;
xmlFSType.FreeClustersSpecified = true;
//xmlFSType.VolumeName = CurrentEncoding.GetString(audiSb.id);
xmlFSType.VolumeSerial = string.Format("{0:X16}", audiSb.serial);
xmlFSType.VolumeSerial = $"{audiSb.serial:X16}";
information = sb.ToString();
return;
@@ -227,7 +227,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.FreeClusters = qnxSb.freeBlocks;
xmlFSType.FreeClustersSpecified = true;
//xmlFSType.VolumeName = CurrentEncoding.GetString(qnxSb.volumeid);
xmlFSType.VolumeSerial = string.Format("{0:X16}", qnxSb.serial);
xmlFSType.VolumeSerial = $"{qnxSb.serial:X16}";
xmlFSType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(qnxSb.ctime);
xmlFSType.CreationDateSpecified = true;
xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(qnxSb.atime);

View File

@@ -288,7 +288,7 @@ namespace DiscImageChef.Filesystems
ModificationDate = DateHandlers.UNIXToDateTime(RBF9000Sb.rid_mtime),
ModificationDateSpecified = true,
VolumeName = StringHandlers.CToString(RBF9000Sb.rid_name, CurrentEncoding),
VolumeSerial = string.Format("{0:X8}", RBF9000Sb.rid_diskid)
VolumeSerial = $"{RBF9000Sb.rid_diskid:X8}"
};
}
else
@@ -334,7 +334,7 @@ namespace DiscImageChef.Filesystems
CreationDate = DateHandlers.OS9ToDateTime(RBFSb.dd_dat),
CreationDateSpecified = true,
VolumeName = StringHandlers.CToString(RBFSb.dd_nam, CurrentEncoding),
VolumeSerial = string.Format("{0:X4}", RBFSb.dd_dsk)
VolumeSerial = $"{RBFSb.dd_dsk:X4}"
};
}

View File

@@ -431,25 +431,23 @@ namespace DiscImageChef.Filesystems
.GetString(pvd.implementationIdentifier.identifier)
.TrimEnd('\u0000')).AppendLine();
sbInformation.AppendFormat("Volume requires UDF version {0}.{1:X2} to be read",
Convert.ToInt32(string.Format("{0}", (lvidiu.minimumReadUDF & 0xFF00) >> 8), 10),
Convert.ToInt32(string.Format("{0}", lvidiu.minimumReadUDF & 0xFF), 10))
Convert.ToInt32($"{(lvidiu.minimumReadUDF & 0xFF00) >> 8}", 10),
Convert.ToInt32($"{lvidiu.minimumReadUDF & 0xFF}", 10))
.AppendLine();
sbInformation.AppendFormat("Volume requires UDF version {0}.{1:X2} to be written to",
Convert.ToInt32(string.Format("{0}", (lvidiu.minimumWriteUDF & 0xFF00) >> 8),
Convert.ToInt32($"{(lvidiu.minimumWriteUDF & 0xFF00) >> 8}",
10),
Convert.ToInt32(string.Format("{0}", lvidiu.minimumWriteUDF & 0xFF), 10))
Convert.ToInt32($"{lvidiu.minimumWriteUDF & 0xFF}", 10))
.AppendLine();
sbInformation.AppendFormat("Volume cannot be written by any UDF version higher than {0}.{1:X2}",
Convert.ToInt32(string.Format("{0}", (lvidiu.maximumWriteUDF & 0xFF00) >> 8),
Convert.ToInt32($"{(lvidiu.maximumWriteUDF & 0xFF00) >> 8}",
10),
Convert.ToInt32(string.Format("{0}", lvidiu.maximumWriteUDF & 0xFF), 10))
Convert.ToInt32($"{lvidiu.maximumWriteUDF & 0xFF}", 10))
.AppendLine();
xmlFSType = new FileSystemType();
xmlFSType.Type = string.Format("UDF v{0}.{1:X2}",
Convert.ToInt32(string.Format("{0}", (lvidiu.maximumWriteUDF & 0xFF00) >> 8),
10),
Convert.ToInt32(string.Format("{0}", lvidiu.maximumWriteUDF & 0xFF), 10));
xmlFSType.Type =
$"UDF v{Convert.ToInt32($"{(lvidiu.maximumWriteUDF & 0xFF00) >> 8}", 10)}.{Convert.ToInt32($"{lvidiu.maximumWriteUDF & 0xFF}", 10):X2}";
xmlFSType.ApplicationIdentifier = CurrentEncoding
.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000');
xmlFSType.ClusterSize = (int)lvd.logicalBlockSize;

View File

@@ -314,9 +314,9 @@ namespace DiscImageChef.Filesystems
xmlFSType.Type = "ZFS filesystem";
if(decodedNvList.TryGetValue("name", out tmpObj)) xmlFSType.VolumeName = (string)tmpObj.value;
if(decodedNvList.TryGetValue("guid", out tmpObj))
xmlFSType.VolumeSerial = string.Format("{0}", (ulong)tmpObj.value);
xmlFSType.VolumeSerial = $"{(ulong)tmpObj.value}";
if(decodedNvList.TryGetValue("pool_guid", out tmpObj))
xmlFSType.VolumeSetIdentifier = string.Format("{0}", (ulong)tmpObj.value);
xmlFSType.VolumeSetIdentifier = $"{(ulong)tmpObj.value}";
}
static bool DecodeNvList(byte[] nvlist, out Dictionary<string, NVS_Item> decodedNvList)

View File

@@ -156,7 +156,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.Clusters = vbr.clusterHeapLength;
xmlFSType.Dirty = vbr.flags.HasFlag(VolumeFlags.VolumeDirty);
xmlFSType.Type = "exFAT";
xmlFSType.VolumeSerial = string.Format("{0:X8}", vbr.volumeSerial);
xmlFSType.VolumeSerial = $"{vbr.volumeSerial:X8}";
information = sb.ToString();
}

View File

@@ -185,7 +185,7 @@ namespace DiscImageChef.Filesystems
ext_os = "MasIX";
break;
default:
ext_os = string.Format("Unknown OS ({0})", supblk.creator_os);
ext_os = $"Unknown OS ({supblk.creator_os})";
break;
}