diff --git a/DiscImageChef.Core/Devices/Dumping/ATA.cs b/DiscImageChef.Core/Devices/Dumping/ATA.cs index e92317cee..220f8b5fa 100644 --- a/DiscImageChef.Core/Devices/Dumping/ATA.cs +++ b/DiscImageChef.Core/Devices/Dumping/ATA.cs @@ -145,7 +145,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer; sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product; sidecar.BlockMedia[0].PCMCIA.Compliance = - string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion); + $"{vers.MajorVersion}.{vers.MinorVersion}"; sidecar.BlockMedia[0].PCMCIA.AdditionalInformation = vers.AdditionalInformation; } break; diff --git a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs b/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs index e6cc0e029..67305d216 100644 --- a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs +++ b/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs @@ -277,7 +277,7 @@ namespace DiscImageChef.Core.Devices.Dumping if(trk.PHOUR > 0) track.StartMSF = string.Format("{3:D2}:{0:D2}:{1:D2}:{2:D2}", trk.PMIN, trk.PSEC, trk.PFRAME, trk.PHOUR); - else track.StartMSF = string.Format("{0:D2}:{1:D2}:{2:D2}", trk.PMIN, trk.PSEC, trk.PFRAME); + else track.StartMSF = $"{trk.PMIN:D2}:{trk.PSEC:D2}:{trk.PFRAME:D2}"; track.StartSector = trk.PHOUR * 3600 * 75 + trk.PMIN * 60 * 75 + trk.PSEC * 75 + trk.PFRAME - 150; trackList.Add(track); @@ -320,7 +320,7 @@ namespace DiscImageChef.Core.Devices.Dumping } if(phour > 0) lastMsf = string.Format("{3:D2}:{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe, phour); - else lastMsf = string.Format("{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe); + else lastMsf = $"{pmin:D2}:{psec:D2}:{pframe:D2}"; lastSector = phour * 3600 * 75 + pmin * 60 * 75 + psec * 75 + pframe - 150; } @@ -349,7 +349,7 @@ namespace DiscImageChef.Core.Devices.Dumping if(phour > 0) tracks[t - 1].EndMSF = string.Format("{3:D2}:{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe, phour); - else tracks[t - 1].EndMSF = string.Format("{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe); + else tracks[t - 1].EndMSF = $"{pmin:D2}:{psec:D2}:{pframe:D2}"; } tracks[tracks.Length - 1].EndMSF = lastMsf; diff --git a/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs b/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs index 266e5a52c..62b904e44 100644 --- a/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs +++ b/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs @@ -51,31 +51,25 @@ namespace DiscImageChef.Core.Devices.Dumping if(resume.Removable != removable) throw new - Exception(string.Format("Resume file specifies a {0} device but you're requesting to dump a {1} device, not continuing...", - resume.Removable ? "removable" : "non removable", - removable ? "removable" : "non removable")); + Exception($"Resume file specifies a {(resume.Removable ? "removable" : "non removable")} device but you're requesting to dump a {(removable ? "removable" : "non removable")} device, not continuing..."); if(resume.LastBlock != blocks - 1) throw new - Exception(string.Format("Resume file specifies a device with {0} blocks but you're requesting to dump one with {1} blocks, not continuing...", - resume.LastBlock + 1, blocks)); + Exception($"Resume file specifies a device with {resume.LastBlock + 1} blocks but you're requesting to dump one with {blocks} blocks, not continuing..."); foreach(DumpHardwareType oldtry in resume.Tries) { if(oldtry.Manufacturer != manufacturer && !removable) throw new - Exception(string.Format("Resume file specifies a device manufactured by {0} but you're requesting to dump one by {1}, not continuing...", - oldtry.Manufacturer, manufacturer)); + Exception($"Resume file specifies a device manufactured by {oldtry.Manufacturer} but you're requesting to dump one by {manufacturer}, not continuing..."); if(oldtry.Model != model && !removable) throw new - Exception(string.Format("Resume file specifies a device model {0} but you're requesting to dump model {1}, not continuing...", - oldtry.Model, model)); + Exception($"Resume file specifies a device model {oldtry.Model} but you're requesting to dump model {model}, not continuing..."); if(oldtry.Serial != serial && !removable) throw new - Exception(string.Format("Resume file specifies a device with serial {0} but you're requesting to dump one with serial {1}, not continuing...", - oldtry.Serial, serial)); + Exception($"Resume file specifies a device with serial {oldtry.Serial} but you're requesting to dump one with serial {serial}, not continuing..."); if(oldtry.Software == null) throw new Exception("Found corrupt resume file, cannot continue..."); diff --git a/DiscImageChef.Core/Devices/Dumping/SBC.cs b/DiscImageChef.Core/Devices/Dumping/SBC.cs index a85c77c26..f571cceac 100644 --- a/DiscImageChef.Core/Devices/Dumping/SBC.cs +++ b/DiscImageChef.Core/Devices/Dumping/SBC.cs @@ -220,7 +220,7 @@ namespace DiscImageChef.Core.Devices.Dumping EVPDType evpd = new EVPDType { - Image = string.Format("{0}.evpd_{1:X2}h.bin", outputPrefix, page), + Image = $"{outputPrefix}.evpd_{page:X2}h.bin", Checksums = Checksum.GetChecksums(cmdBuf).ToArray(), Size = cmdBuf.Length }; diff --git a/DiscImageChef.Core/Devices/Reader.cs b/DiscImageChef.Core/Devices/Reader.cs index be1b2991d..21fc5232f 100644 --- a/DiscImageChef.Core/Devices/Reader.cs +++ b/DiscImageChef.Core/Devices/Reader.cs @@ -82,7 +82,7 @@ namespace DiscImageChef.Core.Devices case DeviceType.ATAPI: case DeviceType.SCSI: return ScsiGetBlocks(); default: - ErrorMessage = string.Format("Unknown device type {0}.", dev.Type); + ErrorMessage = $"Unknown device type {dev.Type}."; return 0; } } @@ -95,7 +95,7 @@ namespace DiscImageChef.Core.Devices case DeviceType.ATAPI: case DeviceType.SCSI: return ScsiFindReadCommand(); default: - ErrorMessage = string.Format("Unknown device type {0}.", dev.Type); + ErrorMessage = $"Unknown device type {dev.Type}."; return true; } } @@ -108,7 +108,7 @@ namespace DiscImageChef.Core.Devices case DeviceType.ATAPI: case DeviceType.SCSI: return ScsiGetBlockSize(); default: - ErrorMessage = string.Format("Unknown device type {0}.", dev.Type); + ErrorMessage = $"Unknown device type {dev.Type}."; return true; } } @@ -121,7 +121,7 @@ namespace DiscImageChef.Core.Devices case DeviceType.ATAPI: case DeviceType.SCSI: return ScsiGetBlocksToRead(startWithBlocks); default: - ErrorMessage = string.Format("Unknown device type {0}.", dev.Type); + ErrorMessage = $"Unknown device type {dev.Type}."; return true; } } diff --git a/DiscImageChef.Core/Devices/ReaderATA.cs b/DiscImageChef.Core/Devices/ReaderATA.cs index cafee9dd0..bc285e138 100644 --- a/DiscImageChef.Core/Devices/ReaderATA.cs +++ b/DiscImageChef.Core/Devices/ReaderATA.cs @@ -265,7 +265,7 @@ namespace DiscImageChef.Core.Devices if(!error || !IsLba) return false; BlocksToRead = 1; - ErrorMessage = string.Format("Device error {0} trying to guess ideal transfer length.", dev.LastError); + ErrorMessage = $"Device error {dev.LastError} trying to guess ideal transfer length."; return true; } diff --git a/DiscImageChef.Core/Devices/ReaderSCSI.cs b/DiscImageChef.Core/Devices/ReaderSCSI.cs index 78a11c86e..5dc5905e3 100644 --- a/DiscImageChef.Core/Devices/ReaderSCSI.cs +++ b/DiscImageChef.Core/Devices/ReaderSCSI.cs @@ -88,16 +88,14 @@ namespace DiscImageChef.Core.Devices if(read6 && !read10 && !read12 && !read16 && Blocks > 0x001FFFFF + 1) { ErrorMessage = - string.Format("Device only supports SCSI READ (6) but has more than {0} blocks ({1} blocks total)", - 0x001FFFFF + 1, Blocks); + $"Device only supports SCSI READ (6) but has more than {0x001FFFFF + 1} blocks ({Blocks} blocks total)"; return true; } if(!read16 && Blocks > 0xFFFFFFFF + (long)1) { ErrorMessage = - string.Format("Device only supports SCSI READ (10) but has more than {0} blocks ({1} blocks total)", - 0xFFFFFFFF + (long)1, Blocks); + $"Device only supports SCSI READ (10) but has more than {0xFFFFFFFF + (long)1} blocks ({Blocks} blocks total)"; return true; } @@ -403,8 +401,7 @@ namespace DiscImageChef.Core.Devices if(sense && Blocks == 0) if(dev.ScsiType != PeripheralDeviceTypes.MultiMediaDevice) { - ErrorMessage = string.Format("Unable to get media capacity\n" + "{0}", - Sense.PrettifySense(senseBuf)); + ErrorMessage = "Unable to get media capacity\n" + $"{Sense.PrettifySense(senseBuf)}"; return true; } @@ -465,7 +462,7 @@ namespace DiscImageChef.Core.Devices if(!dev.Error) return false; BlocksToRead = 1; - ErrorMessage = string.Format("Device error {0} trying to guess ideal transfer length.", dev.LastError); + ErrorMessage = $"Device error {dev.LastError} trying to guess ideal transfer length."; return true; } diff --git a/DiscImageChef.Core/Devices/Report/PCMCIA.cs b/DiscImageChef.Core/Devices/Report/PCMCIA.cs index cf1b7e0ed..8625d9063 100644 --- a/DiscImageChef.Core/Devices/Report/PCMCIA.cs +++ b/DiscImageChef.Core/Devices/Report/PCMCIA.cs @@ -65,7 +65,7 @@ namespace DiscImageChef.Core.Devices.Report { report.PCMCIA.Manufacturer = vers.Manufacturer; report.PCMCIA.ProductName = vers.Product; - report.PCMCIA.Compliance = string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion); + report.PCMCIA.Compliance = $"{vers.MajorVersion}.{vers.MinorVersion}"; report.PCMCIA.AdditionalInformation = vers.AdditionalInformation; } break; diff --git a/DiscImageChef.Core/Devices/Report/SCSI/General.cs b/DiscImageChef.Core/Devices/Report/SCSI/General.cs index adcf043ed..1549aa5d4 100644 --- a/DiscImageChef.Core/Devices/Report/SCSI/General.cs +++ b/DiscImageChef.Core/Devices/Report/SCSI/General.cs @@ -887,7 +887,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(debug) { FileStream bingo = - new FileStream(string.Format("{0}_readlong.bin", dev.Model), + new FileStream($"{dev.Model}_readlong.bin", FileMode.Create); bingo.Write(buffer, 0, buffer.Length); bingo.Close(); diff --git a/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs b/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs index d9d220316..a557f5f9e 100644 --- a/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs +++ b/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs @@ -1917,7 +1917,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI if(debug) { FileStream bingo = - new FileStream(string.Format("{0}_readlong.bin", mediaType), + new FileStream($"{mediaType}_readlong.bin", FileMode.Create); bingo.Write(buffer, 0, buffer.Length); bingo.Close(); diff --git a/DiscImageChef.Core/Logging/MHDDLog.cs b/DiscImageChef.Core/Logging/MHDDLog.cs index 5488a1a10..b0764538b 100644 --- a/DiscImageChef.Core/Logging/MHDDLog.cs +++ b/DiscImageChef.Core/Logging/MHDDLog.cs @@ -80,9 +80,9 @@ namespace DiscImageChef.Core.Logging break; } - device = string.Format("DEVICE: {0} {1}", dev.Manufacturer, dev.Model); - fw = string.Format("F/W: {0}", dev.Revision); - sn = string.Format("S/N: {0}", dev.Serial); + device = $"DEVICE: {dev.Manufacturer} {dev.Model}"; + fw = $"F/W: {dev.Revision}"; + sn = $"S/N: {dev.Serial}"; sectors = string.Format(new CultureInfo("en-US"), "SECTORS: {0:n0}", blocks); sectorsize = string.Format(new CultureInfo("en-US"), "SECTOR SIZE: {0:n0} bytes", blockSize); diff --git a/DiscImageChef.Core/Remote.cs b/DiscImageChef.Core/Remote.cs index 50767d374..63fd76d63 100644 --- a/DiscImageChef.Core/Remote.cs +++ b/DiscImageChef.Core/Remote.cs @@ -59,8 +59,7 @@ namespace DiscImageChef.Core xmlSer.Serialize(xmlStream, report); xmlStream.Seek(0, SeekOrigin.Begin); WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadreport"); - ((HttpWebRequest)request).UserAgent = - string.Format("DiscImageChef {0}", typeof(Version).Assembly.GetName().Version); + ((HttpWebRequest)request).UserAgent = $"DiscImageChef {typeof(Version).Assembly.GetName().Version}"; request.Method = "POST"; request.ContentLength = xmlStream.Length; request.ContentType = "application/xml"; diff --git a/DiscImageChef.Core/Sidecar/BlockMedia.cs b/DiscImageChef.Core/Sidecar/BlockMedia.cs index cace4166b..abb1d0dd7 100644 --- a/DiscImageChef.Core/Sidecar/BlockMedia.cs +++ b/DiscImageChef.Core/Sidecar/BlockMedia.cs @@ -136,7 +136,7 @@ namespace DiscImageChef.Core sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer; sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product; sidecar.BlockMedia[0].PCMCIA.Compliance = - string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion); + $"{vers.MajorVersion}.{vers.MinorVersion}"; sidecar.BlockMedia[0].PCMCIA.AdditionalInformation = vers.AdditionalInformation; } break; diff --git a/DiscImageChef.Core/Sidecar/BlockTape.cs b/DiscImageChef.Core/Sidecar/BlockTape.cs index dee51291d..acfdaf6b9 100644 --- a/DiscImageChef.Core/Sidecar/BlockTape.cs +++ b/DiscImageChef.Core/Sidecar/BlockTape.cs @@ -102,7 +102,7 @@ namespace DiscImageChef.Core { sector = new byte[sectorsToRead * blockSize]; fs.Read(sector, 0, sector.Length); - UpdateProgress2(string.Format("Hashing block {0} of {1} on file {2} of {3}", doneSectors, sectors, i + 1, files.Count), + UpdateProgress2($"Hashing block {doneSectors} of {sectors} on file {i + 1} of {files.Count}", doneSectors, sectors); doneSectors += sectorsToRead; } @@ -110,7 +110,7 @@ namespace DiscImageChef.Core { sector = new byte[(uint)(sectors - doneSectors) * blockSize]; fs.Read(sector, 0, sector.Length); - UpdateProgress2(string.Format("Hashing block {0} of {1} on file {2} of {3}", doneSectors, sectors, i + 1, files.Count), + UpdateProgress2($"Hashing block {doneSectors} of {sectors} on file {i + 1} of {files.Count}", doneSectors, sectors); doneSectors += sectors - doneSectors; } diff --git a/DiscImageChef.Core/Sidecar/Helpers.cs b/DiscImageChef.Core/Sidecar/Helpers.cs index 019ad054e..bf221117d 100644 --- a/DiscImageChef.Core/Sidecar/Helpers.cs +++ b/DiscImageChef.Core/Sidecar/Helpers.cs @@ -54,7 +54,7 @@ namespace DiscImageChef.Core f = lba + 450150; } - return string.Format("{0}:{1:D2}:{2:D2}", m, s, f); + return $"{m}:{s:D2}:{f:D2}"; } static string DdcdLbaToMsf(long lba) diff --git a/DiscImageChef.Core/Statistics.cs b/DiscImageChef.Core/Statistics.cs index 6a2eb8f97..3c499aabc 100644 --- a/DiscImageChef.Core/Statistics.cs +++ b/DiscImageChef.Core/Statistics.cs @@ -154,7 +154,7 @@ namespace DiscImageChef.Core if(CurrentStats != null) { - string partial = string.Format("PartialStats_{0:yyyyMMddHHmmssfff}.xml", DateTime.UtcNow); + string partial = $"PartialStats_{DateTime.UtcNow:yyyyMMddHHmmssfff}.xml"; fs = new FileStream(Path.Combine(Settings.Settings.StatsPath, partial), FileMode.Create); xs = new XmlSerializer(CurrentStats.GetType()); @@ -197,7 +197,7 @@ namespace DiscImageChef.Core WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadstats"); ((HttpWebRequest)request).UserAgent = - string.Format("DiscImageChef {0}", typeof(Version).Assembly.GetName().Version); + $"DiscImageChef {typeof(Version).Assembly.GetName().Version}"; request.Method = "POST"; request.ContentLength = fs.Length; request.ContentType = "application/xml"; diff --git a/DiscImageChef.Decoders/DVD/PFI.cs b/DiscImageChef.Decoders/DVD/PFI.cs index 9db739efa..00542f95a 100644 --- a/DiscImageChef.Decoders/DVD/PFI.cs +++ b/DiscImageChef.Decoders/DVD/PFI.cs @@ -1337,7 +1337,7 @@ namespace DiscImageChef.Decoders.DVD sizeString = "120mm"; break; default: - sizeString = string.Format("unknown size identifier {0}", decoded.DiscSize); + sizeString = $"unknown size identifier {decoded.DiscSize}"; break; } diff --git a/DiscImageChef.Decoders/MMC/CSD.cs b/DiscImageChef.Decoders/MMC/CSD.cs index 74cf3a844..7cc70bd70 100644 --- a/DiscImageChef.Decoders/MMC/CSD.cs +++ b/DiscImageChef.Decoders/MMC/CSD.cs @@ -337,7 +337,7 @@ namespace DiscImageChef.Decoders.MMC sb.AppendFormat("\tDevice's clock frequency: {0}{1}", result, unit).AppendLine(); unit = ""; - for(int cl = 0, mask = 1; cl <= 11; cl++, mask <<= 1) if((csd.Classes & mask) == mask) unit += string.Format(" {0}", cl); + for(int cl = 0, mask = 1; cl <= 11; cl++, mask <<= 1) if((csd.Classes & mask) == mask) unit += $" {cl}"; sb.AppendFormat("\tDevice support command classes {0}", unit).AppendLine(); if(csd.ReadBlockLength == 15) sb.AppendLine("\tRead block length size is defined in extended CSD"); diff --git a/DiscImageChef.Decoders/MMC/VendorString.cs b/DiscImageChef.Decoders/MMC/VendorString.cs index feaa4160c..4bf5e2371 100644 --- a/DiscImageChef.Decoders/MMC/VendorString.cs +++ b/DiscImageChef.Decoders/MMC/VendorString.cs @@ -39,7 +39,7 @@ namespace DiscImageChef.Decoders.MMC switch(MMCVendorID) { case 0x15: return "Samsung"; - default: return string.Format("Unknown manufacturer ID 0x{0:X2}", MMCVendorID); + default: return $"Unknown manufacturer ID 0x{MMCVendorID:X2}"; } } } diff --git a/DiscImageChef.Decoders/PCMCIA/VendorCode.cs b/DiscImageChef.Decoders/PCMCIA/VendorCode.cs index c5a89a7cb..9a4fd69e9 100644 --- a/DiscImageChef.Decoders/PCMCIA/VendorCode.cs +++ b/DiscImageChef.Decoders/PCMCIA/VendorCode.cs @@ -353,7 +353,7 @@ namespace DiscImageChef.Decoders.PCMCIA case 0xC020: return "NextCom K.K."; case 0xC250: return "EMTAC Technology Corporation"; case 0xD601: return "Elsa"; - default: return string.Format("Unknown vendor id 0x{0:X4}", id); + default: return $"Unknown vendor id 0x{id:X4}"; } } } diff --git a/DiscImageChef.Decoders/SCSI/EVPD.cs b/DiscImageChef.Decoders/SCSI/EVPD.cs index 7035f8ede..d14ac39aa 100644 --- a/DiscImageChef.Decoders/SCSI/EVPD.cs +++ b/DiscImageChef.Decoders/SCSI/EVPD.cs @@ -185,7 +185,7 @@ namespace DiscImageChef.Decoders.SCSI case ScsiDefinitions.SCSI1: return "SCSI-1"; case ScsiDefinitions.SCSI2: return "SCSI-2"; case ScsiDefinitions.SCSI3: return "SCSI-3"; - default: return string.Format("Unknown definition code {0}", (byte)definition); + default: return $"Unknown definition code {(byte)definition}"; } } @@ -510,7 +510,7 @@ namespace DiscImageChef.Decoders.SCSI protocol = "USB Attached SCSI"; break; default: - protocol = string.Format("unknown code {0}", (byte)descriptor.ProtocolIdentifier); + protocol = $"unknown code {(byte)descriptor.ProtocolIdentifier}"; break; } diff --git a/DiscImageChef.Decoders/SCSI/Modes/11.cs b/DiscImageChef.Decoders/SCSI/Modes/11.cs index 089c0cb75..42638bccc 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/11.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/11.cs @@ -214,7 +214,7 @@ namespace DiscImageChef.Decoders.SCSI case PartitionSizeUnitOfMeasures.Exponential: sb.AppendFormat("\tPartitions are defined in units of {0} bytes", Math.Pow(10, page.PartitionUnits)) .AppendLine(); - measure = string.Format("units of {0} bytes", Math.Pow(10, page.PartitionUnits)); + measure = $"units of {Math.Pow(10, page.PartitionUnits)} bytes"; break; default: sb.AppendFormat("\tUnknown partition size unit code {0}", (byte)page.PSUM).AppendLine(); diff --git a/DiscImageChef.Decoders/SCSI/Modes/Headers.cs b/DiscImageChef.Decoders/SCSI/Modes/Headers.cs index f81bc4861..5f66c9fc8 100644 --- a/DiscImageChef.Decoders/SCSI/Modes/Headers.cs +++ b/DiscImageChef.Decoders/SCSI/Modes/Headers.cs @@ -89,7 +89,7 @@ namespace DiscImageChef.Decoders.SCSI return "a combination of write-once and erasable optical"; */ case MediumTypes.DOW: return "a direct-overwrite optical"; - default: return string.Format("Unknown medium type 0x{0:X2}", (byte)type); + default: return $"Unknown medium type 0x{(byte)type:X2}"; } } @@ -131,8 +131,7 @@ namespace DiscImageChef.Decoders.SCSI density = "15916 flux transitions per radian"; break; default: - density = string.Format("with unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"with unknown density code 0x{(byte)descriptor.Density:X2}"; break; } @@ -360,7 +359,7 @@ namespace DiscImageChef.Decoders.SCSI medium = "Exatape 75m"; break; default: - medium = string.Format("unknown medium type 0x{0:X2}", (byte)header.Value.MediumType); + medium = $"unknown medium type 0x{(byte)header.Value.MediumType:X2}"; break; } @@ -519,8 +518,7 @@ namespace DiscImageChef.Decoders.SCSI density = "DDS-4"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -543,8 +541,7 @@ namespace DiscImageChef.Decoders.SCSI density = "LTO Ultrium-5 WORM"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -558,8 +555,7 @@ namespace DiscImageChef.Decoders.SCSI density = "LTO Ultrium"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -573,8 +569,7 @@ namespace DiscImageChef.Decoders.SCSI density = "LTO Ultrium-2"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -591,8 +586,7 @@ namespace DiscImageChef.Decoders.SCSI density = "DDS-3"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -609,8 +603,7 @@ namespace DiscImageChef.Decoders.SCSI density = "DDS-4"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -624,8 +617,7 @@ namespace DiscImageChef.Decoders.SCSI density = "DAT-72"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -640,8 +632,7 @@ namespace DiscImageChef.Decoders.SCSI density = "LTO Ultrium-3"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -655,8 +646,7 @@ namespace DiscImageChef.Decoders.SCSI density = "DDS cleaning cartridge"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -671,8 +661,7 @@ namespace DiscImageChef.Decoders.SCSI density = "LTO Ultrium-4"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -687,8 +676,7 @@ namespace DiscImageChef.Decoders.SCSI density = "LTO Ultrium-5"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -703,8 +691,7 @@ namespace DiscImageChef.Decoders.SCSI density = "LTO Ultrium-6"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -719,8 +706,7 @@ namespace DiscImageChef.Decoders.SCSI density = "LTO Ultrium-7"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -743,8 +729,7 @@ namespace DiscImageChef.Decoders.SCSI density = "LTO Ultrium-5 in CD emulation mode"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -779,8 +764,7 @@ namespace DiscImageChef.Decoders.SCSI density = "VXA-1"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -824,8 +808,7 @@ namespace DiscImageChef.Decoders.SCSI density = "VXA-3"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -864,8 +847,7 @@ namespace DiscImageChef.Decoders.SCSI density = "DLTtape III compressed"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -898,8 +880,7 @@ namespace DiscImageChef.Decoders.SCSI density = "DLTtape IIIxt compressed"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -954,8 +935,7 @@ namespace DiscImageChef.Decoders.SCSI density = "DLTtape IV at 98250 bpi compressed"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -995,8 +975,7 @@ namespace DiscImageChef.Decoders.SCSI density = "Super DLTtape I at 133000 bpi compressed"; break;*/ default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1010,8 +989,7 @@ namespace DiscImageChef.Decoders.SCSI density = "Super DLTtape II"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1029,8 +1007,7 @@ namespace DiscImageChef.Decoders.SCSI density = "VStape I compressed"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1044,8 +1021,7 @@ namespace DiscImageChef.Decoders.SCSI density = "DLTtape S4"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1068,8 +1044,7 @@ namespace DiscImageChef.Decoders.SCSI density = "EXB-8500 compressed"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1095,8 +1070,7 @@ namespace DiscImageChef.Decoders.SCSI density = "Mammoth"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1122,8 +1096,7 @@ namespace DiscImageChef.Decoders.SCSI density = "Mammoth"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1149,8 +1122,7 @@ namespace DiscImageChef.Decoders.SCSI density = "Mammoth"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1173,8 +1145,7 @@ namespace DiscImageChef.Decoders.SCSI density = "Mammoth-2"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1188,8 +1159,7 @@ namespace DiscImageChef.Decoders.SCSI density = "DC-2900SL"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1203,8 +1173,7 @@ namespace DiscImageChef.Decoders.SCSI density = "DC-9250"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1218,8 +1187,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLR-32"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1233,8 +1201,7 @@ namespace DiscImageChef.Decoders.SCSI density = "MRL1-26GBSL"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1248,8 +1215,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLRtape-50"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1263,8 +1229,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLRtape-50 SL"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1278,8 +1243,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLR-32 SL"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1293,8 +1257,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLR-5"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1308,8 +1271,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLR-5 SL"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1323,8 +1285,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLRtape-7"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1338,8 +1299,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLRtape-7 SL"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1353,8 +1313,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLRtape-24"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1368,8 +1327,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLRtape-24 SL"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1383,8 +1341,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLRtape-140"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1398,8 +1355,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLRtape-40"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1413,8 +1369,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLRtape-60 or SLRtape-75"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1428,8 +1383,7 @@ namespace DiscImageChef.Decoders.SCSI density = "SLRtape-100"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } @@ -1443,15 +1397,14 @@ namespace DiscImageChef.Decoders.SCSI density = "SLR40, SLR60 or SLR100"; break; default: - density = string.Format("unknown density code 0x{0:X2}", - (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } } break; default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } @@ -1594,7 +1547,7 @@ namespace DiscImageChef.Decoders.SCSI density = "ANSI X3.200: 356 mm double-sided optical disc with 56350 tracks"; break; default: - density = string.Format("unknown density code 0x{0:X2}", (byte)descriptor.Density); + density = $"unknown density code 0x{(byte)descriptor.Density:X2}"; break; } @@ -1790,7 +1743,7 @@ namespace DiscImageChef.Decoders.SCSI density = "LTO Ultrium-5"; break; default: - density = string.Format("with unknown density code 0x{0:X2}", descriptor.Density); + density = $"with unknown density code 0x{descriptor.Density:X2}"; break; } diff --git a/DiscImageChef.Decoders/SCSI/Sense.cs b/DiscImageChef.Decoders/SCSI/Sense.cs index fbe505322..ac0c90bc3 100644 --- a/DiscImageChef.Decoders/SCSI/Sense.cs +++ b/DiscImageChef.Decoders/SCSI/Sense.cs @@ -371,9 +371,8 @@ namespace DiscImageChef.Decoders.SCSI if(!sense.HasValue) return null; return sense.Value.AddressValid - ? string.Format("Error class {0} type {1} happened on block {2}\n", sense.Value.ErrorClass, - sense.Value.ErrorType, sense.Value.LBA) - : string.Format("Error class {0} type {1}\n", sense.Value.ErrorClass, sense.Value.ErrorType); + ? $"Error class {sense.Value.ErrorClass} type {sense.Value.ErrorType} happened on block {sense.Value.LBA}\n" + : $"Error class {sense.Value.ErrorClass} type {sense.Value.ErrorType}\n"; } public static string PrettifySense(FixedSense? sense) @@ -596,7 +595,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyDescriptor00(ulong information) { - return string.Format("On logical block {0}\n", information); + return $"On logical block {information}\n"; } public static string PrettifyDescriptor00(byte[] descriptor) @@ -1444,7 +1443,7 @@ namespace DiscImageChef.Decoders.SCSI switch(ASCQ) { case 0x00: return "RAM FAILURE"; - default: return string.Format("DIAGNOSTIC FAILURE ON COMPONENT {0:X2}h", ASCQ); + default: return $"DIAGNOSTIC FAILURE ON COMPONENT {ASCQ:X2}h"; } case 0x41: switch(ASCQ) @@ -1560,7 +1559,7 @@ namespace DiscImageChef.Decoders.SCSI } break; - case 0x4E: return string.Format("OVERLAPPED COMMANDS ATTEMPTED FOR TASK TAG {0:X2}h", ASCQ); + case 0x4E: return $"OVERLAPPED COMMANDS ATTEMPTED FOR TASK TAG {ASCQ:X2}h"; case 0x50: switch(ASCQ) { @@ -1929,7 +1928,7 @@ namespace DiscImageChef.Decoders.SCSI } break; - case 0x70: return string.Format("DECOMPRESSION EXCEPTION SHORT ALGORITHM ID OF {0:X2}h", ASCQ); + case 0x70: return $"DECOMPRESSION EXCEPTION SHORT ALGORITHM ID OF {ASCQ:X2}h"; case 0x71: switch(ASCQ) { @@ -2005,11 +2004,11 @@ namespace DiscImageChef.Decoders.SCSI return ASC >= 0x80 ? ASCQ >= 0x80 - ? string.Format("VENDOR-SPECIFIC ASC {0:X2}h WITH VENDOR-SPECIFIC ASCQ {1:X2}h", ASC, ASCQ) - : string.Format("VENDOR-SPECIFIC ASC {0:X2}h WITH ASCQ {1:X2}h", ASC, ASCQ) + ? $"VENDOR-SPECIFIC ASC {ASC:X2}h WITH VENDOR-SPECIFIC ASCQ {ASCQ:X2}h" + : $"VENDOR-SPECIFIC ASC {ASC:X2}h WITH ASCQ {ASCQ:X2}h" : ASCQ >= 0x80 - ? string.Format("ASC {0:X2}h WITH VENDOR-SPECIFIC ASCQ {1:X2}h", ASC, ASCQ) - : string.Format("ASC {0:X2}h WITH ASCQ {1:X2}h", ASC, ASCQ); + ? $"ASC {ASC:X2}h WITH VENDOR-SPECIFIC ASCQ {ASCQ:X2}h" + : $"ASC {ASC:X2}h WITH ASCQ {ASCQ:X2}h"; } } } \ No newline at end of file diff --git a/DiscImageChef.Decoders/SecureDigital/CSD.cs b/DiscImageChef.Decoders/SecureDigital/CSD.cs index ba404a54f..076643bf9 100644 --- a/DiscImageChef.Decoders/SecureDigital/CSD.cs +++ b/DiscImageChef.Decoders/SecureDigital/CSD.cs @@ -327,7 +327,7 @@ namespace DiscImageChef.Decoders.SecureDigital sb.AppendFormat("\tDevice's transfer speed: {0}{1}", result, unit).AppendLine(); unit = ""; - for(int cl = 0, mask = 1; cl <= 11; cl++, mask <<= 1) if((csd.Classes & mask) == mask) unit += string.Format(" {0}", cl); + for(int cl = 0, mask = 1; cl <= 11; cl++, mask <<= 1) if((csd.Classes & mask) == mask) unit += $" {cl}"; sb.AppendFormat("\tDevice support command classes {0}", unit).AppendLine(); sb.AppendFormat("\tRead block length is {0} bytes", Math.Pow(2, csd.ReadBlockLength)).AppendLine(); diff --git a/DiscImageChef.Decoders/SecureDigital/VendorString.cs b/DiscImageChef.Decoders/SecureDigital/VendorString.cs index d1c527f99..3938a5eb3 100644 --- a/DiscImageChef.Decoders/SecureDigital/VendorString.cs +++ b/DiscImageChef.Decoders/SecureDigital/VendorString.cs @@ -39,7 +39,7 @@ namespace DiscImageChef.Decoders.SecureDigital switch(SDVendorID) { case 0xAA: return "QEMU"; - default: return string.Format("Unknown manufacturer ID 0x{0:X2}", SDVendorID); + default: return $"Unknown manufacturer ID 0x{SDVendorID:X2}"; } } } diff --git a/DiscImageChef.Decoders/Xbox/SS.cs b/DiscImageChef.Decoders/Xbox/SS.cs index b05dcaf79..62393399d 100644 --- a/DiscImageChef.Decoders/Xbox/SS.cs +++ b/DiscImageChef.Decoders/Xbox/SS.cs @@ -319,7 +319,7 @@ namespace DiscImageChef.Decoders.Xbox sizeString = "120mm"; break; default: - sizeString = string.Format("unknown size identifier {0}", decoded.DiscSize); + sizeString = $"unknown size identifier {decoded.DiscSize}"; break; } diff --git a/DiscImageChef.Devices/Command.cs b/DiscImageChef.Devices/Command.cs index 204a9e28d..3ab18d7ac 100644 --- a/DiscImageChef.Devices/Command.cs +++ b/DiscImageChef.Devices/Command.cs @@ -154,7 +154,7 @@ namespace DiscImageChef.Devices : FreeBSD.Command.SendScsiCommand((IntPtr)fd, cdb, ref buffer, out senseBuffer, timeout, flags, out duration, out sense); } - default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptId)); + default: throw new InvalidOperationException($"Platform {ptId} not yet supported."); } } @@ -201,7 +201,7 @@ namespace DiscImageChef.Devices return FreeBSD.Command.SendAtaCommand((IntPtr)fd, registers, out errorRegisters, protocol, ref buffer, timeout, out duration, out sense); } - default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptId)); + default: throw new InvalidOperationException($"Platform {ptId} not yet supported."); } } @@ -249,7 +249,7 @@ namespace DiscImageChef.Devices return FreeBSD.Command.SendAtaCommand((IntPtr)fd, registers, out errorRegisters, protocol, ref buffer, timeout, out duration, out sense); } - default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptId)); + default: throw new InvalidOperationException($"Platform {ptId} not yet supported."); } } @@ -288,7 +288,7 @@ namespace DiscImageChef.Devices return FreeBSD.Command.SendAtaCommand((IntPtr)fd, registers, out errorRegisters, protocol, ref buffer, timeout, out duration, out sense); } - default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptId)); + default: throw new InvalidOperationException($"Platform {ptId} not yet supported."); } } @@ -321,7 +321,7 @@ namespace DiscImageChef.Devices blockSize, blocks, ref buffer, out response, out duration, out sense, timeout); } - default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptId)); + default: throw new InvalidOperationException($"Platform {ptId} not yet supported."); } } } diff --git a/DiscImageChef.Devices/Device/Constructor.cs b/DiscImageChef.Devices/Device/Constructor.cs index 3cc2b7e30..c5ec5ccbd 100644 --- a/DiscImageChef.Devices/Device/Constructor.cs +++ b/DiscImageChef.Devices/Device/Constructor.cs @@ -117,10 +117,10 @@ namespace DiscImageChef.Devices break; } default: - throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", PlatformId)); + throw new InvalidOperationException($"Platform {PlatformId} not yet supported."); } - if(Error) throw new SystemException(string.Format("Error {0} opening device.", LastError)); + if(Error) throw new SystemException($"Error {LastError} opening device."); Type = DeviceType.Unknown; ScsiType = PeripheralDeviceTypes.UnknownDevice; @@ -131,7 +131,7 @@ namespace DiscImageChef.Devices byte[] senseBuf; byte[] inqBuf = null; - if(Error) throw new SystemException(string.Format("Error {0} trying device.", LastError)); + if(Error) throw new SystemException($"Error {LastError} trying device."); bool scsiSense = true; string ntDevicePath; @@ -362,9 +362,8 @@ namespace DiscImageChef.Devices CID decoded = Decoders.SecureDigital.Decoders.DecodeCID(cachedCid); Manufacturer = VendorString.Prettify(decoded.Manufacturer); Model = decoded.ProductName; - Revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4, - decoded.ProductRevision & 0x0F); - Serial = string.Format("{0}", decoded.ProductSerialNumber); + Revision = $"{(decoded.ProductRevision & 0xF0) >> 4:X2}.{decoded.ProductRevision & 0x0F:X2}"; + Serial = $"{decoded.ProductSerialNumber}"; } else { @@ -372,9 +371,8 @@ namespace DiscImageChef.Devices Decoders.MMC.CID decoded = Decoders.MMC.Decoders.DecodeCID(cachedCid); Manufacturer = Decoders.MMC.VendorString.Prettify(decoded.Manufacturer); Model = decoded.ProductName; - Revision = string.Format("{0:X2}.{1:X2}", (decoded.ProductRevision & 0xF0) >> 4, - decoded.ProductRevision & 0x0F); - Serial = string.Format("{0}", decoded.ProductSerialNumber); + Revision = $"{(decoded.ProductRevision & 0xF0) >> 4:X2}.{decoded.ProductRevision & 0x0F:X2}"; + Serial = $"{decoded.ProductSerialNumber}"; } } #endregion SecureDigital / MultiMediaCard @@ -689,8 +687,8 @@ namespace DiscImageChef.Devices if(string.IsNullOrEmpty(Manufacturer)) Manufacturer = FireWireVendorName; if(string.IsNullOrEmpty(Model)) Model = FireWireModelName; - if(string.IsNullOrEmpty(Serial)) Serial = string.Format("{0:X16}", firewireGuid); - else foreach(char c in Serial.Where(c => char.IsControl(c))) Serial = string.Format("{0:X16}", firewireGuid); + if(string.IsNullOrEmpty(Serial)) Serial = $"{firewireGuid:X16}"; + else foreach(char c in Serial.Where(c => char.IsControl(c))) Serial = $"{firewireGuid:X16}"; } static int ConvertFromHexAscii(string file, out byte[] outBuf) diff --git a/DiscImageChef.Devices/Device/List.cs b/DiscImageChef.Devices/Device/List.cs index 8c0c7b992..a26ac834c 100644 --- a/DiscImageChef.Devices/Device/List.cs +++ b/DiscImageChef.Devices/Device/List.cs @@ -56,8 +56,7 @@ namespace DiscImageChef.Devices case PlatformID.Linux: return Linux.ListDevices.GetList(); case PlatformID.FreeBSD: return FreeBSD.ListDevices.GetList(); default: - throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", - DetectOS.GetRealPlatformID())); + throw new InvalidOperationException($"Platform {DetectOS.GetRealPlatformID()} not yet supported."); } } } diff --git a/DiscImageChef.DiscImages/Alcohol120.cs b/DiscImageChef.DiscImages/Alcohol120.cs index 24ab3b4af..2482f5c01 100644 --- a/DiscImageChef.DiscImages/Alcohol120.cs +++ b/DiscImageChef.DiscImages/Alcohol120.cs @@ -601,7 +601,7 @@ namespace DiscImageChef.DiscImages { Partition partition = new Partition(); - partition.Description = string.Format("Track {0}.", trk.point); + partition.Description = $"Track {trk.point}."; partition.Start = trk.startLba; partition.Size = extra.sectors * trk.sectorSize; partition.Length = extra.sectors; @@ -690,7 +690,7 @@ namespace DiscImageChef.DiscImages ImageInfo.ImageCreationTime = alcImage.GetCreationTime(); ImageInfo.ImageLastModificationTime = alcImage.GetLastWriteTime(); ImageInfo.XmlMediaType = XmlMediaType.OpticalDisc; - ImageInfo.ImageVersion = string.Format("{0}.{1}", header.version[0], header.version[1]); + ImageInfo.ImageVersion = $"{header.version[0]}.{header.version[1]}"; if(!isDvd) { @@ -868,9 +868,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress > _extra.sectors) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length + sectorAddress, _extra.sectors)); + $"Requested more sectors ({length + sectorAddress}) than present in track ({_extra.sectors}), won't cross tracks"); uint sector_offset; uint sector_size; @@ -966,9 +964,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress > _extra.sectors) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length, _extra.sectors)); + $"Requested more sectors ({length}) than present in track ({_extra.sectors}), won't cross tracks"); uint sector_offset; uint sector_size; @@ -1321,9 +1317,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress > _extra.sectors) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length, _extra.sectors)); + $"Requested more sectors ({length}) than present in track ({_extra.sectors}), won't cross tracks"); uint sector_offset; uint sector_size; diff --git a/DiscImageChef.DiscImages/Apple2MG.cs b/DiscImageChef.DiscImages/Apple2MG.cs index 9cd520b31..87ef9baa8 100644 --- a/DiscImageChef.DiscImages/Apple2MG.cs +++ b/DiscImageChef.DiscImages/Apple2MG.cs @@ -329,8 +329,7 @@ namespace DiscImageChef.DiscImages ImageInfo.ImageApplication = "CiderPress"; break; default: - ImageInfo.ImageApplication = - string.Format("Unknown creator code \"{0}\"", Encoding.ASCII.GetString(creator)); + ImageInfo.ImageApplication = $"Unknown creator code \"{Encoding.ASCII.GetString(creator)}\""; break; } diff --git a/DiscImageChef.DiscImages/AppleNIB.cs b/DiscImageChef.DiscImages/AppleNIB.cs index 84d6a9f3c..9415bfb43 100644 --- a/DiscImageChef.DiscImages/AppleNIB.cs +++ b/DiscImageChef.DiscImages/AppleNIB.cs @@ -323,7 +323,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] temp; cookedSectors.TryGetValue(sectorAddress, out temp); @@ -334,7 +334,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); @@ -354,10 +354,10 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(tag != SectorTagType.FloppyAddressMark) - throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); + throw new FeatureUnsupportedImageException($"Tag {tag} not supported by image format"); byte[] temp; addressFields.TryGetValue(sectorAddress, out temp); @@ -368,13 +368,13 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); if(tag != SectorTagType.FloppyAddressMark) - throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); + throw new FeatureUnsupportedImageException($"Tag {tag} not supported by image format"); MemoryStream ms = new MemoryStream(); @@ -391,7 +391,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] temp; longSectors.TryGetValue(sectorAddress, out temp); @@ -402,7 +402,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); diff --git a/DiscImageChef.DiscImages/Apridisk.cs b/DiscImageChef.DiscImages/Apridisk.cs index 74972c324..ebbbb8e6a 100644 --- a/DiscImageChef.DiscImages/Apridisk.cs +++ b/DiscImageChef.DiscImages/Apridisk.cs @@ -183,9 +183,7 @@ namespace DiscImageChef.DiscImages if(record.compression != CompressType.Compressed && record.compression != CompressType.Uncompresed) throw new - ImageNotSupportedException(string - .Format("Found record with unknown compression type 0x{0:X4} at {1}", - (ushort)record.compression, stream.Position)); + ImageNotSupportedException($"Found record with unknown compression type 0x{(ushort)record.compression:X4} at {stream.Position}"); DicConsole.DebugWriteLine("Apridisk plugin", "Found {4} sector record at {0} for cylinder {1} head {2} sector {3}", @@ -202,8 +200,7 @@ namespace DiscImageChef.DiscImages break; default: throw new - ImageNotSupportedException(string.Format("Found record with unknown type 0x{0:X8} at {1}", - (uint)record.type, stream.Position)); + ImageNotSupportedException($"Found record with unknown type 0x{(uint)record.type:X8} at {stream.Position}"); } } diff --git a/DiscImageChef.DiscImages/BLU.cs b/DiscImageChef.DiscImages/BLU.cs index 0f4d98cae..524867710 100644 --- a/DiscImageChef.DiscImages/BLU.cs +++ b/DiscImageChef.DiscImages/BLU.cs @@ -312,7 +312,7 @@ namespace DiscImageChef.DiscImages public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) { if(tag != SectorTagType.AppleSectorTag) - throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); + throw new FeatureUnsupportedImageException($"Tag {tag} not supported by image format"); if(bptag == 0) throw new FeatureNotPresentImageException("Disk image does not have tags"); diff --git a/DiscImageChef.DiscImages/BlindWrite4.cs b/DiscImageChef.DiscImages/BlindWrite4.cs index 01b4ff24b..68eba49d1 100644 --- a/DiscImageChef.DiscImages/BlindWrite4.cs +++ b/DiscImageChef.DiscImages/BlindWrite4.cs @@ -585,7 +585,7 @@ namespace DiscImageChef.DiscImages .ToUpper(CultureInfo.CurrentCulture))); if(dataFilter != null) break; - throw new ArgumentException(string.Format("Data file {0} not found", header.DataFile)); + throw new ArgumentException($"Data file {header.DataFile} not found"); } else throw new ArgumentException("Unable to find data file"); @@ -959,10 +959,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress > _track.TrackEndSector - _track.TrackStartSector + 1) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length + sectorAddress, - _track.TrackEndSector - _track.TrackStartSector + 1)); + $"Requested more sectors ({length + sectorAddress}) than present in track ({_track.TrackEndSector - _track.TrackStartSector + 1}), won't cross tracks"); uint sectorOffset; uint sectorSize; @@ -1039,10 +1036,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress > _track.TrackEndSector - _track.TrackStartSector + 1) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length + sectorAddress, - _track.TrackEndSector - _track.TrackStartSector + 1)); + $"Requested more sectors ({length + sectorAddress}) than present in track ({_track.TrackEndSector - _track.TrackStartSector + 1}), won't cross tracks"); uint sectorOffset; uint sectorSize; @@ -1229,10 +1223,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress > _track.TrackEndSector - _track.TrackStartSector + 1) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length + sectorAddress, - _track.TrackEndSector - _track.TrackStartSector + 1)); + $"Requested more sectors ({length + sectorAddress}) than present in track ({_track.TrackEndSector - _track.TrackStartSector + 1}), won't cross tracks"); uint sectorOffset; uint sectorSize; diff --git a/DiscImageChef.DiscImages/BlindWrite5.cs b/DiscImageChef.DiscImages/BlindWrite5.cs index 84e89d56c..fad1588e8 100644 --- a/DiscImageChef.DiscImages/BlindWrite5.cs +++ b/DiscImageChef.DiscImages/BlindWrite5.cs @@ -867,7 +867,7 @@ namespace DiscImageChef.DiscImages break; } - track.TrackDescription = string.Format("Track {0}", trk.point); + track.TrackDescription = $"Track {trk.point}"; track.TrackStartSector = (ulong)(trk.startLba + trk.pregap); track.TrackEndSector = (ulong)(trk.sectors + trk.startLba); @@ -1088,7 +1088,8 @@ namespace DiscImageChef.DiscImages { PMA.CDPMA pma0 = PMA.Decode(pma).Value; - foreach(uint id in from descriptor in pma0.PMADescriptors where descriptor.ADR == 2 select (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame)) ImageInfo.MediaSerialNumber = string.Format("{0:X6}", id & 0x00FFFFFF); + foreach(uint id in from descriptor in pma0.PMADescriptors where descriptor.ADR == 2 select (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame)) ImageInfo.MediaSerialNumber = + $"{id & 0x00FFFFFF:X6}"; } if(atip != null) @@ -1278,9 +1279,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress > _track.TrackEndSector) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length + sectorAddress, _track.TrackEndSector)); + $"Requested more sectors ({length + sectorAddress}) than present in track ({_track.TrackEndSector}), won't cross tracks"); foreach(DataFileCharacteristics _chars in filePaths.Where(_chars => (long)sectorAddress >= _chars.StartLba && length < (ulong)_chars.Sectors - sectorAddress)) { chars = _chars; @@ -1395,9 +1394,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress > _track.TrackEndSector) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length + sectorAddress, _track.TrackEndSector)); + $"Requested more sectors ({length + sectorAddress}) than present in track ({_track.TrackEndSector}), won't cross tracks"); foreach(DataFileCharacteristics _chars in filePaths.Where(_chars => (long)sectorAddress >= _chars.StartLba && length < (ulong)_chars.Sectors - sectorAddress)) { chars = _chars; @@ -1695,9 +1692,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress > _track.TrackEndSector) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length + sectorAddress, _track.TrackEndSector)); + $"Requested more sectors ({length + sectorAddress}) than present in track ({_track.TrackEndSector}), won't cross tracks"); foreach(DataFileCharacteristics _chars in filePaths.Where(_chars => (long)sectorAddress >= _chars.StartLba && length < (ulong)_chars.Sectors - sectorAddress)) { chars = _chars; diff --git a/DiscImageChef.DiscImages/CDRDAO.cs b/DiscImageChef.DiscImages/CDRDAO.cs index df8f4f2fd..ed963ca88 100644 --- a/DiscImageChef.DiscImages/CDRDAO.cs +++ b/DiscImageChef.DiscImages/CDRDAO.cs @@ -529,8 +529,7 @@ namespace DiscImageChef.DiscImages currenttrack.Bps = 2336; break; default: - throw new NotSupportedException(string.Format("Track mode {0} is unsupported", - matchTrack.Groups["type"].Value)); + throw new NotSupportedException($"Track mode {matchTrack.Groups["type"].Value} is unsupported"); } switch(matchTrack.Groups["subchan"].Value) @@ -545,8 +544,7 @@ namespace DiscImageChef.DiscImages break; default: throw new - NotSupportedException(string.Format("Track subchannel mode {0} is unsupported", - matchTrack.Groups["subchan"].Value)); + NotSupportedException($"Track subchannel mode {matchTrack.Groups["subchan"].Value} is unsupported"); } currenttrack.Tracktype = matchTrack.Groups["type"].Value; @@ -861,7 +859,7 @@ namespace DiscImageChef.DiscImages Partition partition = new Partition(); // Index 01 - partition.Description = string.Format("Track {0}.", discimage.Tracks[i].Sequence); + partition.Description = $"Track {discimage.Tracks[i].Sequence}."; partition.Name = discimage.Tracks[i].Title; partition.Start = discimage.Tracks[i].StartSector; partition.Size = (discimage.Tracks[i].Sectors - index0Len) * discimage.Tracks[i].Bps; @@ -1064,16 +1062,14 @@ namespace DiscImageChef.DiscImages { foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from cdrdaoTrack in discimage.Tracks where cdrdaoTrack.Sequence == kvp.Key where sectorAddress - kvp.Value < cdrdaoTrack.Sectors select kvp) return ReadSectors(sectorAddress - kvp.Value, length, kvp.Key); - throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); } public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) { foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from cdrdaoTrack in discimage.Tracks where cdrdaoTrack.Sequence == kvp.Key where sectorAddress - kvp.Value < cdrdaoTrack.Sectors select kvp) return ReadSectorsTag(sectorAddress - kvp.Value, length, kvp.Key, tag); - throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); } public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) diff --git a/DiscImageChef.DiscImages/CDRWin.cs b/DiscImageChef.DiscImages/CDRWin.cs index f8411fb4f..57e88caaf 100644 --- a/DiscImageChef.DiscImages/CDRWin.cs +++ b/DiscImageChef.DiscImages/CDRWin.cs @@ -458,9 +458,7 @@ namespace DiscImageChef.DiscImages uint trackSeq = uint.Parse(matchTrack.Groups[1].Value); if(trackCount + 1 != trackSeq) throw new - FeatureUnsupportedImageException(string - .Format("Found TRACK {0} out of order in line {1}", - trackSeq, line)); + FeatureUnsupportedImageException($"Found TRACK {trackSeq} out of order in line {line}"); trackCount++; } @@ -493,9 +491,7 @@ namespace DiscImageChef.DiscImages } else if(matchDiskType.Success && intrack) throw new - FeatureUnsupportedImageException(string - .Format("Found REM ORIGINAL MEDIA TYPE field after a track in line {0}", - line)); + FeatureUnsupportedImageException($"Found REM ORIGINAL MEDIA TYPE field after a track in line {line}"); else if(matchSession.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found REM SESSION at line {0}", line); @@ -545,9 +541,7 @@ namespace DiscImageChef.DiscImages if(!intrack) discimage.Barcode = matchBarCode.Groups[1].Value; else throw new - FeatureUnsupportedImageException(string - .Format("Found barcode field in incorrect place at line {0}", - line)); + FeatureUnsupportedImageException($"Found barcode field in incorrect place at line {line}"); } else if(matchCdText.Success) { @@ -555,9 +549,7 @@ namespace DiscImageChef.DiscImages if(!intrack) discimage.Cdtextfile = matchCdText.Groups[1].Value; else throw new - FeatureUnsupportedImageException(string - .Format("Found CD-Text file field in incorrect place at line {0}", - line)); + FeatureUnsupportedImageException($"Found CD-Text file field in incorrect place at line {line}"); } else if(matchComposer.Success) { @@ -571,9 +563,7 @@ namespace DiscImageChef.DiscImages if(!intrack) discimage.DiskId = matchDiskId.Groups[1].Value; else throw new - FeatureUnsupportedImageException(string - .Format("Found CDDB ID field in incorrect place at line {0}", - line)); + FeatureUnsupportedImageException($"Found CDDB ID field in incorrect place at line {line}"); } else if(matchFile.Success) { @@ -622,16 +612,12 @@ namespace DiscImageChef.DiscImages if(currentfile.Datafilter == null) throw new - FeatureUnsupportedImageException(string - .Format("File \"{0}\" not found.", - matchFile - .Groups[1].Value)); + FeatureUnsupportedImageException($"File \"{matchFile.Groups[1].Value}\" not found."); } } else throw new - FeatureUnsupportedImageException(string.Format("File \"{0}\" not found.", - matchFile.Groups[1].Value)); + FeatureUnsupportedImageException($"File \"{matchFile.Groups[1].Value}\" not found."); } else if(datafile[1] == ':' && datafile[2] == '\\' || datafile[0] == '\\' && datafile[1] == '\\' || @@ -653,16 +639,12 @@ namespace DiscImageChef.DiscImages if(currentfile.Datafilter == null) throw new - FeatureUnsupportedImageException(string - .Format("File \"{0}\" not found.", - matchFile - .Groups[1].Value)); + FeatureUnsupportedImageException($"File \"{matchFile.Groups[1].Value}\" not found."); } } else throw new - FeatureUnsupportedImageException(string.Format("File \"{0}\" not found.", - matchFile.Groups[1].Value)); + FeatureUnsupportedImageException($"File \"{matchFile.Groups[1].Value}\" not found."); } else { @@ -671,8 +653,7 @@ namespace DiscImageChef.DiscImages if(currentfile.Datafilter == null) throw new - FeatureUnsupportedImageException(string.Format("File \"{0}\" not found.", - matchFile.Groups[1].Value)); + FeatureUnsupportedImageException($"File \"{matchFile.Groups[1].Value}\" not found."); } // File does exist, process it @@ -687,13 +668,9 @@ namespace DiscImageChef.DiscImages case CDRWIN_DISK_TYPE_RIFF: case CDRWIN_DISK_TYPE_MP3: throw new - FeatureSupportedButNotImplementedImageException(string - .Format("Unsupported file type {0}", - currentfile - .Filetype)); + FeatureSupportedButNotImplementedImageException($"Unsupported file type {currentfile.Filetype}"); default: - throw new FeatureUnsupportedImageException(string.Format("Unknown file type {0}", - currentfile.Filetype)); + throw new FeatureUnsupportedImageException($"Unknown file type {currentfile.Filetype}"); } currentfile.Offset = 0; @@ -704,9 +681,7 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("CDRWin plugin", "Found FLAGS at line {0}", line); if(!intrack) throw new - FeatureUnsupportedImageException(string - .Format("Found FLAGS field in incorrect place at line {0}", - line)); + FeatureUnsupportedImageException($"Found FLAGS field in incorrect place at line {line}"); currenttrack.FlagDcp |= matchFile.Groups["dcp"].Value == "DCP"; currenttrack.Flag4ch |= matchFile.Groups["quad"].Value == "4CH"; @@ -724,17 +699,14 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("CDRWin plugin", "Found INDEX at line {0}", line); if(!intrack) throw new - FeatureUnsupportedImageException(string.Format("Found INDEX before a track {0}", - line)); + FeatureUnsupportedImageException($"Found INDEX before a track {line}"); int index = int.Parse(matchIndex.Groups[1].Value); ulong offset = CdrWinMsftoLba(matchIndex.Groups[2].Value); if(index != 0 && index != 1 && currenttrack.Indexes.Count == 0) throw new - FeatureUnsupportedImageException(string - .Format("Found INDEX {0} before INDEX 00 or INDEX 01", - index)); + FeatureUnsupportedImageException($"Found INDEX {index} before INDEX 00 or INDEX 01"); if(index == 0 || index == 1 && !currenttrack.Indexes.ContainsKey(0)) if((int)(currenttrack.Sequence - 2) >= 0 && offset > 1) @@ -771,8 +743,7 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("CDRWin plugin", "Found ISRC at line {0}", line); if(!intrack) throw new - FeatureUnsupportedImageException(string.Format("Found ISRC before a track {0}", - line)); + FeatureUnsupportedImageException($"Found ISRC before a track {line}"); currenttrack.Isrc = matchIsrc.Groups[1].Value; } @@ -782,9 +753,7 @@ namespace DiscImageChef.DiscImages if(!intrack) discimage.Mcn = matchMcn.Groups[1].Value; else throw new - FeatureUnsupportedImageException(string - .Format("Found CATALOG field in incorrect place at line {0}", - line)); + FeatureUnsupportedImageException($"Found CATALOG field in incorrect place at line {line}"); } else if(matchPerformer.Success) { @@ -798,9 +767,7 @@ namespace DiscImageChef.DiscImages if(intrack) currenttrack.Postgap = CdrWinMsftoLba(matchPostgap.Groups[1].Value); else throw new - FeatureUnsupportedImageException(string - .Format("Found POSTGAP field before a track at line {0}", - line)); + FeatureUnsupportedImageException($"Found POSTGAP field before a track at line {line}"); } else if(matchPregap.Success) { @@ -808,9 +775,7 @@ namespace DiscImageChef.DiscImages if(intrack) currenttrack.Pregap = CdrWinMsftoLba(matchPregap.Groups[1].Value); else throw new - FeatureUnsupportedImageException(string - .Format("Found PREGAP field before a track at line {0}", - line)); + FeatureUnsupportedImageException($"Found PREGAP field before a track at line {line}"); } else if(matchSongWriter.Success) { @@ -829,9 +794,7 @@ namespace DiscImageChef.DiscImages DicConsole.DebugWriteLine("CDRWin plugin", "Found TRACK at line {0}", line); if(currentfile.Datafilter == null) throw new - FeatureUnsupportedImageException(string - .Format("Found TRACK field before a file is defined at line {0}", - line)); + FeatureUnsupportedImageException($"Found TRACK field before a file is defined at line {line}"); if(intrack) { @@ -855,9 +818,7 @@ namespace DiscImageChef.DiscImages { } else // Non-empty unknown field throw new - FeatureUnsupportedImageException(string - .Format("Found unknown field defined at line {0}: \"{1}\"", - line, _line)); + FeatureUnsupportedImageException($"Found unknown field defined at line {line}: \"{_line}\""); } } @@ -1111,8 +1072,7 @@ namespace DiscImageChef.DiscImages indexZero |= discimage.Tracks[i].Indexes.TryGetValue(0, out indexZeroOffset); if(!discimage.Tracks[i].Indexes.TryGetValue(1, out indexOneOffset)) - throw new ImageNotSupportedException(string.Format("Track {0} lacks index 01", - discimage.Tracks[i].Sequence)); + throw new ImageNotSupportedException($"Track {discimage.Tracks[i].Sequence} lacks index 01"); /*if(index_zero && index_one_offset > index_zero_offset) { @@ -1149,7 +1109,7 @@ namespace DiscImageChef.DiscImages }*/ // Index 01 - partition.Description = string.Format("Track {0}.", discimage.Tracks[i].Sequence); + partition.Description = $"Track {discimage.Tracks[i].Sequence}."; partition.Name = discimage.Tracks[i].Title; partition.Start = sectorOffset; partition.Size = (discimage.Tracks[i].Sectors - index0Len) * discimage.Tracks[i].Bps; diff --git a/DiscImageChef.DiscImages/CHD.cs b/DiscImageChef.DiscImages/CHD.cs index aee0e4af5..39fd7cb5f 100644 --- a/DiscImageChef.DiscImages/CHD.cs +++ b/DiscImageChef.DiscImages/CHD.cs @@ -958,7 +958,7 @@ namespace DiscImageChef.DiscImages break; } - default: throw new ImageNotSupportedException(string.Format("Unsupported CHD version {0}", version)); + default: throw new ImageNotSupportedException($"Unsupported CHD version {version}"); } if(mapVersion >= 3) @@ -1078,8 +1078,7 @@ namespace DiscImageChef.DiscImages _track.TrackType = TrackType.CdMode2Formless; break; default: - throw new ImageNotSupportedException(string.Format("Unsupported track type {0}", - _trk.type)); + throw new ImageNotSupportedException($"Unsupported track type {_trk.type}"); } switch((ChdOldSubType)_trk.subType) @@ -1099,12 +1098,11 @@ namespace DiscImageChef.DiscImages break; default: throw new - ImageNotSupportedException(string.Format("Unsupported subchannel type {0}", - _trk.type)); + ImageNotSupportedException($"Unsupported subchannel type {_trk.type}"); } _track.Indexes = new Dictionary(); - _track.TrackDescription = string.Format("Track {0}", i + 1); + _track.TrackDescription = $"Track {i + 1}"; _track.TrackEndSector = currentSector + _trk.frames - 1; _track.TrackFile = imageFilter.GetFilename(); _track.TrackFileType = "BINARY"; @@ -1191,8 +1189,7 @@ namespace DiscImageChef.DiscImages _track.TrackType = TrackType.CdMode2Formless; break; default: - throw new ImageNotSupportedException(string.Format("Unsupported track type {0}", - tracktype)); + throw new ImageNotSupportedException($"Unsupported track type {tracktype}"); } switch(subtype) @@ -1212,12 +1209,11 @@ namespace DiscImageChef.DiscImages break; default: throw new - ImageNotSupportedException(string.Format("Unsupported subchannel type {0}", - subtype)); + ImageNotSupportedException($"Unsupported subchannel type {subtype}"); } _track.Indexes = new Dictionary(); - _track.TrackDescription = string.Format("Track {0}", trackNo); + _track.TrackDescription = $"Track {trackNo}"; _track.TrackEndSector = currentSector + frames - 1; _track.TrackFile = imageFilter.GetFilename(); _track.TrackFileType = "BINARY"; @@ -1307,8 +1303,7 @@ namespace DiscImageChef.DiscImages _track.TrackType = TrackType.CdMode2Formless; break; default: - throw new ImageNotSupportedException(string.Format("Unsupported track type {0}", - tracktype)); + throw new ImageNotSupportedException($"Unsupported track type {tracktype}"); } switch(subtype) @@ -1328,12 +1323,11 @@ namespace DiscImageChef.DiscImages break; default: throw new - ImageNotSupportedException(string.Format("Unsupported subchannel type {0}", - subtype)); + ImageNotSupportedException($"Unsupported subchannel type {subtype}"); } _track.Indexes = new Dictionary(); - _track.TrackDescription = string.Format("Track {0}", trackNo); + _track.TrackDescription = $"Track {trackNo}"; _track.TrackEndSector = currentSector + frames - 1; _track.TrackFile = imageFilter.GetFilename(); _track.TrackFileType = "BINARY"; @@ -1428,8 +1422,7 @@ namespace DiscImageChef.DiscImages _track.TrackType = TrackType.CdMode2Formless; break; default: - throw new ImageNotSupportedException(string.Format("Unsupported track type {0}", - tracktype)); + throw new ImageNotSupportedException($"Unsupported track type {tracktype}"); } switch(subtype) @@ -1449,12 +1442,11 @@ namespace DiscImageChef.DiscImages break; default: throw new - ImageNotSupportedException(string.Format("Unsupported subchannel type {0}", - subtype)); + ImageNotSupportedException($"Unsupported subchannel type {subtype}"); } _track.Indexes = new Dictionary(); - _track.TrackDescription = string.Format("Track {0}", trackNo); + _track.TrackDescription = $"Track {trackNo}"; _track.TrackEndSector = currentSector + frames - 1; _track.TrackFile = imageFilter.GetFilename(); _track.TrackFileType = "BINARY"; @@ -1663,8 +1655,7 @@ namespace DiscImageChef.DiscImages if(length == sectorsPerHunk * ImageInfo.SectorSize) hunk = compHunk; else if((ChdCompression)hdrCompression > ChdCompression.Zlib) - throw new ImageNotSupportedException(string.Format("Unsupported compression {0}", - (ChdCompression)hdrCompression)); + throw new ImageNotSupportedException($"Unsupported compression {(ChdCompression)hdrCompression}"); else { DeflateStream zStream = @@ -1673,9 +1664,7 @@ namespace DiscImageChef.DiscImages int read = zStream.Read(hunk, 0, (int)(sectorsPerHunk * ImageInfo.SectorSize)); if(read != sectorsPerHunk * ImageInfo.SectorSize) throw new - IOException(string - .Format("Unable to decompress hunk correctly, got {0} bytes, expected {1}", - read, sectorsPerHunk * ImageInfo.SectorSize)); + IOException($"Unable to decompress hunk correctly, got {read} bytes, expected {sectorsPerHunk * ImageInfo.SectorSize}"); zStream.Close(); } @@ -1705,9 +1694,7 @@ namespace DiscImageChef.DiscImages int read = zStream.Read(hunk, 0, (int)bytesPerHunk); if(read != bytesPerHunk) throw new - IOException(string - .Format("Unable to decompress hunk correctly, got {0} bytes, expected {1}", - read, bytesPerHunk)); + IOException($"Unable to decompress hunk correctly, got {read} bytes, expected {bytesPerHunk}"); zStream.Close(); } @@ -1719,8 +1706,7 @@ namespace DiscImageChef.DiscImages break; case ChdCompression.Av: throw new - ImageNotSupportedException(string.Format("Unsupported compression {0}", - (ChdCompression)hdrCompression)); + ImageNotSupportedException($"Unsupported compression {(ChdCompression)hdrCompression}"); } break; @@ -1743,8 +1729,7 @@ namespace DiscImageChef.DiscImages case Chdv3EntryFlags.SecondCompressed: throw new ImageNotSupportedException("FLAC is not supported"); default: - throw new ImageNotSupportedException(string.Format("Hunk type {0} is not supported", - entry.flags & 0xF)); + throw new ImageNotSupportedException($"Hunk type {entry.flags & 0xF} is not supported"); } break; @@ -1759,8 +1744,7 @@ namespace DiscImageChef.DiscImages break; default: - throw new ImageNotSupportedException(string.Format("Unsupported hunk map version {0}", - mapVersion)); + throw new ImageNotSupportedException($"Unsupported hunk map version {mapVersion}"); } if(hunkCache.Count >= maxBlockCache) hunkCache.Clear(); @@ -1899,7 +1883,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] sector; Track track = new Track(); @@ -2006,7 +1990,7 @@ namespace DiscImageChef.DiscImages if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] sector; Track track = new Track(); @@ -2045,8 +2029,7 @@ namespace DiscImageChef.DiscImages break; default: throw new - FeatureSupportedButNotImplementedImageException(string.Format("Unsupported subchannel type {0}", - track.TrackSubchannelType)); + FeatureSupportedButNotImplementedImageException($"Unsupported subchannel type {track.TrackSubchannelType}"); } else switch(track.TrackType) @@ -2221,12 +2204,11 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), - string.Format("Requested more sectors ({0}) than available ({1})", - sectorAddress + length, ImageInfo.Sectors)); + $"Requested more sectors ({sectorAddress + length}) than available ({ImageInfo.Sectors})"); MemoryStream ms = new MemoryStream(); @@ -2243,12 +2225,11 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), - string.Format("Requested more sectors ({0}) than available ({1})", - sectorAddress + length, ImageInfo.Sectors)); + $"Requested more sectors ({sectorAddress + length}) than available ({ImageInfo.Sectors})"); MemoryStream ms = new MemoryStream(); @@ -2267,7 +2248,7 @@ namespace DiscImageChef.DiscImages if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] sector; Track track = new Track(); @@ -2309,12 +2290,11 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), - string.Format("Requested more sectors ({0}) than available ({1})", - sectorAddress + length, ImageInfo.Sectors)); + $"Requested more sectors ({sectorAddress + length}) than available ({ImageInfo.Sectors})"); MemoryStream ms = new MemoryStream(); diff --git a/DiscImageChef.DiscImages/CPCDSK.cs b/DiscImageChef.DiscImages/CPCDSK.cs index 8f3da2457..adfff4f40 100644 --- a/DiscImageChef.DiscImages/CPCDSK.cs +++ b/DiscImageChef.DiscImages/CPCDSK.cs @@ -554,15 +554,14 @@ namespace DiscImageChef.DiscImages byte[] sector; if(sectors.TryGetValue(sectorAddress, out sector)) return sector; - throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); } public override byte[] ReadSectors(ulong sectorAddress, uint length) { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); @@ -581,7 +580,7 @@ namespace DiscImageChef.DiscImages public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) { if(tag != SectorTagType.FloppyAddressMark) - throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); + throw new FeatureUnsupportedImageException($"Tag {tag} not supported by image format"); byte[] addressMark; if(addressMarks.TryGetValue(sectorAddress, out addressMark)) return addressMark; @@ -592,11 +591,11 @@ namespace DiscImageChef.DiscImages public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) { if(tag != SectorTagType.FloppyAddressMark) - throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); + throw new FeatureUnsupportedImageException($"Tag {tag} not supported by image format"); if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); diff --git a/DiscImageChef.DiscImages/CisCopy.cs b/DiscImageChef.DiscImages/CisCopy.cs index 30a697ce6..70991cf35 100644 --- a/DiscImageChef.DiscImages/CisCopy.cs +++ b/DiscImageChef.DiscImages/CisCopy.cs @@ -207,7 +207,7 @@ namespace DiscImageChef.DiscImages case DiskType.MF2HD: tracks = 160; break; - default: throw new ImageNotSupportedException(string.Format("Incorrect disk type {0}", (byte)type)); + default: throw new ImageNotSupportedException($"Incorrect disk type {(byte)type}"); } byte[] trackBytes = new byte[tracks]; diff --git a/DiscImageChef.DiscImages/CloneCD.cs b/DiscImageChef.DiscImages/CloneCD.cs index 4858751f9..4844d20db 100644 --- a/DiscImageChef.DiscImages/CloneCD.cs +++ b/DiscImageChef.DiscImages/CloneCD.cs @@ -271,9 +271,7 @@ namespace DiscImageChef.DiscImages { if(inDisk || inSession || inEntry || inTrack || inCdText) throw new - FeatureUnsupportedImageException(string - .Format("Found [CloneCD] out of order in line {0}", - line)); + FeatureUnsupportedImageException($"Found [CloneCD] out of order in line {line}"); inCcd = true; inDisk = false; @@ -724,7 +722,7 @@ namespace DiscImageChef.DiscImages { uint id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame); DicConsole.DebugWriteLine("CloneCD plugin", "Disc ID: {0:X6}", id & 0x00FFFFFF); - ImageInfo.MediaSerialNumber = string.Format("{0:X6}", id & 0x00FFFFFF); + ImageInfo.MediaSerialNumber = $"{id & 0x00FFFFFF:X6}"; break; } } @@ -910,16 +908,14 @@ namespace DiscImageChef.DiscImages { foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from _track in tracks where _track.TrackSequence == kvp.Key where sectorAddress <= _track.TrackEndSector select kvp) return ReadSectors(sectorAddress - kvp.Value, length, kvp.Key); - throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); } public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) { foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from _track in tracks where _track.TrackSequence == kvp.Key where sectorAddress <= _track.TrackEndSector select kvp) return ReadSectorsTag(sectorAddress - kvp.Value, length, kvp.Key, tag); - throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); } public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) @@ -1021,9 +1017,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress - 1 > _track.TrackEndSector) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length + sectorAddress, _track.TrackEndSector)); + $"Requested more sectors ({length + sectorAddress}) than present in track ({_track.TrackEndSector}), won't cross tracks"); if(_track.TrackType == TrackType.Data) throw new ArgumentException("Unsupported tag requested", nameof(tag)); @@ -1262,8 +1256,7 @@ namespace DiscImageChef.DiscImages { foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in tracks where track.TrackSequence == kvp.Key where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector + 1 select kvp) return ReadSectorsLong(sectorAddress - kvp.Value, length, kvp.Key); - throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); } public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) @@ -1282,9 +1275,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress - 1 > _track.TrackEndSector) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length + sectorAddress, _track.TrackEndSector)); + $"Requested more sectors ({length + sectorAddress}) than present in track ({_track.TrackEndSector}), won't cross tracks"); byte[] buffer = new byte[2352 * length]; diff --git a/DiscImageChef.DiscImages/DART.cs b/DiscImageChef.DiscImages/DART.cs index 03b5dac8e..8418596c9 100644 --- a/DiscImageChef.DiscImages/DART.cs +++ b/DiscImageChef.DiscImages/DART.cs @@ -303,10 +303,10 @@ namespace DiscImageChef.DiscImages string dev = null; string pre = null; - major = string.Format("{0}", version.MajorVersion); - minor = string.Format(".{0}", version.MinorVersion / 10); + major = $"{version.MajorVersion}"; + minor = $".{version.MinorVersion / 10}"; if(version.MinorVersion % 10 > 0) - release = string.Format(".{0}", version.MinorVersion % 10); + release = $".{version.MinorVersion % 10}"; switch(version.DevStage) { case Version.DevelopmentStage.Alpha: @@ -322,10 +322,9 @@ namespace DiscImageChef.DiscImages if(dev == null && version.PreReleaseVersion > 0) dev = "f"; - if(dev != null) pre = string.Format("{0}", version.PreReleaseVersion); + if(dev != null) pre = $"{version.PreReleaseVersion}"; - ImageInfo.ImageApplicationVersion = - string.Format("{0}{1}{2}{3}{4}", major, minor, release, dev, pre); + ImageInfo.ImageApplicationVersion = $"{major}{minor}{release}{dev}{pre}"; ImageInfo.ImageApplication = version.VersionString; ImageInfo.ImageComments = version.VersionMessage; } @@ -446,7 +445,7 @@ namespace DiscImageChef.DiscImages public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) { if(tag != SectorTagType.AppleSectorTag) - throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); + throw new FeatureUnsupportedImageException($"Tag {tag} not supported by image format"); if(tagCache == null || tagCache.Length == 0) throw new FeatureNotPresentImageException("Disk image does not have tags"); diff --git a/DiscImageChef.DiscImages/DiscJuggler.cs b/DiscImageChef.DiscImages/DiscJuggler.cs index 32f7f2d8d..1d007208e 100644 --- a/DiscImageChef.DiscImages/DiscJuggler.cs +++ b/DiscImageChef.DiscImages/DiscJuggler.cs @@ -344,8 +344,7 @@ namespace DiscImageChef.DiscImages currentOffset += trackLen * (ulong)(track.TrackRawBytesPerSector + 96); break; default: - throw new ImageNotSupportedException(string.Format("Unknown read mode {0}", - readMode)); + throw new ImageNotSupportedException($"Unknown read mode {readMode}"); } break; @@ -364,8 +363,7 @@ namespace DiscImageChef.DiscImages break; case 1: throw new - ImageNotSupportedException(string.Format("Invalid read mode {0} for this track", - readMode)); + ImageNotSupportedException($"Invalid read mode {readMode} for this track"); case 2: track.TrackRawBytesPerSector = 2352; currentOffset += trackLen * (ulong)track.TrackRawBytesPerSector; @@ -425,8 +423,7 @@ namespace DiscImageChef.DiscImages ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc); break; default: - throw new ImageNotSupportedException(string.Format("Unknown read mode {0}", - readMode)); + throw new ImageNotSupportedException($"Unknown read mode {readMode}"); } break; @@ -439,8 +436,7 @@ namespace DiscImageChef.DiscImages { case 0: throw new - ImageNotSupportedException(string.Format("Invalid read mode {0} for this track", - readMode)); + ImageNotSupportedException($"Invalid read mode {readMode} for this track"); case 1: track.TrackRawBytesPerSector = 2336; if(firstTrack) currentOffset += 150 * (ulong)track.TrackRawBytesPerSector; @@ -482,13 +478,12 @@ namespace DiscImageChef.DiscImages ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader); break; default: - throw new ImageNotSupportedException(string.Format("Unknown read mode {0}", - readMode)); + throw new ImageNotSupportedException($"Unknown read mode {readMode}"); } break; default: - throw new ImageNotSupportedException(string.Format("Unknown track mode {0}", trackMode)); + throw new ImageNotSupportedException($"Unknown track mode {trackMode}"); } track.TrackFile = imageFilter.GetFilename(); @@ -702,16 +697,14 @@ namespace DiscImageChef.DiscImages { foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from _track in tracks where _track.TrackSequence == kvp.Key where sectorAddress < _track.TrackEndSector select kvp) return ReadSectors(sectorAddress - kvp.Value, length, kvp.Key); - throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); } public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) { foreach(KeyValuePair kvp in offsetmap.Where(kvp => sectorAddress >= kvp.Value).Where(kvp => tracks.Where(_track => _track.TrackSequence == kvp.Key).Any(_track => sectorAddress < _track.TrackEndSector))) return ReadSectorsTag(sectorAddress - kvp.Value, length, kvp.Key, tag); - throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); } public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) @@ -730,9 +723,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress > _track.TrackEndSector) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length + sectorAddress, _track.TrackEndSector)); + $"Requested more sectors ({length + sectorAddress}) than present in track ({_track.TrackEndSector}), won't cross tracks"); uint sectorOffset; uint sectorSize; @@ -826,9 +817,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress > _track.TrackEndSector) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length + sectorAddress, _track.TrackEndSector)); + $"Requested more sectors ({length + sectorAddress}) than present in track ({_track.TrackEndSector}), won't cross tracks"); if(_track.TrackType == TrackType.Data) throw new ArgumentException("Unsupported tag requested", nameof(tag)); @@ -1033,8 +1022,7 @@ namespace DiscImageChef.DiscImages { foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from track in tracks where track.TrackSequence == kvp.Key where sectorAddress - kvp.Value < track.TrackEndSector - track.TrackStartSector select kvp) return ReadSectorsLong(sectorAddress - kvp.Value, length, kvp.Key); - throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); } public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) @@ -1053,9 +1041,7 @@ namespace DiscImageChef.DiscImages if(length + sectorAddress > _track.TrackEndSector) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length + sectorAddress, _track.TrackEndSector)); + $"Requested more sectors ({length + sectorAddress}) than present in track ({_track.TrackEndSector}), won't cross tracks"); uint sectorOffset = 0; uint sectorSize = (uint)_track.TrackRawBytesPerSector; diff --git a/DiscImageChef.DiscImages/DiskCopy42.cs b/DiscImageChef.DiscImages/DiskCopy42.cs index 3110cf7b0..536abb198 100644 --- a/DiscImageChef.DiscImages/DiskCopy42.cs +++ b/DiscImageChef.DiscImages/DiskCopy42.cs @@ -472,10 +472,10 @@ namespace DiscImageChef.DiscImages string dev = null; string pre = null; - major = string.Format("{0}", version.MajorVersion); - minor = string.Format(".{0}", version.MinorVersion / 10); + major = $"{version.MajorVersion}"; + minor = $".{version.MinorVersion / 10}"; if(version.MinorVersion % 10 > 0) - release = string.Format(".{0}", version.MinorVersion % 10); + release = $".{version.MinorVersion % 10}"; switch(version.DevStage) { case Version.DevelopmentStage.Alpha: @@ -491,10 +491,9 @@ namespace DiscImageChef.DiscImages if(dev == null && version.PreReleaseVersion > 0) dev = "f"; - if(dev != null) pre = string.Format("{0}", version.PreReleaseVersion); + if(dev != null) pre = $"{version.PreReleaseVersion}"; - ImageInfo.ImageApplicationVersion = - string.Format("{0}{1}{2}{3}{4}", major, minor, release, dev, pre); + ImageInfo.ImageApplicationVersion = $"{major}{minor}{release}{dev}{pre}"; ImageInfo.ImageApplication = version.VersionString; ImageInfo.ImageComments = version.VersionMessage; } @@ -715,7 +714,7 @@ namespace DiscImageChef.DiscImages public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) { if(tag != SectorTagType.AppleSectorTag) - throw new FeatureUnsupportedImageException(string.Format("Tag {0} not supported by image format", tag)); + throw new FeatureUnsupportedImageException($"Tag {tag} not supported by image format"); if(header.TagSize == 0) throw new FeatureNotPresentImageException("Disk image does not have tags"); diff --git a/DiscImageChef.DiscImages/GDI.cs b/DiscImageChef.DiscImages/GDI.cs index 8e319d824..389214167 100644 --- a/DiscImageChef.DiscImages/GDI.cs +++ b/DiscImageChef.DiscImages/GDI.cs @@ -234,8 +234,7 @@ namespace DiscImageChef.DiscImages trackMatch = regexTrack.Match(_line ?? throw new InvalidOperationException()); if(!trackMatch.Success) - throw new ImageNotSupportedException(string.Format("Unknown line \"{0}\" at line {1}", - _line, line)); + throw new ImageNotSupportedException($"Unknown line \"{_line}\" at line {line}"); tracksFound++; @@ -384,7 +383,7 @@ namespace DiscImageChef.DiscImages Partition partition = new Partition(); // Index 01 - partition.Description = string.Format("Track {0}.", discimage.Tracks[i].Sequence); + partition.Description = $"Track {discimage.Tracks[i].Sequence}."; partition.Name = null; partition.Start = discimage.Tracks[i].StartSector; partition.Size = discimage.Tracks[i].Sectors * discimage.Tracks[i].Bps; diff --git a/DiscImageChef.DiscImages/IMD.cs b/DiscImageChef.DiscImages/IMD.cs index ddae570ed..758d309df 100644 --- a/DiscImageChef.DiscImages/IMD.cs +++ b/DiscImageChef.DiscImages/IMD.cs @@ -220,7 +220,7 @@ namespace DiscImageChef.DiscImages if(!track.ContainsKey(idmap[i])) track.Add(idmap[i], data); break; default: - throw new ImageNotSupportedException(string.Format("Invalid sector type {0}", (byte)type)); + throw new ImageNotSupportedException($"Invalid sector type {(byte)type}"); } } diff --git a/DiscImageChef.DiscImages/KryoFlux.cs b/DiscImageChef.DiscImages/KryoFlux.cs index c08bc25fc..598231841 100644 --- a/DiscImageChef.DiscImages/KryoFlux.cs +++ b/DiscImageChef.DiscImages/KryoFlux.cs @@ -204,8 +204,8 @@ namespace DiscImageChef.DiscImages int cylinder = t / heads; int head = topHead ? 1 : t % heads; string trackfile = Directory.Exists(basename) - ? Path.Combine(basename, string.Format("{0:D2}.{1:D1}.raw", cylinder, head)) - : string.Format("{0}{1:D2}.{2:D1}.raw", basename, cylinder, head); + ? Path.Combine(basename, $"{cylinder:D2}.{head:D1}.raw") + : $"{basename}{cylinder:D2}.{head:D1}.raw"; if(!File.Exists(trackfile)) if(cylinder == 0) diff --git a/DiscImageChef.DiscImages/NDIF.cs b/DiscImageChef.DiscImages/NDIF.cs index cb93d619a..8d7d30dee 100644 --- a/DiscImageChef.DiscImages/NDIF.cs +++ b/DiscImageChef.DiscImages/NDIF.cs @@ -335,8 +335,7 @@ namespace DiscImageChef.DiscImages bChnk.type > CHUNK_TYPE_ADC && bChnk.type < CHUNK_TYPE_STUFFIT || bChnk.type > CHUNK_TYPE_STUFFIT && bChnk.type < CHUNK_TYPE_END || bChnk.type == 1) - throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", - bChnk.type)); + throw new ImageNotSupportedException($"Unsupported chunk type 0x{bChnk.type:X8} found"); chunks.Add(bChnk.sector, bChnk); } @@ -382,9 +381,9 @@ namespace DiscImageChef.DiscImages string dev = null; string pre = null; - major = string.Format("{0}", version.MajorVersion); - minor = string.Format(".{0}", version.MinorVersion / 10); - if(version.MinorVersion % 10 > 0) release = string.Format(".{0}", version.MinorVersion % 10); + major = $"{version.MajorVersion}"; + minor = $".{version.MinorVersion / 10}"; + if(version.MinorVersion % 10 > 0) release = $".{version.MinorVersion % 10}"; switch(version.DevStage) { case Version.DevelopmentStage.Alpha: @@ -400,10 +399,9 @@ namespace DiscImageChef.DiscImages if(dev == null && version.PreReleaseVersion > 0) dev = "f"; - if(dev != null) pre = string.Format("{0}", version.PreReleaseVersion); + if(dev != null) pre = $"{version.PreReleaseVersion}"; - ImageInfo.ImageApplicationVersion = - string.Format("{0}{1}{2}{3}{4}", major, minor, release, dev, pre); + ImageInfo.ImageApplicationVersion = $"{major}{minor}{release}{dev}{pre}"; ImageInfo.ImageApplication = version.VersionString; ImageInfo.ImageComments = version.VersionMessage; @@ -467,7 +465,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] sector; @@ -487,13 +485,11 @@ namespace DiscImageChef.DiscImages if(relOff < 0) throw new ArgumentOutOfRangeException(nameof(relOff), - string - .Format("Got a negative offset for sector {0}. This should not happen.", - sectorAddress)); + $"Got a negative offset for sector {sectorAddress}. This should not happen."); if(!chunkFound) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if((currentChunk.type & CHUNK_TYPE_COMPRESSED_MASK) == CHUNK_TYPE_COMPRESSED_MASK) { @@ -508,8 +504,7 @@ namespace DiscImageChef.DiscImages if(currentChunk.type == CHUNK_TYPE_ADC) decStream = new ADCStream(cmpMs, CompressionMode.Decompress); else - throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", - currentChunk.type)); + throw new ImageNotSupportedException($"Unsupported chunk type 0x{currentChunk.type:X8} found"); byte[] tmpBuffer = new byte[buffersize]; int realSize = decStream.Read(tmpBuffer, 0, (int)buffersize); @@ -555,15 +550,14 @@ namespace DiscImageChef.DiscImages return sector; } - throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", - currentChunk.type)); + throw new ImageNotSupportedException($"Unsupported chunk type 0x{currentChunk.type:X8} found"); } public override byte[] ReadSectors(ulong sectorAddress, uint length) { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); diff --git a/DiscImageChef.DiscImages/Nero.cs b/DiscImageChef.DiscImages/Nero.cs index 1d6cc93c3..0458ffd87 100644 --- a/DiscImageChef.DiscImages/Nero.cs +++ b/DiscImageChef.DiscImages/Nero.cs @@ -1711,7 +1711,7 @@ namespace DiscImageChef.DiscImages }*/ partition = new Partition(); - partition.Description = string.Format("Track {0} Index 1", _track.TrackSequence); + partition.Description = $"Track {_track.TrackSequence} Index 1"; partition.Size = neroTrack.EndOfTrack - neroTrack.Index1; partition.Name = StringHandlers.CToString(neroTrack.Isrc); partition.Length = partition.Size / neroTrack.SectorSize; @@ -1838,16 +1838,14 @@ namespace DiscImageChef.DiscImages { foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from _track in imageTracks where _track.TrackSequence == kvp.Key where sectorAddress - kvp.Value < _track.TrackEndSector - _track.TrackStartSector select kvp) return ReadSectors(sectorAddress - kvp.Value, length, kvp.Key); - throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); } public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag) { foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from _track in imageTracks where _track.TrackSequence == kvp.Key where sectorAddress - kvp.Value < _track.TrackEndSector - _track.TrackStartSector select kvp) return ReadSectorsTag(sectorAddress - kvp.Value, length, kvp.Key, tag); - throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); } public override byte[] ReadSectors(ulong sectorAddress, uint length, uint track) @@ -1859,9 +1857,7 @@ namespace DiscImageChef.DiscImages if(length > _track.Sectors) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length, _track.Sectors)); + $"Requested more sectors ({length}) than present in track ({_track.Sectors}), won't cross tracks"); uint sectorOffset; uint sectorSize; @@ -1960,9 +1956,7 @@ namespace DiscImageChef.DiscImages if(length > _track.Sectors) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length, _track.Sectors)); + $"Requested more sectors ({length}) than present in track ({_track.Sectors}), won't cross tracks"); uint sectorOffset; uint sectorSize; @@ -2194,8 +2188,7 @@ namespace DiscImageChef.DiscImages { foreach(KeyValuePair kvp in from kvp in offsetmap where sectorAddress >= kvp.Value from _track in imageTracks where _track.TrackSequence == kvp.Key where sectorAddress - kvp.Value < _track.TrackEndSector - _track.TrackStartSector select kvp) return ReadSectorsLong(sectorAddress - kvp.Value, length, kvp.Key); - throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + throw new ArgumentOutOfRangeException(nameof(sectorAddress), $"Sector address {sectorAddress} not found"); } public override byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) @@ -2207,9 +2200,7 @@ namespace DiscImageChef.DiscImages if(length > _track.Sectors) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0}) than present in track ({1}), won't cross tracks", - length, _track.Sectors)); + $"Requested more sectors ({length}) than present in track ({_track.Sectors}), won't cross tracks"); uint sectorOffset; uint sectorSize; diff --git a/DiscImageChef.DiscImages/Parallels.cs b/DiscImageChef.DiscImages/Parallels.cs index 31d0e4c8f..94fbf2d51 100644 --- a/DiscImageChef.DiscImages/Parallels.cs +++ b/DiscImageChef.DiscImages/Parallels.cs @@ -233,7 +233,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(empty) return new byte[512]; @@ -269,7 +269,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); diff --git a/DiscImageChef.DiscImages/PartClone.cs b/DiscImageChef.DiscImages/PartClone.cs index b54e4acf1..b8a8828b2 100644 --- a/DiscImageChef.DiscImages/PartClone.cs +++ b/DiscImageChef.DiscImages/PartClone.cs @@ -262,7 +262,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(byteMap[sectorAddress] == 0) return new byte[pHdr.blockSize]; @@ -287,7 +287,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); diff --git a/DiscImageChef.DiscImages/Partimage.cs b/DiscImageChef.DiscImages/Partimage.cs index 3c8a4fd17..1809d0723 100644 --- a/DiscImageChef.DiscImages/Partimage.cs +++ b/DiscImageChef.DiscImages/Partimage.cs @@ -566,7 +566,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if((bitmap[sectorAddress / 8] & (1 << (int)(sectorAddress % 8))) == 0) return new byte[ImageInfo.SectorSize]; @@ -604,7 +604,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); diff --git a/DiscImageChef.DiscImages/QCOW.cs b/DiscImageChef.DiscImages/QCOW.cs index 4027bc8b1..ef1d6d586 100644 --- a/DiscImageChef.DiscImages/QCOW.cs +++ b/DiscImageChef.DiscImages/QCOW.cs @@ -299,7 +299,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] sector; @@ -312,9 +312,7 @@ namespace DiscImageChef.DiscImages if((long)l1Off >= l1Table.LongLength) throw new ArgumentOutOfRangeException(nameof(l1Off), - string - .Format("Trying to read past L1 table, position {0} of a max {1}", - l1Off, l1Table.LongLength)); + $"Trying to read past L1 table, position {l1Off} of a max {l1Table.LongLength}"); // TODO: Implement differential images if(l1Table[l1Off] == 0) return new byte[512]; @@ -370,8 +368,7 @@ namespace DiscImageChef.DiscImages if(read != clusterSize) throw new - IOException(string.Format("Unable to decompress cluster, expected {0} bytes got {1}", - clusterSize, read)); + IOException($"Unable to decompress cluster, expected {clusterSize} bytes got {read}"); } else { @@ -399,7 +396,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); diff --git a/DiscImageChef.DiscImages/QCOW2.cs b/DiscImageChef.DiscImages/QCOW2.cs index d7189007b..716308649 100644 --- a/DiscImageChef.DiscImages/QCOW2.cs +++ b/DiscImageChef.DiscImages/QCOW2.cs @@ -243,8 +243,7 @@ namespace DiscImageChef.DiscImages if((qHdr.features & QCOW_FEATURE_MASK) != 0) throw new - ImageNotSupportedException(string.Format("Unknown incompatible features {0:X} enabled, not proceeding.", - qHdr.features & QCOW_FEATURE_MASK)); + ImageNotSupportedException($"Unknown incompatible features {qHdr.features & QCOW_FEATURE_MASK:X} enabled, not proceeding."); } if(qHdr.size <= 1) throw new ArgumentOutOfRangeException(nameof(qHdr.size), "Image size is too small"); @@ -333,7 +332,7 @@ namespace DiscImageChef.DiscImages ImageInfo.XmlMediaType = XmlMediaType.BlockMedia; ImageInfo.MediaType = MediaType.GENERIC_HDD; ImageInfo.ImageSize = qHdr.size; - ImageInfo.ImageVersion = string.Format("{0}", qHdr.version); + ImageInfo.ImageVersion = $"{qHdr.version}"; ImageInfo.Cylinders = (uint)(ImageInfo.Sectors / 16 / 63); ImageInfo.Heads = 16; @@ -346,7 +345,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] sector; @@ -359,9 +358,7 @@ namespace DiscImageChef.DiscImages if((long)l1Off >= l1Table.LongLength) throw new ArgumentOutOfRangeException(nameof(l1Off), - string - .Format("Trying to read past L1 table, position {0} of a max {1}", - l1Off, l1Table.LongLength)); + $"Trying to read past L1 table, position {l1Off} of a max {l1Table.LongLength}"); // TODO: Implement differential images if(l1Table[l1Off] == 0) return new byte[512]; @@ -418,8 +415,7 @@ namespace DiscImageChef.DiscImages if(read != clusterSize) throw new - IOException(string.Format("Unable to decompress cluster, expected {0} bytes got {1}", - clusterSize, read)); + IOException($"Unable to decompress cluster, expected {clusterSize} bytes got {read}"); } else { @@ -447,7 +443,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); diff --git a/DiscImageChef.DiscImages/QED.cs b/DiscImageChef.DiscImages/QED.cs index 54a16fdaa..10133d900 100644 --- a/DiscImageChef.DiscImages/QED.cs +++ b/DiscImageChef.DiscImages/QED.cs @@ -235,8 +235,7 @@ namespace DiscImageChef.DiscImages if((qHdr.features & QED_FEATURE_MASK) > 0) throw new ArgumentOutOfRangeException(nameof(qHdr.features), - string.Format("Image uses unknown incompatible features {0:X}", - qHdr.features & QED_FEATURE_MASK)); + $"Image uses unknown incompatible features {qHdr.features & QED_FEATURE_MASK:X}"); if((qHdr.features & QED_FEATURE_BACKING_FILE) == QED_FEATURE_BACKING_FILE) throw new NotImplementedException("Differencing images not yet supported"); @@ -308,7 +307,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] sector; @@ -321,9 +320,7 @@ namespace DiscImageChef.DiscImages if((long)l1Off >= l1Table.LongLength) throw new ArgumentOutOfRangeException(nameof(l1Off), - string - .Format("Trying to read past L1 table, position {0} of a max {1}", - l1Off, l1Table.LongLength)); + $"Trying to read past L1 table, position {l1Off} of a max {l1Table.LongLength}"); // TODO: Implement differential images if(l1Table[l1Off] == 0) return new byte[512]; @@ -379,7 +376,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); diff --git a/DiscImageChef.DiscImages/RayDIM.cs b/DiscImageChef.DiscImages/RayDIM.cs index a26588e13..7236b881b 100644 --- a/DiscImageChef.DiscImages/RayDIM.cs +++ b/DiscImageChef.DiscImages/RayDIM.cs @@ -154,8 +154,7 @@ namespace DiscImageChef.DiscImages if(!sm.Success) return false; - ImageInfo.ImageApplicationVersion = - string.Format("{0}.{1}", sm.Groups["major"].Value, sm.Groups["minor"].Value); + ImageInfo.ImageApplicationVersion = $"{sm.Groups["major"].Value}.{sm.Groups["minor"].Value}"; ImageInfo.Cylinders = (uint)(header.cylinders + 1); ImageInfo.Heads = (uint)(header.heads + 1); diff --git a/DiscImageChef.DiscImages/RsIde.cs b/DiscImageChef.DiscImages/RsIde.cs index 9caa89823..efae09349 100644 --- a/DiscImageChef.DiscImages/RsIde.cs +++ b/DiscImageChef.DiscImages/RsIde.cs @@ -130,7 +130,7 @@ namespace DiscImageChef.DiscImages ImageInfo.ImageLastModificationTime = imageFilter.GetLastWriteTime(); ImageInfo.ImageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); ImageInfo.XmlMediaType = XmlMediaType.BlockMedia; - ImageInfo.ImageVersion = string.Format("{0}.{1}", hdr.revision >> 8, hdr.revision & 0x0F); + ImageInfo.ImageVersion = $"{hdr.revision >> 8}.{hdr.revision & 0x0F}"; if(!ArrayHelpers.ArrayIsNullOrEmpty(hdr.identify)) { diff --git a/DiscImageChef.DiscImages/SuperCardPro.cs b/DiscImageChef.DiscImages/SuperCardPro.cs index bc607a2dd..35701681a 100644 --- a/DiscImageChef.DiscImages/SuperCardPro.cs +++ b/DiscImageChef.DiscImages/SuperCardPro.cs @@ -384,13 +384,10 @@ namespace DiscImageChef.DiscImages ImageInfo.ImageLastModificationTime); ImageInfo.ImageApplicationVersion = - string.Format("{0}.{1}", (footer.applicationVersion & 0xF0) >> 4, - footer.applicationVersion & 0xF); + $"{(footer.applicationVersion & 0xF0) >> 4}.{footer.applicationVersion & 0xF}"; ImageInfo.DriveFirmwareRevision = - string.Format("{0}.{1}", (footer.firmwareVersion & 0xF0) >> 4, - footer.firmwareVersion & 0xF); - ImageInfo.ImageVersion = - string.Format("{0}.{1}", (footer.imageVersion & 0xF0) >> 4, footer.imageVersion & 0xF); + $"{(footer.firmwareVersion & 0xF0) >> 4}.{footer.firmwareVersion & 0xF}"; + ImageInfo.ImageVersion = $"{(footer.imageVersion & 0xF0) >> 4}.{footer.imageVersion & 0xF}"; break; } @@ -401,8 +398,7 @@ namespace DiscImageChef.DiscImages else { ImageInfo.ImageApplication = "SuperCardPro"; - ImageInfo.ImageApplicationVersion = - string.Format("{0}.{1}", (Header.version & 0xF0) >> 4, Header.version & 0xF); + ImageInfo.ImageApplicationVersion = $"{(Header.version & 0xF0) >> 4}.{Header.version & 0xF}"; ImageInfo.ImageCreationTime = imageFilter.GetCreationTime(); ImageInfo.ImageLastModificationTime = imageFilter.GetLastWriteTime(); ImageInfo.ImageVersion = "1.5"; diff --git a/DiscImageChef.DiscImages/TeleDisk.cs b/DiscImageChef.DiscImages/TeleDisk.cs index f0c327d21..75aefd0ec 100644 --- a/DiscImageChef.DiscImages/TeleDisk.cs +++ b/DiscImageChef.DiscImages/TeleDisk.cs @@ -312,7 +312,7 @@ namespace DiscImageChef.DiscImages header.Crc = BitConverter.ToUInt16(headerBytes, 10); ImageInfo.ImageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename()); - ImageInfo.ImageVersion = string.Format("{0}.{1}", (header.Version & 0xF0) >> 4, header.Version & 0x0F); + ImageInfo.ImageVersion = $"{(header.Version & 0xF0) >> 4}.{header.Version & 0x0F}"; ImageInfo.ImageApplication = ImageInfo.ImageVersion; byte[] headerBytesForCrc = new byte[10]; @@ -927,7 +927,7 @@ namespace DiscImageChef.DiscImages decodedData = new byte[8192]; break; default: - throw new ImageNotSupportedException(string.Format("Sector size {0} is incorrect.", sectorSize)); + throw new ImageNotSupportedException($"Sector size {sectorSize} is incorrect."); } switch(encodingType) @@ -1006,8 +1006,7 @@ namespace DiscImageChef.DiscImages break; } default: - throw new ImageNotSupportedException(string.Format("Data encoding {0} is incorrect.", - encodingType)); + throw new ImageNotSupportedException($"Data encoding {encodingType} is incorrect."); } return decodedData; diff --git a/DiscImageChef.DiscImages/UDIF.cs b/DiscImageChef.DiscImages/UDIF.cs index f2ca7bf45..1bade583f 100644 --- a/DiscImageChef.DiscImages/UDIF.cs +++ b/DiscImageChef.DiscImages/UDIF.cs @@ -368,9 +368,9 @@ namespace DiscImageChef.DiscImages string dev = null; string pre = null; - major = string.Format("{0}", version.MajorVersion); - minor = string.Format(".{0}", version.MinorVersion / 10); - if(version.MinorVersion % 10 > 0) release = string.Format(".{0}", version.MinorVersion % 10); + major = $"{version.MajorVersion}"; + minor = $".{version.MinorVersion / 10}"; + if(version.MinorVersion % 10 > 0) release = $".{version.MinorVersion % 10}"; switch(version.DevStage) { case Version.DevelopmentStage.Alpha: @@ -386,9 +386,9 @@ namespace DiscImageChef.DiscImages if(dev == null && version.PreReleaseVersion > 0) dev = "f"; - if(dev != null) pre = string.Format("{0}", version.PreReleaseVersion); + if(dev != null) pre = $"{version.PreReleaseVersion}"; - ImageInfo.ImageApplicationVersion = string.Format("{0}{1}{2}{3}{4}", major, minor, release, dev, pre); + ImageInfo.ImageApplicationVersion = $"{major}{minor}{release}{dev}{pre}"; ImageInfo.ImageApplication = version.VersionString; ImageInfo.ImageComments = version.VersionMessage; @@ -475,8 +475,7 @@ namespace DiscImageChef.DiscImages if(bChnk.type > CHUNK_TYPE_NOCOPY && bChnk.type < CHUNK_TYPE_COMMNT || bChnk.type > CHUNK_TYPE_LZFSE && bChnk.type < CHUNK_TYPE_END) - throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", - bChnk.type)); + throw new ImageNotSupportedException($"Unsupported chunk type 0x{bChnk.type:X8} found"); if(bChnk.sectors > 0) chunks.Add(bChnk.sector, bChnk); } @@ -495,7 +494,7 @@ namespace DiscImageChef.DiscImages ImageInfo.XmlMediaType = XmlMediaType.BlockMedia; ImageInfo.MediaType = MediaType.GENERIC_HDD; ImageInfo.ImageSize = ImageInfo.Sectors * SECTOR_SIZE; - ImageInfo.ImageVersion = string.Format("{0}", footer.version); + ImageInfo.ImageVersion = $"{footer.version}"; ImageInfo.Cylinders = (uint)(ImageInfo.Sectors / 16 / 63); ImageInfo.Heads = 16; @@ -508,7 +507,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] sector; @@ -528,13 +527,11 @@ namespace DiscImageChef.DiscImages if(relOff < 0) throw new ArgumentOutOfRangeException(nameof(relOff), - string - .Format("Got a negative offset for sector {0}. This should not happen.", - sectorAddress)); + $"Got a negative offset for sector {sectorAddress}. This should not happen."); if(!chunkFound) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if((currentChunk.type & CHUNK_TYPE_COMPRESSED_MASK) == CHUNK_TYPE_COMPRESSED_MASK) { @@ -555,8 +552,7 @@ namespace DiscImageChef.DiscImages case CHUNK_TYPE_BZIP: decStream = new BZip2Stream(cmpMs, CompressionMode.Decompress); break; default: - throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", - currentChunk.type)); + throw new ImageNotSupportedException($"Unsupported chunk type 0x{currentChunk.type:X8} found"); } #if DEBUG @@ -616,15 +612,14 @@ namespace DiscImageChef.DiscImages return sector; } - throw new ImageNotSupportedException(string.Format("Unsupported chunk type 0x{0:X8} found", - currentChunk.type)); + throw new ImageNotSupportedException($"Unsupported chunk type 0x{currentChunk.type:X8} found"); } public override byte[] ReadSectors(ulong sectorAddress, uint length) { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); diff --git a/DiscImageChef.DiscImages/VDI.cs b/DiscImageChef.DiscImages/VDI.cs index 69e9c31ff..f6a7d50fe 100644 --- a/DiscImageChef.DiscImages/VDI.cs +++ b/DiscImageChef.DiscImages/VDI.cs @@ -206,7 +206,7 @@ namespace DiscImageChef.DiscImages ImageInfo.XmlMediaType = XmlMediaType.BlockMedia; ImageInfo.MediaType = MediaType.GENERIC_HDD; ImageInfo.ImageComments = vHdr.description; - ImageInfo.ImageVersion = string.Format("{0}.{1}", vHdr.majorVersion, vHdr.minorVersion); + ImageInfo.ImageVersion = $"{vHdr.majorVersion}.{vHdr.minorVersion}"; switch(vHdr.creator) { @@ -241,7 +241,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] sector; @@ -274,13 +274,11 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), - string - .Format("Requested more sectors ({0} + {1}) than available ({2})", - sectorAddress, length, ImageInfo.Sectors)); + $"Requested more sectors ({sectorAddress} + {length}) than available ({ImageInfo.Sectors})"); MemoryStream ms = new MemoryStream(); diff --git a/DiscImageChef.DiscImages/VHD.cs b/DiscImageChef.DiscImages/VHD.cs index c047baf5b..5243c76ed 100644 --- a/DiscImageChef.DiscImages/VHD.cs +++ b/DiscImageChef.DiscImages/VHD.cs @@ -529,8 +529,7 @@ namespace DiscImageChef.DiscImages if(thisFooter.Version == VERSION1) ImageInfo.ImageVersion = "1.0"; else throw new - ImageNotSupportedException(string.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", - thisFooter.DiskType)); + ImageNotSupportedException($"(VirtualPC plugin): Unknown image type {thisFooter.DiskType} found. Please submit a bug with an example image."); switch(thisFooter.CreatorApplication) { @@ -544,9 +543,8 @@ namespace DiscImageChef.DiscImages } case CREATOR_VIRTUAL_BOX: { - ImageInfo.ImageApplicationVersion = string.Format("{0}.{1:D2}", - (thisFooter.CreatorVersion & 0xFFFF0000) >> 16, - thisFooter.CreatorVersion & 0x0000FFFF); + ImageInfo.ImageApplicationVersion = + $"{(thisFooter.CreatorVersion & 0xFFFF0000) >> 16}.{thisFooter.CreatorVersion & 0x0000FFFF:D2}"; switch(thisFooter.CreatorHostOs) { case CREATOR_MACINTOSH: @@ -558,10 +556,8 @@ namespace DiscImageChef.DiscImages ImageInfo.ImageApplication = "VirtualBox"; break; default: - ImageInfo.ImageApplication = string.Format("VirtualBox for unknown OS \"{0}\"", - Encoding.ASCII.GetString(BigEndianBitConverter - .GetBytes(thisFooter - .CreatorHostOs))); + ImageInfo.ImageApplication = + $"VirtualBox for unknown OS \"{Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(thisFooter.CreatorHostOs))}\""; break; } @@ -576,8 +572,7 @@ namespace DiscImageChef.DiscImages ImageInfo.ImageApplicationVersion = "2004"; break; default: - ImageInfo.ImageApplicationVersion = - string.Format("Unknown version 0x{0:X8}", thisFooter.CreatorVersion); + ImageInfo.ImageApplicationVersion = $"Unknown version 0x{thisFooter.CreatorVersion:X8}"; break; } @@ -597,7 +592,7 @@ namespace DiscImageChef.DiscImages break; default: ImageInfo.ImageApplicationVersion = - string.Format("Unknown version 0x{0:X8}", thisFooter.CreatorVersion); + $"Unknown version 0x{thisFooter.CreatorVersion:X8}"; break; } @@ -619,18 +614,15 @@ namespace DiscImageChef.DiscImages break; default: ImageInfo.ImageApplicationVersion = - string.Format("Unknown version 0x{0:X8}", thisFooter.CreatorVersion); + $"Unknown version 0x{thisFooter.CreatorVersion:X8}"; break; } break; default: - ImageInfo.ImageApplication = string.Format("Virtual PC for unknown OS \"{0}\"", - Encoding.ASCII.GetString(BigEndianBitConverter - .GetBytes(thisFooter - .CreatorHostOs))); - ImageInfo.ImageApplicationVersion = - string.Format("Unknown version 0x{0:X8}", thisFooter.CreatorVersion); + ImageInfo.ImageApplication = + $"Virtual PC for unknown OS \"{Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(thisFooter.CreatorHostOs))}\""; + ImageInfo.ImageApplicationVersion = $"Unknown version 0x{thisFooter.CreatorVersion:X8}"; break; } @@ -638,12 +630,9 @@ namespace DiscImageChef.DiscImages } default: { - ImageInfo.ImageApplication = string.Format("Unknown application \"{0}\"", - Encoding.ASCII.GetString(BigEndianBitConverter - .GetBytes(thisFooter - .CreatorHostOs))); - ImageInfo.ImageApplicationVersion = - string.Format("Unknown version 0x{0:X8}", thisFooter.CreatorVersion); + ImageInfo.ImageApplication = + $"Unknown application \"{Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(thisFooter.CreatorHostOs))}\""; + ImageInfo.ImageApplicationVersion = $"Unknown version 0x{thisFooter.CreatorVersion:X8}"; break; } } @@ -764,8 +753,7 @@ namespace DiscImageChef.DiscImages if(thisDynamic.HeaderVersion != VERSION1) throw new - ImageNotSupportedException(string.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", - thisFooter.DiskType)); + ImageNotSupportedException($"(VirtualPC plugin): Unknown image type {thisFooter.DiskType} found. Please submit a bug with an example image."); DateTime startTime = DateTime.UtcNow; @@ -964,8 +952,7 @@ namespace DiscImageChef.DiscImages default: { throw new - ImageNotSupportedException(string.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", - thisFooter.DiskType)); + ImageNotSupportedException($"(VirtualPC plugin): Unknown image type {thisFooter.DiskType} found. Please submit a bug with an example image."); } } } @@ -1198,8 +1185,7 @@ namespace DiscImageChef.DiscImages default: { throw new - ImageNotSupportedException(string.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", - thisFooter.DiskType)); + ImageNotSupportedException($"(VirtualPC plugin): Unknown image type {thisFooter.DiskType} found. Please submit a bug with an example image."); } } } diff --git a/DiscImageChef.DiscImages/VHDX.cs b/DiscImageChef.DiscImages/VHDX.cs index 4c9b83ce9..dd2bf9fe4 100644 --- a/DiscImageChef.DiscImages/VHDX.cs +++ b/DiscImageChef.DiscImages/VHDX.cs @@ -455,8 +455,7 @@ namespace DiscImageChef.DiscImages else if(vRegs[i].guid == metadataGuid) metadataOffset = (long)vRegs[i].offset; else if((vRegs[i].flags & REGION_FLAGS_REQUIRED) == REGION_FLAGS_REQUIRED) throw new - ImageNotSupportedException(string.Format("Found unsupported and required region Guid {0}, not proceeding with image.", - vRegs[i].guid)); + ImageNotSupportedException($"Found unsupported and required region Guid {vRegs[i].guid}, not proceeding with image."); } if(batOffset == 0) throw new Exception("BAT not found, cannot continue."); @@ -493,8 +492,7 @@ namespace DiscImageChef.DiscImages else if(vMets[i].itemId == parentLocatorGuid) parentOff = vMets[i].offset; else if((vMets[i].flags & METADATA_FLAGS_REQUIRED) == METADATA_FLAGS_REQUIRED) throw new - ImageNotSupportedException(string.Format("Found unsupported and required metadata Guid {0}, not proceeding with image.", - vMets[i].itemId)); + ImageNotSupportedException($"Found unsupported and required metadata Guid {vMets[i].itemId}, not proceeding with image."); } byte[] tmp; @@ -558,8 +556,7 @@ namespace DiscImageChef.DiscImages if(vParHdr.locatorType != parentTypeVhdxGuid) throw new - ImageNotSupportedException(string.Format("Found unsupported and required parent locator type {0}, not proceeding with image.", - vParHdr.locatorType)); + ImageNotSupportedException($"Found unsupported and required parent locator type {vParHdr.locatorType}, not proceeding with image."); vPars = new VhdxParentLocatorEntry[vParHdr.keyValueCount]; for(int i = 0; i < vPars.Length; i++) @@ -705,9 +702,7 @@ namespace DiscImageChef.DiscImages default: if((pt & BAT_FLAGS_MASK) != 0) throw new - ImageNotSupportedException(string - .Format("Unsupported sector bitmap block flags (0x{0:X16}) found, not proceeding.", - pt & BAT_FLAGS_MASK)); + ImageNotSupportedException($"Unsupported sector bitmap block flags (0x{pt & BAT_FLAGS_MASK:X16}) found, not proceeding."); break; } @@ -823,7 +818,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] sector; @@ -836,8 +831,7 @@ namespace DiscImageChef.DiscImages ulong blkFlags = blkPtr & BAT_FLAGS_MASK; if((blkPtr & BAT_RESERVED_MASK) != 0) - throw new ImageNotSupportedException(string.Format("Unknown flags (0x{0:X16}) set in block pointer", - blkPtr & BAT_RESERVED_MASK)); + throw new ImageNotSupportedException($"Unknown flags (0x{blkPtr & BAT_RESERVED_MASK:X16}) set in block pointer"); switch(blkFlags & BAT_FLAGS_MASK) { case PAYLOAD_BLOCK_NOT_PRESENT: return hasParent ? parentImage.ReadSector(sectorAddress) : new byte[logicalSectorSize]; @@ -878,12 +872,11 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), - string.Format("Requested more sectors ({0}) than available ({1})", - sectorAddress + length, ImageInfo.Sectors)); + $"Requested more sectors ({sectorAddress + length}) than available ({ImageInfo.Sectors})"); MemoryStream ms = new MemoryStream(); diff --git a/DiscImageChef.DiscImages/VMware.cs b/DiscImageChef.DiscImages/VMware.cs index 44824da75..96cfc716b 100644 --- a/DiscImageChef.DiscImages/VMware.cs +++ b/DiscImageChef.DiscImages/VMware.cs @@ -338,7 +338,7 @@ namespace DiscImageChef.DiscImages { string curPath; if(cowCount == 1) curPath = basePath + ".vmdk"; - else curPath = string.Format("{0}-{1:D2}.vmdk", basePath, cowCount); + else curPath = $"{basePath}-{cowCount:D2}.vmdk"; if(!File.Exists(curPath)) break; @@ -509,8 +509,7 @@ namespace DiscImageChef.DiscImages throw new ImageNotSupportedException("Raw device image files are not supported, try accessing the device directly."); default: - throw new ImageNotSupportedException(string.Format("Dunno how to handle \"{0}\" extents.", - imageType)); + throw new ImageNotSupportedException($"Dunno how to handle \"{imageType}\" extents."); } bool oneNoFlat = false || cowD; @@ -518,7 +517,7 @@ namespace DiscImageChef.DiscImages foreach(VMwareExtent extent in extents.Values) { if(extent.Filter == null) - throw new Exception(string.Format("Extent file {0} not found.", extent.Filename)); + throw new Exception($"Extent file {extent.Filename} not found."); if(extent.Access == "NOACCESS") throw new Exception("Cannot access NOACCESS extents ;)."); @@ -528,7 +527,7 @@ namespace DiscImageChef.DiscImages extentStream.Seek(0, SeekOrigin.Begin); if(extentStream.Length < SECTOR_SIZE) - throw new Exception(string.Format("Extent {0} is too small.", extent.Filename)); + throw new Exception($"Extent {extent.Filename} is too small."); VMwareExtentHeader extentHdr = new VMwareExtentHeader(); byte[] extentHdrB = new byte[Marshal.SizeOf(extentHdr)]; @@ -539,12 +538,11 @@ namespace DiscImageChef.DiscImages Marshal.FreeHGlobal(extentHdrPtr); if(extentHdr.magic != VMWARE_EXTENT_MAGIC) - throw new Exception(string.Format("{0} is not an VMware extent.", extent.Filter)); + throw new Exception($"{extent.Filter} is not an VMware extent."); if(extentHdr.capacity < extent.Sectors) throw new - Exception(string.Format("Extent contains incorrect number of sectors, {0}. {1} were expected", - extentHdr.capacity, extent.Sectors)); + Exception($"Extent contains incorrect number of sectors, {extentHdr.capacity}. {extent.Sectors} were expected"); // TODO: Support compressed extents if(extentHdr.compression != COMPRESSION_NONE) @@ -673,12 +671,12 @@ namespace DiscImageChef.DiscImages { Filter parentFilter = new FiltersList().GetFilter(Path.Combine(imageFilter.GetParentFolder(), parentName)); - if(parentFilter == null) throw new Exception(string.Format("Cannot find parent \"{0}\".", parentName)); + if(parentFilter == null) throw new Exception($"Cannot find parent \"{parentName}\"."); parentImage = new VMware(); if(!parentImage.OpenImage(parentFilter)) - throw new Exception(string.Format("Cannot open parent \"{0}\".", parentName)); + throw new Exception($"Cannot open parent \"{parentName}\"."); } sectorCache = new Dictionary(); @@ -691,8 +689,8 @@ namespace DiscImageChef.DiscImages ImageInfo.MediaType = MediaType.GENERIC_HDD; ImageInfo.ImageSize = ImageInfo.Sectors * SECTOR_SIZE; // VMDK version 1 started on VMware 4, so there is a previous version, "COWD" - if(cowD) ImageInfo.ImageVersion = string.Format("{0}", version); - else ImageInfo.ImageVersion = string.Format("{0}", version + 3); + if(cowD) ImageInfo.ImageVersion = $"{version}"; + else ImageInfo.ImageVersion = $"{version + 3}"; if(cowD) { @@ -714,7 +712,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); byte[] sector; @@ -732,7 +730,7 @@ namespace DiscImageChef.DiscImages if(!extentFound) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); Stream dataStream; @@ -803,7 +801,7 @@ namespace DiscImageChef.DiscImages { if(sectorAddress > ImageInfo.Sectors - 1) throw new ArgumentOutOfRangeException(nameof(sectorAddress), - string.Format("Sector address {0} not found", sectorAddress)); + $"Sector address {sectorAddress} not found"); if(sectorAddress + length > ImageInfo.Sectors) throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available"); diff --git a/DiscImageChef.Filesystems/Acorn.cs b/DiscImageChef.Filesystems/Acorn.cs index a781a5a73..7050ce6de 100644 --- a/DiscImageChef.Filesystems/Acorn.cs +++ b/DiscImageChef.Filesystems/Acorn.cs @@ -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)) diff --git a/DiscImageChef.Filesystems/AmigaDOS.cs b/DiscImageChef.Filesystems/AmigaDOS.cs index 92864bde2..1c95ca0e5 100644 --- a/DiscImageChef.Filesystems/AmigaDOS.cs +++ b/DiscImageChef.Filesystems/AmigaDOS.cs @@ -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) diff --git a/DiscImageChef.Filesystems/AppleHFS.cs b/DiscImageChef.Filesystems/AppleHFS.cs index 2113e3913..9284063a0 100644 --- a/DiscImageChef.Filesystems/AppleHFS.cs +++ b/DiscImageChef.Filesystems/AppleHFS.cs @@ -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) diff --git a/DiscImageChef.Filesystems/AppleHFSPlus.cs b/DiscImageChef.Filesystems/AppleHFSPlus.cs index 40da88b1f..5a2bc71aa 100644 --- a/DiscImageChef.Filesystems/AppleHFSPlus.cs +++ b/DiscImageChef.Filesystems/AppleHFSPlus.cs @@ -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 diff --git a/DiscImageChef.Filesystems/BTRFS.cs b/DiscImageChef.Filesystems/BTRFS.cs index d28395536..2c7d4dd86 100644 --- a/DiscImageChef.Filesystems/BTRFS.cs +++ b/DiscImageChef.Filesystems/BTRFS.cs @@ -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; } diff --git a/DiscImageChef.Filesystems/CBM.cs b/DiscImageChef.Filesystems/CBM.cs index 8104f7172..a6a20e60c 100644 --- a/DiscImageChef.Filesystems/CBM.cs +++ b/DiscImageChef.Filesystems/CBM.cs @@ -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(); diff --git a/DiscImageChef.Filesystems/CPM/Super.cs b/DiscImageChef.Filesystems/CPM/Super.cs index 52116c220..85a89332b 100644 --- a/DiscImageChef.Filesystems/CPM/Super.cs +++ b/DiscImageChef.Filesystems/CPM/Super.cs @@ -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 diff --git a/DiscImageChef.Filesystems/EFS.cs b/DiscImageChef.Filesystems/EFS.cs index 46743fdc0..c8783ee49 100644 --- a/DiscImageChef.Filesystems/EFS.cs +++ b/DiscImageChef.Filesystems/EFS.cs @@ -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 }; diff --git a/DiscImageChef.Filesystems/FAT.cs b/DiscImageChef.Filesystems/FAT.cs index bcb7a3b31..c9c4b4224 100644 --- a/DiscImageChef.Filesystems/FAT.cs +++ b/DiscImageChef.Filesystems/FAT.cs @@ -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) diff --git a/DiscImageChef.Filesystems/HPFS.cs b/DiscImageChef.Filesystems/HPFS.cs index c1f3cd722..9f355286d 100644 --- a/DiscImageChef.Filesystems/HPFS.cs +++ b/DiscImageChef.Filesystems/HPFS.cs @@ -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(); diff --git a/DiscImageChef.Filesystems/JFS.cs b/DiscImageChef.Filesystems/JFS.cs index 30ced7d26..ce591630e 100644 --- a/DiscImageChef.Filesystems/JFS.cs +++ b/DiscImageChef.Filesystems/JFS.cs @@ -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; diff --git a/DiscImageChef.Filesystems/LisaFS/Info.cs b/DiscImageChef.Filesystems/LisaFS/Info.cs index e67b054d6..1172db66d 100644 --- a/DiscImageChef.Filesystems/LisaFS/Info.cs +++ b/DiscImageChef.Filesystems/LisaFS/Info.cs @@ -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; } diff --git a/DiscImageChef.Filesystems/LisaFS/Super.cs b/DiscImageChef.Filesystems/LisaFS/Super.cs index f24809c1f..9fe734dcb 100644 --- a/DiscImageChef.Filesystems/LisaFS/Super.cs +++ b/DiscImageChef.Filesystems/LisaFS/Super.cs @@ -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; } diff --git a/DiscImageChef.Filesystems/NTFS.cs b/DiscImageChef.Filesystems/NTFS.cs index 5fc02e213..3cad39bab 100644 --- a/DiscImageChef.Filesystems/NTFS.cs +++ b/DiscImageChef.Filesystems/NTFS.cs @@ -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(); diff --git a/DiscImageChef.Filesystems/Nintendo.cs b/DiscImageChef.Filesystems/Nintendo.cs index 076643ddc..fd680241b 100644 --- a/DiscImageChef.Filesystems/Nintendo.cs +++ b/DiscImageChef.Filesystems/Nintendo.cs @@ -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() diff --git a/DiscImageChef.Filesystems/ODS.cs b/DiscImageChef.Filesystems/ODS.cs index e87be1ead..1bf66bafe 100644 --- a/DiscImageChef.Filesystems/ODS.cs +++ b/DiscImageChef.Filesystems/ODS.cs @@ -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) { diff --git a/DiscImageChef.Filesystems/QNX4.cs b/DiscImageChef.Filesystems/QNX4.cs index c7c45646b..3a476268e 100644 --- a/DiscImageChef.Filesystems/QNX4.cs +++ b/DiscImageChef.Filesystems/QNX4.cs @@ -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 { diff --git a/DiscImageChef.Filesystems/QNX6.cs b/DiscImageChef.Filesystems/QNX6.cs index ab7aa83f2..eb83af6df 100644 --- a/DiscImageChef.Filesystems/QNX6.cs +++ b/DiscImageChef.Filesystems/QNX6.cs @@ -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); diff --git a/DiscImageChef.Filesystems/RBF.cs b/DiscImageChef.Filesystems/RBF.cs index 09a8e09ed..b0ad47979 100644 --- a/DiscImageChef.Filesystems/RBF.cs +++ b/DiscImageChef.Filesystems/RBF.cs @@ -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}" }; } diff --git a/DiscImageChef.Filesystems/UDF.cs b/DiscImageChef.Filesystems/UDF.cs index 2c0ed17ee..29581c9e9 100644 --- a/DiscImageChef.Filesystems/UDF.cs +++ b/DiscImageChef.Filesystems/UDF.cs @@ -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; diff --git a/DiscImageChef.Filesystems/ZFS.cs b/DiscImageChef.Filesystems/ZFS.cs index 284ac91ec..a97771fc6 100644 --- a/DiscImageChef.Filesystems/ZFS.cs +++ b/DiscImageChef.Filesystems/ZFS.cs @@ -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 decodedNvList) diff --git a/DiscImageChef.Filesystems/exFAT.cs b/DiscImageChef.Filesystems/exFAT.cs index 2e29934ea..3716e59a4 100644 --- a/DiscImageChef.Filesystems/exFAT.cs +++ b/DiscImageChef.Filesystems/exFAT.cs @@ -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(); } diff --git a/DiscImageChef.Filesystems/ext2FS.cs b/DiscImageChef.Filesystems/ext2FS.cs index c85102e43..35b8ea27a 100644 --- a/DiscImageChef.Filesystems/ext2FS.cs +++ b/DiscImageChef.Filesystems/ext2FS.cs @@ -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; } diff --git a/DiscImageChef.Interop/DetectOS.cs b/DiscImageChef.Interop/DetectOS.cs index 0f5621e35..9e2bd2145 100644 --- a/DiscImageChef.Interop/DetectOS.cs +++ b/DiscImageChef.Interop/DetectOS.cs @@ -86,8 +86,7 @@ namespace DiscImageChef.Interop utsname unixname; int error = uname(out unixname); if(error != 0) - throw new Exception(string.Format("Unhandled exception calling uname: {0}", - Marshal.GetLastWin32Error())); + throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); switch(unixname.sysname) { @@ -110,8 +109,7 @@ namespace DiscImageChef.Interop { Marshal.FreeHGlobal(pLen); - throw new Exception(string.Format("Unhandled exception calling uname: {0}", - Marshal.GetLastWin32Error())); + throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); } int length = Marshal.ReadInt32(pLen); @@ -122,8 +120,7 @@ namespace DiscImageChef.Interop Marshal.FreeHGlobal(pStr); Marshal.FreeHGlobal(pLen); - throw new Exception(string.Format("Unhandled exception calling uname: {0}", - Marshal.GetLastWin32Error())); + throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); } string machine = Marshal.PtrToStringAnsi(pStr); @@ -196,8 +193,7 @@ namespace DiscImageChef.Interop { case PlatformID.MacOSX: if(Environment.OSVersion.Version.Major != 1) - return string.Format("10.{0}.{1}", Environment.OSVersion.Version.Major - 4, - Environment.OSVersion.Version.Minor); + return $"10.{Environment.OSVersion.Version.Major - 4}.{Environment.OSVersion.Version.Minor}"; switch(Environment.OSVersion.Version.Minor) { case 3: return "10.0"; diff --git a/DiscImageChef.Partitions/AppleMap.cs b/DiscImageChef.Partitions/AppleMap.cs index 4d33bd49d..8f361dbbd 100644 --- a/DiscImageChef.Partitions/AppleMap.cs +++ b/DiscImageChef.Partitions/AppleMap.cs @@ -171,7 +171,7 @@ namespace DiscImageChef.Partitions }; if(old_entry.pdFSID == HFS_MAGIC_OLD) part.Type = "Apple_HFS"; - else part.Type = string.Format("0x{0:X8}", old_entry.pdFSID); + else part.Type = $"0x{old_entry.pdFSID:X8}"; partitions.Add(part); diff --git a/DiscImageChef.Partitions/GPT.cs b/DiscImageChef.Partitions/GPT.cs index 319ed537b..a52225b34 100644 --- a/DiscImageChef.Partitions/GPT.cs +++ b/DiscImageChef.Partitions/GPT.cs @@ -166,7 +166,7 @@ namespace DiscImageChef.Partitions Partition part = new Partition { - Description = string.Format("ID: {0}", entry.partitionId), + Description = $"ID: {entry.partitionId}", Size = (entry.endLBA - entry.startLBA + 1) * sectorSize, Name = entry.name, Length = (entry.endLBA - entry.startLBA + 1) / divisor, diff --git a/DiscImageChef.Partitions/MBR.cs b/DiscImageChef.Partitions/MBR.cs index 20f1518d5..64fa1a66e 100644 --- a/DiscImageChef.Partitions/MBR.cs +++ b/DiscImageChef.Partitions/MBR.cs @@ -209,7 +209,7 @@ namespace DiscImageChef.Partitions if(valid) { - part.Type = string.Format("0x{0:X2}", entry.type); + part.Type = $"0x{entry.type:X2}"; part.Name = DecodeMBRType(entry.type); part.Sequence = counter; part.Description = entry.status == 0x80 ? "Partition is bootable." : ""; @@ -326,7 +326,7 @@ namespace DiscImageChef.Partitions if(!ext_valid) continue; - part.Type = string.Format("0x{0:X2}", ebr_entry.type); + part.Type = $"0x{ebr_entry.type:X2}"; part.Name = DecodeMBRType(ebr_entry.type); part.Sequence = counter; part.Description = ebr_entry.status == 0x80 ? "Partition is bootable." : ""; diff --git a/DiscImageChef.Partitions/RDB.cs b/DiscImageChef.Partitions/RDB.cs index a6fcec9fb..48b581f29 100644 --- a/DiscImageChef.Partitions/RDB.cs +++ b/DiscImageChef.Partitions/RDB.cs @@ -1453,44 +1453,37 @@ namespace DiscImageChef.Partitions default: { if((amigaDosType & TYPEID_OFS) == TYPEID_OFS) - return string.Format("Unknown Amiga DOS filesystem type {0}", - AmigaDosTypeToString(amigaDosType)); + return $"Unknown Amiga DOS filesystem type {AmigaDosTypeToString(amigaDosType)}"; if((amigaDosType & TypeID_AMIXSysV) == TypeID_AMIXSysV) - return string.Format("Unknown Amiga UNIX filesystem type {0}", - AmigaDosTypeToString(amigaDosType)); + return $"Unknown Amiga UNIX filesystem type {AmigaDosTypeToString(amigaDosType)}"; if((amigaDosType & 0x50465300) == 0x50465300 || (amigaDosType & 0x41465300) == 0x41465300) - return string.Format("Unknown ProfessionalFileSystem type {0}", - AmigaDosTypeToString(amigaDosType)); + return $"Unknown ProfessionalFileSystem type {AmigaDosTypeToString(amigaDosType)}"; if((amigaDosType & TYPEID_SFS) == TYPEID_SFS) - return string.Format("Unknown SmartFileSystem type {0}", AmigaDosTypeToString(amigaDosType)); + return $"Unknown SmartFileSystem type {AmigaDosTypeToString(amigaDosType)}"; if((amigaDosType & TYPEID_OFS_MUSER) == TYPEID_OFS_MUSER) - return string.Format("Unknown Amiga DOS multi-user filesystem type {0}", - AmigaDosTypeToString(amigaDosType)); + return $"Unknown Amiga DOS multi-user filesystem type {AmigaDosTypeToString(amigaDosType)}"; if((amigaDosType & TYPEID_OLD_BSD_UNUSED) == TYPEID_OLD_BSD_UNUSED) - return string.Format("Unknown BSD filesystem type {0}", AmigaDosTypeToString(amigaDosType)); + return $"Unknown BSD filesystem type {AmigaDosTypeToString(amigaDosType)}"; if((amigaDosType & TYPEID_NETBSD_ROOT_UNUSED) == TYPEID_NETBSD_ROOT_UNUSED) - return string.Format("Unknown NetBSD root filesystem type {0}", - AmigaDosTypeToString(amigaDosType)); + return $"Unknown NetBSD root filesystem type {AmigaDosTypeToString(amigaDosType)}"; if((amigaDosType & TYPEID_NETBSD_USER_UNUSED) == TYPEID_NETBSD_USER_UNUSED) - return string.Format("Unknown NetBSD user filesystem type {0}", - AmigaDosTypeToString(amigaDosType)); + return $"Unknown NetBSD user filesystem type {AmigaDosTypeToString(amigaDosType)}"; if((amigaDosType & TYPEID_NETBSD_SWAP) == TYPEID_NETBSD_SWAP) - return string.Format("Unknown NetBSD swap filesystem type {0}", - AmigaDosTypeToString(amigaDosType)); + return $"Unknown NetBSD swap filesystem type {AmigaDosTypeToString(amigaDosType)}"; if((amigaDosType & TYPEID_LINUX) == TYPEID_LINUX || (amigaDosType & TYPEID_LINUX_SWAP) == TYPEID_LINUX_SWAP) - return string.Format("Unknown Linux filesystem type {0}", AmigaDosTypeToString(amigaDosType)); + return $"Unknown Linux filesystem type {AmigaDosTypeToString(amigaDosType)}"; - return string.Format("Unknown partition type {0}", AmigaDosTypeToString(amigaDosType)); + return $"Unknown partition type {AmigaDosTypeToString(amigaDosType)}"; } } } @@ -1512,8 +1505,8 @@ namespace DiscImageChef.Partitions textPartString = Encoding.ASCII.GetString(textPart); return quoted - ? string.Format("\"{0}\\{1}\"", textPartString, amigaDosType & 0xFF) - : string.Format("{0}\\{1}", textPartString, amigaDosType & 0xFF); + ? $"\"{textPartString}\\{amigaDosType & 0xFF}\"" + : $"{textPartString}\\{amigaDosType & 0xFF}"; } } } \ No newline at end of file diff --git a/DiscImageChef.Partitions/Sun.cs b/DiscImageChef.Partitions/Sun.cs index 899b91315..9377b851e 100644 --- a/DiscImageChef.Partitions/Sun.cs +++ b/DiscImageChef.Partitions/Sun.cs @@ -272,9 +272,8 @@ namespace DiscImageChef.Partitions Scheme = Name }; if(dkl8.dkl_vtoc.v_timestamp[i] != 0) - part.Description += string.Format("\nPartition timestamped on {0}", - DateHandlers - .UNIXToDateTime(dkl8.dkl_vtoc.v_timestamp[i])); + part.Description += + $"\nPartition timestamped on {DateHandlers.UNIXToDateTime(dkl8.dkl_vtoc.v_timestamp[i])}"; if(part.Start < imagePlugin.GetSectors() && part.End <= imagePlugin.GetSectors()) partitions.Add(part); @@ -342,9 +341,8 @@ namespace DiscImageChef.Partitions Scheme = Name }; if(dkl16.dkl_vtoc.v_timestamp[i] != 0) - part.Description += string.Format("\nPartition timestamped on {0}", - DateHandlers - .UNIXToDateTime(dkl16.dkl_vtoc.v_timestamp[i])); + part.Description += + $"\nPartition timestamped on {DateHandlers.UNIXToDateTime(dkl16.dkl_vtoc.v_timestamp[i])}"; if(part.Start < imagePlugin.GetSectors() && part.End <= imagePlugin.GetSectors()) partitions.Add(part); } diff --git a/DiscImageChef.Partitions/VTOC.cs b/DiscImageChef.Partitions/VTOC.cs index bd964dba2..28b10140f 100644 --- a/DiscImageChef.Partitions/VTOC.cs +++ b/DiscImageChef.Partitions/VTOC.cs @@ -334,7 +334,7 @@ namespace DiscImageChef.Partitions Offset = (ulong)(parts[i].p_start * bps), Size = (ulong)(parts[i].p_size * bps), Sequence = (ulong)i, - Type = string.Format("UNIX: {0}", decodeUNIXTAG(parts[i].p_tag, !useOld)), + Type = $"UNIX: {decodeUNIXTAG(parts[i].p_tag, !useOld)}", Scheme = Name }; string info = ""; @@ -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 += string.Format(" created on {0}", DateHandlers.UNIXToDateTime(timestamps[i])); + info += $" created on {DateHandlers.UNIXToDateTime(timestamps[i])}"; part.Description = "UNIX slice" + info + "."; @@ -544,7 +544,7 @@ namespace DiscImageChef.Partitions case pTag.V_ALTSCTR: return "Alternate sector track"; case pTag.V_VMPUBLIC: return "volume mgt public partition"; case pTag.V_VMPRIVATE: return "volume mgt private partition"; - default: return string.Format("Unknown TAG: 0x{0:X4}", type); + default: return $"Unknown TAG: 0x{type:X4}"; } } } diff --git a/DiscImageChef.Server/App_Start/Ata.cs b/DiscImageChef.Server/App_Start/Ata.cs index a3cdebfe4..78c02e7d3 100644 --- a/DiscImageChef.Server/App_Start/Ata.cs +++ b/DiscImageChef.Server/App_Start/Ata.cs @@ -320,7 +320,7 @@ namespace DiscImageChef.Server.App_Start tmpString = "ACS-3 Revision 4"; break; default: - tmpString = string.Format("Unknown ATA revision 0x{0:X4}", ataReport.MinorVersion); + tmpString = $"Unknown ATA revision 0x{ataReport.MinorVersion:X4}"; break; } @@ -352,7 +352,7 @@ namespace DiscImageChef.Server.App_Start break; default: ataTwoValue.Add("Unknown transport type", - string.Format("0x{0:X1}", (ataReport.TransportMajorVersion & 0xF000) >> 12)); + $"0x{(ataReport.TransportMajorVersion & 0xF000) >> 12:X1}"); break; } } @@ -426,8 +426,7 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add("ATAPI Unknown or no device type"); break; default: - ataOneValue.Add(string.Format("ATAPI Unknown device type field value 0x{0:X2}", - ((ushort)ataReport.GeneralConfiguration & 0x1F00) >> 8)); + ataOneValue.Add($"ATAPI Unknown device type field value 0x{((ushort)ataReport.GeneralConfiguration & 0x1F00) >> 8:X2}"); break; } @@ -444,8 +443,7 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add("Device shall set DRQ within 50 µs of receiving PACKET"); break; default: - ataOneValue.Add(string.Format("Unknown ATAPI DRQ behaviour code {0}", - ((ushort)ataReport.GeneralConfiguration & 0x60) >> 5)); + ataOneValue.Add($"Unknown ATAPI DRQ behaviour code {((ushort)ataReport.GeneralConfiguration & 0x60) >> 5}"); break; } @@ -459,8 +457,7 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add("ATAPI device uses 16 byte command packet"); break; default: - ataOneValue.Add(string.Format("Unknown ATAPI packet size code {0}", - (ushort)ataReport.GeneralConfiguration & 0x03)); + ataOneValue.Add($"Unknown ATAPI packet size code {(ushort)ataReport.GeneralConfiguration & 0x03}"); break; } } @@ -529,8 +526,7 @@ namespace DiscImageChef.Server.App_Start .Add("Device does not require SET FEATURES to spin up and IDENTIFY DEVICE response is complete."); break; default: - ataOneValue.Add(string.Format("Unknown device specific configuration 0x{0:X4}", - (ushort)ataReport.SpecificConfiguration)); + ataOneValue.Add($"Unknown device specific configuration 0x{(ushort)ataReport.SpecificConfiguration:X4}"); break; } @@ -540,21 +536,16 @@ namespace DiscImageChef.Server.App_Start switch(ataReport.BufferType) { case 1: - ataOneValue.Add(string.Format("{0} KiB of single ported single sector buffer", - ataReport.BufferSize * logicalsectorsize / 1024)); + ataOneValue.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of single ported single sector buffer"); break; case 2: - ataOneValue.Add(string.Format("{0} KiB of dual ported multi sector buffer", - ataReport.BufferSize * logicalsectorsize / 1024)); + ataOneValue.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer"); break; case 3: - ataOneValue.Add(string.Format("{0} KiB of dual ported multi sector buffer with read caching", - ataReport.BufferSize * logicalsectorsize / 1024)); + ataOneValue.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of dual ported multi sector buffer with read caching"); break; default: - ataOneValue.Add(string.Format("{0} KiB of unknown type {1} buffer", - ataReport.BufferSize * logicalsectorsize / 1024, - ataReport.BufferType)); + ataOneValue.Add($"{ataReport.BufferSize * logicalsectorsize / 1024} KiB of unknown type {ataReport.BufferType} buffer"); break; } @@ -570,8 +561,7 @@ namespace DiscImageChef.Server.App_Start if(ataReport.Capabilities.HasFlag(CapabilitiesBit.DMASupport)) ataOneValue.Add("DMA is supported"); if(ataReport.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment1) || ataReport.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment0)) - ataOneValue.Add(string.Format("Long Physical Alignment setting is {0}", - (ushort)ataReport.Capabilities & 0x03)); + ataOneValue.Add($"Long Physical Alignment setting is {(ushort)ataReport.Capabilities & 0x03}"); if(atapi) { if(ataReport.Capabilities.HasFlag(CapabilitiesBit.InterleavedDMA)) @@ -595,10 +585,8 @@ namespace DiscImageChef.Server.App_Start if(ataReport.Capabilities3.HasFlag(CapabilitiesBit3.MultipleValid)) { ataOneValue - .Add(string.Format("A maximum of {0} sectors can be transferred per interrupt on READ/WRITE MULTIPLE", - ataReport.MultipleSectorNumber)); - ataOneValue.Add(string.Format("Device supports setting a maximum of {0} sectors", - ataReport.MultipleMaxSectors)); + .Add($"A maximum of {ataReport.MultipleSectorNumber} sectors can be transferred per interrupt on READ/WRITE MULTIPLE"); + ataOneValue.Add($"Device supports setting a maximum of {ataReport.MultipleMaxSectors} sectors"); } if(ata1 && ataReport.TrustedComputingSpecified) @@ -608,9 +596,9 @@ namespace DiscImageChef.Server.App_Start if(minatalevel <= 3) { if(ataReport.PIOTransferTimingModeSpecified) - ataTwoValue.Add("PIO timing mode", string.Format("{0}", ataReport.PIOTransferTimingMode)); + ataTwoValue.Add("PIO timing mode", $"{ataReport.PIOTransferTimingMode}"); if(ataReport.DMATransferTimingModeSpecified) - ataTwoValue.Add("DMA timing mode", string.Format("{0}", ataReport.DMATransferTimingMode)); + ataTwoValue.Add("DMA timing mode", $"{ataReport.DMATransferTimingMode}"); } if(ataReport.APIOSupportedSpecified) @@ -792,25 +780,23 @@ namespace DiscImageChef.Server.App_Start } if(ataReport.MinMDMACycleTime != 0 && ataReport.RecommendedMDMACycleTime != 0) - ataOneValue.Add(string.Format("At minimum {0} ns. transfer cycle time per word in MDMA, " + "{1} ns. recommended", - ataReport.MinMDMACycleTime, ataReport.RecommendedMDMACycleTime)); + ataOneValue.Add($"At minimum {ataReport.MinMDMACycleTime} ns. transfer cycle time per word in MDMA, " + + $"{ataReport.RecommendedMDMACycleTime} ns. recommended"); if(ataReport.MinPIOCycleTimeNoFlow != 0) - ataOneValue.Add(string.Format("At minimum {0} ns. transfer cycle time per word in PIO, " + "without flow control", - ataReport.MinPIOCycleTimeNoFlow)); + ataOneValue.Add($"At minimum {ataReport.MinPIOCycleTimeNoFlow} ns. transfer cycle time per word in PIO, " + + "without flow control"); if(ataReport.MinPIOCycleTimeFlow != 0) - ataOneValue.Add(string.Format("At minimum {0} ns. transfer cycle time per word in PIO, " + "with IORDY flow control", - ataReport.MinPIOCycleTimeFlow)); + ataOneValue.Add($"At minimum {ataReport.MinPIOCycleTimeFlow} ns. transfer cycle time per word in PIO, " + + "with IORDY flow control"); - if(ataReport.MaxQueueDepth != 0) ataOneValue.Add(string.Format("{0} depth of queue maximum", ataReport.MaxQueueDepth + 1)); + if(ataReport.MaxQueueDepth != 0) ataOneValue.Add($"{ataReport.MaxQueueDepth + 1} depth of queue maximum"); if(atapi) { if(ataReport.PacketBusRelease != 0) - ataOneValue.Add(string.Format("{0} ns. typical to release bus from receipt of PACKET", - ataReport.PacketBusRelease)); + ataOneValue.Add($"{ataReport.PacketBusRelease} ns. typical to release bus from receipt of PACKET"); if(ataReport.ServiceBusyClear != 0) - ataOneValue.Add(string.Format("{0} ns. typical to clear BSY bit from receipt of SERVICE", - ataReport.ServiceBusyClear)); + ataOneValue.Add($"{ataReport.ServiceBusyClear} ns. typical to clear BSY bit from receipt of SERVICE"); } if(ataReport.TransportMajorVersionSpecified && ((ataReport.TransportMajorVersion & 0xF000) >> 12 == 0x1 || @@ -862,8 +848,7 @@ namespace DiscImageChef.Server.App_Start } if(ataReport.InterseekDelay != 0x0000 && ataReport.InterseekDelay != 0xFFFF) - ataOneValue.Add(string.Format("{0} microseconds of interseek delay for ISO-7779 accoustic testing", - ataReport.InterseekDelay)); + ataOneValue.Add($"{ataReport.InterseekDelay} microseconds of interseek delay for ISO-7779 accoustic testing"); if((ushort)ataReport.DeviceFormFactor != 0x0000 && (ushort)ataReport.DeviceFormFactor != 0xFFFF) switch(ataReport.DeviceFormFactor) @@ -884,14 +869,13 @@ namespace DiscImageChef.Server.App_Start ataOneValue.Add("Device nominal size is smaller than 1.8\""); break; default: - ataOneValue.Add(string.Format("Device nominal size field value {0} is unknown", - ataReport.DeviceFormFactor)); + ataOneValue.Add($"Device nominal size field value {ataReport.DeviceFormFactor} is unknown"); break; } if(atapi) if(ataReport.ATAPIByteCount > 0) - ataOneValue.Add(string.Format("{0} bytes count limit for ATAPI", ataReport.ATAPIByteCount)); + ataOneValue.Add($"{ataReport.ATAPIByteCount} bytes count limit for ATAPI"); if(cfa) if((ataReport.CFAPowerMode & 0x8000) == 0x8000) @@ -902,8 +886,7 @@ namespace DiscImageChef.Server.App_Start if((ataReport.CFAPowerMode & 0x1000) == 0x1000) ataOneValue.Add("CompactFlash power mode 1 is disabled"); - ataOneValue.Add(string.Format("CompactFlash device uses a maximum of {0} mA", - ataReport.CFAPowerMode & 0x0FFF)); + ataOneValue.Add($"CompactFlash device uses a maximum of {ataReport.CFAPowerMode & 0x0FFF} mA"); } if(ataReport.CommandSetSpecified || ataReport.CommandSet2Specified || ataReport.CommandSet3Specified || @@ -995,8 +978,7 @@ namespace DiscImageChef.Server.App_Start if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.AAM) && ataReport.EnabledCommandSet2Specified ) ataOneValue - .Add(string.Format("Automatic Acoustic Management is supported and enabled with value {0} (vendor recommends {1}", - ataReport.CurrentAAM, ataReport.RecommendedAAM)); + .Add($"Automatic Acoustic Management is supported and enabled with value {ataReport.CurrentAAM} (vendor recommends {ataReport.RecommendedAAM}"); else ataOneValue.Add("Automatic Acoustic Management is supported"); if(ataReport.CommandSet2.HasFlag(CommandSetBit2.SetMax)) if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.SetMax) && @@ -1023,8 +1005,7 @@ namespace DiscImageChef.Server.App_Start if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.APM) && ataReport.EnabledCommandSet2Specified ) ataOneValue - .Add(string.Format("Advanced Power Management is supported and enabled with value {0}", - ataReport.CurrentAPM)); + .Add($"Advanced Power Management is supported and enabled with value {ataReport.CurrentAPM}"); else ataOneValue.Add("Advanced Power Management is supported"); if(ataReport.CommandSet2.HasFlag(CommandSetBit2.CompactFlash)) if(ataReport.EnabledCommandSet2.HasFlag(CommandSetBit2.CompactFlash) && @@ -1148,12 +1129,10 @@ namespace DiscImageChef.Server.App_Start if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV) && ataReport.EnabledCommandSet4Specified ) ataOneValue.Add("Write/Read/Verify is supported and enabled"); else ataOneValue.Add("Write/Read/Verify is supported"); - ataOneValue.Add(string.Format("{0} sectors for Write/Read/Verify mode 2", - ataReport.WRVSectorCountMode2)); - ataOneValue.Add(string.Format("{0} sectors for Write/Read/Verify mode 3", - ataReport.WRVSectorCountMode3)); + ataOneValue.Add($"{ataReport.WRVSectorCountMode2} sectors for Write/Read/Verify mode 2"); + ataOneValue.Add($"{ataReport.WRVSectorCountMode3} sectors for Write/Read/Verify mode 3"); if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV) && ataReport.EnabledCommandSet4Specified - ) ataOneValue.Add(string.Format("Current Write/Read/Verify mode: {0}", ataReport.WRVMode)); + ) ataOneValue.Add($"Current Write/Read/Verify mode: {ataReport.WRVMode}"); } if(ataReport.CommandSet4.HasFlag(CommandSetBit4.DT1825)) if(ataReport.EnabledCommandSet4.HasFlag(CommandSetBit4.DT1825) && @@ -1273,13 +1252,12 @@ namespace DiscImageChef.Server.App_Start } if((ataReport.RemovableStatusSet & 0x03) > 0) ataOneValue.Add("Removable Media Status Notification feature set is supported"); - if(ataReport.FreeFallSensitivity != 0x00 && ataReport.FreeFallSensitivity != 0xFF) ataOneValue.Add(string.Format("Free-fall sensitivity set to {0}", ataReport.FreeFallSensitivity)); + if(ataReport.FreeFallSensitivity != 0x00 && ataReport.FreeFallSensitivity != 0xFF) ataOneValue.Add($"Free-fall sensitivity set to {ataReport.FreeFallSensitivity}"); if(ataReport.DataSetMgmtSpecified && ataReport.DataSetMgmt.HasFlag(DataSetMgmtBit.Trim)) ataOneValue.Add("TRIM is supported"); if(ataReport.DataSetMgmtSizeSpecified && ataReport.DataSetMgmtSize > 0) - ataOneValue.Add(string.Format("DATA SET MANAGEMENT can receive a maximum of {0} blocks of 512 bytes", - ataReport.DataSetMgmtSize)); + ataOneValue.Add($"DATA SET MANAGEMENT can receive a maximum of {ataReport.DataSetMgmtSize} blocks of 512 bytes"); if(ataReport.SecurityStatusSpecified && ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Supported)) { @@ -1308,13 +1286,11 @@ namespace DiscImageChef.Server.App_Start if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced)) ataOneValue.Add("Supports enhanced security erase"); - ataOneValue.Add(string.Format("{0} minutes to complete secure erase", ataReport.SecurityEraseTime * 2)); + ataOneValue.Add($"{ataReport.SecurityEraseTime * 2} minutes to complete secure erase"); if(ataReport.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced)) - ataOneValue.Add(string.Format("{0} minutes to complete enhanced secure erase", - ataReport.EnhancedSecurityEraseTime * 2)); + ataOneValue.Add($"{ataReport.EnhancedSecurityEraseTime * 2} minutes to complete enhanced secure erase"); - ataOneValue.Add(string.Format("Master password revision code: {0}", - ataReport.MasterPasswordRevisionCode)); + ataOneValue.Add($"Master password revision code: {ataReport.MasterPasswordRevisionCode}"); } if(ataReport.CommandSet3Specified && ataReport.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && @@ -1322,14 +1298,11 @@ namespace DiscImageChef.Server.App_Start ataReport.CommandSet3.HasFlag(CommandSetBit3.Streaming)) { ataOneValue.Add("Streaming:"); - ataOneValue.Add(string.Format("Minimum request size is {0}", ataReport.StreamMinReqSize)); - ataOneValue.Add(string.Format("Streaming transfer time in PIO is {0}", - ataReport.StreamTransferTimePIO)); - ataOneValue.Add(string.Format("Streaming transfer time in DMA is {0}", - ataReport.StreamTransferTimeDMA)); - ataOneValue.Add(string.Format("Streaming access latency is {0}", ataReport.StreamAccessLatency)); - ataOneValue.Add(string.Format("Streaming performance granularity is {0}", - ataReport.StreamPerformanceGranularity)); + ataOneValue.Add($"Minimum request size is {ataReport.StreamMinReqSize}"); + ataOneValue.Add($"Streaming transfer time in PIO is {ataReport.StreamTransferTimePIO}"); + ataOneValue.Add($"Streaming transfer time in DMA is {ataReport.StreamTransferTimeDMA}"); + ataOneValue.Add($"Streaming access latency is {ataReport.StreamAccessLatency}"); + ataOneValue.Add($"Streaming performance granularity is {ataReport.StreamPerformanceGranularity}"); } if(ataReport.SCTCommandTransportSpecified && @@ -1351,17 +1324,16 @@ namespace DiscImageChef.Server.App_Start if(ataReport.NVCacheCapsSpecified && (ataReport.NVCacheCaps & 0x0010) == 0x0010) { ataOneValue.Add("Non-Volatile Cache:"); - ataOneValue.Add(string.Format("Version {0}", (ataReport.NVCacheCaps & 0xF000) >> 12)); + ataOneValue.Add($"Version {(ataReport.NVCacheCaps & 0xF000) >> 12}"); if((ataReport.NVCacheCaps & 0x0001) == 0x0001) { if((ataReport.NVCacheCaps & 0x0002) == 0x0002) ataOneValue.Add("Power mode feature set is supported and enabled"); else ataOneValue.Add("Power mode feature set is supported"); - ataOneValue.Add(string.Format("Version {0}", (ataReport.NVCacheCaps & 0x0F00) >> 8)); + ataOneValue.Add($"Version {(ataReport.NVCacheCaps & 0x0F00) >> 8}"); } - ataOneValue.Add(string.Format("Non-Volatile Cache is {0} bytes", - ataReport.NVCacheSize * logicalsectorsize)); + ataOneValue.Add($"Non-Volatile Cache is {ataReport.NVCacheSize * logicalsectorsize} bytes"); } if(ataReport.ReadCapabilities != null) @@ -1375,31 +1347,26 @@ namespace DiscImageChef.Server.App_Start if(ataReport.ReadCapabilities.NominalRotationRate == 0x0001) ataOneValue.Add("Device does not rotate."); else - ataOneValue.Add(string.Format("Device rotates at {0} rpm", - ataReport.ReadCapabilities.NominalRotationRate)); + ataOneValue.Add($"Device rotates at {ataReport.ReadCapabilities.NominalRotationRate} rpm"); if(!atapi) { if(ataReport.ReadCapabilities.BlockSizeSpecified) { - ataTwoValue.Add("Logical sector size", - string.Format("{0} bytes", ataReport.ReadCapabilities.BlockSize)); + ataTwoValue.Add("Logical sector size", $"{ataReport.ReadCapabilities.BlockSize} bytes"); logicalsectorsize = ataReport.ReadCapabilities.BlockSize; } if(ataReport.ReadCapabilities.PhysicalBlockSizeSpecified) - ataTwoValue.Add("Physical sector size", - string.Format("{0} bytes", ataReport.ReadCapabilities.PhysicalBlockSize)); + ataTwoValue.Add("Physical sector size", $"{ataReport.ReadCapabilities.PhysicalBlockSize} bytes"); if(ataReport.ReadCapabilities.LongBlockSizeSpecified) - ataTwoValue.Add("READ LONG sector size", - string.Format("{0} bytes", ataReport.ReadCapabilities.LongBlockSize)); + ataTwoValue.Add("READ LONG sector size", $"{ataReport.ReadCapabilities.LongBlockSize} bytes"); if(ataReport.ReadCapabilities.BlockSizeSpecified && ataReport.ReadCapabilities.PhysicalBlockSizeSpecified && ataReport.ReadCapabilities.BlockSize != ataReport.ReadCapabilities.PhysicalBlockSize && (ataReport.ReadCapabilities.LogicalAlignment & 0x8000) == 0x0000 && (ataReport.ReadCapabilities.LogicalAlignment & 0x4000) == 0x4000) - ataOneValue.Add(string.Format("Logical sector starts at offset {0} from physical sector", - ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF)); + ataOneValue.Add($"Logical sector starts at offset {ataReport.ReadCapabilities.LogicalAlignment & 0x3FFF} from physical sector"); if(ataReport.ReadCapabilities.CHS != null && ataReport.ReadCapabilities.CurrentCHS != null) { @@ -1407,118 +1374,70 @@ namespace DiscImageChef.Server.App_Start ataReport.ReadCapabilities.CurrentCHS.Heads * ataReport.ReadCapabilities.CurrentCHS.Sectors; ataTwoValue.Add("Cylinders", - string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Cylinders, - ataReport.ReadCapabilities.CurrentCHS.Cylinders)); + $"{ataReport.ReadCapabilities.CHS.Cylinders} max., {ataReport.ReadCapabilities.CurrentCHS.Cylinders} current"); ataTwoValue.Add("Heads", - string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Heads, - ataReport.ReadCapabilities.CurrentCHS.Heads)); + $"{ataReport.ReadCapabilities.CHS.Heads} max., {ataReport.ReadCapabilities.CurrentCHS.Heads} current"); ataTwoValue.Add("Sectors per track", - string.Format("{0} max., {1} current", ataReport.ReadCapabilities.CHS.Sectors, - ataReport.ReadCapabilities.CurrentCHS.Sectors)); + $"{ataReport.ReadCapabilities.CHS.Sectors} max., {ataReport.ReadCapabilities.CurrentCHS.Sectors} current"); ataTwoValue.Add("Sectors addressable in CHS mode", - string.Format("{0} max., {1} current", - ataReport.ReadCapabilities.CHS.Cylinders * - ataReport.ReadCapabilities.CHS.Heads * - ataReport.ReadCapabilities.CHS.Sectors, currentSectors)); + $"{ataReport.ReadCapabilities.CHS.Cylinders * ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors} max., {currentSectors} current"); ataTwoValue.Add("Device size in CHS mode", - string.Format("{0} bytes, {1} Mb, {2:F2} MiB", - (ulong)currentSectors * logicalsectorsize, - (ulong)currentSectors * logicalsectorsize / 1000 / 1000, - (double)((ulong)currentSectors * logicalsectorsize) / 1024 / - 1024)); + $"{(ulong)currentSectors * logicalsectorsize} bytes, {(ulong)currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); } else if(ataReport.ReadCapabilities.CHS != null) { int currentSectors = ataReport.ReadCapabilities.CHS.Cylinders * ataReport.ReadCapabilities.CHS.Heads * ataReport.ReadCapabilities.CHS.Sectors; - ataTwoValue.Add("Cylinders", string.Format("{0}", ataReport.ReadCapabilities.CHS.Cylinders)); - ataTwoValue.Add("Heads", string.Format("{0}", ataReport.ReadCapabilities.CHS.Heads)); - ataTwoValue.Add("Sectors per track", - string.Format("{0}", ataReport.ReadCapabilities.CHS.Sectors)); - ataTwoValue.Add("Sectors addressable in CHS mode", string.Format("{0}", currentSectors)); + ataTwoValue.Add("Cylinders", $"{ataReport.ReadCapabilities.CHS.Cylinders}"); + ataTwoValue.Add("Heads", $"{ataReport.ReadCapabilities.CHS.Heads}"); + ataTwoValue.Add("Sectors per track", $"{ataReport.ReadCapabilities.CHS.Sectors}"); + ataTwoValue.Add("Sectors addressable in CHS mode", $"{currentSectors}"); ataTwoValue.Add("Device size in CHS mode", - string.Format("{0} bytes, {1} Mb, {2:F2} MiB", - (ulong)currentSectors * logicalsectorsize, - (ulong)currentSectors * logicalsectorsize / 1000 / 1000, - (double)((ulong)currentSectors * logicalsectorsize) / 1024 / - 1024)); + $"{(ulong)currentSectors * logicalsectorsize} bytes, {(ulong)currentSectors * logicalsectorsize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); } if(ataReport.ReadCapabilities.LBASectorsSpecified) { ataTwoValue.Add("Sectors addressable in sectors in 28-bit LBA mode", - string.Format("{0}", ataReport.ReadCapabilities.LBASectors)); + $"{ataReport.ReadCapabilities.LBASectors}"); if((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1024 / 1024 > 1000000) ataTwoValue.Add("Device size in 28-bit LBA mode", - string.Format("{0} bytes, {1} Tb, {2:F2} TiB", - (ulong)ataReport.ReadCapabilities.LBASectors * - logicalsectorsize, - (ulong)ataReport.ReadCapabilities.LBASectors * - logicalsectorsize / 1000 / 1000 / 1000 / 1000, - (double)((ulong)ataReport.ReadCapabilities.LBASectors * - logicalsectorsize) / 1024 / 1024 / 1024 / 1024)); + $"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000} Tb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); else if((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1024 / 1024 > 1000) ataTwoValue.Add("Device size in 28-bit LBA mode", - string.Format("{0} bytes, {1} Gb, {2:F2} GiB", - (ulong)ataReport.ReadCapabilities.LBASectors * - logicalsectorsize, - (ulong)ataReport.ReadCapabilities.LBASectors * - logicalsectorsize / 1000 / 1000 / 1000, - (double)((ulong)ataReport.ReadCapabilities.LBASectors * - logicalsectorsize) / 1024 / 1024 / 1024)); + $"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000 / 1000} Gb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024 / 1024:F2} GiB"); else ataTwoValue.Add("Device size in 28-bit LBA mode", - string.Format("{0} bytes, {1} Mb, {2:F2} MiB", - (ulong)ataReport.ReadCapabilities.LBASectors * - logicalsectorsize, - (ulong)ataReport.ReadCapabilities.LBASectors * - logicalsectorsize / 1000 / 1000, - (double)((ulong)ataReport.ReadCapabilities.LBASectors * - logicalsectorsize) / 1024 / 1024)); + $"{(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize} bytes, {(ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize / 1000 / 1000} Mb, {(double)((ulong)ataReport.ReadCapabilities.LBASectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); } if(ataReport.ReadCapabilities.LBA48SectorsSpecified) { ataTwoValue.Add("Sectors addressable in sectors in 48-bit LBA mode", - string.Format("{0}", ataReport.ReadCapabilities.LBA48Sectors)); + $"{ataReport.ReadCapabilities.LBA48Sectors}"); if(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000000) ataTwoValue.Add("Device size in 48-bit LBA mode", - string.Format("{0} bytes, {1} Tb, {2:F2} TiB", - ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize, - ataReport.ReadCapabilities.LBA48Sectors * - logicalsectorsize / 1000 / 1000 / 1000 / 1000, - (double)(ataReport.ReadCapabilities.LBA48Sectors * - logicalsectorsize) / 1024 / 1024 / 1024 / 1024)); + $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); else if(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000) ataTwoValue.Add("Device size in 48-bit LBA mode", - string.Format("{0} bytes, {1} Gb, {2:F2} GiB", - ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize, - ataReport.ReadCapabilities.LBA48Sectors * - logicalsectorsize / 1000 / 1000 / 1000, - (double)(ataReport.ReadCapabilities.LBA48Sectors * - logicalsectorsize) / 1024 / 1024 / 1024)); + $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000 / 1000} Gb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024:F2} GiB"); else ataTwoValue.Add("Device size in 48-bit LBA mode", - string.Format("{0} bytes, {1} Mb, {2:F2} MiB", - ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize, - ataReport.ReadCapabilities.LBA48Sectors * - logicalsectorsize / 1000 / 1000, - (double)(ataReport.ReadCapabilities.LBA48Sectors * - logicalsectorsize) / 1024 / 1024)); + $"{ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize} bytes, {ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize / 1000 / 1000} Mb, {(double)(ataReport.ReadCapabilities.LBA48Sectors * logicalsectorsize) / 1024 / 1024:F2} MiB"); } if(ata1 || cfa) { if(ataReport.ReadCapabilities.UnformattedBPT > 0) ataTwoValue.Add("Bytes per unformatted track", - string.Format("{0}", ataReport.ReadCapabilities.UnformattedBPT)); + $"{ataReport.ReadCapabilities.UnformattedBPT}"); if(ataReport.ReadCapabilities.UnformattedBPS > 0) ataTwoValue.Add("Bytes per unformatted sector", - string.Format("{0}", ataReport.ReadCapabilities.UnformattedBPS)); + $"{ataReport.ReadCapabilities.UnformattedBPS}"); } } diff --git a/DiscImageChef.Server/App_Start/ScsiEvpd.cs b/DiscImageChef.Server/App_Start/ScsiEvpd.cs index b66dbc457..24d924e95 100644 --- a/DiscImageChef.Server/App_Start/ScsiEvpd.cs +++ b/DiscImageChef.Server/App_Start/ScsiEvpd.cs @@ -53,8 +53,7 @@ namespace DiscImageChef.Server.App_Start else if(evpd.page == 0x89) decoded = EVPD.PrettifyPage_89(evpd.value); else if(evpd.page == 0xB0) decoded = EVPD.PrettifyPage_B0(evpd.value); else if(evpd.page == 0xB2) - decoded = string.Format("TapeAlert Supported Flags Bitmap: 0x{0:X16}
", - EVPD.DecodePageB2(evpd.value)); + decoded = $"TapeAlert Supported Flags Bitmap: 0x{EVPD.DecodePageB2(evpd.value):X16}
"; else if(evpd.page == 0xB4) decoded = EVPD.DecodePageB4(evpd.value); else if(evpd.page == 0xC0 && vendor.Trim() == "quantum") decoded = EVPD.PrettifyPage_C0_Quantum(evpd.value); @@ -79,7 +78,7 @@ namespace DiscImageChef.Server.App_Start if(!string.IsNullOrEmpty(decoded)) decoded = decoded.Replace("\n", "
"); - evpdPages.Add(string.Format("EVPD page {0:X2}h", evpd.page), decoded); + evpdPages.Add($"EVPD page {evpd.page:X2}h", decoded); } } } diff --git a/DiscImageChef.Server/App_Start/ScsiInquiry.cs b/DiscImageChef.Server/App_Start/ScsiInquiry.cs index feef85848..3f5ae042b 100644 --- a/DiscImageChef.Server/App_Start/ScsiInquiry.cs +++ b/DiscImageChef.Server/App_Start/ScsiInquiry.cs @@ -57,8 +57,7 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device is connected but unsupported."); break; default: - scsiOneValue.Add(string.Format("Vendor value {0} set in Peripheral Qualifier field.", - inquiry.PeripheralQualifier)); + scsiOneValue.Add($"Vendor value {inquiry.PeripheralQualifier} set in Peripheral Qualifier field."); break; } @@ -134,8 +133,7 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Unknown or no device type"); break; default: - scsiOneValue.Add(string.Format("Unknown device type field value 0x{0:X2}", - inquiry.PeripheralDeviceType)); + scsiOneValue.Add($"Unknown device type field value 0x{inquiry.PeripheralDeviceType:X2}"); break; } @@ -164,8 +162,7 @@ namespace DiscImageChef.Server.App_Start break; default: scsiOneValue - .Add(string.Format("Device claims to comply with unknown SCSI ANSI standard value 0x{0:X2})", - inquiry.ANSIVersion)); + .Add($"Device claims to comply with unknown SCSI ANSI standard value 0x{inquiry.ANSIVersion:X2})"); break; } @@ -179,8 +176,7 @@ namespace DiscImageChef.Server.App_Start break; default: scsiOneValue - .Add(string.Format("Device claims to comply with unknown SCSI ECMA standard value 0x{0:X2})", - inquiry.ECMAVersion)); + .Add($"Device claims to comply with unknown SCSI ECMA standard value 0x{inquiry.ECMAVersion:X2})"); break; } @@ -194,8 +190,7 @@ namespace DiscImageChef.Server.App_Start break; default: scsiOneValue - .Add(string.Format("Device claims to comply with unknown SCSI ISO/IEC standard value 0x{0:X2})", - inquiry.ISOVersion)); + .Add($"Device claims to comply with unknown SCSI ISO/IEC standard value 0x{inquiry.ISOVersion:X2})"); break; } @@ -242,8 +237,7 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device supports implicit and explicit assymetrical access"); break; default: - scsiOneValue.Add(string.Format("Unknown value in TPGS field 0x{0:X2}", - inquiry.AsymmetricalLUNAccess)); + scsiOneValue.Add($"Unknown value in TPGS field 0x{inquiry.AsymmetricalLUNAccess:X2}"); break; } @@ -262,8 +256,7 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device supports ST and DT clocking"); break; default: - scsiOneValue.Add(string.Format("Unknown value in SPI clocking field 0x{0:X2}", - inquiry.SPIClocking)); + scsiOneValue.Add($"Unknown value in SPI clocking field 0x{inquiry.SPIClocking:X2}"); break; } @@ -935,8 +928,7 @@ namespace DiscImageChef.Server.App_Start case 0x097D: case 0x097E: case 0x097F: - scsiOneValue.Add(string.Format("Device complies with iSCSI revision {0}", - VersionDescriptor & 0x1F)); + scsiOneValue.Add($"Device complies with iSCSI revision {VersionDescriptor & 0x1F}"); break; case 0x0980: scsiOneValue.Add("Device complies with SBP-3 (no version claimed)"); @@ -1696,8 +1688,7 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device complies with IEEE 1667-2009"); break; default: - scsiOneValue.Add(string.Format("Device complies with unknown standard code 0x{0:X4}", - VersionDescriptor)); + scsiOneValue.Add($"Device complies with unknown standard code 0x{VersionDescriptor:X4}"); break; } diff --git a/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs b/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs index 1b51e2539..9dba7c9ca 100644 --- a/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs +++ b/DiscImageChef.Server/App_Start/ScsiMmcFeatures.cs @@ -41,18 +41,17 @@ namespace DiscImageChef.Server.App_Start public static void Report(mmcFeaturesType ftr, ref List mmcOneValue) { if(ftr.SupportsAACS && ftr.AACSVersionSpecified) - mmcOneValue.Add(string.Format("Drive supports AACS version {0}", ftr.AACSVersion)); + mmcOneValue.Add($"Drive supports AACS version {ftr.AACSVersion}"); else if(ftr.SupportsAACS) mmcOneValue.Add("Drive supports AACS"); - if(ftr.AGIDsSpecified) mmcOneValue.Add(string.Format("Drive supports {0} AGIDs concurrently", ftr.AGIDs)); + if(ftr.AGIDsSpecified) mmcOneValue.Add($"Drive supports {ftr.AGIDs} AGIDs concurrently"); if(ftr.CanGenerateBindingNonce) { mmcOneValue.Add("Drive supports generating the binding nonce"); if(ftr.BindingNonceBlocksSpecified) - mmcOneValue.Add(string.Format("{0} media blocks are required for the binding nonce", - ftr.BindingNonceBlocks)); + mmcOneValue.Add($"{ftr.BindingNonceBlocks} media blocks are required for the binding nonce"); } if(ftr.BlocksPerReadableUnit > 1) - mmcOneValue.Add(string.Format("{0} logical blocks per media writable unit", ftr.BlocksPerReadableUnit)); + mmcOneValue.Add($"{ftr.BlocksPerReadableUnit} logical blocks per media writable unit"); if(ftr.BufferUnderrunFreeInDVD) mmcOneValue.Add("Drive supports zero loss linking writing DVDs"); if(ftr.BufferUnderrunFreeInSAO) mmcOneValue.Add("Drive supports zero loss linking in Session at Once Mode"); if(ftr.BufferUnderrunFreeInTAO) mmcOneValue.Add("Drive supports zero loss linking in Track at Once Mode"); @@ -122,7 +121,7 @@ namespace DiscImageChef.Server.App_Start if(ftr.ErrorRecoveryPage) mmcOneValue.Add("Drive shall report Read/Write Error Recovery mode page"); if(ftr.Locked) mmcOneValue.Add("Drive can lock media"); if(ftr.LogicalBlockSize > 0) - mmcOneValue.Add(string.Format("{0} bytes per logical block", ftr.LogicalBlockSize)); + mmcOneValue.Add($"{ftr.LogicalBlockSize} bytes per logical block"); if(ftr.MultiRead) mmcOneValue.Add("Drive claims capability to read all CD formats according to OSTA Multi-Read Specification"); @@ -159,8 +158,7 @@ namespace DiscImageChef.Server.App_Start mmcOneValue.Add("Drive uses a vendor unique interface"); break; default: - mmcOneValue.Add(string.Format("Drive uses an unknown interface with code {0}", - (uint)ftr.PhysicalInterfaceStandard)); + mmcOneValue.Add($"Drive uses an unknown interface with code {(uint)ftr.PhysicalInterfaceStandard}"); break; } @@ -220,18 +218,18 @@ namespace DiscImageChef.Server.App_Start if(ftr.ChangerSupportsDiscPresent) mmcOneValue.Add("Drive is able to report slots contents after a reset or change"); - mmcOneValue.Add(string.Format("Drive has {0} slots", ftr.ChangerSlots + 1)); + mmcOneValue.Add($"Drive has {ftr.ChangerSlots + 1} slots"); } if(ftr.SupportsCSS && ftr.CSSVersionSpecified) - mmcOneValue.Add(string.Format("Drive supports DVD CSS/CPPM version {0}", ftr.CSSVersion)); + mmcOneValue.Add($"Drive supports DVD CSS/CPPM version {ftr.CSSVersion}"); else if(ftr.SupportsCSS) mmcOneValue.Add("Drive supports DVD CSS/CPRM"); if(ftr.SupportsCPRM && ftr.CPRMVersionSpecified) - mmcOneValue.Add(string.Format("Drive supports DVD CPPM version {0}", ftr.CPRMVersion)); + mmcOneValue.Add($"Drive supports DVD CPPM version {ftr.CPRMVersion}"); else if(ftr.SupportsCPRM) mmcOneValue.Add("Drive supports DVD CPRM"); if(ftr.DBML) mmcOneValue.Add("Drive reports Device Busy Class events during medium loading/unloading"); if(ftr.DVDMultiRead) mmcOneValue.Add("Drive conforms to DVD Multi Drive Read-only Specifications"); if(ftr.FirmwareDateSpecified) - mmcOneValue.Add(string.Format("Drive firmware is dated {0}", ftr.FirmwareDate)); + mmcOneValue.Add($"Drive firmware is dated {ftr.FirmwareDate}"); if(ftr.SupportsC2) mmcOneValue.Add("Drive supports C2 Error Pointers"); if(ftr.SupportsDAP) mmcOneValue.Add("Drive supports the DAP bit in the READ CD and READ CD MSF commands"); if(ftr.SupportsDeviceBusyEvent) mmcOneValue.Add("Drive supports Device Busy events"); @@ -254,8 +252,7 @@ namespace DiscImageChef.Server.App_Start mmcOneValue.Add("Drive is a changer using cartridges"); break; default: - mmcOneValue.Add(string.Format("Drive uses unknown loading mechanism type {0}", - ftr.LoadingMechanismType)); + mmcOneValue.Add($"Drive uses unknown loading mechanism type {ftr.LoadingMechanismType}"); break; } @@ -270,7 +267,7 @@ namespace DiscImageChef.Server.App_Start if(ftr.SupportsSeparateVolume) mmcOneValue.Add("Drive supports separate volume per channel"); if(ftr.SupportsVCPS) mmcOneValue.Add("Drive supports VCPS"); if(ftr.VolumeLevelsSpecified) - mmcOneValue.Add(string.Format("Drive has {0} volume levels", ftr.VolumeLevels + 1)); + mmcOneValue.Add($"Drive has {ftr.VolumeLevels + 1} volume levels"); if(ftr.SupportsWriteProtectPAC) mmcOneValue.Add("Drive supports reading/writing the Disc Write Protect PAC on BD-R/-RE media"); if(ftr.SupportsWriteInhibitDCB) diff --git a/DiscImageChef.Server/App_Start/ScsiMmcMode.cs b/DiscImageChef.Server/App_Start/ScsiMmcMode.cs index 228f79efe..8bb7cea64 100644 --- a/DiscImageChef.Server/App_Start/ScsiMmcMode.cs +++ b/DiscImageChef.Server/App_Start/ScsiMmcMode.cs @@ -73,8 +73,7 @@ namespace DiscImageChef.Server.App_Start mmcOneValue.Add("Drive is a changer using cartridges"); break; default: - mmcOneValue.Add(string.Format("Drive uses unknown loading mechanism type {0}", - mode.LoadingMechanismType)); + mmcOneValue.Add($"Drive uses unknown loading mechanism type {mode.LoadingMechanismType}"); break; } @@ -97,12 +96,12 @@ namespace DiscImageChef.Server.App_Start if(mode.SeparateChannelVolume) mmcOneValue.Add("Each channel's volume can be controlled independently"); if(mode.SupportedVolumeLevels > 0) - mmcOneValue.Add(string.Format("Drive supports {0} volume levels", mode.SupportedVolumeLevels)); - if(mode.BufferSize > 0) mmcOneValue.Add(string.Format("Drive has {0} Kbyte of buffer", mode.BufferSize)); + mmcOneValue.Add($"Drive supports {mode.SupportedVolumeLevels} volume levels"); + if(mode.BufferSize > 0) mmcOneValue.Add($"Drive has {mode.BufferSize} Kbyte of buffer"); if(mode.MaximumSpeed > 0) - mmcOneValue.Add(string.Format("Drive's maximum reading speed is {0} Kbyte/sec.", mode.MaximumSpeed)); + mmcOneValue.Add($"Drive's maximum reading speed is {mode.MaximumSpeed} Kbyte/sec."); if(mode.CurrentSpeed > 0) - mmcOneValue.Add(string.Format("Drive's current reading speed is {0} Kbyte/sec.", mode.CurrentSpeed)); + mmcOneValue.Add($"Drive's current reading speed is {mode.CurrentSpeed} Kbyte/sec."); if(mode.ReadsCDR) { @@ -133,30 +132,24 @@ namespace DiscImageChef.Server.App_Start if(mode.CurrentWriteSpeedSelected > 0) { if(mode.RotationControlSelected == 0) - mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec. in CLV mode", - mode.CurrentWriteSpeedSelected)); + mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in CLV mode"); else if(mode.RotationControlSelected == 1) - mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec. in pure CAV mode", - mode.CurrentWriteSpeedSelected)); + mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeedSelected} Kbyte/sec. in pure CAV mode"); } else { if(mode.MaximumWriteSpeed > 0) - mmcOneValue.Add(string.Format("Drive's maximum writing speed is {0} Kbyte/sec.", - mode.MaximumWriteSpeed)); + mmcOneValue.Add($"Drive's maximum writing speed is {mode.MaximumWriteSpeed} Kbyte/sec."); if(mode.CurrentWriteSpeed > 0) - mmcOneValue.Add(string.Format("Drive's current writing speed is {0} Kbyte/sec.", - mode.CurrentWriteSpeed)); + mmcOneValue.Add($"Drive's current writing speed is {mode.CurrentWriteSpeed} Kbyte/sec."); } if(mode.WriteSpeedPerformanceDescriptors != null) foreach(Modes.ModePage_2A_WriteDescriptor descriptor in mode.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0)) if(descriptor.RotationControl == 0) - mmcOneValue.Add(string.Format("Drive supports writing at {0} Kbyte/sec. in CLV mode", - descriptor.WriteSpeed)); + mmcOneValue.Add($"Drive supports writing at {descriptor.WriteSpeed} Kbyte/sec. in CLV mode"); else if(descriptor.RotationControl == 1) mmcOneValue - .Add(string.Format("Drive supports writing at is {0} Kbyte/sec. in pure CAV mode", - descriptor.WriteSpeed)); + .Add($"Drive supports writing at is {descriptor.WriteSpeed} Kbyte/sec. in pure CAV mode"); if(mode.TestWrite) mmcOneValue.Add("Drive supports test writing"); diff --git a/DiscImageChef.Server/App_Start/ScsiModeSense.cs b/DiscImageChef.Server/App_Start/ScsiModeSense.cs index b9535681d..cb966dab1 100644 --- a/DiscImageChef.Server/App_Start/ScsiModeSense.cs +++ b/DiscImageChef.Server/App_Start/ScsiModeSense.cs @@ -42,14 +42,13 @@ namespace DiscImageChef.Server.App_Start ref List scsiOneValue, ref Dictionary modePages) { if(modeSense.MediumTypeSpecified) - scsiOneValue.Add(string.Format("Medium type is {0:X2}h", modeSense.MediumType)); + scsiOneValue.Add($"Medium type is {modeSense.MediumType:X2}h"); if(modeSense.WriteProtected) scsiOneValue.Add("Device is write protected."); if(modeSense.BlockDescriptors != null) foreach(blockDescriptorType descriptor in modeSense.BlockDescriptors) if(descriptor.BlocksSpecified && descriptor.BlockLengthSpecified) - scsiOneValue.Add(string.Format("Density code {0:X2}h has {1} blocks of {2} bytes each", - descriptor.Density, descriptor.Blocks, descriptor.BlockLength)); - else scsiOneValue.Add(string.Format("Density code {0:X2}h", descriptor.Density)); + scsiOneValue.Add($"Density code {descriptor.Density:X2}h has {descriptor.Blocks} blocks of {descriptor.BlockLength} bytes each"); + else scsiOneValue.Add($"Density code {descriptor.Density:X2}h"); if(modeSense.DPOandFUA) scsiOneValue.Add("Drive supports DPO and FUA bits"); if(modeSense.BlankCheckEnabled) scsiOneValue.Add("Blank checking during write is enabled"); @@ -66,7 +65,7 @@ namespace DiscImageChef.Server.App_Start scsiOneValue.Add("Device uses a write cache but doesn't return until cache is flushed"); break; default: - scsiOneValue.Add(string.Format("Unknown buffered mode code 0x{0:X2}", modeSense.BufferedMode)); + scsiOneValue.Add($"Unknown buffered mode code 0x{modeSense.BufferedMode:X2}"); break; } @@ -78,16 +77,16 @@ namespace DiscImageChef.Server.App_Start case 0x00: { if(deviceType == PeripheralDeviceTypes.MultiMediaDevice && page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_00_SFF(page.value)); else { if(page.subpage != 0) modePages - .Add(string.Format("MODE page {0:X2}h subpage {1:X2}h", page.page, page.subpage), + .Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h", "Unknown vendor mode page"); else - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", "Unknown vendor mode page"); } break; @@ -96,10 +95,10 @@ namespace DiscImageChef.Server.App_Start { if(page.subpage == 0) if(deviceType == PeripheralDeviceTypes.MultiMediaDevice) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_01_MMC(page.value)); else - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_01(page.value)); else goto default; @@ -108,7 +107,7 @@ namespace DiscImageChef.Server.App_Start case 0x02: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_02(page.value)); else goto default; @@ -117,7 +116,7 @@ namespace DiscImageChef.Server.App_Start case 0x03: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_03(page.value)); else goto default; @@ -126,7 +125,7 @@ namespace DiscImageChef.Server.App_Start case 0x04: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_04(page.value)); else goto default; @@ -135,7 +134,7 @@ namespace DiscImageChef.Server.App_Start case 0x05: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_05(page.value)); else goto default; @@ -144,7 +143,7 @@ namespace DiscImageChef.Server.App_Start case 0x06: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_06(page.value)); else goto default; @@ -154,10 +153,10 @@ namespace DiscImageChef.Server.App_Start { if(page.subpage == 0) if(deviceType == PeripheralDeviceTypes.MultiMediaDevice) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_07_MMC(page.value)); else - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_07(page.value)); else goto default; @@ -166,7 +165,7 @@ namespace DiscImageChef.Server.App_Start case 0x08: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_08(page.value)); else goto default; @@ -175,10 +174,10 @@ namespace DiscImageChef.Server.App_Start case 0x0A: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0A(page.value)); else if(page.subpage == 1) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0A_S01(page.value)); else goto default; @@ -187,7 +186,7 @@ namespace DiscImageChef.Server.App_Start case 0x0B: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0B(page.value)); else goto default; @@ -196,7 +195,7 @@ namespace DiscImageChef.Server.App_Start case 0x0D: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0D(page.value)); else goto default; @@ -205,7 +204,7 @@ namespace DiscImageChef.Server.App_Start case 0x0E: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0E(page.value)); else goto default; @@ -214,7 +213,7 @@ namespace DiscImageChef.Server.App_Start case 0x0F: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_0F(page.value)); else goto default; @@ -224,10 +223,10 @@ namespace DiscImageChef.Server.App_Start { if(page.subpage == 0) if(deviceType == PeripheralDeviceTypes.SequentialAccess) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_10_SSC(page.value)); else - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_10(page.value)); else goto default; @@ -236,7 +235,7 @@ namespace DiscImageChef.Server.App_Start case 0x11: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_11(page.value)); else goto default; @@ -247,7 +246,7 @@ namespace DiscImageChef.Server.App_Start case 0x14: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_12_13_14(page.value)); else goto default; @@ -256,10 +255,10 @@ namespace DiscImageChef.Server.App_Start case 0x1A: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1A(page.value)); else if(page.subpage == 1) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1A_S01(page.value)); else goto default; @@ -268,7 +267,7 @@ namespace DiscImageChef.Server.App_Start case 0x1B: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1B(page.value)); else goto default; @@ -278,13 +277,13 @@ namespace DiscImageChef.Server.App_Start { if(page.subpage == 0) if(deviceType == PeripheralDeviceTypes.MultiMediaDevice) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1C_SFF(page.value)); else - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1C(page.value)); else if(page.subpage == 1) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1C_S01(page.value)); else goto default; @@ -293,7 +292,7 @@ namespace DiscImageChef.Server.App_Start case 0x1D: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_1D(page.value)); else goto default; @@ -302,7 +301,7 @@ namespace DiscImageChef.Server.App_Start case 0x21: { if(vendor == "CERTANCE") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyCertanceModePage_21(page.value)); else goto default; @@ -311,7 +310,7 @@ namespace DiscImageChef.Server.App_Start case 0x22: { if(vendor == "CERTANCE") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyCertanceModePage_22(page.value)); else goto default; @@ -320,7 +319,7 @@ namespace DiscImageChef.Server.App_Start case 0x24: { if(vendor == "IBM") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_24(page.value)); else goto default; @@ -329,7 +328,7 @@ namespace DiscImageChef.Server.App_Start case 0x2A: { if(page.subpage == 0) - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyModePage_2A(page.value)); else goto default; @@ -338,7 +337,7 @@ namespace DiscImageChef.Server.App_Start case 0x2F: { if(vendor == "IBM") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_2F(page.value)); else goto default; @@ -355,7 +354,7 @@ namespace DiscImageChef.Server.App_Start case 0x3B: { if(vendor == "HP") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3B(page.value)); else goto default; @@ -364,7 +363,7 @@ namespace DiscImageChef.Server.App_Start case 0x3C: { if(vendor == "HP") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3C(page.value)); else goto default; @@ -373,10 +372,10 @@ namespace DiscImageChef.Server.App_Start case 0x3D: { if(vendor == "IBM") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyIBMModePage_3D(page.value)); else if(vendor == "HP") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3D(page.value)); else goto default; @@ -385,10 +384,10 @@ namespace DiscImageChef.Server.App_Start case 0x3E: { if(vendor == "FUJITSU") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyFujitsuModePage_3E(page.value)); else if(vendor == "HP") - modePages.Add(string.Format("MODE page {0:X2}h", page.page), + modePages.Add($"MODE page {page.page:X2}h", Modes.PrettifyHPModePage_3E(page.value)); else goto default; @@ -398,9 +397,9 @@ namespace DiscImageChef.Server.App_Start { if(page.subpage != 0) modePages - .Add(string.Format("MODE page {0:X2}h subpage {1:X2}h", page.page, page.subpage), + .Add($"MODE page {page.page:X2}h subpage {page.subpage:X2}h", "Unknown mode page"); - else modePages.Add(string.Format("MODE page {0:X2}h", page.page), "Unknown mode page"); + else modePages.Add($"MODE page {page.page:X2}h", "Unknown mode page"); } break; } diff --git a/DiscImageChef.Server/App_Start/SscTestedMedia.cs b/DiscImageChef.Server/App_Start/SscTestedMedia.cs index 4f8a59dff..005d82de5 100644 --- a/DiscImageChef.Server/App_Start/SscTestedMedia.cs +++ b/DiscImageChef.Server/App_Start/SscTestedMedia.cs @@ -43,22 +43,21 @@ namespace DiscImageChef.Server.App_Start { if(!string.IsNullOrWhiteSpace(media.MediumTypeName)) { - mediaOneValue.Add(string.Format("Information for medium named \"{0}\"", - media.MediumTypeName)); + mediaOneValue.Add($"Information for medium named \"{media.MediumTypeName}\""); if(media.MediumTypeSpecified) - mediaOneValue.Add(string.Format("Medium type code: {0:X2}h", media.MediumType)); + mediaOneValue.Add($"Medium type code: {media.MediumType:X2}h"); } else if(media.MediumTypeSpecified) - mediaOneValue.Add(string.Format("Information for medium type {0:X2}h", media.MediumType)); + mediaOneValue.Add($"Information for medium type {media.MediumType:X2}h"); else mediaOneValue.Add("Information for unknown medium type"); if(!string.IsNullOrWhiteSpace(media.Manufacturer)) - mediaOneValue.Add(string.Format("Medium manufactured by: {0}", media.Manufacturer)); + mediaOneValue.Add($"Medium manufactured by: {media.Manufacturer}"); if(!string.IsNullOrWhiteSpace(media.Model)) - mediaOneValue.Add(string.Format("Medium model: {0}", media.Model)); + mediaOneValue.Add($"Medium model: {media.Model}"); if(media.DensitySpecified) - mediaOneValue.Add(string.Format("Medium has density code {0:X2}h", media.Density)); + mediaOneValue.Add($"Medium has density code {media.Density:X2}h"); if(media.CanReadMediaSerial) mediaOneValue.Add("Drive can read medium serial number."); if(media.MediaIsRecognized) mediaOneValue.Add("DiscImageChef recognizes this medium."); diff --git a/DiscImageChef.Server/App_Start/TestedMedia.cs b/DiscImageChef.Server/App_Start/TestedMedia.cs index 262a911bf..79f105046 100644 --- a/DiscImageChef.Server/App_Start/TestedMedia.cs +++ b/DiscImageChef.Server/App_Start/TestedMedia.cs @@ -43,160 +43,97 @@ namespace DiscImageChef.Server.App_Start { if(!string.IsNullOrWhiteSpace(testedMedia.MediumTypeName)) { - mediaOneValue.Add(string.Format("Information for medium named \"{0}\"", - testedMedia.MediumTypeName)); + mediaOneValue.Add($"Information for medium named \"{testedMedia.MediumTypeName}\""); if(testedMedia.MediumTypeSpecified) - mediaOneValue.Add(string.Format("Medium type code: {0:X2}h", testedMedia.MediumType)); + mediaOneValue.Add($"Medium type code: {testedMedia.MediumType:X2}h"); } else if(testedMedia.MediumTypeSpecified) - mediaOneValue.Add(string.Format("Information for medium type {0:X2}h", - testedMedia.MediumType)); + mediaOneValue.Add($"Information for medium type {testedMedia.MediumType:X2}h"); else mediaOneValue.Add("Information for unknown medium type"); if(testedMedia.MediaIsRecognized) mediaOneValue.Add("Drive recognizes this medium."); else mediaOneValue.Add("Drive does not recognize this medium."); if(!string.IsNullOrWhiteSpace(testedMedia.Manufacturer)) - mediaOneValue.Add(string.Format("Medium manufactured by: {0}", testedMedia.Manufacturer)); + mediaOneValue.Add($"Medium manufactured by: {testedMedia.Manufacturer}"); if(!string.IsNullOrWhiteSpace(testedMedia.Model)) - mediaOneValue.Add(string.Format("Medium model: {0}", testedMedia.Model)); + mediaOneValue.Add($"Medium model: {testedMedia.Model}"); if(testedMedia.DensitySpecified) - mediaOneValue.Add(string.Format("Density code: {0:X2}h", testedMedia.Density)); + mediaOneValue.Add($"Density code: {testedMedia.Density:X2}h"); if(testedMedia.BlockSizeSpecified) - mediaOneValue.Add(string.Format("Logical sector size: {0} bytes", testedMedia.BlockSize)); + mediaOneValue.Add($"Logical sector size: {testedMedia.BlockSize} bytes"); if(testedMedia.PhysicalBlockSizeSpecified) - mediaOneValue.Add(string.Format("Physical sector size: {0} bytes", testedMedia.PhysicalBlockSize)); + mediaOneValue.Add($"Physical sector size: {testedMedia.PhysicalBlockSize} bytes"); if(testedMedia.LongBlockSizeSpecified) - mediaOneValue.Add(string.Format("READ LONG sector size: {0} bytes", testedMedia.LongBlockSize)); + mediaOneValue.Add($"READ LONG sector size: {testedMedia.LongBlockSize} bytes"); if(testedMedia.BlocksSpecified && testedMedia.BlockSizeSpecified) { - mediaOneValue.Add(string.Format("Medium has {0} blocks of {1} bytes each", testedMedia.Blocks, - testedMedia.BlockSize)); + mediaOneValue.Add($"Medium has {testedMedia.Blocks} blocks of {testedMedia.BlockSize} bytes each"); if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000000) - mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Tb, {2:F2} TiB", - testedMedia.Blocks * testedMedia.BlockSize, - testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / - 1000 / 1000, - (double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / - 1024 / 1024 / 1024)); + mediaOneValue.Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); else if(testedMedia.Blocks * testedMedia.BlockSize / 1024 / 1024 > 1000) - mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Gb, {2:F2} GiB", - testedMedia.Blocks * testedMedia.BlockSize, - testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / - 1000, - (double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / - 1024 / 1024)); + mediaOneValue.Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); else - mediaOneValue.Add(string.Format("Medium size: {0} bytes, {1} Mb, {2:F2} MiB", - testedMedia.Blocks * testedMedia.BlockSize, - testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000, - (double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / - 1024)); + mediaOneValue.Add($"Medium size: {testedMedia.Blocks * testedMedia.BlockSize} bytes, {testedMedia.Blocks * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.Blocks * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } if(testedMedia.CHS != null && testedMedia.CurrentCHS != null) { int currentSectors = testedMedia.CurrentCHS.Cylinders * testedMedia.CurrentCHS.Heads * testedMedia.CurrentCHS.Sectors; - mediaOneValue.Add(string.Format("Cylinders: {0} max., {1} current", testedMedia.CHS.Cylinders, - testedMedia.CurrentCHS.Cylinders)); - mediaOneValue.Add(string.Format("Heads: {0} max., {1} current", testedMedia.CHS.Heads, - testedMedia.CurrentCHS.Heads)); - mediaOneValue.Add(string.Format("Sectors per track: {0} max., {1} current", testedMedia.CHS.Sectors, - testedMedia.CurrentCHS.Sectors)); - mediaOneValue.Add(string.Format("Sectors addressable in CHS mode: {0} max., {1} current", - testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * - testedMedia.CHS.Sectors, currentSectors)); - mediaOneValue.Add(string.Format("Medium size in CHS mode: {0} bytes, {1} Mb, {2:F2} MiB", - (ulong)currentSectors * testedMedia.BlockSize, - (ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000, - (double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / - 1024)); + mediaOneValue.Add($"Cylinders: {testedMedia.CHS.Cylinders} max., {testedMedia.CurrentCHS.Cylinders} current"); + mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads} max., {testedMedia.CurrentCHS.Heads} current"); + mediaOneValue.Add($"Sectors per track: {testedMedia.CHS.Sectors} max., {testedMedia.CurrentCHS.Sectors} current"); + mediaOneValue.Add($"Sectors addressable in CHS mode: {testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors} max., {currentSectors} current"); + mediaOneValue.Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } else if(testedMedia.CHS != null) { int currentSectors = testedMedia.CHS.Cylinders * testedMedia.CHS.Heads * testedMedia.CHS.Sectors; - mediaOneValue.Add(string.Format("Cylinders: {0}", testedMedia.CHS.Cylinders)); - mediaOneValue.Add(string.Format("Heads: {0}", testedMedia.CHS.Heads)); - mediaOneValue.Add(string.Format("Sectors per track: {0}", testedMedia.CHS.Sectors)); - mediaOneValue.Add(string.Format("Sectors addressable in CHS mode: {0}", currentSectors)); - mediaOneValue.Add(string.Format("Medium size in CHS mode: {0} bytes, {1} Mb, {2:F2} MiB", - (ulong)currentSectors * testedMedia.BlockSize, - (ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000, - (double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / - 1024)); + mediaOneValue.Add($"Cylinders: {testedMedia.CHS.Cylinders}"); + mediaOneValue.Add($"Heads: {testedMedia.CHS.Heads}"); + mediaOneValue.Add($"Sectors per track: {testedMedia.CHS.Sectors}"); + mediaOneValue.Add($"Sectors addressable in CHS mode: {currentSectors}"); + mediaOneValue.Add($"Medium size in CHS mode: {(ulong)currentSectors * testedMedia.BlockSize} bytes, {(ulong)currentSectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)currentSectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } if(testedMedia.LBASectorsSpecified) { - mediaOneValue.Add(string.Format("Sectors addressable in sectors in 28-bit LBA mode: {0}", - testedMedia.LBASectors)); + mediaOneValue.Add($"Sectors addressable in sectors in 28-bit LBA mode: {testedMedia.LBASectors}"); if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000000) - mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Tb, {2:F2} TiB", - (ulong)testedMedia.LBASectors * testedMedia.BlockSize, - (ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / - 1000 / 1000 / 1000, - (double)((ulong)testedMedia.LBASectors * - testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024)); + mediaOneValue.Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); else if((ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1024 / 1024 > 1000) - mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Gb, {2:F2} GiB", - (ulong)testedMedia.LBASectors * testedMedia.BlockSize, - (ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / - 1000 / 1000, - (double)((ulong)testedMedia.LBASectors * - testedMedia.BlockSize) / 1024 / 1024 / 1024)); + mediaOneValue.Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); else - mediaOneValue.Add(string.Format("Medium size in 28-bit LBA mode: {0} bytes, {1} Mb, {2:F2} MiB", - (ulong)testedMedia.LBASectors * testedMedia.BlockSize, - (ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / - 1000, - (double)((ulong)testedMedia.LBASectors * - testedMedia.BlockSize) / 1024 / 1024)); + mediaOneValue.Add($"Medium size in 28-bit LBA mode: {(ulong)testedMedia.LBASectors * testedMedia.BlockSize} bytes, {(ulong)testedMedia.LBASectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)((ulong)testedMedia.LBASectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } if(testedMedia.LBA48SectorsSpecified) { - mediaOneValue.Add(string.Format("Sectors addressable in sectors in 48-bit LBA mode: {0}", - testedMedia.LBA48Sectors)); + mediaOneValue.Add($"Sectors addressable in sectors in 48-bit LBA mode: {testedMedia.LBA48Sectors}"); if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000000) - mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Tb, {2:F2} TiB", - testedMedia.LBA48Sectors * testedMedia.BlockSize, - testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / - 1000 / 1000 / 1000, - (double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / - 1024 / 1024 / 1024 / 1024)); + mediaOneValue.Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); else if(testedMedia.LBA48Sectors * testedMedia.BlockSize / 1024 / 1024 > 1000) - mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Gb, {2:F2} GiB", - testedMedia.LBA48Sectors * testedMedia.BlockSize, - testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / - 1000 / 1000, - (double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / - 1024 / 1024 / 1024)); + mediaOneValue.Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); else - mediaOneValue.Add(string.Format("Medium size in 48-bit LBA mode: {0} bytes, {1} Mb, {2:F2} MiB", - testedMedia.LBA48Sectors * testedMedia.BlockSize, - testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / - 1000, - (double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / - 1024 / 1024)); + mediaOneValue.Add($"Medium size in 48-bit LBA mode: {testedMedia.LBA48Sectors * testedMedia.BlockSize} bytes, {testedMedia.LBA48Sectors * testedMedia.BlockSize / 1000 / 1000} Mb, {(double)(testedMedia.LBA48Sectors * testedMedia.BlockSize) / 1024 / 1024:F2} MiB"); } if(testedMedia.NominalRotationRateSpecified && testedMedia.NominalRotationRate != 0x0000 && testedMedia.NominalRotationRate != 0xFFFF) if(testedMedia.NominalRotationRate == 0x0001) mediaOneValue.Add("Medium does not rotate."); - else mediaOneValue.Add(string.Format("Medium rotates at {0} rpm", testedMedia.NominalRotationRate)); + else mediaOneValue.Add($"Medium rotates at {testedMedia.NominalRotationRate} rpm"); if(testedMedia.BlockSizeSpecified && testedMedia.PhysicalBlockSizeSpecified && testedMedia.BlockSize != testedMedia.PhysicalBlockSize && (testedMedia.LogicalAlignment & 0x8000) == 0x0000 && (testedMedia.LogicalAlignment & 0x4000) == 0x4000) - mediaOneValue.Add(string.Format("Logical sector starts at offset {0} from physical sector", - testedMedia.LogicalAlignment & 0x3FFF)); + mediaOneValue.Add($"Logical sector starts at offset {testedMedia.LogicalAlignment & 0x3FFF} from physical sector"); if(testedMedia.SupportsRead && ata) mediaOneValue.Add("Device can use the READ SECTOR(S) command in CHS mode with this medium"); diff --git a/DiscImageChef.Server/Controllers/UploadReportController.cs b/DiscImageChef.Server/Controllers/UploadReportController.cs index b9e75fcda..f70f4a193 100644 --- a/DiscImageChef.Server/Controllers/UploadReportController.cs +++ b/DiscImageChef.Server/Controllers/UploadReportController.cs @@ -67,8 +67,9 @@ namespace DiscImageChef.Server.Controllers } Random rng = new Random(); - string filename = string.Format("NewReport_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next()); - while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Upload", filename))) filename = string.Format("NewReport_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next()); + string filename = $"NewReport_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml"; + while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Upload", filename))) filename = + $"NewReport_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml"; FileStream newFile = new FileStream(Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Upload", filename), diff --git a/DiscImageChef.Server/Controllers/UploadStatsController.cs b/DiscImageChef.Server/Controllers/UploadStatsController.cs index 765ca4694..e8b61b224 100644 --- a/DiscImageChef.Server/Controllers/UploadStatsController.cs +++ b/DiscImageChef.Server/Controllers/UploadStatsController.cs @@ -415,11 +415,10 @@ namespace DiscImageChef.Server.Controllers .ThenBy(device => device.Bus).ToList(); Random rng = new Random(); - string filename = string.Format("BackupStats_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, - rng.Next()); + string filename = $"BackupStats_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml"; while(File.Exists(Path.Combine(HostingEnvironment.MapPath("~"), "Statistics", filename))) - filename = string.Format("BackupStats_{0:yyyyMMddHHmmssfff}_{1}.xml", DateTime.UtcNow, rng.Next()); + filename = $"BackupStats_{DateTime.UtcNow:yyyyMMddHHmmssfff}_{rng.Next()}.xml"; FileStream backup = new diff --git a/DiscImageChef.Server/Statistics.aspx.cs b/DiscImageChef.Server/Statistics.aspx.cs index 4196ea8d4..0f5756e97 100644 --- a/DiscImageChef.Server/Statistics.aspx.cs +++ b/DiscImageChef.Server/Statistics.aspx.cs @@ -81,9 +81,8 @@ namespace DiscImageChef.Server "Statistics.xml"))) { #if DEBUG - content.InnerHtml = string.Format("Sorry, cannot load data file \"{0}\"", - Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), - "Statistics", "Statistics.xml")); + content.InnerHtml = + $"Sorry, cannot load data file \"{Path.Combine(HostingEnvironment.MapPath("~") ?? throw new InvalidOperationException(), "Statistics", "Statistics.xml")}\""; #else content.InnerHtml = "Sorry, cannot load data file"; #endif @@ -105,11 +104,8 @@ namespace DiscImageChef.Server foreach(OsStats nvs in statistics.OperatingSystems) operatingSystems.Add(new NameValueStats { - name = string.Format("{0}{1}{2}", - DetectOS - .GetPlatformName((PlatformID)Enum.Parse(typeof(PlatformID), nvs.name), - nvs.version), - string.IsNullOrEmpty(nvs.version) ? "" : " ", nvs.version), + name = + $"{DetectOS.GetPlatformName((PlatformID)Enum.Parse(typeof(PlatformID), nvs.name), nvs.version)}{(string.IsNullOrEmpty(nvs.version) ? "" : " ")}{nvs.version}", Value = nvs.Value }); @@ -233,30 +229,26 @@ namespace DiscImageChef.Server !string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision)) { xmlFile = device.Manufacturer + "_" + device.Model + "_" + device.Revision + ".xml"; - url = string.Format("ViewReport.aspx?manufacturer={0}&model={1}&revision={2}", - HttpUtility.UrlPathEncode(device.Manufacturer), - HttpUtility.UrlPathEncode(device.Model), - HttpUtility.UrlPathEncode(device.Revision)); + url = + $"ViewReport.aspx?manufacturer={HttpUtility.UrlPathEncode(device.Manufacturer)}&model={HttpUtility.UrlPathEncode(device.Model)}&revision={HttpUtility.UrlPathEncode(device.Revision)}"; } else if(!string.IsNullOrWhiteSpace(device.Manufacturer) && !string.IsNullOrWhiteSpace(device.Model)) { xmlFile = device.Manufacturer + "_" + device.Model + ".xml"; - url = string.Format("ViewReport.aspx?manufacturer={0}&model={1}", - HttpUtility.UrlPathEncode(device.Manufacturer), - HttpUtility.UrlPathEncode(device.Model)); + url = + $"ViewReport.aspx?manufacturer={HttpUtility.UrlPathEncode(device.Manufacturer)}&model={HttpUtility.UrlPathEncode(device.Model)}"; } else if(!string.IsNullOrWhiteSpace(device.Model) && !string.IsNullOrWhiteSpace(device.Revision)) { xmlFile = device.Model + "_" + device.Revision + ".xml"; - url = string.Format("ViewReport.aspx?model={0}&revision={1}", - HttpUtility.UrlPathEncode(device.Model), - HttpUtility.UrlPathEncode(device.Revision)); + url = + $"ViewReport.aspx?model={HttpUtility.UrlPathEncode(device.Model)}&revision={HttpUtility.UrlPathEncode(device.Revision)}"; } else { xmlFile = device.Model + ".xml"; - url = string.Format("ViewReport.aspx?model={0}", HttpUtility.UrlPathEncode(device.Model)); + url = $"ViewReport.aspx?model={HttpUtility.UrlPathEncode(device.Model)}"; } xmlFile = xmlFile.Replace('/', '_').Replace('\\', '_').Replace('?', '_'); @@ -271,7 +263,7 @@ namespace DiscImageChef.Server Revision = device.Revision, Bus = device.Bus, ReportLink = - url == null ? "No" : string.Format("Yes", url) + url == null ? "No" : $"Yes" }); } diff --git a/DiscImageChef.Server/ViewReport.aspx.cs b/DiscImageChef.Server/ViewReport.aspx.cs index 3ce74156f..b31e91cad 100644 --- a/DiscImageChef.Server/ViewReport.aspx.cs +++ b/DiscImageChef.Server/ViewReport.aspx.cs @@ -109,14 +109,12 @@ namespace DiscImageChef.Server lblUsbManufacturer.Text = HttpUtility.HtmlEncode(report.USB.Manufacturer); lblUsbProduct.Text = HttpUtility.HtmlEncode(report.USB.Product); - lblUsbVendor.Text = string.Format("0x{0:x4}", report.USB.VendorID); + lblUsbVendor.Text = $"0x{report.USB.VendorID:x4}"; if(usbVendorDescription != null) - lblUsbVendorDescription.Text = - string.Format("({0})", HttpUtility.HtmlEncode(usbVendorDescription)); - lblUsbProductId.Text = string.Format("0x{0:x4}", report.USB.ProductID); + lblUsbVendorDescription.Text = $"({HttpUtility.HtmlEncode(usbVendorDescription)})"; + lblUsbProductId.Text = $"0x{report.USB.ProductID:x4}"; if(usbProductDescription != null) - lblUsbProductDescription.Text = - string.Format("({0})", HttpUtility.HtmlEncode(usbProductDescription)); + lblUsbProductDescription.Text = $"({HttpUtility.HtmlEncode(usbProductDescription)})"; } else divUsb.Visible = false; @@ -124,8 +122,8 @@ namespace DiscImageChef.Server { lblFirewireManufacturer.Text = HttpUtility.HtmlEncode(report.FireWire.Manufacturer); lblFirewireProduct.Text = HttpUtility.HtmlEncode(report.FireWire.Product); - lblFirewireVendor.Text = string.Format("0x{0:x8}", report.FireWire.VendorID); - lblFirewireProductId.Text = string.Format("0x{0:x8}", report.FireWire.ProductID); + lblFirewireVendor.Text = $"0x{report.FireWire.VendorID:x8}"; + lblFirewireProductId.Text = $"0x{report.FireWire.ProductID:x8}"; } else divFirewire.Visible = false; @@ -133,8 +131,8 @@ namespace DiscImageChef.Server { lblPcmciaManufacturer.Text = HttpUtility.HtmlEncode(report.PCMCIA.Manufacturer); lblPcmciaProduct.Text = HttpUtility.HtmlEncode(report.PCMCIA.ProductName); - lblPcmciaManufacturerCode.Text = string.Format("0x{0:x4}", report.PCMCIA.ManufacturerCode); - lblPcmciaCardCode.Text = string.Format("0x{0:x4}", report.PCMCIA.CardCode); + lblPcmciaManufacturerCode.Text = $"0x{report.PCMCIA.ManufacturerCode:x4}"; + lblPcmciaCardCode.Text = $"0x{report.PCMCIA.CardCode:x4}"; lblPcmciaCompliance.Text = HttpUtility.HtmlEncode(report.PCMCIA.Compliance); Tuple[] tuples = CIS.GetTuples(report.PCMCIA.CIS); if(tuples != null) @@ -155,25 +153,15 @@ namespace DiscImageChef.Server foreach(DeviceGeometry geometry in geom.Geometries) { decodedTuples.Add("Device width", - string.Format("{0} bits", - (1 << (geometry.CardInterface - 1)) * 8)); + $"{(1 << (geometry.CardInterface - 1)) * 8} bits"); decodedTuples.Add("Erase block", - string.Format("{0} bytes", - (1 << (geometry.EraseBlockSize - 1)) * - (1 << (geometry.Interleaving - 1)))); + $"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes"); decodedTuples.Add("Read block", - string.Format("{0} bytes", - (1 << (geometry.ReadBlockSize - 1)) * - (1 << (geometry.Interleaving - 1)))); + $"{(1 << (geometry.ReadBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes"); decodedTuples.Add("Write block", - string.Format("{0} bytes", - (1 << (geometry.WriteBlockSize - 1)) * - (1 << (geometry.Interleaving - 1)))); + $"{(1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1))} bytes"); decodedTuples.Add("Partition alignment", - string.Format("{0} bytes", - (1 << (geometry.EraseBlockSize - 1)) * - (1 << (geometry.Interleaving - 1)) * - (1 << (geometry.Partitions - 1)))); + $"{(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) * (1 << (geometry.Partitions - 1))} bytes"); } break; @@ -214,7 +202,7 @@ namespace DiscImageChef.Server decodedTuples.Add("Undecoded tuple ID", tuple.Code.ToString()); break; default: - decodedTuples.Add("Unknown tuple ID", string.Format("0x{0:X2}", (byte)tuple.Code)); + decodedTuples.Add("Unknown tuple ID", $"0x{(byte)tuple.Code:X2}"); break; } @@ -273,9 +261,8 @@ namespace DiscImageChef.Server if(VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification) != report.SCSI.Inquiry.VendorIdentification) - lblScsiVendor.Text = string.Format("{0} ({1})", report.SCSI.Inquiry.VendorIdentification, - VendorString.Prettify(report.SCSI.Inquiry - .VendorIdentification)); + lblScsiVendor.Text = + $"{report.SCSI.Inquiry.VendorIdentification} ({VendorString.Prettify(report.SCSI.Inquiry.VendorIdentification)})"; else lblScsiVendor.Text = report.SCSI.Inquiry.VendorIdentification; lblScsiProduct.Text = report.SCSI.Inquiry.ProductIdentification; lblScsiRevision.Text = report.SCSI.Inquiry.ProductRevisionLevel; @@ -391,55 +378,27 @@ namespace DiscImageChef.Server if(report.SCSI.ReadCapabilities.BlocksSpecified && report.SCSI.ReadCapabilities.BlockSizeSpecified) { - scsiOneValue.Add(string.Format("Device has {0} blocks of {1} bytes each", - report.SCSI.ReadCapabilities.Blocks, - report.SCSI.ReadCapabilities.BlockSize)); + scsiOneValue.Add($"Device has {report.SCSI.ReadCapabilities.Blocks} blocks of {report.SCSI.ReadCapabilities.BlockSize} bytes each"); if(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 / 1024 > 1000000) - scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Tb, {2:F2} TiB", - report.SCSI.ReadCapabilities.Blocks * - report.SCSI.ReadCapabilities.BlockSize, - report.SCSI.ReadCapabilities.Blocks * - report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / - 1000 / 1000, - (double)(report.SCSI.ReadCapabilities.Blocks * - report.SCSI.ReadCapabilities.BlockSize) / 1024 / - 1024 / 1024 / 1024)); + scsiOneValue.Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000 / 1000} Tb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024 / 1024:F2} TiB"); else if( report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1024 / 1024 > 1000) - scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Gb, {2:F2} GiB", - report.SCSI.ReadCapabilities.Blocks * - report.SCSI.ReadCapabilities.BlockSize, - report.SCSI.ReadCapabilities.Blocks * - report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / - 1000, - (double)(report.SCSI.ReadCapabilities.Blocks * - report.SCSI.ReadCapabilities.BlockSize) / 1024 / - 1024 / 1024)); + scsiOneValue.Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000 / 1000} Gb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024 / 1024:F2} GiB"); else - scsiOneValue.Add(string.Format("Device size: {0} bytes, {1} Mb, {2:F2} MiB", - report.SCSI.ReadCapabilities.Blocks * - report.SCSI.ReadCapabilities.BlockSize, - report.SCSI.ReadCapabilities.Blocks * - report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000, - (double)(report.SCSI.ReadCapabilities.Blocks * - report.SCSI.ReadCapabilities.BlockSize) / 1024 / - 1024)); + scsiOneValue.Add($"Device size: {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize} bytes, {report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize / 1000 / 1000} Mb, {(double)(report.SCSI.ReadCapabilities.Blocks * report.SCSI.ReadCapabilities.BlockSize) / 1024 / 1024:F2} MiB"); } if(report.SCSI.ReadCapabilities.MediumTypeSpecified) - scsiOneValue.Add(string.Format("Medium type code: {0:X2}h", - report.SCSI.ReadCapabilities.MediumType)); + scsiOneValue.Add($"Medium type code: {report.SCSI.ReadCapabilities.MediumType:X2}h"); if(report.SCSI.ReadCapabilities.DensitySpecified) - scsiOneValue.Add(string.Format("Density code: {0:X2}h", - report.SCSI.ReadCapabilities.Density)); + scsiOneValue.Add($"Density code: {report.SCSI.ReadCapabilities.Density:X2}h"); if((report.SCSI.ReadCapabilities.SupportsReadLong || report.SCSI.ReadCapabilities.SupportsReadLong16) && report.SCSI.ReadCapabilities.LongBlockSizeSpecified) - scsiOneValue.Add(string.Format("Long block size: {0} bytes", - report.SCSI.ReadCapabilities.LongBlockSize)); + scsiOneValue.Add($"Long block size: {report.SCSI.ReadCapabilities.LongBlockSize} bytes"); if(report.SCSI.ReadCapabilities.SupportsReadCapacity) scsiOneValue.Add("Device supports READ CAPACITY (10) command."); if(report.SCSI.ReadCapabilities.SupportsReadCapacity16) diff --git a/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs b/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs index 8c0fa82d8..64d5ed0bf 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs b/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs index bbeb20d2e..a0a331fb9 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs b/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs index 402cebe5b..a56eb52cf 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs b/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs index 2b3ca1412..578db4b77 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs @@ -85,7 +85,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/AFS_MBR.cs b/DiscImageChef.Tests/Filesystems/AFS_MBR.cs index 49d4451f2..6ef391105 100644 --- a/DiscImageChef.Tests/Filesystems/AFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/AFS_MBR.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs b/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs index 8d154942b..aa0fa33da 100644 --- a/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs b/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs index e6b92d89c..9707627f8 100644 --- a/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs b/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs index 9e489e8c2..598de9bc6 100644 --- a/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs b/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs index 67a27f7de..6cd5a1dbd 100644 --- a/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/BeFS_APM.cs b/DiscImageChef.Tests/Filesystems/BeFS_APM.cs index 9e976f303..063676da9 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS_APM.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs b/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs index 14cce1c01..65f839eb7 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs b/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs index 532aca0a1..28617b8ab 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs @@ -76,7 +76,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs b/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs index 4d1b4323c..c128e7dd3 100644 --- a/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs b/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs index 1b0102db6..047023fc7 100644 --- a/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs b/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs index f465b7a01..f65529f14 100644 --- a/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/F2FS.cs b/DiscImageChef.Tests/Filesystems/F2FS.cs index 661e26de5..cb19796a1 100644 --- a/DiscImageChef.Tests/Filesystems/F2FS.cs +++ b/DiscImageChef.Tests/Filesystems/F2FS.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/FAT12_APM.cs b/DiscImageChef.Tests/Filesystems/FAT12_APM.cs index 48d1126f8..177fefa2b 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12_APM.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12_APM.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs b/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs index 2df4121d6..093e5d33c 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/FAT16_APM.cs b/DiscImageChef.Tests/Filesystems/FAT16_APM.cs index b4e240799..aabe2754b 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_APM.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_APM.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs b/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs index 7550d151d..adb1d6f15 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs b/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs index 7dfc80677..9595b541a 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs b/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs index 47c3e4d16..99387b184 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/FAT32_APM.cs b/DiscImageChef.Tests/Filesystems/FAT32_APM.cs index da6c4aa0f..24a6b0708 100644 --- a/DiscImageChef.Tests/Filesystems/FAT32_APM.cs +++ b/DiscImageChef.Tests/Filesystems/FAT32_APM.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs b/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs index 2459e2630..842fa2128 100644 --- a/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs b/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs index 984746029..1cb2ceb44 100644 --- a/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs @@ -76,7 +76,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs b/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs index 176f2939f..a8ac73791 100644 --- a/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs +++ b/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs @@ -111,7 +111,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs b/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs index 2360ad0eb..f80e704f3 100644 --- a/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs b/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs index 48fa7e95f..57c5e1368 100644 --- a/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs @@ -90,7 +90,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/HFSX_APM.cs b/DiscImageChef.Tests/Filesystems/HFSX_APM.cs index 36a35e716..d73776fc3 100644 --- a/DiscImageChef.Tests/Filesystems/HFSX_APM.cs +++ b/DiscImageChef.Tests/Filesystems/HFSX_APM.cs @@ -85,7 +85,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs b/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs index 41381ca5d..2dd6e7501 100644 --- a/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs b/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs index 24946d7c2..c70f5ac48 100644 --- a/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs @@ -82,7 +82,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/HFS_APM.cs b/DiscImageChef.Tests/Filesystems/HFS_APM.cs index 4a6aaff1c..fcdf4cf5b 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_APM.cs @@ -116,7 +116,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs b/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs index c914212b3..d24950de0 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs @@ -81,7 +81,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/HFS_MBR.cs b/DiscImageChef.Tests/Filesystems/HFS_MBR.cs index 5d9d6ff91..505526794 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_MBR.cs @@ -79,7 +79,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/HFS_RDB.cs b/DiscImageChef.Tests/Filesystems/HFS_RDB.cs index ddeb36340..561e0f790 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_RDB.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs b/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs index 9cb597c93..6ad1fca00 100644 --- a/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/JFS2.cs b/DiscImageChef.Tests/Filesystems/JFS2.cs index 49a435a1e..d747e89ab 100644 --- a/DiscImageChef.Tests/Filesystems/JFS2.cs +++ b/DiscImageChef.Tests/Filesystems/JFS2.cs @@ -76,7 +76,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs index 5c50b11b5..a5d97b3e1 100644 --- a/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs @@ -73,7 +73,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs index b526ff9b1..3d57407cb 100644 --- a/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs @@ -73,7 +73,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs index 70b864d5f..7cca8d10e 100644 --- a/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs @@ -73,7 +73,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/NILFS2.cs b/DiscImageChef.Tests/Filesystems/NILFS2.cs index d88b35f42..bf09ba21b 100644 --- a/DiscImageChef.Tests/Filesystems/NILFS2.cs +++ b/DiscImageChef.Tests/Filesystems/NILFS2.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs b/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs index 990544ce4..31c463fb9 100644 --- a/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs b/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs index 689971067..b7246e87a 100644 --- a/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs @@ -87,7 +87,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs b/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs index d6aeb84b6..277d5f761 100644 --- a/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs b/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs index a70fcceb1..39201b301 100644 --- a/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs @@ -83,7 +83,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs b/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs index 17cd05cf6..c3e2f170d 100644 --- a/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs @@ -71,7 +71,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs b/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs index 9a4648a3a..07e24754c 100644 --- a/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs @@ -76,7 +76,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); throw new NotImplementedException("ReFS is not yet implemented"); /* Filesystem fs = new DiscImageChef.Filesystems.ReFS(); diff --git a/DiscImageChef.Tests/Filesystems/Reiser3.cs b/DiscImageChef.Tests/Filesystems/Reiser3.cs index 871ff4fc2..3115b9a3d 100644 --- a/DiscImageChef.Tests/Filesystems/Reiser3.cs +++ b/DiscImageChef.Tests/Filesystems/Reiser3.cs @@ -73,7 +73,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/Reiser4.cs b/DiscImageChef.Tests/Filesystems/Reiser4.cs index 3e67ba13e..7526eed48 100644 --- a/DiscImageChef.Tests/Filesystems/Reiser4.cs +++ b/DiscImageChef.Tests/Filesystems/Reiser4.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/SFS_MBR.cs b/DiscImageChef.Tests/Filesystems/SFS_MBR.cs index 2f47003dd..1f3daf7e7 100644 --- a/DiscImageChef.Tests/Filesystems/SFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/SFS_MBR.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs b/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs index 53c738a7c..dd45dfa16 100644 --- a/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/SFS_RDB.cs b/DiscImageChef.Tests/Filesystems/SFS_RDB.cs index 0ed387f7e..729dd1b06 100644 --- a/DiscImageChef.Tests/Filesystems/SFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/SFS_RDB.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/SysV_MBR.cs b/DiscImageChef.Tests/Filesystems/SysV_MBR.cs index 42e757295..3ad02aff8 100644 --- a/DiscImageChef.Tests/Filesystems/SysV_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/SysV_MBR.cs @@ -78,7 +78,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/SysV_RDB.cs b/DiscImageChef.Tests/Filesystems/SysV_RDB.cs index 3be322ffc..2669712a0 100644 --- a/DiscImageChef.Tests/Filesystems/SysV_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/SysV_RDB.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/UFS_APM.cs b/DiscImageChef.Tests/Filesystems/UFS_APM.cs index 26094de0e..20f3b154d 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_APM.cs @@ -85,7 +85,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/UFS_MBR.cs b/DiscImageChef.Tests/Filesystems/UFS_MBR.cs index a9770611e..027687d04 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_MBR.cs @@ -120,7 +120,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs b/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs index 27de2b055..84dfbaa55 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs @@ -81,7 +81,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs b/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs index 643397247..e54904969 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs @@ -83,7 +83,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/UFS_RDB.cs b/DiscImageChef.Tests/Filesystems/UFS_RDB.cs index 670a441e8..6b10def1b 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_RDB.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs b/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs index 787390183..c794a1d7d 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs index b119c821c..0030a345d 100644 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs @@ -73,7 +73,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs index 080dab9bc..c58000d68 100644 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs b/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs index 194396856..d103d2583 100644 --- a/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/XFS_MBR.cs b/DiscImageChef.Tests/Filesystems/XFS_MBR.cs index 8e01185d6..056ffd1a7 100644 --- a/DiscImageChef.Tests/Filesystems/XFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/XFS_MBR.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/btrfs.cs b/DiscImageChef.Tests/Filesystems/btrfs.cs index 21acb435c..532aa7246 100644 --- a/DiscImageChef.Tests/Filesystems/btrfs.cs +++ b/DiscImageChef.Tests/Filesystems/btrfs.cs @@ -77,7 +77,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/exFAT_APM.cs b/DiscImageChef.Tests/Filesystems/exFAT_APM.cs index 37177ef54..023b496e9 100644 --- a/DiscImageChef.Tests/Filesystems/exFAT_APM.cs +++ b/DiscImageChef.Tests/Filesystems/exFAT_APM.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs b/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs index d383c8813..4a256aca4 100644 --- a/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs b/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs index af4cfd82b..a814122d0 100644 --- a/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/ext2.cs b/DiscImageChef.Tests/Filesystems/ext2.cs index fdc1fff31..e2fc71cb9 100644 --- a/DiscImageChef.Tests/Filesystems/ext2.cs +++ b/DiscImageChef.Tests/Filesystems/ext2.cs @@ -87,7 +87,7 @@ namespace DiscImageChef.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}"); Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); fs.GetInformation(image, partitions[part], out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef/Commands/Analyze.cs b/DiscImageChef/Commands/Analyze.cs index 3631d27e1..0f27926d7 100644 --- a/DiscImageChef/Commands/Analyze.cs +++ b/DiscImageChef/Commands/Analyze.cs @@ -169,12 +169,12 @@ namespace DiscImageChef.Commands if(idPlugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(idPlugins.Count > 1) { - DicConsole.WriteLine(string.Format("Identified by {0} plugins", idPlugins.Count)); + DicConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); foreach(string pluginName in idPlugins) if(plugins.PluginsList.TryGetValue(pluginName, out plugin)) { - DicConsole.WriteLine(string.Format("As identified by {0}.", plugin.Name)); + DicConsole.WriteLine($"As identified by {plugin.Name}."); plugin.GetInformation(imageFormat, partitions[i], out information); DicConsole.Write(information); Core.Statistics.AddFilesystem(plugin.XmlFSType.Type); @@ -185,7 +185,7 @@ namespace DiscImageChef.Commands plugins.PluginsList.TryGetValue(idPlugins[0], out plugin); if(plugin != null) { - DicConsole.WriteLine(string.Format("Identified by {0}.", plugin.Name)); + DicConsole.WriteLine($"Identified by {plugin.Name}."); plugin.GetInformation(imageFormat, partitions[i], out information); DicConsole.Write(information); Core.Statistics.AddFilesystem(plugin.XmlFSType.Type); @@ -208,12 +208,12 @@ namespace DiscImageChef.Commands if(idPlugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(idPlugins.Count > 1) { - DicConsole.WriteLine(string.Format("Identified by {0} plugins", idPlugins.Count)); + DicConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); foreach(string pluginName in idPlugins) if(plugins.PluginsList.TryGetValue(pluginName, out plugin)) { - DicConsole.WriteLine(string.Format("As identified by {0}.", plugin.Name)); + DicConsole.WriteLine($"As identified by {plugin.Name}."); plugin.GetInformation(imageFormat, wholePart, out information); DicConsole.Write(information); Core.Statistics.AddFilesystem(plugin.XmlFSType.Type); @@ -224,7 +224,7 @@ namespace DiscImageChef.Commands plugins.PluginsList.TryGetValue(idPlugins[0], out plugin); if(plugin != null) { - DicConsole.WriteLine(string.Format("Identified by {0}.", plugin.Name)); + DicConsole.WriteLine($"Identified by {plugin.Name}."); plugin.GetInformation(imageFormat, wholePart, out information); DicConsole.Write(information); Core.Statistics.AddFilesystem(plugin.XmlFSType.Type); @@ -234,7 +234,7 @@ namespace DiscImageChef.Commands } catch(Exception ex) { - DicConsole.ErrorWriteLine(string.Format("Error reading file: {0}", ex.Message)); + DicConsole.ErrorWriteLine($"Error reading file: {ex.Message}"); DicConsole.DebugWriteLine("Analyze command", ex.StackTrace); } diff --git a/DiscImageChef/Commands/CreateSidecar.cs b/DiscImageChef/Commands/CreateSidecar.cs index f74eeba71..42fdf314c 100644 --- a/DiscImageChef/Commands/CreateSidecar.cs +++ b/DiscImageChef/Commands/CreateSidecar.cs @@ -144,7 +144,7 @@ namespace DiscImageChef.Commands } catch(Exception ex) { - DicConsole.ErrorWriteLine(string.Format("Error reading file: {0}", ex.Message)); + DicConsole.ErrorWriteLine($"Error reading file: {ex.Message}"); DicConsole.DebugWriteLine("Analyze command", ex.StackTrace); } } diff --git a/DiscImageChef/Commands/DeviceInfo.cs b/DiscImageChef/Commands/DeviceInfo.cs index 5aac8411a..9e4a0d94f 100644 --- a/DiscImageChef/Commands/DeviceInfo.cs +++ b/DiscImageChef/Commands/DeviceInfo.cs @@ -300,8 +300,7 @@ namespace DiscImageChef.Commands EVPD.DecodeASCIIPage(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0x80) { @@ -311,8 +310,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Unit Serial Number: {0}", EVPD.DecodePage80(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0x81) { @@ -321,8 +319,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_81(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0x82) { @@ -332,8 +329,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("ASCII implemented operating definitions: {0}", EVPD.DecodePage82(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0x83) { @@ -342,8 +338,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_83(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0x84) { @@ -352,8 +347,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_84(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0x85) { @@ -362,8 +356,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_85(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0x86) { @@ -372,8 +365,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_86(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0x89) { @@ -382,8 +374,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_89(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0xB0) { @@ -392,8 +383,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_B0(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0xB1) { @@ -403,8 +393,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Manufacturer-assigned Serial Number: {0}", EVPD.DecodePageB1(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0xB2) { @@ -414,8 +403,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("TapeAlert Supported Flags Bitmap: 0x{0:X16}", EVPD.DecodePageB2(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0xB3) { @@ -425,8 +413,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Automation Device Serial Number: {0}", EVPD.DecodePageB3(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0xB4) { @@ -436,8 +423,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Data Transfer Device Element Address: 0x{0}", EVPD.DecodePageB4(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0xC0 && StringHandlers @@ -449,8 +435,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_Quantum(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0xC0 && StringHandlers @@ -462,8 +447,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_Seagate(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0xC0 && StringHandlers @@ -475,8 +459,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_IBM(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0xC1 && StringHandlers @@ -488,8 +471,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C1_IBM(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if((page == 0xC0 || page == 0xC1) && StringHandlers @@ -502,8 +484,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_C1_Certance(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if( (page == 0xC2 || page == 0xC3 || page == 0xC4 || page == 0xC5 || page == 0xC6) && @@ -517,8 +498,7 @@ namespace DiscImageChef.Commands EVPD .PrettifyPage_C2_C3_C4_C5_C6_Certance(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if((page == 0xC0 || page == 0xC1 || page == 0xC2 || page == 0xC3 || page == 0xC4 || page == 0xC5) && @@ -532,8 +512,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_C0_to_C5_HP(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else if(page == 0xDF && StringHandlers @@ -546,8 +525,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0}", EVPD.PrettifyPage_DF_Certance(inqBuf)); DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } else { @@ -559,8 +537,7 @@ namespace DiscImageChef.Commands sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); if(!sense) DataFile.WriteTo("Device-Info command", options.OutputPrefix, - string.Format("_scsi_evpd_{0:X2}h.bin", page), - string.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); + $"_scsi_evpd_{page:X2}h.bin", $"SCSI INQUIRY EVPD {page:X2}h", inqBuf); } } diff --git a/DiscImageChef/Commands/ExtractFiles.cs b/DiscImageChef/Commands/ExtractFiles.cs index 5d4ca707b..231f0deba 100644 --- a/DiscImageChef/Commands/ExtractFiles.cs +++ b/DiscImageChef/Commands/ExtractFiles.cs @@ -155,12 +155,12 @@ namespace DiscImageChef.Commands if(idPlugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(idPlugins.Count > 1) { - DicConsole.WriteLine(string.Format("Identified by {0} plugins", idPlugins.Count)); + DicConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); foreach(string pluginName in idPlugins) if(plugins.PluginsList.TryGetValue(pluginName, out plugin)) { - DicConsole.WriteLine(string.Format("As identified by {0}.", plugin.Name)); + DicConsole.WriteLine($"As identified by {plugin.Name}."); Filesystem fs = (Filesystem)plugin .GetType().GetConstructor(new[] { @@ -308,7 +308,7 @@ namespace DiscImageChef.Commands else { plugins.PluginsList.TryGetValue(idPlugins[0], out plugin); - DicConsole.WriteLine(string.Format("Identified by {0}.", plugin.Name)); + DicConsole.WriteLine($"Identified by {plugin.Name}."); Filesystem fs = (Filesystem)plugin .GetType().GetConstructor(new[] { @@ -445,12 +445,12 @@ namespace DiscImageChef.Commands if(idPlugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(idPlugins.Count > 1) { - DicConsole.WriteLine(string.Format("Identified by {0} plugins", idPlugins.Count)); + DicConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); foreach(string pluginName in idPlugins) if(plugins.PluginsList.TryGetValue(pluginName, out plugin)) { - DicConsole.WriteLine(string.Format("As identified by {0}.", plugin.Name)); + DicConsole.WriteLine($"As identified by {plugin.Name}."); Filesystem fs = (Filesystem)plugin .GetType().GetConstructor(new[] { @@ -577,7 +577,7 @@ namespace DiscImageChef.Commands else { plugins.PluginsList.TryGetValue(idPlugins[0], out plugin); - DicConsole.WriteLine(string.Format("Identified by {0}.", plugin.Name)); + DicConsole.WriteLine($"Identified by {plugin.Name}."); Filesystem fs = (Filesystem)plugin .GetType().GetConstructor(new[] { @@ -694,7 +694,7 @@ namespace DiscImageChef.Commands } catch(Exception ex) { - DicConsole.ErrorWriteLine(string.Format("Error reading file: {0}", ex.Message)); + DicConsole.ErrorWriteLine($"Error reading file: {ex.Message}"); DicConsole.DebugWriteLine("Extract-Files command", ex.StackTrace); } diff --git a/DiscImageChef/Commands/Ls.cs b/DiscImageChef/Commands/Ls.cs index b01fea51e..edf7b7e92 100644 --- a/DiscImageChef/Commands/Ls.cs +++ b/DiscImageChef/Commands/Ls.cs @@ -142,12 +142,12 @@ namespace DiscImageChef.Commands if(idPlugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(idPlugins.Count > 1) { - DicConsole.WriteLine(string.Format("Identified by {0} plugins", idPlugins.Count)); + DicConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); foreach(string pluginName in idPlugins) if(plugins.PluginsList.TryGetValue(pluginName, out plugin)) { - DicConsole.WriteLine(string.Format("As identified by {0}.", plugin.Name)); + DicConsole.WriteLine($"As identified by {plugin.Name}."); Filesystem fs = (Filesystem)plugin .GetType().GetConstructor(new[] { @@ -180,7 +180,7 @@ namespace DiscImageChef.Commands plugins.PluginsList.TryGetValue(idPlugins[0], out plugin); if(plugin == null) continue; - DicConsole.WriteLine(string.Format("Identified by {0}.", plugin.Name)); + DicConsole.WriteLine($"Identified by {plugin.Name}."); Filesystem fs = (Filesystem)plugin .GetType().GetConstructor(new[] { @@ -217,12 +217,12 @@ namespace DiscImageChef.Commands if(idPlugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); else if(idPlugins.Count > 1) { - DicConsole.WriteLine(string.Format("Identified by {0} plugins", idPlugins.Count)); + DicConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); foreach(string pluginName in idPlugins) if(plugins.PluginsList.TryGetValue(pluginName, out plugin)) { - DicConsole.WriteLine(string.Format("As identified by {0}.", plugin.Name)); + DicConsole.WriteLine($"As identified by {plugin.Name}."); Filesystem fs = (Filesystem)plugin .GetType().GetConstructor(new[] { @@ -252,7 +252,7 @@ namespace DiscImageChef.Commands plugins.PluginsList.TryGetValue(idPlugins[0], out plugin); if(plugin != null) { - DicConsole.WriteLine(string.Format("Identified by {0}.", plugin.Name)); + DicConsole.WriteLine($"Identified by {plugin.Name}."); Filesystem fs = (Filesystem)plugin .GetType().GetConstructor(new[] {typeof(ImagePlugin), typeof(Partition), typeof(Encoding)}) ?.Invoke(new object[] {imageFormat, wholePart, null}); @@ -303,7 +303,7 @@ namespace DiscImageChef.Commands } catch(Exception ex) { - DicConsole.ErrorWriteLine(string.Format("Error reading file: {0}", ex.Message)); + DicConsole.ErrorWriteLine($"Error reading file: {ex.Message}"); DicConsole.DebugWriteLine("Ls command", ex.StackTrace); }