diff --git a/DiscUtils/DiscUtils.Fat/Modified/FatFileSystem.cs b/DiscUtils/DiscUtils.Fat/Modified/FatFileSystem.cs index 6ffc04b..da849ee 100644 --- a/DiscUtils/DiscUtils.Fat/Modified/FatFileSystem.cs +++ b/DiscUtils/DiscUtils.Fat/Modified/FatFileSystem.cs @@ -1915,9 +1915,7 @@ namespace DiscUtils.Fat throw new DirectoryNotFoundException(string.Format(CultureInfo.InvariantCulture, "The directory '{0}' was not found", path)); } - DirectoryEntry[] entries = dir.Entries; - - foreach (DirectoryEntry de in entries) + foreach (DirectoryEntry de in dir.Entries) { bool isDir = (de.Attributes & FatAttributes.Directory) != 0; diff --git a/HelperClasses.cs b/HelperClasses.cs index 0529fb6..0b680d3 100644 --- a/HelperClasses.cs +++ b/HelperClasses.cs @@ -2221,8 +2221,7 @@ namespace WPinternals } else { - double width = Math.Max(allowedSpace * (Percentage / totalPercentage), 0); - _element.Width = width; + _element.Width = (double)Math.Max(allowedSpace * (Percentage / totalPercentage), 0); } } } diff --git a/Models/GPT.cs b/Models/GPT.cs index b669bd7..7229851 100644 --- a/Models/GPT.cs +++ b/Models/GPT.cs @@ -570,8 +570,7 @@ namespace WPinternals { // This is necessary, because the partitions and backup-partitions can exchange. // This may cause the startsector to be higher than the maximum allowed sector for flashing with a Lumia V1 programmer (hardcoded in programmer) - List RevisePartitions = new(new string[] { "SBL1", "SBL2", "SBL3", "UEFI", "TZ", "RPM", "WINSECAPP" }); - foreach (string RevisePartitionName in RevisePartitions) + foreach (string RevisePartitionName in (List)(new(new string[] { "SBL1", "SBL2", "SBL3", "UEFI", "TZ", "RPM", "WINSECAPP" }))) { Partition RevisePartition = GetPartition(RevisePartitionName); Partition ReviseBackupPartition = GetPartition("BACKUP_" + RevisePartitionName); diff --git a/Models/MassStorage.cs b/Models/MassStorage.cs index 31950ff..c08d88e 100644 --- a/Models/MassStorage.cs +++ b/Models/MassStorage.cs @@ -41,8 +41,7 @@ namespace WPinternals { try { - ManagementObjectCollection coll = new ManagementObjectSearcher("select * from Win32_LogicalDisk").Get(); - foreach (ManagementObject logical in coll) + foreach (ManagementObject logical in new ManagementObjectSearcher("select * from Win32_LogicalDisk").Get()) { System.Diagnostics.Debug.Print(logical["Name"].ToString()); diff --git a/Models/NokiaFlashModel.cs b/Models/NokiaFlashModel.cs index 6421cea..6fd324e 100644 --- a/Models/NokiaFlashModel.cs +++ b/Models/NokiaFlashModel.cs @@ -206,8 +206,7 @@ namespace WPinternals if ((TerminalResponse?.Length > 0x20) && (BigEndian.ToUInt32(TerminalResponse, 0x14) == (TerminalResponse.Length - 0x18)) && (BitConverter.ToUInt32(TerminalResponse, 0x1C) == (TerminalResponse.Length - 0x20))) { // Parse Terminal Response from offset 0x18 - TerminalResponse ParsedResponse = Terminal.Parse(TerminalResponse, 0x18); - return ParsedResponse; + return Terminal.Parse(TerminalResponse, 0x18); } else { @@ -1216,8 +1215,7 @@ namespace WPinternals ByteOperations.WriteAsciiString(Request, 0, "NOKXPH" + VariableName + "\0"); // BTR or CTR, CTR is public ProductCode byte[] Response = ExecuteRawMethod(Request); UInt16 Length = BigEndian.ToUInt16(Response, 6); - string Result = ByteOperations.ReadAsciiString(Response, 8, Length).Trim(new char[] { ' ', '\0' }); - return Result; + return ByteOperations.ReadAsciiString(Response, 8, Length).Trim(new char[] { ' ', '\0' }); } internal string ReadProductCode() @@ -1373,7 +1371,7 @@ namespace WPinternals break; } - LogFile.Log("SecureBoot: " + ((!PlatformSecureBootEnabled || !UefiSecureBootEnabled) ? "Disabled" : "Enabled") + " (Platform Secure Boot: " + (PlatformSecureBootEnabled ? "Enabled" : "Disabled") + ", UEFI Secure Boot: " + (PlatformSecureBootEnabled ? "Enabled" : "Disabled") + ")", Type); + LogFile.Log("SecureBoot: " + ((!PlatformSecureBootEnabled || !UefiSecureBootEnabled) ? "Disabled" : "Enabled") + " (Platform Secure Boot: " + (PlatformSecureBootEnabled ? "Enabled" : "Disabled") + ", UEFI Secure Boot: " + (UefiSecureBootEnabled ? "Enabled" : "Disabled") + ")", Type); if ((Type == LogType.ConsoleOnly) || (Type == LogType.FileAndConsole)) { diff --git a/Models/QualcommLoader.cs b/Models/QualcommLoader.cs index e5373a3..390abaa 100644 --- a/Models/QualcommLoader.cs +++ b/Models/QualcommLoader.cs @@ -33,8 +33,7 @@ namespace WPinternals try { - IEnumerable FilePaths = Directory.EnumerateFiles(Path); - foreach (string FilePath in FilePaths) + foreach (string FilePath in Directory.EnumerateFiles(Path)) { try { diff --git a/ViewModels/DownloadsViewModel.cs b/ViewModels/DownloadsViewModel.cs index a596e03..f4897e0 100644 --- a/ViewModels/DownloadsViewModel.cs +++ b/ViewModels/DownloadsViewModel.cs @@ -275,8 +275,7 @@ namespace WPinternals private void DownloadSelected() { - IEnumerable Selection = SearchResultList.Where(r => r.IsSelected); - foreach (SearchResult Result in Selection) + foreach (SearchResult Result in SearchResultList.Where(r => r.IsSelected)) { App.DownloadManager.Download(Result.URLs, Result.Category, Result.Callback, Result.State); } diff --git a/ViewModels/LumiaV2UnlockBootViewModel.cs b/ViewModels/LumiaV2UnlockBootViewModel.cs index d6c6094..a6b2cce 100644 --- a/ViewModels/LumiaV2UnlockBootViewModel.cs +++ b/ViewModels/LumiaV2UnlockBootViewModel.cs @@ -249,9 +249,7 @@ namespace WPinternals throw new WPinternalsException("Failed to switch to Mass Storage Mode"); } - string Drive = Storage.Drive; - - return Drive; + return Storage.Drive; } internal static async Task LumiaV2ClearNV(System.Threading.SynchronizationContext UIContext, string FFUPath, bool DoResetFirst = true) diff --git a/WinUSBNet/API/DeviceManagement.cs b/WinUSBNet/API/DeviceManagement.cs index 62433fc..9ca5e68 100644 --- a/WinUSBNet/API/DeviceManagement.cs +++ b/WinUSBNet/API/DeviceManagement.cs @@ -64,9 +64,7 @@ namespace MadWizard.WinUSBNet.API } // Store the device name in a String. - string deviceNameString = new(devBroadcastDeviceInterface.dbcc_name, 0, stringSize); - - return deviceNameString; + return (string)(new(devBroadcastDeviceInterface.dbcc_name, 0, stringSize)); } else if (devBroadcastHeader.dbch_devicetype == DBT_DEVTYP_VOLUME) { diff --git a/WinUSBNet/USBNotifier.cs b/WinUSBNet/USBNotifier.cs index c2ff07d..a0bbf42 100644 --- a/WinUSBNet/USBNotifier.cs +++ b/WinUSBNet/USBNotifier.cs @@ -81,8 +81,7 @@ namespace MadWizard.WinUSBNet { _Arrival -= value; _Arrival += value; - USBDeviceInfo[] Devices = USBDevice.GetDevices(Guid); - foreach (USBDeviceInfo Device in Devices) + foreach (USBDeviceInfo Device in USBDevice.GetDevices(Guid)) { _Arrival(this, new USBEvent(USBEventType.DeviceArrival, Guid, Device.DevicePath)); }