mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Fix some minor problems detected by the analyzers.
This commit is contained in:
@@ -986,11 +986,13 @@ public static class PFI
|
||||
|
||||
public static string Prettify(byte[] response, MediaType mediaType) => Prettify(Decode(response, mediaType));
|
||||
|
||||
#pragma warning disable PH2077 // Waiting to get more information on the actual values
|
||||
public static string ManufacturerFromDVDRAM(string manufacturerId) => manufacturerId switch
|
||||
{
|
||||
_ =>
|
||||
ManufacturerFromDVDPlusID(manufacturerId)
|
||||
};
|
||||
#pragma warning restore PH2077
|
||||
|
||||
[SuppressMessage("ReSharper", "StringLiteralTypo")]
|
||||
public static string ManufacturerFromDVDPlusID(string manufacturerId)
|
||||
|
||||
@@ -39,7 +39,9 @@ namespace Aaru.Devices;
|
||||
|
||||
public partial class Device
|
||||
{
|
||||
#pragma warning disable PH2070 // Risks are known. TODO: Maybe protected property?
|
||||
protected static bool _readMultipleBlockCannotSetBlockCount;
|
||||
#pragma warning restore PH2070
|
||||
|
||||
/// <summary>Reads the CSD register from a SecureDigital or MultiMediaCard device</summary>
|
||||
/// <param name="buffer">Data buffer</param>
|
||||
|
||||
@@ -43,20 +43,6 @@ public partial class Device
|
||||
const string SD_MODULE_NAME = "SecureDigital Device";
|
||||
const string MMC_MODULE_NAME = "MultiMediaCard Device";
|
||||
|
||||
// MMC and SecureDigital, values that need to be get with card idle, something that may
|
||||
// not be possible to do but usually is already done by the SDHCI driver.
|
||||
private protected byte[] CachedCid;
|
||||
private protected byte[] CachedCsd;
|
||||
private protected byte[] CachedOcr;
|
||||
private protected byte[] CachedScr;
|
||||
|
||||
private protected string DevicePath;
|
||||
private protected ulong FirewireGuid;
|
||||
private protected uint FirewireModel;
|
||||
private protected uint FirewireVendor;
|
||||
private protected ushort UsbProduct;
|
||||
private protected ushort UsbVendor;
|
||||
|
||||
/// <summary>Gets the Platform ID for this device</summary>
|
||||
/// <value>The Platform ID</value>
|
||||
public PlatformID PlatformId { get; private protected set; }
|
||||
@@ -163,4 +149,20 @@ public partial class Device
|
||||
|
||||
/// <summary>Contains the PCMCIA CIS if applicable</summary>
|
||||
public byte[] Cis { get; private protected set; }
|
||||
|
||||
// MMC and SecureDigital, values that need to be get with card idle, something that may
|
||||
// not be possible to do but usually is already done by the SDHCI driver.
|
||||
#pragma warning disable PH2070 // Risks are known. TODO: Maybe protected property?
|
||||
private protected byte[] CachedCid;
|
||||
private protected byte[] CachedCsd;
|
||||
private protected byte[] CachedOcr;
|
||||
private protected byte[] CachedScr;
|
||||
|
||||
private protected string DevicePath;
|
||||
private protected ulong FirewireGuid;
|
||||
private protected uint FirewireModel;
|
||||
private protected uint FirewireVendor;
|
||||
private protected ushort UsbProduct;
|
||||
private protected ushort UsbVendor;
|
||||
#pragma warning restore PH2070
|
||||
}
|
||||
@@ -167,8 +167,9 @@ public sealed partial class CPM
|
||||
if(errno != ErrorNumber.NoError) return errno;
|
||||
|
||||
if(_workingDefinition.complement)
|
||||
for(var b = 0; b < readSector.Length; b++)
|
||||
readSector[b] = (byte)(~readSector[b] & 0xFF);
|
||||
{
|
||||
for(var b = 0; b < readSector.Length; b++) readSector[b] = (byte)(~readSector[b] & 0xFF);
|
||||
}
|
||||
|
||||
deinterleavedSectors.Add((ulong)p, readSector);
|
||||
}
|
||||
@@ -757,8 +758,6 @@ public sealed partial class CPM
|
||||
_decodedPasswordCache = new Dictionary<string, byte[]>();
|
||||
|
||||
// For each stored password, store a decoded version of it
|
||||
if(_passwordCache.Count > 0)
|
||||
{
|
||||
foreach(KeyValuePair<string, byte[]> kvp in _passwordCache)
|
||||
{
|
||||
var tmp = new byte[8];
|
||||
@@ -768,7 +767,6 @@ public sealed partial class CPM
|
||||
|
||||
_decodedPasswordCache.Add(kvp.Key, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
// Generate statfs.
|
||||
_cpmStat.Blocks = (ulong)(_dpb.dsm + 1);
|
||||
|
||||
@@ -1423,17 +1423,13 @@ public sealed class ImageConvertViewModel : ViewModelBase
|
||||
Progress2Value = Progress2MaxValue;
|
||||
});
|
||||
|
||||
if(isrcs.Count > 0)
|
||||
{
|
||||
foreach(KeyValuePair<byte, string> isrc in isrcs)
|
||||
{
|
||||
outputOptical.WriteSectorTag(Encoding.UTF8.GetBytes(isrc.Value),
|
||||
isrc.Key,
|
||||
SectorTagType.CdTrackIsrc);
|
||||
}
|
||||
}
|
||||
|
||||
if(trackFlags.Count > 0)
|
||||
foreach(KeyValuePair<byte, byte> flags in trackFlags)
|
||||
outputOptical.WriteSectorTag([flags.Value], flags.Key, SectorTagType.CdTrackFlags);
|
||||
|
||||
|
||||
@@ -229,26 +229,17 @@ public sealed class SGI : IPartition
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct Label
|
||||
{
|
||||
/// <summary></summary>
|
||||
public readonly uint magic;
|
||||
/// <summary></summary>
|
||||
public readonly short root_part_num;
|
||||
/// <summary></summary>
|
||||
public readonly short swap_part_num;
|
||||
/// <summary></summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public readonly byte[] boot_file;
|
||||
/// <summary></summary>
|
||||
public readonly DeviceParameters device_params;
|
||||
/// <summary></summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
|
||||
public readonly Volume[] volume;
|
||||
/// <summary></summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public readonly Partition[] partitions;
|
||||
/// <summary></summary>
|
||||
public readonly uint csum;
|
||||
/// <summary></summary>
|
||||
public readonly uint padding;
|
||||
}
|
||||
|
||||
@@ -259,11 +250,8 @@ public sealed class SGI : IPartition
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct Partition
|
||||
{
|
||||
/// <summary></summary>
|
||||
public readonly uint num_blocks;
|
||||
/// <summary></summary>
|
||||
public readonly uint first_block;
|
||||
/// <summary></summary>
|
||||
public readonly SGIType type;
|
||||
}
|
||||
|
||||
@@ -299,12 +287,9 @@ public sealed class SGI : IPartition
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct Volume
|
||||
{
|
||||
/// <summary></summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public readonly byte[] name;
|
||||
/// <summary></summary>
|
||||
public readonly uint block_num;
|
||||
/// <summary></summary>
|
||||
public readonly uint num_bytes;
|
||||
}
|
||||
|
||||
|
||||
@@ -404,11 +404,8 @@ public abstract class OpticalImageConvertIssueTest
|
||||
}
|
||||
}
|
||||
|
||||
if(isrcs.Count > 0)
|
||||
{
|
||||
foreach(KeyValuePair<byte, string> isrc in isrcs)
|
||||
outputOptical.WriteSectorTag(Encoding.UTF8.GetBytes(isrc.Value), isrc.Key, SectorTagType.CdTrackIsrc);
|
||||
}
|
||||
|
||||
if(trackFlags.Count > 0)
|
||||
{
|
||||
|
||||
@@ -502,15 +502,12 @@ public abstract class WritableOpticalMediaImageTest : BaseWritableMediaImageTest
|
||||
}
|
||||
}
|
||||
|
||||
if(isrcs.Count > 0)
|
||||
{
|
||||
foreach(KeyValuePair<byte, string> isrc in isrcs)
|
||||
{
|
||||
outputFormat.WriteSectorTag(Encoding.UTF8.GetBytes(isrc.Value),
|
||||
isrc.Key,
|
||||
SectorTagType.CdTrackIsrc);
|
||||
}
|
||||
}
|
||||
|
||||
if(trackFlags.Count > 0)
|
||||
{
|
||||
|
||||
@@ -1412,19 +1412,16 @@ sealed class ConvertImageCommand : Command
|
||||
if(errno != ErrorNumber.NoError && !force) return (int)errno;
|
||||
}
|
||||
|
||||
if(isrcs.Count > 0)
|
||||
{
|
||||
foreach(KeyValuePair<byte, string> isrc in isrcs)
|
||||
{
|
||||
outputOptical.WriteSectorTag(Encoding.UTF8.GetBytes(isrc.Value),
|
||||
isrc.Key,
|
||||
SectorTagType.CdTrackIsrc);
|
||||
}
|
||||
outputOptical.WriteSectorTag(Encoding.UTF8.GetBytes(isrc.Value), isrc.Key, SectorTagType.CdTrackIsrc);
|
||||
}
|
||||
|
||||
if(trackFlags.Count > 0)
|
||||
{
|
||||
foreach((byte track, byte flags) in trackFlags)
|
||||
outputOptical.WriteSectorTag([flags], track, SectorTagType.CdTrackFlags);
|
||||
}
|
||||
|
||||
if(mcn != null) outputOptical.WriteMediaTag(Encoding.UTF8.GetBytes(mcn), MediaTagType.CD_MCN);
|
||||
|
||||
|
||||
@@ -415,10 +415,12 @@ sealed class DecodeCommand : Command
|
||||
{
|
||||
switch(tag)
|
||||
{
|
||||
#pragma warning disable PH2077 // TODO: Implement some!
|
||||
default:
|
||||
AaruConsole.WriteLine(UI.Decoder_for_sector_tag_type_0_not_yet_implemented_sorry, tag);
|
||||
|
||||
break;
|
||||
#pragma warning restore PH2077
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,29 +221,21 @@ sealed class MediaScanCommand : Command
|
||||
AaruConsole.WriteLine($"[bold]{Localization.Core.Summary}:[/]");
|
||||
AaruConsole.WriteLine($"[lime]{string.Format(Localization.Core._0_sectors_took_less_than_3_ms, results.A)}[/]");
|
||||
|
||||
AaruConsole.WriteLine($"[green]{
|
||||
string.Format(Localization.Core._0_sectors_took_less_than_10_ms_but_more_than_3_ms, results.B)}[/]");
|
||||
AaruConsole.WriteLine($"[green]{string.Format(Localization.Core._0_sectors_took_less_than_10_ms_but_more_than_3_ms, results.B)}[/]");
|
||||
|
||||
AaruConsole.WriteLine($"[darkorange]{
|
||||
string.Format(Localization.Core._0_sectors_took_less_than_50_ms_but_more_than_10_ms, results.C)}[/]");
|
||||
AaruConsole.WriteLine($"[darkorange]{string.Format(Localization.Core._0_sectors_took_less_than_50_ms_but_more_than_10_ms, results.C)}[/]");
|
||||
|
||||
AaruConsole.WriteLine($"[olive]{
|
||||
string.Format(Localization.Core._0_sectors_took_less_than_150_ms_but_more_than_50_ms, results.D)}[/]");
|
||||
AaruConsole.WriteLine($"[olive]{string.Format(Localization.Core._0_sectors_took_less_than_150_ms_but_more_than_50_ms, results.D)}[/]");
|
||||
|
||||
AaruConsole.WriteLine($"[orange3]{
|
||||
string.Format(Localization.Core._0_sectors_took_less_than_500_ms_but_more_than_150_ms, results.E)}[/]");
|
||||
AaruConsole.WriteLine($"[orange3]{string.Format(Localization.Core._0_sectors_took_less_than_500_ms_but_more_than_150_ms, results.E)}[/]");
|
||||
|
||||
AaruConsole.WriteLine($"[red]{string.Format(Localization.Core._0_sectors_took_more_than_500_ms, results.F)
|
||||
}[/]");
|
||||
AaruConsole.WriteLine($"[red]{string.Format(Localization.Core._0_sectors_took_more_than_500_ms, results.F)}[/]");
|
||||
|
||||
AaruConsole.WriteLine($"[maroon]{string.Format(Localization.Core._0_sectors_could_not_be_read,
|
||||
results.UnreadableSectors.Count)}[/]");
|
||||
|
||||
if(results.UnreadableSectors.Count > 0)
|
||||
{
|
||||
foreach(ulong bad in results.UnreadableSectors)
|
||||
AaruConsole.WriteLine(Localization.Core.Sector_0_could_not_be_read, bad);
|
||||
}
|
||||
|
||||
AaruConsole.WriteLine();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user