REFACTOR: Loop can be converted into LINQ-expression.

This commit is contained in:
2017-12-21 07:08:26 +00:00
parent 4d886dae25
commit 5592f147ac
71 changed files with 668 additions and 1131 deletions

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/
using System;
using System.Linq;
using System.Runtime.InteropServices;
using DiscImageChef.Console;
using DiscImageChef.Decoders.ATA;
@@ -670,7 +671,7 @@ namespace DiscImageChef.Devices
if(string.IsNullOrEmpty(manufacturer)) manufacturer = usbManufacturerString;
if(string.IsNullOrEmpty(model)) model = usbProductString;
if(string.IsNullOrEmpty(serial)) serial = usbSerialString;
else foreach(char c in serial) if(char.IsControl(c)) serial = usbSerialString;
else foreach(char c in serial.Where(c => char.IsControl(c))) serial = usbSerialString;
}
if(!firewire) return;
@@ -678,7 +679,7 @@ 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) if(char.IsControl(c)) serial = string.Format("{0:X16}", firewireGuid);
else foreach(char c in serial.Where(c => char.IsControl(c))) serial = string.Format("{0:X16}", firewireGuid);
}
static int ConvertFromHexAscii(string file, out byte[] outBuf)