diff --git a/Aaru.Checksums b/Aaru.Checksums index 843291076..b2612422a 160000 --- a/Aaru.Checksums +++ b/Aaru.Checksums @@ -1 +1 @@ -Subproject commit 843291076cd12156aaa09040ecc511eee64db4bd +Subproject commit b2612422abea422c4b07419b45fd032b5b11801f diff --git a/Aaru.CommonTypes b/Aaru.CommonTypes index 1fe6700b1..1389baf6b 160000 --- a/Aaru.CommonTypes +++ b/Aaru.CommonTypes @@ -1 +1 @@ -Subproject commit 1fe6700b1143a9054ea48903a6a1647060971674 +Subproject commit 1389baf6b2742edf9e90beb83905571185524817 diff --git a/Aaru.Compression/AppleRle.cs b/Aaru.Compression/AppleRle.cs index 2a39176f5..0581d6e95 100644 --- a/Aaru.Compression/AppleRle.cs +++ b/Aaru.Compression/AppleRle.cs @@ -42,9 +42,8 @@ namespace Aaru.Compression readonly Stream _inStream; int _count; bool _nextA; // true if A, false if B - - byte _repeatedByteA, _repeatedByteB; - bool _repeatMode; // true if we're repeating, false if we're just copying + byte _repeatedByteA, _repeatedByteB; + bool _repeatMode; // true if we're repeating, false if we're just copying public AppleRle(Stream stream) { diff --git a/Aaru.Core/Checksum.cs b/Aaru.Core/Checksum.cs index 89ea07ed6..0ed228e56 100644 --- a/Aaru.Core/Checksum.cs +++ b/Aaru.Core/Checksum.cs @@ -51,7 +51,7 @@ namespace Aaru.Core } /// Checksums and hashes data, with different algorithms multithreaded - public class Checksum + public sealed class Checksum { readonly IChecksum _adler32Ctx; readonly IChecksum _crc16Ctx; diff --git a/Aaru.Core/DataFile.cs b/Aaru.Core/DataFile.cs index 60763367b..ea884932e 100644 --- a/Aaru.Core/DataFile.cs +++ b/Aaru.Core/DataFile.cs @@ -37,8 +37,9 @@ using Aaru.Console; namespace Aaru.Core { /// Abstracts a datafile with a block based interface - [SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")] - public class DataFile + [SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global"), + SuppressMessage("ReSharper", "UnusedMember.Global")] + public sealed class DataFile { readonly FileStream _dataFs; diff --git a/Aaru.Core/Delegates.cs b/Aaru.Core/Delegates.cs index 46a442efa..a200e150b 100644 --- a/Aaru.Core/Delegates.cs +++ b/Aaru.Core/Delegates.cs @@ -32,7 +32,7 @@ namespace Aaru.Core { - /// Initializates a progress indicator (e.g. makes a progress bar visible) + /// Initializes a progress indicator (e.g. makes a progress bar visible) public delegate void InitProgressHandler(); /// Updates a progress indicator with text @@ -41,10 +41,10 @@ namespace Aaru.Core /// Pulses a progress indicator with indeterminate boundaries public delegate void PulseProgressHandler(string text); - /// Uninitializates a progress indicator (e.g. adds a newline to the console) + /// Uninitializes a progress indicator (e.g. adds a newline to the console) public delegate void EndProgressHandler(); - /// Initializates a secondary progress indicator (e.g. makes a progress bar visible) + /// Initializes a secondary progress indicator (e.g. makes a progress bar visible) public delegate void InitProgressHandler2(); /// Updates a secondary progress indicator with text @@ -53,10 +53,10 @@ namespace Aaru.Core /// Pulses a secondary progress indicator with indeterminate boundaries public delegate void PulseProgressHandler2(string text); - /// Uninitializates a secondary progress indicator (e.g. adds a newline to the console) + /// Uninitializes a secondary progress indicator (e.g. adds a newline to the console) public delegate void EndProgressHandler2(); - /// Initializates two progress indicators (e.g. makes a progress bar visible) + /// Initializes two progress indicators (e.g. makes a progress bar visible) public delegate void InitTwoProgressHandler(); /// Updates two progress indicators with text @@ -66,7 +66,7 @@ namespace Aaru.Core /// Pulses a progress indicator with indeterminate boundaries public delegate void PulseTwoProgressHandler(string text, string text2); - /// Uninitializates a progress indicator (e.g. adds a newline to the console) + /// Uninitializes a progress indicator (e.g. adds a newline to the console) public delegate void EndTwoProgressHandler(); /// Updates a status indicator diff --git a/Aaru.Core/Devices/Dumping/ATA.cs b/Aaru.Core/Devices/Dumping/ATA.cs index 84769e92b..772f41db7 100644 --- a/Aaru.Core/Devices/Dumping/ATA.cs +++ b/Aaru.Core/Devices/Dumping/ATA.cs @@ -54,7 +54,7 @@ namespace Aaru.Core.Devices.Dumping public partial class Dump { /// Dumps an ATA device - public void Ata() + void Ata() { if(_dumpRaw) { @@ -96,7 +96,7 @@ namespace Aaru.Core.Devices.Dumping double maxSpeed = double.MinValue; double minSpeed = double.MaxValue; - // Initializate reader + // Initialize reader UpdateStatus?.Invoke("Initializing reader."); _dumpLog.WriteLine("Initializing reader."); var ataReader = new Reader(_dev, timeout, ataIdentify, _errorLog); @@ -114,7 +114,7 @@ namespace Aaru.Core.Devices.Dumping } uint blockSize = ataReader.LogicalBlockSize; - uint physicalsectorsize = ataReader.PhysicalBlockSize; + uint physicalSectorSize = ataReader.PhysicalBlockSize; if(ataReader.FindReadCommand()) { @@ -145,7 +145,7 @@ namespace Aaru.Core.Devices.Dumping UpdateStatus?.Invoke($"Device can read {blocksToRead} blocks at a time."); UpdateStatus?.Invoke($"Device reports {blockSize} bytes per logical block."); - UpdateStatus?.Invoke($"Device reports {physicalsectorsize} bytes per physical block."); + UpdateStatus?.Invoke($"Device reports {physicalSectorSize} bytes per physical block."); _dumpLog.WriteLine("Device reports {0} blocks ({1} bytes).", blocks, blocks * blockSize); _dumpLog.WriteLine("Device reports {0} cylinders {1} heads {2} sectors per track.", cylinders, @@ -153,7 +153,7 @@ namespace Aaru.Core.Devices.Dumping _dumpLog.WriteLine("Device can read {0} blocks at a time.", blocksToRead); _dumpLog.WriteLine("Device reports {0} bytes per logical block.", blockSize); - _dumpLog.WriteLine("Device reports {0} bytes per physical block.", physicalsectorsize); + _dumpLog.WriteLine("Device reports {0} bytes per physical block.", physicalSectorSize); bool removable = !_dev.IsCompactFlash && ataId.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable); @@ -277,15 +277,13 @@ namespace Aaru.Core.Devices.Dumping if(blocks - i < blocksToRead) blocksToRead = (byte)(blocks - i); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, (long)blocks); @@ -396,8 +394,8 @@ namespace Aaru.Core.Devices.Dumping EndProgress?.Invoke(); end = DateTime.UtcNow; - UpdateStatus?.Invoke($"Trimmming finished in {(end - start).TotalSeconds} seconds."); - _dumpLog.WriteLine("Trimmming finished in {0} seconds.", (end - start).TotalSeconds); + UpdateStatus?.Invoke($"Trimming finished in {(end - start).TotalSeconds} seconds."); + _dumpLog.WriteLine("Trimming finished in {0} seconds.", (end - start).TotalSeconds); } #endregion Trimming @@ -493,15 +491,13 @@ namespace Aaru.Core.Devices.Dumping break; } - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator PulseProgress?. Invoke($"Reading cylinder {cy} head {hd} sector {sc} ({currentSpeed:F3} MiB/sec.)"); @@ -698,32 +694,33 @@ namespace Aaru.Core.Devices.Dumping switch(tuple.Code) { case TupleCodes.CISTPL_MANFID: - ManufacturerIdentificationTuple manfid = + ManufacturerIdentificationTuple manufacturerId = CIS.DecodeManufacturerIdentificationTuple(tuple); - if(manfid != null) + if(manufacturerId != null) { - sidecar.BlockMedia[0].PCMCIA.ManufacturerCode = manfid.ManufacturerID; + sidecar.BlockMedia[0].PCMCIA.ManufacturerCode = + manufacturerId.ManufacturerID; - sidecar.BlockMedia[0].PCMCIA.CardCode = manfid.CardID; + sidecar.BlockMedia[0].PCMCIA.CardCode = manufacturerId.CardID; sidecar.BlockMedia[0].PCMCIA.ManufacturerCodeSpecified = true; - sidecar.BlockMedia[0].PCMCIA.CardCodeSpecified = true; + sidecar.BlockMedia[0].PCMCIA.CardCodeSpecified = true; } break; case TupleCodes.CISTPL_VERS_1: - Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple); + Level1VersionTuple version = CIS.DecodeLevel1VersionTuple(tuple); - if(vers != null) + if(version != null) { - sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer; - sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product; + sidecar.BlockMedia[0].PCMCIA.Manufacturer = version.Manufacturer; + sidecar.BlockMedia[0].PCMCIA.ProductName = version.Product; sidecar.BlockMedia[0].PCMCIA.Compliance = - $"{vers.MajorVersion}.{vers.MinorVersion}"; + $"{version.MajorVersion}.{version.MinorVersion}"; sidecar.BlockMedia[0].PCMCIA.AdditionalInformation = - vers.AdditionalInformation; + version.AdditionalInformation; } break; @@ -788,7 +785,7 @@ namespace Aaru.Core.Devices.Dumping sidecar.BlockMedia[0].DiskSubType = subType; sidecar.BlockMedia[0].Interface = "ATA"; sidecar.BlockMedia[0].LogicalBlocks = blocks; - sidecar.BlockMedia[0].PhysicalBlockSize = physicalsectorsize; + sidecar.BlockMedia[0].PhysicalBlockSize = physicalSectorSize; sidecar.BlockMedia[0].LogicalBlockSize = blockSize; sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer; sidecar.BlockMedia[0].Model = _dev.Model; diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs b/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs index a0b307f19..133ffaba6 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs @@ -149,13 +149,13 @@ namespace Aaru.Core.Devices.Dumping { ulong sectorSpeedStart = 0; // Used to calculate correct speed DateTime timeSpeedStart = DateTime.UtcNow; // Time of start for speed calculation - bool sense = true; // Sense indicator - byte[] cmdBuf = null; // Data buffer - byte[] senseBuf = null; // Sense buffer - double cmdDuration = 0; // Command execution time - const uint sectorSize = 2352; // Full sector size - Track firstTrack = tracks.FirstOrDefault(t => t.TrackSequence == 1); - uint blocksToRead = 0; // How many sectors to read at once + bool sense; // Sense indicator + byte[] cmdBuf; // Data buffer + byte[] senseBuf; // Sense buffer + double cmdDuration; // Command execution time + const uint sectorSize = 2352; // Full sector size + Track firstTrack = tracks.FirstOrDefault(t => t.TrackSequence == 1); + uint blocksToRead; // How many sectors to read at once if(firstTrack is null) return; @@ -200,21 +200,14 @@ namespace Aaru.Core.Devices.Dumping } } - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - - // ReSharper disable CompareOfFloatsByEqualityOperator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - // ReSharper restore CompareOfFloatsByEqualityOperator - - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator - UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, (long)blocks); diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs index 1299d8b64..849e38f28 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs @@ -98,12 +98,12 @@ namespace Aaru.Core.Devices.Dumping { ulong sectorSpeedStart = 0; // Used to calculate correct speed DateTime timeSpeedStart = DateTime.UtcNow; // Time of start for speed calculation - uint blocksToRead = 0; // How many sectors to read at once - bool sense = true; // Sense indicator - byte[] cmdBuf = null; // Data buffer - byte[] senseBuf = null; // Sense buffer - double cmdDuration = 0; // Command execution time - const uint sectorSize = 2352; // Full sector size + uint blocksToRead; // How many sectors to read at once + bool sense = true; // Sense indicator + byte[] cmdBuf = null; // Data buffer + byte[] senseBuf = null; // Sense buffer + double cmdDuration = 0; // Command execution time + const uint sectorSize = 2352; // Full sector size newTrim = false; PlextorSubchannel supportedPlextorSubchannel; @@ -259,21 +259,14 @@ namespace Aaru.Core.Devices.Dumping crossingLeadOut = false; } - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - - // ReSharper disable CompareOfFloatsByEqualityOperator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - // ReSharper restore CompareOfFloatsByEqualityOperator - - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator - UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, (long)blocks); diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs index c31b1b86d..9c9ade761 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs @@ -59,7 +59,7 @@ namespace Aaru.Core.Devices.Dumping /// Implement dumping Compact Discs // TODO: Barcode - partial class Dump + sealed partial class Dump { /// Dumps a compact disc void CompactDisc() @@ -386,8 +386,8 @@ namespace Aaru.Core.Devices.Dumping } } - tracks = GetCdTracks(ref blockSize, _dev, dskType, _dumpLog, _force, out lastSector, leadOutStarts, - mediaTags, StoppingErrorMessage, subType, out toc, trackFlags, UpdateStatus); + tracks = GetCdTracks(ref blockSize, _dev, _dumpLog, _force, out lastSector, leadOutStarts, mediaTags, + StoppingErrorMessage, subType, out toc, trackFlags, UpdateStatus); if(tracks is null) return; @@ -456,11 +456,8 @@ namespace Aaru.Core.Devices.Dumping ReadCdTags(ref dskType, mediaTags, out sessions, out firstTrackLastSession); // Check if output format supports all disc tags we have retrieved so far - foreach(MediaTagType tag in mediaTags.Keys) + foreach(MediaTagType tag in mediaTags.Keys.Where(tag => !_outputPlugin.SupportedMediaTags.Contains(tag))) { - if(_outputPlugin.SupportedMediaTags.Contains(tag)) - continue; - if(_force) { _dumpLog.WriteLine("Output format does not support {0}, continuing...", tag); @@ -480,14 +477,9 @@ namespace Aaru.Core.Devices.Dumping UpdateStatus?.Invoke("Solving lead-outs..."); foreach(KeyValuePair leadOuts in leadOutStarts) - for(int i = 0; i < tracks.Length; i++) - { - if(tracks[i].TrackSession != leadOuts.Key) - continue; - - if(tracks[i].TrackEndSector >= (ulong)leadOuts.Value) - tracks[i].TrackEndSector = (ulong)leadOuts.Value - 1; - } + foreach(Track trk in tracks.Where(trk => trk.TrackSession == leadOuts.Key). + Where(trk => trk.TrackEndSector >= (ulong)leadOuts.Value)) + trk.TrackEndSector = (ulong)leadOuts.Value - 1; var dataExtents = new ExtentsULong(); @@ -540,31 +532,27 @@ namespace Aaru.Core.Devices.Dumping } // Check mode for tracks - for(int t = 0; t < tracks.Length; t++) + foreach(Track trk in tracks.Where(t => t.TrackType != TrackType.Audio)) { if(!readcd) { - tracks[t].TrackType = TrackType.CdMode1; + trk.TrackType = TrackType.CdMode1; continue; } - if(tracks[t].TrackType == TrackType.Audio) - continue; + _dumpLog.WriteLine("Checking mode for track {0}...", trk.TrackSequence); + UpdateStatus?.Invoke($"Checking mode for track {trk.TrackSequence}..."); - _dumpLog.WriteLine("Checking mode for track {0}...", tracks[t].TrackSequence); - UpdateStatus?.Invoke($"Checking mode for track {tracks[t].TrackSequence}..."); - - sense = _dev.ReadCd(out cmdBuf, out _, (uint)(tracks[t].TrackStartSector + tracks[t].TrackPregap), - blockSize, 1, MmcSectorTypes.AllTypes, false, false, true, - MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, supportedSubchannel, - _dev.Timeout, out _); + sense = _dev.ReadCd(out cmdBuf, out _, (uint)(trk.TrackStartSector + trk.TrackPregap), blockSize, 1, + MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, + MmcErrorField.None, supportedSubchannel, _dev.Timeout, out _); if(sense) { - _dumpLog.WriteLine("Unable to guess mode for track {0}, continuing...", tracks[t].TrackSequence); + _dumpLog.WriteLine("Unable to guess mode for track {0}, continuing...", trk.TrackSequence); - UpdateStatus?.Invoke($"Unable to guess mode for track {tracks[t].TrackSequence}, continuing..."); + UpdateStatus?.Invoke($"Unable to guess mode for track {trk.TrackSequence}, continuing..."); continue; } @@ -572,34 +560,34 @@ namespace Aaru.Core.Devices.Dumping switch(cmdBuf[15]) { case 1: - UpdateStatus?.Invoke($"Track {tracks[t].TrackSequence} is MODE1"); - _dumpLog.WriteLine("Track {0} is MODE1", tracks[t].TrackSequence); - tracks[t].TrackType = TrackType.CdMode1; + UpdateStatus?.Invoke($"Track {trk.TrackSequence} is MODE1"); + _dumpLog.WriteLine("Track {0} is MODE1", trk.TrackSequence); + trk.TrackType = TrackType.CdMode1; break; case 2: if(dskType == MediaType.CDI || dskType == MediaType.CDIREADY) { - UpdateStatus?.Invoke($"Track {tracks[t].TrackSequence} is MODE2"); - _dumpLog.WriteLine("Track {0} is MODE2", tracks[t].TrackSequence); - tracks[t].TrackType = TrackType.CdMode2Formless; + UpdateStatus?.Invoke($"Track {trk.TrackSequence} is MODE2"); + _dumpLog.WriteLine("Track {0} is MODE2", trk.TrackSequence); + trk.TrackType = TrackType.CdMode2Formless; break; } if((cmdBuf[0x012] & 0x20) == 0x20) // mode 2 form 2 { - UpdateStatus?.Invoke($"Track {tracks[t].TrackSequence} is MODE2 FORM 2"); - _dumpLog.WriteLine("Track {0} is MODE2 FORM 2", tracks[t].TrackSequence); - tracks[t].TrackType = TrackType.CdMode2Form2; + UpdateStatus?.Invoke($"Track {trk.TrackSequence} is MODE2 FORM 2"); + _dumpLog.WriteLine("Track {0} is MODE2 FORM 2", trk.TrackSequence); + trk.TrackType = TrackType.CdMode2Form2; break; } - UpdateStatus?.Invoke($"Track {tracks[t].TrackSequence} is MODE2 FORM 1"); - _dumpLog.WriteLine("Track {0} is MODE2 FORM 1", tracks[t].TrackSequence); - tracks[t].TrackType = TrackType.CdMode2Form1; + UpdateStatus?.Invoke($"Track {trk.TrackSequence} is MODE2 FORM 1"); + _dumpLog.WriteLine("Track {0} is MODE2 FORM 1", trk.TrackSequence); + trk.TrackType = TrackType.CdMode2Form1; // These media type specifications do not legally allow mode 2 tracks to be present if(dskType == MediaType.CDROM || @@ -609,8 +597,8 @@ namespace Aaru.Core.Devices.Dumping break; default: - UpdateStatus?.Invoke($"Track {tracks[t].TrackSequence} is unknown mode {cmdBuf[15]}"); - _dumpLog.WriteLine("Track {0} is unknown mode {1}", tracks[t].TrackSequence, cmdBuf[15]); + UpdateStatus?.Invoke($"Track {trk.TrackSequence} is unknown mode {cmdBuf[15]}"); + _dumpLog.WriteLine("Track {0} is unknown mode {1}", trk.TrackSequence, cmdBuf[15]); break; } @@ -1066,9 +1054,9 @@ namespace Aaru.Core.Devices.Dumping return; } - sense = _dev.ReadCd(out cmdBuf, out _, 0, 2352, 1, MmcSectorTypes.AllTypes, false, false, true, - MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, - _dev.Timeout, out _); + _dev.ReadCd(out cmdBuf, out _, 0, 2352, 1, MmcSectorTypes.AllTypes, false, false, true, + MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, _dev.Timeout, + out _); hiddenData = IsData(cmdBuf); diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs index 430edee00..a7a406fc8 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs @@ -120,10 +120,10 @@ namespace Aaru.Core.Devices.Dumping Modes.DecodeMode10(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice); if(dcMode10?.Pages != null) - foreach(Modes.ModePage modePage in dcMode10.Value.Pages) - if(modePage.Page == 0x01 && - modePage.Subpage == 0x00) - currentModePage = modePage; + foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage => + modePage.Page == 0x01 && + modePage.Subpage == 0x00)) + currentModePage = modePage; } } else @@ -131,10 +131,10 @@ namespace Aaru.Core.Devices.Dumping Modes.DecodedMode? dcMode6 = Modes.DecodeMode6(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice); if(dcMode6?.Pages != null) - foreach(Modes.ModePage modePage in dcMode6.Value.Pages) - if(modePage.Page == 0x01 && - modePage.Subpage == 0x00) - currentModePage = modePage; + foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => + modePage.Page == 0x01 && + modePage.Subpage == 0x00)) + currentModePage = modePage; } if(currentModePage == null) @@ -544,9 +544,9 @@ namespace Aaru.Core.Devices.Dumping int[] tmpArray = _resume.BadSubchannels.ToArray(); - for(int i = 0; i < tmpArray.Length; i++) + foreach(int bs in tmpArray) { - uint badSector = (uint)tmpArray[i]; + uint badSector = (uint)bs; Track track = tracks.OrderBy(t => t.TrackStartSector). LastOrDefault(t => badSector >= t.TrackStartSector); @@ -592,7 +592,7 @@ namespace Aaru.Core.Devices.Dumping _fixSubchannel, _fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack); - if(subchannelExtents.Contains(tmpArray[i])) + if(subchannelExtents.Contains(bs)) continue; UpdateStatus?.Invoke($"Correctly retried sector {badSector} subchannel in pass {pass}."); diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs b/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs index 117af4083..29f60dabe 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs @@ -106,20 +106,14 @@ namespace Aaru.Core.Devices.Dumping double cmdDuration = 0; - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - - // ReSharper disable CompareOfFloatsByEqualityOperator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - // ReSharper restore CompareOfFloatsByEqualityOperator - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator - PulseProgress?.Invoke($"Reading sector {i} at lead-out ({currentSpeed:F3} MiB/sec.)"); if(readcd) @@ -287,22 +281,15 @@ namespace Aaru.Core.Devices.Dumping double cmdDuration = 0; - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator - - // ReSharper disable CompareOfFloatsByEqualityOperator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - // ReSharper restore CompareOfFloatsByEqualityOperator - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator - - PulseProgress?.Invoke(string.Format("Reading sector {0} at lead-out ({1:F3} MiB/sec.)", i, - currentSpeed)); + PulseProgress?.Invoke($"Reading sector {i} at lead-out ({currentSpeed:F3} MiB/sec.)"); if(readcd) { diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs index 64b7ef395..e27889981 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs @@ -81,10 +81,13 @@ namespace Aaru.Core.Devices.Dumping PulseProgress?. Invoke($"Trying to read first track pregap sector {firstTrackPregapBlock} ({currentSpeed:F3} MiB/sec.)"); + // ReSharper disable IntVariableOverflowInUncheckedContext sense = _dev.ReadCd(out cmdBuf, out _, (uint)firstTrackPregapBlock, blockSize, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, supportedSubchannel, _dev.Timeout, out cmdDuration); + // ReSharper restore IntVariableOverflowInUncheckedContext + if(!sense && !_dev.Error) { @@ -170,8 +173,8 @@ namespace Aaru.Core.Devices.Dumping } // Initialize the dictionary - for(int i = 0; i < tracks.Length; i++) - pregaps[tracks[i].TrackSequence] = 0; + foreach(Track t in tracks) + pregaps[t.TrackSequence] = 0; for(int t = 0; t < tracks.Length; t++) { @@ -560,28 +563,28 @@ namespace Aaru.Core.Devices.Dumping } } - for(int i = 0; i < tracks.Length; i++) + foreach(Track trk in tracks) { - tracks[i].TrackPregap = (ulong)pregaps[tracks[i].TrackSequence]; + trk.TrackPregap = (ulong)pregaps[trk.TrackSequence]; if(dumping) { // Minus five, to ensure dumping will fix if there is a pregap LBA 0 int red = 5; - while(tracks[i].TrackPregap > 0 && - red > 0) + while(trk.TrackPregap > 0 && + red > 0) { - tracks[i].TrackPregap--; + trk.TrackPregap--; red--; } } - tracks[i].TrackStartSector -= tracks[i].TrackPregap; + trk.TrackStartSector -= trk.TrackPregap; #if DEBUG - dumpLog?.WriteLine($"Track {tracks[i].TrackSequence} pregap is {tracks[i].TrackPregap} sectors"); - updateStatus?.Invoke($"Track {tracks[i].TrackSequence} pregap is {tracks[i].TrackPregap} sectors"); + dumpLog?.WriteLine($"Track {trk.TrackSequence} pregap is {trk.TrackPregap} sectors"); + updateStatus?.Invoke($"Track {trk.TrackSequence} pregap is {trk.TrackPregap} sectors"); #endif } } diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Tracks.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Tracks.cs index 5c09bbddc..bd8c98018 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Tracks.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Tracks.cs @@ -33,7 +33,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Aaru.CommonTypes; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; using Aaru.Core.Logging; @@ -51,7 +50,6 @@ namespace Aaru.Core.Devices.Dumping /// Reads the TOC, processes it, returns the track list and last sector /// Size of the read sector in bytes /// Device - /// Disc type /// Dump log /// Force dump enabled /// Last sector number @@ -63,18 +61,18 @@ namespace Aaru.Core.Devices.Dumping /// Track flags /// Update status handler /// List of tracks - public static Track[] GetCdTracks(ref uint blockSize, Device dev, MediaType dskType, DumpLog dumpLog, - bool force, out long lastSector, Dictionary leadOutStarts, + public static Track[] GetCdTracks(ref uint blockSize, Device dev, DumpLog dumpLog, bool force, + out long lastSector, Dictionary leadOutStarts, Dictionary mediaTags, ErrorMessageHandler stoppingErrorMessage, TrackSubchannelType subType, out FullTOC.CDFullTOC? toc, Dictionary trackFlags, UpdateStatusHandler updateStatus) { - byte[] cmdBuf = null; // Data buffer - const uint sectorSize = 2352; // Full sector size - bool sense = true; // Sense indicator - List trackList = new List(); // Tracks in disc - byte[] tmpBuf; // Temporary buffer + byte[] cmdBuf; // Data buffer + const uint sectorSize = 2352; // Full sector size + bool sense; // Sense indicator + List trackList = new List(); // Tracks in disc + byte[] tmpBuf; // Temporary buffer toc = null; lastSector = 0; TrackType leadoutTrackType = TrackType.Audio; @@ -195,36 +193,37 @@ namespace Aaru.Core.Devices.Dumping return null; } - foreach(TOC.CDTOCTrackDataDescriptor trk in oldToc. - Value.TrackDescriptors.OrderBy(t => t.TrackNumber). - Where(trk => trk.ADR == 1 || trk.ADR == 4)) - if(trk.TrackNumber >= 0x01 && - trk.TrackNumber <= 0x63) - { - trackList.Add(new Track + if(oldToc.HasValue) + foreach(TOC.CDTOCTrackDataDescriptor trk in oldToc. + Value.TrackDescriptors.OrderBy(t => t.TrackNumber). + Where(trk => trk.ADR == 1 || trk.ADR == 4)) + if(trk.TrackNumber >= 0x01 && + trk.TrackNumber <= 0x63) { - TrackSequence = trk.TrackNumber, - TrackSession = 1, - TrackType = (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack || - (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental - ? TrackType.Data : TrackType.Audio, - TrackStartSector = trk.TrackStartAddress, - TrackBytesPerSector = (int)sectorSize, - TrackRawBytesPerSector = (int)sectorSize, - TrackSubchannelType = subType - }); + trackList.Add(new Track + { + TrackSequence = trk.TrackNumber, + TrackSession = 1, + TrackType = (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack || + (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental + ? TrackType.Data : TrackType.Audio, + TrackStartSector = trk.TrackStartAddress, + TrackBytesPerSector = (int)sectorSize, + TrackRawBytesPerSector = (int)sectorSize, + TrackSubchannelType = subType + }); - trackFlags?.Add(trk.TrackNumber, trk.CONTROL); - } - else if(trk.TrackNumber == 0xAA) - { - leadoutTrackType = - (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack || - (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental ? TrackType.Data - : TrackType.Audio; + trackFlags?.Add(trk.TrackNumber, trk.CONTROL); + } + else if(trk.TrackNumber == 0xAA) + { + leadoutTrackType = + (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrack || + (TocControl)(trk.CONTROL & 0x0D) == TocControl.DataTrackIncremental ? TrackType.Data + : TrackType.Audio; - lastSector = trk.TrackStartAddress - 1; - } + lastSector = trk.TrackStartAddress - 1; + } } if(trackList.Count == 0) diff --git a/Aaru.Core/Devices/Dumping/Dump.cs b/Aaru.Core/Devices/Dumping/Dump.cs index 8c09e43bc..a843bf4e9 100644 --- a/Aaru.Core/Devices/Dumping/Dump.cs +++ b/Aaru.Core/Devices/Dumping/Dump.cs @@ -172,7 +172,7 @@ namespace Aaru.Core.Devices.Dumping _generateSubchannels = generateSubchannels; } - /// Starts dumping with the stablished fields and autodetecting the device type + /// Starts dumping with the established fields and autodetecting the device type public void Start() { // Open main database diff --git a/Aaru.Core/Devices/Dumping/MMC.cs b/Aaru.Core/Devices/Dumping/MMC.cs index 10e77ef30..961e3be1f 100644 --- a/Aaru.Core/Devices/Dumping/MMC.cs +++ b/Aaru.Core/Devices/Dumping/MMC.cs @@ -44,6 +44,8 @@ using DDS = Aaru.Decoders.DVD.DDS; using DMI = Aaru.Decoders.Xbox.DMI; using Spare = Aaru.Decoders.DVD.Spare; +// ReSharper disable JoinDeclarationAndInitializer + namespace Aaru.Core.Devices.Dumping { /// Implement dumping optical discs from MultiMedia devices @@ -244,17 +246,16 @@ namespace Aaru.Core.Devices.Dumping { PFI.PhysicalFormatInformation? nintendoPfi = PFI.Decode(cmdBuf); - if(nintendoPfi != null) - if(nintendoPfi.Value.DiskCategory == DiskCategory.Nintendo && - nintendoPfi.Value.PartVersion == 15) - { - _dumpLog.WriteLine("Dumping Nintendo GameCube or Wii discs is not yet implemented."); + if(nintendoPfi?.DiskCategory == DiskCategory.Nintendo && + nintendoPfi.Value.PartVersion == 15) + { + _dumpLog.WriteLine("Dumping Nintendo GameCube or Wii discs is not yet implemented."); - StoppingErrorMessage?. - Invoke("Dumping Nintendo GameCube or Wii discs is not yet implemented."); + StoppingErrorMessage?. + Invoke("Dumping Nintendo GameCube or Wii discs is not yet implemented."); - return; - } + return; + } } break; @@ -822,8 +823,7 @@ namespace Aaru.Core.Devices.Dumping break; case MediaTagType.Xbox_SecuritySector: - if(sidecar.OpticalDisc[0].Xbox == null) - sidecar.OpticalDisc[0].Xbox = new XboxType(); + sidecar.OpticalDisc[0].Xbox ??= new XboxType(); sidecar.OpticalDisc[0].Xbox.SecuritySectors = new[] { @@ -842,8 +842,7 @@ namespace Aaru.Core.Devices.Dumping break; case MediaTagType.Xbox_PFI: - if(sidecar.OpticalDisc[0].Xbox == null) - sidecar.OpticalDisc[0].Xbox = new XboxType(); + sidecar.OpticalDisc[0].Xbox ??= new XboxType(); sidecar.OpticalDisc[0].Xbox.PFI = new DumpType { @@ -854,8 +853,7 @@ namespace Aaru.Core.Devices.Dumping break; case MediaTagType.Xbox_DMI: - if(sidecar.OpticalDisc[0].Xbox == null) - sidecar.OpticalDisc[0].Xbox = new XboxType(); + sidecar.OpticalDisc[0].Xbox ??= new XboxType(); sidecar.OpticalDisc[0].Xbox.DMI = new DumpType { diff --git a/Aaru.Core/Devices/Dumping/MiniDisc.cs b/Aaru.Core/Devices/Dumping/MiniDisc.cs index d745e542e..1936929a3 100644 --- a/Aaru.Core/Devices/Dumping/MiniDisc.cs +++ b/Aaru.Core/Devices/Dumping/MiniDisc.cs @@ -48,13 +48,15 @@ using Schemas; using MediaType = Aaru.CommonTypes.MediaType; using Version = Aaru.CommonTypes.Interop.Version; +// ReSharper disable JoinDeclarationAndInitializer + namespace Aaru.Core.Devices.Dumping { /// Implements dumping MiniDisc Data devices partial class Dump { /// Dumps a MiniDisc Data device - internal void MiniDisc() + void MiniDisc() { bool sense; byte scsiMediumType = 0; @@ -206,11 +208,8 @@ namespace Aaru.Core.Devices.Dumping ret = true; - foreach(MediaTagType tag in mediaTags.Keys) + foreach(MediaTagType tag in mediaTags.Keys.Where(tag => !_outputPlugin.SupportedMediaTags.Contains(tag))) { - if(_outputPlugin.SupportedMediaTags.Contains(tag)) - continue; - ret = false; _dumpLog.WriteLine($"Output format does not support {tag}."); ErrorMessage?.Invoke($"Output format does not support {tag}."); @@ -341,15 +340,13 @@ namespace Aaru.Core.Devices.Dumping if(blocks - i < blocksToRead) blocksToRead = (uint)(blocks - i); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, (long)blocks); @@ -497,12 +494,11 @@ namespace Aaru.Core.Devices.Dumping { Modes.DecodedMode? dcMode6 = Modes.DecodeMode6(readBuffer, _dev.ScsiType); - if(dcMode6.HasValue && - dcMode6.Value.Pages != null) - foreach(Modes.ModePage modePage in dcMode6.Value.Pages) - if(modePage.Page == 0x01 && - modePage.Subpage == 0x00) - currentModePage = modePage; + if(dcMode6?.Pages != null) + foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => + modePage.Page == 0x01 && + modePage.Subpage == 0x00)) + currentModePage = modePage; } if(currentModePage == null) diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs index 5a9282e2c..b1074b5c9 100644 --- a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs +++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs @@ -33,6 +33,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Xml.Serialization; @@ -52,6 +53,7 @@ namespace Aaru.Core.Devices.Dumping { public partial class Dump { + [SuppressMessage("ReSharper", "JoinDeclarationAndInitializer")] void DumpMs() { const ushort sbcProfile = 0x0001; @@ -184,15 +186,13 @@ namespace Aaru.Core.Devices.Dumping if(blocks - i < blocksToRead) blocksToRead = (uint)(blocks - i); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, blocks); @@ -317,7 +317,7 @@ namespace Aaru.Core.Devices.Dumping EndProgress?.Invoke(); end = DateTime.UtcNow; - _dumpLog.WriteLine("Trimmming finished in {0} seconds.", (end - start).TotalSeconds); + _dumpLog.WriteLine("Trimming finished in {0} seconds.", (end - start).TotalSeconds); } #endregion Trimming @@ -350,10 +350,11 @@ namespace Aaru.Core.Devices.Dumping Modes.DecodedMode? dcMode10 = Modes.DecodeMode10(readBuffer, _dev.ScsiType); if(dcMode10.HasValue) - foreach(Modes.ModePage modePage in dcMode10.Value.Pages) - if(modePage.Page == 0x01 && - modePage.Subpage == 0x00) - currentModePage = modePage; + foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage => + modePage.Page == + 0x01 && modePage. + Subpage == 0x00)) + currentModePage = modePage; } } else @@ -361,10 +362,10 @@ namespace Aaru.Core.Devices.Dumping Modes.DecodedMode? dcMode6 = Modes.DecodeMode6(readBuffer, _dev.ScsiType); if(dcMode6.HasValue) - foreach(Modes.ModePage modePage in dcMode6.Value.Pages) - if(modePage.Page == 0x01 && - modePage.Subpage == 0x00) - currentModePage = modePage; + foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => + modePage.Page == 0x01 && + modePage.Subpage == 0x00)) + currentModePage = modePage; } if(currentModePage == null) @@ -507,7 +508,7 @@ namespace Aaru.Core.Devices.Dumping UpdateStatus?.Invoke("Sending MODE SELECT to drive (return device to previous status)."); _dumpLog.WriteLine("Sending MODE SELECT to drive (return device to previous status)."); - sense = _dev.ModeSelect(md6, out _, true, false, _dev.Timeout, out _); + _dev.ModeSelect(md6, out _, true, false, _dev.Timeout, out _); } EndProgress?.Invoke(); diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs index d07fa3ece..59ebe1d4a 100644 --- a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs +++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs @@ -32,6 +32,8 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; using System.Text; using Aaru.CommonTypes; using Aaru.CommonTypes.Enums; @@ -50,6 +52,7 @@ namespace Aaru.Core.Devices.Dumping { public partial class Dump { + [SuppressMessage("ReSharper", "JoinDeclarationAndInitializer")] void DumpUmd() { const uint blockSize = 2048; @@ -152,7 +155,7 @@ namespace Aaru.Core.Devices.Dumping start = DateTime.UtcNow; double imageWriteDuration = 0; - (_outputPlugin as IWritableOpticalImage).SetTracks(new List + (_outputPlugin as IWritableOpticalImage)?.SetTracks(new List { new Track { @@ -204,15 +207,13 @@ namespace Aaru.Core.Devices.Dumping if(blocks - i < blocksToRead) blocksToRead = (uint)(blocks - i); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, (long)blocks); @@ -338,7 +339,7 @@ namespace Aaru.Core.Devices.Dumping EndProgress?.Invoke(); end = DateTime.UtcNow; - _dumpLog.WriteLine("Trimmming finished in {0} seconds.", (end - start).TotalSeconds); + _dumpLog.WriteLine("Trimming finished in {0} seconds.", (end - start).TotalSeconds); } #endregion Trimming @@ -366,10 +367,10 @@ namespace Aaru.Core.Devices.Dumping Modes.DecodedMode? dcMode6 = Modes.DecodeMode6(readBuffer, _dev.ScsiType); if(dcMode6.HasValue) - foreach(Modes.ModePage modePage in dcMode6.Value.Pages) - if(modePage.Page == 0x01 && - modePage.Subpage == 0x00) - currentModePage = modePage; + foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => + modePage.Page == 0x01 && + modePage.Subpage == 0x00)) + currentModePage = modePage; } if(currentModePage == null) @@ -476,8 +477,7 @@ namespace Aaru.Core.Devices.Dumping extents.Add(badSector); _outputPlugin.WriteSector(readBuffer, badSector); - UpdateStatus?.Invoke(string.Format("Correctly retried block {0} in pass {1}.", badSector, - pass)); + UpdateStatus?.Invoke($"Correctly retried block {badSector} in pass {pass}."); _dumpLog.WriteLine("Correctly retried block {0} in pass {1}.", badSector, pass); } @@ -513,7 +513,7 @@ namespace Aaru.Core.Devices.Dumping md6 = Modes.EncodeMode6(md, _dev.ScsiType); _dumpLog.WriteLine("Sending MODE SELECT to drive (return device to previous status)."); - sense = _dev.ModeSelect(md6, out _, true, false, _dev.Timeout, out _); + _dev.ModeSelect(md6, out _, true, false, _dev.Timeout, out _); } EndProgress?.Invoke(); diff --git a/Aaru.Core/Devices/Dumping/SBC.cs b/Aaru.Core/Devices/Dumping/SBC.cs index 943d59645..af3eb6b15 100644 --- a/Aaru.Core/Devices/Dumping/SBC.cs +++ b/Aaru.Core/Devices/Dumping/SBC.cs @@ -54,6 +54,8 @@ using MediaType = Aaru.CommonTypes.MediaType; using TrackType = Aaru.CommonTypes.Enums.TrackType; using Version = Aaru.CommonTypes.Interop.Version; +// ReSharper disable JoinDeclarationAndInitializer + namespace Aaru.Core.Devices.Dumping { /// Implements dumping SCSI Block Commands and Reduced Block Commands devices @@ -63,7 +65,7 @@ namespace Aaru.Core.Devices.Dumping /// If device contains an optical disc (e.g. DVD or BD) /// Media tags as retrieved in MMC layer /// Disc type as detected in SCSI or MMC layer - internal void Sbc(Dictionary mediaTags, MediaType dskType, bool opticalDisc) + void Sbc(Dictionary mediaTags, MediaType dskType, bool opticalDisc) { bool sense; byte scsiMediumType = 0; @@ -168,10 +170,10 @@ namespace Aaru.Core.Devices.Dumping decMode.Value.Header.BlockDescriptors.Length >= 1) scsiDensityCode = (byte)decMode.Value.Header.BlockDescriptors[0].Density; - containsFloppyPage = decMode.Value.Pages != null && - decMode.Value.Pages.Aggregate(containsFloppyPage, - (current, modePage) => - current | (modePage.Page == 0x05)); + containsFloppyPage = decMode.Value.Pages?.Aggregate(containsFloppyPage, + (current, modePage) => + current | (modePage.Page == 0x05)) == + true; } } } @@ -308,11 +310,8 @@ namespace Aaru.Core.Devices.Dumping ret = true; - foreach(MediaTagType tag in mediaTags.Keys) + foreach(MediaTagType tag in mediaTags.Keys.Where(tag => !_outputPlugin.SupportedMediaTags.Contains(tag))) { - if(_outputPlugin.SupportedMediaTags.Contains(tag)) - continue; - ret = false; _dumpLog.WriteLine($"Output format does not support {tag}."); ErrorMessage?.Invoke($"Output format does not support {tag}."); @@ -611,15 +610,13 @@ namespace Aaru.Core.Devices.Dumping if(blocks - i < blocksToRead) blocksToRead = (uint)(blocks - i); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, (long)blocks); @@ -649,7 +646,7 @@ namespace Aaru.Core.Devices.Dumping WriteLine("INSITE floptical drives get crazy on the SCSI bus when an error is found, stopping so you can reboot the computer or reset the scsi bus appropriately."); UpdateStatus?. - Invoke("INSITE floptical drives get crazy on the SCSI bus when an error is found, stopping so you can reboot the computer or reset the scsi bus appropraitely"); + Invoke("INSITE floptical drives get crazy on the SCSI bus when an error is found, stopping so you can reboot the computer or reset the scsi bus appropriately"); continue; } @@ -751,8 +748,8 @@ namespace Aaru.Core.Devices.Dumping EndProgress?.Invoke(); end = DateTime.UtcNow; - UpdateStatus?.Invoke($"Trimmming finished in {(end - start).TotalSeconds} seconds."); - _dumpLog.WriteLine("Trimmming finished in {0} seconds.", (end - start).TotalSeconds); + UpdateStatus?.Invoke($"Trimming finished in {(end - start).TotalSeconds} seconds."); + _dumpLog.WriteLine("Trimming finished in {0} seconds.", (end - start).TotalSeconds); } #endregion Trimming @@ -786,24 +783,22 @@ namespace Aaru.Core.Devices.Dumping { Modes.DecodedMode? dcMode10 = Modes.DecodeMode10(readBuffer, _dev.ScsiType); - if(dcMode10.HasValue && - dcMode10.Value.Pages != null) - foreach(Modes.ModePage modePage in dcMode10.Value.Pages) - if(modePage.Page == 0x01 && - modePage.Subpage == 0x00) - currentModePage = modePage; + if(dcMode10?.Pages != null) + foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage => + modePage.Page == + 0x01 && modePage. + Subpage == 0x00)) + currentModePage = modePage; } } else { Modes.DecodedMode? dcMode6 = Modes.DecodeMode6(readBuffer, _dev.ScsiType); - if(dcMode6.HasValue && - dcMode6.Value.Pages != null) - foreach(Modes.ModePage modePage in dcMode6.Value.Pages) - if(modePage.Page == 0x01 && - modePage.Subpage == 0x00) - currentModePage = modePage; + if(dcMode6?.Pages != null) + foreach(var modePage in dcMode6.Value.Pages.Where(modePage => modePage.Page == 0x01 && + modePage.Subpage == 0x00)) + currentModePage = modePage; } if(currentModePage == null) @@ -1117,14 +1112,11 @@ namespace Aaru.Core.Devices.Dumping sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out _); - decMode = null; - if(!sense && !_dev.Error) if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) { - decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType); - ret = _outputPlugin.WriteMediaTag(cmdBuf, MediaTagType.SCSI_MODESENSE_10); + ret = _outputPlugin.WriteMediaTag(cmdBuf, MediaTagType.SCSI_MODESENSE_10); if(!ret && !_force) @@ -1155,8 +1147,7 @@ namespace Aaru.Core.Devices.Dumping !_dev.Error) if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) { - decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType); - ret = _outputPlugin.WriteMediaTag(cmdBuf, MediaTagType.SCSI_MODESENSE_6); + ret = _outputPlugin.WriteMediaTag(cmdBuf, MediaTagType.SCSI_MODESENSE_6); if(!ret && !_force) diff --git a/Aaru.Core/Devices/Dumping/SCSI.cs b/Aaru.Core/Devices/Dumping/SCSI.cs index d374871c5..2a1ebd80b 100644 --- a/Aaru.Core/Devices/Dumping/SCSI.cs +++ b/Aaru.Core/Devices/Dumping/SCSI.cs @@ -30,6 +30,7 @@ // Copyright © 2011-2020 Natalia Portillo // ****************************************************************************/ +using System; using System.Threading; using Aaru.CommonTypes; using Aaru.CommonTypes.Interfaces; @@ -43,7 +44,7 @@ namespace Aaru.Core.Devices.Dumping { // TODO: Get cartridge serial number from Certance vendor EVPD /// Dumps a SCSI Block Commands device or a Reduced Block Commands devices - public void Scsi() + void Scsi() { int resets = 0; @@ -241,7 +242,8 @@ namespace Aaru.Core.Devices.Dumping return; case PeripheralDeviceTypes.BridgingExpander - when _dev.Model.StartsWith("MDM") || _dev.Model.StartsWith("MDH"): + when _dev.Model.StartsWith("MDM", StringComparison.InvariantCulture) || + _dev.Model.StartsWith("MDH", StringComparison.InvariantCulture): MiniDisc(); break; diff --git a/Aaru.Core/Devices/Dumping/SSC.cs b/Aaru.Core/Devices/Dumping/SSC.cs index 4aa6d8e24..bcb2daf72 100644 --- a/Aaru.Core/Devices/Dumping/SSC.cs +++ b/Aaru.Core/Devices/Dumping/SSC.cs @@ -51,12 +51,14 @@ using Schemas; using MediaType = Aaru.CommonTypes.MediaType; using Version = Aaru.CommonTypes.Interop.Version; +// ReSharper disable JoinDeclarationAndInitializer + namespace Aaru.Core.Devices.Dumping { partial class Dump { /// Dumps the tape from a SCSI Streaming device - internal void Ssc() + void Ssc() { FixedSense? fxSense; bool sense; @@ -76,10 +78,10 @@ namespace Aaru.Core.Devices.Dumping InitProgress?.Invoke(); if(fxSense.HasValue && - fxSense?.SenseKey != SenseKeys.NoSense) + fxSense.Value.SenseKey != SenseKeys.NoSense) { - _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense?.SenseKey, - fxSense?.ASC, fxSense?.ASCQ); + _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, + fxSense.Value.ASC, fxSense.Value.ASCQ); StoppingErrorMessage?.Invoke("Drive has status error, please correct. Sense follows..." + Environment.NewLine + strSense); @@ -88,11 +90,11 @@ namespace Aaru.Core.Devices.Dumping } // Not in BOM/P - if(fxSense.HasValue && - fxSense?.ASC == 0x00 && - fxSense?.ASCQ != 0x00 && - fxSense?.ASCQ != 0x04 && - fxSense?.SenseKey != SenseKeys.IllegalRequest) + if(fxSense.HasValue && + fxSense.Value.ASC == 0x00 && + fxSense.Value.ASCQ != 0x00 && + fxSense.Value.ASCQ != 0x04 && + fxSense.Value.SenseKey != SenseKeys.IllegalRequest) { _dumpLog.WriteLine("Rewinding, please wait..."); PulseProgress?.Invoke("Rewinding, please wait..."); @@ -107,24 +109,25 @@ namespace Aaru.Core.Devices.Dumping PulseProgress?.Invoke("Rewinding, please wait..."); _dev.RequestSense(out senseBuf, _dev.Timeout, out duration); fxSense = Sense.DecodeFixed(senseBuf, out strSense); - } while(fxSense.HasValue && - fxSense?.ASC == 0x00 && - (fxSense?.ASCQ == 0x1A || fxSense?.ASCQ != 0x04 || fxSense?.ASCQ != 0x00)); + } while(fxSense.HasValue && + fxSense.Value.ASC == 0x00 && + (fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ != 0x04 || fxSense.Value.ASCQ != 0x00)); _dev.RequestSense(out senseBuf, _dev.Timeout, out duration); fxSense = Sense.DecodeFixed(senseBuf, out strSense); // And yet, did not rewind! if(fxSense.HasValue && - ((fxSense?.ASC == 0x00 && fxSense?.ASCQ != 0x04 && fxSense?.ASCQ != 0x00) || fxSense?.ASC != 0x00)) + ((fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04 && fxSense.Value.ASCQ != 0x00) || + fxSense.Value.ASC != 0x00)) { StoppingErrorMessage?.Invoke("Drive could not rewind, please correct. Sense follows..." + Environment.NewLine + strSense); _dumpLog.WriteLine("Drive could not rewind, please correct. Sense follows..."); - _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense?.SenseKey, - fxSense?.ASC, fxSense?.ASCQ); + _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, + fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -141,16 +144,16 @@ namespace Aaru.Core.Devices.Dumping fxSense = Sense.DecodeFixed(senseBuf, out strSense); if(fxSense.HasValue && - ((fxSense?.ASC == 0x20 && fxSense?.ASCQ != 0x00) || - (fxSense?.ASC != 0x20 && fxSense?.SenseKey != SenseKeys.IllegalRequest))) + ((fxSense.Value.ASC == 0x20 && fxSense.Value.ASCQ != 0x00) || + (fxSense.Value.ASC != 0x20 && fxSense.Value.SenseKey != SenseKeys.IllegalRequest))) { StoppingErrorMessage?.Invoke("Could not get position. Sense follows..." + Environment.NewLine + strSense); _dumpLog.WriteLine("Could not get position. Sense follows..."); - _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense?.SenseKey, - fxSense?.ASC, fxSense?.ASCQ); + _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, + fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -187,22 +190,22 @@ namespace Aaru.Core.Devices.Dumping PulseProgress?.Invoke("Rewinding, please wait..."); _dev.RequestSense(out senseBuf, _dev.Timeout, out duration); fxSense = Sense.DecodeFixed(senseBuf, out strSense); - } while(fxSense.HasValue && - fxSense?.ASC == 0x00 && - (fxSense?.ASCQ == 0x1A || fxSense?.ASCQ == 0x19)); + } while(fxSense.HasValue && + fxSense.Value.ASC == 0x00 && + (fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ == 0x19)); // And yet, did not rewind! if(fxSense.HasValue && - ((fxSense?.ASC == 0x00 && fxSense?.ASCQ != 0x04 && fxSense?.ASCQ != 0x00) || - fxSense?.ASC != 0x00)) + ((fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04 && fxSense.Value.ASCQ != 0x00) || + fxSense.Value.ASC != 0x00)) { StoppingErrorMessage?.Invoke("Drive could not rewind, please correct. Sense follows..." + Environment.NewLine + strSense); _dumpLog.WriteLine("Drive could not rewind, please correct. Sense follows..."); - _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense?.SenseKey, - fxSense?.ASC, fxSense?.ASCQ); + _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -297,11 +300,8 @@ namespace Aaru.Core.Devices.Dumping { BlockLimits.BlockLimitsData? blockLimits = BlockLimits.Decode(cmdBuf); - if(blockLimits != null && - blockLimits.Value.minBlockLen > blockSize) - { + if(blockLimits?.minBlockLen > blockSize) blockSize = blockLimits.Value.minBlockLen; - } } if(blockSize == 0) @@ -342,7 +342,7 @@ namespace Aaru.Core.Devices.Dumping fxSense = Sense.DecodeFixed(senseBuf, out strSense); if(fxSense.HasValue) - if(fxSense?.SenseKey == SenseKeys.IllegalRequest) + if(fxSense.Value.SenseKey == SenseKeys.IllegalRequest) { sense = _dev.Space(out senseBuf, SscSpaceCodes.LogicalBlock, -1, _dev.Timeout, out duration); @@ -350,8 +350,7 @@ namespace Aaru.Core.Devices.Dumping { fxSense = Sense.DecodeFixed(senseBuf, out strSense); - if(!fxSense.HasValue || - !fxSense?.EOM == true) + if(fxSense?.EOM != true) { StoppingErrorMessage?.Invoke("Drive could not return back. Sense follows..." + Environment.NewLine + strSense); @@ -359,7 +358,7 @@ namespace Aaru.Core.Devices.Dumping _dumpLog.WriteLine("Drive could not return back. Sense follows..."); _dumpLog.WriteLine("Device not ready. Sense {0} ASC {1:X2}h ASCQ {2:X2}h", - fxSense?.SenseKey, fxSense?.ASC, fxSense?.ASCQ); + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -381,15 +380,15 @@ namespace Aaru.Core.Devices.Dumping _dumpLog.WriteLine("Drive could not read. Sense follows..."); _dumpLog.WriteLine("Device not ready. Sense {0} ASC {1:X2}h ASCQ {2:X2}h", - fxSense?.SenseKey, fxSense?.ASC, fxSense?.ASCQ); + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } } - else if(fxSense?.ASC == 0x00 && - fxSense?.ASCQ == 0x00 && - fxSense?.ILI == true && - fxSense?.InformationValid == true) + else if(fxSense.Value.ASC == 0x00 && + fxSense.Value.ASCQ == 0x00 && + fxSense.Value.ILI && + fxSense.Value.InformationValid) { blockSize = (uint)((int)blockSize - BitConverter.ToInt32(BitConverter.GetBytes(fxSense.Value.Information), 0)); @@ -413,7 +412,7 @@ namespace Aaru.Core.Devices.Dumping _dumpLog.WriteLine("Drive could not go back one block. Sense follows..."); _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", - fxSense?.SenseKey, fxSense?.ASC, fxSense?.ASCQ); + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -427,8 +426,8 @@ namespace Aaru.Core.Devices.Dumping _dumpLog.WriteLine("Drive could not read. Sense follows..."); - _dumpLog.WriteLine("Device not ready. Sense {0} ASC {1:X2}h ASCQ {2:X2}h", fxSense?.SenseKey, - fxSense?.ASC, fxSense?.ASCQ); + _dumpLog.WriteLine("Device not ready. Sense {0} ASC {1:X2}h ASCQ {2:X2}h", + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -447,16 +446,15 @@ namespace Aaru.Core.Devices.Dumping { fxSense = Sense.DecodeFixed(senseBuf, out strSense); - if(!fxSense.HasValue || - !fxSense?.EOM == true) + if(fxSense?.EOM != true) { StoppingErrorMessage?.Invoke("Drive could not return back. Sense follows..." + Environment.NewLine + strSense); _dumpLog.WriteLine("Drive could not return back. Sense follows..."); - _dumpLog.WriteLine("Device not ready. Sense {0} ASC {1:X2}h ASCQ {2:X2}h", fxSense?.SenseKey, - fxSense?.ASC, fxSense?.ASCQ); + _dumpLog.WriteLine("Device not ready. Sense {0} ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, + fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -500,11 +498,7 @@ namespace Aaru.Core.Devices.Dumping _dumpLog.WriteLine("LOCATE LONG works."); } } - else - fxSense = Sense.DecodeFixed(senseBuf, out strSense); } - else - fxSense = Sense.DecodeFixed(senseBuf, out strSense); sense = _dev.Locate(out senseBuf, 1, _dev.Timeout, out _); @@ -523,11 +517,7 @@ namespace Aaru.Core.Devices.Dumping _dumpLog.WriteLine("LOCATE works."); } } - else - fxSense = Sense.DecodeFixed(senseBuf, out strSense); } - else - fxSense = Sense.DecodeFixed(senseBuf, out strSense); if(_resume.NextBlock > 0) { @@ -702,8 +692,8 @@ namespace Aaru.Core.Devices.Dumping } else { - sense = canLocateLong ? _dev.Locate16(out senseBuf, false, 0, 0, _dev.Timeout, out duration) - : _dev.Locate(out senseBuf, false, 0, 0, _dev.Timeout, out duration); + _ = canLocateLong ? _dev.Locate16(out senseBuf, false, 0, 0, _dev.Timeout, out duration) + : _dev.Locate(out senseBuf, false, 0, 0, _dev.Timeout, out duration); do { @@ -711,21 +701,22 @@ namespace Aaru.Core.Devices.Dumping PulseProgress?.Invoke("Rewinding, please wait..."); _dev.RequestSense(out senseBuf, _dev.Timeout, out duration); fxSense = Sense.DecodeFixed(senseBuf, out strSense); - } while(fxSense.HasValue && - fxSense?.ASC == 0x00 && - (fxSense?.ASCQ == 0x1A || fxSense?.ASCQ == 0x19)); + } while(fxSense.HasValue && + fxSense.Value.ASC == 0x00 && + (fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ == 0x19)); // And yet, did not rewind! if(fxSense.HasValue && - ((fxSense?.ASC == 0x00 && fxSense?.ASCQ != 0x00 && fxSense?.ASCQ != 0x04) || fxSense?.ASC != 0x00)) + ((fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x00 && fxSense.Value.ASCQ != 0x04) || + fxSense.Value.ASC != 0x00)) { StoppingErrorMessage?.Invoke("Drive could not rewind, please correct. Sense follows..." + Environment.NewLine + strSense); _dumpLog.WriteLine("Drive could not rewind, please correct. Sense follows..."); - _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense?.SenseKey, - fxSense?.ASC, fxSense?.ASCQ); + _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense.Value.SenseKey, + fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -857,15 +848,13 @@ namespace Aaru.Core.Devices.Dumping continue; } - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator PulseProgress?.Invoke($"Reading block {currentBlock} ({currentSpeed:F3} MiB/sec.)"); @@ -880,10 +869,10 @@ namespace Aaru.Core.Devices.Dumping { fxSense = Sense.DecodeFixed(senseBuf, out strSense); - if(fxSense?.ASC == 0x00 && - fxSense?.ASCQ == 0x00 && - fxSense?.ILI == true && - fxSense?.InformationValid == true) + if(fxSense.Value.ASC == 0x00 && + fxSense.Value.ASCQ == 0x00 && + fxSense.Value.ILI && + fxSense.Value.InformationValid) { blockSize = (uint)((int)blockSize - BitConverter.ToInt32(BitConverter.GetBytes(fxSense.Value.Information), 0)); @@ -909,7 +898,7 @@ namespace Aaru.Core.Devices.Dumping _dumpLog.WriteLine("Drive could not go back one block. Sense follows..."); _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", - fxSense?.SenseKey, fxSense?.ASC, fxSense?.ASCQ); + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); return; } @@ -917,7 +906,7 @@ namespace Aaru.Core.Devices.Dumping continue; } - switch(fxSense?.SenseKey) + switch(fxSense.Value.SenseKey) { case SenseKeys.BlankCheck when currentBlock == 0: StoppingErrorMessage?.Invoke("Cannot dump a blank tape..."); @@ -927,9 +916,9 @@ namespace Aaru.Core.Devices.Dumping return; // For sure this is an end-of-tape/partition - case SenseKeys.BlankCheck when fxSense?.ASC == 0x00 && - (fxSense?.ASCQ == 0x02 || fxSense?.ASCQ == 0x05 || - fxSense?.EOM == true): + case SenseKeys.BlankCheck when fxSense.Value.ASC == 0x00 && + (fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || + fxSense.Value.EOM): // TODO: Detect end of partition endOfMedia = true; UpdateStatus?.Invoke("Found end-of-tape/partition..."); @@ -944,8 +933,9 @@ namespace Aaru.Core.Devices.Dumping continue; } - if((fxSense?.SenseKey == SenseKeys.NoSense || fxSense?.SenseKey == SenseKeys.RecoveredError) && - (fxSense?.ASCQ == 0x02 || fxSense?.ASCQ == 0x05 || fxSense?.EOM == true)) + if((fxSense.Value.SenseKey == SenseKeys.NoSense || + fxSense.Value.SenseKey == SenseKeys.RecoveredError) && + (fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM)) { // TODO: Detect end of partition endOfMedia = true; @@ -955,8 +945,9 @@ namespace Aaru.Core.Devices.Dumping continue; } - if((fxSense?.SenseKey == SenseKeys.NoSense || fxSense?.SenseKey == SenseKeys.RecoveredError) && - (fxSense?.ASCQ == 0x01 || fxSense?.Filemark == true)) + if((fxSense.Value.SenseKey == SenseKeys.NoSense || + fxSense.Value.SenseKey == SenseKeys.RecoveredError) && + (fxSense.Value.ASCQ == 0x01 || fxSense.Value.Filemark)) { currentTapeFile.LastBlock = currentBlock - 1; (_outputPlugin as IWritableTapeImage).AddFile(currentTapeFile); @@ -987,12 +978,12 @@ namespace Aaru.Core.Devices.Dumping else { StoppingErrorMessage?. - Invoke($"Drive could not read block ${currentBlock}. Sense follows...\n{fxSense?.SenseKey} {strSense}"); + Invoke($"Drive could not read block ${currentBlock}. Sense follows...\n{fxSense.Value.SenseKey} {strSense}"); _dumpLog.WriteLine($"Drive could not read block ${currentBlock}. Sense follows..."); - _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", fxSense?.SenseKey, - fxSense?.ASC, fxSense?.ASCQ); + _dumpLog.WriteLine("Device not ready. Sense {0}h ASC {1:X2}h ASCQ {2:X2}h", + fxSense.Value.SenseKey, fxSense.Value.ASC, fxSense.Value.ASCQ); } // TODO: Reset device after X errors diff --git a/Aaru.Core/Devices/Dumping/SecureDigital.cs b/Aaru.Core/Devices/Dumping/SecureDigital.cs index e5c00d010..64f79c3c2 100644 --- a/Aaru.Core/Devices/Dumping/SecureDigital.cs +++ b/Aaru.Core/Devices/Dumping/SecureDigital.cs @@ -46,13 +46,15 @@ using Schemas; using MediaType = Aaru.CommonTypes.MediaType; using Version = Aaru.CommonTypes.Interop.Version; +// ReSharper disable JoinDeclarationAndInitializer + namespace Aaru.Core.Devices.Dumping { /// Implements dumping a MultiMediaCard or SecureDigital flash card public partial class Dump { /// Dumps a MultiMediaCard or SecureDigital flash card - public void SecureDigital() + void SecureDigital() { if(_dumpRaw) { @@ -72,17 +74,16 @@ namespace Aaru.Core.Devices.Dumping const ushort sdProfile = 0x0001; const uint timeout = 5; double duration; - - uint blocksToRead = 1; - uint blockSize = 512; - ulong blocks = 0; - byte[] csd = null; - byte[] ocr = null; - byte[] ecsd = null; - byte[] scr = null; - uint physicalBlockSize = 0; - bool byteAddressed = true; - uint[] response; + uint blocksToRead = 1; + uint blockSize = 512; + ulong blocks = 0; + byte[] csd = null; + byte[] ocr = null; + byte[] ecsd = null; + byte[] scr = null; + uint physicalBlockSize = 0; + bool byteAddressed = true; + uint[] response; Dictionary mediaTags = new Dictionary(); @@ -281,11 +282,8 @@ namespace Aaru.Core.Devices.Dumping bool ret = true; - foreach(MediaTagType tag in mediaTags.Keys) + foreach(MediaTagType tag in mediaTags.Keys.Where(tag => !_outputPlugin.SupportedMediaTags.Contains(tag))) { - if(_outputPlugin.SupportedMediaTags.Contains(tag)) - continue; - ret = false; _dumpLog.WriteLine($"Output format does not support {tag}."); ErrorMessage?.Invoke($"Output format does not support {tag}."); @@ -354,15 +352,13 @@ namespace Aaru.Core.Devices.Dumping if(blocks - i < blocksToRead) blocksToRead = (byte)(blocks - i); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, (long)blocks); @@ -481,8 +477,8 @@ namespace Aaru.Core.Devices.Dumping EndProgress?.Invoke(); end = DateTime.UtcNow; - UpdateStatus?.Invoke($"Trimmming finished in {(end - start).TotalSeconds} seconds."); - _dumpLog.WriteLine("Trimmming finished in {0} seconds.", (end - start).TotalSeconds); + UpdateStatus?.Invoke($"Trimming finished in {(end - start).TotalSeconds} seconds."); + _dumpLog.WriteLine("Trimming finished in {0} seconds.", (end - start).TotalSeconds); } #endregion Trimming diff --git a/Aaru.Core/Devices/Dumping/XGD.cs b/Aaru.Core/Devices/Dumping/XGD.cs index a23486d18..79fe865ab 100644 --- a/Aaru.Core/Devices/Dumping/XGD.cs +++ b/Aaru.Core/Devices/Dumping/XGD.cs @@ -51,6 +51,8 @@ using PlatformID = Aaru.CommonTypes.Interop.PlatformID; using TrackType = Aaru.CommonTypes.Enums.TrackType; using Version = Aaru.CommonTypes.Interop.Version; +// ReSharper disable JoinDeclarationAndInitializer + namespace Aaru.Core.Devices.Dumping { /// Implements dumping an Xbox Game Disc using a Kreon drive @@ -59,7 +61,7 @@ namespace Aaru.Core.Devices.Dumping /// Dumps an Xbox Game Disc using a Kreon drive /// Media tags as retrieved in MMC layer /// Disc type as detected in MMC layer - internal void Xgd(Dictionary mediaTags, MediaType dskType) + void Xgd(Dictionary mediaTags, MediaType dskType) { bool sense; const uint blockSize = 2048; @@ -194,7 +196,7 @@ namespace Aaru.Core.Devices.Dumping AaruConsole.DebugWriteLine("Dump-media command", "Video partition total size: {0} sectors", totalSize); ulong l0Video = - (PFI.Decode(readBuffer).Value.Layer0EndPSN - PFI.Decode(readBuffer).Value.DataAreaStartPSN) + 1; + (PFI.Decode(readBuffer)?.Layer0EndPSN ?? 0 - PFI.Decode(readBuffer)?.DataAreaStartPSN ?? 0) + 1; ulong l1Video = (totalSize - l0Video) + 1; UpdateStatus?.Invoke("Reading Disc Manufacturing Information."); @@ -230,7 +232,7 @@ namespace Aaru.Core.Devices.Dumping mediaTags.Add(MediaTagType.DVD_PFI, tmpBuf); AaruConsole.DebugWriteLine("Dump-media command", "Video partition total size: {0} sectors", totalSize); - l0Video = (PFI.Decode(coldPfi).Value.Layer0EndPSN - PFI.Decode(coldPfi).Value.DataAreaStartPSN) + 1; + l0Video = (PFI.Decode(coldPfi)?.Layer0EndPSN ?? 0 - PFI.Decode(coldPfi)?.DataAreaStartPSN ?? 0) + 1; l1Video = (totalSize - l0Video) + 1; @@ -402,14 +404,11 @@ namespace Aaru.Core.Devices.Dumping while(true) { - if(read12) - { - sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, blockSize, 0, - blocksToRead, false, _dev.Timeout, out _); + sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, blockSize, 0, + blocksToRead, false, _dev.Timeout, out _); - if(sense || _dev.Error) - blocksToRead /= 2; - } + if(sense || _dev.Error) + blocksToRead /= 2; if(!_dev.Error || blocksToRead == 1) @@ -429,11 +428,8 @@ namespace Aaru.Core.Devices.Dumping bool ret = true; - foreach(MediaTagType tag in mediaTags.Keys) + foreach(MediaTagType tag in mediaTags.Keys.Where(tag => !_outputPlugin.SupportedMediaTags.Contains(tag))) { - if(_outputPlugin.SupportedMediaTags.Contains(tag)) - continue; - ret = false; _dumpLog.WriteLine($"Output format does not support {tag}."); ErrorMessage?.Invoke($"Output format does not support {tag}."); @@ -578,15 +574,13 @@ namespace Aaru.Core.Devices.Dumping if(extentStart - i < blocksToRead) blocksToRead = (uint)(extentStart - i); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator UpdateProgress?.Invoke($"Reading sector {i} of {totalSize} ({currentSpeed:F3} MiB/sec.)", (long)i, (long)totalSize); @@ -774,15 +768,13 @@ namespace Aaru.Core.Devices.Dumping if((l0Video + l1Video) - l1 < blocksToRead) blocksToRead = (uint)((l0Video + l1Video) - l1); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > maxSpeed && - currentSpeed != 0) + currentSpeed > 0) maxSpeed = currentSpeed; if(currentSpeed < minSpeed && - currentSpeed != 0) + currentSpeed > 0) minSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator UpdateProgress?.Invoke($"Reading sector {currentSector} of {totalSize} ({currentSpeed:F3} MiB/sec.)", (long)currentSector, (long)totalSize); @@ -939,8 +931,8 @@ namespace Aaru.Core.Devices.Dumping EndProgress?.Invoke(); end = DateTime.UtcNow; - UpdateStatus?.Invoke($"Trimmming finished in {(end - start).TotalSeconds} seconds."); - _dumpLog.WriteLine("Trimmming finished in {0} seconds.", (end - start).TotalSeconds); + UpdateStatus?.Invoke($"Trimming finished in {(end - start).TotalSeconds} seconds."); + _dumpLog.WriteLine("Trimming finished in {0} seconds.", (end - start).TotalSeconds); } #endregion Trimming @@ -984,10 +976,9 @@ namespace Aaru.Core.Devices.Dumping Modes.DecodeMode10(readBuffer, PeripheralDeviceTypes.MultiMediaDevice); if(dcMode10.HasValue) - foreach(Modes.ModePage modePage in dcMode10.Value.Pages) - if(modePage.Page == 0x01 && - modePage.Subpage == 0x00) - currentModePage = modePage; + foreach(var modePage in dcMode10.Value.Pages.Where(modePage => modePage.Page == 0x01 && + modePage.Subpage == 0x00)) + currentModePage = modePage; } } else @@ -996,10 +987,10 @@ namespace Aaru.Core.Devices.Dumping Modes.DecodeMode6(readBuffer, PeripheralDeviceTypes.MultiMediaDevice); if(dcMode6.HasValue) - foreach(Modes.ModePage modePage in dcMode6.Value.Pages) - if(modePage.Page == 0x01 && - modePage.Subpage == 0x00) - currentModePage = modePage; + foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => + modePage.Page == 0x01 && + modePage.Subpage == 0x00)) + currentModePage = modePage; } if(currentModePage == null) diff --git a/Aaru.Core/Devices/Reader.cs b/Aaru.Core/Devices/Reader.cs index f294da930..5e8833140 100644 --- a/Aaru.Core/Devices/Reader.cs +++ b/Aaru.Core/Devices/Reader.cs @@ -39,7 +39,7 @@ using Aaru.Devices; namespace Aaru.Core.Devices { /// Reduces common code used for scanning and dumping - internal partial class Reader + internal sealed partial class Reader { readonly Device _dev; readonly ErrorLog _errorLog; diff --git a/Aaru.Core/Devices/ReaderATA.cs b/Aaru.Core/Devices/ReaderATA.cs index f5a7add38..57adf9ad2 100644 --- a/Aaru.Core/Devices/ReaderATA.cs +++ b/Aaru.Core/Devices/ReaderATA.cs @@ -38,7 +38,7 @@ using Identify = Aaru.CommonTypes.Structs.Devices.ATA.Identify; namespace Aaru.Core.Devices { - internal partial class Reader + internal sealed partial class Reader { Identify.IdentifyDevice _ataId; bool _ataRead; diff --git a/Aaru.Core/Devices/ReaderSCSI.cs b/Aaru.Core/Devices/ReaderSCSI.cs index 46bf31a22..60393bda3 100644 --- a/Aaru.Core/Devices/ReaderSCSI.cs +++ b/Aaru.Core/Devices/ReaderSCSI.cs @@ -31,14 +31,13 @@ // ****************************************************************************/ using System; -using System.Linq; using Aaru.CommonTypes.Structs.Devices.SCSI; using Aaru.Console; using Aaru.Decoders.SCSI; namespace Aaru.Core.Devices { - internal partial class Reader + internal sealed partial class Reader { // TODO: Raw reading bool _hldtstReadRaw; @@ -181,27 +180,26 @@ namespace Aaru.Core.Devices { decSense = Sense.DecodeFixed(senseBuf); - if(decSense.HasValue) - if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && - decSense.Value.ASC == 0x24 && - decSense.Value.ASCQ == 0x00) + if(decSense?.SenseKey == SenseKeys.IllegalRequest && + decSense.Value.ASC == 0x24 && + decSense.Value.ASCQ == 0x00) + { + CanReadRaw = true; + + if(decSense.Value.InformationValid && + decSense.Value.ILI) { - CanReadRaw = true; + LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); - if(decSense.Value.InformationValid && - decSense.Value.ILI) - { - LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); - - _readLong10 = !_dev.ReadLong10(out _, out senseBuf, false, false, 0, - (ushort)LongBlockSize, _timeout, out _); - } + _readLong10 = !_dev.ReadLong10(out _, out senseBuf, false, false, 0, + (ushort)LongBlockSize, _timeout, out _); } + } } if(CanReadRaw && LongBlockSize == LogicalBlockSize) if(LogicalBlockSize == 512) - foreach(int i in new[] + foreach(ushort testSize in new ushort[] { // Long sector sizes for floppies 514, @@ -213,7 +211,6 @@ namespace Aaru.Core.Devices 600, 610, 630 }) { - ushort testSize = (ushort)i; testSense = _dev.ReadLong16(out _, out senseBuf, false, 0, testSize, _timeout, out _); if(!testSense && @@ -239,14 +236,14 @@ namespace Aaru.Core.Devices break; } else if(LogicalBlockSize == 1024) - foreach(ushort testSize in new[] + foreach(ushort testSize in new ushort[] { // Long sector sizes for floppies 1026, // Long sector sizes for 1024-byte magneto-opticals 1200 - }.Select(i => (ushort)i)) + }) { testSense = _dev.ReadLong16(out _, out senseBuf, false, 0, testSize, _timeout, out _); @@ -382,23 +379,22 @@ namespace Aaru.Core.Devices { decSense = Sense.DecodeFixed(senseBuf); - if(decSense.HasValue) - if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && - decSense.Value.ASC == 0x24 && - decSense.Value.ASCQ == 0x00) + if(decSense?.SenseKey == SenseKeys.IllegalRequest && + decSense.Value.ASC == 0x24 && + decSense.Value.ASCQ == 0x00) + { + CanReadRaw = true; + + if(decSense.Value.InformationValid && + decSense.Value.ILI) { - CanReadRaw = true; + LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); - if(decSense.Value.InformationValid && - decSense.Value.ILI) - { - LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); - - _syqReadLong6 = - !_dev.SyQuestReadLong6(out _, out senseBuf, 0, LongBlockSize, - _timeout, out _); - } + _syqReadLong6 = + !_dev.SyQuestReadLong6(out _, out senseBuf, 0, LongBlockSize, + _timeout, out _); } + } } } } @@ -484,10 +480,9 @@ namespace Aaru.Core.Devices bool ScsiGetBlockSize() { - bool sense; Blocks = 0; - sense = _dev.ReadCapacity(out byte[] cmdBuf, out byte[] senseBuf, _timeout, out _); + bool sense = _dev.ReadCapacity(out byte[] cmdBuf, out byte[] senseBuf, _timeout, out _); if(!sense) { diff --git a/Aaru.Core/Devices/Report/ATA.cs b/Aaru.Core/Devices/Report/ATA.cs index c0fc9ce3f..750b7a5be 100644 --- a/Aaru.Core/Devices/Report/ATA.cs +++ b/Aaru.Core/Devices/Report/ATA.cs @@ -39,7 +39,7 @@ using Identify = Aaru.CommonTypes.Structs.Devices.ATA.Identify; namespace Aaru.Core.Devices.Report { - public partial class DeviceReport + public sealed partial class DeviceReport { public TestedMedia ReportAtaMedia() { @@ -175,12 +175,11 @@ namespace Aaru.Core.Devices.Report } ulong checkCorrectRead = BitConverter.ToUInt64(buffer, 0); - bool sense; AaruConsole.WriteLine("Trying READ SECTOR(S) in CHS mode..."); - sense = _dev.Read(out byte[] readBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, - _dev.Timeout, out _); + bool sense = _dev.Read(out byte[] readBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, + _dev.Timeout, out _); mediaTest.SupportsReadSectors = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; @@ -517,12 +516,11 @@ namespace Aaru.Core.Devices.Report } ulong checkCorrectRead = 0; - bool sense; AaruConsole.WriteLine("Trying READ SECTOR(S) in CHS mode..."); - sense = _dev.Read(out byte[] readBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, _dev.Timeout, - out _); + bool sense = _dev.Read(out byte[] readBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, + _dev.Timeout, out _); capabilities.SupportsReadSectors = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0; diff --git a/Aaru.Core/Devices/Report/DeviceReport.cs b/Aaru.Core/Devices/Report/DeviceReport.cs index 3c1851b1d..17263e6f9 100644 --- a/Aaru.Core/Devices/Report/DeviceReport.cs +++ b/Aaru.Core/Devices/Report/DeviceReport.cs @@ -34,7 +34,7 @@ using Aaru.Devices; namespace Aaru.Core.Devices.Report { - public partial class DeviceReport + public sealed partial class DeviceReport { readonly Device _dev; diff --git a/Aaru.Core/Devices/Report/FireWire.cs b/Aaru.Core/Devices/Report/FireWire.cs index 5548ed3a8..80b6d6c60 100644 --- a/Aaru.Core/Devices/Report/FireWire.cs +++ b/Aaru.Core/Devices/Report/FireWire.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Metadata; namespace Aaru.Core.Devices.Report { /// Implements creating a report for a FireWire device - public partial class DeviceReport + public sealed partial class DeviceReport { /// Fills a device report with parameters specific to a FireWire device public FireWire FireWireReport() => new FireWire diff --git a/Aaru.Core/Devices/Report/GdRomSwapTrick.cs b/Aaru.Core/Devices/Report/GdRomSwapTrick.cs index 03952631e..e6488a701 100644 --- a/Aaru.Core/Devices/Report/GdRomSwapTrick.cs +++ b/Aaru.Core/Devices/Report/GdRomSwapTrick.cs @@ -39,9 +39,11 @@ using Aaru.Decoders.CD; using Aaru.Decoders.SCSI; using Aaru.Devices; +// ReSharper disable InlineOutVariableDeclaration + namespace Aaru.Core.Devices.Report { - public partial class DeviceReport + public sealed partial class DeviceReport { public void ReportGdRomSwapTrick(ref DeviceReportV2 report) { @@ -92,10 +94,10 @@ namespace Aaru.Core.Devices.Report FixedSense? decodedSense = Sense.DecodeFixed(senseBuffer); - if(decodedSense.Value.ASC != 0x04) + if(decodedSense?.ASC != 0x04) break; - if(decodedSense.Value.ASCQ != 0x01) + if(decodedSense?.ASCQ != 0x01) break; Thread.Sleep(2000); @@ -214,7 +216,7 @@ namespace Aaru.Core.Devices.Report if(decodedSense?.ASC != 0x04) break; - if(decodedSense.Value.ASCQ != 0x01) + if(decodedSense?.ASCQ != 0x01) break; } while(retries < 25); diff --git a/Aaru.Core/Devices/Report/MMC.cs b/Aaru.Core/Devices/Report/MMC.cs index 56ec59966..ee39d8031 100644 --- a/Aaru.Core/Devices/Report/MMC.cs +++ b/Aaru.Core/Devices/Report/MMC.cs @@ -43,7 +43,7 @@ using Aaru.Helpers; namespace Aaru.Core.Devices.Report { - public partial class DeviceReport + public sealed partial class DeviceReport { static byte[] ClearMmcFeatures(byte[] response) { @@ -452,9 +452,8 @@ namespace Aaru.Core.Devices.Report report.SupportsCSS = true; Feature_0106? ftr0106 = Features.Decode_0106(desc.Data); - if(ftr0106.HasValue) - if(ftr0106.Value.CSSVersion > 0) - report.CSSVersion = ftr0106.Value.CSSVersion; + if(ftr0106?.CSSVersion > 0) + report.CSSVersion = ftr0106.Value.CSSVersion; } break; @@ -471,9 +470,8 @@ namespace Aaru.Core.Devices.Report report.SupportsCPRM = true; Feature_010B? ftr010B = Features.Decode_010B(desc.Data); - if(ftr010B.HasValue) - if(ftr010B.Value.CPRMVersion > 0) - report.CPRMVersion = ftr010B.Value.CPRMVersion; + if(ftr010B?.CPRMVersion > 0) + report.CPRMVersion = ftr010B.Value.CPRMVersion; } break; @@ -625,18 +623,16 @@ namespace Aaru.Core.Devices.Report if(!sense && !_dev.Error) { - if(!decMode.HasValue) - decMode = Modes.DecodeMode6(buffer, _dev.ScsiType); + decMode ??= Modes.DecodeMode6(buffer, _dev.ScsiType); mediaTest.ModeSense6Data = buffer; } - if(decMode.HasValue) + if(decMode != null) { mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; - if(decMode.Value.Header.BlockDescriptors != null && - decMode.Value.Header.BlockDescriptors.Length > 0) + if(decMode?.Header.BlockDescriptors.Length > 0) mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; } @@ -1112,6 +1108,7 @@ namespace Aaru.Core.Devices.Report for(int i = -10; i < 0; i++) { + // ReSharper disable IntVariableOverflowInUncheckedContext if(mediaType == "Audio CD") sense = _dev.ReadCd(out buffer, out senseBuffer, (uint)i, 2352, 1, MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true, false, @@ -1121,6 +1118,8 @@ namespace Aaru.Core.Devices.Report false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, _dev.Timeout, out _); + // ReSharper restore IntVariableOverflowInUncheckedContext + AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}", sense); mediaTest.Track1PregapData = buffer; @@ -1567,17 +1566,16 @@ namespace Aaru.Core.Devices.Report { FixedSense? decSense = Sense.DecodeFixed(senseBuffer); - if(decSense.HasValue) - if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && - decSense.Value.ASC == 0x24 && - decSense.Value.ASCQ == 0x00) - { - mediaTest.SupportsReadLong = true; + if(decSense?.SenseKey == SenseKeys.IllegalRequest && + decSense.Value.ASC == 0x24 && + decSense.Value.ASCQ == 0x00) + { + mediaTest.SupportsReadLong = true; - if(decSense.Value.InformationValid && - decSense.Value.ILI) - mediaTest.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); - } + if(decSense.Value.InformationValid && + decSense.Value.ILI) + mediaTest.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); + } } if(mediaTest.SupportsReadLong == true && diff --git a/Aaru.Core/Devices/Report/PCMCIA.cs b/Aaru.Core/Devices/Report/PCMCIA.cs index 5747da517..aeed64466 100644 --- a/Aaru.Core/Devices/Report/PCMCIA.cs +++ b/Aaru.Core/Devices/Report/PCMCIA.cs @@ -36,7 +36,7 @@ using Aaru.Decoders.PCMCIA; namespace Aaru.Core.Devices.Report { /// Implements creating a report for a PCMCIA device - public partial class DeviceReport + public sealed partial class DeviceReport { /// Fills a device report with parameters specific to a PCMCIA device public Pcmcia PcmciaReport() diff --git a/Aaru.Core/Devices/Report/SSC.cs b/Aaru.Core/Devices/Report/SSC.cs index e02a361f7..19f353105 100644 --- a/Aaru.Core/Devices/Report/SSC.cs +++ b/Aaru.Core/Devices/Report/SSC.cs @@ -39,7 +39,7 @@ using Aaru.Devices; namespace Aaru.Core.Devices.Report { - public partial class DeviceReport + public sealed partial class DeviceReport { public Ssc ReportScsiSsc() { @@ -51,17 +51,14 @@ namespace Aaru.Core.Devices.Report { BlockLimits.BlockLimitsData? decBl = BlockLimits.Decode(buffer); - if(decBl.HasValue) - { - if(decBl.Value.granularity > 0) - report.BlockSizeGranularity = decBl.Value.granularity; + if(decBl?.granularity > 0) + report.BlockSizeGranularity = decBl.Value.granularity; - if(decBl.Value.maxBlockLen > 0) - report.MaxBlockLength = decBl.Value.maxBlockLen; + if(decBl?.maxBlockLen > 0) + report.MaxBlockLength = decBl.Value.maxBlockLen; - if(decBl.Value.minBlockLen > 0) - report.MinBlockLength = decBl.Value.minBlockLen; - } + if(decBl?.minBlockLen > 0) + report.MinBlockLength = decBl.Value.minBlockLen; } AaruConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT..."); @@ -164,8 +161,7 @@ namespace Aaru.Core.Devices.Report if(!sense && !_dev.Error) { - if(!decMode.HasValue) - decMode = Modes.DecodeMode6(buffer, _dev.ScsiType); + decMode ??= Modes.DecodeMode6(buffer, _dev.ScsiType); seqTest.ModeSense6Data = buffer; } diff --git a/Aaru.Core/Devices/Report/Scsi.cs b/Aaru.Core/Devices/Report/Scsi.cs index 7a398d601..c9ce42e1d 100644 --- a/Aaru.Core/Devices/Report/Scsi.cs +++ b/Aaru.Core/Devices/Report/Scsi.cs @@ -43,7 +43,7 @@ using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry; namespace Aaru.Core.Devices.Report { - public partial class DeviceReport + public sealed partial class DeviceReport { public Scsi ReportScsiInquiry() { @@ -65,7 +65,7 @@ namespace Aaru.Core.Devices.Report return report; } - public static byte[] ClearInquiry(byte[] inquiry) + internal static byte[] ClearInquiry(byte[] inquiry) { Inquiry? decodedNullable = Inquiry.Decode(inquiry); @@ -74,11 +74,13 @@ namespace Aaru.Core.Devices.Report Inquiry decoded = decodedNullable.Value; + if(!decoded.SeagatePresent || + StringHandlers.CToString(decoded.VendorIdentification)?.Trim().ToLowerInvariant() != "seagate") + return inquiry; + // Clear Seagate serial number - if(decoded.SeagatePresent && - StringHandlers.CToString(decoded.VendorIdentification)?.Trim().ToLowerInvariant() == "seagate") - for(int i = 36; i <= 43; i++) - inquiry[i] = 0; + for(int i = 36; i <= 43; i++) + inquiry[i] = 0; return inquiry; } @@ -414,8 +416,7 @@ namespace Aaru.Core.Devices.Report if(!sense && !_dev.Error) { - if(!decMode.HasValue) - decMode = Modes.DecodeMode6(buffer, _dev.ScsiType); + decMode ??= Modes.DecodeMode6(buffer, _dev.ScsiType); mediaTest.ModeSense6Data = buffer; } @@ -469,23 +470,22 @@ namespace Aaru.Core.Devices.Report { FixedSense? decSense = Sense.DecodeFixed(senseBuffer); - if(decSense.HasValue) - if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && - decSense.Value.ASC == 0x24 && - decSense.Value.ASCQ == 0x00) - { - mediaTest.SupportsReadLong = true; + if(decSense?.SenseKey == SenseKeys.IllegalRequest && + decSense.Value.ASC == 0x24 && + decSense.Value.ASCQ == 0x00) + { + mediaTest.SupportsReadLong = true; - if(decSense.Value.InformationValid && - decSense.Value.ILI) - mediaTest.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); - } + if(decSense.Value.InformationValid && + decSense.Value.ILI) + mediaTest.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); + } } if(mediaTest.SupportsReadLong == true && mediaTest.LongBlockSize == mediaTest.BlockSize) if(mediaTest.BlockSize == 512) - foreach(int i in new[] + foreach(ushort testSize in new ushort[] { // Long sector sizes for floppies 514, @@ -497,8 +497,6 @@ namespace Aaru.Core.Devices.Report 600, 610, 630 }) { - ushort testSize = (ushort)i; - sense = _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, _dev.Timeout, out _); @@ -511,7 +509,7 @@ namespace Aaru.Core.Devices.Report break; } else if(mediaTest.BlockSize == 1024) - foreach(int i in new[] + foreach(ushort testSize in new ushort[] { // Long sector sizes for floppies 1026, @@ -520,9 +518,7 @@ namespace Aaru.Core.Devices.Report 1200 }) { - ushort testSize = (ushort)i; - - sense = _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, (ushort)i, _dev.Timeout, + sense = _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, _dev.Timeout, out _); if(sense || _dev.Error) @@ -629,8 +625,7 @@ namespace Aaru.Core.Devices.Report if(!sense && !_dev.Error) { - if(!decMode.HasValue) - decMode = Modes.DecodeMode6(buffer, _dev.ScsiType); + decMode ??= Modes.DecodeMode6(buffer, _dev.ScsiType); capabilities.ModeSense6Data = buffer; } @@ -684,17 +679,16 @@ namespace Aaru.Core.Devices.Report { FixedSense? decSense = Sense.DecodeFixed(senseBuffer); - if(decSense.HasValue) - if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && - decSense.Value.ASC == 0x24 && - decSense.Value.ASCQ == 0x00) - { - capabilities.SupportsReadLong = true; + if(decSense?.SenseKey == SenseKeys.IllegalRequest && + decSense.Value.ASC == 0x24 && + decSense.Value.ASCQ == 0x00) + { + capabilities.SupportsReadLong = true; - if(decSense.Value.InformationValid && - decSense.Value.ILI) - capabilities.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); - } + if(decSense.Value.InformationValid && + decSense.Value.ILI) + capabilities.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); + } } if(capabilities.SupportsReadLong != true || @@ -702,7 +696,7 @@ namespace Aaru.Core.Devices.Report return capabilities; if(capabilities.BlockSize == 512) - foreach(int i in new[] + foreach(ushort testSize in new ushort[] { // Long sector sizes for floppies 514, @@ -714,9 +708,7 @@ namespace Aaru.Core.Devices.Report 600, 610, 630 }) { - ushort testSize = (ushort)i; - - sense = _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, (ushort)i, _dev.Timeout, + sense = _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, _dev.Timeout, out _); if(sense || _dev.Error) @@ -728,7 +720,7 @@ namespace Aaru.Core.Devices.Report break; } else if(capabilities.BlockSize == 1024) - foreach(int i in new[] + foreach(ushort testSize in new ushort[] { // Long sector sizes for floppies 1026, @@ -737,9 +729,7 @@ namespace Aaru.Core.Devices.Report 1200 }) { - ushort testSize = (ushort)i; - - sense = _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, (ushort)i, _dev.Timeout, + sense = _dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, _dev.Timeout, out _); if(sense || _dev.Error) diff --git a/Aaru.Core/Devices/Report/SecureDigital.cs b/Aaru.Core/Devices/Report/SecureDigital.cs index 102f68981..75904407c 100644 --- a/Aaru.Core/Devices/Report/SecureDigital.cs +++ b/Aaru.Core/Devices/Report/SecureDigital.cs @@ -37,7 +37,7 @@ using Aaru.Console; namespace Aaru.Core.Devices.Report { /// Implements creating a device report for a SecureDigital or MultiMediaCard flash card - public partial class DeviceReport + public sealed partial class DeviceReport { /// Creates a device report for a SecureDigital or MultiMediaCard flash card public MmcSd MmcSdReport() diff --git a/Aaru.Core/Devices/Report/USB.cs b/Aaru.Core/Devices/Report/USB.cs index 21869d324..c63a7e98a 100644 --- a/Aaru.Core/Devices/Report/USB.cs +++ b/Aaru.Core/Devices/Report/USB.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Metadata; namespace Aaru.Core.Devices.Report { /// Implements creating a report for a USB device - public partial class DeviceReport + public sealed partial class DeviceReport { /// Fills a device report with parameters specific to a USB device public Usb UsbReport() diff --git a/Aaru.Core/Devices/Scanning/ATA.cs b/Aaru.Core/Devices/Scanning/ATA.cs index 82c7f96c5..a4c3277dd 100644 --- a/Aaru.Core/Devices/Scanning/ATA.cs +++ b/Aaru.Core/Devices/Scanning/ATA.cs @@ -38,24 +38,26 @@ using Aaru.Core.Logging; namespace Aaru.Core.Devices.Scanning { /// Implements scanning the media from an ATA device - public partial class MediaScan + public sealed partial class MediaScan { /// Scans the media from an ATA device /// Scanning results ScanResults Ata() { - var results = new ScanResults(); - bool sense; - results.Blocks = 0; + var results = new ScanResults + { + Blocks = 0 + }; + const ushort ataProfile = 0x0001; const uint timeout = 5; - sense = _dev.AtaIdentify(out byte[] cmdBuf, out _); + bool sense = _dev.AtaIdentify(out byte[] cmdBuf, out _); if(!sense && Identify.Decode(cmdBuf).HasValue) { - // Initializate reader + // Initialize reader var ataReader = new Reader(_dev, timeout, cmdBuf, null); // Fill reader blocks @@ -108,7 +110,7 @@ namespace Aaru.Core.Devices.Scanning results.SeekMax = double.MinValue; results.SeekMin = double.MaxValue; results.SeekTotal = 0; - const int SEEK_TIMES = 1000; + const int seekTimes = 1000; double seekCur; @@ -139,15 +141,13 @@ namespace Aaru.Core.Devices.Scanning if(results.Blocks - i < blocksToRead) blocksToRead = (byte)(results.Blocks - i); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > results.MaxSpeed && - currentSpeed != 0) + currentSpeed > 0) results.MaxSpeed = currentSpeed; if(currentSpeed < results.MinSpeed && - currentSpeed != 0) + currentSpeed > 0) results.MinSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator UpdateProgress?.Invoke($"Reading sector {i} of {results.Blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, (long)results.Blocks); @@ -210,7 +210,7 @@ namespace Aaru.Core.Devices.Scanning InitProgress?.Invoke(); if(ataReader.CanSeekLba && _seekTest) - for(int i = 0; i < SEEK_TIMES; i++) + for(int i = 0; i < seekTimes; i++) { if(_aborted) break; @@ -221,15 +221,13 @@ namespace Aaru.Core.Devices.Scanning ataReader.Seek(seekPos, out seekCur); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(seekCur > results.SeekMax && - seekCur != 0) + seekCur > 0) results.SeekMax = seekCur; if(seekCur < results.SeekMin && - seekCur != 0) + seekCur > 0) results.SeekMin = seekCur; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator results.SeekTotal += seekCur; GC.Collect(); @@ -259,15 +257,13 @@ namespace Aaru.Core.Devices.Scanning if(_aborted) break; - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > results.MaxSpeed && - currentSpeed != 0) + currentSpeed > 0) results.MaxSpeed = currentSpeed; if(currentSpeed < results.MinSpeed && - currentSpeed != 0) + currentSpeed > 0) results.MinSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator PulseProgress?. Invoke($"Reading cylinder {cy} head {hd} sector {sc} ({currentSpeed:F3} MiB/sec.)"); @@ -330,7 +326,7 @@ namespace Aaru.Core.Devices.Scanning InitProgress?.Invoke(); if(ataReader.CanSeek) - for(int i = 0; i < SEEK_TIMES; i++) + for(int i = 0; i < seekTimes; i++) { if(_aborted) break; @@ -344,15 +340,13 @@ namespace Aaru.Core.Devices.Scanning ataReader.SeekChs(seekCy, seekHd, seekSc, out seekCur); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(seekCur > results.SeekMax && - seekCur != 0) + seekCur > 0) results.SeekMax = seekCur; if(seekCur < results.SeekMin && - seekCur != 0) + seekCur > 0) results.SeekMin = seekCur; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator results.SeekTotal += seekCur; GC.Collect(); @@ -364,7 +358,7 @@ namespace Aaru.Core.Devices.Scanning results.ProcessingTime /= 1000; results.TotalTime = (end - start).TotalSeconds; results.AvgSpeed = (blockSize * (double)(results.Blocks + 1)) / 1048576 / results.ProcessingTime; - results.SeekTimes = SEEK_TIMES; + results.SeekTimes = seekTimes; return results; } diff --git a/Aaru.Core/Devices/Scanning/MediaScan.cs b/Aaru.Core/Devices/Scanning/MediaScan.cs index b3adf30eb..29b44b8a0 100644 --- a/Aaru.Core/Devices/Scanning/MediaScan.cs +++ b/Aaru.Core/Devices/Scanning/MediaScan.cs @@ -36,7 +36,7 @@ using Aaru.Devices; namespace Aaru.Core.Devices.Scanning { - public partial class MediaScan + public sealed partial class MediaScan { readonly Device _dev; readonly string _devicePath; @@ -86,7 +86,7 @@ namespace Aaru.Core.Devices.Scanning public event ErrorMessageHandler StoppingErrorMessage; /// Event raised to update the values of a determinate progress bar public event UpdateProgressHandler UpdateProgress; - /// Event raised to update the status of an undeterminate progress bar + /// Event raised to update the status of an indeterminate progress bar public event PulseProgressHandler PulseProgress; public event ScanTimeHandler ScanTime; public event ScanUnreadableHandler ScanUnreadable; diff --git a/Aaru.Core/Devices/Scanning/NVMe.cs b/Aaru.Core/Devices/Scanning/NVMe.cs index 4f9b9bec7..4532a9b6c 100644 --- a/Aaru.Core/Devices/Scanning/NVMe.cs +++ b/Aaru.Core/Devices/Scanning/NVMe.cs @@ -32,7 +32,7 @@ namespace Aaru.Core.Devices.Scanning { - public partial class MediaScan + public sealed partial class MediaScan { ScanResults Nvme() { diff --git a/Aaru.Core/Devices/Scanning/SCSI.cs b/Aaru.Core/Devices/Scanning/SCSI.cs index 397131d1a..aef10d059 100644 --- a/Aaru.Core/Devices/Scanning/SCSI.cs +++ b/Aaru.Core/Devices/Scanning/SCSI.cs @@ -44,7 +44,7 @@ using Aaru.Devices; namespace Aaru.Core.Devices.Scanning { /// Implements scanning the media from an SCSI device - public partial class MediaScan + public sealed partial class MediaScan { ScanResults Scsi() { @@ -347,15 +347,13 @@ namespace Aaru.Core.Devices.Scanning if(results.Blocks - i < blocksToRead) blocksToRead = (uint)(results.Blocks - i); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > results.MaxSpeed && - currentSpeed != 0) + currentSpeed > 0) results.MaxSpeed = currentSpeed; if(currentSpeed < results.MinSpeed && - currentSpeed != 0) + currentSpeed > 0) results.MinSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator UpdateProgress?.Invoke($"Reading sector {i} of {results.Blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, (long)results.Blocks); @@ -472,15 +470,13 @@ namespace Aaru.Core.Devices.Scanning if(results.Blocks - i < blocksToRead) blocksToRead = (uint)(results.Blocks - i); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > results.MaxSpeed && - currentSpeed != 0) + currentSpeed > 0) results.MaxSpeed = currentSpeed; if(currentSpeed < results.MinSpeed && - currentSpeed != 0) + currentSpeed > 0) results.MinSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator UpdateProgress?.Invoke($"Reading sector {i} of {results.Blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, (long)results.Blocks); @@ -547,13 +543,13 @@ namespace Aaru.Core.Devices.Scanning results.SeekMax = double.MinValue; results.SeekMin = double.MaxValue; results.SeekTotal = 0; - const int SEEK_TIMES = 1000; + const int seekTimes = 1000; var rnd = new Random(); InitProgress?.Invoke(); - for(int i = 0; i < SEEK_TIMES; i++) + for(int i = 0; i < seekTimes; i++) { if(_aborted || !_seekTest) break; @@ -569,15 +565,13 @@ namespace Aaru.Core.Devices.Scanning else scsiReader.ReadBlock(out _, seekPos, out seekCur); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(seekCur > results.SeekMax && - seekCur != 0) + seekCur > 0) results.SeekMax = seekCur; if(seekCur < results.SeekMin && - seekCur != 0) + seekCur > 0) results.SeekMin = seekCur; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator results.SeekTotal += seekCur; GC.Collect(); @@ -588,7 +582,7 @@ namespace Aaru.Core.Devices.Scanning results.ProcessingTime /= 1000; results.TotalTime = (end - start).TotalSeconds; results.AvgSpeed = (blockSize * (double)(results.Blocks + 1)) / 1048576 / results.ProcessingTime; - results.SeekTimes = SEEK_TIMES; + results.SeekTimes = seekTimes; return results; } diff --git a/Aaru.Core/Devices/Scanning/SecureDigital.cs b/Aaru.Core/Devices/Scanning/SecureDigital.cs index 851d8b169..1fc73a800 100644 --- a/Aaru.Core/Devices/Scanning/SecureDigital.cs +++ b/Aaru.Core/Devices/Scanning/SecureDigital.cs @@ -36,10 +36,12 @@ using Aaru.CommonTypes.Enums; using Aaru.Core.Logging; using Aaru.Decoders.MMC; +// ReSharper disable JoinDeclarationAndInitializer + namespace Aaru.Core.Devices.Scanning { /// Implements scanning a SecureDigital or MultiMediaCard flash card - public partial class MediaScan + public sealed partial class MediaScan { ScanResults SecureDigital() { @@ -174,15 +176,13 @@ namespace Aaru.Core.Devices.Scanning if(results.Blocks - i < blocksToRead) blocksToRead = (byte)(results.Blocks - i); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(currentSpeed > results.MaxSpeed && - currentSpeed != 0) + currentSpeed > 0) results.MaxSpeed = currentSpeed; if(currentSpeed < results.MinSpeed && - currentSpeed != 0) + currentSpeed > 0) results.MinSpeed = currentSpeed; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator UpdateProgress?.Invoke($"Reading sector {i} of {results.Blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, (long)results.Blocks); @@ -257,15 +257,13 @@ namespace Aaru.Core.Devices.Scanning _dev.Read(out cmdBuf, out _, seekPos, blockSize, blocksToRead, byteAddressed, timeout, out double seekCur); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator if(seekCur > results.SeekMax && - seekCur != 0) + seekCur > 0) results.SeekMax = seekCur; if(seekCur < results.SeekMin && - seekCur != 0) + seekCur > 0) results.SeekMin = seekCur; - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator results.SeekTotal += seekCur; GC.Collect(); diff --git a/Aaru.Core/Entropy.cs b/Aaru.Core/Entropy.cs index 7e2b76304..e9f41a6d3 100644 --- a/Aaru.Core/Entropy.cs +++ b/Aaru.Core/Entropy.cs @@ -40,7 +40,7 @@ using Aaru.Console; namespace Aaru.Core { - public class Entropy + public sealed class Entropy { readonly bool _debug; readonly IMediaImage _inputFormat; @@ -60,13 +60,13 @@ namespace Aaru.Core public EntropyResults[] CalculateTracksEntropy(bool duplicatedSectors) { - List entropyResultses = new List(); + List entropyResults = new List(); if(!(_inputFormat is IOpticalMediaImage opticalMediaImage)) { AaruConsole.ErrorWriteLine("The selected image does not support tracks."); - return entropyResultses.ToArray(); + return entropyResults.ToArray(); } try @@ -127,7 +127,7 @@ namespace Aaru.Core if(duplicatedSectors) trackEntropy.UniqueSectors = uniqueSectorsPerTrack.Count; - entropyResultses.Add(trackEntropy); + entropyResults.Add(trackEntropy); } EndProgressEvent?.Invoke(); @@ -140,7 +140,7 @@ namespace Aaru.Core AaruConsole.ErrorWriteLine("Unable to get separate tracks, not calculating their entropy"); } - return entropyResultses.ToArray(); + return entropyResults.ToArray(); } public EntropyResults CalculateMediaEntropy(bool duplicatedSectors) diff --git a/Aaru.Core/ImageFormat.cs b/Aaru.Core/ImageFormat.cs index 5aaac35e9..9bc2351f1 100644 --- a/Aaru.Core/ImageFormat.cs +++ b/Aaru.Core/ImageFormat.cs @@ -52,19 +52,19 @@ namespace Aaru.Core IMediaImage imageFormat = null; // Check all but RAW plugin - foreach(IMediaImage imageplugin in plugins.ImagePluginsList.Values.Where(imageplugin => - imageplugin.Id != + foreach(IMediaImage imagePlugin in plugins.ImagePluginsList.Values.Where(imagePlugin => + imagePlugin.Id != new Guid("12345678-AAAA-BBBB-CCCC-123456789000")) ) try { - AaruConsole.DebugWriteLine("Format detection", "Trying plugin {0}", imageplugin.Name); + AaruConsole.DebugWriteLine("Format detection", "Trying plugin {0}", imagePlugin.Name); - if(!imageplugin.Identify(imageFilter)) + if(!imagePlugin.Identify(imageFilter)) continue; - imageFormat = imageplugin; + imageFormat = imagePlugin; break; } @@ -78,19 +78,19 @@ namespace Aaru.Core return imageFormat; // Check only RAW plugin - foreach(IMediaImage imageplugin in plugins.ImagePluginsList.Values.Where(imageplugin => - imageplugin.Id == + foreach(IMediaImage imagePlugin in plugins.ImagePluginsList.Values.Where(imagePlugin => + imagePlugin.Id == new Guid("12345678-AAAA-BBBB-CCCC-123456789000")) ) try { - AaruConsole.DebugWriteLine("Format detection", "Trying plugin {0}", imageplugin.Name); + AaruConsole.DebugWriteLine("Format detection", "Trying plugin {0}", imagePlugin.Name); - if(!imageplugin.Identify(imageFilter)) + if(!imagePlugin.Identify(imageFilter)) continue; - imageFormat = imageplugin; + imageFormat = imagePlugin; break; } diff --git a/Aaru.Core/ImageInfo.cs b/Aaru.Core/ImageInfo.cs index 527d8b45d..4ed2a1a06 100644 --- a/Aaru.Core/ImageInfo.cs +++ b/Aaru.Core/ImageInfo.cs @@ -58,6 +58,15 @@ namespace Aaru.Core { public static class ImageInfo { + const string MANUFACTURER_STRING = "Manufacturer"; + const string MODEL_STRING = "Model"; + const string SERIAL_STRING = "Serial"; + const string SOFTWARE_STRING = "Software"; + const string VERSION_STRING = "Version"; + const string OS_STRING = "Operating system"; + const string START_STRING = "Start"; + const string END_STRING = "End"; + public static void PrintImageInfo(IMediaImage imageFormat) { AaruConsole.WriteLine("Image information:"); @@ -169,8 +178,7 @@ namespace Aaru.Core PeripheralDeviceTypes scsiDeviceType = PeripheralDeviceTypes.DirectAccess; byte[] scsiVendorId = null; - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_INQUIRY)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SCSI_INQUIRY) == true) { byte[] inquiry = imageFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY); @@ -187,8 +195,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATA_IDENTIFY)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.ATA_IDENTIFY) == true) { byte[] identify = imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY); @@ -197,8 +204,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATAPI_IDENTIFY)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.ATAPI_IDENTIFY) == true) { byte[] identify = imageFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY); @@ -207,8 +213,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_10)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SCSI_MODESENSE_10) == true) { byte[] modeSense10 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_10); Modes.DecodedMode? decMode = Modes.DecodeMode10(modeSense10, scsiDeviceType); @@ -220,8 +225,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } } - else if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_6)) + else if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SCSI_MODESENSE_6) == true) { byte[] modeSense6 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_6); Modes.DecodedMode? decMode = Modes.DecodeMode6(modeSense6, scsiDeviceType); @@ -233,8 +237,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } } - else if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODEPAGE_2A)) + else if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SCSI_MODEPAGE_2A) == true) { byte[] mode2A = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODEPAGE_2A); @@ -242,8 +245,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_FullTOC)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.CD_FullTOC) == true) { byte[] toc = imageFormat.ReadDiskTag(MediaTagType.CD_FullTOC); @@ -266,8 +268,7 @@ namespace Aaru.Core } } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_PMA)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.CD_PMA) == true) { byte[] pma = imageFormat.ReadDiskTag(MediaTagType.CD_PMA); @@ -290,8 +291,7 @@ namespace Aaru.Core } } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_ATIP)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.CD_ATIP) == true) { byte[] atip = imageFormat.ReadDiskTag(MediaTagType.CD_ATIP); @@ -313,8 +313,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TEXT)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.CD_TEXT) == true) { byte[] cdtext = imageFormat.ReadDiskTag(MediaTagType.CD_TEXT); @@ -336,8 +335,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_MCN)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.CD_MCN) == true) { byte[] mcn = imageFormat.ReadDiskTag(MediaTagType.CD_MCN); @@ -347,8 +345,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_PFI)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVD_PFI) == true) { byte[] pfi = imageFormat.ReadDiskTag(MediaTagType.DVD_PFI); @@ -357,8 +354,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_DDS)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDRAM_DDS) == true) { byte[] dds = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_DDS); @@ -367,8 +363,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_PFI)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDR_PFI) == true) { byte[] pfi = imageFormat.ReadDiskTag(MediaTagType.DVDR_PFI); @@ -377,8 +372,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DI)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.BD_DI) == true) { byte[] di = imageFormat.ReadDiskTag(MediaTagType.BD_DI); @@ -387,8 +381,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DDS)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.BD_DDS) == true) { byte[] dds = imageFormat.ReadDiskTag(MediaTagType.BD_DDS); @@ -397,8 +390,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.PCMCIA_CIS)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.PCMCIA_CIS) == true) { byte[] cis = imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS); @@ -472,8 +464,7 @@ namespace Aaru.Core AaruConsole.DebugWriteLine("Device-Info command", "Could not get tuples"); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CID)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SD_CID) == true) { byte[] cid = imageFormat.ReadDiskTag(MediaTagType.SD_CID); @@ -482,8 +473,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CSD)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SD_CSD) == true) { byte[] csd = imageFormat.ReadDiskTag(MediaTagType.SD_CSD); @@ -492,8 +482,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_SCR)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SD_SCR) == true) { byte[] scr = imageFormat.ReadDiskTag(MediaTagType.SD_SCR); @@ -502,8 +491,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_OCR)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SD_OCR) == true) { byte[] ocr = imageFormat.ReadDiskTag(MediaTagType.SD_OCR); @@ -512,8 +500,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CID)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.MMC_CID) == true) { byte[] cid = imageFormat.ReadDiskTag(MediaTagType.MMC_CID); @@ -522,8 +509,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CSD)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.MMC_CSD) == true) { byte[] csd = imageFormat.ReadDiskTag(MediaTagType.MMC_CSD); @@ -532,8 +518,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_ExtendedCSD)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.MMC_ExtendedCSD) == true) { byte[] ecsd = imageFormat.ReadDiskTag(MediaTagType.MMC_ExtendedCSD); @@ -542,8 +527,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_OCR)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.MMC_OCR) == true) { byte[] ocr = imageFormat.ReadDiskTag(MediaTagType.MMC_OCR); @@ -552,8 +536,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_PFI)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.Xbox_PFI) == true) { byte[] xpfi = imageFormat.ReadDiskTag(MediaTagType.Xbox_PFI); @@ -562,8 +545,7 @@ namespace Aaru.Core AaruConsole.WriteLine(); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_DMI)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.Xbox_DMI) == true) { byte[] xdmi = imageFormat.ReadDiskTag(MediaTagType.Xbox_DMI); @@ -592,8 +574,7 @@ namespace Aaru.Core } } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_SecuritySector)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.Xbox_SecuritySector) == true) { byte[] toc = imageFormat.ReadDiskTag(MediaTagType.Xbox_SecuritySector); @@ -675,21 +656,13 @@ namespace Aaru.Core if(imageFormat.DumpHardware == null) return; - const string MANUFACTURER_STRING = "Manufacturer"; - const string MODEL_STRING = "Model"; - const string SERIAL_STRING = "Serial"; - const string SOFTWARE_STRING = "Software"; - const string VERSION_STRING = "Version"; - const string OS_STRING = "Operating system"; - const string START_STRING = "Start"; - const string END_STRING = "End"; - int manufacturerLen = MANUFACTURER_STRING.Length; - int modelLen = MODEL_STRING.Length; - int serialLen = SERIAL_STRING.Length; - int softwareLen = SOFTWARE_STRING.Length; - int versionLen = VERSION_STRING.Length; - int osLen = OS_STRING.Length; - int sectorLen = START_STRING.Length; + int manufacturerLen = MANUFACTURER_STRING.Length; + int modelLen = MODEL_STRING.Length; + int serialLen = SERIAL_STRING.Length; + int softwareLen = SOFTWARE_STRING.Length; + int versionLen = VERSION_STRING.Length; + int osLen = OS_STRING.Length; + int sectorLen = START_STRING.Length; foreach(DumpHardwareType dump in imageFormat.DumpHardware) { diff --git a/Aaru.Core/Logging/DumpLog.cs b/Aaru.Core/Logging/DumpLog.cs index 0a1a91010..5be157600 100644 --- a/Aaru.Core/Logging/DumpLog.cs +++ b/Aaru.Core/Logging/DumpLog.cs @@ -42,7 +42,7 @@ using Version = Aaru.CommonTypes.Interop.Version; namespace Aaru.Core.Logging { /// Creates a dump log - public class DumpLog + public sealed class DumpLog { readonly StreamWriter _logSw; @@ -92,8 +92,8 @@ namespace Aaru.Core.Logging for(int i = 0; i < args.Length; i++) { - if(args[i].StartsWith("/dev") || - args[i].StartsWith("aaru://")) + if(args[i].StartsWith("/dev", StringComparison.OrdinalIgnoreCase) || + args[i].StartsWith("aaru://", StringComparison.OrdinalIgnoreCase)) continue; try diff --git a/Aaru.Core/Logging/ErrorLog.cs b/Aaru.Core/Logging/ErrorLog.cs index 2788b970f..4d2a1b4bf 100644 --- a/Aaru.Core/Logging/ErrorLog.cs +++ b/Aaru.Core/Logging/ErrorLog.cs @@ -35,7 +35,7 @@ using Aaru.Decoders.SCSI; namespace Aaru.Core.Logging { - public class ErrorLog + public sealed class ErrorLog { readonly StreamWriter _logSw; @@ -378,10 +378,10 @@ namespace Aaru.Core.Logging { if(prettySense != null) { - if(prettySense.StartsWith("SCSI SENSE: ")) + if(prettySense.StartsWith("SCSI SENSE: ", StringComparison.Ordinal)) prettySense = prettySense.Substring(12); - if(prettySense.EndsWith("\n")) + if(prettySense.EndsWith('\n')) prettySense = prettySense.Substring(0, prettySense.Length - 1); prettySense = prettySense.Replace("\n", " - "); @@ -401,10 +401,10 @@ namespace Aaru.Core.Logging { if(prettySense != null) { - if(prettySense.StartsWith("SCSI SENSE: ")) + if(prettySense.StartsWith("SCSI SENSE: ", StringComparison.Ordinal)) prettySense = prettySense.Substring(12); - if(prettySense.EndsWith("\n")) + if(prettySense.EndsWith('\n')) prettySense = prettySense.Substring(0, prettySense.Length - 1); prettySense = prettySense.Replace("\n", " - "); @@ -424,10 +424,10 @@ namespace Aaru.Core.Logging { if(prettySense != null) { - if(prettySense.StartsWith("SCSI SENSE: ")) + if(prettySense.StartsWith("SCSI SENSE: ", StringComparison.Ordinal)) prettySense = prettySense.Substring(12); - if(prettySense.EndsWith("\n")) + if(prettySense.EndsWith('\n')) prettySense = prettySense.Substring(0, prettySense.Length - 1); prettySense = prettySense.Replace("\n", " - "); @@ -467,10 +467,10 @@ namespace Aaru.Core.Logging { if(prettySense != null) { - if(prettySense.StartsWith("SCSI SENSE: ")) + if(prettySense.StartsWith("SCSI SENSE: ", StringComparison.Ordinal)) prettySense = prettySense.Substring(12); - if(prettySense.EndsWith("\n")) + if(prettySense.EndsWith('\n')) prettySense = prettySense.Substring(0, prettySense.Length - 1); prettySense = prettySense.Replace("\n", " - "); @@ -490,10 +490,10 @@ namespace Aaru.Core.Logging { if(prettySense != null) { - if(prettySense.StartsWith("SCSI SENSE: ")) + if(prettySense.StartsWith("SCSI SENSE: ", StringComparison.Ordinal)) prettySense = prettySense.Substring(12); - if(prettySense.EndsWith("\n")) + if(prettySense.EndsWith('\n')) prettySense = prettySense.Substring(0, prettySense.Length - 1); prettySense = prettySense.Replace("\n", " - "); @@ -513,10 +513,10 @@ namespace Aaru.Core.Logging { if(prettySense != null) { - if(prettySense.StartsWith("SCSI SENSE: ")) + if(prettySense.StartsWith("SCSI SENSE: ", StringComparison.Ordinal)) prettySense = prettySense.Substring(12); - if(prettySense.EndsWith("\n")) + if(prettySense.EndsWith('\n')) prettySense = prettySense.Substring(0, prettySense.Length - 1); prettySense = prettySense.Replace("\n", " - "); diff --git a/Aaru.Core/Logging/IBGLog.cs b/Aaru.Core/Logging/IBGLog.cs index 6efd7000a..1d558020e 100644 --- a/Aaru.Core/Logging/IBGLog.cs +++ b/Aaru.Core/Logging/IBGLog.cs @@ -39,7 +39,7 @@ using Aaru.Devices; namespace Aaru.Core.Logging { /// Implements a log in the format used by IMGBurn - internal class IbgLog + internal sealed class IbgLog { readonly CultureInfo _ibgCulture; readonly double _ibgDivider; diff --git a/Aaru.Core/Logging/MHDDLog.cs b/Aaru.Core/Logging/MHDDLog.cs index 61f55dcea..e9768c7d7 100644 --- a/Aaru.Core/Logging/MHDDLog.cs +++ b/Aaru.Core/Logging/MHDDLog.cs @@ -40,7 +40,7 @@ using Aaru.Devices; namespace Aaru.Core.Logging { /// Implements a log in the format used by MHDD - internal class MhddLog + internal sealed class MhddLog { const string MHDD_VER = "VER:2 "; readonly string _logFile; @@ -98,9 +98,9 @@ namespace Aaru.Core.Logging string fw = $"F/W: {dev.FirmwareRevision}"; string sn = $"S/N: {(@private ? "" : dev.Serial)}"; string sectors = string.Format(new CultureInfo("en-US"), "SECTORS: {0:n0}", blocks); - string sectorsize = string.Format(new CultureInfo("en-US"), "SECTOR SIZE: {0:n0} bytes", blockSize); + string sectorSize = string.Format(new CultureInfo("en-US"), "SECTOR SIZE: {0:n0} bytes", blockSize); - string scanblocksize = + string scanBlockSize = string.Format(new CultureInfo("en-US"), "SCAN BLOCK SIZE: {0:n0} sectors", blocksToRead); byte[] deviceBytes = Encoding.ASCII.GetBytes(device); @@ -108,12 +108,12 @@ namespace Aaru.Core.Logging byte[] fwBytes = Encoding.ASCII.GetBytes(fw); byte[] snBytes = Encoding.ASCII.GetBytes(sn); byte[] sectorsBytes = Encoding.ASCII.GetBytes(sectors); - byte[] sectorsizeBytes = Encoding.ASCII.GetBytes(sectorsize); - byte[] scanblocksizeBytes = Encoding.ASCII.GetBytes(scanblocksize); + byte[] sectorSizeBytes = Encoding.ASCII.GetBytes(sectorSize); + byte[] scanBlockSizeBytes = Encoding.ASCII.GetBytes(scanBlockSize); byte[] verBytes = Encoding.ASCII.GetBytes(MHDD_VER); uint pointer = (uint)(deviceBytes.Length + modeBytes.Length + fwBytes.Length + snBytes.Length + - sectorsBytes.Length + sectorsizeBytes.Length + scanblocksizeBytes.Length + + sectorsBytes.Length + sectorSizeBytes.Length + scanBlockSizeBytes.Length + verBytes.Length + (2 * 9) + // New lines 4); // Pointer @@ -135,9 +135,9 @@ namespace Aaru.Core.Logging _mhddFs.Write(newLine, 0, 2); _mhddFs.Write(sectorsBytes, 0, sectorsBytes.Length); _mhddFs.Write(newLine, 0, 2); - _mhddFs.Write(sectorsizeBytes, 0, sectorsizeBytes.Length); + _mhddFs.Write(sectorSizeBytes, 0, sectorSizeBytes.Length); _mhddFs.Write(newLine, 0, 2); - _mhddFs.Write(scanblocksizeBytes, 0, scanblocksizeBytes.Length); + _mhddFs.Write(scanBlockSizeBytes, 0, scanBlockSizeBytes.Length); _mhddFs.Write(newLine, 0, 2); } diff --git a/Aaru.Core/Media/CompactDisc.cs b/Aaru.Core/Media/CompactDisc.cs index e029fb9a3..33d24ba26 100644 --- a/Aaru.Core/Media/CompactDisc.cs +++ b/Aaru.Core/Media/CompactDisc.cs @@ -1458,6 +1458,9 @@ namespace Aaru.Core.Media ulong trackStart; ulong pregap; + if(track == null) + continue; + // Hidden track if(track.TrackSequence == 0) { diff --git a/Aaru.Core/Media/Detection/MMC.cs b/Aaru.Core/Media/Detection/MMC.cs index 1d0f417d7..bf051468e 100644 --- a/Aaru.Core/Media/Detection/MMC.cs +++ b/Aaru.Core/Media/Detection/MMC.cs @@ -168,30 +168,29 @@ namespace Aaru.Core.Media.Detection { Array.Copy(sector, i, testMark, 0, 12); - if(syncMark.SequenceEqual(testMark) && - (sector[i + 0xF] == 0x60 || sector[i + 0xF] == 0x61 || sector[i + 0xF] == 0x62)) + if(!syncMark.SequenceEqual(testMark) || + (sector[i + 0xF] != 0x60 && sector[i + 0xF] != 0x61 && sector[i + 0xF] != 0x62)) + continue; - { - // De-scramble M and S - int minute = sector[i + 12] ^ 0x01; - int second = sector[i + 13] ^ 0x80; - int frame = sector[i + 14]; + // De-scramble M and S + int minute = sector[i + 12] ^ 0x01; + int second = sector[i + 13] ^ 0x80; + int frame = sector[i + 14]; - // Convert to binary - minute = ((minute / 16) * 10) + (minute & 0x0F); - second = ((second / 16) * 10) + (second & 0x0F); - frame = ((frame / 16) * 10) + (frame & 0x0F); + // Convert to binary + minute = ((minute / 16) * 10) + (minute & 0x0F); + second = ((second / 16) * 10) + (second & 0x0F); + frame = ((frame / 16) * 10) + (frame & 0x0F); - // Calculate the first found LBA - int lba = ((minute * 60 * 75) + (second * 75) + frame) - 150; + // Calculate the first found LBA + int lba = ((minute * 60 * 75) + (second * 75) + frame) - 150; - // Calculate the difference between the found LBA and the requested one - int diff = wantedLba - lba; + // Calculate the difference between the found LBA and the requested one + int diff = wantedLba - lba; - offset = i + (2352 * diff); + offset = i + (2352 * diff); - return true; - } + return true; } return false; @@ -259,7 +258,7 @@ namespace Aaru.Core.Media.Detection return false; } - public static int GetVideoNowColorOffset(byte[] data) + internal static int GetVideoNowColorOffset(byte[] data) { byte[] buffer = new byte[_videoNowColorFrameMarker.Length]; @@ -279,9 +278,9 @@ namespace Aaru.Core.Media.Detection return 0; } - public static void DetectDiscType(ref MediaType mediaType, int sessions, FullTOC.CDFullTOC? decodedToc, - Device dev, out bool hiddenTrack, out bool hiddenData, - int firstTrackLastSession) + internal static void DetectDiscType(ref MediaType mediaType, int sessions, FullTOC.CDFullTOC? decodedToc, + Device dev, out bool hiddenTrack, out bool hiddenData, + int firstTrackLastSession) { uint startOfFirstDataTrack = uint.MaxValue; byte[] cmdBuf; @@ -300,10 +299,9 @@ namespace Aaru.Core.Media.Detection hiddenTrack = false; hiddenData = false; - if(decodedToc.HasValue) - if(decodedToc.Value.TrackDescriptors.Any(t => t.SessionNumber == 2)) - secondSessionFirstTrack = decodedToc.Value.TrackDescriptors.Where(t => t.SessionNumber == 2). - Min(t => t.POINT); + if(decodedToc?.TrackDescriptors.Any(t => t.SessionNumber == 2) == true) + secondSessionFirstTrack = decodedToc.Value.TrackDescriptors.Where(t => t.SessionNumber == 2). + Min(t => t.POINT); if(mediaType == MediaType.CD || mediaType == MediaType.CDROMXA) @@ -409,53 +407,50 @@ namespace Aaru.Core.Media.Detection if((mediaType == MediaType.CD || mediaType == MediaType.CDROM) && hasDataTrack) { - foreach(FullTOC.TrackDataDescriptor track in - decodedToc.Value.TrackDescriptors.Where(t => t.POINT > 0 && t.POINT <= 0x99 && - ((TocControl)(t.CONTROL & 0x0D) == - TocControl.DataTrack || - (TocControl)(t.CONTROL & 0x0D) == - TocControl.DataTrackIncremental))) + foreach(uint startAddress in decodedToc. + Value.TrackDescriptors. + Where(t => t.POINT > 0 && t.POINT <= 0x99 && + ((TocControl)(t.CONTROL & 0x0D) == TocControl.DataTrack || + (TocControl)(t.CONTROL & 0x0D) == + TocControl.DataTrackIncremental)). + Select(track => (uint)(((track.PHOUR * 3600 * 75) + + (track.PMIN * 60 * 75) + (track.PSEC * 75) + + track.PFRAME) - 150) + 16)) { - uint startAddress = - (uint)(((track.PHOUR * 3600 * 75) + (track.PMIN * 60 * 75) + (track.PSEC * 75) + - track.PFRAME) - 150) + 16; - sense = dev.ReadCd(out cmdBuf, out _, startAddress, 2352, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - if(!sense && - !dev.Error) - { - if(cmdBuf[0] == 0x00 && - cmdBuf[1] == 0xFF && - cmdBuf[2] == 0xFF && - cmdBuf[3] == 0xFF && - cmdBuf[4] == 0xFF && - cmdBuf[5] == 0xFF && - cmdBuf[6] == 0xFF && - cmdBuf[7] == 0xFF && - cmdBuf[8] == 0xFF && - cmdBuf[9] == 0xFF && - cmdBuf[10] == 0xFF && - cmdBuf[11] == 0x00 && - cmdBuf[15] == 0x02) - { - AaruConsole.DebugWriteLine("Media detection", - "Disc has a mode 2 data track, setting as CD-ROM XA."); + if(sense || dev.Error) + continue; - mediaType = MediaType.CDROMXA; + if(cmdBuf[0] != 0x00 || + cmdBuf[1] != 0xFF || + cmdBuf[2] != 0xFF || + cmdBuf[3] != 0xFF || + cmdBuf[4] != 0xFF || + cmdBuf[5] != 0xFF || + cmdBuf[6] != 0xFF || + cmdBuf[7] != 0xFF || + cmdBuf[8] != 0xFF || + cmdBuf[9] != 0xFF || + cmdBuf[10] != 0xFF || + cmdBuf[11] != 0x00 || + cmdBuf[15] != 0x02) + continue; - break; - } - } + AaruConsole.DebugWriteLine("Media detection", + "Disc has a mode 2 data track, setting as CD-ROM XA."); + + mediaType = MediaType.CDROMXA; + + break; } } } - if(secondSessionFirstTrack != 0 && - decodedToc.HasValue && - decodedToc.Value.TrackDescriptors.Any(t => t.POINT == secondSessionFirstTrack)) + if(secondSessionFirstTrack != 0 && + decodedToc?.TrackDescriptors.Any(t => t.POINT == secondSessionFirstTrack) == true) { FullTOC.TrackDataDescriptor secondSessionFirstTrackTrack = decodedToc.Value.TrackDescriptors.First(t => t.POINT == secondSessionFirstTrack); @@ -531,38 +526,81 @@ namespace Aaru.Core.Media.Detection Array.Copy(cmdBuf, 0, videoNowColorFrame, i * 2352, 2352); } - if(decodedToc.HasValue) + FullTOC.TrackDataDescriptor? firstTrack = decodedToc?.TrackDescriptors.FirstOrDefault(t => t.POINT == 1); + + if(firstTrack?.POINT == 1) { - FullTOC.TrackDataDescriptor firstTrack = - decodedToc.Value.TrackDescriptors.FirstOrDefault(t => t.POINT == 1); + uint firstTrackSector = (uint)(((firstTrack.Value.PHOUR * 3600 * 75) + + (firstTrack.Value.PMIN * 60 * 75) + (firstTrack.Value.PSEC * 75) + + firstTrack.Value.PFRAME) - 150); - if(firstTrack.POINT == 1) + // Check for hidden data before start of track 1 + if(firstTrackSector > 0) { - uint firstTrackSector = (uint)(((firstTrack.PHOUR * 3600 * 75) + (firstTrack.PMIN * 60 * 75) + - (firstTrack.PSEC * 75) + firstTrack.PFRAME) - 150); + sense = dev.ReadCd(out sector0, out _, 0, 2352, 1, MmcSectorTypes.AllTypes, false, false, true, + MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, + dev.Timeout, out _); - // Check for hidden data before start of track 1 - if(firstTrackSector > 0) + if(!dev.Error && + !sense) { - sense = dev.ReadCd(out sector0, out _, 0, 2352, 1, MmcSectorTypes.AllTypes, false, false, true, - MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, - MmcSubchannel.None, dev.Timeout, out _); + hiddenTrack = true; - if(!dev.Error && - !sense) + hiddenData = IsData(sector0); + + if(hiddenData) { - hiddenTrack = true; + sense = dev.ReadCd(out byte[] sector16, out _, 16, 2352, 1, MmcSectorTypes.AllTypes, false, + false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, + MmcSubchannel.None, dev.Timeout, out _); - hiddenData = IsData(sector0); + if(!sense && + IsCdi(sector0, sector16)) + { + mediaType = MediaType.CDIREADY; + + AaruConsole.DebugWriteLine("Media detection", + "Disc has a hidden CD-i track in track 1's pregap, setting as CD-i Ready."); + + return; + } + } + else + { + hiddenData = IsScrambledData(sector0, 0, out int combinedOffset); if(hiddenData) { - sense = dev.ReadCd(out byte[] sector16, out _, 16, 2352, 1, MmcSectorTypes.AllTypes, - false, false, true, MmcHeaderCodes.AllHeaders, true, true, - MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); + int sectorsForOffset = combinedOffset / 2352; - if(!sense && - IsCdi(sector0, sector16)) + if(sectorsForOffset < 0) + sectorsForOffset *= -1; + + if(combinedOffset % 2352 != 0) + sectorsForOffset++; + + int lba0 = 0; + int lba16 = 16; + + if(combinedOffset < 0) + { + lba0 -= sectorsForOffset - 1; + lba16 -= sectorsForOffset - 1; + } + + dev.ReadCd(out sector0, out _, (uint)lba0, 2352, (uint)sectorsForOffset + 1, + MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); + + sector0 = DescrambleAndFixOffset(sector0, combinedOffset, sectorsForOffset); + + dev.ReadCd(out byte[] sector16, out _, (uint)lba16, 2352, (uint)sectorsForOffset + 1, + MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, + true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); + + sector16 = DescrambleAndFixOffset(sector16, combinedOffset, sectorsForOffset); + + if(IsCdi(sector0, sector16)) { mediaType = MediaType.CDIREADY; @@ -572,54 +610,6 @@ namespace Aaru.Core.Media.Detection return; } } - else - { - hiddenData = IsScrambledData(sector0, 0, out int combinedOffset); - - if(hiddenData) - { - int sectorsForOffset = combinedOffset / 2352; - - if(sectorsForOffset < 0) - sectorsForOffset *= -1; - - if(combinedOffset % 2352 != 0) - sectorsForOffset++; - - int lba0 = 0; - int lba16 = 16; - - if(combinedOffset < 0) - { - lba0 -= sectorsForOffset - 1; - lba16 -= sectorsForOffset - 1; - } - - sense = dev.ReadCd(out sector0, out _, (uint)lba0, 2352, (uint)sectorsForOffset + 1, - MmcSectorTypes.AllTypes, false, false, true, - MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, - MmcSubchannel.None, dev.Timeout, out _); - - sector0 = DescrambleAndFixOffset(sector0, combinedOffset, sectorsForOffset); - - sense = dev.ReadCd(out byte[] sector16, out _, (uint)lba16, 2352, - (uint)sectorsForOffset + 1, MmcSectorTypes.AllTypes, false, - false, true, MmcHeaderCodes.AllHeaders, true, true, - MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); - - sector16 = DescrambleAndFixOffset(sector16, combinedOffset, sectorsForOffset); - - if(IsCdi(sector0, sector16)) - { - mediaType = MediaType.CDIREADY; - - AaruConsole.DebugWriteLine("Media detection", - "Disc has a hidden CD-i track in track 1's pregap, setting as CD-i Ready."); - - return; - } - } - } } } } @@ -1359,22 +1349,21 @@ namespace Aaru.Core.Media.Detection } } - if(firstTrackSecondSession != null) - if(firstTrackSecondSession.Length >= 2336) + if(firstTrackSecondSession?.Length >= 2336) + { + byte[] milcd = new byte[2048]; + Array.Copy(firstTrackSecondSession, 24, milcd, 0, 2048); + + if(Dreamcast.DecodeIPBin(milcd).HasValue) { - byte[] milcd = new byte[2048]; - Array.Copy(firstTrackSecondSession, 24, milcd, 0, 2048); + mediaType = MediaType.MilCD; - if(Dreamcast.DecodeIPBin(milcd).HasValue) - { - mediaType = MediaType.MilCD; + AaruConsole.DebugWriteLine("Media detection", + "Found Sega Dreamcast IP.BIN on second session, setting disc type to MilCD."); - AaruConsole.DebugWriteLine("Media detection", - "Found Sega Dreamcast IP.BIN on second session, setting disc type to MilCD."); - - return; - } + return; } + } // TODO: Detect black and white VideoNow // TODO: Detect VideoNow XP @@ -1537,7 +1526,6 @@ namespace Aaru.Core.Media.Detection return; List rootEntries = new List(); - int rootPos = 0; uint ngcdIplStart = 0; uint ngcdIplLength = 0; uint vcdStart = 0; @@ -1549,7 +1537,7 @@ namespace Aaru.Core.Media.Detection for(int ri = 0; ri < rootLength; ri++) { - rootPos = ri * 2048; + int rootPos = ri * 2048; while(isoSector[rootPos] > 0 && rootPos < isoSector.Length && @@ -1565,30 +1553,31 @@ namespace Aaru.Core.Media.Detection rootEntries.Add(name); - if(name == "IPL.TXT") + switch(name) { - ngcdIplStart = BitConverter.ToUInt32(isoSector, rootPos + 2); - ngcdIplLength = BitConverter.ToUInt32(isoSector, rootPos + 10); - } + case "IPL.TXT": + ngcdIplStart = BitConverter.ToUInt32(isoSector, rootPos + 2); + ngcdIplLength = BitConverter.ToUInt32(isoSector, rootPos + 10); - if((name == "VCD" || name == "SVCD" || name == "HQVCD") && - (isoSector[rootPos + 25] & 0x02) == 0x02) - { - vcdStart = BitConverter.ToUInt32(isoSector, rootPos + 2); - vcdLength = BitConverter.ToUInt32(isoSector, rootPos + 10) / 2048; - } + break; - if(name == "PHOTO_CD" && - (isoSector[rootPos + 25] & 0x02) == 0x02) - { - pcdStart = BitConverter.ToUInt32(isoSector, rootPos + 2); - pcdLength = BitConverter.ToUInt32(isoSector, rootPos + 10) / 2048; - } + case "VCD" when (isoSector[rootPos + 25] & 0x02) == 0x02: + case "SVCD" when (isoSector[rootPos + 25] & 0x02) == 0x02: + case "HQVCD" when (isoSector[rootPos + 25] & 0x02) == 0x02: + vcdStart = BitConverter.ToUInt32(isoSector, rootPos + 2); + vcdLength = BitConverter.ToUInt32(isoSector, rootPos + 10) / 2048; - if(name == "SYSTEM.CNF") - { - ps1Start = BitConverter.ToUInt32(isoSector, rootPos + 2); - ps1Length = BitConverter.ToUInt32(isoSector, rootPos + 10); + break; + case "PHOTO_CD" when (isoSector[rootPos + 25] & 0x02) == 0x02: + pcdStart = BitConverter.ToUInt32(isoSector, rootPos + 2); + pcdLength = BitConverter.ToUInt32(isoSector, rootPos + 10) / 2048; + + break; + case "SYSTEM.CNF": + ps1Start = BitConverter.ToUInt32(isoSector, rootPos + 2); + ps1Length = BitConverter.ToUInt32(isoSector, rootPos + 10); + + break; } rootPos += isoSector[rootPos]; @@ -1626,7 +1615,7 @@ namespace Aaru.Core.Media.Detection if(ngcdIplLength % 2048 > 0) ngcdSectors++; - string iplTxt = null; + string iplTxt; // Read "IPL.TXT" try @@ -1790,12 +1779,11 @@ namespace Aaru.Core.Media.Detection if(isoSector.Length < 2048) return; - int vcdPos = 0; uint infoPos = 0; for(int vi = 0; vi < vcdLength; vi++) { - vcdPos = vi * 2048; + int vcdPos = vi * 2048; while(isoSector[vcdPos] > 0 && vcdPos < isoSector.Length && @@ -1888,12 +1876,11 @@ namespace Aaru.Core.Media.Detection if(isoSector.Length < 2048) return; - int pcdPos = 0; uint infoPos = 0; for(int pi = 0; pi < vcdLength; pi++) { - pcdPos = pi * 2048; + int pcdPos = pi * 2048; while(isoSector[pcdPos] > 0 && pcdPos < isoSector.Length && @@ -1952,7 +1939,7 @@ namespace Aaru.Core.Media.Detection if(ps1Length % 2048 > 0) ps1Sectors++; - string ps1Txt = null; + string ps1Txt; // Read "SYSTEM.CNF" try diff --git a/Aaru.Core/Media/Info/CompactDisc.cs b/Aaru.Core/Media/Info/CompactDisc.cs index 5465580bf..16f2b29b8 100644 --- a/Aaru.Core/Media/Info/CompactDisc.cs +++ b/Aaru.Core/Media/Info/CompactDisc.cs @@ -89,7 +89,7 @@ namespace Aaru.Core.Media.Info { dataTrack = tracks.FirstOrDefault(t => t.TrackType != TrackType.Audio); - if(dataTrack.TrackSequence != 0) + if(dataTrack != null) { // Build sync sectorSync = new byte[] @@ -171,9 +171,9 @@ namespace Aaru.Core.Media.Info break; } - sense = dev.ReadCd(out cmdBuf, out _, wantedLba, sectorSize, 3, MmcSectorTypes.Cdda, - false, false, false, MmcHeaderCodes.None, true, false, - MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _); + dev.ReadCd(out cmdBuf, out _, wantedLba, sectorSize, 3, MmcSectorTypes.Cdda, false, + false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, + MmcSubchannel.None, dev.Timeout, out _); for(int i = 0; i < cmdBuf.Length - sectorSync.Length; i++) { diff --git a/Aaru.Core/Media/Info/ScsiInfo.cs b/Aaru.Core/Media/Info/ScsiInfo.cs index f20b8d27b..6c0aa97bd 100644 --- a/Aaru.Core/Media/Info/ScsiInfo.cs +++ b/Aaru.Core/Media/Info/ScsiInfo.cs @@ -52,7 +52,7 @@ using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry; namespace Aaru.Core.Media.Info { - public class ScsiInfo + public sealed class ScsiInfo { public ScsiInfo(Device dev) { @@ -1258,8 +1258,7 @@ namespace Aaru.Core.Media.Info { Inquiry? inq = Inquiry.Decode(inqBuffer); - if(inq.HasValue && - inq.Value.KreonPresent) + if(inq?.KreonPresent == true) { sense = dev.KreonExtractSs(out cmdBuf, out senseBuf, dev.Timeout, out _); diff --git a/Aaru.Core/Media/Info/XgdInfo.cs b/Aaru.Core/Media/Info/XgdInfo.cs index d4f374600..cf6fd3901 100644 --- a/Aaru.Core/Media/Info/XgdInfo.cs +++ b/Aaru.Core/Media/Info/XgdInfo.cs @@ -32,7 +32,7 @@ namespace Aaru.Core.Media.Info { - public class XgdInfo + public sealed class XgdInfo { public ulong GameSize; public ulong L0Video; diff --git a/Aaru.Core/Partitions.cs b/Aaru.Core/Partitions.cs index 050af9ac6..f4de19f3c 100644 --- a/Aaru.Core/Partitions.cs +++ b/Aaru.Core/Partitions.cs @@ -110,7 +110,7 @@ namespace Aaru.Core continue; } - List childs = new List(); + List children = new List(); foreach(IPartition partitionPlugin in plugins.PartPluginsList.Values) { @@ -123,18 +123,18 @@ namespace Aaru.Core AaruConsole.DebugWriteLine("Partitions", "Found {0} @ {1}", partitionPlugin.Name, foundPartitions[0].Start); - childs.AddRange(partitions); + children.AddRange(partitions); } checkedLocations.Add(foundPartitions[0].Start); - AaruConsole.DebugWriteLine("Partitions", "Got {0} childs", childs.Count); + AaruConsole.DebugWriteLine("Partitions", "Got {0} children", children.Count); - if(childs.Count > 0) + if(children.Count > 0) { foundPartitions.RemoveAt(0); - foreach(Partition child in childs) + foreach(Partition child in children) if(checkedLocations.Contains(child.Start)) childPartitions.Add(child); else diff --git a/Aaru.Core/Sidecar/AudioMedia.cs b/Aaru.Core/Sidecar/AudioMedia.cs index fd2540de1..0bb8ac4d4 100644 --- a/Aaru.Core/Sidecar/AudioMedia.cs +++ b/Aaru.Core/Sidecar/AudioMedia.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.Core { - public partial class Sidecar + public sealed partial class Sidecar { // TODO: Complete it /// Creates a metadata sidecar for an audio media (e.g. cassette) diff --git a/Aaru.Core/Sidecar/BlockMedia.cs b/Aaru.Core/Sidecar/BlockMedia.cs index f59b0230e..b03e60b1c 100644 --- a/Aaru.Core/Sidecar/BlockMedia.cs +++ b/Aaru.Core/Sidecar/BlockMedia.cs @@ -51,7 +51,7 @@ using Tuple = Aaru.Decoders.PCMCIA.Tuple; namespace Aaru.Core { - public partial class Sidecar + public sealed partial class Sidecar { /// Creates a metadata sidecar for a block media (e.g. floppy, hard disk, flash card, usb stick) /// Image diff --git a/Aaru.Core/Sidecar/BlockTape.cs b/Aaru.Core/Sidecar/BlockTape.cs index b08df3d80..c11e87fa2 100644 --- a/Aaru.Core/Sidecar/BlockTape.cs +++ b/Aaru.Core/Sidecar/BlockTape.cs @@ -36,7 +36,7 @@ using Schemas; namespace Aaru.Core { - public partial class Sidecar + public sealed partial class Sidecar { /// Creates a metadata sidecar for a block tape (e.g. scsi streaming) /// List of files diff --git a/Aaru.Core/Sidecar/Events.cs b/Aaru.Core/Sidecar/Events.cs index 9c256a4a9..353437f94 100644 --- a/Aaru.Core/Sidecar/Events.cs +++ b/Aaru.Core/Sidecar/Events.cs @@ -32,7 +32,7 @@ namespace Aaru.Core { - public partial class Sidecar + public sealed partial class Sidecar { public event InitProgressHandler InitProgressEvent; public event UpdateProgressHandler UpdateProgressEvent; diff --git a/Aaru.Core/Sidecar/Files.cs b/Aaru.Core/Sidecar/Files.cs index c814fa72d..5c7cc4efa 100644 --- a/Aaru.Core/Sidecar/Files.cs +++ b/Aaru.Core/Sidecar/Files.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.Core { - public partial class Sidecar + public sealed partial class Sidecar { FilesystemContentsType Files(IReadOnlyFilesystem filesystem) { diff --git a/Aaru.Core/Sidecar/Helpers.cs b/Aaru.Core/Sidecar/Helpers.cs index 7434965e5..bbd1509a4 100644 --- a/Aaru.Core/Sidecar/Helpers.cs +++ b/Aaru.Core/Sidecar/Helpers.cs @@ -32,7 +32,7 @@ namespace Aaru.Core { - public partial class Sidecar + public sealed partial class Sidecar { /// Converts a LBA to MM:SS:FF string for CDs /// LBA diff --git a/Aaru.Core/Sidecar/LinearMedia.cs b/Aaru.Core/Sidecar/LinearMedia.cs index d5638e148..8be0e06a6 100644 --- a/Aaru.Core/Sidecar/LinearMedia.cs +++ b/Aaru.Core/Sidecar/LinearMedia.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.Core { - public partial class Sidecar + public sealed partial class Sidecar { // TODO: Complete it /// Creates a metadata sidecar for linear media (e.g. ROM chip) diff --git a/Aaru.Core/Sidecar/OpticalDisc.cs b/Aaru.Core/Sidecar/OpticalDisc.cs index aee979938..d8234aa70 100644 --- a/Aaru.Core/Sidecar/OpticalDisc.cs +++ b/Aaru.Core/Sidecar/OpticalDisc.cs @@ -50,7 +50,7 @@ using TrackType = Schemas.TrackType; namespace Aaru.Core { - public partial class Sidecar + public sealed partial class Sidecar { /// Creates a metadata sidecar for an optical disc (e.g. CD, DVD, GD, BD, XGD, GOD) /// Image diff --git a/Aaru.Core/Sidecar/Sidecar.cs b/Aaru.Core/Sidecar/Sidecar.cs index 15cce665f..d79016bd9 100644 --- a/Aaru.Core/Sidecar/Sidecar.cs +++ b/Aaru.Core/Sidecar/Sidecar.cs @@ -42,7 +42,7 @@ using Schemas; namespace Aaru.Core { - public partial class Sidecar + public sealed partial class Sidecar { readonly ChecksumType[] _emptyChecksums; readonly Encoding _encoding; diff --git a/Aaru.Core/Statistics.cs b/Aaru.Core/Statistics.cs index f08d1c085..df9aa29cf 100644 --- a/Aaru.Core/Statistics.cs +++ b/Aaru.Core/Statistics.cs @@ -58,7 +58,7 @@ namespace Aaru.Core public static class Statistics { /// Statistics file semaphore - static bool submitStatsLock; + static bool _submitStatsLock; /// Loads saved statistics from disk public static void LoadStats() @@ -78,286 +78,275 @@ namespace Aaru.Core allStats = (Stats)xs.Deserialize(sr); sr.Close(); - if(allStats.Commands != null) + if(allStats.Commands?.Analyze > 0) { - if(allStats.Commands.Analyze > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "analyze" && c.Synchronized) ?? - new Command - { - Name = "analyze", - Synchronized = true - }; + Command command = ctx.Commands.FirstOrDefault(c => c.Name == "analyze" && c.Synchronized) ?? + new Command + { + Name = "analyze", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.Analyze; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.Analyze; + ctx.Commands.Update(command); + } - if(allStats.Commands.Checksum > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "checksum" && c.Synchronized) ?? - new Command - { - Name = "checksum", - Synchronized = true - }; + if(allStats.Commands?.Checksum > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "checksum" && c.Synchronized) ?? new Command + { + Name = "checksum", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.Checksum; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.Checksum; + ctx.Commands.Update(command); + } - if(allStats.Commands.Compare > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "compare" && c.Synchronized) ?? - new Command - { - Name = "compare", - Synchronized = true - }; + if(allStats.Commands?.Compare > 0) + { + Command command = ctx.Commands.FirstOrDefault(c => c.Name == "compare" && c.Synchronized) ?? + new Command + { + Name = "compare", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.Compare; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.Compare; + ctx.Commands.Update(command); + } - if(allStats.Commands.ConvertImage > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "convert-image" && c.Synchronized) ?? - new Command - { - Name = "convert-image", - Synchronized = true - }; + if(allStats.Commands?.ConvertImage > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "convert-image" && c.Synchronized) ?? + new Command + { + Name = "convert-image", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.ConvertImage; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.ConvertImage; + ctx.Commands.Update(command); + } - if(allStats.Commands.CreateSidecar > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "create-sidecar" && c.Synchronized) ?? - new Command - { - Name = "create-sidecar", - Synchronized = true - }; + if(allStats.Commands?.CreateSidecar > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "create-sidecar" && c.Synchronized) ?? + new Command + { + Name = "create-sidecar", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.CreateSidecar; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.CreateSidecar; + ctx.Commands.Update(command); + } - if(allStats.Commands.Decode > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "decode" && c.Synchronized) ?? - new Command - { - Name = "decode", - Synchronized = true - }; + if(allStats.Commands?.Decode > 0) + { + Command command = ctx.Commands.FirstOrDefault(c => c.Name == "decode" && c.Synchronized) ?? + new Command + { + Name = "decode", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.Decode; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.Decode; + ctx.Commands.Update(command); + } - if(allStats.Commands.DeviceInfo > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "device-info" && c.Synchronized) ?? - new Command - { - Name = "device-info", - Synchronized = true - }; + if(allStats.Commands?.DeviceInfo > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "device-info" && c.Synchronized) ?? + new Command + { + Name = "device-info", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.DeviceInfo; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.DeviceInfo; + ctx.Commands.Update(command); + } - if(allStats.Commands.DeviceReport > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "device-report" && c.Synchronized) ?? - new Command - { - Name = "device-report", - Synchronized = true - }; + if(allStats.Commands?.DeviceReport > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "device-report" && c.Synchronized) ?? + new Command + { + Name = "device-report", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.DeviceReport; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.DeviceReport; + ctx.Commands.Update(command); + } - if(allStats.Commands.DumpMedia > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "dump-media" && c.Synchronized) ?? - new Command - { - Name = "dump-media", - Synchronized = true - }; + if(allStats.Commands?.DumpMedia > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "dump-media" && c.Synchronized) ?? + new Command + { + Name = "dump-media", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.DumpMedia; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.DumpMedia; + ctx.Commands.Update(command); + } - if(allStats.Commands.Entropy > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "entropy" && c.Synchronized) ?? - new Command - { - Name = "entropy", - Synchronized = true - }; + if(allStats.Commands?.Entropy > 0) + { + Command command = ctx.Commands.FirstOrDefault(c => c.Name == "entropy" && c.Synchronized) ?? + new Command + { + Name = "entropy", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.Entropy; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.Entropy; + ctx.Commands.Update(command); + } - if(allStats.Commands.ExtractFiles > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "extract-files" && c.Synchronized) ?? - new Command - { - Name = "extract-files", - Synchronized = true - }; + if(allStats.Commands?.ExtractFiles > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "extract-files" && c.Synchronized) ?? + new Command + { + Name = "extract-files", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.ExtractFiles; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.ExtractFiles; + ctx.Commands.Update(command); + } - if(allStats.Commands.Formats > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "formats" && c.Synchronized) ?? - new Command - { - Name = "formats", - Synchronized = true - }; + if(allStats.Commands?.Formats > 0) + { + Command command = ctx.Commands.FirstOrDefault(c => c.Name == "formats" && c.Synchronized) ?? + new Command + { + Name = "formats", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.Formats; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.Formats; + ctx.Commands.Update(command); + } - if(allStats.Commands.ImageInfo > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "image-info" && c.Synchronized) ?? - new Command - { - Name = "image-info", - Synchronized = true - }; + if(allStats.Commands?.ImageInfo > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "image-info" && c.Synchronized) ?? + new Command + { + Name = "image-info", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.ImageInfo; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.ImageInfo; + ctx.Commands.Update(command); + } - if(allStats.Commands.ListDevices > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "list-devices" && c.Synchronized) ?? - new Command - { - Name = "list-devices", - Synchronized = true - }; + if(allStats.Commands?.ListDevices > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "list-devices" && c.Synchronized) ?? + new Command + { + Name = "list-devices", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.ListDevices; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.ListDevices; + ctx.Commands.Update(command); + } - if(allStats.Commands.ListEncodings > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "list-encodings" && c.Synchronized) ?? - new Command - { - Name = "list-encodings", - Synchronized = true - }; + if(allStats.Commands?.ListEncodings > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "list-encodings" && c.Synchronized) ?? + new Command + { + Name = "list-encodings", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.ListEncodings; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.ListEncodings; + ctx.Commands.Update(command); + } - if(allStats.Commands.Ls > 0) - { - Command command = ctx.Commands.FirstOrDefault(c => c.Name == "ls" && c.Synchronized) ?? - new Command - { - Name = "ls", - Synchronized = true - }; + if(allStats.Commands?.Ls > 0) + { + Command command = ctx.Commands.FirstOrDefault(c => c.Name == "ls" && c.Synchronized) ?? + new Command + { + Name = "ls", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.Ls; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.Ls; + ctx.Commands.Update(command); + } - if(allStats.Commands.MediaInfo > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "media-info" && c.Synchronized) ?? - new Command - { - Name = "media-info", - Synchronized = true - }; + if(allStats.Commands?.MediaInfo > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "media-info" && c.Synchronized) ?? + new Command + { + Name = "media-info", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.MediaInfo; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.MediaInfo; + ctx.Commands.Update(command); + } - if(allStats.Commands.MediaScan > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "media-scan" && c.Synchronized) ?? - new Command - { - Name = "media-scan", - Synchronized = true - }; + if(allStats.Commands?.MediaScan > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "media-scan" && c.Synchronized) ?? + new Command + { + Name = "media-scan", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.MediaScan; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.MediaScan; + ctx.Commands.Update(command); + } - if(allStats.Commands.PrintHex > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "printhex" && c.Synchronized) ?? - new Command - { - Name = "printhex", - Synchronized = true - }; + if(allStats.Commands?.PrintHex > 0) + { + Command command = + ctx.Commands.FirstOrDefault(c => c.Name == "printhex" && c.Synchronized) ?? new Command + { + Name = "printhex", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.PrintHex; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.PrintHex; + ctx.Commands.Update(command); + } - if(allStats.Commands.Verify > 0) - { - Command command = - ctx.Commands.FirstOrDefault(c => c.Name == "verify" && c.Synchronized) ?? - new Command - { - Name = "verify", - Synchronized = true - }; + if(allStats.Commands?.Verify > 0) + { + Command command = ctx.Commands.FirstOrDefault(c => c.Name == "verify" && c.Synchronized) ?? + new Command + { + Name = "verify", + Synchronized = true + }; - command.Count += (ulong)allStats.Commands.Verify; - ctx.Commands.Update(command); - } + command.Count += (ulong)allStats.Commands.Verify; + ctx.Commands.Update(command); } if(allStats.OperatingSystems != null) @@ -581,7 +570,7 @@ namespace Aaru.Core } /// Submits statistics to Aaru.Server - public static void SubmitStats() + static void SubmitStats() { var submitThread = new Thread(() => { @@ -589,10 +578,10 @@ namespace Aaru.Core try { - if(submitStatsLock) + if(_submitStatsLock) return; - submitStatsLock = true; + _submitStatsLock = true; if(ctx.Commands.Any(c => !c.Synchronized) || ctx.Filesystems.Any(c => !c.Synchronized) || @@ -1158,7 +1147,7 @@ namespace Aaru.Core catch { #if DEBUG - submitStatsLock = false; + _submitStatsLock = false; if(Debugger.IsAttached) throw; @@ -1227,13 +1216,13 @@ namespace Aaru.Core if(!Debugger.IsAttached) continue; - submitStatsLock = false; + _submitStatsLock = false; throw; #endif } - submitStatsLock = false; + _submitStatsLock = false; }); submitThread.Start(); diff --git a/Aaru.Database/Context.cs b/Aaru.Database/Context.cs index ea012d5db..b85eda3a9 100644 --- a/Aaru.Database/Context.cs +++ b/Aaru.Database/Context.cs @@ -71,29 +71,22 @@ namespace Aaru.Database { base.OnModelCreating(modelBuilder); - modelBuilder.Entity("Aaru.CommonTypes.Metadata.Ata", b => - { - b.HasOne("Aaru.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany(). - HasForeignKey("ReadCapabilitiesId").OnDelete(DeleteBehavior.SetNull); - }); + modelBuilder.Entity("Aaru.CommonTypes.Metadata.Ata", + b => b.HasOne("Aaru.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany(). + HasForeignKey("ReadCapabilitiesId").OnDelete(DeleteBehavior.SetNull)); - modelBuilder.Entity("Aaru.CommonTypes.Metadata.BlockDescriptor", b => - { - b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", null).WithMany("BlockDescriptors"). - HasForeignKey("ScsiModeId").OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Aaru.CommonTypes.Metadata.BlockDescriptor", + b => b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", null).WithMany("BlockDescriptors"). + HasForeignKey("ScsiModeId").OnDelete(DeleteBehavior.Cascade)); - modelBuilder.Entity("Aaru.CommonTypes.Metadata.DensityCode", b => - { - b.HasOne("Aaru.CommonTypes.Metadata.SscSupportedMedia", null).WithMany("DensityCodes"). - HasForeignKey("SscSupportedMediaId").OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Aaru.CommonTypes.Metadata.DensityCode", + b => b.HasOne("Aaru.CommonTypes.Metadata.SscSupportedMedia", null). + WithMany("DensityCodes").HasForeignKey("SscSupportedMediaId"). + OnDelete(DeleteBehavior.Cascade)); - modelBuilder.Entity("Aaru.CommonTypes.Metadata.Mmc", b => - { - b.HasOne("Aaru.CommonTypes.Metadata.MmcFeatures", "Features").WithMany().HasForeignKey("FeaturesId"). - OnDelete(DeleteBehavior.SetNull); - }); + modelBuilder.Entity("Aaru.CommonTypes.Metadata.Mmc", + b => b.HasOne("Aaru.CommonTypes.Metadata.MmcFeatures", "Features").WithMany(). + HasForeignKey("FeaturesId").OnDelete(DeleteBehavior.SetNull)); modelBuilder.Entity("Aaru.CommonTypes.Metadata.Scsi", b => { @@ -155,11 +148,9 @@ namespace Aaru.Database OnDelete(DeleteBehavior.SetNull); }); - modelBuilder.Entity("Aaru.CommonTypes.Metadata.TestedSequentialMedia", b => - { - b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null).WithMany("TestedMedia").HasForeignKey("SscId"). - OnDelete(DeleteBehavior.SetNull); - }); + modelBuilder.Entity("Aaru.CommonTypes.Metadata.TestedSequentialMedia", + b => b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null).WithMany("TestedMedia"). + HasForeignKey("SscId").OnDelete(DeleteBehavior.SetNull)); modelBuilder.Entity("Aaru.Database.Models.Device", b => { diff --git a/Aaru.Database/Migrations/20181126222301_DeviceReportV2.cs b/Aaru.Database/Migrations/20181126222301_DeviceReportV2.cs index 00fb8da04..d9e962f87 100644 --- a/Aaru.Database/Migrations/20181126222301_DeviceReportV2.cs +++ b/Aaru.Database/Migrations/20181126222301_DeviceReportV2.cs @@ -13,10 +13,7 @@ namespace Aaru.Database.Migrations Cylinders = table.Column(), Heads = table.Column(), Sectors = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_Chs", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_Chs", x => x.Id)); migrationBuilder.CreateTable("FireWire", table => new { @@ -26,10 +23,7 @@ namespace Aaru.Database.Migrations Manufacturer = table.Column(nullable: true), Product = table.Column(nullable: true), RemovableMedia = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_FireWire", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_FireWire", x => x.Id)); migrationBuilder.CreateTable("MmcFeatures", table => new { @@ -157,10 +151,7 @@ namespace Aaru.Database.Migrations SupportsWriteInhibitDCB = table.Column(), SupportsWriteProtectPAC = table.Column(), VolumeLevels = table.Column(nullable: true) - }, constraints: table => - { - table.PrimaryKey("PK_MmcFeatures", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_MmcFeatures", x => x.Id)); migrationBuilder.CreateTable("MmcSd", table => new { @@ -170,10 +161,7 @@ namespace Aaru.Database.Migrations OCR = table.Column(nullable: true), SCR = table.Column(nullable: true), ExtendedCSD = table.Column(nullable: true) - }, constraints: table => - { - table.PrimaryKey("PK_MmcSd", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_MmcSd", x => x.Id)); migrationBuilder.CreateTable("ModePage_2A", table => new { @@ -230,10 +218,7 @@ namespace Aaru.Database.Migrations RotationControlSelected = table.Column(), CurrentWriteSpeedSelected = table.Column(), Id = table.Column().Annotation("Sqlite:Autoincrement", true) - }, constraints: table => - { - table.PrimaryKey("PK_ModePage_2A", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_ModePage_2A", x => x.Id)); migrationBuilder.CreateTable("Pcmcia", table => new { @@ -244,10 +229,7 @@ namespace Aaru.Database.Migrations CardCode = table.Column(nullable: true), Manufacturer = table.Column(nullable: true), ProductName = table.Column(nullable: true) - }, constraints: table => - { - table.PrimaryKey("PK_Pcmcia", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_Pcmcia", x => x.Id)); migrationBuilder.CreateTable("ScsiMode", table => new { @@ -258,10 +240,7 @@ namespace Aaru.Database.Migrations BufferedMode = table.Column(nullable: true), BlankCheckEnabled = table.Column(), DPOandFUA = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_ScsiMode", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_ScsiMode", x => x.Id)); migrationBuilder.CreateTable("Ssc", table => new { @@ -269,10 +248,7 @@ namespace Aaru.Database.Migrations BlockSizeGranularity = table.Column(nullable: true), MaxBlockLength = table.Column(nullable: true), MinBlockLength = table.Column(nullable: true) - }, constraints: table => - { - table.PrimaryKey("PK_Ssc", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_Ssc", x => x.Id)); migrationBuilder.CreateTable("Usb", table => new { @@ -283,10 +259,7 @@ namespace Aaru.Database.Migrations Product = table.Column(nullable: true), RemovableMedia = table.Column(), Descriptors = table.Column(nullable: true) - }, constraints: table => - { - table.PrimaryKey("PK_Usb", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_Usb", x => x.Id)); migrationBuilder.CreateTable("Mmc", table => new { diff --git a/Aaru.Database/Migrations/20181221015906_NameValueStatistics.cs b/Aaru.Database/Migrations/20181221015906_NameValueStatistics.cs index 0ce337c81..9d9dcc6ca 100644 --- a/Aaru.Database/Migrations/20181221015906_NameValueStatistics.cs +++ b/Aaru.Database/Migrations/20181221015906_NameValueStatistics.cs @@ -11,50 +11,35 @@ namespace Aaru.Database.Migrations Id = table.Column().Annotation("Sqlite:Autoincrement", true), Name = table.Column(nullable: true), Synchronized = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_Commands", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_Commands", x => x.Id)); migrationBuilder.CreateTable("Filesystems", table => new { Id = table.Column().Annotation("Sqlite:Autoincrement", true), Name = table.Column(nullable: true), Synchronized = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_Filesystems", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_Filesystems", x => x.Id)); migrationBuilder.CreateTable("Filters", table => new { Id = table.Column().Annotation("Sqlite:Autoincrement", true), Name = table.Column(nullable: true), Synchronized = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_Filters", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_Filters", x => x.Id)); migrationBuilder.CreateTable("MediaFormats", table => new { Id = table.Column().Annotation("Sqlite:Autoincrement", true), Name = table.Column(nullable: true), Synchronized = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_MediaFormats", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_MediaFormats", x => x.Id)); migrationBuilder.CreateTable("Partitions", table => new { Id = table.Column().Annotation("Sqlite:Autoincrement", true), Name = table.Column(nullable: true), Synchronized = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_Partitions", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_Partitions", x => x.Id)); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/Aaru.Database/Migrations/20181221032605_MediaStatistics.cs b/Aaru.Database/Migrations/20181221032605_MediaStatistics.cs index 20b3384b8..b8f738b25 100644 --- a/Aaru.Database/Migrations/20181221032605_MediaStatistics.cs +++ b/Aaru.Database/Migrations/20181221032605_MediaStatistics.cs @@ -31,14 +31,11 @@ namespace Aaru.Database.Migrations () }, constraints - : table => - { - table. - PrimaryKey("PK_Medias", - x => - x. - Id); - }); + : table => table. + PrimaryKey("PK_Medias", + x => + x. + Id)); protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("Medias"); } diff --git a/Aaru.Database/Migrations/20181221034941_SeenDevicesStatistics.cs b/Aaru.Database/Migrations/20181221034941_SeenDevicesStatistics.cs index 8658da6f0..62ae25b39 100644 --- a/Aaru.Database/Migrations/20181221034941_SeenDevicesStatistics.cs +++ b/Aaru.Database/Migrations/20181221034941_SeenDevicesStatistics.cs @@ -41,14 +41,11 @@ namespace Aaru.Database.Migrations () }, constraints: - table => - { - table. - PrimaryKey("PK_SeenDevices", - x => - x. - Id); - }); + table => table. + PrimaryKey("PK_SeenDevices", + x => + x. + Id)); protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("SeenDevices"); } diff --git a/Aaru.Database/Migrations/20181221040408_OperatingSystemStatistics.cs b/Aaru.Database/Migrations/20181221040408_OperatingSystemStatistics.cs index 2252f3045..91cbc9aef 100644 --- a/Aaru.Database/Migrations/20181221040408_OperatingSystemStatistics.cs +++ b/Aaru.Database/Migrations/20181221040408_OperatingSystemStatistics.cs @@ -11,10 +11,7 @@ namespace Aaru.Database.Migrations Name = table.Column(nullable: true), Version = table.Column(nullable: true), Synchronized = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_OperatingSystems", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_OperatingSystems", x => x.Id)); protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("OperatingSystems"); diff --git a/Aaru.Database/Migrations/20181221041242_VersionStatistics.cs b/Aaru.Database/Migrations/20181221041242_VersionStatistics.cs index 9612ff7cf..a3e72450e 100644 --- a/Aaru.Database/Migrations/20181221041242_VersionStatistics.cs +++ b/Aaru.Database/Migrations/20181221041242_VersionStatistics.cs @@ -24,14 +24,11 @@ namespace Aaru.Database.Migrations () }, constraints: - table => - { - table. - PrimaryKey("PK_Versions", - x => - x. - Id); - }); + table => table. + PrimaryKey("PK_Versions", + x => + x. + Id)); protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("Versions"); } diff --git a/Aaru.Database/Migrations/20181223214411_UseBinaryDataForIdentifyInquiryAndModesInReports.cs b/Aaru.Database/Migrations/20181223214411_UseBinaryDataForIdentifyInquiryAndModesInReports.cs index 1a6ef5187..3c4643270 100644 --- a/Aaru.Database/Migrations/20181223214411_UseBinaryDataForIdentifyInquiryAndModesInReports.cs +++ b/Aaru.Database/Migrations/20181223214411_UseBinaryDataForIdentifyInquiryAndModesInReports.cs @@ -70,10 +70,7 @@ namespace Aaru.Database.Migrations WriteCDRW = table.Column(), WriteDVDR = table.Column(), WriteDVDRAM = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_ModePage_2A", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_ModePage_2A", x => x.Id)); } } } \ No newline at end of file diff --git a/Aaru.Database/Migrations/20181224044809_StoreUsbIdsInDatabase.cs b/Aaru.Database/Migrations/20181224044809_StoreUsbIdsInDatabase.cs index 7045caee5..046fbad52 100644 --- a/Aaru.Database/Migrations/20181224044809_StoreUsbIdsInDatabase.cs +++ b/Aaru.Database/Migrations/20181224044809_StoreUsbIdsInDatabase.cs @@ -13,10 +13,7 @@ namespace Aaru.Database.Migrations Vendor = table.Column(nullable: true), AddedWhen = table.Column(), ModifiedWhen = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_UsbVendors", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_UsbVendors", x => x.Id)); migrationBuilder.CreateTable("UsbProducts", table => new { diff --git a/Aaru.Database/Migrations/20181225002740_AddCdOffsets.cs b/Aaru.Database/Migrations/20181225002740_AddCdOffsets.cs index 610d69c68..a710e92d9 100644 --- a/Aaru.Database/Migrations/20181225002740_AddCdOffsets.cs +++ b/Aaru.Database/Migrations/20181225002740_AddCdOffsets.cs @@ -51,14 +51,11 @@ namespace Aaru.Database.Migrations () }, constraints: - table => - { - table. - PrimaryKey("PK_CdOffsets", - x => - x. - Id); - }); + table => table. + PrimaryKey("PK_CdOffsets", + x => + x. + Id)); protected override void Down(MigrationBuilder migrationBuilder) => migrationBuilder.DropTable("CdOffsets"); } diff --git a/Aaru.Database/Migrations/20191207184342_AddRemoteStats.cs b/Aaru.Database/Migrations/20191207184342_AddRemoteStats.cs index ba48a7c2c..f2f03ab35 100644 --- a/Aaru.Database/Migrations/20191207184342_AddRemoteStats.cs +++ b/Aaru.Database/Migrations/20191207184342_AddRemoteStats.cs @@ -13,10 +13,7 @@ namespace Aaru.Database.Migrations Version = table.Column(nullable: true), Synchronized = table.Column(), Count = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_RemoteApplications", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_RemoteApplications", x => x.Id)); migrationBuilder.CreateTable("RemoteArchitectures", table => new { @@ -24,10 +21,7 @@ namespace Aaru.Database.Migrations Name = table.Column(nullable: true), Synchronized = table.Column(), Count = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_RemoteArchitectures", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_RemoteArchitectures", x => x.Id)); migrationBuilder.CreateTable("RemoteOperatingSystems", table => new { @@ -36,10 +30,7 @@ namespace Aaru.Database.Migrations Version = table.Column(nullable: true), Synchronized = table.Column(), Count = table.Column() - }, constraints: table => - { - table.PrimaryKey("PK_RemoteOperatingSystems", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_RemoteOperatingSystems", x => x.Id)); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/Aaru.Database/Migrations/20200710170129_AddGdRomSwapDiscCapabilities.cs b/Aaru.Database/Migrations/20200710170129_AddGdRomSwapDiscCapabilities.cs index 21a9463b3..5d47ae53c 100644 --- a/Aaru.Database/Migrations/20200710170129_AddGdRomSwapDiscCapabilities.cs +++ b/Aaru.Database/Migrations/20200710170129_AddGdRomSwapDiscCapabilities.cs @@ -120,10 +120,7 @@ namespace Aaru.Database.Migrations MaximumReadableSectorInHdArea = table.Column(nullable: false), MaximumReadablePqInHdArea = table.Column(nullable: true), MaximumReadableRwInHdArea = table.Column(nullable: true) - }, constraints: table => - { - table.PrimaryKey("PK_GdRomSwapDiscCapabilities", x => x.Id); - }); + }, constraints: table => table.PrimaryKey("PK_GdRomSwapDiscCapabilities", x => x.Id)); migrationBuilder.CreateIndex("IX_Reports_GdRomSwapDiscCapabilitiesId", "Reports", "GdRomSwapDiscCapabilitiesId"); diff --git a/Aaru.Database/Migrations/AaruContextModelSnapshot.cs b/Aaru.Database/Migrations/AaruContextModelSnapshot.cs index 5a30357d5..26c8257b5 100644 --- a/Aaru.Database/Migrations/AaruContextModelSnapshot.cs +++ b/Aaru.Database/Migrations/AaruContextModelSnapshot.cs @@ -1760,29 +1760,17 @@ namespace Aaru.Database.Migrations b.ToTable("Versions"); }); - modelBuilder.Entity("Aaru.CommonTypes.Metadata.Ata", b => - { - b.HasOne("Aaru.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany(). - HasForeignKey("ReadCapabilitiesId").OnDelete(DeleteBehavior.SetNull); - }); + modelBuilder.Entity("Aaru.CommonTypes.Metadata.Ata", b => b.HasOne("Aaru.CommonTypes.Metadata.TestedMedia", "ReadCapabilities").WithMany(). + HasForeignKey("ReadCapabilitiesId").OnDelete(DeleteBehavior.SetNull)); - modelBuilder.Entity("Aaru.CommonTypes.Metadata.BlockDescriptor", b => - { - b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", null).WithMany("BlockDescriptors"). - HasForeignKey("ScsiModeId").OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Aaru.CommonTypes.Metadata.BlockDescriptor", b => b.HasOne("Aaru.CommonTypes.Metadata.ScsiMode", null).WithMany("BlockDescriptors"). + HasForeignKey("ScsiModeId").OnDelete(DeleteBehavior.Cascade)); - modelBuilder.Entity("Aaru.CommonTypes.Metadata.DensityCode", b => - { - b.HasOne("Aaru.CommonTypes.Metadata.SscSupportedMedia", null).WithMany("DensityCodes"). - HasForeignKey("SscSupportedMediaId").OnDelete(DeleteBehavior.Cascade); - }); + modelBuilder.Entity("Aaru.CommonTypes.Metadata.DensityCode", b => b.HasOne("Aaru.CommonTypes.Metadata.SscSupportedMedia", null).WithMany("DensityCodes"). + HasForeignKey("SscSupportedMediaId").OnDelete(DeleteBehavior.Cascade)); - modelBuilder.Entity("Aaru.CommonTypes.Metadata.Mmc", b => - { - b.HasOne("Aaru.CommonTypes.Metadata.MmcFeatures", "Features").WithMany().HasForeignKey("FeaturesId"). - OnDelete(DeleteBehavior.SetNull); - }); + modelBuilder.Entity("Aaru.CommonTypes.Metadata.Mmc", b => b.HasOne("Aaru.CommonTypes.Metadata.MmcFeatures", "Features").WithMany().HasForeignKey("FeaturesId"). + OnDelete(DeleteBehavior.SetNull)); modelBuilder.Entity("Aaru.CommonTypes.Metadata.Scsi", b => { @@ -1844,11 +1832,8 @@ namespace Aaru.Database.Migrations OnDelete(DeleteBehavior.SetNull); }); - modelBuilder.Entity("Aaru.CommonTypes.Metadata.TestedSequentialMedia", b => - { - b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null).WithMany("TestedMedia").HasForeignKey("SscId"). - OnDelete(DeleteBehavior.SetNull); - }); + modelBuilder.Entity("Aaru.CommonTypes.Metadata.TestedSequentialMedia", b => b.HasOne("Aaru.CommonTypes.Metadata.Ssc", null).WithMany("TestedMedia").HasForeignKey("SscId"). + OnDelete(DeleteBehavior.SetNull)); modelBuilder.Entity("Aaru.Database.Models.Device", b => { @@ -1910,11 +1895,8 @@ namespace Aaru.Database.Migrations OnDelete(DeleteBehavior.SetNull); }); - modelBuilder.Entity("Aaru.Database.Models.UsbProduct", b => - { - b.HasOne("Aaru.Database.Models.UsbVendor", "Vendor").WithMany("Products").HasForeignKey("VendorId"). - OnDelete(DeleteBehavior.Cascade).IsRequired(); - }); + modelBuilder.Entity("Aaru.Database.Models.UsbProduct", b => b.HasOne("Aaru.Database.Models.UsbVendor", "Vendor").WithMany("Products").HasForeignKey("VendorId"). + OnDelete(DeleteBehavior.Cascade).IsRequired()); #pragma warning restore 612, 618 } } diff --git a/Aaru.Database/Models/BaseModel.cs b/Aaru.Database/Models/BaseModel.cs index 526576a75..e67d2f6fa 100644 --- a/Aaru.Database/Models/BaseModel.cs +++ b/Aaru.Database/Models/BaseModel.cs @@ -34,7 +34,7 @@ using System.ComponentModel.DataAnnotations; namespace Aaru.Database.Models { - public abstract class BaseModel + public abstract class BaseModel { [Key] public int Id { get; set; } diff --git a/Aaru.Database/Models/BaseOperatingSystem.cs b/Aaru.Database/Models/BaseOperatingSystem.cs index 666b19c54..5c610843c 100644 --- a/Aaru.Database/Models/BaseOperatingSystem.cs +++ b/Aaru.Database/Models/BaseOperatingSystem.cs @@ -32,7 +32,7 @@ namespace Aaru.Database.Models { - public abstract class BaseOperatingSystem : BaseModel + public abstract class BaseOperatingSystem : BaseModel { public string Name { get; set; } public string Version { get; set; } diff --git a/Aaru.Database/Models/Command.cs b/Aaru.Database/Models/Command.cs index 0522f16f3..5cea904de 100644 --- a/Aaru.Database/Models/Command.cs +++ b/Aaru.Database/Models/Command.cs @@ -32,5 +32,5 @@ namespace Aaru.Database.Models { - public class Command : NameCountModel {} + public class Command : NameCountModel {} } \ No newline at end of file diff --git a/Aaru.Database/Models/DeviceStat.cs b/Aaru.Database/Models/DeviceStat.cs index b66ca9305..ed8d1b192 100644 --- a/Aaru.Database/Models/DeviceStat.cs +++ b/Aaru.Database/Models/DeviceStat.cs @@ -32,7 +32,7 @@ namespace Aaru.Database.Models { - public class DeviceStat : BaseModel + public class DeviceStat : BaseModel { public string Manufacturer { get; set; } public string Model { get; set; } diff --git a/Aaru.Database/Models/Filesystem.cs b/Aaru.Database/Models/Filesystem.cs index 45e05b046..a6f69f6bf 100644 --- a/Aaru.Database/Models/Filesystem.cs +++ b/Aaru.Database/Models/Filesystem.cs @@ -32,5 +32,5 @@ namespace Aaru.Database.Models { - public class Filesystem : NameCountModel {} + public class Filesystem : NameCountModel {} } \ No newline at end of file diff --git a/Aaru.Database/Models/Filter.cs b/Aaru.Database/Models/Filter.cs index 20b8e56bf..4bb3e3c9a 100644 --- a/Aaru.Database/Models/Filter.cs +++ b/Aaru.Database/Models/Filter.cs @@ -32,5 +32,5 @@ namespace Aaru.Database.Models { - public class Filter : NameCountModel {} + public class Filter : NameCountModel {} } \ No newline at end of file diff --git a/Aaru.Database/Models/Media.cs b/Aaru.Database/Models/Media.cs index fca2ba15f..9533ac891 100644 --- a/Aaru.Database/Models/Media.cs +++ b/Aaru.Database/Models/Media.cs @@ -32,7 +32,7 @@ namespace Aaru.Database.Models { - public class Media : BaseModel + public class Media : BaseModel { public string Type { get; set; } public bool Real { get; set; } diff --git a/Aaru.Database/Models/MediaFormat.cs b/Aaru.Database/Models/MediaFormat.cs index d85f0f970..76b256e4a 100644 --- a/Aaru.Database/Models/MediaFormat.cs +++ b/Aaru.Database/Models/MediaFormat.cs @@ -32,5 +32,5 @@ namespace Aaru.Database.Models { - public class MediaFormat : NameCountModel {} + public class MediaFormat : NameCountModel {} } \ No newline at end of file diff --git a/Aaru.Database/Models/NameCountModel.cs b/Aaru.Database/Models/NameCountModel.cs index 2d61efb66..af4c949ff 100644 --- a/Aaru.Database/Models/NameCountModel.cs +++ b/Aaru.Database/Models/NameCountModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Database.Models { - public abstract class NameCountModel : BaseModel + public abstract class NameCountModel : BaseModel { public string Name { get; set; } public bool Synchronized { get; set; } diff --git a/Aaru.Database/Models/Partition.cs b/Aaru.Database/Models/Partition.cs index a1076b913..36dd611c9 100644 --- a/Aaru.Database/Models/Partition.cs +++ b/Aaru.Database/Models/Partition.cs @@ -32,5 +32,5 @@ namespace Aaru.Database.Models { - public class Partition : NameCountModel {} + public class Partition : NameCountModel {} } \ No newline at end of file diff --git a/Aaru.Database/Models/RemoteArchitecture.cs b/Aaru.Database/Models/RemoteArchitecture.cs index 88ffb12aa..78fe041b8 100644 --- a/Aaru.Database/Models/RemoteArchitecture.cs +++ b/Aaru.Database/Models/RemoteArchitecture.cs @@ -32,5 +32,5 @@ namespace Aaru.Database.Models { - public class RemoteArchitecture : NameCountModel {} + public class RemoteArchitecture : NameCountModel {} } \ No newline at end of file diff --git a/Aaru.Database/Models/Version.cs b/Aaru.Database/Models/Version.cs index a26fedeac..29e1efe54 100644 --- a/Aaru.Database/Models/Version.cs +++ b/Aaru.Database/Models/Version.cs @@ -32,5 +32,5 @@ namespace Aaru.Database.Models { - public class Version : NameCountModel {} + public class Version : NameCountModel {} } \ No newline at end of file diff --git a/Aaru.Decoders b/Aaru.Decoders index 4cbfe9b0c..b52d62376 160000 --- a/Aaru.Decoders +++ b/Aaru.Decoders @@ -1 +1 @@ -Subproject commit 4cbfe9b0cd684c8526be28e8d8a21a2f3b2f4961 +Subproject commit b52d623764d463e4e0dd4142bc0b4bc51203e194 diff --git a/Aaru.Devices/Device/AtaCommands/Ata28.cs b/Aaru.Devices/Device/AtaCommands/Ata28.cs index f0a444b6d..ad65f3d8e 100644 --- a/Aaru.Devices/Device/AtaCommands/Ata28.cs +++ b/Aaru.Devices/Device/AtaCommands/Ata28.cs @@ -35,7 +35,7 @@ using Aaru.Decoders.ATA; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { public bool ReadBuffer(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration) diff --git a/Aaru.Devices/Device/AtaCommands/Ata48.cs b/Aaru.Devices/Device/AtaCommands/Ata48.cs index 65a177582..912efaa85 100644 --- a/Aaru.Devices/Device/AtaCommands/Ata48.cs +++ b/Aaru.Devices/Device/AtaCommands/Ata48.cs @@ -35,7 +35,7 @@ using Aaru.Decoders.ATA; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { public bool GetNativeMaxAddressExt(out ulong lba, out AtaErrorRegistersLba48 statusRegisters, uint timeout, out double duration) diff --git a/Aaru.Devices/Device/AtaCommands/AtaCHS.cs b/Aaru.Devices/Device/AtaCommands/AtaCHS.cs index 87d6ce638..49f906bc2 100644 --- a/Aaru.Devices/Device/AtaCommands/AtaCHS.cs +++ b/Aaru.Devices/Device/AtaCommands/AtaCHS.cs @@ -35,7 +35,7 @@ using Aaru.Decoders.ATA; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Sends the ATA IDENTIFY DEVICE command to the device, using default device timeout /// true if the command failed and contains the error registers. diff --git a/Aaru.Devices/Device/AtaCommands/Atapi.cs b/Aaru.Devices/Device/AtaCommands/Atapi.cs index 354ef861b..8c8fe140a 100644 --- a/Aaru.Devices/Device/AtaCommands/Atapi.cs +++ b/Aaru.Devices/Device/AtaCommands/Atapi.cs @@ -35,7 +35,7 @@ using Aaru.Decoders.ATA; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Sends the ATA IDENTIFY PACKET DEVICE command to the device, using default device timeout /// true if the command failed and contains the error registers. diff --git a/Aaru.Devices/Device/AtaCommands/Cfa.cs b/Aaru.Devices/Device/AtaCommands/Cfa.cs index 6ab2041ed..e030a313a 100644 --- a/Aaru.Devices/Device/AtaCommands/Cfa.cs +++ b/Aaru.Devices/Device/AtaCommands/Cfa.cs @@ -35,7 +35,7 @@ using Aaru.Decoders.ATA; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { public bool TranslateSector(out byte[] buffer, out AtaErrorRegistersLba28 statusRegisters, uint lba, uint timeout, out double duration) diff --git a/Aaru.Devices/Device/AtaCommands/MCPT.cs b/Aaru.Devices/Device/AtaCommands/MCPT.cs index 1eb2ef36b..5fdc4a7ed 100644 --- a/Aaru.Devices/Device/AtaCommands/MCPT.cs +++ b/Aaru.Devices/Device/AtaCommands/MCPT.cs @@ -35,7 +35,7 @@ using Aaru.Decoders.ATA; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { public bool EnableMediaCardPassThrough(out AtaErrorRegistersChs statusRegisters, uint timeout, out double duration) => diff --git a/Aaru.Devices/Device/AtaCommands/Smart.cs b/Aaru.Devices/Device/AtaCommands/Smart.cs index c625dd0b5..c1ba6c8b3 100644 --- a/Aaru.Devices/Device/AtaCommands/Smart.cs +++ b/Aaru.Devices/Device/AtaCommands/Smart.cs @@ -35,7 +35,7 @@ using Aaru.Decoders.ATA; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { public bool SmartDisable(out AtaErrorRegistersLba28 statusRegisters, uint timeout, out double duration) { diff --git a/Aaru.Devices/Device/Commands.cs b/Aaru.Devices/Device/Commands.cs index 721a51612..56d02a28e 100644 --- a/Aaru.Devices/Device/Commands.cs +++ b/Aaru.Devices/Device/Commands.cs @@ -37,7 +37,7 @@ using Aaru.Decoders.ATA; namespace Aaru.Devices { [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] - public partial class Device + public sealed partial class Device { /// Sends a SCSI command to this device /// 0 if no error occurred, otherwise, errno diff --git a/Aaru.Devices/Device/Constructor.cs b/Aaru.Devices/Device/Constructor.cs index 91fc87ad9..6444c9502 100644 --- a/Aaru.Devices/Device/Constructor.cs +++ b/Aaru.Devices/Device/Constructor.cs @@ -31,6 +31,7 @@ // ****************************************************************************/ using System; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; @@ -58,7 +59,9 @@ using VendorString = Aaru.Decoders.SecureDigital.VendorString; namespace Aaru.Devices { - public partial class Device + [SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "UnusedMember.Global"), + SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")] + public sealed partial class Device { /// Opens the device for sending direct commands /// Device path @@ -69,13 +72,11 @@ namespace Aaru.Devices Error = false; IsRemovable = false; - if(devicePath.StartsWith("dic://") || - devicePath.StartsWith("aaru://")) + if(devicePath.StartsWith("dic://", StringComparison.OrdinalIgnoreCase) || + devicePath.StartsWith("aaru://", StringComparison.OrdinalIgnoreCase)) { - if(devicePath.StartsWith("dic://")) - devicePath = devicePath.Substring(6); - else - devicePath = devicePath.Substring(7); + devicePath = + devicePath.Substring(devicePath.StartsWith("dic://", StringComparison.OrdinalIgnoreCase) ? 6 : 7); string[] pieces = devicePath.Split('/'); string host = pieces[0]; diff --git a/Aaru.Devices/Device/Destructor.cs b/Aaru.Devices/Device/Destructor.cs index 7e34f3818..2a331f67e 100644 --- a/Aaru.Devices/Device/Destructor.cs +++ b/Aaru.Devices/Device/Destructor.cs @@ -37,7 +37,7 @@ using PlatformID = Aaru.CommonTypes.Interop.PlatformID; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// /// Releases unmanaged resources and performs other cleanup operations before the is diff --git a/Aaru.Devices/Device/DeviceException.cs b/Aaru.Devices/Device/DeviceException.cs index 1e5886ee1..fcbee76f5 100644 --- a/Aaru.Devices/Device/DeviceException.cs +++ b/Aaru.Devices/Device/DeviceException.cs @@ -35,7 +35,7 @@ using System; namespace Aaru.Devices { /// Exception to be returned by the device constructor - public class DeviceException : Exception + public sealed class DeviceException : Exception { internal DeviceException(string message) : base(message) {} diff --git a/Aaru.Devices/Device/List.cs b/Aaru.Devices/Device/List.cs index 37af650b8..1d16ca6a4 100644 --- a/Aaru.Devices/Device/List.cs +++ b/Aaru.Devices/Device/List.cs @@ -63,7 +63,7 @@ namespace Aaru.Devices public readonly byte[] Padding; } - public partial class Device + public sealed partial class Device { public static DeviceInfo[] ListDevices() => ListDevices(out _, out _, out _, out _, out _, out _); @@ -92,20 +92,19 @@ namespace Aaru.Devices try { - if(aaruRemote.ToLowerInvariant().StartsWith("aaru://")) + if(aaruRemote.ToLowerInvariant().StartsWith("aaru://", StringComparison.OrdinalIgnoreCase)) aaruRemote = aaruRemote.Substring(7); - using(var remote = new Remote.Remote(aaruRemote)) - { - isRemote = true; - serverApplication = remote.ServerApplication; - serverVersion = remote.ServerVersion; - serverOperatingSystem = remote.ServerOperatingSystem; - serverOperatingSystemVersion = remote.ServerOperatingSystemVersion; - serverArchitecture = remote.ServerArchitecture; + using var remote = new Remote.Remote(aaruRemote); - return remote.ListDevices(); - } + isRemote = true; + serverApplication = remote.ServerApplication; + serverVersion = remote.ServerVersion; + serverOperatingSystem = remote.ServerOperatingSystem; + serverOperatingSystemVersion = remote.ServerOperatingSystemVersion; + serverArchitecture = remote.ServerArchitecture; + + return remote.ListDevices(); } catch(Exception) { diff --git a/Aaru.Devices/Device/MmcCommands/MMC.cs b/Aaru.Devices/Device/MmcCommands/MMC.cs index 3d63188cc..329f6e535 100644 --- a/Aaru.Devices/Device/MmcCommands/MMC.cs +++ b/Aaru.Devices/Device/MmcCommands/MMC.cs @@ -34,7 +34,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { public bool ReadCsd(out byte[] buffer, out uint[] response, uint timeout, out double duration) { diff --git a/Aaru.Devices/Device/MmcCommands/SecureDigital.cs b/Aaru.Devices/Device/MmcCommands/SecureDigital.cs index f4f94f17a..6ca8f3812 100644 --- a/Aaru.Devices/Device/MmcCommands/SecureDigital.cs +++ b/Aaru.Devices/Device/MmcCommands/SecureDigital.cs @@ -34,7 +34,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { public bool ReadSdStatus(out byte[] buffer, out uint[] response, uint timeout, out double duration) { diff --git a/Aaru.Devices/Device/ScsiCommands/Adaptec.cs b/Aaru.Devices/Device/ScsiCommands/Adaptec.cs index 28ce7e7fa..cd288d572 100644 --- a/Aaru.Devices/Device/ScsiCommands/Adaptec.cs +++ b/Aaru.Devices/Device/ScsiCommands/Adaptec.cs @@ -36,7 +36,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Gets the underlying drive cylinder, head and index bytes for the specified SCSI LBA. /// Buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs b/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs index 129e9586c..02711f964 100644 --- a/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs +++ b/Aaru.Devices/Device/ScsiCommands/ArchiveCorp.cs @@ -34,7 +34,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Gets the underlying drive cylinder, head and index bytes for the specified SCSI LBA. /// Buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/Certance.cs b/Aaru.Devices/Device/ScsiCommands/Certance.cs index b78f474b8..48df6bea6 100644 --- a/Aaru.Devices/Device/ScsiCommands/Certance.cs +++ b/Aaru.Devices/Device/ScsiCommands/Certance.cs @@ -36,7 +36,7 @@ using Aaru.Console; namespace Aaru.Devices { [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] - public partial class Device + public sealed partial class Device { /// Parks the load arm in preparation for transport /// Sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/Fujitsu.cs b/Aaru.Devices/Device/ScsiCommands/Fujitsu.cs index 6b5016c7a..b2b52e3ac 100644 --- a/Aaru.Devices/Device/ScsiCommands/Fujitsu.cs +++ b/Aaru.Devices/Device/ScsiCommands/Fujitsu.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { public bool FujitsuDisplay(out byte[] senseBuffer, bool flash, FujitsuDisplayModes mode, string firstHalf, string secondHalf, uint timeout, out double duration) diff --git a/Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs b/Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs index 2986b75dc..2c73ea215 100644 --- a/Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs +++ b/Aaru.Devices/Device/ScsiCommands/HL-DT-ST.cs @@ -34,7 +34,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Reads a "raw" sector from DVD on HL-DT-ST drives. /// true if the command failed and contains the sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/HP.cs b/Aaru.Devices/Device/ScsiCommands/HP.cs index 0be8c3f57..ae6fb1654 100644 --- a/Aaru.Devices/Device/ScsiCommands/HP.cs +++ b/Aaru.Devices/Device/ScsiCommands/HP.cs @@ -34,7 +34,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Sends the HP READ LONG vendor command /// true if the command failed and contains the sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/Kreon.cs b/Aaru.Devices/Device/ScsiCommands/Kreon.cs index c6cf31e5c..0d1a20dba 100644 --- a/Aaru.Devices/Device/ScsiCommands/Kreon.cs +++ b/Aaru.Devices/Device/ScsiCommands/Kreon.cs @@ -35,7 +35,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Sets the drive to the xtreme unlocked state /// true if the command failed and contains the sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/MMC.cs b/Aaru.Devices/Device/ScsiCommands/MMC.cs index d325e050d..f701dce0c 100644 --- a/Aaru.Devices/Device/ScsiCommands/MMC.cs +++ b/Aaru.Devices/Device/ScsiCommands/MMC.cs @@ -36,7 +36,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Sends the MMC GET CONFIGURATION command for all Features /// true if the command failed and contains the sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/MediaTek.cs b/Aaru.Devices/Device/ScsiCommands/MediaTek.cs index 8e24fa151..86f2bfb6b 100644 --- a/Aaru.Devices/Device/ScsiCommands/MediaTek.cs +++ b/Aaru.Devices/Device/ScsiCommands/MediaTek.cs @@ -34,7 +34,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Reads from the drive's cache. /// true if the command failed and contains the sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs b/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs index c5f70672d..5373c34af 100644 --- a/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs +++ b/Aaru.Devices/Device/ScsiCommands/MiniDisc.cs @@ -34,7 +34,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { public bool MiniDiscReadDataTOC(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { diff --git a/Aaru.Devices/Device/ScsiCommands/NEC.cs b/Aaru.Devices/Device/ScsiCommands/NEC.cs index 175a6ba6a..f50a2d3f8 100644 --- a/Aaru.Devices/Device/ScsiCommands/NEC.cs +++ b/Aaru.Devices/Device/ScsiCommands/NEC.cs @@ -34,7 +34,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Sends the NEC READ CD-DA command /// true if the command failed and contains the sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/Optical.cs b/Aaru.Devices/Device/ScsiCommands/Optical.cs index f32dfdb18..d476d5459 100644 --- a/Aaru.Devices/Device/ScsiCommands/Optical.cs +++ b/Aaru.Devices/Device/ScsiCommands/Optical.cs @@ -35,7 +35,7 @@ using Aaru.Decoders.SCSI; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Scan the medium for a contiguous set of written or blank logical blocks /// Sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/Pioneer.cs b/Aaru.Devices/Device/ScsiCommands/Pioneer.cs index b40011c1a..a3f1ff8bb 100644 --- a/Aaru.Devices/Device/ScsiCommands/Pioneer.cs +++ b/Aaru.Devices/Device/ScsiCommands/Pioneer.cs @@ -34,7 +34,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Sends the Pioneer READ CD-DA command /// true if the command failed and contains the sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/Plasmon.cs b/Aaru.Devices/Device/ScsiCommands/Plasmon.cs index 1573b841b..8a7d40853 100644 --- a/Aaru.Devices/Device/ScsiCommands/Plasmon.cs +++ b/Aaru.Devices/Device/ScsiCommands/Plasmon.cs @@ -34,7 +34,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Sends the Plasmon READ LONG vendor command /// true if the command failed and contains the sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/Plextor.cs b/Aaru.Devices/Device/ScsiCommands/Plextor.cs index 71230cd0e..bbd96c3af 100644 --- a/Aaru.Devices/Device/ScsiCommands/Plextor.cs +++ b/Aaru.Devices/Device/ScsiCommands/Plextor.cs @@ -35,7 +35,7 @@ using Aaru.Helpers; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Sends the Plextor READ CD-DA command /// true if the command failed and contains the sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/SBC.cs b/Aaru.Devices/Device/ScsiCommands/SBC.cs index 22062b036..046dfdf45 100644 --- a/Aaru.Devices/Device/ScsiCommands/SBC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SBC.cs @@ -35,7 +35,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Sends the SBC READ (6) command /// true if the command failed and contains the sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/SMC.cs b/Aaru.Devices/Device/ScsiCommands/SMC.cs index cb7d46e29..7bd7f3b24 100644 --- a/Aaru.Devices/Device/ScsiCommands/SMC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SMC.cs @@ -34,7 +34,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Reads an attribute from the medium auxiliary memory, or reports which elements in the changer contain one /// Buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/SPC.cs b/Aaru.Devices/Device/ScsiCommands/SPC.cs index a60cf96fb..c477edba9 100644 --- a/Aaru.Devices/Device/ScsiCommands/SPC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SPC.cs @@ -38,7 +38,7 @@ using PlatformID = Aaru.CommonTypes.Interop.PlatformID; namespace Aaru.Devices { [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] - public partial class Device + public sealed partial class Device { /// Sends the SPC INQUIRY command to the device using default device timeout. /// true if the command failed and contains the sense buffer. diff --git a/Aaru.Devices/Device/ScsiCommands/SSC.cs b/Aaru.Devices/Device/ScsiCommands/SSC.cs index 217bd36f3..8937fad99 100644 --- a/Aaru.Devices/Device/ScsiCommands/SSC.cs +++ b/Aaru.Devices/Device/ScsiCommands/SSC.cs @@ -35,7 +35,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Prepares the medium for reading /// true, if load was successful, false otherwise. diff --git a/Aaru.Devices/Device/ScsiCommands/SyQuest.cs b/Aaru.Devices/Device/ScsiCommands/SyQuest.cs index fd5fdd4c9..a04d35996 100644 --- a/Aaru.Devices/Device/ScsiCommands/SyQuest.cs +++ b/Aaru.Devices/Device/ScsiCommands/SyQuest.cs @@ -34,7 +34,7 @@ using Aaru.Console; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { /// Sends the SyQuest READ (6) command /// true if the command failed and contains the sense buffer. diff --git a/Aaru.Devices/Device/Variables.cs b/Aaru.Devices/Device/Variables.cs index c1e3082bf..81311c8f0 100644 --- a/Aaru.Devices/Device/Variables.cs +++ b/Aaru.Devices/Device/Variables.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Structs.Devices.SCSI; namespace Aaru.Devices { - public partial class Device + public sealed partial class Device { readonly ushort _usbVendor; readonly ushort _usbProduct; @@ -169,8 +169,7 @@ namespace Aaru.Devices { get { - if(_isRemoteAdmin is null) - _isRemoteAdmin = _remote.IsRoot; + _isRemoteAdmin ??= _remote.IsRoot; return _isRemoteAdmin == true; } diff --git a/Aaru.Devices/Windows/ListDevices.cs b/Aaru.Devices/Windows/ListDevices.cs index bc8a56d32..cf37d6a3e 100644 --- a/Aaru.Devices/Windows/ListDevices.cs +++ b/Aaru.Devices/Windows/ListDevices.cs @@ -182,12 +182,11 @@ namespace Aaru.Devices.Windows info.Serial = HexStringToString(info.Serial).Trim(); } - if((string.IsNullOrEmpty(info.Vendor) || info.Vendor == "ATA") && - info.Model != null) + if(string.IsNullOrEmpty(info.Vendor) || info.Vendor == "ATA") { - string[] pieces = info.Model.Split(' '); + string[] pieces = info.Model?.Split(' '); - if(pieces.Length > 1) + if(pieces?.Length > 1) { info.Vendor = pieces[0]; info.Model = info.Model.Substring(pieces[0].Length + 1); diff --git a/Aaru.Devices/Windows/Usb.cs b/Aaru.Devices/Windows/Usb.cs index 3d51a90ad..05e399ca9 100644 --- a/Aaru.Devices/Windows/Usb.cs +++ b/Aaru.Devices/Windows/Usb.cs @@ -246,7 +246,7 @@ namespace Aaru.Devices.Windows } /// Represents a USB Host Controller - class UsbController + sealed class UsbController { internal string ControllerDriverKeyName, ControllerDevicePath, ControllerDeviceDesc; internal int ControllerIndex; diff --git a/Aaru.Filesystems/AODOS.cs b/Aaru.Filesystems/AODOS.cs index 76e33425c..9c7674e81 100644 --- a/Aaru.Filesystems/AODOS.cs +++ b/Aaru.Filesystems/AODOS.cs @@ -44,7 +44,7 @@ namespace Aaru.Filesystems { // Information has been extracted looking at available disk images // This may be missing fields, or not, I don't know russian so any help is appreciated - public class AODOS : IFilesystem + public sealed class AODOS : IFilesystem { readonly byte[] _identifier = { diff --git a/Aaru.Filesystems/APFS.cs b/Aaru.Filesystems/APFS.cs index 5afd96954..1bee676a8 100644 --- a/Aaru.Filesystems/APFS.cs +++ b/Aaru.Filesystems/APFS.cs @@ -42,7 +42,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class APFS : IFilesystem + public sealed class APFS : IFilesystem { const uint APFS_CONTAINER_MAGIC = 0x4253584E; // "NXSB" const uint APFS_VOLUME_MAGIC = 0x42535041; // "APSB" diff --git a/Aaru.Filesystems/Acorn.cs b/Aaru.Filesystems/Acorn.cs index 3ae55ba14..0c7ab5c35 100644 --- a/Aaru.Filesystems/Acorn.cs +++ b/Aaru.Filesystems/Acorn.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class AcornADFS : IFilesystem + public sealed class AcornADFS : IFilesystem { /// Location for boot block, in bytes const ulong BOOT_BLOCK_LOCATION = 0xC00; diff --git a/Aaru.Filesystems/AmigaDOS.cs b/Aaru.Filesystems/AmigaDOS.cs index 677330130..f80acaf46 100644 --- a/Aaru.Filesystems/AmigaDOS.cs +++ b/Aaru.Filesystems/AmigaDOS.cs @@ -44,7 +44,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class AmigaDOSPlugin : IFilesystem + public sealed class AmigaDOSPlugin : IFilesystem { const uint FFS_MASK = 0x444F5300; const uint MUFS_MASK = 0x6D754600; diff --git a/Aaru.Filesystems/AppleDOS/AppleDOS.cs b/Aaru.Filesystems/AppleDOS/AppleDOS.cs index 88013fa94..00c378e6a 100644 --- a/Aaru.Filesystems/AppleDOS/AppleDOS.cs +++ b/Aaru.Filesystems/AppleDOS/AppleDOS.cs @@ -38,7 +38,7 @@ using Schemas; namespace Aaru.Filesystems { - public partial class AppleDOS : IReadOnlyFilesystem + public sealed partial class AppleDOS : IReadOnlyFilesystem { bool _debug; IMediaImage _device; diff --git a/Aaru.Filesystems/AppleDOS/Dir.cs b/Aaru.Filesystems/AppleDOS/Dir.cs index 2bd41be58..ac768c44e 100644 --- a/Aaru.Filesystems/AppleDOS/Dir.cs +++ b/Aaru.Filesystems/AppleDOS/Dir.cs @@ -39,7 +39,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class AppleDOS + public sealed partial class AppleDOS { /// /// Solves a symbolic link. diff --git a/Aaru.Filesystems/AppleDOS/File.cs b/Aaru.Filesystems/AppleDOS/File.cs index b8c76de0d..74d54f2ac 100644 --- a/Aaru.Filesystems/AppleDOS/File.cs +++ b/Aaru.Filesystems/AppleDOS/File.cs @@ -40,7 +40,7 @@ using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; namespace Aaru.Filesystems { - public partial class AppleDOS + public sealed partial class AppleDOS { public Errno GetAttributes(string path, out FileAttributes attributes) { @@ -156,7 +156,7 @@ namespace Aaru.Filesystems stat = new FileEntryInfo(); - _fileSizeCache.TryGetValue(filename, out int filesize); + _fileSizeCache.TryGetValue(filename, out int fileSize); GetAttributes(path, out FileAttributes attrs); if(_debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || @@ -174,7 +174,7 @@ namespace Aaru.Filesystems } else { - stat.Length = filesize; + stat.Length = fileSize; stat.Blocks = stat.Length / _vtoc.bytesPerSector; } diff --git a/Aaru.Filesystems/AppleDOS/Info.cs b/Aaru.Filesystems/AppleDOS/Info.cs index fb22206da..1254ac4f2 100644 --- a/Aaru.Filesystems/AppleDOS/Info.cs +++ b/Aaru.Filesystems/AppleDOS/Info.cs @@ -40,7 +40,7 @@ using Encoding = System.Text.Encoding; namespace Aaru.Filesystems { - public partial class AppleDOS + public sealed partial class AppleDOS { public bool Identify(IMediaImage imagePlugin, Partition partition) { @@ -68,8 +68,7 @@ namespace Aaru.Filesystems information = ""; var sb = new StringBuilder(); - int spt; - spt = imagePlugin.Info.Sectors == 455 ? 13 : 16; + int spt = imagePlugin.Info.Sectors == 455 ? 13 : 16; byte[] vtocB = imagePlugin.ReadSector((ulong)(17 * spt)); _vtoc = Marshal.ByteArrayToStructureLittleEndian(vtocB); diff --git a/Aaru.Filesystems/AppleDOS/Structs.cs b/Aaru.Filesystems/AppleDOS/Structs.cs index 73851b591..b7cb9595b 100644 --- a/Aaru.Filesystems/AppleDOS/Structs.cs +++ b/Aaru.Filesystems/AppleDOS/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { - public partial class AppleDOS + public sealed partial class AppleDOS { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Vtoc diff --git a/Aaru.Filesystems/AppleDOS/Super.cs b/Aaru.Filesystems/AppleDOS/Super.cs index 28b48be12..2fa8359c0 100644 --- a/Aaru.Filesystems/AppleDOS/Super.cs +++ b/Aaru.Filesystems/AppleDOS/Super.cs @@ -42,7 +42,7 @@ using Encoding = System.Text.Encoding; namespace Aaru.Filesystems { - public partial class AppleDOS + public sealed partial class AppleDOS { /// /// Mounts an Apple DOS filesystem @@ -117,8 +117,7 @@ namespace Aaru.Filesystems XmlFsType.FreeClusters = XmlFsType.Clusters - _usedSectors; - if(options == null) - options = GetDefaultOptions(); + options ??= GetDefaultOptions(); if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out _debug); @@ -129,7 +128,7 @@ namespace Aaru.Filesystems } /// - /// Umounts this DOS filesystem + /// Unmounts this DOS filesystem public Errno Unmount() { _mounted = false; diff --git a/Aaru.Filesystems/AppleDOS/Xattr.cs b/Aaru.Filesystems/AppleDOS/Xattr.cs index 333af5c40..c6f59461a 100644 --- a/Aaru.Filesystems/AppleDOS/Xattr.cs +++ b/Aaru.Filesystems/AppleDOS/Xattr.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.Filesystems { - public partial class AppleDOS + public sealed partial class AppleDOS { /// /// Lists all extended attributes, alternate data streams and forks of the given file. diff --git a/Aaru.Filesystems/AppleHFS/AppleHFS.cs b/Aaru.Filesystems/AppleHFS/AppleHFS.cs index 5da4ff6ae..15f3ea3b5 100644 --- a/Aaru.Filesystems/AppleHFS/AppleHFS.cs +++ b/Aaru.Filesystems/AppleHFS/AppleHFS.cs @@ -40,7 +40,7 @@ namespace Aaru.Filesystems { // Information from Inside Macintosh // https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf - public partial class AppleHFS : IFilesystem + public sealed partial class AppleHFS : IFilesystem { public FileSystemType XmlFsType { get; private set; } public Encoding Encoding { get; private set; } diff --git a/Aaru.Filesystems/AppleHFS/Consts.cs b/Aaru.Filesystems/AppleHFS/Consts.cs index a68c2a057..939c9d81d 100644 --- a/Aaru.Filesystems/AppleHFS/Consts.cs +++ b/Aaru.Filesystems/AppleHFS/Consts.cs @@ -39,7 +39,7 @@ namespace Aaru.Filesystems // Information from Inside Macintosh // https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class AppleHFS + public sealed partial class AppleHFS { /// Parent ID of the root directory. const uint kRootParentCnid = 1; diff --git a/Aaru.Filesystems/AppleHFS/Enums.cs b/Aaru.Filesystems/AppleHFS/Enums.cs index 6fd32edc9..c8760ee9c 100644 --- a/Aaru.Filesystems/AppleHFS/Enums.cs +++ b/Aaru.Filesystems/AppleHFS/Enums.cs @@ -32,11 +32,12 @@ // ReSharper disable InconsistentNaming +// ReSharper disable UnusedMember.Local namespace Aaru.Filesystems { - public partial class AppleHFS + public sealed partial class AppleHFS { - internal enum NodeType : sbyte + enum NodeType : sbyte { /// Index node ndIndxNode = 0, @@ -48,7 +49,7 @@ namespace Aaru.Filesystems ndLeafNode = -1 } - internal enum CatDataType : sbyte + enum CatDataType : sbyte { /// Directory record cdrDirRec = 1, @@ -60,7 +61,7 @@ namespace Aaru.Filesystems cdrFThdRec = 4 } - internal enum ForkType : sbyte + enum ForkType : sbyte { Data = 0, Resource = -1 } diff --git a/Aaru.Filesystems/AppleHFS/Info.cs b/Aaru.Filesystems/AppleHFS/Info.cs index 980ffff15..486e23d1e 100644 --- a/Aaru.Filesystems/AppleHFS/Info.cs +++ b/Aaru.Filesystems/AppleHFS/Info.cs @@ -41,7 +41,7 @@ namespace Aaru.Filesystems { // Information from Inside Macintosh // https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf - public partial class AppleHFS + public sealed partial class AppleHFS { public bool Identify(IMediaImage imagePlugin, Partition partition) { diff --git a/Aaru.Filesystems/AppleHFS/Structs.cs b/Aaru.Filesystems/AppleHFS/Structs.cs index fbd678b58..aacd1bbbf 100644 --- a/Aaru.Filesystems/AppleHFS/Structs.cs +++ b/Aaru.Filesystems/AppleHFS/Structs.cs @@ -41,7 +41,7 @@ namespace Aaru.Filesystems { // Information from Inside Macintosh // https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf - public partial class AppleHFS + public sealed partial class AppleHFS { /// Master Directory Block, should be sector 2 in volume [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Filesystems/AppleHFSPlus.cs b/Aaru.Filesystems/AppleHFSPlus.cs index 70f1697da..ad4b0be75 100644 --- a/Aaru.Filesystems/AppleHFSPlus.cs +++ b/Aaru.Filesystems/AppleHFSPlus.cs @@ -42,7 +42,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { // Information from Apple TechNote 1150: https://developer.apple.com/legacy/library/technotes/tn/tn1150.html - public class AppleHFSPlus : IFilesystem + public sealed class AppleHFSPlus : IFilesystem { public FileSystemType XmlFsType { get; private set; } public Encoding Encoding { get; private set; } diff --git a/Aaru.Filesystems/AppleMFS/AppleMFS.cs b/Aaru.Filesystems/AppleMFS/AppleMFS.cs index 76d4ae83c..c908b9f25 100644 --- a/Aaru.Filesystems/AppleMFS/AppleMFS.cs +++ b/Aaru.Filesystems/AppleMFS/AppleMFS.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.Filesystems { // Information from Inside Macintosh Volume II - public partial class AppleMFS : IReadOnlyFilesystem + public sealed partial class AppleMFS : IReadOnlyFilesystem { bool _mounted; bool _debug; diff --git a/Aaru.Filesystems/AppleMFS/Consts.cs b/Aaru.Filesystems/AppleMFS/Consts.cs index 907ab7051..cc1a7bd5f 100644 --- a/Aaru.Filesystems/AppleMFS/Consts.cs +++ b/Aaru.Filesystems/AppleMFS/Consts.cs @@ -36,7 +36,7 @@ namespace Aaru.Filesystems { // Information from Inside Macintosh Volume II [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class AppleMFS + public sealed partial class AppleMFS { const ushort MFS_MAGIC = 0xD2D7; diff --git a/Aaru.Filesystems/AppleMFS/Dir.cs b/Aaru.Filesystems/AppleMFS/Dir.cs index 09140cd5b..6f5e153cd 100644 --- a/Aaru.Filesystems/AppleMFS/Dir.cs +++ b/Aaru.Filesystems/AppleMFS/Dir.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { // Information from Inside Macintosh Volume II - public partial class AppleMFS + public sealed partial class AppleMFS { public Errno ReadDir(string path, out List contents) { diff --git a/Aaru.Filesystems/AppleMFS/File.cs b/Aaru.Filesystems/AppleMFS/File.cs index 84a0d59af..2d467c075 100644 --- a/Aaru.Filesystems/AppleMFS/File.cs +++ b/Aaru.Filesystems/AppleMFS/File.cs @@ -41,7 +41,7 @@ using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; namespace Aaru.Filesystems { // Information from Inside Macintosh Volume II - public partial class AppleMFS + public sealed partial class AppleMFS { public Errno MapBlock(string path, long fileBlock, out long deviceBlock) { diff --git a/Aaru.Filesystems/AppleMFS/Info.cs b/Aaru.Filesystems/AppleMFS/Info.cs index bc885d85e..3879f54ac 100644 --- a/Aaru.Filesystems/AppleMFS/Info.cs +++ b/Aaru.Filesystems/AppleMFS/Info.cs @@ -42,7 +42,7 @@ using Encoding = System.Text.Encoding; namespace Aaru.Filesystems { // Information from Inside Macintosh Volume II - public partial class AppleMFS + public sealed partial class AppleMFS { public bool Identify(IMediaImage imagePlugin, Partition partition) { diff --git a/Aaru.Filesystems/AppleMFS/Structs.cs b/Aaru.Filesystems/AppleMFS/Structs.cs index ccf52a25e..11d42c88a 100644 --- a/Aaru.Filesystems/AppleMFS/Structs.cs +++ b/Aaru.Filesystems/AppleMFS/Structs.cs @@ -39,7 +39,7 @@ namespace Aaru.Filesystems { // Information from Inside Macintosh Volume II [SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "NotAccessedField.Local")] - public partial class AppleMFS + public sealed partial class AppleMFS { /// Master Directory Block, should be at offset 0x0400 bytes in volume struct MasterDirectoryBlock diff --git a/Aaru.Filesystems/AppleMFS/Super.cs b/Aaru.Filesystems/AppleMFS/Super.cs index 7b38ea27f..9928573e0 100644 --- a/Aaru.Filesystems/AppleMFS/Super.cs +++ b/Aaru.Filesystems/AppleMFS/Super.cs @@ -43,7 +43,7 @@ using Schemas; namespace Aaru.Filesystems { // Information from Inside Macintosh Volume II - public partial class AppleMFS + public sealed partial class AppleMFS { const int BYTES_BEFORE_BLOCK_MAP = 64; @@ -54,8 +54,7 @@ namespace Aaru.Filesystems _partitionStart = partition.Start; Encoding = encoding ?? Encoding.GetEncoding("macintosh"); - if(options == null) - options = GetDefaultOptions(); + options ??= GetDefaultOptions(); if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out _debug); diff --git a/Aaru.Filesystems/AppleMFS/Xattr.cs b/Aaru.Filesystems/AppleMFS/Xattr.cs index c55b998b6..bdb00b9e5 100644 --- a/Aaru.Filesystems/AppleMFS/Xattr.cs +++ b/Aaru.Filesystems/AppleMFS/Xattr.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { // Information from Inside Macintosh Volume II - public partial class AppleMFS + public sealed partial class AppleMFS { public Errno ListXAttr(string path, out List xattrs) { diff --git a/Aaru.Filesystems/AtheOS.cs b/Aaru.Filesystems/AtheOS.cs index ed4c3777b..4e22bdbbf 100644 --- a/Aaru.Filesystems/AtheOS.cs +++ b/Aaru.Filesystems/AtheOS.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class AtheOS : IFilesystem + public sealed class AtheOS : IFilesystem { // Little endian constants (that is, as read by .NET :p) const uint AFS_MAGIC1 = 0x41465331; diff --git a/Aaru.Filesystems/BFS.cs b/Aaru.Filesystems/BFS.cs index f73b497e4..31fb92fee 100644 --- a/Aaru.Filesystems/BFS.cs +++ b/Aaru.Filesystems/BFS.cs @@ -44,7 +44,7 @@ namespace Aaru.Filesystems { // Information from Practical Filesystem Design, ISBN 1-55860-497-9 [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class BeFS : IFilesystem + public sealed class BeFS : IFilesystem { // Little endian constants (that is, as read by .NET :p) const uint BEFS_MAGIC1 = 0x42465331; @@ -144,10 +144,8 @@ namespace Aaru.Filesystems return; } - if(littleEndian) - besb = Marshal.ByteArrayToStructureLittleEndian(sbSector); - else - besb = Marshal.ByteArrayToStructureBigEndian(sbSector); + besb = littleEndian ? Marshal.ByteArrayToStructureLittleEndian(sbSector) + : Marshal.ByteArrayToStructureBigEndian(sbSector); sb.AppendLine(littleEndian ? "Little-endian BeFS" : "Big-endian BeFS"); diff --git a/Aaru.Filesystems/BTRFS.cs b/Aaru.Filesystems/BTRFS.cs index 9ff6a00db..be34bbfaa 100644 --- a/Aaru.Filesystems/BTRFS.cs +++ b/Aaru.Filesystems/BTRFS.cs @@ -41,7 +41,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class BTRFS : IFilesystem + public sealed class BTRFS : IFilesystem { /// BTRFS magic "_BHRfS_M" const ulong BTRFS_MAGIC = 0x4D5F53665248425F; diff --git a/Aaru.Filesystems/CBM.cs b/Aaru.Filesystems/CBM.cs index 9081a9764..ee2d1adcd 100644 --- a/Aaru.Filesystems/CBM.cs +++ b/Aaru.Filesystems/CBM.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class CBM : IFilesystem + public sealed class CBM : IFilesystem { public FileSystemType XmlFsType { get; private set; } public string Name => "Commodore file system"; diff --git a/Aaru.Filesystems/CPM/CPM.cs b/Aaru.Filesystems/CPM/CPM.cs index 9fb59226b..82a008663 100644 --- a/Aaru.Filesystems/CPM/CPM.cs +++ b/Aaru.Filesystems/CPM/CPM.cs @@ -39,13 +39,14 @@ using Schemas; namespace Aaru.Filesystems { - internal partial class CPM : IReadOnlyFilesystem + public sealed partial class CPM : IReadOnlyFilesystem { /// True if thinks this is a CP/M filesystem bool _cpmFound; /// Cached FileSystemInfo _cpmStat; + bool _debug; /// Cached file passwords, decoded Dictionary _decodedPasswordCache; diff --git a/Aaru.Filesystems/CPM/Consts.cs b/Aaru.Filesystems/CPM/Consts.cs index f8a60b893..c570ae6da 100644 --- a/Aaru.Filesystems/CPM/Consts.cs +++ b/Aaru.Filesystems/CPM/Consts.cs @@ -34,7 +34,7 @@ namespace Aaru.Filesystems { - internal partial class CPM + public sealed partial class CPM { /// Enumerates the format identification byte used by CP/M-86 enum FormatByte : byte diff --git a/Aaru.Filesystems/CPM/Definitions.cs b/Aaru.Filesystems/CPM/Definitions.cs index 72a41fc12..8dcfbce7f 100644 --- a/Aaru.Filesystems/CPM/Definitions.cs +++ b/Aaru.Filesystems/CPM/Definitions.cs @@ -38,7 +38,7 @@ using System.Xml.Serialization; namespace Aaru.Filesystems { - internal partial class CPM + public sealed partial class CPM { /// Loads all the known CP/M disk definitions from an XML stored as an embedded resource. /// The definitions. @@ -95,7 +95,7 @@ namespace Aaru.Filesystems } /// CP/M disk definitions - public class CpmDefinitions + public sealed class CpmDefinitions { /// Timestamp of creation of the CP/M disk definitions list public DateTime creation; @@ -104,7 +104,7 @@ namespace Aaru.Filesystems } /// CP/M disk definition - public class CpmDefinition + public sealed class CpmDefinition { /// Maps the first 16 allocation blocks for reservation, high byte public int al0; @@ -158,7 +158,7 @@ namespace Aaru.Filesystems } /// Side descriptions - public class Side + public sealed class Side { /// Software interleaving mask, [1,3,0,2] means CP/M LBA 0 is physical sector 1, LBA 1 = 3, so on public int[] sectorIds; diff --git a/Aaru.Filesystems/CPM/Dir.cs b/Aaru.Filesystems/CPM/Dir.cs index 0b8949707..1f5e87f8e 100644 --- a/Aaru.Filesystems/CPM/Dir.cs +++ b/Aaru.Filesystems/CPM/Dir.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - internal partial class CPM + public sealed partial class CPM { public Errno ReadDir(string path, out List contents) { @@ -58,8 +58,8 @@ namespace Aaru.Filesystems /// /// Checks that the given directory blocks follow the CP/M filesystem directory specification Corrupted - /// directories will fail. FAT firectories will false positive if all files start with 0x05, and do not use full - /// extentions, for example: "σAFILE.GZ" (using code page 437) + /// directories will fail. FAT directories will false positive if all files start with 0x05, and do not use full + /// extensions, for example: "σAFILE.GZ" (using code page 437) /// /// False if the directory does not follow the directory specification /// Directory blocks. diff --git a/Aaru.Filesystems/CPM/File.cs b/Aaru.Filesystems/CPM/File.cs index 763fd0426..301e4a75e 100644 --- a/Aaru.Filesystems/CPM/File.cs +++ b/Aaru.Filesystems/CPM/File.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - internal partial class CPM + public sealed partial class CPM { public Errno GetAttributes(string path, out FileAttributes attributes) { diff --git a/Aaru.Filesystems/CPM/Info.cs b/Aaru.Filesystems/CPM/Info.cs index 42c0de303..0aa918624 100644 --- a/Aaru.Filesystems/CPM/Info.cs +++ b/Aaru.Filesystems/CPM/Info.cs @@ -42,7 +42,7 @@ using Schemas; namespace Aaru.Filesystems { - internal partial class CPM + public sealed partial class CPM { public bool Identify(IMediaImage imagePlugin, Partition partition) { diff --git a/Aaru.Filesystems/CPM/Structs.cs b/Aaru.Filesystems/CPM/Structs.cs index 9e22f6302..90eeb88e4 100644 --- a/Aaru.Filesystems/CPM/Structs.cs +++ b/Aaru.Filesystems/CPM/Structs.cs @@ -36,7 +36,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { - internal partial class CPM + public sealed partial class CPM { /// Most of the times this structure is hard wired or generated by CP/M, not stored on disk class DiscParameterBlock diff --git a/Aaru.Filesystems/CPM/Super.cs b/Aaru.Filesystems/CPM/Super.cs index f5c3bd6c4..5c8466890 100644 --- a/Aaru.Filesystems/CPM/Super.cs +++ b/Aaru.Filesystems/CPM/Super.cs @@ -48,7 +48,7 @@ using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo; namespace Aaru.Filesystems { - internal partial class CPM + public sealed partial class CPM { public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, Dictionary options, string @namespace) @@ -56,6 +56,11 @@ namespace Aaru.Filesystems _device = imagePlugin; Encoding = encoding ?? Encoding.GetEncoding("IBM437"); + options ??= GetDefaultOptions(); + + if(options.TryGetValue("debug", out string debugString)) + bool.TryParse(debugString, out _debug); + // As the identification is so complex, just call Identify() and relay on its findings if(!Identify(_device, partition) || !_cpmFound || diff --git a/Aaru.Filesystems/CPM/Xattr.cs b/Aaru.Filesystems/CPM/Xattr.cs index f2e8d3907..31956ddda 100644 --- a/Aaru.Filesystems/CPM/Xattr.cs +++ b/Aaru.Filesystems/CPM/Xattr.cs @@ -36,13 +36,13 @@ using Aaru.CommonTypes.Structs; namespace Aaru.Filesystems { - internal partial class CPM + public sealed partial class CPM { /// /// Reads an extended attribute, alternate data stream or fork from the given file. /// Error number. /// File path. - /// Extendad attribute, alternate data stream or fork name. + /// Extended attribute, alternate data stream or fork name. /// Buffer. public Errno GetXattr(string path, string xattr, ref byte[] buf) { diff --git a/Aaru.Filesystems/Cram.cs b/Aaru.Filesystems/Cram.cs index 2547746a3..8836c1c8d 100644 --- a/Aaru.Filesystems/Cram.cs +++ b/Aaru.Filesystems/Cram.cs @@ -45,7 +45,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedType.Local")] - public class Cram : IFilesystem + public sealed class Cram : IFilesystem { /// Identifier for Cram const uint CRAM_MAGIC = 0x28CD3D45; diff --git a/Aaru.Filesystems/ECMA67.cs b/Aaru.Filesystems/ECMA67.cs index 9e2242314..71216579c 100644 --- a/Aaru.Filesystems/ECMA67.cs +++ b/Aaru.Filesystems/ECMA67.cs @@ -41,7 +41,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class ECMA67 : IFilesystem + public sealed class ECMA67 : IFilesystem { readonly byte[] _magic = { diff --git a/Aaru.Filesystems/EFS.cs b/Aaru.Filesystems/EFS.cs index 2c7093f49..d4de612f1 100644 --- a/Aaru.Filesystems/EFS.cs +++ b/Aaru.Filesystems/EFS.cs @@ -44,7 +44,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class EFS : IFilesystem + public sealed class EFS : IFilesystem { const uint EFS_MAGIC = 0x00072959; const uint EFS_MAGIC_NEW = 0x0007295A; diff --git a/Aaru.Filesystems/F2FS.cs b/Aaru.Filesystems/F2FS.cs index 4044f7c94..c7affedc6 100644 --- a/Aaru.Filesystems/F2FS.cs +++ b/Aaru.Filesystems/F2FS.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class F2FS : IFilesystem + public sealed class F2FS : IFilesystem { const uint F2FS_MAGIC = 0xF2F52010; const uint F2FS_SUPER_OFFSET = 1024; diff --git a/Aaru.Filesystems/FAT/BPB.cs b/Aaru.Filesystems/FAT/BPB.cs index 2c55683ff..5669170e0 100644 --- a/Aaru.Filesystems/FAT/BPB.cs +++ b/Aaru.Filesystems/FAT/BPB.cs @@ -42,7 +42,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class FAT + public sealed partial class FAT { static BpbKind DetectBpbKind(byte[] bpbSector, IMediaImage imagePlugin, Partition partition, out BiosParameterBlockEbpb fakeBpb, out HumanParameterBlock humanBpb, @@ -101,16 +101,14 @@ namespace Aaru.Filesystems return BpbKind.Human; } - var msxBpb = new MsxParameterBlock(); - var dos2Bpb = new BiosParameterBlock2(); - var dos30Bpb = new BiosParameterBlock30(); - var dos32Bpb = new BiosParameterBlock32(); - var dos33Bpb = new BiosParameterBlock33(); - var shortEbpb = new BiosParameterBlockShortEbpb(); - var ebpb = new BiosParameterBlockEbpb(); - var shortFat32Bpb = new Fat32ParameterBlockShort(); - var fat32Bpb = new Fat32ParameterBlock(); - var apricotBpb = new ApricotLabel(); + var msxBpb = new MsxParameterBlock(); + var dos2Bpb = new BiosParameterBlock2(); + var dos30Bpb = new BiosParameterBlock30(); + var dos32Bpb = new BiosParameterBlock32(); + var dos33Bpb = new BiosParameterBlock33(); + var shortEbpb = new BiosParameterBlockShortEbpb(); + var ebpb = new BiosParameterBlockEbpb(); + var apricotBpb = new ApricotLabel(); bool useAtariBpb = false; bool useMsxBpb = false; @@ -125,19 +123,21 @@ namespace Aaru.Filesystems bool useApricotBpb = false; bool useDecRainbowBpb = false; - if(imagePlugin.Info.SectorSize >= 256 && - !useHumanBpb) + if(imagePlugin.Info.SectorSize >= 256) { - msxBpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); - dos2Bpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); - dos30Bpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); - dos32Bpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); - dos33Bpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); - shortEbpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); - ebpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); - shortFat32Bpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); - fat32Bpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); - apricotBpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); + msxBpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); + dos2Bpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); + dos30Bpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); + dos32Bpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); + dos33Bpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); + shortEbpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); + ebpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); + + Fat32ParameterBlockShort shortFat32Bpb = + Marshal.ByteArrayToStructureLittleEndian(bpbSector); + + Fat32ParameterBlock fat32Bpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); + apricotBpb = Marshal.ByteArrayToStructureLittleEndian(bpbSector); int bitsInBpsMsx = CountBits.Count(msxBpb.bps); int bitsInBpsDos33 = CountBits.Count(dos33Bpb.bps); @@ -206,7 +206,6 @@ namespace Aaru.Filesystems Encoding.ASCII.GetString(fat32Bpb.fs_type) == "FAT32 ") { AaruConsole.DebugWriteLine("FAT plugin", "Using FAT32 BPB"); - useLongFat32 = true; minBootNearJump = 0x58; return BpbKind.LongFat32; @@ -221,10 +220,6 @@ namespace Aaru.Filesystems { AaruConsole.DebugWriteLine("FAT plugin", "Using short FAT32 BPB"); - useShortFat32 = shortFat32Bpb.big_sectors == 0 - ? shortFat32Bpb.huge_sectors <= (partition.End - partition.Start) + 1 - : shortFat32Bpb.big_sectors <= (partition.End - partition.Start) + 1; - minBootNearJump = 0x57; return BpbKind.ShortFat32; @@ -377,7 +372,6 @@ namespace Aaru.Filesystems !useDos33Bpb && !userShortExtendedBpb && !useExtendedBpb && - !useHumanBpb && !useShortFat32 && !useLongFat32 && !useApricotBpb) diff --git a/Aaru.Filesystems/FAT/Consts.cs b/Aaru.Filesystems/FAT/Consts.cs index b6c44371d..b3c696b30 100644 --- a/Aaru.Filesystems/FAT/Consts.cs +++ b/Aaru.Filesystems/FAT/Consts.cs @@ -36,7 +36,7 @@ using System; namespace Aaru.Filesystems { - public partial class FAT + public sealed partial class FAT { const uint FSINFO_SIGNATURE1 = 0x41615252; const uint FSINFO_SIGNATURE2 = 0x61417272; diff --git a/Aaru.Filesystems/FAT/Dir.cs b/Aaru.Filesystems/FAT/Dir.cs index 03b4f29fa..c69991e0c 100644 --- a/Aaru.Filesystems/FAT/Dir.cs +++ b/Aaru.Filesystems/FAT/Dir.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class FAT + public sealed partial class FAT { /// /// Solves a symbolic link. diff --git a/Aaru.Filesystems/FAT/FAT.cs b/Aaru.Filesystems/FAT/FAT.cs index 1fdc4cacd..9546c10a1 100644 --- a/Aaru.Filesystems/FAT/FAT.cs +++ b/Aaru.Filesystems/FAT/FAT.cs @@ -42,7 +42,7 @@ namespace Aaru.Filesystems { // TODO: Differentiate between Atari and X68k FAT, as this one uses a standard BPB. // X68K uses cdate/adate from direntry for extending filename - public partial class FAT : IReadOnlyFilesystem + public sealed partial class FAT : IReadOnlyFilesystem { uint _bytesPerCluster; byte[] _cachedEaData; diff --git a/Aaru.Filesystems/FAT/File.cs b/Aaru.Filesystems/FAT/File.cs index 01dd59bfe..94337226e 100644 --- a/Aaru.Filesystems/FAT/File.cs +++ b/Aaru.Filesystems/FAT/File.cs @@ -40,7 +40,7 @@ using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; namespace Aaru.Filesystems { - public partial class FAT + public sealed partial class FAT { public Errno MapBlock(string path, long fileBlock, out long deviceBlock) { @@ -258,7 +258,7 @@ namespace Aaru.Filesystems { entry = null; - string cutPath = path.StartsWith("/") ? path.Substring(1).ToLower(_cultureInfo) + string cutPath = path.StartsWith('/') ? path.Substring(1).ToLower(_cultureInfo) : path.ToLower(_cultureInfo); string[] pieces = cutPath.Split(new[] diff --git a/Aaru.Filesystems/FAT/Info.cs b/Aaru.Filesystems/FAT/Info.cs index ce9fecf8f..a98b130a7 100644 --- a/Aaru.Filesystems/FAT/Info.cs +++ b/Aaru.Filesystems/FAT/Info.cs @@ -31,6 +31,7 @@ // ****************************************************************************/ using System; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Text; @@ -44,8 +45,9 @@ using Schemas; namespace Aaru.Filesystems { - public partial class FAT + public sealed partial class FAT { + [SuppressMessage("ReSharper", "JoinDeclarationAndInitializer")] public bool Identify(IMediaImage imagePlugin, Partition partition) { if(2 + partition.Start >= partition.End) diff --git a/Aaru.Filesystems/FAT/Structs.cs b/Aaru.Filesystems/FAT/Structs.cs index d91f00255..ccbda41e1 100644 --- a/Aaru.Filesystems/FAT/Structs.cs +++ b/Aaru.Filesystems/FAT/Structs.cs @@ -38,7 +38,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class FAT + public sealed partial class FAT { const int UMSDOS_MAXNAME = 220; diff --git a/Aaru.Filesystems/FAT/Super.cs b/Aaru.Filesystems/FAT/Super.cs index 52e66052f..892e699c3 100644 --- a/Aaru.Filesystems/FAT/Super.cs +++ b/Aaru.Filesystems/FAT/Super.cs @@ -49,7 +49,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public partial class FAT + public sealed partial class FAT { uint _fatEntriesPerSector; IMediaImage _image; @@ -60,15 +60,13 @@ namespace Aaru.Filesystems { XmlFsType = new FileSystemType(); - if(options == null) - options = GetDefaultOptions(); + options ??= GetDefaultOptions(); if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out _debug); // Default namespace - if(@namespace is null) - @namespace = "ecs"; + @namespace ??= "ecs"; switch(@namespace.ToLowerInvariant()) { @@ -451,7 +449,7 @@ namespace Aaru.Filesystems _fatFirstSector = partition.Start + (_reservedSectors * sectorsPerRealSector); _rootDirectoryCache = new Dictionary(); - byte[] rootDirectory = null; + byte[] rootDirectory; if(!_fat32) { @@ -479,12 +477,9 @@ namespace Aaru.Filesystems var rootMs = new MemoryStream(); uint[] rootDirectoryClusters = GetClusters(rootDirectoryCluster); - foreach(uint cluster in rootDirectoryClusters) + foreach(var buffer in rootDirectoryClusters.Select(cluster => imagePlugin.ReadSectors(_firstClusterSector + (cluster * _sectorsPerCluster), + _sectorsPerCluster))) { - byte[] buffer = - imagePlugin.ReadSectors(_firstClusterSector + (cluster * _sectorsPerCluster), - _sectorsPerCluster); - rootMs.Write(buffer, 0, buffer.Length); } diff --git a/Aaru.Filesystems/FAT/Xattr.cs b/Aaru.Filesystems/FAT/Xattr.cs index a68e6eea3..f8b468b6c 100644 --- a/Aaru.Filesystems/FAT/Xattr.cs +++ b/Aaru.Filesystems/FAT/Xattr.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class FAT + public sealed partial class FAT { Dictionary> _eaCache; @@ -133,11 +133,8 @@ namespace Aaru.Filesystems var eaMs = new MemoryStream(); uint[] rootDirectoryClusters = GetClusters(entryFat32Ea.start_cluster); - foreach(uint cluster in rootDirectoryClusters) + foreach(var buffer in rootDirectoryClusters.Select(cluster => _image.ReadSectors(_firstClusterSector + (cluster * _sectorsPerCluster), _sectorsPerCluster))) { - byte[] buffer = - _image.ReadSectors(_firstClusterSector + (cluster * _sectorsPerCluster), _sectorsPerCluster); - eaMs.Write(buffer, 0, buffer.Length); } diff --git a/Aaru.Filesystems/FATX/Consts.cs b/Aaru.Filesystems/FATX/Consts.cs index 33fc3e527..1a39f74f4 100644 --- a/Aaru.Filesystems/FATX/Consts.cs +++ b/Aaru.Filesystems/FATX/Consts.cs @@ -36,7 +36,7 @@ using System; namespace Aaru.Filesystems { - public partial class XboxFatPlugin + public sealed partial class XboxFatPlugin { const uint FATX_MAGIC = 0x58544146; const uint FATX_CIGAM = 0x46415458; diff --git a/Aaru.Filesystems/FATX/Dir.cs b/Aaru.Filesystems/FATX/Dir.cs index 77a60e2ba..e80264f06 100644 --- a/Aaru.Filesystems/FATX/Dir.cs +++ b/Aaru.Filesystems/FATX/Dir.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class XboxFatPlugin + public sealed partial class XboxFatPlugin { public Errno ReadDir(string path, out List contents) { @@ -55,7 +55,7 @@ namespace Aaru.Filesystems return Errno.NoError; } - string cutPath = path.StartsWith("/") ? path.Substring(1).ToLower(_cultureInfo) + string cutPath = path.StartsWith('/') ? path.Substring(1).ToLower(_cultureInfo) : path.ToLower(_cultureInfo); if(_directoryCache.TryGetValue(cutPath, out Dictionary currentDirectory)) diff --git a/Aaru.Filesystems/FATX/FATX.cs b/Aaru.Filesystems/FATX/FATX.cs index 5ed24f398..3f69fac58 100644 --- a/Aaru.Filesystems/FATX/FATX.cs +++ b/Aaru.Filesystems/FATX/FATX.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.Filesystems { - public partial class XboxFatPlugin : IReadOnlyFilesystem + public sealed partial class XboxFatPlugin : IReadOnlyFilesystem { uint _bytesPerCluster; CultureInfo _cultureInfo; diff --git a/Aaru.Filesystems/FATX/File.cs b/Aaru.Filesystems/FATX/File.cs index 9c15e7aca..b0fc8b6e9 100644 --- a/Aaru.Filesystems/FATX/File.cs +++ b/Aaru.Filesystems/FATX/File.cs @@ -40,7 +40,7 @@ using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; namespace Aaru.Filesystems { - public partial class XboxFatPlugin + public sealed partial class XboxFatPlugin { public Errno MapBlock(string path, long fileBlock, out long deviceBlock) { @@ -247,7 +247,7 @@ namespace Aaru.Filesystems { entry = new DirectoryEntry(); - string cutPath = path.StartsWith("/") ? path.Substring(1).ToLower(_cultureInfo) + string cutPath = path.StartsWith('/') ? path.Substring(1).ToLower(_cultureInfo) : path.ToLower(_cultureInfo); string[] pieces = cutPath.Split(new[] diff --git a/Aaru.Filesystems/FATX/Info.cs b/Aaru.Filesystems/FATX/Info.cs index 66dfae139..e62316136 100644 --- a/Aaru.Filesystems/FATX/Info.cs +++ b/Aaru.Filesystems/FATX/Info.cs @@ -38,7 +38,7 @@ using Schemas; namespace Aaru.Filesystems { - public partial class XboxFatPlugin + public sealed partial class XboxFatPlugin { public bool Identify(IMediaImage imagePlugin, Partition partition) { diff --git a/Aaru.Filesystems/FATX/Structs.cs b/Aaru.Filesystems/FATX/Structs.cs index 318f42b3e..23bec6dee 100644 --- a/Aaru.Filesystems/FATX/Structs.cs +++ b/Aaru.Filesystems/FATX/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { - public partial class XboxFatPlugin + public sealed partial class XboxFatPlugin { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Superblock diff --git a/Aaru.Filesystems/FATX/Super.cs b/Aaru.Filesystems/FATX/Super.cs index 9adc605e1..7afe9e4c9 100644 --- a/Aaru.Filesystems/FATX/Super.cs +++ b/Aaru.Filesystems/FATX/Super.cs @@ -45,7 +45,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public partial class XboxFatPlugin + public sealed partial class XboxFatPlugin { public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, Dictionary options, string @namespace) @@ -53,8 +53,7 @@ namespace Aaru.Filesystems Encoding = Encoding.GetEncoding("iso-8859-15"); _littleEndian = true; - if(options == null) - options = GetDefaultOptions(); + options ??= GetDefaultOptions(); if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out _debug); diff --git a/Aaru.Filesystems/FFS.cs b/Aaru.Filesystems/FFS.cs index a0b24f301..5af4eeb76 100644 --- a/Aaru.Filesystems/FFS.cs +++ b/Aaru.Filesystems/FFS.cs @@ -48,7 +48,7 @@ namespace Aaru.Filesystems { // Using information from Linux kernel headers [SuppressMessage("ReSharper", "InconsistentNaming")] - public class FFSPlugin : IFilesystem + public sealed class FFSPlugin : IFilesystem { const uint block_size = 8192; diff --git a/Aaru.Filesystems/Fossil.cs b/Aaru.Filesystems/Fossil.cs index d649a3d75..3e221245b 100644 --- a/Aaru.Filesystems/Fossil.cs +++ b/Aaru.Filesystems/Fossil.cs @@ -42,7 +42,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class Fossil : IFilesystem + public sealed class Fossil : IFilesystem { const uint FOSSIL_HDR_MAGIC = 0x3776AE89; const uint FOSSIL_SB_MAGIC = 0x2340A3B1; @@ -124,7 +124,7 @@ namespace Aaru.Filesystems sb.AppendFormat("Next QID {0}", fsb.qid).AppendLine(); sb.AppendFormat("Active root block {0}", fsb.active).AppendLine(); sb.AppendFormat("Next root block {0}", fsb.next).AppendLine(); - sb.AppendFormat("Curren root block {0}", fsb.current).AppendLine(); + sb.AppendFormat("Current root block {0}", fsb.current).AppendLine(); sb.AppendFormat("Volume label: \"{0}\"", StringHandlers.CToString(fsb.name, Encoding)).AppendLine(); XmlFsType.VolumeName = StringHandlers.CToString(fsb.name, Encoding); } diff --git a/Aaru.Filesystems/HAMMER.cs b/Aaru.Filesystems/HAMMER.cs index db5c1ead9..124c8bcdd 100644 --- a/Aaru.Filesystems/HAMMER.cs +++ b/Aaru.Filesystems/HAMMER.cs @@ -47,7 +47,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class HAMMER : IFilesystem + public sealed class HAMMER : IFilesystem { const ulong HAMMER_FSBUF_VOLUME = 0xC8414D4DC5523031; const ulong HAMMER_FSBUF_VOLUME_REV = 0x313052C54D4D41C8; @@ -96,10 +96,8 @@ namespace Aaru.Filesystems ulong magic = BitConverter.ToUInt64(sbSector, 0); - if(magic == HAMMER_FSBUF_VOLUME) - superBlock = Marshal.ByteArrayToStructureLittleEndian(sbSector); - else - superBlock = Marshal.ByteArrayToStructureBigEndian(sbSector); + superBlock = magic == HAMMER_FSBUF_VOLUME ? Marshal.ByteArrayToStructureLittleEndian(sbSector) + : Marshal.ByteArrayToStructureBigEndian(sbSector); sb.AppendLine("HAMMER filesystem"); @@ -195,7 +193,7 @@ namespace Aaru.Filesystems /* * These fields are initialized and space is reserved in every - * volume making up a HAMMER filesytem, but only the root volume + * volume making up a HAMMER filesystem, but only the root volume * contains valid data. Note that vol0_stat_bigblocks does not * include big-blocks for freemap and undomap initially allocated * by newfs_hammer(8). diff --git a/Aaru.Filesystems/HPFS.cs b/Aaru.Filesystems/HPFS.cs index 230c563c0..fbb0e5927 100644 --- a/Aaru.Filesystems/HPFS.cs +++ b/Aaru.Filesystems/HPFS.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { // Information from an old unnamed document - public class HPFS : IFilesystem + public sealed class HPFS : IFilesystem { public FileSystemType XmlFsType { get; private set; } public Encoding Encoding { get; private set; } diff --git a/Aaru.Filesystems/HPOFS/Consts.cs b/Aaru.Filesystems/HPOFS/Consts.cs index b2c9f9ca8..a04d889dc 100644 --- a/Aaru.Filesystems/HPOFS/Consts.cs +++ b/Aaru.Filesystems/HPOFS/Consts.cs @@ -32,7 +32,7 @@ namespace Aaru.Filesystems { - public partial class HPOFS + public sealed partial class HPOFS { readonly byte[] _type = { diff --git a/Aaru.Filesystems/HPOFS/HPOFS.cs b/Aaru.Filesystems/HPOFS/HPOFS.cs index 6c2fb6576..f48b76955 100644 --- a/Aaru.Filesystems/HPOFS/HPOFS.cs +++ b/Aaru.Filesystems/HPOFS/HPOFS.cs @@ -39,7 +39,7 @@ namespace Aaru.Filesystems { // Information from test floppy images created with OS/2 HPOFS 2.0 // Need to get IBM document GA32-0224 -> IBM 3995 Optical Library Dataserver Products: Optical Disk Format - public partial class HPOFS : IFilesystem + public sealed partial class HPOFS : IFilesystem { public FileSystemType XmlFsType { get; private set; } public Encoding Encoding { get; private set; } diff --git a/Aaru.Filesystems/HPOFS/Info.cs b/Aaru.Filesystems/HPOFS/Info.cs index 86a63f1f8..24554f2aa 100644 --- a/Aaru.Filesystems/HPOFS/Info.cs +++ b/Aaru.Filesystems/HPOFS/Info.cs @@ -41,7 +41,7 @@ using Schemas; namespace Aaru.Filesystems { - public partial class HPOFS + public sealed partial class HPOFS { public bool Identify(IMediaImage imagePlugin, Partition partition) { diff --git a/Aaru.Filesystems/HPOFS/Structs.cs b/Aaru.Filesystems/HPOFS/Structs.cs index f5fdbbc13..3d255979c 100644 --- a/Aaru.Filesystems/HPOFS/Structs.cs +++ b/Aaru.Filesystems/HPOFS/Structs.cs @@ -36,7 +36,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedType.Local")] - public partial class HPOFS + public sealed partial class HPOFS { /// BIOS Parameter Block, at sector 0, little-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Filesystems/ISO9660/Consts/AAIP.cs b/Aaru.Filesystems/ISO9660/Consts/AAIP.cs index 53c1d6058..fd39e1df1 100644 --- a/Aaru.Filesystems/ISO9660/Consts/AAIP.cs +++ b/Aaru.Filesystems/ISO9660/Consts/AAIP.cs @@ -32,14 +32,12 @@ // ****************************************************************************/ using System; -using System.Diagnostics.CodeAnalysis; // ReSharper disable UnusedMember.Local namespace Aaru.Filesystems { - [SuppressMessage("ReSharper", "UnusedType.Local")] - public partial class ISO9660 + public sealed partial class ISO9660 { const ushort AAIP_MAGIC = 0x414C; // "AL" const ushort AAIP_MAGIC_OLD = 0x4141; // "AA" diff --git a/Aaru.Filesystems/ISO9660/Consts/Amiga.cs b/Aaru.Filesystems/ISO9660/Consts/Amiga.cs index 9a2ecc4b2..cfac94da5 100644 --- a/Aaru.Filesystems/ISO9660/Consts/Amiga.cs +++ b/Aaru.Filesystems/ISO9660/Consts/Amiga.cs @@ -37,7 +37,7 @@ using System; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { const ushort AMIGA_MAGIC = 0x4153; // "AS" diff --git a/Aaru.Filesystems/ISO9660/Consts/Apple.cs b/Aaru.Filesystems/ISO9660/Consts/Apple.cs index a34b04929..978c35901 100644 --- a/Aaru.Filesystems/ISO9660/Consts/Apple.cs +++ b/Aaru.Filesystems/ISO9660/Consts/Apple.cs @@ -33,7 +33,7 @@ namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { const ushort APPLE_MAGIC = 0x4141; // "AA" const ushort APPLE_MAGIC_OLD = 0x4241; // "BA" diff --git a/Aaru.Filesystems/ISO9660/Consts/CDi.cs b/Aaru.Filesystems/ISO9660/Consts/CDi.cs index 080fdfd7c..572fc3c8f 100644 --- a/Aaru.Filesystems/ISO9660/Consts/CDi.cs +++ b/Aaru.Filesystems/ISO9660/Consts/CDi.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { const string CDI_MAGIC = "CD-I "; static readonly int _cdiDirectoryRecordSize = Marshal.SizeOf(); diff --git a/Aaru.Filesystems/ISO9660/Consts/ElTorito.cs b/Aaru.Filesystems/ISO9660/Consts/ElTorito.cs index b1cc60ef1..d82de8ab1 100644 --- a/Aaru.Filesystems/ISO9660/Consts/ElTorito.cs +++ b/Aaru.Filesystems/ISO9660/Consts/ElTorito.cs @@ -37,7 +37,7 @@ using System; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { const ushort EL_TORITO_MAGIC = 0xAA55; const int EL_TORITO_ENTRY_SIZE = 32; diff --git a/Aaru.Filesystems/ISO9660/Consts/HighSierra.cs b/Aaru.Filesystems/ISO9660/Consts/HighSierra.cs index 51c39b33f..45e606187 100644 --- a/Aaru.Filesystems/ISO9660/Consts/HighSierra.cs +++ b/Aaru.Filesystems/ISO9660/Consts/HighSierra.cs @@ -35,7 +35,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { const string HIGH_SIERRA_MAGIC = "CDROM"; static readonly int _highSierraDirectoryRecordSize = Marshal.SizeOf(); diff --git a/Aaru.Filesystems/ISO9660/Consts/ISO.cs b/Aaru.Filesystems/ISO9660/Consts/ISO.cs index 6e3bda56b..42ec94b60 100644 --- a/Aaru.Filesystems/ISO9660/Consts/ISO.cs +++ b/Aaru.Filesystems/ISO9660/Consts/ISO.cs @@ -37,7 +37,7 @@ using System; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { const string ISO_MAGIC = "CD001"; diff --git a/Aaru.Filesystems/ISO9660/Consts/Internal.cs b/Aaru.Filesystems/ISO9660/Consts/Internal.cs index 5205503d3..74bd35d91 100644 --- a/Aaru.Filesystems/ISO9660/Consts/Internal.cs +++ b/Aaru.Filesystems/ISO9660/Consts/Internal.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class ISO9660 + public sealed partial class ISO9660 { const byte MODE2_FORM2 = 0x20; static readonly int _directoryRecordSize = Marshal.SizeOf(); diff --git a/Aaru.Filesystems/ISO9660/Consts/RRIP.cs b/Aaru.Filesystems/ISO9660/Consts/RRIP.cs index 80267b119..53fd4f8af 100644 --- a/Aaru.Filesystems/ISO9660/Consts/RRIP.cs +++ b/Aaru.Filesystems/ISO9660/Consts/RRIP.cs @@ -37,7 +37,7 @@ using System; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { const ushort RRIP_MAGIC = 0x5252; // "RR" const ushort RRIP_POSIX_ATTRIBUTES = 0x5058; // "PX" diff --git a/Aaru.Filesystems/ISO9660/Consts/SUSP.cs b/Aaru.Filesystems/ISO9660/Consts/SUSP.cs index bef5d37a2..dffc7fc92 100644 --- a/Aaru.Filesystems/ISO9660/Consts/SUSP.cs +++ b/Aaru.Filesystems/ISO9660/Consts/SUSP.cs @@ -38,7 +38,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class ISO9660 + public sealed partial class ISO9660 { const ushort SUSP_CONTINUATION = 0x4345; // "CE" const ushort SUSP_PADDING = 0x5044; // "PD" diff --git a/Aaru.Filesystems/ISO9660/Consts/XA.cs b/Aaru.Filesystems/ISO9660/Consts/XA.cs index c47626b70..cd5aa95b0 100644 --- a/Aaru.Filesystems/ISO9660/Consts/XA.cs +++ b/Aaru.Filesystems/ISO9660/Consts/XA.cs @@ -37,7 +37,7 @@ using System; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { const ushort XA_MAGIC = 0x5841; // "XA" diff --git a/Aaru.Filesystems/ISO9660/Consts/Ziso.cs b/Aaru.Filesystems/ISO9660/Consts/Ziso.cs index a05a83b9c..1352c66de 100644 --- a/Aaru.Filesystems/ISO9660/Consts/Ziso.cs +++ b/Aaru.Filesystems/ISO9660/Consts/Ziso.cs @@ -36,7 +36,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class ISO9660 + public sealed partial class ISO9660 { const ulong ZISO_HEADER_MAGIC = 0x37E45396C9DBD607; const ulong ZISO_HEADER_CIGAM = 0x07D6DBC99653E437; diff --git a/Aaru.Filesystems/ISO9660/Date.cs b/Aaru.Filesystems/ISO9660/Date.cs index 501d58153..20ee43290 100644 --- a/Aaru.Filesystems/ISO9660/Date.cs +++ b/Aaru.Filesystems/ISO9660/Date.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { static DateTime? DecodeIsoDateTime(byte[] timestamp) { diff --git a/Aaru.Filesystems/ISO9660/Dir.cs b/Aaru.Filesystems/ISO9660/Dir.cs index 982ecbfe6..d881f8494 100644 --- a/Aaru.Filesystems/ISO9660/Dir.cs +++ b/Aaru.Filesystems/ISO9660/Dir.cs @@ -42,7 +42,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { Dictionary> _directoryCache; diff --git a/Aaru.Filesystems/ISO9660/File.cs b/Aaru.Filesystems/ISO9660/File.cs index c281bc9fe..1967b130a 100644 --- a/Aaru.Filesystems/ISO9660/File.cs +++ b/Aaru.Filesystems/ISO9660/File.cs @@ -45,7 +45,7 @@ using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { public Errno MapBlock(string path, long fileBlock, out long deviceBlock) { @@ -124,9 +124,7 @@ namespace Aaru.Filesystems offset += entry.XattrLength; - if(entry.CdiSystemArea != null && - entry.CdiSystemArea.Value.attributes.HasFlag(CdiAttributes.DigitalAudio) && - entry.Extents.Count == 1) + if(entry.CdiSystemArea?.attributes.HasFlag(CdiAttributes.DigitalAudio) == true && entry.Extents.Count == 1) { try { @@ -196,37 +194,32 @@ namespace Aaru.Filesystems if(entry.Flags.HasFlag(FileFlags.Hidden)) stat.Attributes |= FileAttributes.Hidden; - if(entry.FinderInfo != null) - { - AppleCommon.FInfo finderInfo = entry.FinderInfo.Value; + if(entry.FinderInfo?.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsAlias) == true) + stat.Attributes |= FileAttributes.Alias; - if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsAlias)) - stat.Attributes |= FileAttributes.Alias; + if(entry.FinderInfo?.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsInvisible) == true) + stat.Attributes |= FileAttributes.Hidden; - if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsInvisible)) - stat.Attributes |= FileAttributes.Hidden; + if(entry.FinderInfo?.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasBeenInited) == true) + stat.Attributes |= FileAttributes.HasBeenInited; - if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasBeenInited)) - stat.Attributes |= FileAttributes.HasBeenInited; + if(entry.FinderInfo?.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasCustomIcon) == true) + stat.Attributes |= FileAttributes.HasCustomIcon; - if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasCustomIcon)) - stat.Attributes |= FileAttributes.HasCustomIcon; + if(entry.FinderInfo?.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasNoINITs) == true) + stat.Attributes |= FileAttributes.HasNoINITs; - if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasNoINITs)) - stat.Attributes |= FileAttributes.HasNoINITs; + if(entry.FinderInfo?.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsOnDesk) == true) + stat.Attributes |= FileAttributes.IsOnDesk; - if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsOnDesk)) - stat.Attributes |= FileAttributes.IsOnDesk; + if(entry.FinderInfo?.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsShared) == true) + stat.Attributes |= FileAttributes.Shared; - if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsShared)) - stat.Attributes |= FileAttributes.Shared; + if(entry.FinderInfo?.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsStationery) == true) + stat.Attributes |= FileAttributes.Stationery; - if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsStationery)) - stat.Attributes |= FileAttributes.Stationery; - - if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasBundle)) - stat.Attributes |= FileAttributes.Bundle; - } + if(entry.FinderInfo?.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasBundle) == true) + stat.Attributes |= FileAttributes.Bundle; if(entry.AppleIcon != null) stat.Attributes |= FileAttributes.HasCustomIcon; diff --git a/Aaru.Filesystems/ISO9660/ISO9660.cs b/Aaru.Filesystems/ISO9660/ISO9660.cs index 20bb530b4..ed21de9a1 100644 --- a/Aaru.Filesystems/ISO9660/ISO9660.cs +++ b/Aaru.Filesystems/ISO9660/ISO9660.cs @@ -43,7 +43,7 @@ namespace Aaru.Filesystems { // This is coded following ECMA-119. [SuppressMessage("ReSharper", "UnusedType.Local")] - public partial class ISO9660 : IReadOnlyFilesystem + public sealed partial class ISO9660 : IReadOnlyFilesystem { bool _cdi; bool _debug; diff --git a/Aaru.Filesystems/ISO9660/Info.cs b/Aaru.Filesystems/ISO9660/Info.cs index e0463702d..b9537f71c 100644 --- a/Aaru.Filesystems/ISO9660/Info.cs +++ b/Aaru.Filesystems/ISO9660/Info.cs @@ -44,7 +44,7 @@ using Schemas; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { public bool Identify(IMediaImage imagePlugin, Partition partition) { diff --git a/Aaru.Filesystems/ISO9660/Mode2.cs b/Aaru.Filesystems/ISO9660/Mode2.cs index ebbfbca27..4af11d559 100644 --- a/Aaru.Filesystems/ISO9660/Mode2.cs +++ b/Aaru.Filesystems/ISO9660/Mode2.cs @@ -36,7 +36,7 @@ using Aaru.Decoders.CD; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { byte[] ReadSector(ulong sector, bool interleaved = false, byte fileNumber = 0) { diff --git a/Aaru.Filesystems/ISO9660/PathTable.cs b/Aaru.Filesystems/ISO9660/PathTable.cs index 467abc18f..8379ad474 100644 --- a/Aaru.Filesystems/ISO9660/PathTable.cs +++ b/Aaru.Filesystems/ISO9660/PathTable.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { PathTableEntryInternal[] DecodePathTable(byte[] data) { diff --git a/Aaru.Filesystems/ISO9660/Structs/Amiga.cs b/Aaru.Filesystems/ISO9660/Structs/Amiga.cs index 72350eb03..e051aee3e 100644 --- a/Aaru.Filesystems/ISO9660/Structs/Amiga.cs +++ b/Aaru.Filesystems/ISO9660/Structs/Amiga.cs @@ -35,7 +35,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AmigaEntry diff --git a/Aaru.Filesystems/ISO9660/Structs/Apple.cs b/Aaru.Filesystems/ISO9660/Structs/Apple.cs index 8f2006432..68767a7ab 100644 --- a/Aaru.Filesystems/ISO9660/Structs/Apple.cs +++ b/Aaru.Filesystems/ISO9660/Structs/Apple.cs @@ -35,7 +35,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { // Little-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Filesystems/ISO9660/Structs/CDi.cs b/Aaru.Filesystems/ISO9660/Structs/CDi.cs index 0861ec1cc..0f89fa469 100644 --- a/Aaru.Filesystems/ISO9660/Structs/CDi.cs +++ b/Aaru.Filesystems/ISO9660/Structs/CDi.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { static DecodedVolumeDescriptor DecodeVolumeDescriptor(FileStructureVolumeDescriptor pvd) { diff --git a/Aaru.Filesystems/ISO9660/Structs/ElTorito.cs b/Aaru.Filesystems/ISO9660/Structs/ElTorito.cs index 04a4b774a..02ca59da7 100644 --- a/Aaru.Filesystems/ISO9660/Structs/ElTorito.cs +++ b/Aaru.Filesystems/ISO9660/Structs/ElTorito.cs @@ -35,7 +35,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ElToritoBootRecord diff --git a/Aaru.Filesystems/ISO9660/Structs/HighSierra.cs b/Aaru.Filesystems/ISO9660/Structs/HighSierra.cs index 5b9d2adf4..1d357e4f8 100644 --- a/Aaru.Filesystems/ISO9660/Structs/HighSierra.cs +++ b/Aaru.Filesystems/ISO9660/Structs/HighSierra.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { static DecodedVolumeDescriptor DecodeVolumeDescriptor(HighSierraPrimaryVolumeDescriptor pvd) { diff --git a/Aaru.Filesystems/ISO9660/Structs/ISO.cs b/Aaru.Filesystems/ISO9660/Structs/ISO.cs index ac8b771ca..2a0fbd050 100644 --- a/Aaru.Filesystems/ISO9660/Structs/ISO.cs +++ b/Aaru.Filesystems/ISO9660/Structs/ISO.cs @@ -39,7 +39,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { static DecodedVolumeDescriptor DecodeVolumeDescriptor(PrimaryVolumeDescriptor pvd) { diff --git a/Aaru.Filesystems/ISO9660/Structs/Internal.cs b/Aaru.Filesystems/ISO9660/Structs/Internal.cs index 8082fa01f..a63f7e75e 100644 --- a/Aaru.Filesystems/ISO9660/Structs/Internal.cs +++ b/Aaru.Filesystems/ISO9660/Structs/Internal.cs @@ -36,7 +36,7 @@ using System.Collections.Generic; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { struct DecodedVolumeDescriptor { diff --git a/Aaru.Filesystems/ISO9660/Structs/Joliet.cs b/Aaru.Filesystems/ISO9660/Structs/Joliet.cs index 502fa48f9..b3d9c5e61 100644 --- a/Aaru.Filesystems/ISO9660/Structs/Joliet.cs +++ b/Aaru.Filesystems/ISO9660/Structs/Joliet.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { static DecodedVolumeDescriptor DecodeJolietDescriptor(PrimaryVolumeDescriptor jolietvd) { diff --git a/Aaru.Filesystems/ISO9660/Structs/RRIP.cs b/Aaru.Filesystems/ISO9660/Structs/RRIP.cs index 9e8b87871..e2b335e0d 100644 --- a/Aaru.Filesystems/ISO9660/Structs/RRIP.cs +++ b/Aaru.Filesystems/ISO9660/Structs/RRIP.cs @@ -37,7 +37,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedType.Local")] - public partial class ISO9660 + public sealed partial class ISO9660 { // RRIP 1.10 [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Filesystems/ISO9660/Structs/SUSP.cs b/Aaru.Filesystems/ISO9660/Structs/SUSP.cs index a959c5039..3ae8db13a 100644 --- a/Aaru.Filesystems/ISO9660/Structs/SUSP.cs +++ b/Aaru.Filesystems/ISO9660/Structs/SUSP.cs @@ -37,7 +37,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ContinuationArea diff --git a/Aaru.Filesystems/ISO9660/Structs/XA.cs b/Aaru.Filesystems/ISO9660/Structs/XA.cs index 3c335fe15..e81d77989 100644 --- a/Aaru.Filesystems/ISO9660/Structs/XA.cs +++ b/Aaru.Filesystems/ISO9660/Structs/XA.cs @@ -35,7 +35,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { // Big-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Filesystems/ISO9660/Structs/Ziso.cs b/Aaru.Filesystems/ISO9660/Structs/Ziso.cs index 288624547..01ecc8cb8 100644 --- a/Aaru.Filesystems/ISO9660/Structs/Ziso.cs +++ b/Aaru.Filesystems/ISO9660/Structs/Ziso.cs @@ -37,7 +37,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedType.Local")] - public partial class ISO9660 + public sealed partial class ISO9660 { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ZisofsHeader diff --git a/Aaru.Filesystems/ISO9660/Super.cs b/Aaru.Filesystems/ISO9660/Super.cs index 244ade0df..fffe3ccb7 100644 --- a/Aaru.Filesystems/ISO9660/Super.cs +++ b/Aaru.Filesystems/ISO9660/Super.cs @@ -44,7 +44,7 @@ using Schemas; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, Dictionary options, string @namespace) @@ -53,8 +53,7 @@ namespace Aaru.Filesystems byte[] vdMagic = new byte[5]; // Volume Descriptor magic "CD001" byte[] hsMagic = new byte[5]; // Volume Descriptor magic "CDROM" - if(options == null) - options = GetDefaultOptions(); + options ??= GetDefaultOptions(); if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out _debug); @@ -69,8 +68,7 @@ namespace Aaru.Filesystems bool.TryParse(useEvdString, out _useEvd); // Default namespace - if(@namespace is null) - @namespace = "joliet"; + @namespace ??= "joliet"; switch(@namespace.ToLowerInvariant()) { @@ -222,7 +220,7 @@ namespace Aaru.Filesystems if(_useEvd) { // Basically until escape sequences are implemented, let the user chose the encoding. - // This is the same as user chosing Romeo namespace, but using the EVD instead of the PVD + // This is the same as user choosing Romeo namespace, but using the EVD instead of the PVD _namespace = Namespace.Romeo; pvd = svd; } @@ -334,10 +332,7 @@ namespace Aaru.Filesystems rootXattrLength = _highSierra ? hsvd.Value.root_directory_record.xattr_len : pvd.Value.root_directory_record.xattr_len; - if(_highSierra) - rootSize = hsvd.Value.root_directory_record.size; - else - rootSize = pvd.Value.root_directory_record.size; + rootSize = _highSierra ? hsvd.Value.root_directory_record.size : pvd.Value.root_directory_record.size; if(pathTableData.Length > 1 && rootLocation != _pathTable[0].Extent) diff --git a/Aaru.Filesystems/ISO9660/Xattr.cs b/Aaru.Filesystems/ISO9660/Xattr.cs index d967324d9..598d86173 100644 --- a/Aaru.Filesystems/ISO9660/Xattr.cs +++ b/Aaru.Filesystems/ISO9660/Xattr.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class ISO9660 + public sealed partial class ISO9660 { public Errno ListXAttr(string path, out List xattrs) { diff --git a/Aaru.Filesystems/JFS.cs b/Aaru.Filesystems/JFS.cs index 8a82dbf26..f494497f9 100644 --- a/Aaru.Filesystems/JFS.cs +++ b/Aaru.Filesystems/JFS.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class JFS : IFilesystem + public sealed class JFS : IFilesystem { const uint JFS_BOOT_BLOCKS_SIZE = 0x8000; const uint JFS_MAGIC = 0x3153464A; diff --git a/Aaru.Filesystems/LIF.cs b/Aaru.Filesystems/LIF.cs index 729f0990e..76307d813 100644 --- a/Aaru.Filesystems/LIF.cs +++ b/Aaru.Filesystems/LIF.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { // Information from http://www.hp9845.net/9845/projects/hpdir/#lif_filesystem - public class LIF : IFilesystem + public sealed class LIF : IFilesystem { const uint LIF_MAGIC = 0x8000; diff --git a/Aaru.Filesystems/LisaFS/Consts.cs b/Aaru.Filesystems/LisaFS/Consts.cs index 934457fcc..dfabecf63 100644 --- a/Aaru.Filesystems/LisaFS/Consts.cs +++ b/Aaru.Filesystems/LisaFS/Consts.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.Filesystems.LisaFS { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class LisaFS + public sealed partial class LisaFS { /// Lisa FS v1, from Lisa OS 1.0 (Workshop or Office) Never seen on Sony floppies. const byte LISA_V1 = 0x0E; diff --git a/Aaru.Filesystems/LisaFS/Dir.cs b/Aaru.Filesystems/LisaFS/Dir.cs index e8fc694d6..ffec5f977 100644 --- a/Aaru.Filesystems/LisaFS/Dir.cs +++ b/Aaru.Filesystems/LisaFS/Dir.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems.LisaFS { - public partial class LisaFS + public sealed partial class LisaFS { /// /// Solves a symbolic link. @@ -198,8 +198,7 @@ namespace Aaru.Filesystems.LisaFS if(firstCatalogBlock == null) return Errno.NoSuchFile; - ulong prevCatalogPointer; - prevCatalogPointer = BigEndianBitConverter.ToUInt32(firstCatalogBlock, 0x7F6); + ulong prevCatalogPointer = BigEndianBitConverter.ToUInt32(firstCatalogBlock, 0x7F6); // Traverse double-linked list until first catalog block while(prevCatalogPointer != 0xFFFFFFFF) @@ -214,8 +213,7 @@ namespace Aaru.Filesystems.LisaFS prevCatalogPointer = BigEndianBitConverter.ToUInt32(firstCatalogBlock, 0x7F6); } - ulong nextCatalogPointer; - nextCatalogPointer = BigEndianBitConverter.ToUInt32(firstCatalogBlock, 0x7FA); + ulong nextCatalogPointer = BigEndianBitConverter.ToUInt32(firstCatalogBlock, 0x7FA); List catalogBlocks = new List { diff --git a/Aaru.Filesystems/LisaFS/Extent.cs b/Aaru.Filesystems/LisaFS/Extent.cs index 53327a46d..d15ca9be0 100644 --- a/Aaru.Filesystems/LisaFS/Extent.cs +++ b/Aaru.Filesystems/LisaFS/Extent.cs @@ -39,7 +39,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems.LisaFS { - public partial class LisaFS + public sealed partial class LisaFS { public Errno MapBlock(string path, long fileBlock, out long deviceBlock) { diff --git a/Aaru.Filesystems/LisaFS/File.cs b/Aaru.Filesystems/LisaFS/File.cs index 11d60a34e..c0c887f0b 100644 --- a/Aaru.Filesystems/LisaFS/File.cs +++ b/Aaru.Filesystems/LisaFS/File.cs @@ -39,7 +39,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems.LisaFS { - public partial class LisaFS + public sealed partial class LisaFS { public Errno GetAttributes(string path, out FileAttributes attributes) { diff --git a/Aaru.Filesystems/LisaFS/Info.cs b/Aaru.Filesystems/LisaFS/Info.cs index 9cf3bd3a0..e7732d8fc 100644 --- a/Aaru.Filesystems/LisaFS/Info.cs +++ b/Aaru.Filesystems/LisaFS/Info.cs @@ -44,16 +44,13 @@ using Encoding = System.Text.Encoding; namespace Aaru.Filesystems.LisaFS { - public partial class LisaFS + public sealed partial class LisaFS { public bool Identify(IMediaImage imagePlugin, Partition partition) { try { - if(imagePlugin.Info.ReadableSectorTags == null) - return false; - - if(!imagePlugin.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag)) + if(imagePlugin.Info.ReadableSectorTags?.Contains(SectorTagType.AppleSectorTag) != true) return false; // Minimal LisaOS disk is 3.5" single sided double density, 800 sectors @@ -142,10 +139,7 @@ namespace Aaru.Filesystems.LisaFS try { - if(imagePlugin.Info.ReadableSectorTags == null) - return; - - if(!imagePlugin.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag)) + if(imagePlugin.Info.ReadableSectorTags?.Contains(SectorTagType.AppleSectorTag) != true) return; // Minimal LisaOS disk is 3.5" single sided double density, 800 sectors @@ -331,7 +325,7 @@ namespace Aaru.Filesystems.LisaFS break; default: - sb.AppendFormat("Uknown LisaFS version {0}", infoMddf.fsversion).AppendLine(); + sb.AppendFormat("Unknown LisaFS version {0}", infoMddf.fsversion).AppendLine(); break; } @@ -371,7 +365,7 @@ namespace Aaru.Filesystems.LisaFS sb.AppendFormat("{0} blocks free", infoMddf.freecount).AppendLine(); sb.AppendFormat("{0} bytes in LisaInfo", infoMddf.label_size).AppendLine(); sb.AppendFormat("Filesystem overhead: {0}", infoMddf.fs_overhead).AppendLine(); - sb.AppendFormat("Scanvenger result code: 0x{0:X8}", infoMddf.result_scavenge).AppendLine(); + sb.AppendFormat("Scavenger result code: 0x{0:X8}", infoMddf.result_scavenge).AppendLine(); sb.AppendFormat("Boot code: 0x{0:X8}", infoMddf.boot_code).AppendLine(); sb.AppendFormat("Boot environment: 0x{0:X8}", infoMddf.boot_environ).AppendLine(); sb.AppendFormat("Overmount stamp: 0x{0:X16}", infoMddf.overmount_stamp).AppendLine(); diff --git a/Aaru.Filesystems/LisaFS/LisaFS.cs b/Aaru.Filesystems/LisaFS/LisaFS.cs index 8e60508c7..391cc79f8 100644 --- a/Aaru.Filesystems/LisaFS/LisaFS.cs +++ b/Aaru.Filesystems/LisaFS/LisaFS.cs @@ -40,7 +40,7 @@ namespace Aaru.Filesystems.LisaFS { // All information by Natalia Portillo // Variable names from Lisa API - public partial class LisaFS : IReadOnlyFilesystem + public sealed partial class LisaFS : IReadOnlyFilesystem { bool _debug; IMediaImage _device; diff --git a/Aaru.Filesystems/LisaFS/Structs.cs b/Aaru.Filesystems/LisaFS/Structs.cs index a4144530e..3ed1df12c 100644 --- a/Aaru.Filesystems/LisaFS/Structs.cs +++ b/Aaru.Filesystems/LisaFS/Structs.cs @@ -36,7 +36,7 @@ using System; namespace Aaru.Filesystems.LisaFS { - public partial class LisaFS + public sealed partial class LisaFS { /// /// The MDDF is the most import block on a Lisa FS volume. It describes the volume and its contents. On diff --git a/Aaru.Filesystems/LisaFS/Super.cs b/Aaru.Filesystems/LisaFS/Super.cs index a8339a2c1..9d28c7cd4 100644 --- a/Aaru.Filesystems/LisaFS/Super.cs +++ b/Aaru.Filesystems/LisaFS/Super.cs @@ -45,7 +45,7 @@ using Encoding = System.Text.Encoding; namespace Aaru.Filesystems.LisaFS { - public partial class LisaFS + public sealed partial class LisaFS { /// /// Mounts an Apple Lisa filesystem @@ -60,8 +60,7 @@ namespace Aaru.Filesystems.LisaFS // Lisa OS is unable to work on disks without tags. // This code is designed like that. // However with some effort the code may be modified to ignore them. - if(_device.Info.ReadableSectorTags == null || - !_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag)) + if(_device.Info.ReadableSectorTags?.Contains(SectorTagType.AppleSectorTag) != true) { AaruConsole.DebugWriteLine("LisaFS plugin", "Underlying device does not support Lisa tags"); @@ -224,8 +223,7 @@ namespace Aaru.Filesystems.LisaFS _mounted = true; - if(options == null) - options = GetDefaultOptions(); + options ??= GetDefaultOptions(); if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out _debug); @@ -360,7 +358,7 @@ namespace Aaru.Filesystems.LisaFS } /// - /// Umounts this Lisa filesystem + /// Unmounts this Lisa filesystem public Errno Unmount() { _mounted = false; diff --git a/Aaru.Filesystems/LisaFS/Xattr.cs b/Aaru.Filesystems/LisaFS/Xattr.cs index 7166a6537..f20040be6 100644 --- a/Aaru.Filesystems/LisaFS/Xattr.cs +++ b/Aaru.Filesystems/LisaFS/Xattr.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems.LisaFS { - public partial class LisaFS + public sealed partial class LisaFS { /// /// Lists all extended attributes, alternate data streams and forks of the given file. @@ -62,7 +62,7 @@ namespace Aaru.Filesystems.LisaFS /// Reads an extended attribute, alternate data stream or fork from the given file. /// Error number. /// File path. - /// Extendad attribute, alternate data stream or fork name. + /// Extended attribute, alternate data stream or fork name. /// Buffer. public Errno GetXattr(string path, string xattr, ref byte[] buf) { diff --git a/Aaru.Filesystems/Locus.cs b/Aaru.Filesystems/Locus.cs index a67de43aa..ea31bd87c 100644 --- a/Aaru.Filesystems/Locus.cs +++ b/Aaru.Filesystems/Locus.cs @@ -67,7 +67,7 @@ using time_t = System.Int32; namespace Aaru.Filesystems { - public class Locus : IFilesystem + public sealed class Locus : IFilesystem { const int NICINOD = 325; const int NICFREE = 600; @@ -279,7 +279,7 @@ namespace Aaru.Filesystems /* defined as a constant below */ public readonly gfs_t s_gfs; /* global filesystem number */ public readonly daddr_t s_fsize; /* size in blocks of entire volume */ - /* several ints for replicated filsystems */ + /* several ints for replicated filesystems */ public readonly commitcnt_t s_lwm; /* all prior commits propagated */ public readonly commitcnt_t s_hwm; /* highest commit propagated */ /* oldest committed version in the list. diff --git a/Aaru.Filesystems/MicroDOS.cs b/Aaru.Filesystems/MicroDOS.cs index c198ef36a..e0280c54f 100644 --- a/Aaru.Filesystems/MicroDOS.cs +++ b/Aaru.Filesystems/MicroDOS.cs @@ -45,7 +45,7 @@ namespace Aaru.Filesystems { // Information from http://www.owg.ru/mkt/BK/MKDOS.TXT // Thanks to tarlabnor for translating it - public class MicroDOS : IFilesystem + public sealed class MicroDOS : IFilesystem { const ushort MAGIC = 0xA72E; const ushort MAGIC2 = 0x530C; diff --git a/Aaru.Filesystems/MinixFS.cs b/Aaru.Filesystems/MinixFS.cs index 6df526de7..297653570 100644 --- a/Aaru.Filesystems/MinixFS.cs +++ b/Aaru.Filesystems/MinixFS.cs @@ -42,7 +42,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { // Information from the Linux kernel - public class MinixFS : IFilesystem + public sealed class MinixFS : IFilesystem { /// Minix v1, 14 char filenames const ushort MINIX_MAGIC = 0x137F; @@ -252,12 +252,8 @@ namespace Aaru.Filesystems if(minix3) { - SuperBlock3 mnxSb; - - if(littleEndian) - mnxSb = Marshal.ByteArrayToStructureLittleEndian(minixSbSector); - else - mnxSb = Marshal.ByteArrayToStructureBigEndian(minixSbSector); + SuperBlock3 mnxSb = littleEndian ? Marshal.ByteArrayToStructureLittleEndian(minixSbSector) + : Marshal.ByteArrayToStructureBigEndian(minixSbSector); if(magic != MINIX3_MAGIC && magic != MINIX3_CIGAM) @@ -293,12 +289,8 @@ namespace Aaru.Filesystems } else { - SuperBlock mnxSb; - - if(littleEndian) - mnxSb = Marshal.ByteArrayToStructureLittleEndian(minixSbSector); - else - mnxSb = Marshal.ByteArrayToStructureBigEndian(minixSbSector); + SuperBlock mnxSb = littleEndian ? Marshal.ByteArrayToStructureLittleEndian(minixSbSector) + : Marshal.ByteArrayToStructureBigEndian(minixSbSector); sb.AppendLine(minixVersion); sb.AppendFormat("{0} chars in filename", filenamesize).AppendLine(); diff --git a/Aaru.Filesystems/NILFS2.cs b/Aaru.Filesystems/NILFS2.cs index 62efea008..4d2fcf0dd 100644 --- a/Aaru.Filesystems/NILFS2.cs +++ b/Aaru.Filesystems/NILFS2.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class NILFS2 : IFilesystem + public sealed class NILFS2 : IFilesystem { const ushort NILFS2_MAGIC = 0x3434; const uint NILFS2_SUPER_OFFSET = 1024; diff --git a/Aaru.Filesystems/NTFS.cs b/Aaru.Filesystems/NTFS.cs index 85e03f6b9..626707450 100644 --- a/Aaru.Filesystems/NTFS.cs +++ b/Aaru.Filesystems/NTFS.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { // Information from Inside Windows NT - public class NTFS : IFilesystem + public sealed class NTFS : IFilesystem { public FileSystemType XmlFsType { get; private set; } public Encoding Encoding { get; private set; } diff --git a/Aaru.Filesystems/Nintendo.cs b/Aaru.Filesystems/Nintendo.cs index 3c455e763..9b6b197fc 100644 --- a/Aaru.Filesystems/Nintendo.cs +++ b/Aaru.Filesystems/Nintendo.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.Filesystems { - public class NintendoPlugin : IFilesystem + public sealed class NintendoPlugin : IFilesystem { public FileSystemType XmlFsType { get; private set; } public Encoding Encoding { get; private set; } diff --git a/Aaru.Filesystems/ODS.cs b/Aaru.Filesystems/ODS.cs index bb89d049c..d65af6fbf 100644 --- a/Aaru.Filesystems/ODS.cs +++ b/Aaru.Filesystems/ODS.cs @@ -52,7 +52,7 @@ namespace Aaru.Filesystems // There is an ODS with signature "DECFILES11A", yet to be seen // Time is a 64 bit unsigned integer, tenths of microseconds since 1858/11/17 00:00:00. // TODO: Implement checksum - public class ODS : IFilesystem + public sealed class ODS : IFilesystem { public FileSystemType XmlFsType { get; private set; } public Encoding Encoding { get; private set; } diff --git a/Aaru.Filesystems/Opera/Consts.cs b/Aaru.Filesystems/Opera/Consts.cs index 9166e66ad..abf4bb613 100644 --- a/Aaru.Filesystems/Opera/Consts.cs +++ b/Aaru.Filesystems/Opera/Consts.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class OperaFS + public sealed partial class OperaFS { const string SYNC = "ZZZZZ"; const uint FLAGS_MASK = 0xFF; diff --git a/Aaru.Filesystems/Opera/Dir.cs b/Aaru.Filesystems/Opera/Dir.cs index ef5c12d36..718d49744 100644 --- a/Aaru.Filesystems/Opera/Dir.cs +++ b/Aaru.Filesystems/Opera/Dir.cs @@ -39,7 +39,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems { - public partial class OperaFS + public sealed partial class OperaFS { public Errno ReadDir(string path, out List contents) { diff --git a/Aaru.Filesystems/Opera/File.cs b/Aaru.Filesystems/Opera/File.cs index 52751a6a7..7f85b31d5 100644 --- a/Aaru.Filesystems/Opera/File.cs +++ b/Aaru.Filesystems/Opera/File.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.Filesystems { - public partial class OperaFS + public sealed partial class OperaFS { public Errno MapBlock(string path, long fileBlock, out long deviceBlock) { diff --git a/Aaru.Filesystems/Opera/Info.cs b/Aaru.Filesystems/Opera/Info.cs index 491670639..1a5def35b 100644 --- a/Aaru.Filesystems/Opera/Info.cs +++ b/Aaru.Filesystems/Opera/Info.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.Filesystems { - public partial class OperaFS + public sealed partial class OperaFS { public bool Identify(IMediaImage imagePlugin, Partition partition) { diff --git a/Aaru.Filesystems/Opera/Opera.cs b/Aaru.Filesystems/Opera/Opera.cs index 0710f1998..4facbcdc2 100644 --- a/Aaru.Filesystems/Opera/Opera.cs +++ b/Aaru.Filesystems/Opera/Opera.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.Filesystems { - public partial class OperaFS : IReadOnlyFilesystem + public sealed partial class OperaFS : IReadOnlyFilesystem { bool _debug; Dictionary> _directoryCache; diff --git a/Aaru.Filesystems/Opera/Structs.cs b/Aaru.Filesystems/Opera/Structs.cs index be18cde8b..c90940832 100644 --- a/Aaru.Filesystems/Opera/Structs.cs +++ b/Aaru.Filesystems/Opera/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.Filesystems { - public partial class OperaFS + public sealed partial class OperaFS { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SuperBlock diff --git a/Aaru.Filesystems/Opera/Super.cs b/Aaru.Filesystems/Opera/Super.cs index e41755943..c17effedc 100644 --- a/Aaru.Filesystems/Opera/Super.cs +++ b/Aaru.Filesystems/Opera/Super.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.Filesystems { - public partial class OperaFS + public sealed partial class OperaFS { public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, Dictionary options, string @namespace) @@ -48,8 +48,7 @@ namespace Aaru.Filesystems // TODO: Find correct default encoding Encoding = Encoding.ASCII; - if(options == null) - options = GetDefaultOptions(); + options ??= GetDefaultOptions(); if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out _debug); diff --git a/Aaru.Filesystems/PCEngine.cs b/Aaru.Filesystems/PCEngine.cs index 7f1215244..0f8f59607 100644 --- a/Aaru.Filesystems/PCEngine.cs +++ b/Aaru.Filesystems/PCEngine.cs @@ -38,7 +38,7 @@ using Schemas; namespace Aaru.Filesystems { - public class PCEnginePlugin : IFilesystem + public sealed class PCEnginePlugin : IFilesystem { public FileSystemType XmlFsType { get; private set; } public Encoding Encoding { get; private set; } diff --git a/Aaru.Filesystems/PCFX.cs b/Aaru.Filesystems/PCFX.cs index 688465e52..e0818156e 100644 --- a/Aaru.Filesystems/PCFX.cs +++ b/Aaru.Filesystems/PCFX.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { // Not a filesystem, more like an executable header - public class PCFX : IFilesystem + public sealed class PCFX : IFilesystem { const string IDENTIFIER = "PC-FX:Hu_CD-ROM "; public FileSystemType XmlFsType { get; private set; } diff --git a/Aaru.Filesystems/PFS.cs b/Aaru.Filesystems/PFS.cs index 4e30ff899..486879245 100644 --- a/Aaru.Filesystems/PFS.cs +++ b/Aaru.Filesystems/PFS.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class PFS : IFilesystem + public sealed class PFS : IFilesystem { /// Identifier for AFS (PFS v1) const uint AFS_DISK = 0x41465301; diff --git a/Aaru.Filesystems/ProDOS.cs b/Aaru.Filesystems/ProDOS.cs index 003b64c87..8555af97a 100644 --- a/Aaru.Filesystems/ProDOS.cs +++ b/Aaru.Filesystems/ProDOS.cs @@ -47,7 +47,7 @@ namespace Aaru.Filesystems { // Information from Apple ProDOS 8 Technical Reference [SuppressMessage("ReSharper", "UnusedMember.Local"), SuppressMessage("ReSharper", "UnusedType.Local")] - public class ProDOSPlugin : IFilesystem + public sealed class ProDOSPlugin : IFilesystem { const byte EMPTY_STORAGE_TYPE = 0x00; /// A file that occupies one block or less diff --git a/Aaru.Filesystems/QNX4.cs b/Aaru.Filesystems/QNX4.cs index d0eafae69..71937e043 100644 --- a/Aaru.Filesystems/QNX4.cs +++ b/Aaru.Filesystems/QNX4.cs @@ -44,7 +44,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedType.Local")] - public class QNX4 : IFilesystem + public sealed class QNX4 : IFilesystem { readonly byte[] _rootDirFname = { diff --git a/Aaru.Filesystems/QNX6.cs b/Aaru.Filesystems/QNX6.cs index 00cbf5714..845318b94 100644 --- a/Aaru.Filesystems/QNX6.cs +++ b/Aaru.Filesystems/QNX6.cs @@ -41,7 +41,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class QNX6 : IFilesystem + public sealed class QNX6 : IFilesystem { const uint QNX6_SUPER_BLOCK_SIZE = 0x1000; const uint QNX6_BOOT_BLOCKS_SIZE = 0x2000; diff --git a/Aaru.Filesystems/RBF.cs b/Aaru.Filesystems/RBF.cs index c4aaa0b2f..bc50315be 100644 --- a/Aaru.Filesystems/RBF.cs +++ b/Aaru.Filesystems/RBF.cs @@ -42,7 +42,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class RBF : IFilesystem + public sealed class RBF : IFilesystem { /// Magic number for OS-9. Same for OS-9000? const uint RBF_SYNC = 0x4372757A; diff --git a/Aaru.Filesystems/RT11.cs b/Aaru.Filesystems/RT11.cs index c1169a608..330225bf8 100644 --- a/Aaru.Filesystems/RT11.cs +++ b/Aaru.Filesystems/RT11.cs @@ -45,7 +45,7 @@ namespace Aaru.Filesystems { // Information from http://www.trailing-edge.com/~shoppa/rt11fs/ // TODO: Implement Radix-50 - public class RT11 : IFilesystem + public sealed class RT11 : IFilesystem { public FileSystemType XmlFsType { get; private set; } public Encoding Encoding { get; private set; } diff --git a/Aaru.Filesystems/ReFS.cs b/Aaru.Filesystems/ReFS.cs index ff9eca3b2..2740a45c0 100644 --- a/Aaru.Filesystems/ReFS.cs +++ b/Aaru.Filesystems/ReFS.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class ReFS : IFilesystem + public sealed class ReFS : IFilesystem { const uint FSRS = 0x53525346; readonly byte[] _signature = diff --git a/Aaru.Filesystems/Register.cs b/Aaru.Filesystems/Register.cs index 231fcfc03..1c54e25a7 100644 --- a/Aaru.Filesystems/Register.cs +++ b/Aaru.Filesystems/Register.cs @@ -44,7 +44,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.Filesystems { - public class Register : IPluginRegister + public sealed class Register : IPluginRegister { public List GetAllChecksumPlugins() => null; diff --git a/Aaru.Filesystems/Reiser.cs b/Aaru.Filesystems/Reiser.cs index 4d0444bc8..3175c9106 100644 --- a/Aaru.Filesystems/Reiser.cs +++ b/Aaru.Filesystems/Reiser.cs @@ -42,7 +42,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class Reiser : IFilesystem + public sealed class Reiser : IFilesystem { const uint REISER_SUPER_OFFSET = 0x10000; diff --git a/Aaru.Filesystems/Reiser4.cs b/Aaru.Filesystems/Reiser4.cs index 72ea76d10..3cf9df2f8 100644 --- a/Aaru.Filesystems/Reiser4.cs +++ b/Aaru.Filesystems/Reiser4.cs @@ -42,7 +42,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class Reiser4 : IFilesystem + public sealed class Reiser4 : IFilesystem { const uint REISER4_SUPER_OFFSET = 0x10000; diff --git a/Aaru.Filesystems/SFS.cs b/Aaru.Filesystems/SFS.cs index 0c3cf9e39..3411a2abf 100644 --- a/Aaru.Filesystems/SFS.cs +++ b/Aaru.Filesystems/SFS.cs @@ -41,7 +41,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class SFS : IFilesystem + public sealed class SFS : IFilesystem { /// Identifier for SFS v1 const uint SFS_MAGIC = 0x53465300; @@ -108,7 +108,7 @@ namespace Aaru.Filesystems if(rootBlock.bits.HasFlag(Flags.CaseSensitive)) sbInformation.AppendLine("Volume is case sensitive"); - if(rootBlock.bits.HasFlag(Flags.RecyledFolder)) + if(rootBlock.bits.HasFlag(Flags.RecycledFolder)) sbInformation.AppendLine("Volume moves deleted files to a recycled folder"); information = sbInformation.ToString(); @@ -126,7 +126,7 @@ namespace Aaru.Filesystems [Flags] enum Flags : byte { - RecyledFolder = 64, CaseSensitive = 128 + RecycledFolder = 64, CaseSensitive = 128 } [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Filesystems/SolarFS.cs b/Aaru.Filesystems/SolarFS.cs index 939a54d98..294e6ebd3 100644 --- a/Aaru.Filesystems/SolarFS.cs +++ b/Aaru.Filesystems/SolarFS.cs @@ -41,7 +41,7 @@ using Schemas; namespace Aaru.Filesystems { // Based on FAT's BPB, cannot find a FAT or directory - public class SolarFS : IFilesystem + public sealed class SolarFS : IFilesystem { public FileSystemType XmlFsType { get; private set; } public Encoding Encoding { get; private set; } diff --git a/Aaru.Filesystems/Squash.cs b/Aaru.Filesystems/Squash.cs index 7e78ca3ee..564ea976c 100644 --- a/Aaru.Filesystems/Squash.cs +++ b/Aaru.Filesystems/Squash.cs @@ -41,7 +41,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class Squash : IFilesystem + public sealed class Squash : IFilesystem { /// Identifier for Squash const uint SQUASH_MAGIC = 0x73717368; diff --git a/Aaru.Filesystems/SysV.cs b/Aaru.Filesystems/SysV.cs index 342ef5adb..3d9e2f643 100644 --- a/Aaru.Filesystems/SysV.cs +++ b/Aaru.Filesystems/SysV.cs @@ -46,7 +46,7 @@ namespace Aaru.Filesystems // Information from the Linux kernel [SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "UnusedMember.Local"), SuppressMessage("ReSharper", "UnusedType.Local")] - public class SysVfs : IFilesystem + public sealed class SysVfs : IFilesystem { const uint XENIX_MAGIC = 0x002B5544; const uint XENIX_CIGAM = 0x44552B00; diff --git a/Aaru.Filesystems/UCSDPascal/Consts.cs b/Aaru.Filesystems/UCSDPascal/Consts.cs index e8e9db649..c16fd052a 100644 --- a/Aaru.Filesystems/UCSDPascal/Consts.cs +++ b/Aaru.Filesystems/UCSDPascal/Consts.cs @@ -36,7 +36,7 @@ namespace Aaru.Filesystems.UCSDPascal { // Information from Call-A.P.P.L.E. Pascal Disk Directory Structure [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class PascalPlugin + public sealed partial class PascalPlugin { enum PascalFileKind : short { diff --git a/Aaru.Filesystems/UCSDPascal/Dir.cs b/Aaru.Filesystems/UCSDPascal/Dir.cs index 6cfa7eb93..cf831bc32 100644 --- a/Aaru.Filesystems/UCSDPascal/Dir.cs +++ b/Aaru.Filesystems/UCSDPascal/Dir.cs @@ -39,7 +39,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems.UCSDPascal { // Information from Call-A.P.P.L.E. Pascal Disk Directory Structure - public partial class PascalPlugin + public sealed partial class PascalPlugin { public Errno ReadDir(string path, out List contents) { diff --git a/Aaru.Filesystems/UCSDPascal/File.cs b/Aaru.Filesystems/UCSDPascal/File.cs index 6aaa2effc..4282c2f62 100644 --- a/Aaru.Filesystems/UCSDPascal/File.cs +++ b/Aaru.Filesystems/UCSDPascal/File.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.Filesystems.UCSDPascal { // Information from Call-A.P.P.L.E. Pascal Disk Directory Structure - public partial class PascalPlugin + public sealed partial class PascalPlugin { public Errno MapBlock(string path, long fileBlock, out long deviceBlock) { diff --git a/Aaru.Filesystems/UCSDPascal/Info.cs b/Aaru.Filesystems/UCSDPascal/Info.cs index d9fa1b8c2..1f6dc3394 100644 --- a/Aaru.Filesystems/UCSDPascal/Info.cs +++ b/Aaru.Filesystems/UCSDPascal/Info.cs @@ -43,7 +43,7 @@ using Encoding = System.Text.Encoding; namespace Aaru.Filesystems.UCSDPascal { // Information from Call-A.P.P.L.E. Pascal Disk Directory Structure - public partial class PascalPlugin + public sealed partial class PascalPlugin { public bool Identify(IMediaImage imagePlugin, Partition partition) { diff --git a/Aaru.Filesystems/UCSDPascal/Structs.cs b/Aaru.Filesystems/UCSDPascal/Structs.cs index 77b30f939..00ea8822c 100644 --- a/Aaru.Filesystems/UCSDPascal/Structs.cs +++ b/Aaru.Filesystems/UCSDPascal/Structs.cs @@ -36,7 +36,7 @@ namespace Aaru.Filesystems.UCSDPascal { // Information from Call-A.P.P.L.E. Pascal Disk Directory Structure [SuppressMessage("ReSharper", "NotAccessedField.Local")] - public partial class PascalPlugin + public sealed partial class PascalPlugin { struct PascalVolumeEntry { diff --git a/Aaru.Filesystems/UCSDPascal/Super.cs b/Aaru.Filesystems/UCSDPascal/Super.cs index c78db84ef..63ad49f84 100644 --- a/Aaru.Filesystems/UCSDPascal/Super.cs +++ b/Aaru.Filesystems/UCSDPascal/Super.cs @@ -43,7 +43,7 @@ using Encoding = System.Text.Encoding; namespace Aaru.Filesystems.UCSDPascal { // Information from Call-A.P.P.L.E. Pascal Disk Directory Structure - public partial class PascalPlugin + public sealed partial class PascalPlugin { public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, Dictionary options, string @namespace) @@ -51,8 +51,7 @@ namespace Aaru.Filesystems.UCSDPascal _device = imagePlugin; Encoding = encoding ?? new Apple2(); - if(options == null) - options = GetDefaultOptions(); + options ??= GetDefaultOptions(); if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out _debug); diff --git a/Aaru.Filesystems/UCSDPascal/UCSDPascal.cs b/Aaru.Filesystems/UCSDPascal/UCSDPascal.cs index dfef3b97b..b7f6eeeb8 100644 --- a/Aaru.Filesystems/UCSDPascal/UCSDPascal.cs +++ b/Aaru.Filesystems/UCSDPascal/UCSDPascal.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.Filesystems.UCSDPascal { // Information from Call-A.P.P.L.E. Pascal Disk Directory Structure - public partial class PascalPlugin : IReadOnlyFilesystem + public sealed partial class PascalPlugin : IReadOnlyFilesystem { byte[] _bootBlocks; byte[] _catalogBlocks; diff --git a/Aaru.Filesystems/UDF.cs b/Aaru.Filesystems/UDF.cs index 0b3d1b847..5af054fd0 100644 --- a/Aaru.Filesystems/UDF.cs +++ b/Aaru.Filesystems/UDF.cs @@ -46,7 +46,7 @@ namespace Aaru.Filesystems { // TODO: Detect bootable [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class UDF : IFilesystem + public sealed class UDF : IFilesystem { readonly byte[] _magic = { diff --git a/Aaru.Filesystems/UNICOS.cs b/Aaru.Filesystems/UNICOS.cs index 70d8db1ba..b51fb8b8f 100644 --- a/Aaru.Filesystems/UNICOS.cs +++ b/Aaru.Filesystems/UNICOS.cs @@ -51,7 +51,7 @@ using time_t = System.Int64; namespace Aaru.Filesystems { - public class UNICOS : IFilesystem + public sealed class UNICOS : IFilesystem { const int NC1_MAXPART = 64; const int NC1_MAXIREG = 4; diff --git a/Aaru.Filesystems/UNIXBFS.cs b/Aaru.Filesystems/UNIXBFS.cs index e791723c6..5106f3e76 100644 --- a/Aaru.Filesystems/UNIXBFS.cs +++ b/Aaru.Filesystems/UNIXBFS.cs @@ -41,7 +41,7 @@ using Schemas; namespace Aaru.Filesystems { // Information from the Linux kernel - public class BFS : IFilesystem + public sealed class BFS : IFilesystem { const uint BFS_MAGIC = 0x1BADFACE; diff --git a/Aaru.Filesystems/VMfs.cs b/Aaru.Filesystems/VMfs.cs index 350aa9bfb..618e8664c 100644 --- a/Aaru.Filesystems/VMfs.cs +++ b/Aaru.Filesystems/VMfs.cs @@ -44,7 +44,7 @@ namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "UnusedType.Local"), SuppressMessage("ReSharper", "IdentifierTypo"), SuppressMessage("ReSharper", "UnusedMember.Local")] - public class VMfs : IFilesystem + public sealed class VMfs : IFilesystem { /// Identifier for VMfs const uint VMFS_MAGIC = 0xC001D00D; diff --git a/Aaru.Filesystems/VxFS.cs b/Aaru.Filesystems/VxFS.cs index 9c108b0d3..17f731484 100644 --- a/Aaru.Filesystems/VxFS.cs +++ b/Aaru.Filesystems/VxFS.cs @@ -41,7 +41,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class VxFS : IFilesystem + public sealed class VxFS : IFilesystem { /// Identifier for VxFS const uint VXFS_MAGIC = 0xA501FCF5; diff --git a/Aaru.Filesystems/XFS.cs b/Aaru.Filesystems/XFS.cs index 056154798..e3e8b48e3 100644 --- a/Aaru.Filesystems/XFS.cs +++ b/Aaru.Filesystems/XFS.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Filesystems { - public class XFS : IFilesystem + public sealed class XFS : IFilesystem { const uint XFS_MAGIC = 0x58465342; diff --git a/Aaru.Filesystems/Xia.cs b/Aaru.Filesystems/Xia.cs index 4925b415b..b5e553d0f 100644 --- a/Aaru.Filesystems/Xia.cs +++ b/Aaru.Filesystems/Xia.cs @@ -44,7 +44,7 @@ namespace Aaru.Filesystems { // Information from the Linux kernel [SuppressMessage("ReSharper", "UnusedMember.Local"), SuppressMessage("ReSharper", "UnusedType.Local")] - public class Xia : IFilesystem + public sealed class Xia : IFilesystem { const uint XIAFS_SUPER_MAGIC = 0x012FD16D; const uint XIAFS_ROOT_INO = 1; diff --git a/Aaru.Filesystems/ZFS.cs b/Aaru.Filesystems/ZFS.cs index 147eb4b55..33c270cba 100644 --- a/Aaru.Filesystems/ZFS.cs +++ b/Aaru.Filesystems/ZFS.cs @@ -63,7 +63,7 @@ namespace Aaru.Filesystems */ [SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "UnusedType.Local"), SuppressMessage("ReSharper", "UnusedMember.Local"), SuppressMessage("ReSharper", "NotAccessedField.Local")] - public class ZFS : IFilesystem + public sealed class ZFS : IFilesystem { const ulong ZEC_MAGIC = 0x0210DA7AB10C7A11; const ulong ZEC_CIGAM = 0x117A0CB17ADA1002; diff --git a/Aaru.Filesystems/dump.cs b/Aaru.Filesystems/dump.cs index 9d5f4cfd9..c3409862a 100644 --- a/Aaru.Filesystems/dump.cs +++ b/Aaru.Filesystems/dump.cs @@ -45,7 +45,7 @@ using ufs_daddr_t = System.Int32; namespace Aaru.Filesystems { [SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "UnusedMember.Local")] - public class dump : IFilesystem + public sealed class dump : IFilesystem { /// Magic number for old dump const ushort OFS_MAGIC = 60011; diff --git a/Aaru.Filesystems/exFAT.cs b/Aaru.Filesystems/exFAT.cs index a483994a1..a94ba7299 100644 --- a/Aaru.Filesystems/exFAT.cs +++ b/Aaru.Filesystems/exFAT.cs @@ -44,7 +44,7 @@ namespace Aaru.Filesystems { // Information from https://www.sans.org/reading-room/whitepapers/forensics/reverse-engineering-microsoft-exfat-file-system-33274 [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class exFAT : IFilesystem + public sealed class exFAT : IFilesystem { readonly Guid _oemFlashParameterGuid = new Guid("0A0C7E46-3399-4021-90C8-FA6D389C4BA2"); diff --git a/Aaru.Filesystems/ext2FS.cs b/Aaru.Filesystems/ext2FS.cs index 72f027804..fd372c26c 100644 --- a/Aaru.Filesystems/ext2FS.cs +++ b/Aaru.Filesystems/ext2FS.cs @@ -44,7 +44,7 @@ namespace Aaru.Filesystems { // Information from the Linux kernel [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class ext2FS : IFilesystem + public sealed class ext2FS : IFilesystem { const int SB_POS = 0x400; diff --git a/Aaru.Filesystems/extFS.cs b/Aaru.Filesystems/extFS.cs index e551706e2..8e2bf80df 100644 --- a/Aaru.Filesystems/extFS.cs +++ b/Aaru.Filesystems/extFS.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.Filesystems { // Information from the Linux kernel - public class extFS : IFilesystem + public sealed class extFS : IFilesystem { const int SB_POS = 0x400; diff --git a/Aaru.Filters/AppleDouble.cs b/Aaru.Filters/AppleDouble.cs index b6d531659..355d60573 100644 --- a/Aaru.Filters/AppleDouble.cs +++ b/Aaru.Filters/AppleDouble.cs @@ -43,7 +43,7 @@ namespace Aaru.Filters { /// Decodes AppleDouble files [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class AppleDouble : IFilter + public sealed class AppleDouble : IFilter { const uint MAGIC = 0x00051607; const uint VERSION = 0x00010000; @@ -129,7 +129,7 @@ namespace Aaru.Filters string filenameNoExt = Path.GetFileNameWithoutExtension(path); string parentFolder = Path.GetDirectoryName(path); - parentFolder = parentFolder ?? ""; + parentFolder ??= ""; if(filename is null || filenameNoExt is null) @@ -316,7 +316,7 @@ namespace Aaru.Filters string filenameNoExt = Path.GetFileNameWithoutExtension(path); string parentFolder = Path.GetDirectoryName(path); - parentFolder = parentFolder ?? ""; + parentFolder ??= ""; if(filename is null || filenameNoExt is null) diff --git a/Aaru.Filters/AppleSingle.cs b/Aaru.Filters/AppleSingle.cs index 1d4fcea7e..4885bb65e 100644 --- a/Aaru.Filters/AppleSingle.cs +++ b/Aaru.Filters/AppleSingle.cs @@ -43,7 +43,7 @@ namespace Aaru.Filters { /// Decodes AppleSingle files [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class AppleSingle : IFilter + public sealed class AppleSingle : IFilter { const uint MAGIC = 0x00051600; const uint VERSION = 0x00010000; diff --git a/Aaru.Filters/ForcedSeekStream.cs b/Aaru.Filters/ForcedSeekStream.cs index 7679117dc..52eaf0237 100644 --- a/Aaru.Filters/ForcedSeekStream.cs +++ b/Aaru.Filters/ForcedSeekStream.cs @@ -39,7 +39,7 @@ namespace Aaru.Filters /// ForcedSeekStream allows to seek a forward-readable stream (like System.IO.Compression streams) by doing the /// slow and known trick of rewinding and forward reading until arriving the desired position. /// - public class ForcedSeekStream : Stream where T : Stream + public sealed class ForcedSeekStream : Stream where T : Stream { const int BUFFER_LEN = 1048576; readonly string _backFile; diff --git a/Aaru.Filters/GZip.cs b/Aaru.Filters/GZip.cs index 1b57e972a..576165f77 100644 --- a/Aaru.Filters/GZip.cs +++ b/Aaru.Filters/GZip.cs @@ -39,7 +39,7 @@ using Aaru.Helpers; namespace Aaru.Filters { /// Decompress gzip files while reading - public class GZip : IFilter + public sealed class GZip : IFilter { string _basePath; DateTime _creationTime; diff --git a/Aaru.Filters/LZip.cs b/Aaru.Filters/LZip.cs index a1b7d1e9a..a6f628d4b 100644 --- a/Aaru.Filters/LZip.cs +++ b/Aaru.Filters/LZip.cs @@ -39,7 +39,7 @@ using SharpCompress.Compressors.LZMA; namespace Aaru.Filters { /// Decompress lzip files while reading - public class LZip : IFilter + public sealed class LZip : IFilter { string _basePath; DateTime _creationTime; diff --git a/Aaru.Filters/MacBinary.cs b/Aaru.Filters/MacBinary.cs index 017c9a588..7176e5934 100644 --- a/Aaru.Filters/MacBinary.cs +++ b/Aaru.Filters/MacBinary.cs @@ -42,7 +42,7 @@ namespace Aaru.Filters { // TODO: Interpret fdScript /// Decodes MacBinary files - public class MacBinary : IFilter + public sealed class MacBinary : IFilter { const uint MAGIC = 0x6D42494E; string _basePath; diff --git a/Aaru.Filters/OffsetStream.cs b/Aaru.Filters/OffsetStream.cs index f9ca6cbc4..bb3bf512a 100644 --- a/Aaru.Filters/OffsetStream.cs +++ b/Aaru.Filters/OffsetStream.cs @@ -41,7 +41,7 @@ using Microsoft.Win32.SafeHandles; namespace Aaru.Filters { /// Creates a stream that is a subset of another stream. - public class OffsetStream : Stream + public sealed class OffsetStream : Stream { readonly Stream _baseStream; readonly long _streamEnd; @@ -354,7 +354,7 @@ namespace Aaru.Filters public override void Close() => _baseStream.Close(); - protected new void Dispose() + new void Dispose() { _baseStream.Dispose(); base.Dispose(); diff --git a/Aaru.Filters/PCExchange.cs b/Aaru.Filters/PCExchange.cs index df7db647e..a0f6de25c 100644 --- a/Aaru.Filters/PCExchange.cs +++ b/Aaru.Filters/PCExchange.cs @@ -45,7 +45,7 @@ namespace Aaru.Filters { /// Decodes PCExchange files [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class PcExchange : IFilter + public sealed class PcExchange : IFilter { const string FILE_ID = "FILEID.DAT"; const string FINDER_INFO = "FINDER.DAT"; @@ -97,7 +97,7 @@ namespace Aaru.Filters { string parentFolder = Path.GetDirectoryName(path); - parentFolder = parentFolder ?? ""; + parentFolder ??= ""; if(!File.Exists(Path.Combine(parentFolder, FINDER_INFO))) return false; @@ -165,7 +165,7 @@ namespace Aaru.Filters string parentFolder = Path.GetDirectoryName(path); string baseFilename = Path.GetFileName(path); - parentFolder = parentFolder ?? ""; + parentFolder ??= ""; var finderDatStream = new FileStream(Path.Combine(parentFolder, FINDER_INFO), FileMode.Open, FileAccess.Read); diff --git a/Aaru.Filters/XZ.cs b/Aaru.Filters/XZ.cs index 35c091fdf..722820c66 100644 --- a/Aaru.Filters/XZ.cs +++ b/Aaru.Filters/XZ.cs @@ -38,7 +38,7 @@ using SharpCompress.Compressors.Xz; namespace Aaru.Filters { /// Decompress xz files while reading - public class XZ : IFilter + public sealed class XZ : IFilter { string _basePath; DateTime _creationTime; diff --git a/Aaru.Filters/ZZZNoFilter.cs b/Aaru.Filters/ZZZNoFilter.cs index 2f0ede51b..553ff11f4 100644 --- a/Aaru.Filters/ZZZNoFilter.cs +++ b/Aaru.Filters/ZZZNoFilter.cs @@ -37,7 +37,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.Filters { /// No filter for reading files not recognized by any filter - public class ZZZNoFilter : IFilter + public sealed class ZZZNoFilter : IFilter { string _basePath; DateTime _creationTime; diff --git a/Aaru.Gui/App.xaml.cs b/Aaru.Gui/App.xaml.cs index b3832dd4d..d9047aa3f 100644 --- a/Aaru.Gui/App.xaml.cs +++ b/Aaru.Gui/App.xaml.cs @@ -43,7 +43,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui { - public class App : Application + public sealed class App : Application { public override void Initialize() => AvaloniaXamlLoader.Load(this); diff --git a/Aaru.Gui/ConsoleHandler.cs b/Aaru.Gui/ConsoleHandler.cs index 9ac33d231..d8d105ee7 100644 --- a/Aaru.Gui/ConsoleHandler.cs +++ b/Aaru.Gui/ConsoleHandler.cs @@ -34,6 +34,7 @@ using System; using System.Collections.ObjectModel; using Aaru.Console; +using JetBrains.Annotations; namespace Aaru.Gui { @@ -84,7 +85,7 @@ namespace Aaru.Gui AaruConsole.ErrorWriteLineEvent += OnErrorWriteHandler; } - static void OnWriteHandler(string format, params object[] arg) + static void OnWriteHandler([CanBeNull] string format, [CanBeNull] params object[] arg) { if(format == null || arg == null) @@ -99,7 +100,7 @@ namespace Aaru.Gui }); } - static void OnErrorWriteHandler(string format, params object[] arg) + static void OnErrorWriteHandler([CanBeNull] string format, [CanBeNull] params object[] arg) { if(format == null || arg == null) @@ -114,7 +115,7 @@ namespace Aaru.Gui }); } - static void OnVerboseWriteHandler(string format, params object[] arg) + static void OnVerboseWriteHandler([CanBeNull] string format, [CanBeNull] params object[] arg) { if(format == null || arg == null) @@ -129,7 +130,7 @@ namespace Aaru.Gui }); } - static void OnDebugWriteHandler(string module, string format, params object[] arg) + static void OnDebugWriteHandler(string module, [CanBeNull] string format, [CanBeNull] params object[] arg) { if(format == null || arg == null) @@ -145,7 +146,7 @@ namespace Aaru.Gui } } - public class LogEntry + public sealed class LogEntry { public string Message { get; set; } public string Module { get; set; } diff --git a/Aaru.Gui/Controls/BlockMap.cs b/Aaru.Gui/Controls/BlockMap.cs index fcb35fd21..c31612b20 100644 --- a/Aaru.Gui/Controls/BlockMap.cs +++ b/Aaru.Gui/Controls/BlockMap.cs @@ -40,6 +40,7 @@ using Avalonia.Media; using Avalonia.Media.Imaging; using Avalonia.Platform; using Avalonia.Threading; +using JetBrains.Annotations; namespace Aaru.Gui.Controls { @@ -47,7 +48,7 @@ namespace Aaru.Gui.Controls // TODO: React to size changes // TODO: Optimize block size to viewport // TODO: Writing one more than it should - public class BlockMap : ItemsControl + public sealed class BlockMap : ItemsControl { const int _blockSize = 15; public static readonly StyledProperty BlocksProperty = @@ -161,7 +162,7 @@ namespace Aaru.Gui.Controls set => SetValue(BlocksProperty, value); } - protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e) + protected override void OnPropertyChanged([NotNull] AvaloniaPropertyChangedEventArgs e) { base.OnPropertyChanged(e); @@ -219,7 +220,7 @@ namespace Aaru.Gui.Controls } } - public override void Render(DrawingContext context) + public override void Render([NotNull] DrawingContext context) { if((int?)_bitmap?.Size.Height != (int)Height || (int?)_bitmap?.Size.Width != (int)Width) @@ -233,7 +234,7 @@ namespace Aaru.Gui.Controls base.Render(context); } - protected override void ItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + protected override void ItemsCollectionChanged(object sender, [NotNull] NotifyCollectionChangedEventArgs e) { base.ItemsCollectionChanged(sender, e); @@ -377,7 +378,7 @@ namespace Aaru.Gui.Controls Dispatcher.UIThread.Post(InvalidateVisual, DispatcherPriority.Background); } - protected override void ItemsChanged(AvaloniaPropertyChangedEventArgs e) + protected override void ItemsChanged([NotNull] AvaloniaPropertyChangedEventArgs e) { if(e.NewValue != null && !(e.NewValue is IList<(ulong, double)>)) diff --git a/Aaru.Gui/Models/AssemblyModel.cs b/Aaru.Gui/Models/AssemblyModel.cs index a2475c1c6..f2846c0c0 100644 --- a/Aaru.Gui/Models/AssemblyModel.cs +++ b/Aaru.Gui/Models/AssemblyModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Gui.Models { - public class AssemblyModel + public sealed class AssemblyModel { public string Name { get; set; } public string Version { get; set; } diff --git a/Aaru.Gui/Models/ChecksumModel.cs b/Aaru.Gui/Models/ChecksumModel.cs index e83c1d90b..6f429a5cc 100644 --- a/Aaru.Gui/Models/ChecksumModel.cs +++ b/Aaru.Gui/Models/ChecksumModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Gui.Models { - public class ChecksumModel + public sealed class ChecksumModel { public string Track { get; set; } public string Algorithm { get; set; } diff --git a/Aaru.Gui/Models/DeviceModel.cs b/Aaru.Gui/Models/DeviceModel.cs index 44289b71f..5660d14c1 100644 --- a/Aaru.Gui/Models/DeviceModel.cs +++ b/Aaru.Gui/Models/DeviceModel.cs @@ -36,7 +36,7 @@ using Avalonia.Media.Imaging; namespace Aaru.Gui.Models { - public class DeviceModel + public sealed class DeviceModel { public DeviceModel() => Media = new ObservableCollection(); diff --git a/Aaru.Gui/Models/DeviceStatsModel.cs b/Aaru.Gui/Models/DeviceStatsModel.cs index b110cf8d8..f3256dbd8 100644 --- a/Aaru.Gui/Models/DeviceStatsModel.cs +++ b/Aaru.Gui/Models/DeviceStatsModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Gui.Models { - public class DeviceStatsModel + public sealed class DeviceStatsModel { public string Model { get; set; } public string Manufacturer { get; set; } diff --git a/Aaru.Gui/Models/DevicesRootModel.cs b/Aaru.Gui/Models/DevicesRootModel.cs index a75512bd1..0b436d6cd 100644 --- a/Aaru.Gui/Models/DevicesRootModel.cs +++ b/Aaru.Gui/Models/DevicesRootModel.cs @@ -34,7 +34,7 @@ using System.Collections.ObjectModel; namespace Aaru.Gui.Models { - public class DevicesRootModel : RootModel + public sealed class DevicesRootModel : RootModel { public DevicesRootModel() => Devices = new ObservableCollection(); diff --git a/Aaru.Gui/Models/DumpHardwareModel.cs b/Aaru.Gui/Models/DumpHardwareModel.cs index b7d0ebc3f..a4fcb96d0 100644 --- a/Aaru.Gui/Models/DumpHardwareModel.cs +++ b/Aaru.Gui/Models/DumpHardwareModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Gui.Models { - public class DumpHardwareModel + public sealed class DumpHardwareModel { public string Manufacturer { get; set; } diff --git a/Aaru.Gui/Models/EncodingModel.cs b/Aaru.Gui/Models/EncodingModel.cs index fa3b345e0..f7119cdd1 100644 --- a/Aaru.Gui/Models/EncodingModel.cs +++ b/Aaru.Gui/Models/EncodingModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Gui.Models { - public class EncodingModel + public sealed class EncodingModel { public string Name { get; set; } public string DisplayName { get; set; } diff --git a/Aaru.Gui/Models/FileModel.cs b/Aaru.Gui/Models/FileModel.cs index 7ae2c8858..ac46b09d9 100644 --- a/Aaru.Gui/Models/FileModel.cs +++ b/Aaru.Gui/Models/FileModel.cs @@ -32,23 +32,36 @@ using System; using Aaru.CommonTypes.Structs; +using JetBrains.Annotations; namespace Aaru.Gui.Models { - public class FileModel + public sealed class FileModel { public string Name { get; set; } + [NotNull] public string Size => $"{Stat.Length}"; + [NotNull] public string CreationTime => Stat.CreationTime == default(DateTime) ? "" : $"{Stat.CreationTime:G}"; + [NotNull] public string LastAccessTime => Stat.AccessTime == default(DateTime) ? "" : $"{Stat.AccessTime:G}"; + [NotNull] public string ChangedTime => Stat.StatusChangeTime == default(DateTime) ? "" : $"{Stat.StatusChangeTime:G}"; + [NotNull] public string LastBackupTime => Stat.BackupTime == default(DateTime) ? "" : $"{Stat.BackupTime:G}"; + [NotNull] public string LastWriteTime => Stat.LastWriteTime == default(DateTime) ? "" : $"{Stat.LastWriteTime:G}"; + [NotNull] public string Attributes => $"{Stat.Attributes}"; + [NotNull] public string Gid => $"{Stat.GID}"; + [NotNull] public string Uid => $"{Stat.UID}"; + [NotNull] public string Inode => $"{Stat.Inode}"; + [NotNull] public string Links => $"{Stat.Links}"; + [NotNull] public string Mode => $"{Stat.Mode}"; public FileEntryInfo Stat { get; set; } } diff --git a/Aaru.Gui/Models/FileSystemModel.cs b/Aaru.Gui/Models/FileSystemModel.cs index f27ba775d..328f7fe0f 100644 --- a/Aaru.Gui/Models/FileSystemModel.cs +++ b/Aaru.Gui/Models/FileSystemModel.cs @@ -36,7 +36,7 @@ using Aaru.Gui.ViewModels.Panels; namespace Aaru.Gui.Models { - public class FileSystemModel : RootModel + public sealed class FileSystemModel : RootModel { public FileSystemModel() => Roots = new ObservableCollection(); diff --git a/Aaru.Gui/Models/ImageModel.cs b/Aaru.Gui/Models/ImageModel.cs index 0a830629e..511d3e7dd 100644 --- a/Aaru.Gui/Models/ImageModel.cs +++ b/Aaru.Gui/Models/ImageModel.cs @@ -37,7 +37,7 @@ using Avalonia.Media.Imaging; namespace Aaru.Gui.Models { - public class ImageModel + public sealed class ImageModel { public ImageModel() => PartitionSchemesOrFileSystems = new ObservableCollection(); diff --git a/Aaru.Gui/Models/ImagePluginModel.cs b/Aaru.Gui/Models/ImagePluginModel.cs index eb36e3eba..a08851e73 100644 --- a/Aaru.Gui/Models/ImagePluginModel.cs +++ b/Aaru.Gui/Models/ImagePluginModel.cs @@ -34,7 +34,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.Gui.Models { - public class ImagePluginModel + public sealed class ImagePluginModel { public string Name => Plugin.Name; public IWritableImage Plugin { get; set; } diff --git a/Aaru.Gui/Models/ImagesRootModel.cs b/Aaru.Gui/Models/ImagesRootModel.cs index f20f0ccd4..93ee094e3 100644 --- a/Aaru.Gui/Models/ImagesRootModel.cs +++ b/Aaru.Gui/Models/ImagesRootModel.cs @@ -34,7 +34,7 @@ using System.Collections.ObjectModel; namespace Aaru.Gui.Models { - public class ImagesRootModel : RootModel + public sealed class ImagesRootModel : RootModel { public ImagesRootModel() => Images = new ObservableCollection(); diff --git a/Aaru.Gui/Models/IsrcModel.cs b/Aaru.Gui/Models/IsrcModel.cs index bfa88d72f..c9ae03bd8 100644 --- a/Aaru.Gui/Models/IsrcModel.cs +++ b/Aaru.Gui/Models/IsrcModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Gui.Models { - public class IsrcModel + public sealed class IsrcModel { public string Track { get; set; } public string Isrc { get; set; } diff --git a/Aaru.Gui/Models/LbaModel.cs b/Aaru.Gui/Models/LbaModel.cs index 16efb0576..6ebe5dc71 100644 --- a/Aaru.Gui/Models/LbaModel.cs +++ b/Aaru.Gui/Models/LbaModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Gui.Models { - public class LbaModel + public sealed class LbaModel { public string Lba { get; set; } } diff --git a/Aaru.Gui/Models/MediaModel.cs b/Aaru.Gui/Models/MediaModel.cs index d742bfbe2..a692502ef 100644 --- a/Aaru.Gui/Models/MediaModel.cs +++ b/Aaru.Gui/Models/MediaModel.cs @@ -35,7 +35,7 @@ using Avalonia.Media.Imaging; namespace Aaru.Gui.Models { - public class MediaModel + public sealed class MediaModel { public Bitmap Icon { get; set; } public string Name { get; set; } diff --git a/Aaru.Gui/Models/MediaStatsModel.cs b/Aaru.Gui/Models/MediaStatsModel.cs index 2f7ef74a0..41bab222d 100644 --- a/Aaru.Gui/Models/MediaStatsModel.cs +++ b/Aaru.Gui/Models/MediaStatsModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Gui.Models { - public class MediaStatsModel + public sealed class MediaStatsModel { public string Name { get; set; } public ulong Count { get; set; } diff --git a/Aaru.Gui/Models/MediaTagModel.cs b/Aaru.Gui/Models/MediaTagModel.cs index 066743e54..99c53a235 100644 --- a/Aaru.Gui/Models/MediaTagModel.cs +++ b/Aaru.Gui/Models/MediaTagModel.cs @@ -31,14 +31,16 @@ // ****************************************************************************/ using Aaru.CommonTypes.Enums; +using JetBrains.Annotations; namespace Aaru.Gui.Models { - public class MediaTagModel + public sealed class MediaTagModel { public MediaTagType Tag { get; set; } public byte[] Data { get; set; } public string Decoded { get; set; } - public string Name => Tag.ToString(); + [NotNull] + public string Name => Tag.ToString(); } } \ No newline at end of file diff --git a/Aaru.Gui/Models/NameCountModel.cs b/Aaru.Gui/Models/NameCountModel.cs index f754fac10..b830022e0 100644 --- a/Aaru.Gui/Models/NameCountModel.cs +++ b/Aaru.Gui/Models/NameCountModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Gui.Models { - public class NameCountModel + public sealed class NameCountModel { public string Name { get; set; } public ulong Count { get; set; } diff --git a/Aaru.Gui/Models/PartitionModel.cs b/Aaru.Gui/Models/PartitionModel.cs index 4729a4812..e9c664bee 100644 --- a/Aaru.Gui/Models/PartitionModel.cs +++ b/Aaru.Gui/Models/PartitionModel.cs @@ -37,7 +37,7 @@ using Avalonia.Media.Imaging; namespace Aaru.Gui.Models { - public class PartitionModel + public sealed class PartitionModel { public PartitionModel() => FileSystems = new ObservableCollection(); diff --git a/Aaru.Gui/Models/PartitionSchemeModel.cs b/Aaru.Gui/Models/PartitionSchemeModel.cs index f5ab68244..bb26c7c9b 100644 --- a/Aaru.Gui/Models/PartitionSchemeModel.cs +++ b/Aaru.Gui/Models/PartitionSchemeModel.cs @@ -35,7 +35,7 @@ using Avalonia.Media.Imaging; namespace Aaru.Gui.Models { - public class PartitionSchemeModel : RootModel + public sealed class PartitionSchemeModel : RootModel { public PartitionSchemeModel() => Partitions = new ObservableCollection(); diff --git a/Aaru.Gui/Models/PcmciaCisModel.cs b/Aaru.Gui/Models/PcmciaCisModel.cs index a3cf7aa82..be0efdc1f 100644 --- a/Aaru.Gui/Models/PcmciaCisModel.cs +++ b/Aaru.Gui/Models/PcmciaCisModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Gui.Models { - public class PcmciaCisModel + public sealed class PcmciaCisModel { public string Code { get; set; } public string Description { get; set; } diff --git a/Aaru.Gui/Models/PluginModel.cs b/Aaru.Gui/Models/PluginModel.cs index 2874ade82..71e123a23 100644 --- a/Aaru.Gui/Models/PluginModel.cs +++ b/Aaru.Gui/Models/PluginModel.cs @@ -34,7 +34,7 @@ using System; namespace Aaru.Gui.Models { - public class PluginModel + public sealed class PluginModel { public string Name { get; set; } public Guid Uuid { get; set; } diff --git a/Aaru.Gui/Models/ScsiPageModel.cs b/Aaru.Gui/Models/ScsiPageModel.cs index 098509733..446026633 100644 --- a/Aaru.Gui/Models/ScsiPageModel.cs +++ b/Aaru.Gui/Models/ScsiPageModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Gui.Models { - public class ScsiPageModel + public sealed class ScsiPageModel { public byte[] Data; public string Page { get; set; } diff --git a/Aaru.Gui/Models/SubdirectoryModel.cs b/Aaru.Gui/Models/SubdirectoryModel.cs index 02ea9f74f..602c30dc5 100644 --- a/Aaru.Gui/Models/SubdirectoryModel.cs +++ b/Aaru.Gui/Models/SubdirectoryModel.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.Gui.Models { - public class SubdirectoryModel + public sealed class SubdirectoryModel { public SubdirectoryModel() => Subdirectories = new ObservableCollection(); diff --git a/Aaru.Gui/Models/TrackEntropyModel.cs b/Aaru.Gui/Models/TrackEntropyModel.cs index 89165e286..3918093ef 100644 --- a/Aaru.Gui/Models/TrackEntropyModel.cs +++ b/Aaru.Gui/Models/TrackEntropyModel.cs @@ -32,7 +32,7 @@ namespace Aaru.Gui.Models { - public class TrackEntropyModel + public sealed class TrackEntropyModel { public string Track { get; set; } public string Entropy { get; set; } diff --git a/Aaru.Gui/ResourceHandler.cs b/Aaru.Gui/ResourceHandler.cs index 6105014eb..1e81620c5 100644 --- a/Aaru.Gui/ResourceHandler.cs +++ b/Aaru.Gui/ResourceHandler.cs @@ -32,12 +32,14 @@ using System.IO; using System.Reflection; +using JetBrains.Annotations; namespace Aaru.Gui { internal static class ResourceHandler { - internal static Stream GetResourceStream(string resourcePath) => + [CanBeNull] + internal static Stream GetResourceStream([NotNull] string resourcePath) => Assembly.GetExecutingAssembly().GetManifestResourceStream(resourcePath); } } \ No newline at end of file diff --git a/Aaru.Gui/ViewLocator.cs b/Aaru.Gui/ViewLocator.cs index 850993e2b..d4689a442 100644 --- a/Aaru.Gui/ViewLocator.cs +++ b/Aaru.Gui/ViewLocator.cs @@ -34,14 +34,16 @@ using System; using Aaru.Gui.ViewModels; using Avalonia.Controls; using Avalonia.Controls.Templates; +using JetBrains.Annotations; namespace Aaru.Gui { - public class ViewLocator : IDataTemplate + public sealed class ViewLocator : IDataTemplate { public bool SupportsRecycling => false; - public IControl Build(object data) + [CanBeNull] + public IControl Build([NotNull] object data) { string name = data.GetType().FullName?.Replace("ViewModel", "View"); diff --git a/Aaru.Gui/ViewModels/Dialogs/AboutViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/AboutViewModel.cs index fcbfbe3e6..3bc7a3750 100644 --- a/Aaru.Gui/ViewModels/Dialogs/AboutViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/AboutViewModel.cs @@ -39,12 +39,13 @@ using System.Reflection; using System.Threading.Tasks; using Aaru.Gui.Models; using Aaru.Gui.Views.Dialogs; +using JetBrains.Annotations; using Microsoft.DotNet.PlatformAbstractions; using ReactiveUI; namespace Aaru.Gui.ViewModels.Dialogs { - public class AboutViewModel : ViewModelBase + public sealed class AboutViewModel : ViewModelBase { readonly About _view; string _versionText; @@ -67,7 +68,7 @@ namespace Aaru.Gui.ViewModels.Dialogs { foreach(Assembly assembly in AppDomain.CurrentDomain.GetAssemblies().OrderBy(a => a.FullName)) { - string? name = assembly.GetName().Name; + string name = assembly.GetName().Name; string version = (Attribute.GetCustomAttribute(assembly, typeof(AssemblyInformationalVersionAttribute)) as @@ -86,18 +87,31 @@ namespace Aaru.Gui.ViewModels.Dialogs }); } - public string AboutLabel => "About"; - public string LibrariesLabel => "Libraries"; - public string AuthorsLabel => "Authors"; - public string Title => "About Aaru"; - public string SoftwareName => "Aaru"; - public string SuiteName => "Aaru Data Preservation Suite"; - public string Copyright => "© 2011-2020 Natalia Portillo"; - public string Website => "https://aaru.app"; - public string License => "License: GNU General Public License Version 3"; - public string CloseLabel => "Close"; + [NotNull] + public string AboutLabel => "About"; + [NotNull] + public string LibrariesLabel => "Libraries"; + [NotNull] + public string AuthorsLabel => "Authors"; + [NotNull] + public string Title => "About Aaru"; + [NotNull] + public string SoftwareName => "Aaru"; + [NotNull] + public string SuiteName => "Aaru Data Preservation Suite"; + [NotNull] + public string Copyright => "© 2011-2020 Natalia Portillo"; + [NotNull] + public string Website => "https://aaru.app"; + [NotNull] + public string License => "License: GNU General Public License Version 3"; + [NotNull] + public string CloseLabel => "Close"; + [NotNull] public string AssembliesLibraryText => "Library"; + [NotNull] public string AssembliesVersionText => "Version"; + [NotNull] public string Authors => @"Developers: Natalia Portillo Michael Drüing diff --git a/Aaru.Gui/ViewModels/Dialogs/ConsoleViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/ConsoleViewModel.cs index f5b887f8f..d4cdd159f 100644 --- a/Aaru.Gui/ViewModels/Dialogs/ConsoleViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/ConsoleViewModel.cs @@ -39,6 +39,7 @@ using System.Reflection; using Aaru.CommonTypes.Interop; using Aaru.Console; using Avalonia.Controls; +using JetBrains.Annotations; using MessageBox.Avalonia; using MessageBox.Avalonia.Enums; using ReactiveUI; @@ -47,7 +48,7 @@ using Version = Aaru.CommonTypes.Interop.Version; namespace Aaru.Gui.ViewModels.Dialogs { - public class ConsoleViewModel : ViewModelBase + public sealed class ConsoleViewModel : ViewModelBase { readonly Views.Dialogs.Console _view; bool _debugChecked; @@ -59,13 +60,17 @@ namespace Aaru.Gui.ViewModels.Dialogs ClearCommand = ReactiveCommand.Create(ExecuteClearCommand); } - public string Title => "Console"; + [NotNull] + public string Title => "Console"; public ReactiveCommand ClearCommand { get; } public ReactiveCommand SaveCommand { get; } public ObservableCollection Entries => ConsoleHandler.Entries; - public string DebugText => "Enable debug console"; - public string SaveLabel => "Save"; - public string ClearLabel => "Clear"; + [NotNull] + public string DebugText => "Enable debug console"; + [NotNull] + public string SaveLabel => "Save"; + [NotNull] + public string ClearLabel => "Clear"; public bool DebugChecked { diff --git a/Aaru.Gui/ViewModels/Dialogs/EncodingsViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/EncodingsViewModel.cs index 2f033a492..99dfc6f0b 100644 --- a/Aaru.Gui/ViewModels/Dialogs/EncodingsViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/EncodingsViewModel.cs @@ -38,11 +38,12 @@ using System.Text; using System.Threading.Tasks; using Aaru.Gui.Models; using Aaru.Gui.Views.Dialogs; +using JetBrains.Annotations; using ReactiveUI; namespace Aaru.Gui.ViewModels.Dialogs { - public class EncodingsViewModel : ViewModelBase + public sealed class EncodingsViewModel : ViewModelBase { readonly Encodings _view; @@ -71,8 +72,10 @@ namespace Aaru.Gui.ViewModels.Dialogs }); } - public string Title => "Encodings"; - public string CloseLabel => "Close"; + [NotNull] + public string Title => "Encodings"; + [NotNull] + public string CloseLabel => "Close"; public ReactiveCommand CloseCommand { get; } public ObservableCollection Encodings { get; } diff --git a/Aaru.Gui/ViewModels/Dialogs/LicenseViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/LicenseViewModel.cs index ee488c5c2..e4d7ed0bd 100644 --- a/Aaru.Gui/ViewModels/Dialogs/LicenseViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/LicenseViewModel.cs @@ -34,11 +34,12 @@ using System.IO; using System.Reactive; using System.Reflection; using Aaru.Gui.Views.Dialogs; +using JetBrains.Annotations; using ReactiveUI; namespace Aaru.Gui.ViewModels.Dialogs { - public class LicenseViewModel : ViewModelBase + public sealed class LicenseViewModel : ViewModelBase { readonly LicenseDialog _view; string _versionText; @@ -48,15 +49,20 @@ namespace Aaru.Gui.ViewModels.Dialogs _view = view; CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand); - using(Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Aaru.Gui.LICENSE")) - using(var reader = new StreamReader(stream)) - { - LicenseText = reader.ReadToEnd(); - } + using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Aaru.Gui.LICENSE"); + + if(stream == null) + return; + + using var reader = new StreamReader(stream); + + LicenseText = reader.ReadToEnd(); } - public string Title => "Aaru's license"; - public string CloseLabel => "Close"; + [NotNull] + public string Title => "Aaru's license"; + [NotNull] + public string CloseLabel => "Close"; public string LicenseText { get; } public ReactiveCommand CloseCommand { get; } diff --git a/Aaru.Gui/ViewModels/Dialogs/PluginsViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/PluginsViewModel.cs index d04e2d5a8..ae2e462a4 100644 --- a/Aaru.Gui/ViewModels/Dialogs/PluginsViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/PluginsViewModel.cs @@ -37,12 +37,12 @@ using Aaru.CommonTypes.Interfaces; using Aaru.Core; using Aaru.Gui.Models; using Aaru.Gui.Views.Dialogs; -using Aaru.Partitions; +using JetBrains.Annotations; using ReactiveUI; namespace Aaru.Gui.ViewModels.Dialogs { - public class PluginsViewModel : ViewModelBase + public sealed class PluginsViewModel : ViewModelBase { readonly PluginsDialog _view; @@ -133,16 +133,26 @@ namespace Aaru.Gui.ViewModels.Dialogs }); } - public string Title => "Plugins"; - public string FiltersLabel => "Filters"; - public string PartitionsLabel => "Partitions"; - public string FilesystemsLabel => "Filesystems"; - public string IdentifyLabel => "Identify only:"; - public string ImagesLabel => "Media images"; - public string FloppyImagesLabel => "Floppy images"; - public string ReadableLabel => "Readable:"; - public string WritableLabel => "Writable:"; - public string CloseLabel => "Close"; + [NotNull] + public string Title => "Plugins"; + [NotNull] + public string FiltersLabel => "Filters"; + [NotNull] + public string PartitionsLabel => "Partitions"; + [NotNull] + public string FilesystemsLabel => "Filesystems"; + [NotNull] + public string IdentifyLabel => "Identify only:"; + [NotNull] + public string ImagesLabel => "Media images"; + [NotNull] + public string FloppyImagesLabel => "Floppy images"; + [NotNull] + public string ReadableLabel => "Readable:"; + [NotNull] + public string WritableLabel => "Writable:"; + [NotNull] + public string CloseLabel => "Close"; public ReactiveCommand CloseCommand { get; } public ObservableCollection Filters { get; } public ObservableCollection PartitionSchemes { get; } diff --git a/Aaru.Gui/ViewModels/Dialogs/SettingsViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/SettingsViewModel.cs index 765a28036..52b3737d9 100644 --- a/Aaru.Gui/ViewModels/Dialogs/SettingsViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/SettingsViewModel.cs @@ -33,11 +33,12 @@ using System.Reactive; using Aaru.Gui.Views.Dialogs; using Aaru.Settings; +using JetBrains.Annotations; using ReactiveUI; namespace Aaru.Gui.ViewModels.Dialogs { - public class SettingsViewModel : ViewModelBase + public sealed class SettingsViewModel : ViewModelBase { readonly SettingsDialog _view; bool _commandStatsChecked; @@ -88,26 +89,36 @@ namespace Aaru.Gui.ViewModels.Dialogs } // TODO: Show Preferences in macOS - public string Title => "Settings"; - public string GdprLabel => "GDPR"; - public string ReportsLabel => "Reports"; + [NotNull] + public string Title => "Settings"; + [NotNull] + public string GdprLabel => "GDPR"; + [NotNull] + public string ReportsLabel => "Reports"; + [NotNull] public string StatisticsLabel => "Statistics"; - public string SaveLabel => "Save"; - public string CancelLabel => "Cancel"; + [NotNull] + public string SaveLabel => "Save"; + [NotNull] + public string CancelLabel => "Cancel"; + [NotNull] public string GdprText1 => @"In compliance with the European Union General Data Protection Regulation 2016/679 (GDPR), we must give you the following information about Aaru and ask if you want to opt-in in some information sharing."; + [NotNull] public string GdprText2 => @"Disclaimer: Because Aaru is an open source software this information, and therefore, compliance with GDPR only holds true if you obtained a certificated copy from its original authors. In case of doubt, close Aaru now and ask in our IRC support channel."; + [NotNull] public string GdprText3 => @"For any information sharing your IP address may be stored in our server, in a way that is not possible for any person, manual, or automated process, to link with your identity, unless specified otherwise."; + [NotNull] public string ReportsGloballyText => @"With the 'device-report' command, Aaru creates a report of a device, that includes its manufacturer, model, firmware revision and/or version, attached bus, size, and supported commands. @@ -117,33 +128,48 @@ the device serial number in non-standard places that prevent the automatic remov of devices. A human-readable copy of the report in XML format is always created in the same directory where Aaru is being run from."; + [NotNull] public string SaveReportsGloballyText => "Save device reports in shared folder of your computer?"; + [NotNull] public string ReportsText => @"Sharing a report with us will send it to our server, that's in the european union territory, where it -will be manually analized by an european union citizen to remove any trace of personal identification +will be manually analyzed by an european union citizen to remove any trace of personal identification from it. Once that is done, it will be shared in our stats website, https://www.aaru.app These report will be used to improve Aaru support, and in some cases, to provide emulation of the devices to other open-source projects. In any case, no information linking the report to you will be stored."; + [NotNull] public string ShareReportsText => "Share your device reports with us?"; + [NotNull] public string StatisticsText => @"Aaru can store some usage statistics. These statistics are limited to the number of times a command is executed, a filesystem, partition, or device is used, the operating system version, and other. In no case, any information besides pure statistical usage numbers is stored, and they're just joint to the pool with no way of using them to identify you."; - public string SaveStatsText => "Save stats about your Aaru usage?"; - public string ShareStatsText => "Share your stats anonymously?"; - public string CommandStatsText => "Gather statistics about command usage?"; - public string DeviceStatsText => "Gather statistics about found devices?"; + [NotNull] + public string SaveStatsText => "Save stats about your Aaru usage?"; + [NotNull] + public string ShareStatsText => "Share your stats anonymously?"; + [NotNull] + public string CommandStatsText => "Gather statistics about command usage?"; + [NotNull] + public string DeviceStatsText => "Gather statistics about found devices?"; + [NotNull] public string FilesystemStatsText => "Gather statistics about found filesystems?"; - public string FilterStatsText => "Gather statistics about found file filters?"; + [NotNull] + public string FilterStatsText => "Gather statistics about found file filters?"; + [NotNull] public string MediaImageStatsText => "Gather statistics about found media image formats?"; - public string MediaScanStatsText => "Gather statistics about scanned media?"; - public string PartitionStatsText => "Gather statistics about found partitioning schemes?"; - public string MediaStatsText => "Gather statistics about media types?"; - public string VerifyStatsText => "Gather statistics about media image verifications?"; + [NotNull] + public string MediaScanStatsText => "Gather statistics about scanned media?"; + [NotNull] + public string PartitionStatsText => "Gather statistics about found partitioning schemes?"; + [NotNull] + public string MediaStatsText => "Gather statistics about media types?"; + [NotNull] + public string VerifyStatsText => "Gather statistics about media image verifications?"; public ReactiveCommand CancelCommand { get; } public ReactiveCommand SaveCommand { get; } diff --git a/Aaru.Gui/ViewModels/Dialogs/StatisticsViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/StatisticsViewModel.cs index 5dfeee98c..8c873c702 100644 --- a/Aaru.Gui/ViewModels/Dialogs/StatisticsViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/StatisticsViewModel.cs @@ -37,11 +37,13 @@ using Aaru.Database; using Aaru.Database.Models; using Aaru.Gui.Models; using Aaru.Gui.Views.Dialogs; +using JetBrains.Annotations; using ReactiveUI; +using NameCountModel = Aaru.Gui.Models.NameCountModel; namespace Aaru.Gui.ViewModels.Dialogs { - public class StatisticsViewModel : ViewModelBase + public sealed class StatisticsViewModel : ViewModelBase { readonly StatisticsDialog _view; @@ -643,33 +645,53 @@ namespace Aaru.Gui.ViewModels.Dialogs set => this.RaiseAndSetIfChanged(ref _mediasVisible, value); } - public string CommandsLabel => "Commands"; - public string FilterLabel => "Filter"; - public string PartitionLabel => "Partition"; - public string PartitionsLabel => "Partitions"; - public string FiltersLabel => "Filters"; - public string FormatsLabel => "Formats"; - public string FormatLabel => "Format"; - public string FilesystemsLabel => "Filesystems"; - public string FilesystemLabel => "Filesystem"; - public string TimesFoundLabel => "Times found"; - public string DevicesLabel => "Devices"; - public string DeviceLabel => "Device"; - public string ManufacturerLabel => "Manufacturer"; - public string RevisionLabel => "Revision"; - public string BusLabel => "Bus"; - public string MediasLabel => "Medias"; - public string MediaLabel => "Media"; - public string TypeLabel => "Type"; - public string Title => "Encodings"; - public string CloseLabel => "Close"; - public ReactiveCommand CloseCommand { get; } - public ObservableCollection Filters { get; } - public ObservableCollection Formats { get; } - public ObservableCollection Partitions { get; } - public ObservableCollection Filesystems { get; } - public ObservableCollection Devices { get; } - public ObservableCollection Medias { get; } + [NotNull] + public string CommandsLabel => "Commands"; + [NotNull] + public string FilterLabel => "Filter"; + [NotNull] + public string PartitionLabel => "Partition"; + [NotNull] + public string PartitionsLabel => "Partitions"; + [NotNull] + public string FiltersLabel => "Filters"; + [NotNull] + public string FormatsLabel => "Formats"; + [NotNull] + public string FormatLabel => "Format"; + [NotNull] + public string FilesystemsLabel => "Filesystems"; + [NotNull] + public string FilesystemLabel => "Filesystem"; + [NotNull] + public string TimesFoundLabel => "Times found"; + [NotNull] + public string DevicesLabel => "Devices"; + [NotNull] + public string DeviceLabel => "Device"; + [NotNull] + public string ManufacturerLabel => "Manufacturer"; + [NotNull] + public string RevisionLabel => "Revision"; + [NotNull] + public string BusLabel => "Bus"; + [NotNull] + public string MediasLabel => "Medias"; + [NotNull] + public string MediaLabel => "Media"; + [NotNull] + public string TypeLabel => "Type"; + [NotNull] + public string Title => "Encodings"; + [NotNull] + public string CloseLabel => "Close"; + public ReactiveCommand CloseCommand { get; } + public ObservableCollection Filters { get; } + public ObservableCollection Formats { get; } + public ObservableCollection Partitions { get; } + public ObservableCollection Filesystems { get; } + public ObservableCollection Devices { get; } + public ObservableCollection Medias { get; } void ExecuteCloseCommand() => _view.Close(); } diff --git a/Aaru.Gui/ViewModels/Panels/DeviceInfoViewModel.cs b/Aaru.Gui/ViewModels/Panels/DeviceInfoViewModel.cs index fc71a707a..ddbab452a 100644 --- a/Aaru.Gui/ViewModels/Panels/DeviceInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/DeviceInfoViewModel.cs @@ -44,10 +44,10 @@ using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo; namespace Aaru.Gui.ViewModels.Panels { - public class DeviceInfoViewModel : ViewModelBase + public sealed class DeviceInfoViewModel : ViewModelBase { + readonly DeviceInfo _devInfo; readonly Window _view; - readonly DeviceInfo devInfo; AtaInfo _ataInfo; string _blockLimits; string _blockSizeGranularity; @@ -142,8 +142,7 @@ namespace Aaru.Gui.ViewModels.Panels { SaveUsbDescriptorsCommand = ReactiveCommand.Create(ExecuteSaveUsbDescriptorsCommand); _view = view; - - this.devInfo = devInfo; + _devInfo = devInfo; DeviceType = devInfo.Type.ToString(); Manufacturer = devInfo.Manufacturer; @@ -948,7 +947,7 @@ namespace Aaru.Gui.ViewModels.Panels return; var saveFs = new FileStream(result, FileMode.Create); - saveFs.Write(devInfo.UsbDescriptors, 0, devInfo.UsbDescriptors.Length); + saveFs.Write(_devInfo.UsbDescriptors, 0, _devInfo.UsbDescriptors.Length); saveFs.Close(); } diff --git a/Aaru.Gui/ViewModels/Panels/FileSystemViewModel.cs b/Aaru.Gui/ViewModels/Panels/FileSystemViewModel.cs index dd65dafb1..9fda94764 100644 --- a/Aaru.Gui/ViewModels/Panels/FileSystemViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/FileSystemViewModel.cs @@ -30,13 +30,14 @@ // Copyright © 2011-2020 Natalia Portillo // ****************************************************************************/ +using JetBrains.Annotations; using Schemas; namespace Aaru.Gui.ViewModels.Panels { - public class FileSystemViewModel + public sealed class FileSystemViewModel { - public FileSystemViewModel(FileSystemType xmlFsType, string information) + public FileSystemViewModel([NotNull] FileSystemType xmlFsType, string information) { TypeText = $"Filesystem type: {xmlFsType.Type}"; VolumeNameText = $"Volume name: {xmlFsType.VolumeName}"; diff --git a/Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs b/Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs index 3d65ecd96..5e6ae06b6 100644 --- a/Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs @@ -60,12 +60,11 @@ using Session = Aaru.CommonTypes.Structs.Session; namespace Aaru.Gui.ViewModels.Panels { - public class ImageInfoViewModel : ViewModelBase + public sealed class ImageInfoViewModel : ViewModelBase { readonly IFilter _filter; readonly IMediaImage _imageFormat; readonly string _imagePath; - readonly Window _view; DecodeMediaTags _decodeMediaTags; ImageChecksum _imageChecksum; ImageConvert _imageConvert; @@ -80,7 +79,6 @@ namespace Aaru.Gui.ViewModels.Panels _imagePath = imagePath; _filter = filter; _imageFormat = imageFormat; - _view = view; IAssetLoader assets = AvaloniaLocator.Current.GetService(); MediaTagsList = new ObservableCollection(); SectorTagsList = new ObservableCollection(); @@ -207,8 +205,7 @@ namespace Aaru.Gui.ViewModels.Panels byte[] scsiModeSense6 = null; byte[] scsiModeSense10 = null; - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_INQUIRY)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SCSI_INQUIRY) == true) { scsiInquiryData = imageFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY); @@ -217,15 +214,13 @@ namespace Aaru.Gui.ViewModels.Panels scsiInquiry = Inquiry.Decode(scsiInquiryData); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_6)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SCSI_MODESENSE_6) == true) { scsiModeSense6 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_6); scsiMode = Modes.DecodeMode6(scsiModeSense6, scsiDeviceType); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SCSI_MODESENSE_10)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SCSI_MODESENSE_10) == true) { scsiModeSense10 = imageFormat.ReadDiskTag(MediaTagType.SCSI_MODESENSE_10); scsiMode = Modes.DecodeMode10(scsiModeSense10, scsiDeviceType); @@ -234,23 +229,21 @@ namespace Aaru.Gui.ViewModels.Panels ScsiInfo = new ScsiInfo { DataContext = new ScsiInfoViewModel(scsiInquiryData, scsiInquiry, null, scsiMode, scsiDeviceType, - scsiModeSense6, scsiModeSense10, null, _view) + scsiModeSense6, scsiModeSense10, null, view) }; byte[] ataIdentify = null; byte[] atapiIdentify = null; - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATA_IDENTIFY)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.ATA_IDENTIFY) == true) ataIdentify = imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.ATAPI_IDENTIFY)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.ATAPI_IDENTIFY) == true) atapiIdentify = imageFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY); AtaInfo = new AtaInfo { - DataContext = new AtaInfoViewModel(ataIdentify, atapiIdentify, null, _view) + DataContext = new AtaInfoViewModel(ataIdentify, atapiIdentify, null, view) }; byte[] toc = null; @@ -264,8 +257,7 @@ namespace Aaru.Gui.ViewModels.Panels CDTextOnLeadIn.CDText? decodedCdText = null; string mediaCatalogueNumber = null; - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TOC)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.CD_TOC) == true) { toc = imageFormat.ReadDiskTag(MediaTagType.CD_TOC); @@ -286,8 +278,7 @@ namespace Aaru.Gui.ViewModels.Panels } } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_FullTOC)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.CD_FullTOC) == true) { fullToc = imageFormat.ReadDiskTag(MediaTagType.CD_FullTOC); @@ -308,8 +299,7 @@ namespace Aaru.Gui.ViewModels.Panels } } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_PMA)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.CD_PMA) == true) { pma = imageFormat.ReadDiskTag(MediaTagType.CD_PMA); @@ -328,8 +318,7 @@ namespace Aaru.Gui.ViewModels.Panels } } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_ATIP)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.CD_ATIP) == true) { atip = imageFormat.ReadDiskTag(MediaTagType.CD_ATIP); @@ -349,8 +338,7 @@ namespace Aaru.Gui.ViewModels.Panels decodedAtip = ATIP.Decode(atip); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_TEXT)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.CD_TEXT) == true) { cdtext = imageFormat.ReadDiskTag(MediaTagType.CD_TEXT); @@ -370,8 +358,7 @@ namespace Aaru.Gui.ViewModels.Panels decodedCdText = CDTextOnLeadIn.Decode(cdtext); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.CD_MCN)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.CD_MCN) == true) { byte[] mcn = imageFormat.ReadDiskTag(MediaTagType.CD_MCN); @@ -382,7 +369,7 @@ namespace Aaru.Gui.ViewModels.Panels { DataContext = new CompactDiscInfoViewModel(toc, atip, null, null, fullToc, pma, cdtext, decodedToc, decodedAtip, null, decodedFullToc, decodedCdText, null, - mediaCatalogueNumber, null, _view) + mediaCatalogueNumber, null, view) }; byte[] dvdPfi = null; @@ -392,33 +379,28 @@ namespace Aaru.Gui.ViewModels.Panels byte[] dvdBca = null; PFI.PhysicalFormatInformation? decodedPfi = null; - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_PFI)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVD_PFI) == true) { dvdPfi = imageFormat.ReadDiskTag(MediaTagType.DVD_PFI); decodedPfi = PFI.Decode(dvdPfi); } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_DMI)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVD_DMI) == true) dvdDmi = imageFormat.ReadDiskTag(MediaTagType.DVD_DMI); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_CMI)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVD_CMI) == true) dvdCmi = imageFormat.ReadDiskTag(MediaTagType.DVD_CMI); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.HDDVD_CPI)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.HDDVD_CPI) == true) hddvdCopyrightInformation = imageFormat.ReadDiskTag(MediaTagType.HDDVD_CPI); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_BCA)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVD_BCA) == true) dvdBca = imageFormat.ReadDiskTag(MediaTagType.DVD_BCA); DvdInfo = new DvdInfo { DataContext = new DvdInfoViewModel(imageFormat.Info.MediaType, dvdPfi, dvdDmi, dvdCmi, - hddvdCopyrightInformation, dvdBca, null, decodedPfi, _view) + hddvdCopyrightInformation, dvdBca, null, decodedPfi, view) }; byte[] dvdRamDds = null; @@ -436,60 +418,46 @@ namespace Aaru.Gui.ViewModels.Panels byte[] dvdPlusAdip = null; byte[] dvdPlusDcb = null; - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_DDS)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDRAM_DDS) == true) dvdRamDds = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_DDS); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_MediumStatus)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDRAM_MediumStatus) == true) dvdRamCartridgeStatus = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_MediumStatus); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDRAM_SpareArea)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDRAM_SpareArea) == true) dvdRamSpareArea = imageFormat.ReadDiskTag(MediaTagType.DVDRAM_SpareArea); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_RMD)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDR_RMD) == true) lastBorderOutRmd = imageFormat.ReadDiskTag(MediaTagType.DVDR_RMD); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_PreRecordedInfo)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDR_PreRecordedInfo) == true) dvdPreRecordedInfo = imageFormat.ReadDiskTag(MediaTagType.DVDR_PreRecordedInfo); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_MediaIdentifier)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDR_MediaIdentifier) == true) dvdrMediaIdentifier = imageFormat.ReadDiskTag(MediaTagType.DVDR_MediaIdentifier); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDR_PFI)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDR_PFI) == true) dvdrPhysicalInformation = imageFormat.ReadDiskTag(MediaTagType.DVDR_PFI); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.HDDVD_MediumStatus)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.HDDVD_MediumStatus) == true) hddvdrMediumStatus = imageFormat.ReadDiskTag(MediaTagType.HDDVD_MediumStatus); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_LayerCapacity)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDDL_LayerCapacity) == true) dvdrLayerCapacity = imageFormat.ReadDiskTag(MediaTagType.DVDDL_LayerCapacity); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_MiddleZoneAddress)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDDL_MiddleZoneAddress) == true) dvdrDlMiddleZoneStart = imageFormat.ReadDiskTag(MediaTagType.DVDDL_MiddleZoneAddress); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_JumpIntervalSize)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDDL_JumpIntervalSize) == true) dvdrDlJumpIntervalSize = imageFormat.ReadDiskTag(MediaTagType.DVDDL_JumpIntervalSize); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVDDL_ManualLayerJumpLBA)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVDDL_ManualLayerJumpLBA) == true) dvdrDlManualLayerJumpStartLba = imageFormat.ReadDiskTag(MediaTagType.DVDDL_ManualLayerJumpLBA); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DVD_ADIP)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DVD_ADIP) == true) dvdPlusAdip = imageFormat.ReadDiskTag(MediaTagType.DVD_ADIP); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.DCB)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.DCB) == true) dvdPlusDcb = imageFormat.ReadDiskTag(MediaTagType.DCB); DvdWritableInfo = new DvdWritableInfo @@ -500,7 +468,7 @@ namespace Aaru.Gui.ViewModels.Panels hddvdrMediumStatus, null, dvdrLayerCapacity, dvdrDlMiddleZoneStart, dvdrDlJumpIntervalSize, dvdrDlManualLayerJumpStartLba, null, dvdPlusAdip, dvdPlusDcb, - _view) + view) }; byte[] blurayBurstCuttingArea = null; @@ -511,51 +479,42 @@ namespace Aaru.Gui.ViewModels.Panels byte[] bluraySpareAreaInformation = null; byte[] blurayTrackResources = null; - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_BCA)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.BD_BCA) == true) blurayBurstCuttingArea = imageFormat.ReadDiskTag(MediaTagType.BD_BCA); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_CartridgeStatus)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.BD_CartridgeStatus) == true) blurayCartridgeStatus = imageFormat.ReadDiskTag(MediaTagType.BD_CartridgeStatus); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DDS)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.BD_DDS) == true) blurayDds = imageFormat.ReadDiskTag(MediaTagType.BD_DDS); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_DI)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.BD_DI) == true) blurayDiscInformation = imageFormat.ReadDiskTag(MediaTagType.BD_DI); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_POWResourcesInformation)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.MMC_POWResourcesInformation) == true) blurayPowResources = imageFormat.ReadDiskTag(MediaTagType.MMC_POWResourcesInformation); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.BD_SpareArea)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.BD_SpareArea) == true) bluraySpareAreaInformation = imageFormat.ReadDiskTag(MediaTagType.BD_SpareArea); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_TrackResourcesInformation)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.MMC_TrackResourcesInformation) == true) bluraySpareAreaInformation = imageFormat.ReadDiskTag(MediaTagType.MMC_TrackResourcesInformation); BlurayInfo = new BlurayInfo { DataContext = new BlurayInfoViewModel(blurayDiscInformation, blurayBurstCuttingArea, blurayDds, blurayCartridgeStatus, bluraySpareAreaInformation, - blurayPowResources, blurayTrackResources, null, null, _view) + blurayPowResources, blurayTrackResources, null, null, view) }; byte[] xboxDmi = null; byte[] xboxSecuritySector = null; SS.SecuritySector? decodedXboxSecuritySector = null; - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_DMI)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.Xbox_DMI) == true) xboxDmi = imageFormat.ReadDiskTag(MediaTagType.Xbox_DMI); - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.Xbox_SecuritySector)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.Xbox_SecuritySector) == true) { xboxSecuritySector = imageFormat.ReadDiskTag(MediaTagType.Xbox_SecuritySector); decodedXboxSecuritySector = SS.Decode(xboxSecuritySector); @@ -563,18 +522,17 @@ namespace Aaru.Gui.ViewModels.Panels XboxInfo = new XboxInfo { - DataContext = new XboxInfoViewModel(null, xboxDmi, xboxSecuritySector, decodedXboxSecuritySector, _view) + DataContext = new XboxInfoViewModel(null, xboxDmi, xboxSecuritySector, decodedXboxSecuritySector, view) }; byte[] pcmciaCis = null; - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.PCMCIA_CIS)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.PCMCIA_CIS) == true) pcmciaCis = imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS); PcmciaInfo = new PcmciaInfo { - DataContext = new PcmciaInfoViewModel(pcmciaCis, _view) + DataContext = new PcmciaInfoViewModel(pcmciaCis, view) }; DeviceType deviceType = DeviceType.Unknown; @@ -584,57 +542,49 @@ namespace Aaru.Gui.ViewModels.Panels byte[] extendedCsd = null; byte[] scr = null; - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CID)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SD_CID) == true) { cid = imageFormat.ReadDiskTag(MediaTagType.SD_CID); deviceType = DeviceType.SecureDigital; } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_CSD)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SD_CSD) == true) { csd = imageFormat.ReadDiskTag(MediaTagType.SD_CSD); deviceType = DeviceType.SecureDigital; } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_OCR)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SD_OCR) == true) { ocr = imageFormat.ReadDiskTag(MediaTagType.SD_OCR); deviceType = DeviceType.SecureDigital; } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.SD_SCR)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.SD_SCR) == true) { scr = imageFormat.ReadDiskTag(MediaTagType.SD_SCR); deviceType = DeviceType.SecureDigital; } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CID)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.MMC_CID) == true) { cid = imageFormat.ReadDiskTag(MediaTagType.MMC_CID); deviceType = DeviceType.MMC; } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_CSD)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.MMC_CSD) == true) { csd = imageFormat.ReadDiskTag(MediaTagType.MMC_CSD); deviceType = DeviceType.MMC; } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_OCR)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.MMC_OCR) == true) { ocr = imageFormat.ReadDiskTag(MediaTagType.MMC_OCR); deviceType = DeviceType.MMC; } - if(imageFormat.Info.ReadableMediaTags != null && - imageFormat.Info.ReadableMediaTags.Contains(MediaTagType.MMC_ExtendedCSD)) + if(imageFormat.Info.ReadableMediaTags?.Contains(MediaTagType.MMC_ExtendedCSD) == true) { extendedCsd = imageFormat.ReadDiskTag(MediaTagType.MMC_ExtendedCSD); deviceType = DeviceType.MMC; @@ -748,7 +698,7 @@ namespace Aaru.Gui.ViewModels.Panels MediaSerialNumberText != null || MediaBarcodeText != null || MediaPartNumberText != null; - protected void ExecuteEntropyCommand() + void ExecuteEntropyCommand() { if(_imageEntropy != null) { @@ -760,15 +710,12 @@ namespace Aaru.Gui.ViewModels.Panels _imageEntropy = new ImageEntropy(); _imageEntropy.DataContext = new ImageEntropyViewModel(_imageFormat, _imageEntropy); - _imageEntropy.Closed += (sender, args) => - { - _imageEntropy = null; - }; + _imageEntropy.Closed += (sender, args) => _imageEntropy = null; _imageEntropy.Show(); } - protected void ExecuteVerifyCommand() + void ExecuteVerifyCommand() { if(_imageVerify != null) { @@ -780,15 +727,12 @@ namespace Aaru.Gui.ViewModels.Panels _imageVerify = new ImageVerify(); _imageVerify.DataContext = new ImageVerifyViewModel(_imageFormat, _imageVerify); - _imageVerify.Closed += (sender, args) => - { - _imageVerify = null; - }; + _imageVerify.Closed += (sender, args) => _imageVerify = null; _imageVerify.Show(); } - protected void ExecuteChecksumCommand() + void ExecuteChecksumCommand() { if(_imageChecksum != null) { @@ -800,15 +744,12 @@ namespace Aaru.Gui.ViewModels.Panels _imageChecksum = new ImageChecksum(); _imageChecksum.DataContext = new ImageChecksumViewModel(_imageFormat, _imageChecksum); - _imageChecksum.Closed += (sender, args) => - { - _imageChecksum = null; - }; + _imageChecksum.Closed += (sender, args) => _imageChecksum = null; _imageChecksum.Show(); } - protected void ExecuteConvertCommand() + void ExecuteConvertCommand() { if(_imageConvert != null) { @@ -820,15 +761,12 @@ namespace Aaru.Gui.ViewModels.Panels _imageConvert = new ImageConvert(); _imageConvert.DataContext = new ImageConvertViewModel(_imageFormat, _imagePath, _imageConvert); - _imageConvert.Closed += (sender, args) => - { - _imageConvert = null; - }; + _imageConvert.Closed += (sender, args) => _imageConvert = null; _imageConvert.Show(); } - protected void ExecuteCreateSidecarCommand() + void ExecuteCreateSidecarCommand() { if(_imageSidecar != null) { @@ -843,15 +781,12 @@ namespace Aaru.Gui.ViewModels.Panels _imageSidecar.DataContext = new ImageSidecarViewModel(_imageFormat, _imagePath, _filter.Id, null, _imageSidecar); - _imageSidecar.Closed += (sender, args) => - { - _imageSidecar = null; - }; + _imageSidecar.Closed += (sender, args) => _imageSidecar = null; _imageSidecar.Show(); } - protected void ExecuteViewSectorsCommand() + void ExecuteViewSectorsCommand() { if(_viewSector != null) { @@ -865,15 +800,12 @@ namespace Aaru.Gui.ViewModels.Panels DataContext = new ViewSectorViewModel(_imageFormat) }; - _viewSector.Closed += (sender, args) => - { - _viewSector = null; - }; + _viewSector.Closed += (sender, args) => _viewSector = null; _viewSector.Show(); } - protected void ExecuteDecodeMediaTagCommand() + void ExecuteDecodeMediaTagCommand() { if(_decodeMediaTags != null) { @@ -887,10 +819,7 @@ namespace Aaru.Gui.ViewModels.Panels DataContext = new DecodeMediaTagsViewModel(_imageFormat) }; - _decodeMediaTags.Closed += (sender, args) => - { - _decodeMediaTags = null; - }; + _decodeMediaTags.Closed += (sender, args) => _decodeMediaTags = null; _decodeMediaTags.Show(); } diff --git a/Aaru.Gui/ViewModels/Panels/MediaInfoViewModel.cs b/Aaru.Gui/ViewModels/Panels/MediaInfoViewModel.cs index 0b4699d7d..675c4152f 100644 --- a/Aaru.Gui/ViewModels/Panels/MediaInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/MediaInfoViewModel.cs @@ -50,7 +50,7 @@ using ScsiInfo = Aaru.Core.Media.Info.ScsiInfo; namespace Aaru.Gui.ViewModels.Panels { - public class MediaInfoViewModel : ViewModelBase + public sealed class MediaInfoViewModel : ViewModelBase { readonly string _devicePath; readonly ScsiInfo _scsiInfo; diff --git a/Aaru.Gui/ViewModels/Panels/PartitionViewModel.cs b/Aaru.Gui/ViewModels/Panels/PartitionViewModel.cs index aeb9ee60b..eee400675 100644 --- a/Aaru.Gui/ViewModels/Panels/PartitionViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/PartitionViewModel.cs @@ -34,7 +34,7 @@ using Aaru.CommonTypes; namespace Aaru.Gui.ViewModels.Panels { - public class PartitionViewModel + public sealed class PartitionViewModel { public PartitionViewModel(Partition partition) { diff --git a/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs b/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs index 8b61af956..3808ca8b5 100644 --- a/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/SubdirectoryViewModel.cs @@ -42,6 +42,7 @@ using Aaru.Console; using Aaru.Core; using Aaru.Gui.Models; using Avalonia.Controls; +using JetBrains.Annotations; using MessageBox.Avalonia; using MessageBox.Avalonia.Enums; using ReactiveUI; @@ -49,12 +50,12 @@ using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; namespace Aaru.Gui.ViewModels.Panels { - public class SubdirectoryViewModel + public sealed class SubdirectoryViewModel { readonly SubdirectoryModel _model; readonly Window _view; - public SubdirectoryViewModel(SubdirectoryModel model, Window view) + public SubdirectoryViewModel([NotNull] SubdirectoryModel model, Window view) { Entries = new ObservableCollection(); SelectedEntries = new List(); diff --git a/Aaru.Gui/ViewModels/Tabs/AtaInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/AtaInfoViewModel.cs index 0dbf9c3fd..274085d34 100644 --- a/Aaru.Gui/ViewModels/Tabs/AtaInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/AtaInfoViewModel.cs @@ -35,25 +35,26 @@ using System.IO; using System.Reactive; using Aaru.Decoders.ATA; using Avalonia.Controls; +using JetBrains.Annotations; using ReactiveUI; namespace Aaru.Gui.ViewModels.Tabs { - public class AtaInfoViewModel : ViewModelBase + public sealed class AtaInfoViewModel : ViewModelBase { - readonly byte[] ata; - readonly byte[] atapi; + readonly byte[] _ata; + readonly byte[] _atapi; readonly Window _view; - public AtaInfoViewModel(byte[] ataIdentify, byte[] atapiIdentify, AtaErrorRegistersChs? ataMcptError, - Window view) + public AtaInfoViewModel([CanBeNull] byte[] ataIdentify, byte[] atapiIdentify, + AtaErrorRegistersChs? ataMcptError, Window view) { SaveAtaBinaryCommand = ReactiveCommand.Create(ExecuteSaveAtaBinaryCommand); SaveAtaTextCommand = ReactiveCommand.Create(ExecuteSaveAtaTextCommand); - ata = ataIdentify; - atapi = atapiIdentify; - _view = view; + _ata = ataIdentify; + _atapi = atapiIdentify; + _view = view; if(ataIdentify == null && atapiIdentify == null) @@ -104,12 +105,12 @@ namespace Aaru.Gui.ViewModels.Tabs AtaMcptSpecificDataText = $"Card specific data: 0x{specificData:X4}"; } - AtaIdentifyText = Identify.Prettify(ata); + AtaIdentifyText = Identify.Prettify(_ata); } else { AtaOrAtapiText = "ATA PACKET IDENTIFY DEVICE"; - AtaIdentifyText = Identify.Prettify(atapi); + AtaIdentifyText = Identify.Prettify(_atapi); } } @@ -124,7 +125,7 @@ namespace Aaru.Gui.ViewModels.Tabs public string AtaOrAtapiText { get; } - protected async void ExecuteSaveAtaBinaryCommand() + async void ExecuteSaveAtaBinaryCommand() { var dlgSaveBinary = new SaveFileDialog(); @@ -144,15 +145,15 @@ namespace Aaru.Gui.ViewModels.Tabs var saveFs = new FileStream(result, FileMode.Create); - if(ata != null) - saveFs.Write(ata, 0, ata.Length); - else if(atapi != null) - saveFs.Write(atapi, 0, atapi.Length); + if(_ata != null) + saveFs.Write(_ata, 0, _ata.Length); + else if(_atapi != null) + saveFs.Write(_atapi, 0, _atapi.Length); saveFs.Close(); } - protected async void ExecuteSaveAtaTextCommand() + async void ExecuteSaveAtaTextCommand() { var dlgSaveText = new SaveFileDialog(); diff --git a/Aaru.Gui/ViewModels/Tabs/BlurayInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/BlurayInfoViewModel.cs index 55df1a507..708075c24 100644 --- a/Aaru.Gui/ViewModels/Tabs/BlurayInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/BlurayInfoViewModel.cs @@ -36,11 +36,12 @@ using System.Reactive; using Aaru.Decoders.Bluray; using Aaru.Decoders.SCSI.MMC; using Avalonia.Controls; +using JetBrains.Annotations; using ReactiveUI; namespace Aaru.Gui.ViewModels.Tabs { - public class BlurayInfoViewModel + public sealed class BlurayInfoViewModel { readonly byte[] _burstCuttingArea; readonly byte[] _cartridgeStatus; @@ -53,10 +54,11 @@ namespace Aaru.Gui.ViewModels.Tabs readonly byte[] _trackResources; readonly Window _view; - public BlurayInfoViewModel(byte[] blurayDiscInformation, byte[] blurayBurstCuttingArea, byte[] blurayDds, - byte[] blurayCartridgeStatus, byte[] bluraySpareAreaInformation, - byte[] blurayPowResources, byte[] blurayTrackResources, byte[] blurayRawDfl, - byte[] blurayPac, Window view) + public BlurayInfoViewModel([CanBeNull] byte[] blurayDiscInformation, [CanBeNull] byte[] blurayBurstCuttingArea, + [CanBeNull] byte[] blurayDds, [CanBeNull] byte[] blurayCartridgeStatus, + [CanBeNull] byte[] bluraySpareAreaInformation, [CanBeNull] byte[] blurayPowResources, + [CanBeNull] byte[] blurayTrackResources, [CanBeNull] byte[] blurayRawDfl, + [CanBeNull] byte[] blurayPac, Window view) { _view = view; _discInformation = blurayDiscInformation; diff --git a/Aaru.Gui/ViewModels/Tabs/CompactDiscInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/CompactDiscInfoViewModel.cs index 3e7147dd9..800b0e1e8 100644 --- a/Aaru.Gui/ViewModels/Tabs/CompactDiscInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/CompactDiscInfoViewModel.cs @@ -42,7 +42,7 @@ using ReactiveUI; namespace Aaru.Gui.ViewModels.Tabs { - public class CompactDiscInfoViewModel : ViewModelBase + public sealed class CompactDiscInfoViewModel : ViewModelBase { readonly byte[] _atipData; readonly byte[] _cdTextLeadInData; @@ -131,7 +131,7 @@ namespace Aaru.Gui.ViewModels.Tabs public ReactiveCommand SaveCdPmaCommand { get; } public ObservableCollection IsrcList { get; } - protected async void ExecuteSaveCdInformationCommand() + async void ExecuteSaveCdInformationCommand() { var dlgSaveBinary = new SaveFileDialog(); @@ -155,7 +155,7 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - protected async void ExecuteSaveCdTocCommand() + async void ExecuteSaveCdTocCommand() { var dlgSaveBinary = new SaveFileDialog(); @@ -179,7 +179,7 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - protected async void ExecuteSaveCdFullTocCommand() + async void ExecuteSaveCdFullTocCommand() { var dlgSaveBinary = new SaveFileDialog(); @@ -203,7 +203,7 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - protected async void ExecuteSaveCdSessionCommand() + async void ExecuteSaveCdSessionCommand() { var dlgSaveBinary = new SaveFileDialog(); @@ -227,7 +227,7 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - protected async void ExecuteSaveCdTextCommand() + async void ExecuteSaveCdTextCommand() { var dlgSaveBinary = new SaveFileDialog(); @@ -251,7 +251,7 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - protected async void ExecuteSaveCdAtipCommand() + async void ExecuteSaveCdAtipCommand() { var dlgSaveBinary = new SaveFileDialog(); @@ -275,7 +275,7 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - protected async void ExecuteSaveCdPmaCommand() + async void ExecuteSaveCdPmaCommand() { var dlgSaveBinary = new SaveFileDialog(); diff --git a/Aaru.Gui/ViewModels/Tabs/DvdInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/DvdInfoViewModel.cs index 35682f39b..d5eafe8ac 100644 --- a/Aaru.Gui/ViewModels/Tabs/DvdInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/DvdInfoViewModel.cs @@ -36,11 +36,12 @@ using System.Reactive; using Aaru.CommonTypes; using Aaru.Decoders.DVD; using Avalonia.Controls; +using JetBrains.Annotations; using ReactiveUI; namespace Aaru.Gui.ViewModels.Tabs { - public class DvdInfoViewModel + public sealed class DvdInfoViewModel { readonly byte[] _dvdAacs; readonly byte[] _dvdBca; @@ -50,8 +51,10 @@ namespace Aaru.Gui.ViewModels.Tabs readonly byte[] _hddvdCopyrightInformation; readonly Window _view; - public DvdInfoViewModel(MediaType mediaType, byte[] pfi, byte[] dmi, byte[] cmi, byte[] hdCopyrightInformation, - byte[] bca, byte[] aacs, PFI.PhysicalFormatInformation? decodedPfi, Window view) + public DvdInfoViewModel(MediaType mediaType, [CanBeNull] byte[] pfi, [CanBeNull] byte[] dmi, + [CanBeNull] byte[] cmi, [CanBeNull] byte[] hdCopyrightInformation, + [CanBeNull] byte[] bca, [CanBeNull] byte[] aacs, + PFI.PhysicalFormatInformation? decodedPfi, Window view) { _dvdPfi = pfi; _dvdDmi = dmi; @@ -139,16 +142,16 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - protected void ExecuteSaveDvdPfiCommand() => SaveElement(_dvdPfi); + void ExecuteSaveDvdPfiCommand() => SaveElement(_dvdPfi); - protected void ExecuteSaveDvdDmiCommand() => SaveElement(_dvdDmi); + void ExecuteSaveDvdDmiCommand() => SaveElement(_dvdDmi); - protected void ExecuteSaveDvdCmiCommand() => SaveElement(_dvdCmi); + void ExecuteSaveDvdCmiCommand() => SaveElement(_dvdCmi); - protected void ExecuteSaveHdDvdCmiCommand() => SaveElement(_hddvdCopyrightInformation); + void ExecuteSaveHdDvdCmiCommand() => SaveElement(_hddvdCopyrightInformation); - protected void ExecuteSaveDvdBcaCommand() => SaveElement(_dvdBca); + void ExecuteSaveDvdBcaCommand() => SaveElement(_dvdBca); - protected void ExecuteSaveDvdAacsCommand() => SaveElement(_dvdAacs); + void ExecuteSaveDvdAacsCommand() => SaveElement(_dvdAacs); } } \ No newline at end of file diff --git a/Aaru.Gui/ViewModels/Tabs/DvdWritableInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/DvdWritableInfoViewModel.cs index 6b9f28874..b9fd5a1fc 100644 --- a/Aaru.Gui/ViewModels/Tabs/DvdWritableInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/DvdWritableInfoViewModel.cs @@ -40,7 +40,7 @@ using ReactiveUI; namespace Aaru.Gui.ViewModels.Tabs { - public class DvdWritableInfoViewModel + public sealed class DvdWritableInfoViewModel { readonly byte[] _dvdLastBorderOutRmd; readonly byte[] _dvdPlusAdip; diff --git a/Aaru.Gui/ViewModels/Tabs/PcmciaInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/PcmciaInfoViewModel.cs index dfe273b8b..45dabfd78 100644 --- a/Aaru.Gui/ViewModels/Tabs/PcmciaInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/PcmciaInfoViewModel.cs @@ -38,29 +38,30 @@ using Aaru.Console; using Aaru.Decoders.PCMCIA; using Aaru.Gui.Models; using Avalonia.Controls; +using JetBrains.Annotations; using ReactiveUI; namespace Aaru.Gui.ViewModels.Tabs { public class PcmciaInfoViewModel : ViewModelBase { + readonly byte[] _cis; readonly Window _view; - readonly byte[] cis; string _pcmciaCisText; PcmciaCisModel _selectedCis; - internal PcmciaInfoViewModel(byte[] pcmciaCis, Window view) + internal PcmciaInfoViewModel([CanBeNull] byte[] pcmciaCis, Window view) { if(pcmciaCis == null) return; - cis = pcmciaCis; - cisList = new ObservableCollection(); + _cis = pcmciaCis; + CisList = new ObservableCollection(); SavePcmciaCisCommand = ReactiveCommand.Create(ExecuteSavePcmciaCisCommand); _view = view; - Tuple[] tuples = CIS.GetTuples(cis); + Tuple[] tuples = CIS.GetTuples(_cis); if(tuples != null) foreach(Tuple tuple in tuples) @@ -133,7 +134,7 @@ namespace Aaru.Gui.ViewModels.Tabs break; } - cisList.Add(new PcmciaCisModel + CisList.Add(new PcmciaCisModel { Code = tupleCode, Description = tupleDescription @@ -143,7 +144,7 @@ namespace Aaru.Gui.ViewModels.Tabs AaruConsole.DebugWriteLine("Device-Info command", "PCMCIA CIS returned no tuples"); } - public ObservableCollection cisList { get; } + public ObservableCollection CisList { get; } public string PcmciaCisText { @@ -185,7 +186,7 @@ namespace Aaru.Gui.ViewModels.Tabs return; var saveFs = new FileStream(result, FileMode.Create); - saveFs.Write(cis, 0, cis.Length); + saveFs.Write(_cis, 0, _cis.Length); saveFs.Close(); } diff --git a/Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs index 11cc02dd4..e1a43c507 100644 --- a/Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/ScsiInfoViewModel.cs @@ -47,7 +47,7 @@ using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry; namespace Aaru.Gui.ViewModels.Tabs { - public class ScsiInfoViewModel : ViewModelBase + public sealed class ScsiInfoViewModel : ViewModelBase { readonly byte[] _configuration; readonly byte[] _scsiModeSense10; @@ -311,7 +311,8 @@ namespace Aaru.Gui.ViewModels.Tabs } case 0x21: { - if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "CERTANCE") + if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == + "CERTANCE") decodedText = Modes.PrettifyCertanceModePage_21(page.PageResponse); else goto default; @@ -320,7 +321,8 @@ namespace Aaru.Gui.ViewModels.Tabs } case 0x22: { - if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "CERTANCE") + if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == + "CERTANCE") decodedText = Modes.PrettifyCertanceModePage_22(page.PageResponse); else goto default; @@ -329,7 +331,7 @@ namespace Aaru.Gui.ViewModels.Tabs } case 0x24: { - if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "IBM") + if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "IBM") decodedText = Modes.PrettifyIBMModePage_24(page.PageResponse); else goto default; @@ -347,7 +349,7 @@ namespace Aaru.Gui.ViewModels.Tabs } case 0x2F: { - if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "IBM") + if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "IBM") decodedText = Modes.PrettifyIBMModePage_2F(page.PageResponse); else goto default; @@ -365,7 +367,7 @@ namespace Aaru.Gui.ViewModels.Tabs } case 0x3B: { - if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "HP") + if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "HP") decodedText = Modes.PrettifyHPModePage_3B(page.PageResponse); else goto default; @@ -374,7 +376,7 @@ namespace Aaru.Gui.ViewModels.Tabs } case 0x3C: { - if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "HP") + if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "HP") decodedText = Modes.PrettifyHPModePage_3C(page.PageResponse); else goto default; @@ -383,9 +385,9 @@ namespace Aaru.Gui.ViewModels.Tabs } case 0x3D: { - if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "IBM") + if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "IBM") decodedText = Modes.PrettifyIBMModePage_3D(page.PageResponse); - else if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "HP") + else if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "HP") decodedText = Modes.PrettifyHPModePage_3D(page.PageResponse); else goto default; @@ -394,9 +396,9 @@ namespace Aaru.Gui.ViewModels.Tabs } case 0x3E: { - if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "FUJITSU") + if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "FUJITSU") decodedText = Modes.PrettifyFujitsuModePage_3E(page.PageResponse); - else if(StringHandlers.CToString(scsiInquiry?.VendorIdentification).Trim() == "HP") + else if(StringHandlers.CToString(scsiInquiry.Value.VendorIdentification).Trim() == "HP") decodedText = Modes.PrettifyHPModePage_3E(page.PageResponse); else goto default; @@ -974,7 +976,7 @@ namespace Aaru.Gui.ViewModels.Tabs set => this.RaiseAndSetIfChanged(ref _mmcFeatureText, value); } - protected async void ExecuteSaveInquiryBinaryCommand() + async void ExecuteSaveInquiryBinaryCommand() { var dlgSaveBinary = new SaveFileDialog(); @@ -998,7 +1000,7 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - protected async void ExecuteSaveInquiryTextCommand() + async void ExecuteSaveInquiryTextCommand() { var dlgSaveText = new SaveFileDialog(); @@ -1022,7 +1024,7 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - protected async void ExecuteSaveModeSense6Command() + async void ExecuteSaveModeSense6Command() { var dlgSaveBinary = new SaveFileDialog(); @@ -1046,7 +1048,7 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - protected async void ExecuteSaveModeSense10Command() + async void ExecuteSaveModeSense10Command() { var dlgSaveBinary = new SaveFileDialog(); @@ -1070,7 +1072,7 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - protected async void ExecuteSaveEvpdPageCommand() + async void ExecuteSaveEvpdPageCommand() { if(!(SelectedEvpdPage is ScsiPageModel pageModel)) return; @@ -1097,7 +1099,7 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - protected async void ExecuteSaveMmcFeaturesCommand() + async void ExecuteSaveMmcFeaturesCommand() { var dlgSaveBinary = new SaveFileDialog(); diff --git a/Aaru.Gui/ViewModels/Tabs/SdMmcInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/SdMmcInfoViewModel.cs index 9d4944655..dae3640c9 100644 --- a/Aaru.Gui/ViewModels/Tabs/SdMmcInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/SdMmcInfoViewModel.cs @@ -31,13 +31,14 @@ // ****************************************************************************/ using Aaru.CommonTypes.Enums; +using JetBrains.Annotations; namespace Aaru.Gui.ViewModels.Tabs { - public class SdMmcInfoViewModel + public sealed class SdMmcInfoViewModel { - public SdMmcInfoViewModel(DeviceType deviceType, byte[] cid, byte[] csd, byte[] ocr, byte[] extendedCsd, - byte[] scr) + public SdMmcInfoViewModel(DeviceType deviceType, [CanBeNull] byte[] cid, [CanBeNull] byte[] csd, + [CanBeNull] byte[] ocr, [CanBeNull] byte[] extendedCsd, [CanBeNull] byte[] scr) { switch(deviceType) { diff --git a/Aaru.Gui/ViewModels/Tabs/XboxInfoViewModel.cs b/Aaru.Gui/ViewModels/Tabs/XboxInfoViewModel.cs index 973b2b600..3e774fe04 100644 --- a/Aaru.Gui/ViewModels/Tabs/XboxInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Tabs/XboxInfoViewModel.cs @@ -36,21 +36,22 @@ using System.Reactive; using Aaru.Core.Media.Info; using Aaru.Decoders.Xbox; using Avalonia.Controls; +using JetBrains.Annotations; using ReactiveUI; namespace Aaru.Gui.ViewModels.Tabs { - public class XboxInfoViewModel + public sealed class XboxInfoViewModel { - readonly byte[] xboxSecuritySector; readonly Window _view; + readonly byte[] _xboxSecuritySector; - public XboxInfoViewModel(XgdInfo xgdInfo, byte[] dmi, byte[] securitySector, + public XboxInfoViewModel([CanBeNull] XgdInfo xgdInfo, [CanBeNull] byte[] dmi, [CanBeNull] byte[] securitySector, SS.SecuritySector? decodedSecuritySector, Window view) { - xboxSecuritySector = securitySector; - _view = view; - SaveXboxSsCommand = ReactiveCommand.Create(ExecuteSaveXboxSsCommand); + _xboxSecuritySector = securitySector; + _view = view; + SaveXboxSsCommand = ReactiveCommand.Create(ExecuteSaveXboxSsCommand); if(xgdInfo != null) { @@ -113,6 +114,6 @@ namespace Aaru.Gui.ViewModels.Tabs saveFs.Close(); } - public void ExecuteSaveXboxSsCommand() => SaveElement(xboxSecuritySector); + public void ExecuteSaveXboxSsCommand() => SaveElement(_xboxSecuritySector); } } \ No newline at end of file diff --git a/Aaru.Gui/ViewModels/Windows/DecodeMediaTagsViewModel.cs b/Aaru.Gui/ViewModels/Windows/DecodeMediaTagsViewModel.cs index 17c2983c6..38c6b429b 100644 --- a/Aaru.Gui/ViewModels/Windows/DecodeMediaTagsViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/DecodeMediaTagsViewModel.cs @@ -44,6 +44,7 @@ using Aaru.Decoders.SCSI.MMC; using Aaru.Decoders.Xbox; using Aaru.Gui.Models; using Aaru.Helpers; +using JetBrains.Annotations; using ReactiveUI; using BCA = Aaru.Decoders.Bluray.BCA; using Cartridge = Aaru.Decoders.DVD.Cartridge; @@ -54,7 +55,7 @@ using Spare = Aaru.Decoders.DVD.Spare; namespace Aaru.Gui.ViewModels.Windows { - public class DecodeMediaTagsViewModel : ViewModelBase + public sealed class DecodeMediaTagsViewModel : ViewModelBase { const int HEX_COLUMNS = 32; string _decodedText; @@ -63,7 +64,7 @@ namespace Aaru.Gui.ViewModels.Windows MediaTagModel _selectedTag; - public DecodeMediaTagsViewModel(IMediaImage inputFormat) + public DecodeMediaTagsViewModel([NotNull] IMediaImage inputFormat) { TagsList = new ObservableCollection(); diff --git a/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs index 7bba40b8c..0be945ee2 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs @@ -46,7 +46,7 @@ using Schemas; namespace Aaru.Gui.ViewModels.Windows { - public class ImageChecksumViewModel : ViewModelBase + public sealed class ImageChecksumViewModel : ViewModelBase { // How many sectors to read at once const uint SECTORS_TO_READ = 256; diff --git a/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs index c7d1135b2..30db139ac 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs @@ -51,6 +51,7 @@ using Aaru.Devices; using Aaru.Gui.Models; using Avalonia.Controls; using Avalonia.Threading; +using JetBrains.Annotations; using MessageBox.Avalonia; using MessageBox.Avalonia.Enums; using ReactiveUI; @@ -60,10 +61,12 @@ using Version = Aaru.CommonTypes.Interop.Version; namespace Aaru.Gui.ViewModels.Windows { - public class ImageConvertViewModel : ViewModelBase + public sealed class ImageConvertViewModel : ViewModelBase { + readonly IMediaImage _inputFormat; readonly Window _view; - readonly IMediaImage inputFormat; + bool _cancel; + CICMMetadataType _cicmMetadata; bool _cicmXmlFromImageVisible; string _cicmXmlText; bool _closeVisible; @@ -82,6 +85,7 @@ namespace Aaru.Gui.ViewModels.Windows bool _driveModelVisible; string _driveSerialNumberText; bool _driveSerialNumberVisible; + List _dumpHardware; bool _forceChecked; bool _formatReadOnly; double _lastMediaSequenceValue; @@ -121,15 +125,12 @@ namespace Aaru.Gui.ViewModels.Windows bool _stopEnabled; bool _stopVisible; string _title; - bool cancel; - CICMMetadataType cicmMetadata; - List dumpHardware; - public ImageConvertViewModel(IMediaImage inputFormat, string imageSource, Window view) + public ImageConvertViewModel([NotNull] IMediaImage inputFormat, string imageSource, Window view) { _view = view; - this.inputFormat = inputFormat; - cancel = false; + _inputFormat = inputFormat; + _cancel = false; DestinationCommand = ReactiveCommand.Create(ExecuteDestinationCommand); CreatorCommand = ReactiveCommand.Create(ExecuteCreatorCommand); MediaTitleCommand = ReactiveCommand.Create(ExecuteMediaTitleCommand); @@ -177,15 +178,14 @@ namespace Aaru.Gui.ViewModels.Windows Plugin = plugin }); - CicmXmlFromImageVisible = inputFormat.CicmMetadata != null; - ResumeFileFromImageVisible = inputFormat.DumpHardware != null && inputFormat.DumpHardware.Any(); - cicmMetadata = inputFormat.CicmMetadata; + CicmXmlFromImageVisible = inputFormat.CicmMetadata != null; + ResumeFileFromImageVisible = inputFormat.DumpHardware?.Any() == true; + _cicmMetadata = inputFormat.CicmMetadata; - dumpHardware = inputFormat.DumpHardware != null && inputFormat.DumpHardware.Any() ? inputFormat.DumpHardware - : null; + _dumpHardware = inputFormat.DumpHardware?.Any() == true ? inputFormat.DumpHardware : null; - CicmXmlText = cicmMetadata == null ? "" : ""; - ResumeFileText = dumpHardware == null ? "" : ""; + CicmXmlText = _cicmMetadata == null ? "" : ""; + ResumeFileText = _dumpHardware == null ? "" : ""; } public string Title @@ -580,7 +580,7 @@ namespace Aaru.Gui.ViewModels.Windows return; } - var inputOptical = inputFormat as IOpticalMediaImage; + var inputOptical = _inputFormat as IOpticalMediaImage; var outputOptical = outputFormat as IWritableOpticalImage; List tracks; @@ -607,7 +607,7 @@ namespace Aaru.Gui.ViewModels.Windows DestinationVisible = false; ProgressMaxValue = 1d; - ProgressMaxValue += inputFormat.Info.ReadableMediaTags.Count; + ProgressMaxValue += _inputFormat.Info.ReadableMediaTags.Count; ProgressMaxValue++; if(tracks != null) @@ -617,7 +617,7 @@ namespace Aaru.Gui.ViewModels.Windows { ProgressMaxValue += 2; - foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags) + foreach(SectorTagType tag in _inputFormat.Info.ReadableSectorTags) { switch(tag) { @@ -643,7 +643,7 @@ namespace Aaru.Gui.ViewModels.Windows { ProgressMaxValue += tracks.Count; - foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags.OrderBy(t => t)) + foreach(SectorTagType tag in _inputFormat.Info.ReadableSectorTags.OrderBy(t => t)) { switch(tag) { @@ -666,38 +666,38 @@ namespace Aaru.Gui.ViewModels.Windows } } - if(dumpHardware != null) + if(_dumpHardware != null) ProgressMaxValue++; - if(cicmMetadata != null) + if(_cicmMetadata != null) ProgressMaxValue++; ProgressMaxValue++; }); - foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags) + foreach(MediaTagType mediaTag in _inputFormat.Info.ReadableMediaTags.Where(mediaTag => + !outputFormat. + SupportedMediaTags. + Contains(mediaTag) && + !ForceChecked)) { - if(outputFormat.SupportedMediaTags.Contains(mediaTag) || ForceChecked) - continue; - - await Dispatcher.UIThread.InvokeAsync(action: async () => - { - await MessageBoxManager. - GetMessageBoxStandardWindow("Error", - $"Converting image will lose media tag {mediaTag}, not continuing...", - icon: Icon.Error).ShowDialog(_view); - }); + await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager. + GetMessageBoxStandardWindow("Error", + $"Converting image will lose media tag {mediaTag}, not continuing...", + icon: Icon. + Error). + ShowDialog(_view)); return; } - bool useLong = inputFormat.Info.ReadableSectorTags.Count != 0; + bool useLong = _inputFormat.Info.ReadableSectorTags.Count != 0; - foreach(SectorTagType sectorTag in inputFormat.Info.ReadableSectorTags) + foreach(SectorTagType sectorTag in _inputFormat.Info.ReadableSectorTags.Where(sectorTag => + !outputFormat. + SupportedSectorTags. + Contains(sectorTag))) { - if(outputFormat.SupportedSectorTags.Contains(sectorTag)) - continue; - if(ForceChecked) { if(sectorTag != SectorTagType.CdTrackFlags && @@ -708,13 +708,12 @@ namespace Aaru.Gui.ViewModels.Windows continue; } - await Dispatcher.UIThread.InvokeAsync(action: async () => - { - await MessageBoxManager. - GetMessageBoxStandardWindow("Error", - $"Converting image will lose sector tag {sectorTag}, not continuing...", - icon: Icon.Error).ShowDialog(_view); - }); + await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager. + GetMessageBoxStandardWindow("Error", + $"Converting image will lose sector tag {sectorTag}, not continuing...", + icon: Icon. + Error). + ShowDialog(_view)); return; } @@ -760,16 +759,15 @@ namespace Aaru.Gui.ViewModels.Windows Progress2Indeterminate = true; }); - if(!outputFormat.Create(DestinationText, inputFormat.Info.MediaType, parsedOptions, - inputFormat.Info.Sectors, inputFormat.Info.SectorSize)) + if(!outputFormat.Create(DestinationText, _inputFormat.Info.MediaType, parsedOptions, + _inputFormat.Info.Sectors, _inputFormat.Info.SectorSize)) { - await Dispatcher.UIThread.InvokeAsync(action: async () => - { - await MessageBoxManager. - GetMessageBoxStandardWindow("Error", - $"Error {outputFormat.ErrorMessage} creating output image.", - icon: Icon.Error).ShowDialog(_view); - }); + await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager. + GetMessageBoxStandardWindow("Error", + $"Error {outputFormat.ErrorMessage} creating output image.", + icon: Icon. + Error). + ShowDialog(_view)); AaruConsole.ErrorWriteLine("Error {0} creating output image.", outputFormat.ErrorMessage); @@ -804,20 +802,20 @@ namespace Aaru.Gui.ViewModels.Windows MediaTitle = MediaTitleText }; - if(!cancel) + if(!_cancel) if(!outputFormat.SetMetadata(metadata)) { AaruConsole.ErrorWrite("Error {0} setting metadata, ", outputFormat.ErrorMessage); if(ForceChecked != true) { - await Dispatcher.UIThread.InvokeAsync(action: async () => - { - await MessageBoxManager. - GetMessageBoxStandardWindow("Error", - $"Error {outputFormat.ErrorMessage} setting metadata, not continuing...", - icon: Icon.Error).ShowDialog(_view); - }); + await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager. + GetMessageBoxStandardWindow("Error", + $"Error {outputFormat.ErrorMessage} setting metadata, not continuing...", + icon + : Icon. + Error). + ShowDialog(_view)); AaruConsole.ErrorWriteLine("not continuing..."); @@ -829,7 +827,7 @@ namespace Aaru.Gui.ViewModels.Windows } if(tracks != null && - !cancel && + !_cancel && outputOptical != null) { await Dispatcher.UIThread.InvokeAsync(() => @@ -842,13 +840,13 @@ namespace Aaru.Gui.ViewModels.Windows if(!outputOptical.SetTracks(tracks)) { - await Dispatcher.UIThread.InvokeAsync(action: async () => - { - await MessageBoxManager. - GetMessageBoxStandardWindow("Error", - $"Error {outputFormat.ErrorMessage} sending tracks list to output image.", - icon: Icon.Error).ShowDialog(_view); - }); + await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager. + GetMessageBoxStandardWindow("Error", + $"Error {outputFormat.ErrorMessage} sending tracks list to output image.", + icon: + Icon. + Error). + ShowDialog(_view)); AaruConsole.ErrorWriteLine("Error {0} sending tracks list to output image.", outputFormat.ErrorMessage); @@ -857,11 +855,8 @@ namespace Aaru.Gui.ViewModels.Windows } } - foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags) + foreach(MediaTagType mediaTag in _inputFormat.Info.ReadableMediaTags.TakeWhile(mediaTag => !_cancel)) { - if(cancel) - break; - await Dispatcher.UIThread.InvokeAsync(() => { ProgressText = $"Converting media tag {mediaTag}"; @@ -873,7 +868,7 @@ namespace Aaru.Gui.ViewModels.Windows if(ForceChecked && !outputFormat.SupportedMediaTags.Contains(mediaTag)) continue; - byte[] tag = inputFormat.ReadDiskTag(mediaTag); + byte[] tag = _inputFormat.ReadDiskTag(mediaTag); if(outputFormat.WriteMediaTag(tag, mediaTag)) continue; @@ -885,13 +880,13 @@ namespace Aaru.Gui.ViewModels.Windows } else { - await Dispatcher.UIThread.InvokeAsync(action: async () => - { - await MessageBoxManager. - GetMessageBoxStandardWindow("Error", - $"Error {outputFormat.ErrorMessage} writing media tag, not continuing...", - icon: Icon.Error).ShowDialog(_view); - }); + await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager. + GetMessageBoxStandardWindow("Error", + $"Error {outputFormat.ErrorMessage} writing media tag, not continuing...", + icon: + Icon. + Error). + ShowDialog(_view)); AaruConsole.ErrorWriteLine("Error {0} writing media tag, not continuing...", outputFormat.ErrorMessage); @@ -903,20 +898,20 @@ namespace Aaru.Gui.ViewModels.Windows ulong doneSectors = 0; if(tracks == null && - !cancel) + !_cancel) { await Dispatcher.UIThread.InvokeAsync(() => { ProgressText = - $"Setting geometry to {inputFormat.Info.Cylinders} cylinders, {inputFormat.Info.Heads} heads and {inputFormat.Info.SectorsPerTrack} sectors per track"; + $"Setting geometry to {_inputFormat.Info.Cylinders} cylinders, {_inputFormat.Info.Heads} heads and {_inputFormat.Info.SectorsPerTrack} sectors per track"; ProgressValue++; Progress2Text = ""; Progress2Indeterminate = true; }); - if(!outputFormat.SetGeometry(inputFormat.Info.Cylinders, inputFormat.Info.Heads, - inputFormat.Info.SectorsPerTrack)) + if(!outputFormat.SetGeometry(_inputFormat.Info.Cylinders, _inputFormat.Info.Heads, + _inputFormat.Info.SectorsPerTrack)) { warning = true; @@ -930,29 +925,29 @@ namespace Aaru.Gui.ViewModels.Windows ProgressValue++; Progress2Text = ""; Progress2Indeterminate = false; - Progress2MaxValue = (int)(inputFormat.Info.Sectors / SectorsValue); + Progress2MaxValue = (int)(_inputFormat.Info.Sectors / SectorsValue); }); - while(doneSectors < inputFormat.Info.Sectors) + while(doneSectors < _inputFormat.Info.Sectors) { - if(cancel) + if(_cancel) break; byte[] sector; uint sectorsToDo; - if(inputFormat.Info.Sectors - doneSectors >= (ulong)SectorsValue) + if(_inputFormat.Info.Sectors - doneSectors >= (ulong)SectorsValue) sectorsToDo = (uint)SectorsValue; else - sectorsToDo = (uint)(inputFormat.Info.Sectors - doneSectors); + sectorsToDo = (uint)(_inputFormat.Info.Sectors - doneSectors); ulong sectors = doneSectors; await Dispatcher.UIThread.InvokeAsync(() => { Progress2Text = - $"Converting sectors {sectors} to {sectors + sectorsToDo} ({sectors / (double)inputFormat.Info.Sectors:P2} done)"; + $"Converting sectors {sectors} to {sectors + sectorsToDo} ({sectors / (double)_inputFormat.Info.Sectors:P2} done)"; Progress2Value = (int)(sectors / SectorsValue); }); @@ -962,24 +957,24 @@ namespace Aaru.Gui.ViewModels.Windows if(useLong) if(sectorsToDo == 1) { - sector = inputFormat.ReadSectorLong(doneSectors); + sector = _inputFormat.ReadSectorLong(doneSectors); result = outputFormat.WriteSectorLong(sector, doneSectors); } else { - sector = inputFormat.ReadSectorsLong(doneSectors, sectorsToDo); + sector = _inputFormat.ReadSectorsLong(doneSectors, sectorsToDo); result = outputFormat.WriteSectorsLong(sector, doneSectors, sectorsToDo); } else { if(sectorsToDo == 1) { - sector = inputFormat.ReadSector(doneSectors); + sector = _inputFormat.ReadSector(doneSectors); result = outputFormat.WriteSector(sector, doneSectors); } else { - sector = inputFormat.ReadSectors(doneSectors, sectorsToDo); + sector = _inputFormat.ReadSectors(doneSectors, sectorsToDo); result = outputFormat.WriteSectors(sector, doneSectors, sectorsToDo); } } @@ -994,13 +989,13 @@ namespace Aaru.Gui.ViewModels.Windows } else { - await Dispatcher.UIThread.InvokeAsync(action: async () => - { - await MessageBoxManager. - GetMessageBoxStandardWindow("Error", - $"Error {outputFormat.ErrorMessage} writing sector {doneSectors}, not continuing...", - icon: Icon.Error).ShowDialog(_view); - }); + await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager. + GetMessageBoxStandardWindow("Error", + $"Error {outputFormat.ErrorMessage} writing sector {doneSectors}, not continuing...", + icon + : Icon. + Error). + ShowDialog(_view)); AaruConsole.ErrorWriteLine("Error {0} writing sector {1}, not continuing...", outputFormat.ErrorMessage, doneSectors); @@ -1014,7 +1009,7 @@ namespace Aaru.Gui.ViewModels.Windows await Dispatcher.UIThread.InvokeAsync(() => { Progress2Text = - $"Converting sectors {inputFormat.Info.Sectors} to {inputFormat.Info.Sectors} ({1.0:P2} done)"; + $"Converting sectors {_inputFormat.Info.Sectors} to {_inputFormat.Info.Sectors} ({1.0:P2} done)"; Progress2Value = Progress2MaxValue; }); @@ -1025,12 +1020,12 @@ namespace Aaru.Gui.ViewModels.Windows HashSet subchannelExtents = new HashSet(); Dictionary smallestPregapLbaPerTrack = new Dictionary(); - foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags. - Where(t => t == SectorTagType.CdTrackIsrc).OrderBy(t => t)) + foreach(SectorTagType tag in _inputFormat.Info.ReadableSectorTags. + Where(t => t == SectorTagType.CdTrackIsrc).OrderBy(t => t)) { foreach(Track track in inputOptical.Tracks) { - byte[] isrc = inputFormat.ReadSectorTag(track.TrackSequence, tag); + byte[] isrc = _inputFormat.ReadSectorTag(track.TrackSequence, tag); if(isrc is null) continue; @@ -1039,12 +1034,12 @@ namespace Aaru.Gui.ViewModels.Windows } } - foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags. - Where(t => t == SectorTagType.CdTrackFlags).OrderBy(t => t)) + foreach(SectorTagType tag in _inputFormat.Info.ReadableSectorTags. + Where(t => t == SectorTagType.CdTrackFlags).OrderBy(t => t)) { foreach(Track track in inputOptical.Tracks) { - byte[] flags = inputFormat.ReadSectorTag(track.TrackSequence, tag); + byte[] flags = _inputFormat.ReadSectorTag(track.TrackSequence, tag); if(flags is null) continue; @@ -1053,7 +1048,7 @@ namespace Aaru.Gui.ViewModels.Windows } } - for(ulong s = 0; s < inputFormat.Info.Sectors; s++) + for(ulong s = 0; s < _inputFormat.Info.Sectors; s++) { if(s > int.MaxValue) break; @@ -1061,11 +1056,8 @@ namespace Aaru.Gui.ViewModels.Windows subchannelExtents.Add((int)s); } - foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags) + foreach(SectorTagType tag in _inputFormat.Info.ReadableSectorTags.TakeWhile(tag => useLong && !_cancel)) { - if(!useLong || cancel) - break; - switch(tag) { case SectorTagType.AppleSectorTag: @@ -1089,31 +1081,31 @@ namespace Aaru.Gui.ViewModels.Windows ProgressValue++; Progress2Text = ""; Progress2Indeterminate = false; - Progress2MaxValue = (int)(inputFormat.Info.Sectors / SectorsValue); + Progress2MaxValue = (int)(_inputFormat.Info.Sectors / SectorsValue); }); doneSectors = 0; - while(doneSectors < inputFormat.Info.Sectors) + while(doneSectors < _inputFormat.Info.Sectors) { - if(cancel) + if(_cancel) break; byte[] sector; uint sectorsToDo; - if(inputFormat.Info.Sectors - doneSectors >= (ulong)SectorsValue) + if(_inputFormat.Info.Sectors - doneSectors >= (ulong)SectorsValue) sectorsToDo = (uint)SectorsValue; else - sectorsToDo = (uint)(inputFormat.Info.Sectors - doneSectors); + sectorsToDo = (uint)(_inputFormat.Info.Sectors - doneSectors); ulong sectors = doneSectors; await Dispatcher.UIThread.InvokeAsync(() => { Progress2Text = - $"Converting tag {sectors / (double)inputFormat.Info.Sectors} for sectors {sectors} to {sectors + sectorsToDo} ({sectors / (double)inputFormat.Info.Sectors:P2} done)"; + $"Converting tag {sectors / (double)_inputFormat.Info.Sectors} for sectors {sectors} to {sectors + sectorsToDo} ({sectors / (double)_inputFormat.Info.Sectors:P2} done)"; Progress2Value = (int)(sectors / SectorsValue); }); @@ -1122,7 +1114,7 @@ namespace Aaru.Gui.ViewModels.Windows if(sectorsToDo == 1) { - sector = inputFormat.ReadSectorTag(doneSectors, tag); + sector = _inputFormat.ReadSectorTag(doneSectors, tag); Track track = tracks.LastOrDefault(t => t.TrackStartSector >= doneSectors); if(tag == SectorTagType.CdSectorSubchannel && @@ -1148,7 +1140,7 @@ namespace Aaru.Gui.ViewModels.Windows } else { - sector = inputFormat.ReadSectorsTag(doneSectors, sectorsToDo, tag); + sector = _inputFormat.ReadSectorsTag(doneSectors, sectorsToDo, tag); Track track = tracks.LastOrDefault(t => t.TrackStartSector >= doneSectors); if(tag == SectorTagType.CdSectorSubchannel && @@ -1185,13 +1177,13 @@ namespace Aaru.Gui.ViewModels.Windows } else { - await Dispatcher.UIThread.InvokeAsync(action: async () => - { - await MessageBoxManager. - GetMessageBoxStandardWindow("Error", - $"Error {outputFormat.ErrorMessage} writing sector {doneSectors}, not continuing...", - icon: Icon.Error).ShowDialog(_view); - }); + await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager. + GetMessageBoxStandardWindow("Error", + $"Error {outputFormat.ErrorMessage} writing sector {doneSectors}, not continuing...", + icon + : Icon. + Error). + ShowDialog(_view)); AaruConsole.ErrorWriteLine("Error {0} writing sector {1}, not continuing...", outputFormat.ErrorMessage, doneSectors); @@ -1205,7 +1197,7 @@ namespace Aaru.Gui.ViewModels.Windows await Dispatcher.UIThread.InvokeAsync(() => { Progress2Text = - $"Converting tag {tag} for sectors {inputFormat.Info.Sectors} to {inputFormat.Info.Sectors} ({1.0:P2} done)"; + $"Converting tag {tag} for sectors {_inputFormat.Info.Sectors} to {_inputFormat.Info.Sectors} ({1.0:P2} done)"; Progress2Value = Progress2MaxValue; }); @@ -1228,11 +1220,8 @@ namespace Aaru.Gui.ViewModels.Windows } else { - foreach(Track track in tracks) + foreach(Track track in tracks.TakeWhile(track => !_cancel)) { - if(cancel) - break; - doneSectors = 0; ulong trackSectors = (track.TrackEndSector - track.TrackStartSector) + 1; @@ -1247,7 +1236,7 @@ namespace Aaru.Gui.ViewModels.Windows while(doneSectors < trackSectors) { - if(cancel) + if(_cancel) break; byte[] sector; @@ -1264,7 +1253,7 @@ namespace Aaru.Gui.ViewModels.Windows await Dispatcher.UIThread.InvokeAsync(() => { Progress2Text = - $"Converting sectors {sectors + track.TrackStartSector} to {sectors + sectorsToDo + track.TrackStartSector} in track {track.TrackSequence} ({(sectors + track.TrackStartSector) / (double)inputFormat.Info.Sectors:P2} done)"; + $"Converting sectors {sectors + track.TrackStartSector} to {sectors + sectorsToDo + track.TrackStartSector} in track {track.TrackSequence} ({(sectors + track.TrackStartSector) / (double)_inputFormat.Info.Sectors:P2} done)"; Progress2Value = (int)(sectors / SectorsValue); }); @@ -1274,12 +1263,13 @@ namespace Aaru.Gui.ViewModels.Windows if(useLong) if(sectorsToDo == 1) { - sector = inputFormat.ReadSectorLong(doneSectors + track.TrackStartSector); + sector = _inputFormat.ReadSectorLong(doneSectors + track.TrackStartSector); result = outputFormat.WriteSectorLong(sector, doneSectors + track.TrackStartSector); } else { - sector = inputFormat.ReadSectorsLong(doneSectors + track.TrackStartSector, sectorsToDo); + sector = _inputFormat.ReadSectorsLong(doneSectors + track.TrackStartSector, + sectorsToDo); result = outputFormat.WriteSectorsLong(sector, doneSectors + track.TrackStartSector, sectorsToDo); @@ -1288,12 +1278,12 @@ namespace Aaru.Gui.ViewModels.Windows { if(sectorsToDo == 1) { - sector = inputFormat.ReadSector(doneSectors + track.TrackStartSector); + sector = _inputFormat.ReadSector(doneSectors + track.TrackStartSector); result = outputFormat.WriteSector(sector, doneSectors + track.TrackStartSector); } else { - sector = inputFormat.ReadSectors(doneSectors + track.TrackStartSector, sectorsToDo); + sector = _inputFormat.ReadSectors(doneSectors + track.TrackStartSector, sectorsToDo); result = outputFormat.WriteSectors(sector, doneSectors + track.TrackStartSector, sectorsToDo); @@ -1310,13 +1300,13 @@ namespace Aaru.Gui.ViewModels.Windows } else { - await Dispatcher.UIThread.InvokeAsync(action: async () => - { - await MessageBoxManager. - GetMessageBoxStandardWindow("Error", - $"Error {outputFormat.ErrorMessage} writing sector {doneSectors}, not continuing...", - icon: Icon.Error).ShowDialog(_view); - }); + await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager. + GetMessageBoxStandardWindow("Error", + $"Error {outputFormat.ErrorMessage} writing sector {doneSectors}, not continuing...", + icon + : Icon. + Error). + ShowDialog(_view)); return; } @@ -1328,16 +1318,15 @@ namespace Aaru.Gui.ViewModels.Windows await Dispatcher.UIThread.InvokeAsync(() => { Progress2Text = - $"Converting sectors {inputFormat.Info.Sectors} to {inputFormat.Info.Sectors} in track {tracks.Count} ({1.0:P2} done)"; + $"Converting sectors {_inputFormat.Info.Sectors} to {_inputFormat.Info.Sectors} in track {tracks.Count} ({1.0:P2} done)"; Progress2Value = Progress2MaxValue; }); - foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags.OrderBy(t => t)) + foreach(SectorTagType tag in _inputFormat. + Info.ReadableSectorTags.OrderBy(t => t). + TakeWhile(tag => useLong && !_cancel)) { - if(!useLong || cancel) - break; - switch(tag) { case SectorTagType.AppleSectorTag: @@ -1355,11 +1344,8 @@ namespace Aaru.Gui.ViewModels.Windows if(ForceChecked && !outputFormat.SupportedSectorTags.Contains(tag)) continue; - foreach(Track track in tracks) + foreach(Track track in tracks.TakeWhile(track => !_cancel)) { - if(cancel) - break; - doneSectors = 0; ulong trackSectors = (track.TrackEndSector - track.TrackStartSector) + 1; byte[] sector; @@ -1379,7 +1365,7 @@ namespace Aaru.Gui.ViewModels.Windows case SectorTagType.CdTrackFlags: case SectorTagType.CdTrackIsrc: - sector = inputFormat.ReadSectorTag(track.TrackSequence, tag); + sector = _inputFormat.ReadSectorTag(track.TrackSequence, tag); result = outputFormat.WriteSectorTag(sector, track.TrackSequence, tag); if(!result) @@ -1393,12 +1379,13 @@ namespace Aaru.Gui.ViewModels.Windows else { await Dispatcher.UIThread.InvokeAsync(action: async () => - { - await MessageBoxManager. - GetMessageBoxStandardWindow("Error", - $"Error {outputFormat.ErrorMessage} writing tag, not continuing...", - icon: Icon.Error).ShowDialog(_view); - }); + await MessageBoxManager. + GetMessageBoxStandardWindow("Error", + $"Error {outputFormat.ErrorMessage} writing tag, not continuing...", + icon + : Icon. + Error). + ShowDialog(_view)); return; } @@ -1408,7 +1395,7 @@ namespace Aaru.Gui.ViewModels.Windows while(doneSectors < trackSectors) { - if(cancel) + if(_cancel) break; uint sectorsToDo; @@ -1423,20 +1410,20 @@ namespace Aaru.Gui.ViewModels.Windows await Dispatcher.UIThread.InvokeAsync(() => { Progress2Text = - $"Converting tag {tag} for sectors {sectors + track.TrackStartSector} to {sectors + sectorsToDo + track.TrackStartSector} in track {track.TrackSequence} ({(sectors + track.TrackStartSector) / (double)inputFormat.Info.Sectors:P2} done)"; + $"Converting tag {tag} for sectors {sectors + track.TrackStartSector} to {sectors + sectorsToDo + track.TrackStartSector} in track {track.TrackSequence} ({(sectors + track.TrackStartSector) / (double)_inputFormat.Info.Sectors:P2} done)"; Progress2Value = (int)(sectors / SectorsValue); }); if(sectorsToDo == 1) { - sector = inputFormat.ReadSectorTag(doneSectors + track.TrackStartSector, tag); + sector = _inputFormat.ReadSectorTag(doneSectors + track.TrackStartSector, tag); result = outputFormat.WriteSectorTag(sector, doneSectors + track.TrackStartSector, tag); } else { - sector = inputFormat.ReadSectorsTag(doneSectors + track.TrackStartSector, sectorsToDo, - tag); + sector = _inputFormat.ReadSectorsTag(doneSectors + track.TrackStartSector, sectorsToDo, + tag); result = outputFormat.WriteSectorsTag(sector, doneSectors + track.TrackStartSector, sectorsToDo, tag); @@ -1452,13 +1439,13 @@ namespace Aaru.Gui.ViewModels.Windows } else { - await Dispatcher.UIThread.InvokeAsync(action: async () => - { - await MessageBoxManager. - GetMessageBoxStandardWindow("Error", - $"Error {outputFormat.ErrorMessage} writing tag for sector {doneSectors}, not continuing...", - icon: Icon.Error).ShowDialog(_view); - }); + await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager. + GetMessageBoxStandardWindow("Error", + $"Error {outputFormat.ErrorMessage} writing tag for sector {doneSectors}, not continuing...", + icon + : Icon. + Error). + ShowDialog(_view)); return; } @@ -1477,8 +1464,8 @@ namespace Aaru.Gui.ViewModels.Windows bool ret; - if(dumpHardware != null && - !cancel) + if(_dumpHardware != null && + !_cancel) { await Dispatcher.UIThread.InvokeAsync(() => { @@ -1486,7 +1473,7 @@ namespace Aaru.Gui.ViewModels.Windows ProgressValue++; }); - ret = outputFormat.SetDumpHardware(dumpHardware); + ret = outputFormat.SetDumpHardware(_dumpHardware); if(!ret) AaruConsole.WriteLine("Error {0} writing dump hardware list to output image.", @@ -1495,8 +1482,8 @@ namespace Aaru.Gui.ViewModels.Windows ret = false; - if(cicmMetadata != null && - !cancel) + if(_cicmMetadata != null && + !_cancel) { await Dispatcher.UIThread.InvokeAsync(() => { @@ -1504,7 +1491,7 @@ namespace Aaru.Gui.ViewModels.Windows ProgressValue++; }); - outputFormat.SetCicmMetadata(cicmMetadata); + outputFormat.SetCicmMetadata(_cicmMetadata); if(!ret) AaruConsole.WriteLine("Error {0} writing CICM XML metadata to output image.", @@ -1517,7 +1504,7 @@ namespace Aaru.Gui.ViewModels.Windows ProgressIndeterminate = true; }); - if(cancel) + if(_cancel) { await Dispatcher.UIThread.InvokeAsync(action: async () => { @@ -1535,20 +1522,19 @@ namespace Aaru.Gui.ViewModels.Windows if(!outputFormat.Close()) { - await Dispatcher.UIThread.InvokeAsync(action: async () => - { - await MessageBoxManager. - GetMessageBoxStandardWindow("Error", - $"Error {outputFormat.ErrorMessage} closing output image... Contents are not correct.", - icon: Icon.Error).ShowDialog(_view); - }); + await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager. + GetMessageBoxStandardWindow("Error", + $"Error {outputFormat.ErrorMessage} closing output image... Contents are not correct.", + icon: Icon. + Error). + ShowDialog(_view)); return; } await Dispatcher.UIThread.InvokeAsync(action: async () => { - await MessageBoxManager.GetMessageBoxStandardWindow(warning ? "Warning" : "Convertion success", + await MessageBoxManager.GetMessageBoxStandardWindow(warning ? "Warning" : "Conversion success", warning ? "Some warnings happened. Check console for more information. Image should be correct." : "Image converted successfully.", @@ -1563,11 +1549,11 @@ namespace Aaru.Gui.ViewModels.Windows Statistics.AddCommand("convert-image"); } - protected void ExecuteCloseCommand() => _view.Close(); + void ExecuteCloseCommand() => _view.Close(); - protected internal void ExecuteStopCommand() + internal void ExecuteStopCommand() { - cancel = true; + _cancel = true; StopEnabled = false; } @@ -1737,45 +1723,45 @@ namespace Aaru.Gui.ViewModels.Windows DestinationText = result; } - void ExecuteCreatorCommand() => CreatorText = inputFormat.Info.Creator; + void ExecuteCreatorCommand() => CreatorText = _inputFormat.Info.Creator; - void ExecuteMediaTitleCommand() => MediaTitleText = inputFormat.Info.MediaTitle; + void ExecuteMediaTitleCommand() => MediaTitleText = _inputFormat.Info.MediaTitle; - void ExecuteCommentsCommand() => CommentsText = inputFormat.Info.Comments; + void ExecuteCommentsCommand() => CommentsText = _inputFormat.Info.Comments; - void ExecuteMediaManufacturerCommand() => MediaManufacturerText = inputFormat.Info.MediaManufacturer; + void ExecuteMediaManufacturerCommand() => MediaManufacturerText = _inputFormat.Info.MediaManufacturer; - void ExecuteMediaModelCommand() => MediaModelText = inputFormat.Info.MediaModel; + void ExecuteMediaModelCommand() => MediaModelText = _inputFormat.Info.MediaModel; - void ExecuteMediaSerialNumberCommand() => MediaSerialNumberText = inputFormat.Info.MediaSerialNumber; + void ExecuteMediaSerialNumberCommand() => MediaSerialNumberText = _inputFormat.Info.MediaSerialNumber; - void ExecuteMediaBarcodeCommand() => MediaBarcodeText = inputFormat.Info.MediaBarcode; + void ExecuteMediaBarcodeCommand() => MediaBarcodeText = _inputFormat.Info.MediaBarcode; - void ExecuteMediaPartNumberCommand() => MediaPartNumberText = inputFormat.Info.MediaPartNumber; + void ExecuteMediaPartNumberCommand() => MediaPartNumberText = _inputFormat.Info.MediaPartNumber; - void ExecuteMediaSequenceCommand() => MediaSequenceValue = inputFormat.Info.MediaSequence; + void ExecuteMediaSequenceCommand() => MediaSequenceValue = _inputFormat.Info.MediaSequence; - void ExecuteLastMediaSequenceCommand() => LastMediaSequenceValue = inputFormat.Info.LastMediaSequence; + void ExecuteLastMediaSequenceCommand() => LastMediaSequenceValue = _inputFormat.Info.LastMediaSequence; - void ExecuteDriveManufacturerCommand() => DriveManufacturerText = inputFormat.Info.DriveManufacturer; + void ExecuteDriveManufacturerCommand() => DriveManufacturerText = _inputFormat.Info.DriveManufacturer; - void ExecuteDriveModelCommand() => DriveModelText = inputFormat.Info.DriveModel; + void ExecuteDriveModelCommand() => DriveModelText = _inputFormat.Info.DriveModel; - void ExecuteDriveSerialNumberCommand() => DriveSerialNumberText = inputFormat.Info.DriveSerialNumber; + void ExecuteDriveSerialNumberCommand() => DriveSerialNumberText = _inputFormat.Info.DriveSerialNumber; void ExecuteDriveFirmwareRevisionCommand() => - DriveFirmwareRevisionText = inputFormat.Info.DriveFirmwareRevision; + DriveFirmwareRevisionText = _inputFormat.Info.DriveFirmwareRevision; void ExecuteCicmXmlFromImageCommand() { - CicmXmlText = ""; - cicmMetadata = inputFormat.CicmMetadata; + CicmXmlText = ""; + _cicmMetadata = _inputFormat.CicmMetadata; } async void ExecuteCicmXmlCommand() { - cicmMetadata = null; - CicmXmlText = ""; + _cicmMetadata = null; + CicmXmlText = ""; var dlgMetadata = new OpenFileDialog { @@ -1802,7 +1788,7 @@ namespace Aaru.Gui.ViewModels.Windows try { var sr = new StreamReader(result[0]); - cicmMetadata = (CICMMetadataType)sidecarXs.Deserialize(sr); + _cicmMetadata = (CICMMetadataType)sidecarXs.Deserialize(sr); sr.Close(); CicmXmlText = result[0]; } @@ -1816,12 +1802,12 @@ namespace Aaru.Gui.ViewModels.Windows void ExecuteResumeFileFromImageCommand() { ResumeFileText = ""; - dumpHardware = inputFormat.DumpHardware; + _dumpHardware = _inputFormat.DumpHardware; } async void ExecuteResumeFileCommand() { - dumpHardware = null; + _dumpHardware = null; ResumeFileText = ""; var dlgMetadata = new OpenFileDialog @@ -1851,10 +1837,9 @@ namespace Aaru.Gui.ViewModels.Windows var sr = new StreamReader(result[0]); var resume = (Resume)sidecarXs.Deserialize(sr); - if(resume.Tries != null && - !resume.Tries.Any()) + if(resume.Tries?.Any() == false) { - dumpHardware = resume.Tries; + _dumpHardware = resume.Tries; ResumeFileText = result[0]; } else diff --git a/Aaru.Gui/ViewModels/Windows/ImageEntropyViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageEntropyViewModel.cs index 5b2544159..05fc55d00 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageEntropyViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageEntropyViewModel.cs @@ -41,11 +41,12 @@ using Aaru.Core; using Aaru.Gui.Models; using Avalonia.Controls; using Avalonia.Threading; +using JetBrains.Annotations; using ReactiveUI; namespace Aaru.Gui.ViewModels.Windows { - public class ImageEntropyViewModel : ViewModelBase + public sealed class ImageEntropyViewModel : ViewModelBase { readonly IMediaImage _inputFormat; readonly Window _view; @@ -276,7 +277,8 @@ namespace Aaru.Gui.ViewModels.Windows set => this.RaiseAndSetIfChanged(ref _progress2Value, value); } - public string Title => "Calculating entropy"; + [NotNull] + public string Title => "Calculating entropy"; public ObservableCollection TrackEntropy { get; } public ReactiveCommand StartCommand { get; } public ReactiveCommand CloseCommand { get; } diff --git a/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs index fa120c9eb..f004de320 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs @@ -47,7 +47,7 @@ using Schemas; namespace Aaru.Gui.ViewModels.Windows { - public class ImageSidecarViewModel : ViewModelBase + public sealed class ImageSidecarViewModel : ViewModelBase { readonly Encoding _encoding; readonly Guid _filterId; diff --git a/Aaru.Gui/ViewModels/Windows/ImageVerifyViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageVerifyViewModel.cs index 67a8f9917..eaba34ab9 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageVerifyViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageVerifyViewModel.cs @@ -46,7 +46,7 @@ using ReactiveUI; namespace Aaru.Gui.ViewModels.Windows { - public class ImageVerifyViewModel : ViewModelBase + public sealed class ImageVerifyViewModel : ViewModelBase { readonly IMediaImage _inputFormat; readonly Window _view; @@ -658,7 +658,7 @@ namespace Aaru.Gui.ViewModels.Windows void ExecuteCloseCommand() => _view.Close(); - protected internal void ExecuteStopCommand() + internal void ExecuteStopCommand() { _cancel = true; StopEnabled = false; diff --git a/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs b/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs index 12d00eeb8..e8b5d41b2 100644 --- a/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs @@ -59,6 +59,7 @@ using Avalonia.Controls; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Media.Imaging; using Avalonia.Platform; +using JetBrains.Annotations; using MessageBox.Avalonia; using MessageBox.Avalonia.Enums; using ReactiveUI; @@ -69,7 +70,7 @@ using PlatformID = Aaru.CommonTypes.Interop.PlatformID; namespace Aaru.Gui.ViewModels.Windows { - public class MainWindowViewModel : ViewModelBase + public sealed class MainWindowViewModel : ViewModelBase { readonly IAssetLoader _assets; readonly DevicesRootModel _devicesRoot; @@ -81,13 +82,12 @@ namespace Aaru.Gui.ViewModels.Windows readonly ImagesRootModel _imagesRoot; readonly Bitmap _removableIcon; readonly Bitmap _sdIcon; - - readonly Bitmap _usbIcon; - readonly MainWindow _view; - Views.Dialogs.Console _console; - object _contentPanel; - bool _devicesSupported; - object _treeViewSelectedItem; + readonly Bitmap _usbIcon; + readonly MainWindow _view; + Views.Dialogs.Console _console; + object _contentPanel; + bool _devicesSupported; + object _treeViewSelectedItem; public MainWindowViewModel(MainWindow view) { @@ -173,7 +173,8 @@ namespace Aaru.Gui.ViewModels.Windows NativeMenu.GetIsNativeMenuExported((Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime)?.MainWindow); - public string Greeting => "Welcome to Aaru!"; + [NotNull] + public string Greeting => "Welcome to Aaru!"; public ObservableCollection TreeRoot { get; } public ReactiveCommand AboutCommand { get; } public ReactiveCommand ConsoleCommand { get; } @@ -349,10 +350,7 @@ namespace Aaru.Gui.ViewModels.Windows var imageEntropyWindow = new ImageEntropy(); imageEntropyWindow.DataContext = new ImageEntropyViewModel(imageModel.Image, imageEntropyWindow); - imageEntropyWindow.Closed += (sender, args) => - { - imageEntropyWindow = null; - }; + imageEntropyWindow.Closed += (sender, args) => imageEntropyWindow = null; imageEntropyWindow.Show(); } @@ -365,10 +363,7 @@ namespace Aaru.Gui.ViewModels.Windows var imageVerifyWindow = new ImageVerify(); imageVerifyWindow.DataContext = new ImageVerifyViewModel(imageModel.Image, imageVerifyWindow); - imageVerifyWindow.Closed += (sender, args) => - { - imageVerifyWindow = null; - }; + imageVerifyWindow.Closed += (sender, args) => imageVerifyWindow = null; imageVerifyWindow.Show(); } @@ -381,10 +376,7 @@ namespace Aaru.Gui.ViewModels.Windows var imageChecksumWindow = new ImageChecksum(); imageChecksumWindow.DataContext = new ImageChecksumViewModel(imageModel.Image, imageChecksumWindow); - imageChecksumWindow.Closed += (sender, args) => - { - imageChecksumWindow = null; - }; + imageChecksumWindow.Closed += (sender, args) => imageChecksumWindow = null; imageChecksumWindow.Show(); } @@ -399,10 +391,7 @@ namespace Aaru.Gui.ViewModels.Windows imageConvertWindow.DataContext = new ImageConvertViewModel(imageModel.Image, imageModel.Path, imageConvertWindow); - imageConvertWindow.Closed += (sender, args) => - { - imageConvertWindow = null; - }; + imageConvertWindow.Closed += (sender, args) => imageConvertWindow = null; imageConvertWindow.Show(); } diff --git a/Aaru.Gui/ViewModels/Windows/MediaDumpViewModel.cs b/Aaru.Gui/ViewModels/Windows/MediaDumpViewModel.cs index 46aded9c8..8c1d11115 100644 --- a/Aaru.Gui/ViewModels/Windows/MediaDumpViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/MediaDumpViewModel.cs @@ -52,6 +52,7 @@ using Aaru.Gui.Models; using Avalonia.Controls; using Avalonia.Threading; using DynamicData; +using JetBrains.Annotations; using MessageBox.Avalonia; using MessageBox.Avalonia.Enums; using ReactiveUI; @@ -61,7 +62,7 @@ using MediaType = Aaru.CommonTypes.MediaType; namespace Aaru.Gui.ViewModels.Windows { - public class MediaDumpViewModel : ViewModelBase + public sealed class MediaDumpViewModel : ViewModelBase { readonly string _devicePath; readonly Window _view; @@ -106,7 +107,8 @@ namespace Aaru.Gui.ViewModels.Windows bool _useResume; bool _useSidecar; - public MediaDumpViewModel(string devicePath, DeviceInfo deviceInfo, Window view, ScsiInfo scsiInfo = null) + public MediaDumpViewModel(string devicePath, DeviceInfo deviceInfo, Window view, + [CanBeNull] ScsiInfo scsiInfo = null) { _view = view; DestinationEnabled = true; @@ -660,7 +662,7 @@ namespace Aaru.Gui.ViewModels.Windows Destination = result; - _outputPrefix = Path.Combine(Path.GetDirectoryName(result), Path.GetFileNameWithoutExtension(result)); + _outputPrefix = Path.Combine(Path.GetDirectoryName(result) ?? "", Path.GetFileNameWithoutExtension(result)); Resume = true; } diff --git a/Aaru.Gui/ViewModels/Windows/MediaScanViewModel.cs b/Aaru.Gui/ViewModels/Windows/MediaScanViewModel.cs index 8f01e5dd0..e7b201a5c 100644 --- a/Aaru.Gui/ViewModels/Windows/MediaScanViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/MediaScanViewModel.cs @@ -46,7 +46,7 @@ using ReactiveUI; namespace Aaru.Gui.ViewModels.Windows { - public class MediaScanViewModel : ViewModelBase + public sealed class MediaScanViewModel : ViewModelBase { readonly Window _view; string _a; @@ -390,9 +390,9 @@ namespace Aaru.Gui.ViewModels.Windows // TODO: Show results /* - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator + if(results.SeekTotal != 0 || results.SeekMin != double.MaxValue || results.SeekMax != double.MinValue) - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator + string.Format("Testing {0} seeks, longest seek took {1:F3} ms, fastest one took {2:F3} ms. ({3:F3} ms average)", results.SeekTimes, results.SeekMax, results.SeekMin, results.SeekTotal / 1000); */ diff --git a/Aaru.Gui/ViewModels/Windows/SplashWindowViewModel.cs b/Aaru.Gui/ViewModels/Windows/SplashWindowViewModel.cs index 133143330..edeaddd84 100644 --- a/Aaru.Gui/ViewModels/Windows/SplashWindowViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/SplashWindowViewModel.cs @@ -48,7 +48,7 @@ using ReactiveUI; namespace Aaru.Gui.ViewModels.Windows { - public class SplashWindowViewModel : ViewModelBase + public sealed class SplashWindowViewModel : ViewModelBase { readonly SplashWindow _view; double _currentProgress; @@ -147,21 +147,20 @@ namespace Aaru.Gui.ViewModels.Windows } // Remove duplicates - foreach(var duplicate in ctx.SeenDevices.AsEnumerable().GroupBy(a => new + foreach(var duplicate in ctx.SeenDevices.AsEnumerable()!.GroupBy(a => new { a.Manufacturer, a.Model, a.Revision, a.Bus }).Where(a => a.Count() > 1).Distinct().Select(a => a.Key)) - ctx.RemoveRange(ctx.SeenDevices. - Where(d => d.Manufacturer == duplicate.Manufacturer && - d.Model == duplicate.Model && d.Revision == duplicate.Revision && - d.Bus == duplicate.Bus).Skip(1)); + ctx.RemoveRange(ctx.SeenDevices!. + Where(d => d.Manufacturer == duplicate.Manufacturer && d.Model == duplicate.Model && + d.Revision == duplicate.Revision && d.Bus == duplicate.Bus).Skip(1)); // Remove nulls - ctx.RemoveRange(ctx.SeenDevices.Where(d => d.Manufacturer == null && d.Model == null && - d.Revision == null)); + ctx.RemoveRange(ctx.SeenDevices!.Where(d => d.Manufacturer == null && d.Model == null && + d.Revision == null)); ctx.SaveChanges(); diff --git a/Aaru.Gui/ViewModels/Windows/ViewSectorViewModel.cs b/Aaru.Gui/ViewModels/Windows/ViewSectorViewModel.cs index 3a63ee998..65f267a3c 100644 --- a/Aaru.Gui/ViewModels/Windows/ViewSectorViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ViewSectorViewModel.cs @@ -32,14 +32,15 @@ using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; +using JetBrains.Annotations; using ReactiveUI; namespace Aaru.Gui.ViewModels.Windows { - public class ViewSectorViewModel : ViewModelBase + public sealed class ViewSectorViewModel : ViewModelBase { const int HEX_COLUMNS = 32; - readonly IMediaImage inputFormat; + readonly IMediaImage _inputFormat; bool _longSectorChecked; bool _longSectorVisible; string _printHexText; @@ -47,9 +48,9 @@ namespace Aaru.Gui.ViewModels.Windows string _title; string _totalSectorsText; - public ViewSectorViewModel(IMediaImage inputFormat) + public ViewSectorViewModel([NotNull] IMediaImage inputFormat) { - this.inputFormat = inputFormat; + _inputFormat = inputFormat; try { @@ -80,7 +81,7 @@ namespace Aaru.Gui.ViewModels.Windows PrintHexText = PrintHex. - ByteArrayToHexArrayString(LongSectorChecked ? inputFormat.ReadSectorLong((ulong)SectorNumber) : inputFormat.ReadSector((ulong)SectorNumber), + ByteArrayToHexArrayString(LongSectorChecked ? _inputFormat.ReadSectorLong((ulong)SectorNumber) : _inputFormat.ReadSector((ulong)SectorNumber), HEX_COLUMNS); } } diff --git a/Aaru.Gui/Views/Dialogs/About.xaml.cs b/Aaru.Gui/Views/Dialogs/About.xaml.cs index 2e93e56bb..ae2fdf142 100644 --- a/Aaru.Gui/Views/Dialogs/About.xaml.cs +++ b/Aaru.Gui/Views/Dialogs/About.xaml.cs @@ -36,7 +36,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Dialogs { - public class About : Window + public sealed class About : Window { public About() { diff --git a/Aaru.Gui/Views/Dialogs/Console.xaml.cs b/Aaru.Gui/Views/Dialogs/Console.xaml.cs index 02a76eda8..94772e47c 100644 --- a/Aaru.Gui/Views/Dialogs/Console.xaml.cs +++ b/Aaru.Gui/Views/Dialogs/Console.xaml.cs @@ -34,10 +34,11 @@ using System.ComponentModel; using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; +using JetBrains.Annotations; namespace Aaru.Gui.Views.Dialogs { - public class Console : Window + public sealed class Console : Window { public Console() { @@ -49,7 +50,7 @@ namespace Aaru.Gui.Views.Dialogs void InitializeComponent() => AvaloniaXamlLoader.Load(this); - protected override void OnClosing(CancelEventArgs e) + protected override void OnClosing([NotNull] CancelEventArgs e) { e.Cancel = true; Hide(); diff --git a/Aaru.Gui/Views/Dialogs/Encodings.xaml.cs b/Aaru.Gui/Views/Dialogs/Encodings.xaml.cs index 437980e58..84d976c33 100644 --- a/Aaru.Gui/Views/Dialogs/Encodings.xaml.cs +++ b/Aaru.Gui/Views/Dialogs/Encodings.xaml.cs @@ -36,7 +36,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Dialogs { - public class Encodings : Window + public sealed class Encodings : Window { public Encodings() { diff --git a/Aaru.Gui/Views/Dialogs/LicenseDialog.xaml.cs b/Aaru.Gui/Views/Dialogs/LicenseDialog.xaml.cs index 2b380ccfd..abd89a4d0 100644 --- a/Aaru.Gui/Views/Dialogs/LicenseDialog.xaml.cs +++ b/Aaru.Gui/Views/Dialogs/LicenseDialog.xaml.cs @@ -36,7 +36,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Dialogs { - public class LicenseDialog : Window + public sealed class LicenseDialog : Window { public LicenseDialog() { diff --git a/Aaru.Gui/Views/Dialogs/PluginsDialog.xaml.cs b/Aaru.Gui/Views/Dialogs/PluginsDialog.xaml.cs index 5edd724fe..f8816f6fc 100644 --- a/Aaru.Gui/Views/Dialogs/PluginsDialog.xaml.cs +++ b/Aaru.Gui/Views/Dialogs/PluginsDialog.xaml.cs @@ -36,7 +36,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Dialogs { - public class PluginsDialog : Window + public sealed class PluginsDialog : Window { public PluginsDialog() { diff --git a/Aaru.Gui/Views/Dialogs/SettingsDialog.xaml.cs b/Aaru.Gui/Views/Dialogs/SettingsDialog.xaml.cs index 10cc1ef92..076885eaa 100644 --- a/Aaru.Gui/Views/Dialogs/SettingsDialog.xaml.cs +++ b/Aaru.Gui/Views/Dialogs/SettingsDialog.xaml.cs @@ -36,7 +36,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Dialogs { - public class SettingsDialog : Window + public sealed class SettingsDialog : Window { public SettingsDialog() { diff --git a/Aaru.Gui/Views/Dialogs/StatisticsDialog.xaml.cs b/Aaru.Gui/Views/Dialogs/StatisticsDialog.xaml.cs index 37f744087..01d057819 100644 --- a/Aaru.Gui/Views/Dialogs/StatisticsDialog.xaml.cs +++ b/Aaru.Gui/Views/Dialogs/StatisticsDialog.xaml.cs @@ -36,7 +36,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Dialogs { - public class StatisticsDialog : Window + public sealed class StatisticsDialog : Window { public StatisticsDialog() { diff --git a/Aaru.Gui/Views/Panels/DeviceInfo.xaml.cs b/Aaru.Gui/Views/Panels/DeviceInfo.xaml.cs index 31029998f..a10f04d46 100644 --- a/Aaru.Gui/Views/Panels/DeviceInfo.xaml.cs +++ b/Aaru.Gui/Views/Panels/DeviceInfo.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Panels { - public class DeviceInfo : UserControl + public sealed class DeviceInfo : UserControl { public DeviceInfo() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Panels/FileSystem.xaml.cs b/Aaru.Gui/Views/Panels/FileSystem.xaml.cs index bc26bb065..9d2939986 100644 --- a/Aaru.Gui/Views/Panels/FileSystem.xaml.cs +++ b/Aaru.Gui/Views/Panels/FileSystem.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Panels { - public class FileSystem : UserControl + public sealed class FileSystem : UserControl { public FileSystem() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Panels/ImageInfo.xaml.cs b/Aaru.Gui/Views/Panels/ImageInfo.xaml.cs index 7e5c30bf5..71249b449 100644 --- a/Aaru.Gui/Views/Panels/ImageInfo.xaml.cs +++ b/Aaru.Gui/Views/Panels/ImageInfo.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Panels { - public class ImageInfo : UserControl + public sealed class ImageInfo : UserControl { public ImageInfo() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Panels/MediaInfo.xaml.cs b/Aaru.Gui/Views/Panels/MediaInfo.xaml.cs index 8005b9450..5459160a8 100644 --- a/Aaru.Gui/Views/Panels/MediaInfo.xaml.cs +++ b/Aaru.Gui/Views/Panels/MediaInfo.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Panels { - public class MediaInfo : UserControl + public sealed class MediaInfo : UserControl { public MediaInfo() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Panels/Partition.xaml.cs b/Aaru.Gui/Views/Panels/Partition.xaml.cs index 20ac60869..e9d718a4d 100644 --- a/Aaru.Gui/Views/Panels/Partition.xaml.cs +++ b/Aaru.Gui/Views/Panels/Partition.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Panels { - public class Partition : UserControl + public sealed class Partition : UserControl { public Partition() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Panels/Subdirectory.xaml.cs b/Aaru.Gui/Views/Panels/Subdirectory.xaml.cs index 795eedefe..adcc54b43 100644 --- a/Aaru.Gui/Views/Panels/Subdirectory.xaml.cs +++ b/Aaru.Gui/Views/Panels/Subdirectory.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Panels { - public class Subdirectory : UserControl + public sealed class Subdirectory : UserControl { public Subdirectory() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Tabs/AtaInfo.xaml.cs b/Aaru.Gui/Views/Tabs/AtaInfo.xaml.cs index 7792eb69e..b834471b0 100644 --- a/Aaru.Gui/Views/Tabs/AtaInfo.xaml.cs +++ b/Aaru.Gui/Views/Tabs/AtaInfo.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Tabs { - public class AtaInfo : UserControl + public sealed class AtaInfo : UserControl { public AtaInfo() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Tabs/BlurayInfo.xaml.cs b/Aaru.Gui/Views/Tabs/BlurayInfo.xaml.cs index c9111011e..dbb8fc660 100644 --- a/Aaru.Gui/Views/Tabs/BlurayInfo.xaml.cs +++ b/Aaru.Gui/Views/Tabs/BlurayInfo.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Tabs { - public class BlurayInfo : UserControl + public sealed class BlurayInfo : UserControl { public BlurayInfo() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Tabs/CompactDiscInfo.xaml.cs b/Aaru.Gui/Views/Tabs/CompactDiscInfo.xaml.cs index 6feacd243..c71015b25 100644 --- a/Aaru.Gui/Views/Tabs/CompactDiscInfo.xaml.cs +++ b/Aaru.Gui/Views/Tabs/CompactDiscInfo.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Tabs { - public class CompactDiscInfo : UserControl + public sealed class CompactDiscInfo : UserControl { public CompactDiscInfo() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Tabs/DvdInfo.xaml.cs b/Aaru.Gui/Views/Tabs/DvdInfo.xaml.cs index deca61083..b8e17ba4a 100644 --- a/Aaru.Gui/Views/Tabs/DvdInfo.xaml.cs +++ b/Aaru.Gui/Views/Tabs/DvdInfo.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Tabs { - public class DvdInfo : UserControl + public sealed class DvdInfo : UserControl { public DvdInfo() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Tabs/DvdWritableInfo.xaml.cs b/Aaru.Gui/Views/Tabs/DvdWritableInfo.xaml.cs index 4145aacc1..322f32ce5 100644 --- a/Aaru.Gui/Views/Tabs/DvdWritableInfo.xaml.cs +++ b/Aaru.Gui/Views/Tabs/DvdWritableInfo.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Tabs { - public class DvdWritableInfo : UserControl + public sealed class DvdWritableInfo : UserControl { public DvdWritableInfo() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Tabs/PcmciaInfo.xaml b/Aaru.Gui/Views/Tabs/PcmciaInfo.xaml index 33cb9edbf..faf29249b 100644 --- a/Aaru.Gui/Views/Tabs/PcmciaInfo.xaml +++ b/Aaru.Gui/Views/Tabs/PcmciaInfo.xaml @@ -41,7 +41,7 @@ - + diff --git a/Aaru.Gui/Views/Tabs/PcmciaInfo.xaml.cs b/Aaru.Gui/Views/Tabs/PcmciaInfo.xaml.cs index 87d67f2dc..022469c77 100644 --- a/Aaru.Gui/Views/Tabs/PcmciaInfo.xaml.cs +++ b/Aaru.Gui/Views/Tabs/PcmciaInfo.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Tabs { - public class PcmciaInfo : UserControl + public sealed class PcmciaInfo : UserControl { public PcmciaInfo() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Tabs/ScsiInfo.xaml.cs b/Aaru.Gui/Views/Tabs/ScsiInfo.xaml.cs index 487be6d72..12e5a15be 100644 --- a/Aaru.Gui/Views/Tabs/ScsiInfo.xaml.cs +++ b/Aaru.Gui/Views/Tabs/ScsiInfo.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Tabs { - public class ScsiInfo : UserControl + public sealed class ScsiInfo : UserControl { public ScsiInfo() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Tabs/SdMmcInfo.xaml.cs b/Aaru.Gui/Views/Tabs/SdMmcInfo.xaml.cs index 03bc03bd5..fa7a38dd7 100644 --- a/Aaru.Gui/Views/Tabs/SdMmcInfo.xaml.cs +++ b/Aaru.Gui/Views/Tabs/SdMmcInfo.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Tabs { - public class SdMmcInfo : UserControl + public sealed class SdMmcInfo : UserControl { public SdMmcInfo() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Tabs/XboxInfo.xaml.cs b/Aaru.Gui/Views/Tabs/XboxInfo.xaml.cs index 0dbbf85e4..d69b704b3 100644 --- a/Aaru.Gui/Views/Tabs/XboxInfo.xaml.cs +++ b/Aaru.Gui/Views/Tabs/XboxInfo.xaml.cs @@ -35,7 +35,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Tabs { - public class XboxInfo : UserControl + public sealed class XboxInfo : UserControl { public XboxInfo() => InitializeComponent(); diff --git a/Aaru.Gui/Views/Windows/DecodeMediaTags.xaml.cs b/Aaru.Gui/Views/Windows/DecodeMediaTags.xaml.cs index 22117f032..4f2d9119c 100644 --- a/Aaru.Gui/Views/Windows/DecodeMediaTags.xaml.cs +++ b/Aaru.Gui/Views/Windows/DecodeMediaTags.xaml.cs @@ -36,7 +36,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Windows { - public class DecodeMediaTags : Window + public sealed class DecodeMediaTags : Window { public DecodeMediaTags() { diff --git a/Aaru.Gui/Views/Windows/ImageChecksum.xaml.cs b/Aaru.Gui/Views/Windows/ImageChecksum.xaml.cs index 6b01316d7..d57c20711 100644 --- a/Aaru.Gui/Views/Windows/ImageChecksum.xaml.cs +++ b/Aaru.Gui/Views/Windows/ImageChecksum.xaml.cs @@ -38,7 +38,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Windows { - public class ImageChecksum : Window + public sealed class ImageChecksum : Window { public ImageChecksum() { diff --git a/Aaru.Gui/Views/Windows/ImageConvert.xaml.cs b/Aaru.Gui/Views/Windows/ImageConvert.xaml.cs index 91d8cbb21..4df5c013f 100644 --- a/Aaru.Gui/Views/Windows/ImageConvert.xaml.cs +++ b/Aaru.Gui/Views/Windows/ImageConvert.xaml.cs @@ -38,7 +38,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Windows { - public class ImageConvert : Window + public sealed class ImageConvert : Window { public ImageConvert() { diff --git a/Aaru.Gui/Views/Windows/ImageEntropy.xaml.cs b/Aaru.Gui/Views/Windows/ImageEntropy.xaml.cs index 43c06492a..3ab0f22ac 100644 --- a/Aaru.Gui/Views/Windows/ImageEntropy.xaml.cs +++ b/Aaru.Gui/Views/Windows/ImageEntropy.xaml.cs @@ -38,7 +38,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Windows { - public class ImageEntropy : Window + public sealed class ImageEntropy : Window { public ImageEntropy() { diff --git a/Aaru.Gui/Views/Windows/ImageSidecar.xaml.cs b/Aaru.Gui/Views/Windows/ImageSidecar.xaml.cs index 06cc6b1f0..0fc734508 100644 --- a/Aaru.Gui/Views/Windows/ImageSidecar.xaml.cs +++ b/Aaru.Gui/Views/Windows/ImageSidecar.xaml.cs @@ -36,7 +36,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Windows { - public class ImageSidecar : Window + public sealed class ImageSidecar : Window { public ImageSidecar() { diff --git a/Aaru.Gui/Views/Windows/ImageVerify.xaml.cs b/Aaru.Gui/Views/Windows/ImageVerify.xaml.cs index c2d0fb772..963b3177b 100644 --- a/Aaru.Gui/Views/Windows/ImageVerify.xaml.cs +++ b/Aaru.Gui/Views/Windows/ImageVerify.xaml.cs @@ -38,7 +38,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Windows { - public class ImageVerify : Window + public sealed class ImageVerify : Window { public ImageVerify() { diff --git a/Aaru.Gui/Views/Windows/MainWindow.xaml.cs b/Aaru.Gui/Views/Windows/MainWindow.xaml.cs index 4e8d6b3ca..3846554f3 100644 --- a/Aaru.Gui/Views/Windows/MainWindow.xaml.cs +++ b/Aaru.Gui/Views/Windows/MainWindow.xaml.cs @@ -38,7 +38,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Windows { - public class MainWindow : Window + public sealed class MainWindow : Window { public MainWindow() { diff --git a/Aaru.Gui/Views/Windows/MediaDump.xaml.cs b/Aaru.Gui/Views/Windows/MediaDump.xaml.cs index e66dbe058..d5d184fea 100644 --- a/Aaru.Gui/Views/Windows/MediaDump.xaml.cs +++ b/Aaru.Gui/Views/Windows/MediaDump.xaml.cs @@ -38,7 +38,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Windows { - public class MediaDump : Window + public sealed class MediaDump : Window { public MediaDump() { diff --git a/Aaru.Gui/Views/Windows/MediaScan.xaml.cs b/Aaru.Gui/Views/Windows/MediaScan.xaml.cs index 7c3d05bc8..9ac727660 100644 --- a/Aaru.Gui/Views/Windows/MediaScan.xaml.cs +++ b/Aaru.Gui/Views/Windows/MediaScan.xaml.cs @@ -38,7 +38,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Windows { - public class MediaScan : Window + public sealed class MediaScan : Window { public MediaScan() { diff --git a/Aaru.Gui/Views/Windows/SplashWindow.xaml.cs b/Aaru.Gui/Views/Windows/SplashWindow.xaml.cs index fd49a68df..a49dcdd6d 100644 --- a/Aaru.Gui/Views/Windows/SplashWindow.xaml.cs +++ b/Aaru.Gui/Views/Windows/SplashWindow.xaml.cs @@ -38,7 +38,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Windows { - public class SplashWindow : Window + public sealed class SplashWindow : Window { public SplashWindow() { diff --git a/Aaru.Gui/Views/Windows/ViewSector.xaml.cs b/Aaru.Gui/Views/Windows/ViewSector.xaml.cs index 03b51ba88..c67e1c65d 100644 --- a/Aaru.Gui/Views/Windows/ViewSector.xaml.cs +++ b/Aaru.Gui/Views/Windows/ViewSector.xaml.cs @@ -36,7 +36,7 @@ using Avalonia.Markup.Xaml; namespace Aaru.Gui.Views.Windows { - public class ViewSector : Window + public sealed class ViewSector : Window { public ViewSector() { diff --git a/Aaru.Helpers b/Aaru.Helpers index bc471c3ff..b23d976f9 160000 --- a/Aaru.Helpers +++ b/Aaru.Helpers @@ -1 +1 @@ -Subproject commit bc471c3ff84134692081cd89f85f6f49df9de28a +Subproject commit b23d976f9334f0bc2e59e4d61f047be65cc47500 diff --git a/Aaru.Images/AaruFormat/AaruFormat.cs b/Aaru.Images/AaruFormat/AaruFormat.cs index 1d1d5623d..110738dea 100644 --- a/Aaru.Images/AaruFormat/AaruFormat.cs +++ b/Aaru.Images/AaruFormat/AaruFormat.cs @@ -65,7 +65,7 @@ the pointer in the corresponding deduplication table. P.S.: Data Position Measurement is doable, as soon as I know how to do it. - P.S.2: Support for floppy image containg bitslices and/or fluxes will be added soon. + P.S.2: Support for floppy image contaning bitslices and/or fluxes will be added soon. */ using System; @@ -81,7 +81,7 @@ using SharpCompress.Compressors.LZMA; namespace Aaru.DiscImages { - public partial class AaruFormat : IWritableOpticalImage, IVerifiableImage, IWritableTapeImage + public sealed partial class AaruFormat : IWritableOpticalImage, IVerifiableImage, IWritableTapeImage { bool _alreadyWrittenZero; /// Cache of uncompressed blocks. diff --git a/Aaru.Images/AaruFormat/CdEcc.cs b/Aaru.Images/AaruFormat/CdEcc.cs index 92291689c..e56560a40 100644 --- a/Aaru.Images/AaruFormat/CdEcc.cs +++ b/Aaru.Images/AaruFormat/CdEcc.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Enums; namespace Aaru.DiscImages { - public partial class AaruFormat + public sealed partial class AaruFormat { byte[] _eccBTable; byte[] _eccFTable; @@ -111,14 +111,14 @@ namespace Aaru.DiscImages if(!_initedEdc) EccInit(); - byte[] zeroaddress = new byte[4]; + byte[] zeroAddress = new byte[4]; - bool correctEccP = CheckEcc(zeroaddress, sector, 86, 24, 2, 86, sector, 0, 0x10, 0x81C); + bool correctEccP = CheckEcc(zeroAddress, sector, 86, 24, 2, 86, sector, 0, 0x10, 0x81C); if(!correctEccP) return false; - bool correctEccQ = CheckEcc(zeroaddress, sector, 52, 43, 86, 88, sector, 0, 0x10, 0x81C + 0xAC); + bool correctEccQ = CheckEcc(zeroAddress, sector, 52, 43, 86, 88, sector, 0, 0x10, 0x81C + 0xAC); if(!correctEccQ) return false; @@ -309,7 +309,7 @@ namespace Aaru.DiscImages default: return; } - byte[] zeroaddress = new byte[4]; + byte[] zeroAddress = new byte[4]; switch(type) { @@ -332,7 +332,7 @@ namespace Aaru.DiscImages break; case TrackType.CdMode2Form1: - EccWriteSector(zeroaddress, sector, ref sector, 0, 0x10, 0x81C); + EccWriteSector(zeroAddress, sector, ref sector, 0, 0x10, 0x81C); break; default: return; diff --git a/Aaru.Images/AaruFormat/ClauniaSubchannelTransform.cs b/Aaru.Images/AaruFormat/ClauniaSubchannelTransform.cs index 2d15e7526..bcdb47890 100644 --- a/Aaru.Images/AaruFormat/ClauniaSubchannelTransform.cs +++ b/Aaru.Images/AaruFormat/ClauniaSubchannelTransform.cs @@ -35,7 +35,7 @@ using Aaru.Console; namespace Aaru.DiscImages { - public partial class AaruFormat + public sealed partial class AaruFormat { static byte[] ClauniaSubchannelTransform(byte[] interleaved) { diff --git a/Aaru.Images/AaruFormat/Constants.cs b/Aaru.Images/AaruFormat/Constants.cs index 3bce618c8..e95130b46 100644 --- a/Aaru.Images/AaruFormat/Constants.cs +++ b/Aaru.Images/AaruFormat/Constants.cs @@ -32,11 +32,11 @@ namespace Aaru.DiscImages { - public partial class AaruFormat + public sealed partial class AaruFormat { - /// Old magic identidier = "DICMFRMT". + /// Old magic identifier = "DICMFRMT". const ulong DIC_MAGIC = 0x544D52464D434944; - /// Magic identidier = "AARUFRMT". + /// Magic identifier = "AARUFRMT". const ulong AARU_MAGIC = 0x544D524655524141; /// /// Image format version. A change in this number indicates an incompatible change to the format that prevents diff --git a/Aaru.Images/AaruFormat/Enums.cs b/Aaru.Images/AaruFormat/Enums.cs index cba666418..70f3e819d 100644 --- a/Aaru.Images/AaruFormat/Enums.cs +++ b/Aaru.Images/AaruFormat/Enums.cs @@ -34,7 +34,7 @@ namespace Aaru.DiscImages { - public partial class AaruFormat + public sealed partial class AaruFormat { /// List of known compression types enum CompressionType : ushort diff --git a/Aaru.Images/AaruFormat/Helpers.cs b/Aaru.Images/AaruFormat/Helpers.cs index 7db28e545..4a53c94ac 100644 --- a/Aaru.Images/AaruFormat/Helpers.cs +++ b/Aaru.Images/AaruFormat/Helpers.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class AaruFormat + public sealed partial class AaruFormat { /// Checks for media tags that may contain metadata and sets it up if not already set void SetMetadataFromTags() diff --git a/Aaru.Images/AaruFormat/Identify.cs b/Aaru.Images/AaruFormat/Identify.cs index 181be2ae7..a991764d8 100644 --- a/Aaru.Images/AaruFormat/Identify.cs +++ b/Aaru.Images/AaruFormat/Identify.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class AaruFormat + public sealed partial class AaruFormat { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/AaruFormat/Properties.cs b/Aaru.Images/AaruFormat/Properties.cs index f6ea1ca09..0ed3356da 100644 --- a/Aaru.Images/AaruFormat/Properties.cs +++ b/Aaru.Images/AaruFormat/Properties.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class AaruFormat + public sealed partial class AaruFormat { public OpticalImageCapabilities OpticalCapabilities => OpticalImageCapabilities.CanStoreAudioTracks | OpticalImageCapabilities.CanStoreDataTracks | diff --git a/Aaru.Images/AaruFormat/Read.cs b/Aaru.Images/AaruFormat/Read.cs index 5566e8d30..4ba8c5b2d 100644 --- a/Aaru.Images/AaruFormat/Read.cs +++ b/Aaru.Images/AaruFormat/Read.cs @@ -54,7 +54,7 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType; namespace Aaru.DiscImages { - public partial class AaruFormat + public sealed partial class AaruFormat { public bool Open(IFilter imageFilter) { @@ -383,112 +383,124 @@ namespace Aaru.DiscImages if(ddtHeader.identifier != BlockType.DeDuplicationTable) break; - if(entry.dataType == DataType.UserData) + switch(entry.dataType) { - _imageInfo.Sectors = ddtHeader.entries; - _shift = ddtHeader.shift; + case DataType.UserData: + _imageInfo.Sectors = ddtHeader.entries; + _shift = ddtHeader.shift; - AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", + GC.GetTotalMemory(false)); - // Check for DDT compression - switch(ddtHeader.compression) + // Check for DDT compression + switch(ddtHeader.compression) + { + case CompressionType.Lzma: + AaruConsole.DebugWriteLine("Aaru Format plugin", "Decompressing DDT..."); + DateTime ddtStart = DateTime.UtcNow; + byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; + byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; + _imageStream.Read(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH); + _imageStream.Read(compressedDdt, 0, compressedDdt.Length); + var compressedDdtMs = new MemoryStream(compressedDdt); + var lzmaDdt = new LzmaStream(lzmaProperties, compressedDdtMs); + byte[] decompressedDdt = new byte[ddtHeader.length]; + lzmaDdt.Read(decompressedDdt, 0, (int)ddtHeader.length); + lzmaDdt.Close(); + compressedDdtMs.Close(); + _userDataDdt = MemoryMarshal.Cast(decompressedDdt).ToArray(); + DateTime ddtEnd = DateTime.UtcNow; + _inMemoryDdt = true; + + AaruConsole.DebugWriteLine("Aaru Format plugin", + "Took {0} seconds to decompress DDT", + (ddtEnd - ddtStart).TotalSeconds); + + AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", + GC.GetTotalMemory(false)); + + break; + case CompressionType.None: + _inMemoryDdt = false; + _outMemoryDdtPosition = (long)entry.offset; + + AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", + GC.GetTotalMemory(false)); + + break; + default: + throw new + ImageNotSupportedException($"Found unsupported compression algorithm {(ushort)ddtHeader.compression}"); + } + + foundUserDataDdt = true; + + break; + case DataType.CdSectorPrefixCorrected: + case DataType.CdSectorSuffixCorrected: { - case CompressionType.Lzma: - AaruConsole.DebugWriteLine("Aaru Format plugin", "Decompressing DDT..."); - DateTime ddtStart = DateTime.UtcNow; - byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; - byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; - _imageStream.Read(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH); - _imageStream.Read(compressedDdt, 0, compressedDdt.Length); - var compressedDdtMs = new MemoryStream(compressedDdt); - var lzmaDdt = new LzmaStream(lzmaProperties, compressedDdtMs); - byte[] decompressedDdt = new byte[ddtHeader.length]; - lzmaDdt.Read(decompressedDdt, 0, (int)ddtHeader.length); - lzmaDdt.Close(); - compressedDdtMs.Close(); - _userDataDdt = MemoryMarshal.Cast(decompressedDdt).ToArray(); - DateTime ddtEnd = DateTime.UtcNow; - _inMemoryDdt = true; + uint[] cdDdt = new uint[ddtHeader.entries]; + byte[] decompressedDdt = new byte[ddtHeader.length]; - AaruConsole.DebugWriteLine("Aaru Format plugin", - "Took {0} seconds to decompress DDT", - (ddtEnd - ddtStart).TotalSeconds); + AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", + GC.GetTotalMemory(false)); - AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", - GC.GetTotalMemory(false)); + // Check for DDT compression + switch(ddtHeader.compression) + { + case CompressionType.Lzma: + AaruConsole.DebugWriteLine("Aaru Format plugin", "Decompressing DDT..."); + DateTime ddtStart = DateTime.UtcNow; + byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; + byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; + _imageStream.Read(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH); + _imageStream.Read(compressedDdt, 0, compressedDdt.Length); + var compressedDdtMs = new MemoryStream(compressedDdt); + var lzmaDdt = new LzmaStream(lzmaProperties, compressedDdtMs); + lzmaDdt.Read(decompressedDdt, 0, (int)ddtHeader.length); + lzmaDdt.Close(); + compressedDdtMs.Close(); + DateTime ddtEnd = DateTime.UtcNow; - break; - case CompressionType.None: - _inMemoryDdt = false; - _outMemoryDdtPosition = (long)entry.offset; + AaruConsole.DebugWriteLine("Aaru Format plugin", + "Took {0} seconds to decompress DDT", + (ddtEnd - ddtStart).TotalSeconds); - AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", - GC.GetTotalMemory(false)); + AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", + GC.GetTotalMemory(false)); - break; - default: - throw new - ImageNotSupportedException($"Found unsupported compression algorithm {(ushort)ddtHeader.compression}"); + break; + case CompressionType.None: + _imageStream.Read(decompressedDdt, 0, decompressedDdt.Length); + + AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", + GC.GetTotalMemory(false)); + + break; + default: + throw new + ImageNotSupportedException($"Found unsupported compression algorithm {(ushort)ddtHeader.compression}"); + } + + cdDdt = MemoryMarshal.Cast(decompressedDdt).ToArray(); + + switch(entry.dataType) + { + case DataType.CdSectorPrefixCorrected: + _sectorPrefixDdt = cdDdt; + + break; + case DataType.CdSectorSuffixCorrected: + _sectorSuffixDdt = cdDdt; + + break; + } + + AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", + GC.GetTotalMemory(false)); + + break; } - - foundUserDataDdt = true; - } - else if(entry.dataType == DataType.CdSectorPrefixCorrected || - entry.dataType == DataType.CdSectorSuffixCorrected) - { - uint[] cdDdt = new uint[ddtHeader.entries]; - byte[] decompressedDdt = new byte[ddtHeader.length]; - - AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", - GC.GetTotalMemory(false)); - - // Check for DDT compression - switch(ddtHeader.compression) - { - case CompressionType.Lzma: - AaruConsole.DebugWriteLine("Aaru Format plugin", "Decompressing DDT..."); - DateTime ddtStart = DateTime.UtcNow; - byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH]; - byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH]; - _imageStream.Read(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH); - _imageStream.Read(compressedDdt, 0, compressedDdt.Length); - var compressedDdtMs = new MemoryStream(compressedDdt); - var lzmaDdt = new LzmaStream(lzmaProperties, compressedDdtMs); - lzmaDdt.Read(decompressedDdt, 0, (int)ddtHeader.length); - lzmaDdt.Close(); - compressedDdtMs.Close(); - DateTime ddtEnd = DateTime.UtcNow; - - AaruConsole.DebugWriteLine("Aaru Format plugin", - "Took {0} seconds to decompress DDT", - (ddtEnd - ddtStart).TotalSeconds); - - AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", - GC.GetTotalMemory(false)); - - break; - case CompressionType.None: - _imageStream.Read(decompressedDdt, 0, decompressedDdt.Length); - - AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", - GC.GetTotalMemory(false)); - - break; - default: - throw new - ImageNotSupportedException($"Found unsupported compression algorithm {(ushort)ddtHeader.compression}"); - } - - cdDdt = MemoryMarshal.Cast(decompressedDdt).ToArray(); - - if(entry.dataType == DataType.CdSectorPrefixCorrected) - _sectorPrefixDdt = cdDdt; - else if(entry.dataType == DataType.CdSectorSuffixCorrected) - _sectorSuffixDdt = cdDdt; - - AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", - GC.GetTotalMemory(false)); } break; @@ -1206,21 +1218,21 @@ namespace Aaru.DiscImages Track[] tracks = Tracks.ToArray(); - for(int i = 0; i < tracks.Length; i++) + foreach(Track trk in tracks) { - byte[] sector = ReadSector(tracks[i].TrackStartSector); - tracks[i].TrackBytesPerSector = sector.Length; + byte[] sector = ReadSector(trk.TrackStartSector); + trk.TrackBytesPerSector = sector.Length; - tracks[i].TrackRawBytesPerSector = + trk.TrackRawBytesPerSector = (_sectorPrefix != null && _sectorSuffix != null) || (_sectorPrefixDdt != null && _sectorSuffixDdt != null) ? 2352 : sector.Length; if(_sectorSubchannel == null) continue; - tracks[i].TrackSubchannelFile = tracks[i].TrackFile; - tracks[i].TrackSubchannelFilter = tracks[i].TrackFilter; - tracks[i].TrackSubchannelType = TrackSubchannelType.Raw; + trk.TrackSubchannelFile = trk.TrackFile; + trk.TrackSubchannelFilter = trk.TrackFilter; + trk.TrackSubchannelType = TrackSubchannelType.Raw; } AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes", @@ -1262,51 +1274,55 @@ namespace Aaru.DiscImages if(_imageInfo.XmlMediaType != XmlMediaType.OpticalDisc) return true; - if(_imageInfo.MediaType != MediaType.CD && - _imageInfo.MediaType != MediaType.CDDA && - _imageInfo.MediaType != MediaType.CDG && - _imageInfo.MediaType != MediaType.CDEG && - _imageInfo.MediaType != MediaType.CDI && - _imageInfo.MediaType != MediaType.CDROM && - _imageInfo.MediaType != MediaType.CDROMXA && - _imageInfo.MediaType != MediaType.CDPLUS && - _imageInfo.MediaType != MediaType.CDMO && - _imageInfo.MediaType != MediaType.CDR && - _imageInfo.MediaType != MediaType.CDRW && - _imageInfo.MediaType != MediaType.CDMRW && - _imageInfo.MediaType != MediaType.VCD && - _imageInfo.MediaType != MediaType.SVCD && - _imageInfo.MediaType != MediaType.PCD && - _imageInfo.MediaType != MediaType.DTSCD && - _imageInfo.MediaType != MediaType.CDMIDI && - _imageInfo.MediaType != MediaType.CDV && - _imageInfo.MediaType != MediaType.CDIREADY && - _imageInfo.MediaType != MediaType.FMTOWNS && - _imageInfo.MediaType != MediaType.PS1CD && - _imageInfo.MediaType != MediaType.PS2CD && - _imageInfo.MediaType != MediaType.MEGACD && - _imageInfo.MediaType != MediaType.SATURNCD && - _imageInfo.MediaType != MediaType.GDROM && - _imageInfo.MediaType != MediaType.GDR && - _imageInfo.MediaType != MediaType.MilCD && - _imageInfo.MediaType != MediaType.SuperCDROM2 && - _imageInfo.MediaType != MediaType.JaguarCD && - _imageInfo.MediaType != MediaType.ThreeDO && - _imageInfo.MediaType != MediaType.PCFX && - _imageInfo.MediaType != MediaType.NeoGeoCD && - _imageInfo.MediaType != MediaType.CDTV && - _imageInfo.MediaType != MediaType.CD32 && - _imageInfo.MediaType != MediaType.Playdia && - _imageInfo.MediaType != MediaType.Pippin && - _imageInfo.MediaType != MediaType.VideoNow && - _imageInfo.MediaType != MediaType.VideoNowColor && - _imageInfo.MediaType != MediaType.VideoNowXp && - _imageInfo.MediaType != MediaType.CVD) + if(_imageInfo.MediaType == MediaType.CD || + _imageInfo.MediaType == MediaType.CDDA || + _imageInfo.MediaType == MediaType.CDG || + _imageInfo.MediaType == MediaType.CDEG || + _imageInfo.MediaType == MediaType.CDI || + _imageInfo.MediaType == MediaType.CDROM || + _imageInfo.MediaType == MediaType.CDROMXA || + _imageInfo.MediaType == MediaType.CDPLUS || + _imageInfo.MediaType == MediaType.CDMO || + _imageInfo.MediaType == MediaType.CDR || + _imageInfo.MediaType == MediaType.CDRW || + _imageInfo.MediaType == MediaType.CDMRW || + _imageInfo.MediaType == MediaType.VCD || + _imageInfo.MediaType == MediaType.SVCD || + _imageInfo.MediaType == MediaType.PCD || + _imageInfo.MediaType == MediaType.DTSCD || + _imageInfo.MediaType == MediaType.CDMIDI || + _imageInfo.MediaType == MediaType.CDV || + _imageInfo.MediaType == MediaType.CDIREADY || + _imageInfo.MediaType == MediaType.FMTOWNS || + _imageInfo.MediaType == MediaType.PS1CD || + _imageInfo.MediaType == MediaType.PS2CD || + _imageInfo.MediaType == MediaType.MEGACD || + _imageInfo.MediaType == MediaType.SATURNCD || + _imageInfo.MediaType == MediaType.GDROM || + _imageInfo.MediaType == MediaType.GDR || + _imageInfo.MediaType == MediaType.MilCD || + _imageInfo.MediaType == MediaType.SuperCDROM2 || + _imageInfo.MediaType == MediaType.JaguarCD || + _imageInfo.MediaType == MediaType.ThreeDO || + _imageInfo.MediaType == MediaType.PCFX || + _imageInfo.MediaType == MediaType.NeoGeoCD || + _imageInfo.MediaType == MediaType.CDTV || + _imageInfo.MediaType == MediaType.CD32 || + _imageInfo.MediaType == MediaType.Playdia || + _imageInfo.MediaType == MediaType.Pippin || + _imageInfo.MediaType == MediaType.VideoNow || + _imageInfo.MediaType == MediaType.VideoNowColor || + _imageInfo.MediaType == MediaType.VideoNowXp || + _imageInfo.MediaType == MediaType.CVD) + return true; + + { foreach(Track track in Tracks) { track.TrackPregap = 0; track.Indexes?.Clear(); } + } return true; } @@ -1432,7 +1448,7 @@ namespace Aaru.DiscImages Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track); - if(trk.TrackSequence != track) + if(trk?.TrackSequence != track) throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); return ReadSector(trk.TrackStartSector + sectorAddress); @@ -1445,7 +1461,7 @@ namespace Aaru.DiscImages Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track); - if(trk.TrackSequence != track) + if(trk?.TrackSequence != track) throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); return ReadSectorTag(trk.TrackStartSector + sectorAddress, tag); @@ -1483,6 +1499,10 @@ namespace Aaru.DiscImages Track trk = Tracks.FirstOrDefault(t => sectorAddress >= t.TrackStartSector && sectorAddress <= t.TrackEndSector); + if(trk is null) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + "Can't found track containing requested sector"); + if(trk.TrackSequence == 0 && trk.TrackStartSector == 0 && trk.TrackEndSector == 0) @@ -1705,7 +1725,7 @@ namespace Aaru.DiscImages Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track); - if(trk.TrackSequence != track) + if(trk?.TrackSequence != track) throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(trk.TrackStartSector + sectorAddress + length > trk.TrackEndSector + 1) @@ -1722,7 +1742,7 @@ namespace Aaru.DiscImages Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track); - if(trk.TrackSequence != track) + if(trk?.TrackSequence != track) throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(trk.TrackStartSector + sectorAddress + length > trk.TrackEndSector + 1) @@ -1740,6 +1760,10 @@ namespace Aaru.DiscImages Track trk = Tracks.FirstOrDefault(t => sectorAddress >= t.TrackStartSector && sectorAddress <= t.TrackEndSector); + if(trk is null) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + "Can't found track containing requested sector"); + if(trk.TrackSequence == 0 && trk.TrackStartSector == 0 && trk.TrackEndSector == 0) @@ -1936,7 +1960,7 @@ namespace Aaru.DiscImages Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track); - if(trk.TrackSequence != track) + if(trk?.TrackSequence != track) throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); return ReadSectorLong(trk.TrackStartSector + sectorAddress); @@ -1953,6 +1977,10 @@ namespace Aaru.DiscImages Track trk = Tracks.FirstOrDefault(t => sectorAddress >= t.TrackStartSector && sectorAddress <= t.TrackEndSector); + if(trk is null) + throw new ArgumentOutOfRangeException(nameof(sectorAddress), + "Can't found track containing requested sector"); + if(trk.TrackSequence == 0 && trk.TrackStartSector == 0 && trk.TrackEndSector == 0) @@ -2106,7 +2134,7 @@ namespace Aaru.DiscImages Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track); - if(trk.TrackSequence != track) + if(trk?.TrackSequence != track) throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image"); if(trk.TrackStartSector + sectorAddress + length > trk.TrackEndSector + 1) diff --git a/Aaru.Images/AaruFormat/Structs.cs b/Aaru.Images/AaruFormat/Structs.cs index b423a8eb3..34809dac1 100644 --- a/Aaru.Images/AaruFormat/Structs.cs +++ b/Aaru.Images/AaruFormat/Structs.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Enums; namespace Aaru.DiscImages { - public partial class AaruFormat + public sealed partial class AaruFormat { /// Header, at start of file [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)] diff --git a/Aaru.Images/AaruFormat/Tape.cs b/Aaru.Images/AaruFormat/Tape.cs index 136f4ae22..ff611b88e 100644 --- a/Aaru.Images/AaruFormat/Tape.cs +++ b/Aaru.Images/AaruFormat/Tape.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class AaruFormat + public sealed partial class AaruFormat { public List Files { get; private set; } public List TapePartitions { get; private set; } diff --git a/Aaru.Images/AaruFormat/Verify.cs b/Aaru.Images/AaruFormat/Verify.cs index 4482f28d1..612d53ddb 100644 --- a/Aaru.Images/AaruFormat/Verify.cs +++ b/Aaru.Images/AaruFormat/Verify.cs @@ -39,7 +39,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class AaruFormat + public sealed partial class AaruFormat { public bool? VerifyMediaImage() { diff --git a/Aaru.Images/AaruFormat/Write.cs b/Aaru.Images/AaruFormat/Write.cs index a14ba3511..d3be810e8 100644 --- a/Aaru.Images/AaruFormat/Write.cs +++ b/Aaru.Images/AaruFormat/Write.cs @@ -56,7 +56,7 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType; namespace Aaru.DiscImages { - public partial class AaruFormat + public sealed partial class AaruFormat { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -195,7 +195,7 @@ namespace Aaru.DiscImages // This really, cannot happen if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } @@ -1049,6 +1049,9 @@ namespace Aaru.DiscImages trk = Tracks.FirstOrDefault(t => sectorAddress >= t.TrackStartSector && sectorAddress <= t.TrackEndSector); + if(trk is null) + trk.TrackType = TrackType.Data; // TODO: Check intersession data type + if(trk.TrackSequence == 0 && trk.TrackStartSector == 0 && trk.TrackEndSector == 0) @@ -1074,30 +1077,37 @@ namespace Aaru.DiscImages byte[] lzmaProperties = new byte[0]; - if(_currentBlockHeader.compression == CompressionType.Flac) + switch(_currentBlockHeader.compression) { - long remaining = (_currentBlockOffset * SAMPLES_PER_SECTOR) % _flakeWriter.Settings.BlockSize; - - // Fill FLAC block - if(remaining != 0) + case CompressionType.Flac: { - var audioBuffer = - new AudioBuffer(AudioPCMConfig.RedBook, new byte[remaining * 4], (int)remaining); + long remaining = (_currentBlockOffset * SAMPLES_PER_SECTOR) % _flakeWriter.Settings.BlockSize; - _flakeWriter.Write(audioBuffer); + // Fill FLAC block + if(remaining != 0) + { + var audioBuffer = + new AudioBuffer(AudioPCMConfig.RedBook, new byte[remaining * 4], (int)remaining); + + _flakeWriter.Write(audioBuffer); + } + + _flakeWriter.Close(); + + break; } + case CompressionType.Lzma: + { + lzmaProperties = _lzmaBlockStream.Properties; + _lzmaBlockStream.Close(); + _lzmaBlockStream = null; + cmpCrc64Context.Update(lzmaProperties); - _flakeWriter.Close(); - } - else if(_currentBlockHeader.compression == CompressionType.Lzma) - { - lzmaProperties = _lzmaBlockStream.Properties; - _lzmaBlockStream.Close(); - _lzmaBlockStream = null; - cmpCrc64Context.Update(lzmaProperties); + if(_blockStream.Length > _decompressedStream.Length) + _currentBlockHeader.compression = CompressionType.None; - if(_blockStream.Length > _decompressedStream.Length) - _currentBlockHeader.compression = CompressionType.None; + break; + } } if(_currentBlockHeader.compression == CompressionType.None) @@ -1266,6 +1276,13 @@ namespace Aaru.DiscImages Tracks.FirstOrDefault(trk => sectorAddress >= trk.TrackStartSector && sectorAddress <= trk.TrackEndSector); + if(track is null) + { + ErrorMessage = "Track not found"; + + return false; + } + if(track.TrackSequence == 0 && track.TrackStartSector == 0 && track.TrackEndSector == 0) @@ -1321,11 +1338,9 @@ namespace Aaru.DiscImages return WriteSector(sector, sectorAddress); } - if(_sectorSuffixMs == null) - _sectorSuffixMs = new NonClosableStream(); + _sectorSuffixMs ??= new NonClosableStream(); - if(_sectorPrefixMs == null) - _sectorPrefixMs = new NonClosableStream(); + _sectorPrefixMs ??= new NonClosableStream(); if(_sectorSuffixDdt == null) { @@ -1333,8 +1348,7 @@ namespace Aaru.DiscImages EccInit(); } - if(_sectorPrefixDdt == null) - _sectorPrefixDdt = new uint[_imageInfo.Sectors]; + _sectorPrefixDdt ??= new uint[_imageInfo.Sectors]; sector = new byte[2048]; @@ -1419,11 +1433,9 @@ namespace Aaru.DiscImages return WriteSector(sector, sectorAddress); } - if(_sectorSuffixMs == null) - _sectorSuffixMs = new NonClosableStream(); + _sectorSuffixMs ??= new NonClosableStream(); - if(_sectorPrefixMs == null) - _sectorPrefixMs = new NonClosableStream(); + _sectorPrefixMs ??= new NonClosableStream(); if(_sectorSuffixDdt == null) { @@ -1431,8 +1443,7 @@ namespace Aaru.DiscImages EccInit(); } - if(_sectorPrefixDdt == null) - _sectorPrefixDdt = new uint[_imageInfo.Sectors]; + _sectorPrefixDdt ??= new uint[_imageInfo.Sectors]; sector = new byte[2328]; @@ -1484,22 +1495,19 @@ namespace Aaru.DiscImages _sectorPrefixMs.Write(data, 0, 16); } - if(_mode2Subheaders == null) - _mode2Subheaders = new byte[_imageInfo.Sectors * 8]; + _mode2Subheaders ??= new byte[_imageInfo.Sectors * 8]; bool form2 = (data[18] & 0x20) == 0x20 || (data[22] & 0x20) == 0x20; if(form2) { - bool correctEdc; uint computedEdc = ComputeEdc(0, data, 0x91C, 0x10); uint edc = BitConverter.ToUInt32(data, 0x92C); - correctEdc = computedEdc == edc; + bool correctEdc = computedEdc == edc; sector = new byte[2324]; - if(_sectorSuffixDdt == null) - _sectorSuffixDdt = new uint[_imageInfo.Sectors]; + _sectorSuffixDdt ??= new uint[_imageInfo.Sectors]; Array.Copy(data, 24, sector, 0, 2324); @@ -1527,19 +1535,17 @@ namespace Aaru.DiscImages else { bool correctEcc = SuffixIsCorrectMode2(data); - bool correctEdc; uint computedEdc = ComputeEdc(0, data, 0x808, 0x10); uint edc = BitConverter.ToUInt32(data, 0x818); - correctEdc = computedEdc == edc; + bool correctEdc = computedEdc == edc; sector = new byte[2048]; Array.Copy(data, 24, sector, 0, 2048); if(correctEcc && correctEdc) { - if(_sectorSuffixDdt == null) - _sectorSuffixDdt = new uint[_imageInfo.Sectors]; + _sectorSuffixDdt ??= new uint[_imageInfo.Sectors]; _sectorSuffixDdt[sectorAddress] = (uint)CdFixFlags.Mode2Form1Ok; } @@ -1668,8 +1674,7 @@ namespace Aaru.DiscImages if(newTag == null) return WriteSector(sector, sectorAddress); - if(_sectorSubchannel == null) - _sectorSubchannel = new byte[newTag.Length * (int)_imageInfo.Sectors]; + _sectorSubchannel ??= new byte[newTag.Length * (int)_imageInfo.Sectors]; Array.Copy(newTag, 0, _sectorSubchannel, newTag.Length * (int)sectorAddress, newTag.Length); @@ -2013,17 +2018,14 @@ namespace Aaru.DiscImages if(!string.IsNullOrWhiteSpace(dump.Serial)) dumpSerial = Encoding.UTF8.GetBytes(dump.Serial); - if(dump.Software != null) - { - if(!string.IsNullOrWhiteSpace(dump.Software.Name)) - dumpSoftwareName = Encoding.UTF8.GetBytes(dump.Software.Name); + if(!string.IsNullOrWhiteSpace(dump.Software?.Name)) + dumpSoftwareName = Encoding.UTF8.GetBytes(dump.Software.Name); - if(!string.IsNullOrWhiteSpace(dump.Software.Version)) - dumpSoftwareVersion = Encoding.UTF8.GetBytes(dump.Software.Version); + if(!string.IsNullOrWhiteSpace(dump.Software?.Version)) + dumpSoftwareVersion = Encoding.UTF8.GetBytes(dump.Software.Version); - if(!string.IsNullOrWhiteSpace(dump.Software.OperatingSystem)) - dumpSoftwareOperatingSystem = Encoding.UTF8.GetBytes(dump.Software.OperatingSystem); - } + if(!string.IsNullOrWhiteSpace(dump.Software?.OperatingSystem)) + dumpSoftwareOperatingSystem = Encoding.UTF8.GetBytes(dump.Software.OperatingSystem); var dumpEntry = new DumpHardwareEntry { @@ -2292,19 +2294,23 @@ namespace Aaru.DiscImages for(int t = 0; t < TapePartitions.Count; t++) { - tapePartitionEntries[t] = new TapePartitionEntry(); - tapePartitionEntries[t].Number = TapePartitions[t].Number; - tapePartitionEntries[t].FirstBlock = TapePartitions[t].FirstBlock; - tapePartitionEntries[t].LastBlock = TapePartitions[t].LastBlock; + tapePartitionEntries[t] = new TapePartitionEntry + { + Number = TapePartitions[t].Number, + FirstBlock = TapePartitions[t].FirstBlock, + LastBlock = TapePartitions[t].LastBlock + }; } byte[] tapePartitionEntriesData = MemoryMarshal.Cast(tapePartitionEntries).ToArray(); - var tapePartitionHeader = new TapePartitionHeader(); - tapePartitionHeader.identifier = BlockType.TapePartitionBlock; - tapePartitionHeader.entries = (byte)tapePartitionEntries.Length; - tapePartitionHeader.length = (ulong)tapePartitionEntriesData.Length; + var tapePartitionHeader = new TapePartitionHeader + { + identifier = BlockType.TapePartitionBlock, + entries = (byte)tapePartitionEntries.Length, + length = (ulong)tapePartitionEntriesData.Length + }; _crc64 = new Crc64Context(); _crc64.Update(tapePartitionEntriesData); @@ -3578,7 +3584,7 @@ namespace Aaru.DiscImages if(_imageInfo.XmlMediaType != XmlMediaType.BlockMedia) { - ErrorMessage = "Tried to set geometry on a media that doesn't suppport it"; + ErrorMessage = "Tried to set geometry on a media that doesn't support it"; return false; } @@ -3627,9 +3633,8 @@ namespace Aaru.DiscImages track = Tracks.FirstOrDefault(trk => sectorAddress == trk.TrackSequence); - if(track.TrackSequence == 0 && - track.TrackStartSector == 0 && - track.TrackEndSector == 0) + if(track is null || + (track.TrackSequence == 0 && track.TrackStartSector == 0 && track.TrackEndSector == 0)) { ErrorMessage = $"Can't find track {sectorAddress}"; @@ -3689,8 +3694,7 @@ namespace Aaru.DiscImages return false; } - if(_sectorSubchannel == null) - _sectorSubchannel = new byte[_imageInfo.Sectors * 96]; + _sectorSubchannel ??= new byte[_imageInfo.Sectors * 96]; Array.Copy(data, 0, _sectorSubchannel, (int)(96 * sectorAddress), 96); @@ -3733,8 +3737,7 @@ namespace Aaru.DiscImages return false; } - if(_sectorSubchannel == null) - _sectorSubchannel = new byte[_imageInfo.Sectors * 96]; + _sectorSubchannel ??= new byte[_imageInfo.Sectors * 96]; if((sectorAddress * 96) + (length * 96) > (ulong)_sectorSubchannel.LongLength) { @@ -3776,14 +3779,11 @@ namespace Aaru.DiscImages /// The properties as a byte array static byte[] CompressDataToStreamWithLZMA(byte[] data, LzmaEncoderProperties properties, Stream stream) { - byte[] propertiesArray; + using var lzmaStream = new LzmaStream(properties, false, stream); - using(var lzmaStream = new LzmaStream(properties, false, stream)) - { - lzmaStream.Write(data, 0, data.Length); - propertiesArray = new byte[lzmaStream.Properties.Length]; - lzmaStream.Properties.CopyTo(propertiesArray, 0); - } + lzmaStream.Write(data, 0, data.Length); + byte[] propertiesArray = new byte[lzmaStream.Properties.Length]; + lzmaStream.Properties.CopyTo(propertiesArray, 0); return propertiesArray; } diff --git a/Aaru.Images/Alcohol120/Alcohol120.cs b/Aaru.Images/Alcohol120/Alcohol120.cs index dc733d58e..35419b781 100644 --- a/Aaru.Images/Alcohol120/Alcohol120.cs +++ b/Aaru.Images/Alcohol120/Alcohol120.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Alcohol120 : IWritableOpticalImage + public sealed partial class Alcohol120 : IWritableOpticalImage { AlcoholFooter _alcFooter; IFilter _alcImage; diff --git a/Aaru.Images/Alcohol120/Constants.cs b/Aaru.Images/Alcohol120/Constants.cs index b23604bc7..394df04d5 100644 --- a/Aaru.Images/Alcohol120/Constants.cs +++ b/Aaru.Images/Alcohol120/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Alcohol120 + public sealed partial class Alcohol120 { const byte _maximumSupportedVersion = 1; readonly byte[] _alcoholSignature = diff --git a/Aaru.Images/Alcohol120/Enums.cs b/Aaru.Images/Alcohol120/Enums.cs index 77f292c56..727177a43 100644 --- a/Aaru.Images/Alcohol120/Enums.cs +++ b/Aaru.Images/Alcohol120/Enums.cs @@ -34,7 +34,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { - public partial class Alcohol120 + public sealed partial class Alcohol120 { [SuppressMessage("ReSharper", "InconsistentNaming")] enum AlcoholMediumType : ushort diff --git a/Aaru.Images/Alcohol120/Helpers.cs b/Aaru.Images/Alcohol120/Helpers.cs index 43453789f..5120af47e 100644 --- a/Aaru.Images/Alcohol120/Helpers.cs +++ b/Aaru.Images/Alcohol120/Helpers.cs @@ -35,24 +35,8 @@ using Aaru.CommonTypes.Enums; namespace Aaru.DiscImages { - public partial class Alcohol120 + public sealed partial class Alcohol120 { - static ushort AlcoholTrackModeToBytesPerSector(AlcoholTrackMode trackMode) - { - switch(trackMode) - { - case AlcoholTrackMode.Audio: - case AlcoholTrackMode.Mode1: - case AlcoholTrackMode.Mode2: - case AlcoholTrackMode.Mode2F1: - case AlcoholTrackMode.Mode2F2: - case AlcoholTrackMode.Mode2F2Alt: - case AlcoholTrackMode.Mode2F1Alt: return 2352; - case AlcoholTrackMode.DVD: return 2048; - default: return 0; - } - } - static ushort AlcoholTrackModeToCookedBytesPerSector(AlcoholTrackMode trackMode) { switch(trackMode) diff --git a/Aaru.Images/Alcohol120/Identify.cs b/Aaru.Images/Alcohol120/Identify.cs index 6b56dedb1..3067ee2e5 100644 --- a/Aaru.Images/Alcohol120/Identify.cs +++ b/Aaru.Images/Alcohol120/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Alcohol120 + public sealed partial class Alcohol120 { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/Alcohol120/Properties.cs b/Aaru.Images/Alcohol120/Properties.cs index 73bd8d0bf..8ea5db66b 100644 --- a/Aaru.Images/Alcohol120/Properties.cs +++ b/Aaru.Images/Alcohol120/Properties.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Alcohol120 + public sealed partial class Alcohol120 { public OpticalImageCapabilities OpticalCapabilities => OpticalImageCapabilities.CanStoreAudioTracks | OpticalImageCapabilities.CanStoreDataTracks | diff --git a/Aaru.Images/Alcohol120/Read.cs b/Aaru.Images/Alcohol120/Read.cs index e925cf2ce..66c31fd5d 100644 --- a/Aaru.Images/Alcohol120/Read.cs +++ b/Aaru.Images/Alcohol120/Read.cs @@ -49,7 +49,7 @@ using Session = Aaru.CommonTypes.Structs.Session; namespace Aaru.DiscImages { - public partial class Alcohol120 + public sealed partial class Alcohol120 { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/Alcohol120/Structs.cs b/Aaru.Images/Alcohol120/Structs.cs index b93a57497..2e3a55534 100644 --- a/Aaru.Images/Alcohol120/Structs.cs +++ b/Aaru.Images/Alcohol120/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Alcohol120 + public sealed partial class Alcohol120 { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AlcoholHeader diff --git a/Aaru.Images/Alcohol120/Verify.cs b/Aaru.Images/Alcohol120/Verify.cs index a03233a67..05af5e27e 100644 --- a/Aaru.Images/Alcohol120/Verify.cs +++ b/Aaru.Images/Alcohol120/Verify.cs @@ -36,7 +36,7 @@ using Aaru.Checksums; namespace Aaru.DiscImages { - public partial class Alcohol120 + public sealed partial class Alcohol120 { public bool? VerifySector(ulong sectorAddress) { diff --git a/Aaru.Images/Alcohol120/Write.cs b/Aaru.Images/Alcohol120/Write.cs index 9f3012493..70992a127 100644 --- a/Aaru.Images/Alcohol120/Write.cs +++ b/Aaru.Images/Alcohol120/Write.cs @@ -45,14 +45,14 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType; namespace Aaru.DiscImages { - public partial class Alcohol120 + public sealed partial class Alcohol120 { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) { if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } @@ -70,7 +70,7 @@ namespace Aaru.DiscImages _imageStream = new - FileStream(Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)) + ".mdf", + FileStream(Path.Combine(Path.GetDirectoryName(path) ?? "", Path.GetFileNameWithoutExtension(path)) + ".mdf", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); } catch(IOException e) @@ -418,6 +418,9 @@ namespace Aaru.DiscImages { Track firstTrackInSession = tracks.FirstOrDefault(t => t.TrackSession == tmpTracks[i].TrackSession); + if(firstTrackInSession is null) + continue; + if(tmpTracks[i].TrackSequence == firstTrackInSession.TrackSequence) { if(tmpTracks[i].TrackSequence > 1) @@ -478,9 +481,8 @@ namespace Aaru.DiscImages byte sessions = byte.MinValue; - foreach(Track t in _writingTracks) - if(t.TrackSession > byte.MinValue) - sessions = (byte)t.TrackSession; + foreach(Track t in _writingTracks.Where(t => t.TrackSession > byte.MinValue)) + sessions = (byte)t.TrackSession; var header = new AlcoholHeader { @@ -626,9 +628,8 @@ namespace Aaru.DiscImages (byte minute, byte second, byte frame) leadinPmsf = LbaToMsf(lastTrack.TrackEndSector + 1); - if(decodedToc.HasValue && - decodedToc.Value.TrackDescriptors.Any(t => t.SessionNumber == i && t.POINT >= 0xA0 && - t.POINT <= 0xAF)) + if(decodedToc?.TrackDescriptors.Any(t => t.SessionNumber == i && t.POINT >= 0xA0 && + t.POINT <= 0xAF) == true) foreach(FullTOC.TrackDataDescriptor tocTrk in decodedToc.Value.TrackDescriptors.Where(t => t.SessionNumber == i && t.POINT >= 0xA0 && t.POINT <= 0xAF)) @@ -707,9 +708,8 @@ namespace Aaru.DiscImages { var alcTrk = new AlcoholTrack(); - if(decodedToc.HasValue && - decodedToc.Value.TrackDescriptors.Any(t => t.SessionNumber == i && - t.POINT == track.TrackSequence)) + if(decodedToc?.TrackDescriptors.Any(t => t.SessionNumber == i && + t.POINT == track.TrackSequence) == true) { FullTOC.TrackDataDescriptor tocTrk = decodedToc.Value.TrackDescriptors.First(t => t.SessionNumber == i && @@ -805,8 +805,7 @@ namespace Aaru.DiscImages _alcTrackExtras.Add((int)track.TrackSequence, trkExtra); } - if(decodedToc.HasValue && - decodedToc.Value.TrackDescriptors.Any(t => t.SessionNumber == i && t.POINT >= 0xB0)) + if(decodedToc?.TrackDescriptors.Any(t => t.SessionNumber == i && t.POINT >= 0xB0) == true) foreach(FullTOC.TrackDataDescriptor tocTrk in decodedToc.Value.TrackDescriptors.Where(t => t.SessionNumber == i && t.POINT >= 0xB0)) { @@ -880,34 +879,37 @@ namespace Aaru.DiscImages byte[] filename = Encoding.Unicode.GetBytes("*.mdf"); // Yup, Alcohol stores no filename but a wildcard. - IntPtr blockPtr; - // Write header _descriptorStream.Seek(0, SeekOrigin.Begin); - byte[] block = new byte[Marshal.SizeOf()]; - blockPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(Marshal.SizeOf()); + byte[] block = new byte[Marshal.SizeOf()]; + IntPtr blockPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(Marshal.SizeOf()); System.Runtime.InteropServices.Marshal.StructureToPtr(header, blockPtr, true); System.Runtime.InteropServices.Marshal.Copy(blockPtr, block, 0, block.Length); System.Runtime.InteropServices.Marshal.FreeHGlobal(blockPtr); _descriptorStream.Write(block, 0, block.Length); - // Write DVD structures if pressent + // Write DVD structures if present if(header.structuresOffset != 0) { if(_dmi != null) { _descriptorStream.Seek(header.structuresOffset, SeekOrigin.Begin); - if(_dmi.Length == 2052) - _descriptorStream.Write(_dmi, 0, 2052); - else if(_dmi.Length == 2048) + switch(_dmi.Length) { - _descriptorStream.Write(new byte[] - { - 0x08, 0x02, 0x00, 0x00 - }, 0, 4); + case 2052: + _descriptorStream.Write(_dmi, 0, 2052); - _descriptorStream.Write(_dmi, 0, 2048); + break; + case 2048: + _descriptorStream.Write(new byte[] + { + 0x08, 0x02, 0x00, 0x00 + }, 0, 4); + + _descriptorStream.Write(_dmi, 0, 2048); + + break; } } diff --git a/Aaru.Images/Anex86/Anex86.cs b/Aaru.Images/Anex86/Anex86.cs index 6e0624ecf..8907cd39f 100644 --- a/Aaru.Images/Anex86/Anex86.cs +++ b/Aaru.Images/Anex86/Anex86.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Anex86 : IWritableImage + public sealed partial class Anex86 : IWritableImage { IFilter _anexImageFilter; Anex86Header _fdihdr; diff --git a/Aaru.Images/Anex86/Identify.cs b/Aaru.Images/Anex86/Identify.cs index 609a8dde7..c9a0eab2b 100644 --- a/Aaru.Images/Anex86/Identify.cs +++ b/Aaru.Images/Anex86/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Anex86 + public sealed partial class Anex86 { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/Anex86/Properties.cs b/Aaru.Images/Anex86/Properties.cs index 23c57b8b0..75386edca 100644 --- a/Aaru.Images/Anex86/Properties.cs +++ b/Aaru.Images/Anex86/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Anex86 + public sealed partial class Anex86 { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/Anex86/Read.cs b/Aaru.Images/Anex86/Read.cs index b1a5bce41..badc20aa1 100644 --- a/Aaru.Images/Anex86/Read.cs +++ b/Aaru.Images/Anex86/Read.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Anex86 + public sealed partial class Anex86 { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/Anex86/Structs.cs b/Aaru.Images/Anex86/Structs.cs index 14e993425..7e7594fbd 100644 --- a/Aaru.Images/Anex86/Structs.cs +++ b/Aaru.Images/Anex86/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Anex86 + public sealed partial class Anex86 { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Anex86Header diff --git a/Aaru.Images/Anex86/Unsupported.cs b/Aaru.Images/Anex86/Unsupported.cs index 1c7d54447..6aac60ef1 100644 --- a/Aaru.Images/Anex86/Unsupported.cs +++ b/Aaru.Images/Anex86/Unsupported.cs @@ -32,11 +32,10 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Exceptions; -using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class Anex86 : IWritableImage + public sealed partial class Anex86 { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/Anex86/Write.cs b/Aaru.Images/Anex86/Write.cs index ca1185eb9..2ee13a7dd 100644 --- a/Aaru.Images/Anex86/Write.cs +++ b/Aaru.Images/Anex86/Write.cs @@ -42,7 +42,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.DiscImages { - public partial class Anex86 + public sealed partial class Anex86 { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -64,7 +64,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/Apple2MG/Apple2MG.cs b/Aaru.Images/Apple2MG/Apple2MG.cs index 9fef64818..56e215e89 100644 --- a/Aaru.Images/Apple2MG/Apple2MG.cs +++ b/Aaru.Images/Apple2MG/Apple2MG.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Apple2Mg : IWritableImage + public sealed partial class Apple2Mg : IWritableImage { IFilter _a2MgImageFilter; byte[] _decodedImage; diff --git a/Aaru.Images/Apple2MG/Constants.cs b/Aaru.Images/Apple2MG/Constants.cs index 58e78d49f..839eecb19 100644 --- a/Aaru.Images/Apple2MG/Constants.cs +++ b/Aaru.Images/Apple2MG/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Apple2Mg + public sealed partial class Apple2Mg { /// Magic number, "2IMG" const uint MAGIC = 0x474D4932; diff --git a/Aaru.Images/Apple2MG/Enums.cs b/Aaru.Images/Apple2MG/Enums.cs index d65884042..c7105ce82 100644 --- a/Aaru.Images/Apple2MG/Enums.cs +++ b/Aaru.Images/Apple2MG/Enums.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Apple2Mg + public sealed partial class Apple2Mg { enum SectorOrder : uint { diff --git a/Aaru.Images/Apple2MG/Helpers.cs b/Aaru.Images/Apple2MG/Helpers.cs index 3062fffee..341d9b191 100644 --- a/Aaru.Images/Apple2MG/Helpers.cs +++ b/Aaru.Images/Apple2MG/Helpers.cs @@ -34,7 +34,7 @@ using Aaru.CommonTypes; namespace Aaru.DiscImages { - public partial class Apple2Mg + public sealed partial class Apple2Mg { MediaType GetMediaType() { diff --git a/Aaru.Images/Apple2MG/Identify.cs b/Aaru.Images/Apple2MG/Identify.cs index 6aa59144e..ce61c5d9c 100644 --- a/Aaru.Images/Apple2MG/Identify.cs +++ b/Aaru.Images/Apple2MG/Identify.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Apple2Mg + public sealed partial class Apple2Mg { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/Apple2MG/Properties.cs b/Aaru.Images/Apple2MG/Properties.cs index e312d2ded..87ac4ffb9 100644 --- a/Aaru.Images/Apple2MG/Properties.cs +++ b/Aaru.Images/Apple2MG/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Apple2Mg + public sealed partial class Apple2Mg { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/Apple2MG/Read.cs b/Aaru.Images/Apple2MG/Read.cs index 23a30fc62..fed8e1960 100644 --- a/Aaru.Images/Apple2MG/Read.cs +++ b/Aaru.Images/Apple2MG/Read.cs @@ -42,7 +42,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Apple2Mg + public sealed partial class Apple2Mg { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/Apple2MG/Structs.cs b/Aaru.Images/Apple2MG/Structs.cs index 4a55d85db..29c283c75 100644 --- a/Aaru.Images/Apple2MG/Structs.cs +++ b/Aaru.Images/Apple2MG/Structs.cs @@ -35,7 +35,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Apple2Mg + public sealed partial class Apple2Mg { [SuppressMessage("ReSharper", "NotAccessedField.Local"), StructLayout(LayoutKind.Sequential, Pack = 1)] struct A2ImgHeader diff --git a/Aaru.Images/Apple2MG/Unsupported.cs b/Aaru.Images/Apple2MG/Unsupported.cs index 9c7e374a2..a7ed54ce3 100644 --- a/Aaru.Images/Apple2MG/Unsupported.cs +++ b/Aaru.Images/Apple2MG/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Apple2Mg + public sealed partial class Apple2Mg { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/Apple2MG/Write.cs b/Aaru.Images/Apple2MG/Write.cs index d2edede19..7fd290eba 100644 --- a/Aaru.Images/Apple2MG/Write.cs +++ b/Aaru.Images/Apple2MG/Write.cs @@ -43,7 +43,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Apple2Mg + public sealed partial class Apple2Mg { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -59,7 +59,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/AppleDOS/AppleDOS.cs b/Aaru.Images/AppleDOS/AppleDOS.cs index 63886529c..26fab18c8 100644 --- a/Aaru.Images/AppleDOS/AppleDOS.cs +++ b/Aaru.Images/AppleDOS/AppleDOS.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class AppleDos : IWritableImage + public sealed partial class AppleDos : IWritableImage { byte[] _deinterleaved; string _extension; diff --git a/Aaru.Images/AppleDOS/Constants.cs b/Aaru.Images/AppleDOS/Constants.cs index f83063c1a..abe1728a9 100644 --- a/Aaru.Images/AppleDOS/Constants.cs +++ b/Aaru.Images/AppleDOS/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class AppleDos + public sealed partial class AppleDos { readonly int[] _deinterleave = { diff --git a/Aaru.Images/AppleDOS/Identify.cs b/Aaru.Images/AppleDOS/Identify.cs index 972fb994c..cfe3ff7d7 100644 --- a/Aaru.Images/AppleDOS/Identify.cs +++ b/Aaru.Images/AppleDOS/Identify.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class AppleDos + public sealed partial class AppleDos { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/AppleDOS/Properties.cs b/Aaru.Images/AppleDOS/Properties.cs index 5dbd76c86..ec26f864e 100644 --- a/Aaru.Images/AppleDOS/Properties.cs +++ b/Aaru.Images/AppleDOS/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class AppleDos + public sealed partial class AppleDos { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/AppleDOS/Read.cs b/Aaru.Images/AppleDOS/Read.cs index 606b6daea..140e115f0 100644 --- a/Aaru.Images/AppleDOS/Read.cs +++ b/Aaru.Images/AppleDOS/Read.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class AppleDos + public sealed partial class AppleDos { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/AppleDOS/Unsupported.cs b/Aaru.Images/AppleDOS/Unsupported.cs index cf4e426af..1c6d5f067 100644 --- a/Aaru.Images/AppleDOS/Unsupported.cs +++ b/Aaru.Images/AppleDOS/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class AppleDos + public sealed partial class AppleDos { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/AppleDOS/Write.cs b/Aaru.Images/AppleDOS/Write.cs index 5d787cae5..3f85a0d3b 100644 --- a/Aaru.Images/AppleDOS/Write.cs +++ b/Aaru.Images/AppleDOS/Write.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class AppleDos + public sealed partial class AppleDos { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -54,7 +54,7 @@ namespace Aaru.DiscImages if(mediaType != MediaType.Apple33SS) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/AppleNIB/AppleNIB.cs b/Aaru.Images/AppleNIB/AppleNIB.cs index 1baed3630..f03aad498 100644 --- a/Aaru.Images/AppleNIB/AppleNIB.cs +++ b/Aaru.Images/AppleNIB/AppleNIB.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { // TODO: Checksum sectors - public partial class AppleNib : IMediaImage + public sealed partial class AppleNib : IMediaImage { Dictionary _addressFields; Dictionary _cookedSectors; diff --git a/Aaru.Images/AppleNIB/Constants.cs b/Aaru.Images/AppleNIB/Constants.cs index adaca46c4..2b3334772 100644 --- a/Aaru.Images/AppleNIB/Constants.cs +++ b/Aaru.Images/AppleNIB/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class AppleNib + public sealed partial class AppleNib { readonly byte[] _apple3Sign = { diff --git a/Aaru.Images/AppleNIB/Helpers.cs b/Aaru.Images/AppleNIB/Helpers.cs index 48a130c7a..930e2562c 100644 --- a/Aaru.Images/AppleNIB/Helpers.cs +++ b/Aaru.Images/AppleNIB/Helpers.cs @@ -34,7 +34,7 @@ using Aaru.CommonTypes; namespace Aaru.DiscImages { - public partial class AppleNib + public sealed partial class AppleNib { MediaType GetMediaType() { diff --git a/Aaru.Images/AppleNIB/Identify.cs b/Aaru.Images/AppleNIB/Identify.cs index 5883e4d83..0d01c7a7c 100644 --- a/Aaru.Images/AppleNIB/Identify.cs +++ b/Aaru.Images/AppleNIB/Identify.cs @@ -36,7 +36,7 @@ using Aaru.Decoders.Floppy; namespace Aaru.DiscImages { - public partial class AppleNib + public sealed partial class AppleNib { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/AppleNIB/Properties.cs b/Aaru.Images/AppleNIB/Properties.cs index 32a296499..237beba0f 100644 --- a/Aaru.Images/AppleNIB/Properties.cs +++ b/Aaru.Images/AppleNIB/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class AppleNib + public sealed partial class AppleNib { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/AppleNIB/Read.cs b/Aaru.Images/AppleNIB/Read.cs index 7fb5e893f..7f876ad09 100644 --- a/Aaru.Images/AppleNIB/Read.cs +++ b/Aaru.Images/AppleNIB/Read.cs @@ -43,7 +43,7 @@ using Aaru.Decoders.Floppy; namespace Aaru.DiscImages { - public partial class AppleNib + public sealed partial class AppleNib { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/AppleNIB/Unsupported.cs b/Aaru.Images/AppleNIB/Unsupported.cs index 9e014a77c..927a16ff0 100644 --- a/Aaru.Images/AppleNIB/Unsupported.cs +++ b/Aaru.Images/AppleNIB/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class AppleNib + public sealed partial class AppleNib { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/Apridisk/Apridisk.cs b/Aaru.Images/Apridisk/Apridisk.cs index 53fc9ebee..864733260 100644 --- a/Aaru.Images/Apridisk/Apridisk.cs +++ b/Aaru.Images/Apridisk/Apridisk.cs @@ -39,7 +39,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { // TODO: Check writing - public partial class Apridisk : IWritableImage + public sealed partial class Apridisk : IWritableImage { ImageInfo _imageInfo; diff --git a/Aaru.Images/Apridisk/Compression.cs b/Aaru.Images/Apridisk/Compression.cs index d4fc977b3..d2c20e041 100644 --- a/Aaru.Images/Apridisk/Compression.cs +++ b/Aaru.Images/Apridisk/Compression.cs @@ -35,7 +35,7 @@ using System.IO; namespace Aaru.DiscImages { - public partial class Apridisk + public sealed partial class Apridisk { static uint Decompress(byte[] compressed, out byte[] decompressed) { diff --git a/Aaru.Images/Apridisk/Constants.cs b/Aaru.Images/Apridisk/Constants.cs index 518f8a3a3..2091700ee 100644 --- a/Aaru.Images/Apridisk/Constants.cs +++ b/Aaru.Images/Apridisk/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Apridisk + public sealed partial class Apridisk { readonly byte[] _signature = { diff --git a/Aaru.Images/Apridisk/Enums.cs b/Aaru.Images/Apridisk/Enums.cs index ff14b0db8..66bd59209 100644 --- a/Aaru.Images/Apridisk/Enums.cs +++ b/Aaru.Images/Apridisk/Enums.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Apridisk + public sealed partial class Apridisk { enum RecordType : uint { diff --git a/Aaru.Images/Apridisk/Helpers.cs b/Aaru.Images/Apridisk/Helpers.cs index dbb016e4c..cc7631cd8 100644 --- a/Aaru.Images/Apridisk/Helpers.cs +++ b/Aaru.Images/Apridisk/Helpers.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Apridisk + public sealed partial class Apridisk { (ushort cylinder, byte head, byte sector) LbaToChs(ulong lba) { diff --git a/Aaru.Images/Apridisk/Identify.cs b/Aaru.Images/Apridisk/Identify.cs index 933463472..bd3d013d3 100644 --- a/Aaru.Images/Apridisk/Identify.cs +++ b/Aaru.Images/Apridisk/Identify.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class Apridisk + public sealed partial class Apridisk { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/Apridisk/Properties.cs b/Aaru.Images/Apridisk/Properties.cs index f5a06a81e..c24fce52b 100644 --- a/Aaru.Images/Apridisk/Properties.cs +++ b/Aaru.Images/Apridisk/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Apridisk + public sealed partial class Apridisk { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/Apridisk/Read.cs b/Aaru.Images/Apridisk/Read.cs index 1e1fc95e0..ceba9f2fa 100644 --- a/Aaru.Images/Apridisk/Read.cs +++ b/Aaru.Images/Apridisk/Read.cs @@ -41,7 +41,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Apridisk + public sealed partial class Apridisk { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/Apridisk/Structs.cs b/Aaru.Images/Apridisk/Structs.cs index c85e50b34..12a30029e 100644 --- a/Aaru.Images/Apridisk/Structs.cs +++ b/Aaru.Images/Apridisk/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Apridisk + public sealed partial class Apridisk { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ApridiskRecord diff --git a/Aaru.Images/Apridisk/Unsupported.cs b/Aaru.Images/Apridisk/Unsupported.cs index b42a9df1e..3bc6f2919 100644 --- a/Aaru.Images/Apridisk/Unsupported.cs +++ b/Aaru.Images/Apridisk/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Apridisk + public sealed partial class Apridisk { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/Apridisk/Write.cs b/Aaru.Images/Apridisk/Write.cs index d44396ddd..6d1f0e4ab 100644 --- a/Aaru.Images/Apridisk/Write.cs +++ b/Aaru.Images/Apridisk/Write.cs @@ -43,14 +43,14 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.DiscImages { - public partial class Apridisk + public sealed partial class Apridisk { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) { if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/BLU/BLU.cs b/Aaru.Images/BLU/BLU.cs index 072d02e42..1f432b833 100644 --- a/Aaru.Images/BLU/BLU.cs +++ b/Aaru.Images/BLU/BLU.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Blu : IWritableImage, IVerifiableSectorsImage + public sealed partial class Blu : IWritableImage, IVerifiableSectorsImage { IFilter _bluImageFilter; int _bptag; diff --git a/Aaru.Images/BLU/Constants.cs b/Aaru.Images/BLU/Constants.cs index f614dd366..615723d39 100644 --- a/Aaru.Images/BLU/Constants.cs +++ b/Aaru.Images/BLU/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Blu + public sealed partial class Blu { const string PROFILE_NAME = "PROFILE "; const string PROFILE10_NAME = "PROFILE 10 "; diff --git a/Aaru.Images/BLU/Identify.cs b/Aaru.Images/BLU/Identify.cs index 3d25cfa2d..fa0ca393e 100644 --- a/Aaru.Images/BLU/Identify.cs +++ b/Aaru.Images/BLU/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Blu + public sealed partial class Blu { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/BLU/Properties.cs b/Aaru.Images/BLU/Properties.cs index 90ee5e319..a66089d62 100644 --- a/Aaru.Images/BLU/Properties.cs +++ b/Aaru.Images/BLU/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Blu + public sealed partial class Blu { public ImageInfo Info => _imageInfo; public string Name => "Basic Lisa Utility"; diff --git a/Aaru.Images/BLU/Read.cs b/Aaru.Images/BLU/Read.cs index ae2f85dff..dfcdadef4 100644 --- a/Aaru.Images/BLU/Read.cs +++ b/Aaru.Images/BLU/Read.cs @@ -41,7 +41,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Blu + public sealed partial class Blu { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/BLU/Unsupported.cs b/Aaru.Images/BLU/Unsupported.cs index 1ab85f47b..155466688 100644 --- a/Aaru.Images/BLU/Unsupported.cs +++ b/Aaru.Images/BLU/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Blu + public sealed partial class Blu { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/BLU/Verify.cs b/Aaru.Images/BLU/Verify.cs index b15dd2fcd..4534a6eb0 100644 --- a/Aaru.Images/BLU/Verify.cs +++ b/Aaru.Images/BLU/Verify.cs @@ -34,7 +34,7 @@ using System.Collections.Generic; namespace Aaru.DiscImages { - public partial class Blu + public sealed partial class Blu { // TODO: Check tag checkums public bool? VerifySector(ulong sectorAddress) => null; diff --git a/Aaru.Images/BLU/Write.cs b/Aaru.Images/BLU/Write.cs index b149ce9ec..1293737f9 100644 --- a/Aaru.Images/BLU/Write.cs +++ b/Aaru.Images/BLU/Write.cs @@ -45,7 +45,7 @@ using Version = Aaru.CommonTypes.Interop.Version; namespace Aaru.DiscImages { - public partial class Blu + public sealed partial class Blu { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -66,7 +66,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } @@ -246,8 +246,7 @@ namespace Aaru.DiscImages return false; } - if(newTag == null) - newTag = new byte[longSectorSize - 512]; + newTag ??= new byte[longSectorSize - 512]; _writingStream.Seek(longSectorSize + ((long)sectorAddress * longSectorSize), SeekOrigin.Begin); _writingStream.Write(data, 0, 512); @@ -351,8 +350,7 @@ namespace Aaru.DiscImages return false; } - if(newTag == null) - newTag = new byte[longSectorSize - 512]; + newTag ??= new byte[longSectorSize - 512]; _writingStream.Seek(longSectorSize + ((long)sectorAddress * longSectorSize), SeekOrigin.Begin); _writingStream.Write(data, (int)(givenSectorSize * i), 512); diff --git a/Aaru.Images/BlindWrite4/BlindWrite4.cs b/Aaru.Images/BlindWrite4/BlindWrite4.cs index 991c6599d..c75cab5bd 100644 --- a/Aaru.Images/BlindWrite4/BlindWrite4.cs +++ b/Aaru.Images/BlindWrite4/BlindWrite4.cs @@ -39,16 +39,15 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { // TODO: Too many unknowns, plus a completely unknown footer, to make this writable - public partial class BlindWrite4 : IOpticalMediaImage + public sealed partial class BlindWrite4 : IOpticalMediaImage { List _bwTracks; IFilter _dataFilter, _subFilter; - - Bw4Header _header; - ImageInfo _imageInfo; - Stream _imageStream; - Dictionary _offsetmap; - Dictionary _trackFlags; + Bw4Header _header; + ImageInfo _imageInfo; + Stream _imageStream; + Dictionary _offsetmap; + Dictionary _trackFlags; public BlindWrite4() => _imageInfo = new ImageInfo { diff --git a/Aaru.Images/BlindWrite4/Constants.cs b/Aaru.Images/BlindWrite4/Constants.cs index 352d3f46e..a5d3ec8b8 100644 --- a/Aaru.Images/BlindWrite4/Constants.cs +++ b/Aaru.Images/BlindWrite4/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class BlindWrite4 + public sealed partial class BlindWrite4 { /// "BLINDWRITE TOC FILE" readonly byte[] _bw4Signature = diff --git a/Aaru.Images/BlindWrite4/Enums.cs b/Aaru.Images/BlindWrite4/Enums.cs index c1881fb7d..d39a3549e 100644 --- a/Aaru.Images/BlindWrite4/Enums.cs +++ b/Aaru.Images/BlindWrite4/Enums.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class BlindWrite4 + public sealed partial class BlindWrite4 { enum Bw4TrackType : byte { diff --git a/Aaru.Images/BlindWrite4/Identify.cs b/Aaru.Images/BlindWrite4/Identify.cs index 8f5e5bafe..bba5f9b26 100644 --- a/Aaru.Images/BlindWrite4/Identify.cs +++ b/Aaru.Images/BlindWrite4/Identify.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class BlindWrite4 + public sealed partial class BlindWrite4 { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/BlindWrite4/Properties.cs b/Aaru.Images/BlindWrite4/Properties.cs index 546a43b88..5b8144c8f 100644 --- a/Aaru.Images/BlindWrite4/Properties.cs +++ b/Aaru.Images/BlindWrite4/Properties.cs @@ -38,7 +38,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class BlindWrite4 + public sealed partial class BlindWrite4 { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/BlindWrite4/Read.cs b/Aaru.Images/BlindWrite4/Read.cs index 36268c7e9..2132a1700 100644 --- a/Aaru.Images/BlindWrite4/Read.cs +++ b/Aaru.Images/BlindWrite4/Read.cs @@ -48,7 +48,7 @@ using Session = Aaru.CommonTypes.Structs.Session; namespace Aaru.DiscImages { - public partial class BlindWrite4 + public sealed partial class BlindWrite4 { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/BlindWrite4/Structs.cs b/Aaru.Images/BlindWrite4/Structs.cs index c5703be2e..658530c01 100644 --- a/Aaru.Images/BlindWrite4/Structs.cs +++ b/Aaru.Images/BlindWrite4/Structs.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class BlindWrite4 + public sealed partial class BlindWrite4 { struct Bw4Header { diff --git a/Aaru.Images/BlindWrite4/Verify.cs b/Aaru.Images/BlindWrite4/Verify.cs index 424786ff2..ed2f73063 100644 --- a/Aaru.Images/BlindWrite4/Verify.cs +++ b/Aaru.Images/BlindWrite4/Verify.cs @@ -36,7 +36,7 @@ using Aaru.Checksums; namespace Aaru.DiscImages { - public partial class BlindWrite4 + public sealed partial class BlindWrite4 { public bool? VerifySector(ulong sectorAddress) { diff --git a/Aaru.Images/BlindWrite5/BlindWrite5.cs b/Aaru.Images/BlindWrite5/BlindWrite5.cs index 60cfdd339..2197895e8 100644 --- a/Aaru.Images/BlindWrite5/BlindWrite5.cs +++ b/Aaru.Images/BlindWrite5/BlindWrite5.cs @@ -39,7 +39,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { // TODO: Too many unknowns to make this writable - public partial class BlindWrite5 : IOpticalMediaImage + public sealed partial class BlindWrite5 : IOpticalMediaImage { byte[] _atip; byte[] _bca; @@ -52,16 +52,15 @@ namespace Aaru.DiscImages byte[] _dpm; List _filePaths; byte[] _fullToc; - - Bw5Header _header; - ImageInfo _imageInfo; - Stream _imageStream; - byte[] _mode2A; - Dictionary _offsetmap; - byte[] _pfi; - byte[] _pma; - Dictionary _trackFlags; - byte[] _unkBlock; + Bw5Header _header; + ImageInfo _imageInfo; + Stream _imageStream; + byte[] _mode2A; + Dictionary _offsetmap; + byte[] _pfi; + byte[] _pma; + Dictionary _trackFlags; + byte[] _unkBlock; public BlindWrite5() => _imageInfo = new ImageInfo { diff --git a/Aaru.Images/BlindWrite5/Constants.cs b/Aaru.Images/BlindWrite5/Constants.cs index c74762ce1..4377287b3 100644 --- a/Aaru.Images/BlindWrite5/Constants.cs +++ b/Aaru.Images/BlindWrite5/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class BlindWrite5 + public sealed partial class BlindWrite5 { /// "BWT5 STREAM FOOT" readonly byte[] _bw5Footer = diff --git a/Aaru.Images/BlindWrite5/Enums.cs b/Aaru.Images/BlindWrite5/Enums.cs index a2a18091c..77881ac51 100644 --- a/Aaru.Images/BlindWrite5/Enums.cs +++ b/Aaru.Images/BlindWrite5/Enums.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class BlindWrite5 + public sealed partial class BlindWrite5 { enum Bw5TrackType : byte { diff --git a/Aaru.Images/BlindWrite5/Helpers.cs b/Aaru.Images/BlindWrite5/Helpers.cs index f441659a8..be9bc816b 100644 --- a/Aaru.Images/BlindWrite5/Helpers.cs +++ b/Aaru.Images/BlindWrite5/Helpers.cs @@ -36,7 +36,7 @@ using Aaru.Decoders.SCSI.MMC; namespace Aaru.DiscImages { - public partial class BlindWrite5 + public sealed partial class BlindWrite5 { static TrackType BlindWriteTrackTypeToTrackType(Bw5TrackType trackType) { diff --git a/Aaru.Images/BlindWrite5/Identify.cs b/Aaru.Images/BlindWrite5/Identify.cs index 4536cf6fb..ea3817465 100644 --- a/Aaru.Images/BlindWrite5/Identify.cs +++ b/Aaru.Images/BlindWrite5/Identify.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class BlindWrite5 + public sealed partial class BlindWrite5 { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/BlindWrite5/Properties.cs b/Aaru.Images/BlindWrite5/Properties.cs index 33e2baa9f..4c8d02056 100644 --- a/Aaru.Images/BlindWrite5/Properties.cs +++ b/Aaru.Images/BlindWrite5/Properties.cs @@ -38,7 +38,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class BlindWrite5 + public sealed partial class BlindWrite5 { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/BlindWrite5/Read.cs b/Aaru.Images/BlindWrite5/Read.cs index 0c88a63cd..47c2ebcbe 100644 --- a/Aaru.Images/BlindWrite5/Read.cs +++ b/Aaru.Images/BlindWrite5/Read.cs @@ -53,7 +53,7 @@ using Session = Aaru.CommonTypes.Structs.Session; namespace Aaru.DiscImages { - public partial class BlindWrite5 + public sealed partial class BlindWrite5 { public bool Open(IFilter imageFilter) { @@ -1245,9 +1245,10 @@ namespace Aaru.DiscImages public byte[] ReadSectors(ulong sectorAddress, uint length, uint track) { // TODO: Cross data files - var aaruTrack = new Track(); - - aaruTrack.TrackSequence = 0; + var aaruTrack = new Track + { + TrackSequence = 0 + }; foreach(Track bwTrack in Tracks.Where(bwTrack => bwTrack.TrackSequence == track)) { @@ -1379,9 +1380,10 @@ namespace Aaru.DiscImages public byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag) { // TODO: Cross data files - var aaruTrack = new Track(); - - aaruTrack.TrackSequence = 0; + var aaruTrack = new Track + { + TrackSequence = 0 + }; foreach(Track bwTrack in Tracks.Where(bwTrack => bwTrack.TrackSequence == track)) { @@ -1818,9 +1820,10 @@ namespace Aaru.DiscImages public byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track) { // TODO: Cross data files - var aaruTrack = new Track(); - - aaruTrack.TrackSequence = 0; + var aaruTrack = new Track + { + TrackSequence = 0 + }; foreach(Track bwTrack in Tracks.Where(bwTrack => bwTrack.TrackSequence == track)) { diff --git a/Aaru.Images/BlindWrite5/Structs.cs b/Aaru.Images/BlindWrite5/Structs.cs index 82409f518..62fca7729 100644 --- a/Aaru.Images/BlindWrite5/Structs.cs +++ b/Aaru.Images/BlindWrite5/Structs.cs @@ -37,7 +37,7 @@ using Aaru.Decoders.SCSI.MMC; namespace Aaru.DiscImages { - public partial class BlindWrite5 + public sealed partial class BlindWrite5 { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Bw5Header diff --git a/Aaru.Images/BlindWrite5/Verify.cs b/Aaru.Images/BlindWrite5/Verify.cs index 03818dc0d..ac042f5ad 100644 --- a/Aaru.Images/BlindWrite5/Verify.cs +++ b/Aaru.Images/BlindWrite5/Verify.cs @@ -36,7 +36,7 @@ using Aaru.Checksums; namespace Aaru.DiscImages { - public partial class BlindWrite5 + public sealed partial class BlindWrite5 { public bool? VerifySector(ulong sectorAddress) { diff --git a/Aaru.Images/CDRDAO/CDRDAO.cs b/Aaru.Images/CDRDAO/CDRDAO.cs index 48e23d376..05a240cd0 100644 --- a/Aaru.Images/CDRDAO/CDRDAO.cs +++ b/Aaru.Images/CDRDAO/CDRDAO.cs @@ -41,7 +41,7 @@ namespace Aaru.DiscImages { // TODO: Doesn't support compositing from several files // TODO: Doesn't support silences that are not in files - public partial class Cdrdao : IWritableOpticalImage + public sealed partial class Cdrdao : IWritableOpticalImage { IFilter _cdrdaoFilter; StreamWriter _descriptorStream; diff --git a/Aaru.Images/CDRDAO/Constants.cs b/Aaru.Images/CDRDAO/Constants.cs index 6f99defdb..340c21e77 100644 --- a/Aaru.Images/CDRDAO/Constants.cs +++ b/Aaru.Images/CDRDAO/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Cdrdao + public sealed partial class Cdrdao { /// Audio track, 2352 bytes/sector const string CDRDAO_TRACK_TYPE_AUDIO = "AUDIO"; diff --git a/Aaru.Images/CDRDAO/Helpers.cs b/Aaru.Images/CDRDAO/Helpers.cs index 40b1cf2fd..d2ec696b2 100644 --- a/Aaru.Images/CDRDAO/Helpers.cs +++ b/Aaru.Images/CDRDAO/Helpers.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Cdrdao + public sealed partial class Cdrdao { static ushort CdrdaoTrackTypeToBytesPerSector(string trackType) { diff --git a/Aaru.Images/CDRDAO/Identify.cs b/Aaru.Images/CDRDAO/Identify.cs index e75d4b86e..45e0b52ae 100644 --- a/Aaru.Images/CDRDAO/Identify.cs +++ b/Aaru.Images/CDRDAO/Identify.cs @@ -38,7 +38,7 @@ using Aaru.Console; namespace Aaru.DiscImages { - public partial class Cdrdao + public sealed partial class Cdrdao { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/CDRDAO/Properties.cs b/Aaru.Images/CDRDAO/Properties.cs index b4625df20..4154709e8 100644 --- a/Aaru.Images/CDRDAO/Properties.cs +++ b/Aaru.Images/CDRDAO/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Cdrdao + public sealed partial class Cdrdao { public OpticalImageCapabilities OpticalCapabilities => OpticalImageCapabilities.CanStoreAudioTracks | OpticalImageCapabilities.CanStoreDataTracks | diff --git a/Aaru.Images/CDRDAO/Read.cs b/Aaru.Images/CDRDAO/Read.cs index 242edb911..79f24650e 100644 --- a/Aaru.Images/CDRDAO/Read.cs +++ b/Aaru.Images/CDRDAO/Read.cs @@ -47,7 +47,7 @@ using Session = Aaru.CommonTypes.Structs.Session; namespace Aaru.DiscImages { - public partial class Cdrdao + public sealed partial class Cdrdao { public bool Open(IFilter imageFilter) { @@ -60,7 +60,7 @@ namespace Aaru.DiscImages { imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin); _tocStream = new StreamReader(imageFilter.GetDataForkStream()); - bool intrack = false; + bool inTrack = false; // Initialize all RegExs var regexComment = new Regex(REGEX_COMMENT); @@ -103,12 +103,12 @@ namespace Aaru.DiscImages Comment = "" }; - var currenttrack = new CdrdaoTrack(); + var currentTrack = new CdrdaoTrack(); uint currentTrackNumber = 0; - currenttrack.Indexes = new Dictionary(); - currenttrack.Pregap = 0; + currentTrack.Indexes = new Dictionary(); + currentTrack.Pregap = 0; ulong currentSector = 0; - int nextindex = 2; + int nextIndex = 2; var commentBuilder = new StringBuilder(); _tocStream = new StreamReader(_cdrdaoFilter.GetDataForkStream()); @@ -238,48 +238,48 @@ namespace Aaru.DiscImages lineNumber, matchTrack.Groups["type"].Value, matchTrack.Groups["subchan"].Value); - if(intrack) + if(inTrack) { - currentSector += currenttrack.Sectors; + currentSector += currentTrack.Sectors; - if(currenttrack.Pregap != currenttrack.Sectors && - !currenttrack.Indexes.ContainsKey(1)) - currenttrack.Indexes.Add(1, currenttrack.StartSector + currenttrack.Pregap); + if(currentTrack.Pregap != currentTrack.Sectors && + !currentTrack.Indexes.ContainsKey(1)) + currentTrack.Indexes.Add(1, currentTrack.StartSector + currentTrack.Pregap); - _discimage.Tracks.Add(currenttrack); + _discimage.Tracks.Add(currentTrack); - currenttrack = new CdrdaoTrack + currentTrack = new CdrdaoTrack { Indexes = new Dictionary(), Pregap = 0 }; - nextindex = 2; + nextIndex = 2; } currentTrackNumber++; - intrack = true; + inTrack = true; switch(matchTrack.Groups["type"].Value) { case "AUDIO": case "MODE1_RAW": case "MODE2_RAW": - currenttrack.Bps = 2352; + currentTrack.Bps = 2352; break; case "MODE1": case "MODE2_FORM1": - currenttrack.Bps = 2048; + currentTrack.Bps = 2048; break; case "MODE2_FORM2": - currenttrack.Bps = 2324; + currentTrack.Bps = 2324; break; case "MODE2": case "MODE2_FORM_MIX": - currenttrack.Bps = 2336; + currentTrack.Bps = 2336; break; default: @@ -291,10 +291,10 @@ namespace Aaru.DiscImages { case "": break; case "RW": - currenttrack.Packedsubchannel = true; + currentTrack.Packedsubchannel = true; goto case "RW_RAW"; case "RW_RAW": - currenttrack.Subchannel = true; + currentTrack.Subchannel = true; break; default: @@ -302,39 +302,39 @@ namespace Aaru.DiscImages NotSupportedException($"Track subchannel mode {matchTrack.Groups["subchan"].Value} is unsupported"); } - currenttrack.Tracktype = matchTrack.Groups["type"].Value; + currentTrack.Tracktype = matchTrack.Groups["type"].Value; - currenttrack.Sequence = currentTrackNumber; - currenttrack.StartSector = currentSector; + currentTrack.Sequence = currentTrackNumber; + currentTrack.StartSector = currentSector; } else if(matchCopy.Success) { AaruConsole.DebugWriteLine("CDRDAO plugin", "Found {1} COPY at line {0}", lineNumber, matchCopy.Groups["no"].Value); - currenttrack.FlagDcp |= intrack && matchCopy.Groups["no"].Value == ""; + currentTrack.FlagDcp |= inTrack && matchCopy.Groups["no"].Value == ""; } else if(matchEmphasis.Success) { AaruConsole.DebugWriteLine("CDRDAO plugin", "Found {1} PRE_EMPHASIS at line {0}", lineNumber, matchEmphasis.Groups["no"].Value); - currenttrack.FlagPre |= intrack && matchEmphasis.Groups["no"].Value == ""; + currentTrack.FlagPre |= inTrack && matchEmphasis.Groups["no"].Value == ""; } else if(matchStereo.Success) { AaruConsole.DebugWriteLine("CDRDAO plugin", "Found {1}_CHANNEL_AUDIO at line {0}", lineNumber, matchStereo.Groups["num"].Value); - currenttrack.Flag_4Ch |= intrack && matchStereo.Groups["num"].Value == "FOUR"; + currentTrack.Flag_4Ch |= inTrack && matchStereo.Groups["num"].Value == "FOUR"; } else if(matchIsrc.Success) { AaruConsole.DebugWriteLine("CDRDAO plugin", "Found ISRC \"{1}\" at line {0}", lineNumber, matchIsrc.Groups["isrc"].Value); - if(intrack) - currenttrack.Isrc = matchIsrc.Groups["isrc"].Value; + if(inTrack) + currentTrack.Isrc = matchIsrc.Groups["isrc"].Value; } else if(matchIndex.Success) { @@ -346,35 +346,35 @@ namespace Aaru.DiscImages ulong nextIndexPos = (ulong.Parse(lengthString[0]) * 60 * 75) + (ulong.Parse(lengthString[1]) * 75) + ulong.Parse(lengthString[2]); - currenttrack.Indexes.Add(nextindex, - nextIndexPos + currenttrack.Pregap + currenttrack.StartSector); + currentTrack.Indexes.Add(nextIndex, + nextIndexPos + currentTrack.Pregap + currentTrack.StartSector); } else if(matchPregap.Success) { AaruConsole.DebugWriteLine("CDRDAO plugin", "Found START \"{1}\" at line {0}", lineNumber, matchPregap.Groups["address"].Value); - currenttrack.Indexes.Add(0, currenttrack.StartSector); + currentTrack.Indexes.Add(0, currentTrack.StartSector); if(matchPregap.Groups["address"].Value != "") { string[] lengthString = matchPregap.Groups["address"].Value.Split(':'); - currenttrack.Pregap = (ulong.Parse(lengthString[0]) * 60 * 75) + + currentTrack.Pregap = (ulong.Parse(lengthString[0]) * 60 * 75) + (ulong.Parse(lengthString[1]) * 75) + ulong.Parse(lengthString[2]); } else - currenttrack.Pregap = currenttrack.Sectors; + currentTrack.Pregap = currentTrack.Sectors; } else if(matchZeroPregap.Success) { AaruConsole.DebugWriteLine("CDRDAO plugin", "Found PREGAP \"{1}\" at line {0}", lineNumber, matchZeroPregap.Groups["length"].Value); - currenttrack.Indexes.Add(0, currenttrack.StartSector); + currentTrack.Indexes.Add(0, currentTrack.StartSector); string[] lengthString = matchZeroPregap.Groups["length"].Value.Split(':'); - currenttrack.Pregap = (ulong.Parse(lengthString[0]) * 60 * 75) + + currentTrack.Pregap = (ulong.Parse(lengthString[0]) * 60 * 75) + (ulong.Parse(lengthString[1]) * 75) + ulong.Parse(lengthString[2]); } else if(matchZeroData.Success) @@ -394,7 +394,7 @@ namespace Aaru.DiscImages filtersList = new FiltersList(); - currenttrack.Trackfile = new CdrdaoTrackFile + currentTrack.Trackfile = new CdrdaoTrackFile { Datafilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), @@ -416,20 +416,20 @@ namespace Aaru.DiscImages (ulong.Parse(startString[1]) * 75) + ulong.Parse(startString[2]); } - currenttrack.Trackfile.Offset += startSectors * currenttrack.Bps; + currentTrack.Trackfile.Offset += startSectors * currentTrack.Bps; if(matchAudioFile.Groups["length"].Value != "") { string[] lengthString = matchAudioFile.Groups["length"].Value.Split(':'); - currenttrack.Sectors = (ulong.Parse(lengthString[0]) * 60 * 75) + + currentTrack.Sectors = (ulong.Parse(lengthString[0]) * 60 * 75) + (ulong.Parse(lengthString[1]) * 75) + ulong.Parse(lengthString[2]); } else - currenttrack.Sectors = - ((ulong)currenttrack.Trackfile.Datafilter.GetDataForkLength() - - currenttrack.Trackfile.Offset) / currenttrack.Bps; + currentTrack.Sectors = + ((ulong)currentTrack.Trackfile.Datafilter.GetDataForkLength() - + currentTrack.Trackfile.Offset) / currentTrack.Bps; } else if(matchFile.Success) { @@ -438,7 +438,7 @@ namespace Aaru.DiscImages filtersList = new FiltersList(); - currenttrack.Trackfile = new CdrdaoTrackFile + currentTrack.Trackfile = new CdrdaoTrackFile { Datafilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), @@ -454,22 +454,22 @@ namespace Aaru.DiscImages { string[] lengthString = matchFile.Groups["length"].Value.Split(':'); - currenttrack.Sectors = (ulong.Parse(lengthString[0]) * 60 * 75) + + currentTrack.Sectors = (ulong.Parse(lengthString[0]) * 60 * 75) + (ulong.Parse(lengthString[1]) * 75) + ulong.Parse(lengthString[2]); } else - currenttrack.Sectors = - ((ulong)currenttrack.Trackfile.Datafilter.GetDataForkLength() - - currenttrack.Trackfile.Offset) / currenttrack.Bps; + currentTrack.Sectors = + ((ulong)currentTrack.Trackfile.Datafilter.GetDataForkLength() - + currentTrack.Trackfile.Offset) / currentTrack.Bps; } else if(matchTitle.Success) { AaruConsole.DebugWriteLine("CDRDAO plugin", "Found TITLE \"{1}\" at line {0}", lineNumber, matchTitle.Groups["title"].Value); - if(intrack) - currenttrack.Title = matchTitle.Groups["title"].Value; + if(inTrack) + currentTrack.Title = matchTitle.Groups["title"].Value; else _discimage.Title = matchTitle.Groups["title"].Value; } @@ -478,8 +478,8 @@ namespace Aaru.DiscImages AaruConsole.DebugWriteLine("CDRDAO plugin", "Found PERFORMER \"{1}\" at line {0}", lineNumber, matchPerformer.Groups["performer"].Value); - if(intrack) - currenttrack.Performer = matchPerformer.Groups["performer"].Value; + if(inTrack) + currentTrack.Performer = matchPerformer.Groups["performer"].Value; else _discimage.Performer = matchPerformer.Groups["performer"].Value; } @@ -488,8 +488,8 @@ namespace Aaru.DiscImages AaruConsole.DebugWriteLine("CDRDAO plugin", "Found SONGWRITER \"{1}\" at line {0}", lineNumber, matchSongwriter.Groups["songwriter"].Value); - if(intrack) - currenttrack.Songwriter = matchSongwriter.Groups["songwriter"].Value; + if(inTrack) + currentTrack.Songwriter = matchSongwriter.Groups["songwriter"].Value; else _discimage.Songwriter = matchSongwriter.Groups["songwriter"].Value; } @@ -498,8 +498,8 @@ namespace Aaru.DiscImages AaruConsole.DebugWriteLine("CDRDAO plugin", "Found COMPOSER \"{1}\" at line {0}", lineNumber, matchComposer.Groups["composer"].Value); - if(intrack) - currenttrack.Composer = matchComposer.Groups["composer"].Value; + if(inTrack) + currentTrack.Composer = matchComposer.Groups["composer"].Value; else _discimage.Composer = matchComposer.Groups["composer"].Value; } @@ -508,8 +508,8 @@ namespace Aaru.DiscImages AaruConsole.DebugWriteLine("CDRDAO plugin", "Found ARRANGER \"{1}\" at line {0}", lineNumber, matchArranger.Groups["arranger"].Value); - if(intrack) - currenttrack.Arranger = matchArranger.Groups["arranger"].Value; + if(inTrack) + currentTrack.Arranger = matchArranger.Groups["arranger"].Value; else _discimage.Arranger = matchArranger.Groups["arranger"].Value; } @@ -518,8 +518,8 @@ namespace Aaru.DiscImages AaruConsole.DebugWriteLine("CDRDAO plugin", "Found MESSAGE \"{1}\" at line {0}", lineNumber, matchMessage.Groups["message"].Value); - if(intrack) - currenttrack.Message = matchMessage.Groups["message"].Value; + if(inTrack) + currentTrack.Message = matchMessage.Groups["message"].Value; else _discimage.Message = matchMessage.Groups["message"].Value; } @@ -528,7 +528,7 @@ namespace Aaru.DiscImages AaruConsole.DebugWriteLine("CDRDAO plugin", "Found DISC_ID \"{1}\" at line {0}", lineNumber, matchDiscId.Groups["discid"].Value); - if(!intrack) + if(!inTrack) _discimage.DiskId = matchDiscId.Groups["discid"].Value; } else if(matchUpc.Success) @@ -536,7 +536,7 @@ namespace Aaru.DiscImages AaruConsole.DebugWriteLine("CDRDAO plugin", "Found UPC_EAN \"{1}\" at line {0}", lineNumber, matchUpc.Groups["catalog"].Value); - if(!intrack) + if(!inTrack) _discimage.Barcode = matchUpc.Groups["catalog"].Value; } @@ -559,13 +559,13 @@ namespace Aaru.DiscImages */ } - if(currenttrack.Sequence != 0) + if(currentTrack.Sequence != 0) { - if(currenttrack.Pregap != currenttrack.Sectors && - !currenttrack.Indexes.ContainsKey(1)) - currenttrack.Indexes.Add(1, currenttrack.StartSector + currenttrack.Pregap); + if(currentTrack.Pregap != currentTrack.Sectors && + !currentTrack.Indexes.ContainsKey(1)) + currentTrack.Indexes.Add(1, currentTrack.StartSector + currentTrack.Pregap); - _discimage.Tracks.Add(currenttrack); + _discimage.Tracks.Add(currentTrack); } _discimage.Comment = commentBuilder.ToString(); diff --git a/Aaru.Images/CDRDAO/Structs.cs b/Aaru.Images/CDRDAO/Structs.cs index 35b9a2c50..be8806108 100644 --- a/Aaru.Images/CDRDAO/Structs.cs +++ b/Aaru.Images/CDRDAO/Structs.cs @@ -37,7 +37,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class Cdrdao + public sealed partial class Cdrdao { [SuppressMessage("ReSharper", "NotAccessedField.Local")] struct CdrdaoTrackFile diff --git a/Aaru.Images/CDRDAO/Verify.cs b/Aaru.Images/CDRDAO/Verify.cs index 47526bcda..3e54ae257 100644 --- a/Aaru.Images/CDRDAO/Verify.cs +++ b/Aaru.Images/CDRDAO/Verify.cs @@ -36,7 +36,7 @@ using Aaru.Checksums; namespace Aaru.DiscImages { - public partial class Cdrdao + public sealed partial class Cdrdao { public bool? VerifySector(ulong sectorAddress) { diff --git a/Aaru.Images/CDRDAO/Write.cs b/Aaru.Images/CDRDAO/Write.cs index d2170fecc..2f80a35e3 100644 --- a/Aaru.Images/CDRDAO/Write.cs +++ b/Aaru.Images/CDRDAO/Write.cs @@ -43,7 +43,7 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType; namespace Aaru.DiscImages { - public partial class Cdrdao + public sealed partial class Cdrdao { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -61,7 +61,7 @@ namespace Aaru.DiscImages if(_separateTracksWriting) { - ErrorMessage = "Separate tracksnot yet implemented"; + ErrorMessage = "Separate tracks not yet implemented"; return false; } @@ -72,7 +72,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } @@ -87,7 +87,9 @@ namespace Aaru.DiscImages // TODO: Separate tracks try { - _writingBaseName = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)); + _writingBaseName = + Path.Combine(Path.GetDirectoryName(path) ?? "", Path.GetFileNameWithoutExtension(path)); + _descriptorStream = new StreamWriter(path, false, Encoding.ASCII); } catch(IOException e) diff --git a/Aaru.Images/CDRWin/CDRWin.cs b/Aaru.Images/CDRWin/CDRWin.cs index 999708fba..851080f22 100644 --- a/Aaru.Images/CDRWin/CDRWin.cs +++ b/Aaru.Images/CDRWin/CDRWin.cs @@ -40,7 +40,7 @@ using Aaru.Decoders.CD; namespace Aaru.DiscImages { // TODO: Implement track flags - public partial class CdrWin : IWritableOpticalImage, IVerifiableImage + public sealed partial class CdrWin : IWritableOpticalImage, IVerifiableImage { IFilter _cdrwinFilter; StreamReader _cueStream; diff --git a/Aaru.Images/CDRWin/Constants.cs b/Aaru.Images/CDRWin/Constants.cs index ba6ba9302..b1e1575ad 100644 --- a/Aaru.Images/CDRWin/Constants.cs +++ b/Aaru.Images/CDRWin/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class CdrWin + public sealed partial class CdrWin { // Type for FILE entity /// Data as-is in little-endian diff --git a/Aaru.Images/CDRWin/Helpers.cs b/Aaru.Images/CDRWin/Helpers.cs index 86b991fbc..b35f1293b 100644 --- a/Aaru.Images/CDRWin/Helpers.cs +++ b/Aaru.Images/CDRWin/Helpers.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class CdrWin + public sealed partial class CdrWin { static int CdrWinMsfToLba(string msf) { diff --git a/Aaru.Images/CDRWin/Identify.cs b/Aaru.Images/CDRWin/Identify.cs index 8452c5cef..4a173a014 100644 --- a/Aaru.Images/CDRWin/Identify.cs +++ b/Aaru.Images/CDRWin/Identify.cs @@ -38,7 +38,7 @@ using Aaru.Console; namespace Aaru.DiscImages { - public partial class CdrWin + public sealed partial class CdrWin { // Due to .cue format, this method must parse whole file, ignoring errors (those will be thrown by OpenImage()). public bool Identify(IFilter imageFilter) diff --git a/Aaru.Images/CDRWin/Properties.cs b/Aaru.Images/CDRWin/Properties.cs index 59199d512..2a32d5f7f 100644 --- a/Aaru.Images/CDRWin/Properties.cs +++ b/Aaru.Images/CDRWin/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class CdrWin + public sealed partial class CdrWin { public OpticalImageCapabilities OpticalCapabilities => OpticalImageCapabilities.CanStoreAudioTracks | OpticalImageCapabilities.CanStoreDataTracks | diff --git a/Aaru.Images/CDRWin/Read.cs b/Aaru.Images/CDRWin/Read.cs index 682c4b2c6..6095765ee 100644 --- a/Aaru.Images/CDRWin/Read.cs +++ b/Aaru.Images/CDRWin/Read.cs @@ -49,7 +49,7 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType; namespace Aaru.DiscImages { - public partial class CdrWin + public sealed partial class CdrWin { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/CDRWin/Structs.cs b/Aaru.Images/CDRWin/Structs.cs index acc9c6397..83ca9088e 100644 --- a/Aaru.Images/CDRWin/Structs.cs +++ b/Aaru.Images/CDRWin/Structs.cs @@ -39,7 +39,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class CdrWin + public sealed partial class CdrWin { struct CdrWinTrackFile { diff --git a/Aaru.Images/CDRWin/Verify.cs b/Aaru.Images/CDRWin/Verify.cs index 92fced77f..1a2d4e924 100644 --- a/Aaru.Images/CDRWin/Verify.cs +++ b/Aaru.Images/CDRWin/Verify.cs @@ -40,7 +40,7 @@ using Aaru.Console; namespace Aaru.DiscImages { - public partial class CdrWin + public sealed partial class CdrWin { public bool? VerifyMediaImage() { diff --git a/Aaru.Images/CDRWin/Write.cs b/Aaru.Images/CDRWin/Write.cs index 1a9423d9d..f8f127757 100644 --- a/Aaru.Images/CDRWin/Write.cs +++ b/Aaru.Images/CDRWin/Write.cs @@ -42,7 +42,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class CdrWin + public sealed partial class CdrWin { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -86,7 +86,9 @@ namespace Aaru.DiscImages // TODO: Separate tracks try { - _writingBaseName = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)); + _writingBaseName = + Path.Combine(Path.GetDirectoryName(path) ?? "", Path.GetFileNameWithoutExtension(path)); + _descriptorStream = new StreamWriter(path, false, Encoding.ASCII); } catch(IOException e) diff --git a/Aaru.Images/CHD/CHD.cs b/Aaru.Images/CHD/CHD.cs index 10dcde071..d261325e9 100644 --- a/Aaru.Images/CHD/CHD.cs +++ b/Aaru.Images/CHD/CHD.cs @@ -43,7 +43,7 @@ namespace Aaru.DiscImages { // TODO: Implement PCMCIA support [SuppressMessage("ReSharper", "NotAccessedField.Local")] - public partial class Chd : IOpticalMediaImage, IVerifiableImage + public sealed partial class Chd : IOpticalMediaImage, IVerifiableImage { /// "MComprHD" readonly byte[] _chdTag = diff --git a/Aaru.Images/CHD/Constants.cs b/Aaru.Images/CHD/Constants.cs index d3e0be26b..ddfa901d9 100644 --- a/Aaru.Images/CHD/Constants.cs +++ b/Aaru.Images/CHD/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Chd + public sealed partial class Chd { /// "GDDD" const uint HARD_DISK_METADATA = 0x47444444; diff --git a/Aaru.Images/CHD/Enums.cs b/Aaru.Images/CHD/Enums.cs index 547c35093..d0233b95a 100644 --- a/Aaru.Images/CHD/Enums.cs +++ b/Aaru.Images/CHD/Enums.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Chd + public sealed partial class Chd { enum ChdCompression : uint { diff --git a/Aaru.Images/CHD/Helpers.cs b/Aaru.Images/CHD/Helpers.cs index 4f96f5450..5b4b98b67 100644 --- a/Aaru.Images/CHD/Helpers.cs +++ b/Aaru.Images/CHD/Helpers.cs @@ -42,7 +42,7 @@ using SharpCompress.Compressors.Deflate; namespace Aaru.DiscImages { - public partial class Chd + public sealed partial class Chd { Track GetTrack(ulong sector) { @@ -58,7 +58,7 @@ namespace Aaru.DiscImages { _tracks.TryGetValue(track, out Track aaruTrack); - return aaruTrack.TrackStartSector + relativeSector; + return aaruTrack!.TrackStartSector + relativeSector; } byte[] GetHunk(ulong hunkNo) diff --git a/Aaru.Images/CHD/Identify.cs b/Aaru.Images/CHD/Identify.cs index e6aa3ee2a..ffb177b60 100644 --- a/Aaru.Images/CHD/Identify.cs +++ b/Aaru.Images/CHD/Identify.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class Chd + public sealed partial class Chd { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/CHD/Properties.cs b/Aaru.Images/CHD/Properties.cs index 4b0872fdd..6284c587e 100644 --- a/Aaru.Images/CHD/Properties.cs +++ b/Aaru.Images/CHD/Properties.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Chd + public sealed partial class Chd { public ImageInfo Info => _imageInfo; public string Name => "MAME Compressed Hunks of Data"; diff --git a/Aaru.Images/CHD/Read.cs b/Aaru.Images/CHD/Read.cs index d44f35936..a9d6a06c8 100644 --- a/Aaru.Images/CHD/Read.cs +++ b/Aaru.Images/CHD/Read.cs @@ -50,7 +50,7 @@ using Session = Aaru.CommonTypes.Structs.Session; namespace Aaru.DiscImages { - public partial class Chd + public sealed partial class Chd { [SuppressMessage("ReSharper", "UnusedVariable")] public bool Open(IFilter imageFilter) diff --git a/Aaru.Images/CHD/Structs.cs b/Aaru.Images/CHD/Structs.cs index 5ffea45b6..9e26e001c 100644 --- a/Aaru.Images/CHD/Structs.cs +++ b/Aaru.Images/CHD/Structs.cs @@ -36,7 +36,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedType.Local")] - public partial class Chd + public sealed partial class Chd { // Hunks are represented in a 64 bit integer with 44 bit as offset, 20 bits as length // Sectors are fixed at 512 bytes/sector diff --git a/Aaru.Images/CHD/Verify.cs b/Aaru.Images/CHD/Verify.cs index 95013fc37..2cd2b91a2 100644 --- a/Aaru.Images/CHD/Verify.cs +++ b/Aaru.Images/CHD/Verify.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Chd + public sealed partial class Chd { public bool? VerifySector(ulong sectorAddress) { diff --git a/Aaru.Images/CPCDSK/CPCDSK.cs b/Aaru.Images/CPCDSK/CPCDSK.cs index 962a93830..d7293c335 100644 --- a/Aaru.Images/CPCDSK/CPCDSK.cs +++ b/Aaru.Images/CPCDSK/CPCDSK.cs @@ -37,7 +37,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Cpcdsk : IMediaImage + public sealed partial class Cpcdsk : IMediaImage { Dictionary _addressMarks; bool _extended; diff --git a/Aaru.Images/CPCDSK/Constants.cs b/Aaru.Images/CPCDSK/Constants.cs index c5af2c82e..b0d093beb 100644 --- a/Aaru.Images/CPCDSK/Constants.cs +++ b/Aaru.Images/CPCDSK/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Cpcdsk + public sealed partial class Cpcdsk { /// Identifier for CPCEMU disk images, "MV - CPC" + usually : "EMU Disk-File\r\nDisk-Info\r\n" but not required readonly byte[] _cpcdskId = diff --git a/Aaru.Images/CPCDSK/Helpers.cs b/Aaru.Images/CPCDSK/Helpers.cs index 3eacf7e80..dfbf003fa 100644 --- a/Aaru.Images/CPCDSK/Helpers.cs +++ b/Aaru.Images/CPCDSK/Helpers.cs @@ -34,7 +34,7 @@ using Aaru.Decoders.Floppy; namespace Aaru.DiscImages { - public partial class Cpcdsk + public sealed partial class Cpcdsk { static int SizeCodeToBytes(IBMSectorSizeCode code) { diff --git a/Aaru.Images/CPCDSK/Identify.cs b/Aaru.Images/CPCDSK/Identify.cs index 576c971f7..ddaf24389 100644 --- a/Aaru.Images/CPCDSK/Identify.cs +++ b/Aaru.Images/CPCDSK/Identify.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Cpcdsk + public sealed partial class Cpcdsk { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/CPCDSK/Properties.cs b/Aaru.Images/CPCDSK/Properties.cs index b9f3fb3af..50811d15e 100644 --- a/Aaru.Images/CPCDSK/Properties.cs +++ b/Aaru.Images/CPCDSK/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Cpcdsk + public sealed partial class Cpcdsk { public ImageInfo Info => _imageInfo; public string Name => "CPCEMU Disk-File and Extended CPC Disk-File"; diff --git a/Aaru.Images/CPCDSK/Read.cs b/Aaru.Images/CPCDSK/Read.cs index 699b20685..4a01fa0bc 100644 --- a/Aaru.Images/CPCDSK/Read.cs +++ b/Aaru.Images/CPCDSK/Read.cs @@ -45,7 +45,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Cpcdsk + public sealed partial class Cpcdsk { public bool Open(IFilter imageFilter) { @@ -335,8 +335,8 @@ namespace Aaru.DiscImages for(uint i = 0; i < length; i++) { - byte[] adddressMark = ReadSector(sectorAddress + i); - ms.Write(adddressMark, 0, adddressMark.Length); + byte[] addressMark = ReadSector(sectorAddress + i); + ms.Write(addressMark, 0, addressMark.Length); } return ms.ToArray(); diff --git a/Aaru.Images/CPCDSK/Structs.cs b/Aaru.Images/CPCDSK/Structs.cs index d4bee4128..29800f935 100644 --- a/Aaru.Images/CPCDSK/Structs.cs +++ b/Aaru.Images/CPCDSK/Structs.cs @@ -35,7 +35,7 @@ using Aaru.Decoders.Floppy; namespace Aaru.DiscImages { - public partial class Cpcdsk + public sealed partial class Cpcdsk { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CpcDiskInfo @@ -89,7 +89,7 @@ namespace Aaru.DiscImages public readonly byte gap3; /// Filler public readonly byte filler; - /// Informatino for up to 32 sectors + /// Information for up to 32 sectors [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public readonly CpcSectorInfo[] sectorsInfo; } diff --git a/Aaru.Images/CPCDSK/Unsupported.cs b/Aaru.Images/CPCDSK/Unsupported.cs index 6fcd2660a..94c4dcfc7 100644 --- a/Aaru.Images/CPCDSK/Unsupported.cs +++ b/Aaru.Images/CPCDSK/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Cpcdsk + public sealed partial class Cpcdsk { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/CisCopy/CisCopy.cs b/Aaru.Images/CisCopy/CisCopy.cs index 59d083c90..8ab9acd4d 100644 --- a/Aaru.Images/CisCopy/CisCopy.cs +++ b/Aaru.Images/CisCopy/CisCopy.cs @@ -53,7 +53,7 @@ namespace Aaru.DiscImages * 2) High compression, algorithm unknown * Then the data for whole tracks follow. */ - public partial class CisCopy : IWritableImage + public sealed partial class CisCopy : IWritableImage { byte[] _decodedDisk; ImageInfo _imageInfo; diff --git a/Aaru.Images/CisCopy/Enums.cs b/Aaru.Images/CisCopy/Enums.cs index 3b092de15..90fbbbebf 100644 --- a/Aaru.Images/CisCopy/Enums.cs +++ b/Aaru.Images/CisCopy/Enums.cs @@ -34,7 +34,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { - public partial class CisCopy + public sealed partial class CisCopy { [SuppressMessage("ReSharper", "InconsistentNaming")] enum DiskType : byte diff --git a/Aaru.Images/CisCopy/Identify.cs b/Aaru.Images/CisCopy/Identify.cs index 22a7a2cd5..e7b72a2c0 100644 --- a/Aaru.Images/CisCopy/Identify.cs +++ b/Aaru.Images/CisCopy/Identify.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class CisCopy + public sealed partial class CisCopy { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/CisCopy/Properties.cs b/Aaru.Images/CisCopy/Properties.cs index 3aae2417a..4e716001b 100644 --- a/Aaru.Images/CisCopy/Properties.cs +++ b/Aaru.Images/CisCopy/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class CisCopy + public sealed partial class CisCopy { public string Name => "CisCopy Disk Image (DC-File)"; public Guid Id => new Guid("EDF20CC7-6012-49E2-9E92-663A53E42130"); diff --git a/Aaru.Images/CisCopy/Read.cs b/Aaru.Images/CisCopy/Read.cs index c427f2649..26ccaa3bd 100644 --- a/Aaru.Images/CisCopy/Read.cs +++ b/Aaru.Images/CisCopy/Read.cs @@ -41,7 +41,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class CisCopy + public sealed partial class CisCopy { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/CisCopy/Unsupported.cs b/Aaru.Images/CisCopy/Unsupported.cs index 09020001f..54ab9365a 100644 --- a/Aaru.Images/CisCopy/Unsupported.cs +++ b/Aaru.Images/CisCopy/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class CisCopy + public sealed partial class CisCopy { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/CisCopy/Write.cs b/Aaru.Images/CisCopy/Write.cs index cb4d399c4..99ca3f3d9 100644 --- a/Aaru.Images/CisCopy/Write.cs +++ b/Aaru.Images/CisCopy/Write.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class CisCopy + public sealed partial class CisCopy { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -54,7 +54,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } @@ -110,7 +110,7 @@ namespace Aaru.DiscImages break; default: - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/CloneCD/CloneCD.cs b/Aaru.Images/CloneCD/CloneCD.cs index 5ab56f0ac..af72979df 100644 --- a/Aaru.Images/CloneCD/CloneCD.cs +++ b/Aaru.Images/CloneCD/CloneCD.cs @@ -39,7 +39,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { // TODO: CloneCD stores subchannel deinterleaved - public partial class CloneCd : IWritableOpticalImage + public sealed partial class CloneCd : IWritableOpticalImage { string _catalog; // TODO: Use it IFilter _ccdFilter; diff --git a/Aaru.Images/CloneCD/Constants.cs b/Aaru.Images/CloneCD/Constants.cs index 96355e84d..6ce351b41 100644 --- a/Aaru.Images/CloneCD/Constants.cs +++ b/Aaru.Images/CloneCD/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class CloneCd + public sealed partial class CloneCd { const string CCD_IDENTIFIER = @"^\s*\[CloneCD\]"; const string DISC_IDENTIFIER = @"^\s*\[Disc\]"; diff --git a/Aaru.Images/CloneCD/Helpers.cs b/Aaru.Images/CloneCD/Helpers.cs index a5c483806..8cfbc5685 100644 --- a/Aaru.Images/CloneCD/Helpers.cs +++ b/Aaru.Images/CloneCD/Helpers.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class CloneCd + public sealed partial class CloneCd { static ulong GetLba(int minute, int second, int frame) => (ulong)(((minute * 60 * 75) + (second * 75) + frame) - 150); diff --git a/Aaru.Images/CloneCD/Identify.cs b/Aaru.Images/CloneCD/Identify.cs index 57d9810fe..b8dbad332 100644 --- a/Aaru.Images/CloneCD/Identify.cs +++ b/Aaru.Images/CloneCD/Identify.cs @@ -38,7 +38,7 @@ using Aaru.Console; namespace Aaru.DiscImages { - public partial class CloneCd + public sealed partial class CloneCd { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/CloneCD/Properties.cs b/Aaru.Images/CloneCD/Properties.cs index 45791b240..69b3b7567 100644 --- a/Aaru.Images/CloneCD/Properties.cs +++ b/Aaru.Images/CloneCD/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class CloneCd + public sealed partial class CloneCd { public OpticalImageCapabilities OpticalCapabilities => OpticalImageCapabilities.CanStoreAudioTracks | OpticalImageCapabilities.CanStoreDataTracks | diff --git a/Aaru.Images/CloneCD/Read.cs b/Aaru.Images/CloneCD/Read.cs index c70ee7b01..b65e497a8 100644 --- a/Aaru.Images/CloneCD/Read.cs +++ b/Aaru.Images/CloneCD/Read.cs @@ -46,7 +46,7 @@ using Session = Aaru.CommonTypes.Structs.Session; namespace Aaru.DiscImages { - public partial class CloneCd + public sealed partial class CloneCd { public bool Open(IFilter imageFilter) { @@ -515,31 +515,30 @@ namespace Aaru.DiscImages ulong currentDataOffset = 0; ulong currentSubchannelOffset = 0; - for(int i = 0; i < tmpTracks.Length; i++) + foreach(Track tmpTrack in tmpTracks) { - tmpTracks[i].TrackFileOffset = currentDataOffset; + tmpTrack.TrackFileOffset = currentDataOffset; - currentDataOffset += 2352 * ((tmpTracks[i].TrackEndSector - tmpTracks[i].TrackStartSector) + 1); + currentDataOffset += 2352 * ((tmpTrack.TrackEndSector - tmpTrack.TrackStartSector) + 1); if(_subFilter != null) { - tmpTracks[i].TrackSubchannelOffset = currentSubchannelOffset; + tmpTrack.TrackSubchannelOffset = currentSubchannelOffset; - currentSubchannelOffset += - 96 * ((tmpTracks[i].TrackEndSector - tmpTracks[i].TrackStartSector) + 1); + currentSubchannelOffset += 96 * ((tmpTrack.TrackEndSector - tmpTrack.TrackStartSector) + 1); } - if(tmpTracks[i].TrackType == TrackType.Data) + if(tmpTrack.TrackType == TrackType.Data) { for(int s = 0; s < 750; s++) { byte[] syncTest = new byte[12]; byte[] sectTest = new byte[2352]; - long pos = (long)tmpTracks[i].TrackFileOffset + (s * 2352); + long pos = (long)tmpTrack.TrackFileOffset + (s * 2352); if(pos >= _dataStream.Length + 2352 || - s >= (int)(tmpTracks[i].TrackEndSector - tmpTracks[i].TrackStartSector)) + s >= (int)(tmpTrack.TrackEndSector - tmpTrack.TrackStartSector)) break; _dataStream.Seek(pos, SeekOrigin.Begin); @@ -554,8 +553,8 @@ namespace Aaru.DiscImages if(sectTest[15] == 1) { - tmpTracks[i].TrackBytesPerSector = 2048; - tmpTracks[i].TrackType = TrackType.CdMode1; + tmpTrack.TrackBytesPerSector = 2048; + tmpTrack.TrackType = TrackType.CdMode1; if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync)) _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync); @@ -581,85 +580,85 @@ namespace Aaru.DiscImages break; } - if(sectTest[15] == 2) - { - byte[] subHdr1 = new byte[4]; - byte[] subHdr2 = new byte[4]; - byte[] empHdr = new byte[4]; + if(sectTest[15] != 2) + continue; - Array.Copy(sectTest, 16, subHdr1, 0, 4); - Array.Copy(sectTest, 20, subHdr2, 0, 4); + byte[] subHdr1 = new byte[4]; + byte[] subHdr2 = new byte[4]; + byte[] empHdr = new byte[4]; - if(subHdr1.SequenceEqual(subHdr2) && - !empHdr.SequenceEqual(subHdr1)) - if((subHdr1[2] & 0x20) == 0x20) - { - tmpTracks[i].TrackBytesPerSector = 2324; - tmpTracks[i].TrackType = TrackType.CdMode2Form2; + Array.Copy(sectTest, 16, subHdr1, 0, 4); + Array.Copy(sectTest, 20, subHdr2, 0, 4); - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync); + if(subHdr1.SequenceEqual(subHdr2) && + !empHdr.SequenceEqual(subHdr1)) + if((subHdr1[2] & 0x20) == 0x20) + { + tmpTrack.TrackBytesPerSector = 2324; + tmpTrack.TrackType = TrackType.CdMode2Form2; - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader); + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync); - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSubHeader)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSubHeader); + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader); - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEdc)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc); + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSubHeader)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSubHeader); - if(_imageInfo.SectorSize < 2324) - _imageInfo.SectorSize = 2324; + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEdc)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc); - break; - } - else - { - tmpTracks[i].TrackBytesPerSector = 2048; - tmpTracks[i].TrackType = TrackType.CdMode2Form1; + if(_imageInfo.SectorSize < 2324) + _imageInfo.SectorSize = 2324; - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync); + break; + } + else + { + tmpTrack.TrackBytesPerSector = 2048; + tmpTrack.TrackType = TrackType.CdMode2Form1; - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader); + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync); - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSubHeader)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSubHeader); + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader); - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEcc)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEcc); + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSubHeader)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSubHeader); - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEccP)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEccP); + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEcc)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEcc); - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEccQ)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEccQ); + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEccP)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEccP); - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEdc)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc); + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEccQ)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEccQ); - if(_imageInfo.SectorSize < 2048) - _imageInfo.SectorSize = 2048; + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEdc)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc); - break; - } + if(_imageInfo.SectorSize < 2048) + _imageInfo.SectorSize = 2048; - tmpTracks[i].TrackBytesPerSector = 2336; - tmpTracks[i].TrackType = TrackType.CdMode2Formless; + break; + } - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync); + tmpTrack.TrackBytesPerSector = 2336; + tmpTrack.TrackType = TrackType.CdMode2Formless; - if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader)) - _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader); + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync); - if(_imageInfo.SectorSize < 2336) - _imageInfo.SectorSize = 2336; + if(!_imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader)) + _imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader); - break; - } + if(_imageInfo.SectorSize < 2336) + _imageInfo.SectorSize = 2336; + + break; } } else diff --git a/Aaru.Images/CloneCD/Verify.cs b/Aaru.Images/CloneCD/Verify.cs index 505ee6087..21b3acc5e 100644 --- a/Aaru.Images/CloneCD/Verify.cs +++ b/Aaru.Images/CloneCD/Verify.cs @@ -36,7 +36,7 @@ using Aaru.Checksums; namespace Aaru.DiscImages { - public partial class CloneCd + public sealed partial class CloneCd { public bool? VerifySector(ulong sectorAddress) { diff --git a/Aaru.Images/CloneCD/Write.cs b/Aaru.Images/CloneCD/Write.cs index 92f5aa874..f2c1f8eac 100644 --- a/Aaru.Images/CloneCD/Write.cs +++ b/Aaru.Images/CloneCD/Write.cs @@ -45,14 +45,14 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType; namespace Aaru.DiscImages { - public partial class CloneCd + public sealed partial class CloneCd { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) { if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } @@ -66,7 +66,9 @@ namespace Aaru.DiscImages try { - _writingBaseName = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)); + _writingBaseName = + Path.Combine(Path.GetDirectoryName(path) ?? "", Path.GetFileNameWithoutExtension(path)); + _descriptorStream = new StreamWriter(path, false, Encoding.ASCII); _dataStream = new FileStream(_writingBaseName + ".img", FileMode.OpenOrCreate, FileAccess.ReadWrite, @@ -239,8 +241,8 @@ namespace Aaru.DiscImages { Track firstSessionTrack = tracks.FirstOrDefault(t => t.TrackSession == newTrack.TrackSession); - if(firstSessionTrack.TrackSequence == newTrack.TrackSequence && - newTrack.TrackPregap >= 150) + if(firstSessionTrack?.TrackSequence == newTrack.TrackSequence && + newTrack.TrackPregap >= 150) { newTrack.TrackPregap -= 150; newTrack.TrackStartSector += 150; @@ -393,8 +395,8 @@ namespace Aaru.DiscImages sessionEndingTrack.TryGetValue(currentSession, out byte endingTrackNumber); (byte minute, byte second, byte frame) leadinPmsf = - LbaToMsf(Tracks.FirstOrDefault(t => t.TrackSequence == endingTrackNumber).TrackEndSector + - 1); + LbaToMsf(Tracks.FirstOrDefault(t => t.TrackSequence == endingTrackNumber)?.TrackEndSector ?? + 0 + 1); // Starting track trackDescriptors.Add(new FullTOC.TrackDataDescriptor @@ -468,7 +470,7 @@ namespace Aaru.DiscImages Track firstSessionTrack = Tracks.FirstOrDefault(t => t.TrackSession == i); - switch(firstSessionTrack.TrackType) + switch(firstSessionTrack?.TrackType) { case TrackType.Audio: // CloneCD always writes this value for first track in disc, however the Rainbow Books diff --git a/Aaru.Images/CopyQM/Constants.cs b/Aaru.Images/CopyQM/Constants.cs index 0bdb74509..a1d73d224 100644 --- a/Aaru.Images/CopyQM/Constants.cs +++ b/Aaru.Images/CopyQM/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class CopyQm + public sealed partial class CopyQm { const ushort COPYQM_MAGIC = 0x5143; const byte COPYQM_MARK = 0x14; diff --git a/Aaru.Images/CopyQM/CopyQM.cs b/Aaru.Images/CopyQM/CopyQM.cs index 94a1b5d1c..927d3b20f 100644 --- a/Aaru.Images/CopyQM/CopyQM.cs +++ b/Aaru.Images/CopyQM/CopyQM.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class CopyQm : IMediaImage, IVerifiableImage + public sealed partial class CopyQm : IMediaImage, IVerifiableImage { uint _calculatedDataCrc; byte[] _decodedDisk; diff --git a/Aaru.Images/CopyQM/Identify.cs b/Aaru.Images/CopyQM/Identify.cs index 0b98ec088..9aa978ebd 100644 --- a/Aaru.Images/CopyQM/Identify.cs +++ b/Aaru.Images/CopyQM/Identify.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class CopyQm + public sealed partial class CopyQm { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/CopyQM/Properties.cs b/Aaru.Images/CopyQM/Properties.cs index 7d2f95d63..6475ae4e4 100644 --- a/Aaru.Images/CopyQM/Properties.cs +++ b/Aaru.Images/CopyQM/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class CopyQm + public sealed partial class CopyQm { public ImageInfo Info => _imageInfo; public string Name => "Sydex CopyQM"; diff --git a/Aaru.Images/CopyQM/Read.cs b/Aaru.Images/CopyQM/Read.cs index 8548b8813..8d7fe20af 100644 --- a/Aaru.Images/CopyQM/Read.cs +++ b/Aaru.Images/CopyQM/Read.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class CopyQm + public sealed partial class CopyQm { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/CopyQM/Structs.cs b/Aaru.Images/CopyQM/Structs.cs index ece54b264..76f203e9f 100644 --- a/Aaru.Images/CopyQM/Structs.cs +++ b/Aaru.Images/CopyQM/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class CopyQm + public sealed partial class CopyQm { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CopyQmHeader diff --git a/Aaru.Images/CopyQM/Unsupported.cs b/Aaru.Images/CopyQM/Unsupported.cs index 514c884f6..7ee12d26e 100644 --- a/Aaru.Images/CopyQM/Unsupported.cs +++ b/Aaru.Images/CopyQM/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class CopyQm + public sealed partial class CopyQm { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/CopyTape/Constants.cs b/Aaru.Images/CopyTape/Constants.cs index 5f9740739..f1f7bd39c 100644 --- a/Aaru.Images/CopyTape/Constants.cs +++ b/Aaru.Images/CopyTape/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class CopyTape + public sealed partial class CopyTape { const string _blockRegex = @"^CPTP:BLK (?\d{6})\n$"; const string _partialBlockRegex = @"^CPTP:BLK $"; diff --git a/Aaru.Images/CopyTape/CopyTape.cs b/Aaru.Images/CopyTape/CopyTape.cs index 9385c3ab2..79bcbd110 100644 --- a/Aaru.Images/CopyTape/CopyTape.cs +++ b/Aaru.Images/CopyTape/CopyTape.cs @@ -6,7 +6,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class CopyTape : IWritableTapeImage + public sealed partial class CopyTape : IWritableTapeImage { long[] _blockPositionCache; ImageInfo _imageInfo; diff --git a/Aaru.Images/CopyTape/Identify.cs b/Aaru.Images/CopyTape/Identify.cs index c1277804c..8d0425244 100644 --- a/Aaru.Images/CopyTape/Identify.cs +++ b/Aaru.Images/CopyTape/Identify.cs @@ -37,7 +37,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class CopyTape + public sealed partial class CopyTape { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/CopyTape/Properties.cs b/Aaru.Images/CopyTape/Properties.cs index b2e1d0247..caca0a6ac 100644 --- a/Aaru.Images/CopyTape/Properties.cs +++ b/Aaru.Images/CopyTape/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class CopyTape + public sealed partial class CopyTape { public ImageInfo Info => _imageInfo; public string Name => "CopyTape"; diff --git a/Aaru.Images/CopyTape/Read.cs b/Aaru.Images/CopyTape/Read.cs index fc3b0ad67..f87164f21 100644 --- a/Aaru.Images/CopyTape/Read.cs +++ b/Aaru.Images/CopyTape/Read.cs @@ -42,7 +42,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class CopyTape + public sealed partial class CopyTape { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/CopyTape/Unsupported.cs b/Aaru.Images/CopyTape/Unsupported.cs index b4576fe6e..19e2ef3b7 100644 --- a/Aaru.Images/CopyTape/Unsupported.cs +++ b/Aaru.Images/CopyTape/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class CopyTape + public sealed partial class CopyTape { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/CopyTape/Write.cs b/Aaru.Images/CopyTape/Write.cs index c8b206475..ec22fc7b9 100644 --- a/Aaru.Images/CopyTape/Write.cs +++ b/Aaru.Images/CopyTape/Write.cs @@ -41,7 +41,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class CopyTape + public sealed partial class CopyTape { FileStream _dataStream; ulong _lastWrittenBlock; @@ -52,7 +52,7 @@ namespace Aaru.DiscImages { if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/D88/Constants.cs b/Aaru.Images/D88/Constants.cs index a15543aea..9b5f2fb59 100644 --- a/Aaru.Images/D88/Constants.cs +++ b/Aaru.Images/D88/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class D88 + public sealed partial class D88 { const byte READ_ONLY = 0x10; readonly byte[] _reservedEmpty = diff --git a/Aaru.Images/D88/D88.cs b/Aaru.Images/D88/D88.cs index fe0fa3a0a..d229e8794 100644 --- a/Aaru.Images/D88/D88.cs +++ b/Aaru.Images/D88/D88.cs @@ -40,7 +40,7 @@ namespace Aaru.DiscImages // Information from Quasi88's FORMAT.TXT file // Japanese comments copied from there // TODO: Solve media types - public partial class D88 : IMediaImage + public sealed partial class D88 : IMediaImage { ImageInfo _imageInfo; List _sectorsData; diff --git a/Aaru.Images/D88/Enums.cs b/Aaru.Images/D88/Enums.cs index 6f07a6e0e..3eabc5a64 100644 --- a/Aaru.Images/D88/Enums.cs +++ b/Aaru.Images/D88/Enums.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local"), SuppressMessage("ReSharper", "UnusedType.Local")] - public partial class D88 + public sealed partial class D88 { enum DiskType : byte { diff --git a/Aaru.Images/D88/Identify.cs b/Aaru.Images/D88/Identify.cs index 6ea6c404a..4e4c94298 100644 --- a/Aaru.Images/D88/Identify.cs +++ b/Aaru.Images/D88/Identify.cs @@ -39,7 +39,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class D88 + public sealed partial class D88 { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/D88/Properties.cs b/Aaru.Images/D88/Properties.cs index 72ca95b37..a9da70972 100644 --- a/Aaru.Images/D88/Properties.cs +++ b/Aaru.Images/D88/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class D88 + public sealed partial class D88 { public string Name => "D88 Disk Image"; public Guid Id => new Guid("669EDC77-EC41-4720-A88C-49C38CFFBAA0"); diff --git a/Aaru.Images/D88/Read.cs b/Aaru.Images/D88/Read.cs index bc7f583fb..248c68eef 100644 --- a/Aaru.Images/D88/Read.cs +++ b/Aaru.Images/D88/Read.cs @@ -44,7 +44,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class D88 + public sealed partial class D88 { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/D88/Structs.cs b/Aaru.Images/D88/Structs.cs index efbea3b26..1d0ba7d5c 100644 --- a/Aaru.Images/D88/Structs.cs +++ b/Aaru.Images/D88/Structs.cs @@ -35,7 +35,7 @@ using Aaru.Decoders.Floppy; namespace Aaru.DiscImages { - public partial class D88 + public sealed partial class D88 { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct D88Header diff --git a/Aaru.Images/D88/Unsupported.cs b/Aaru.Images/D88/Unsupported.cs index b4d9214af..f8c251699 100644 --- a/Aaru.Images/D88/Unsupported.cs +++ b/Aaru.Images/D88/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class D88 + public sealed partial class D88 { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/DART/Constants.cs b/Aaru.Images/DART/Constants.cs index 78185470a..c6bd41ded 100644 --- a/Aaru.Images/DART/Constants.cs +++ b/Aaru.Images/DART/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Dart + public sealed partial class Dart { // Disk types const byte DISK_MAC = 1; diff --git a/Aaru.Images/DART/DART.cs b/Aaru.Images/DART/DART.cs index 49c97f5d6..633a9df85 100644 --- a/Aaru.Images/DART/DART.cs +++ b/Aaru.Images/DART/DART.cs @@ -37,7 +37,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Dart : IMediaImage + public sealed partial class Dart : IMediaImage { // DART images are at most 1474560 bytes, so let's cache the whole byte[] _dataCache; diff --git a/Aaru.Images/DART/Identify.cs b/Aaru.Images/DART/Identify.cs index f46c74608..1cf0a26ae 100644 --- a/Aaru.Images/DART/Identify.cs +++ b/Aaru.Images/DART/Identify.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Dart + public sealed partial class Dart { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/DART/Properties.cs b/Aaru.Images/DART/Properties.cs index 4cc22afef..7bde2cf9b 100644 --- a/Aaru.Images/DART/Properties.cs +++ b/Aaru.Images/DART/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Dart + public sealed partial class Dart { public string Name => "Apple Disk Archival/Retrieval Tool"; public Guid Id => new Guid("B3E06BF8-F98D-4F9B-BBE2-342C373BAF3E"); diff --git a/Aaru.Images/DART/Read.cs b/Aaru.Images/DART/Read.cs index 6c235abe6..a03d7c3cf 100644 --- a/Aaru.Images/DART/Read.cs +++ b/Aaru.Images/DART/Read.cs @@ -46,7 +46,7 @@ using Version = Resources.Version; namespace Aaru.DiscImages { - public partial class Dart + public sealed partial class Dart { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/DART/Structs.cs b/Aaru.Images/DART/Structs.cs index b4c38aa09..5fa8bba3d 100644 --- a/Aaru.Images/DART/Structs.cs +++ b/Aaru.Images/DART/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Dart + public sealed partial class Dart { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DartHeader diff --git a/Aaru.Images/DART/Unsupported.cs b/Aaru.Images/DART/Unsupported.cs index 6d11a0957..d36cc2fa7 100644 --- a/Aaru.Images/DART/Unsupported.cs +++ b/Aaru.Images/DART/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Dart + public sealed partial class Dart { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/DIM/Constants.cs b/Aaru.Images/DIM/Constants.cs index b8ec6c461..065e720ce 100644 --- a/Aaru.Images/DIM/Constants.cs +++ b/Aaru.Images/DIM/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Dim + public sealed partial class Dim { /// Start of data sectors in disk image, should be 0x100 const uint DATA_OFFSET = 0x100; diff --git a/Aaru.Images/DIM/DIM.cs b/Aaru.Images/DIM/DIM.cs index 41ab0ac81..f9233840d 100644 --- a/Aaru.Images/DIM/DIM.cs +++ b/Aaru.Images/DIM/DIM.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { // TODO: What are the real supported floppies for this image format? - public partial class Dim : IMediaImage + public sealed partial class Dim : IMediaImage { byte[] _comment; IFilter _dimImageFilter; diff --git a/Aaru.Images/DIM/Enums.cs b/Aaru.Images/DIM/Enums.cs index 9b350fe40..ffad23968 100644 --- a/Aaru.Images/DIM/Enums.cs +++ b/Aaru.Images/DIM/Enums.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Dim + public sealed partial class Dim { enum DiskType : byte { diff --git a/Aaru.Images/DIM/Identify.cs b/Aaru.Images/DIM/Identify.cs index b047a5f18..9dd42fd9a 100644 --- a/Aaru.Images/DIM/Identify.cs +++ b/Aaru.Images/DIM/Identify.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class Dim + public sealed partial class Dim { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/DIM/Properties.cs b/Aaru.Images/DIM/Properties.cs index eaf27742b..1fabbf89a 100644 --- a/Aaru.Images/DIM/Properties.cs +++ b/Aaru.Images/DIM/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Dim + public sealed partial class Dim { public List Partitions => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/DIM/Read.cs b/Aaru.Images/DIM/Read.cs index f9c575a7f..973d2fd29 100644 --- a/Aaru.Images/DIM/Read.cs +++ b/Aaru.Images/DIM/Read.cs @@ -42,7 +42,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Dim + public sealed partial class Dim { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/DIM/Unsupported.cs b/Aaru.Images/DIM/Unsupported.cs index 38327cb59..07635ce43 100644 --- a/Aaru.Images/DIM/Unsupported.cs +++ b/Aaru.Images/DIM/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Dim + public sealed partial class Dim { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/DiscFerret/Constants.cs b/Aaru.Images/DiscFerret/Constants.cs index e431464dd..bc6c83259 100644 --- a/Aaru.Images/DiscFerret/Constants.cs +++ b/Aaru.Images/DiscFerret/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class DiscFerret + public sealed partial class DiscFerret { /// "DFER" const uint DFI_MAGIC = 0x52454644; diff --git a/Aaru.Images/DiscFerret/DiscFerret.cs b/Aaru.Images/DiscFerret/DiscFerret.cs index 855b6d4b3..ca11597a6 100644 --- a/Aaru.Images/DiscFerret/DiscFerret.cs +++ b/Aaru.Images/DiscFerret/DiscFerret.cs @@ -37,7 +37,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class DiscFerret : IMediaImage, IVerifiableSectorsImage + public sealed partial class DiscFerret : IMediaImage, IVerifiableSectorsImage { ImageInfo _imageInfo; diff --git a/Aaru.Images/DiscFerret/Identify.cs b/Aaru.Images/DiscFerret/Identify.cs index fa82aff42..fb61a39e4 100644 --- a/Aaru.Images/DiscFerret/Identify.cs +++ b/Aaru.Images/DiscFerret/Identify.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class DiscFerret + public sealed partial class DiscFerret { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/DiscFerret/Properties.cs b/Aaru.Images/DiscFerret/Properties.cs index 14513e48b..2a6f7aa4f 100644 --- a/Aaru.Images/DiscFerret/Properties.cs +++ b/Aaru.Images/DiscFerret/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class DiscFerret + public sealed partial class DiscFerret { public string Name => "DiscFerret"; public Guid Id => new Guid("70EA7B9B-5323-42EB-9B40-8DDA37C5EB4D"); diff --git a/Aaru.Images/DiscFerret/Read.cs b/Aaru.Images/DiscFerret/Read.cs index 53d52e248..74b5cf2b2 100644 --- a/Aaru.Images/DiscFerret/Read.cs +++ b/Aaru.Images/DiscFerret/Read.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class DiscFerret + public sealed partial class DiscFerret { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/DiscFerret/Structs.cs b/Aaru.Images/DiscFerret/Structs.cs index cc78621f5..aafca3e30 100644 --- a/Aaru.Images/DiscFerret/Structs.cs +++ b/Aaru.Images/DiscFerret/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class DiscFerret + public sealed partial class DiscFerret { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DfiBlockHeader diff --git a/Aaru.Images/DiscFerret/Verify.cs b/Aaru.Images/DiscFerret/Verify.cs index 9dff31d22..f13b96ce2 100644 --- a/Aaru.Images/DiscFerret/Verify.cs +++ b/Aaru.Images/DiscFerret/Verify.cs @@ -35,7 +35,7 @@ using System.Collections.Generic; namespace Aaru.DiscImages { - public partial class DiscFerret + public sealed partial class DiscFerret { public bool? VerifySector(ulong sectorAddress) => throw new NotImplementedException("Flux decoding is not yet implemented."); diff --git a/Aaru.Images/DiscJuggler/DiscJuggler.cs b/Aaru.Images/DiscJuggler/DiscJuggler.cs index ddbddf318..e38396a96 100644 --- a/Aaru.Images/DiscJuggler/DiscJuggler.cs +++ b/Aaru.Images/DiscJuggler/DiscJuggler.cs @@ -41,7 +41,7 @@ namespace Aaru.DiscImages { // Support separate data files? Never seen a DiscJuggler image using them anyways... // TODO: Too many unknowns to make this writable - public partial class DiscJuggler : IOpticalMediaImage + public sealed partial class DiscJuggler : IOpticalMediaImage { byte[] _cdtext; ImageInfo _imageInfo; diff --git a/Aaru.Images/DiscJuggler/Helpers.cs b/Aaru.Images/DiscJuggler/Helpers.cs index 3b1872f11..51ff75c24 100644 --- a/Aaru.Images/DiscJuggler/Helpers.cs +++ b/Aaru.Images/DiscJuggler/Helpers.cs @@ -34,7 +34,7 @@ using Aaru.CommonTypes; namespace Aaru.DiscImages { - public partial class DiscJuggler + public sealed partial class DiscJuggler { static MediaType DecodeCdiMediumType(ushort type) { diff --git a/Aaru.Images/DiscJuggler/Identify.cs b/Aaru.Images/DiscJuggler/Identify.cs index 30aff1a88..3a34b6b09 100644 --- a/Aaru.Images/DiscJuggler/Identify.cs +++ b/Aaru.Images/DiscJuggler/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Console; namespace Aaru.DiscImages { - public partial class DiscJuggler + public sealed partial class DiscJuggler { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/DiscJuggler/Properties.cs b/Aaru.Images/DiscJuggler/Properties.cs index 93acc0436..ebb25b116 100644 --- a/Aaru.Images/DiscJuggler/Properties.cs +++ b/Aaru.Images/DiscJuggler/Properties.cs @@ -38,7 +38,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class DiscJuggler + public sealed partial class DiscJuggler { public string Name => "DiscJuggler"; public Guid Id => new Guid("2444DBC6-CD35-424C-A227-39B0C4DB01B2"); diff --git a/Aaru.Images/DiscJuggler/Read.cs b/Aaru.Images/DiscJuggler/Read.cs index 4d53d2068..6334f4234 100644 --- a/Aaru.Images/DiscJuggler/Read.cs +++ b/Aaru.Images/DiscJuggler/Read.cs @@ -47,7 +47,7 @@ using Session = Aaru.CommonTypes.Structs.Session; namespace Aaru.DiscImages { - public partial class DiscJuggler + public sealed partial class DiscJuggler { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/DiscJuggler/Verify.cs b/Aaru.Images/DiscJuggler/Verify.cs index 64dcb0307..6e0d2af2b 100644 --- a/Aaru.Images/DiscJuggler/Verify.cs +++ b/Aaru.Images/DiscJuggler/Verify.cs @@ -36,7 +36,7 @@ using Aaru.Checksums; namespace Aaru.DiscImages { - public partial class DiscJuggler + public sealed partial class DiscJuggler { public bool? VerifySector(ulong sectorAddress) { diff --git a/Aaru.Images/DiskCopy42/Constants.cs b/Aaru.Images/DiskCopy42/Constants.cs index 91e8b9112..67ad56d43 100644 --- a/Aaru.Images/DiskCopy42/Constants.cs +++ b/Aaru.Images/DiskCopy42/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class DiskCopy42 + public sealed partial class DiskCopy42 { // format byte /// 3.5", single side, double density, GCR diff --git a/Aaru.Images/DiskCopy42/DiskCopy42.cs b/Aaru.Images/DiskCopy42/DiskCopy42.cs index 36276d0d4..b99074f69 100644 --- a/Aaru.Images/DiskCopy42/DiskCopy42.cs +++ b/Aaru.Images/DiskCopy42/DiskCopy42.cs @@ -41,7 +41,7 @@ namespace Aaru.DiscImages { // Checked using several images and strings inside Apple's DiskImages.framework [SuppressMessage("ReSharper", "InconsistentNaming")] - public partial class DiskCopy42 : IWritableImage, IVerifiableImage + public sealed partial class DiskCopy42 : IWritableImage, IVerifiableImage { /// Bytes per tag, should be 12 uint bptag; diff --git a/Aaru.Images/DiskCopy42/Helpers.cs b/Aaru.Images/DiskCopy42/Helpers.cs index c3847725c..b0e14cb71 100644 --- a/Aaru.Images/DiskCopy42/Helpers.cs +++ b/Aaru.Images/DiskCopy42/Helpers.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class DiskCopy42 + public sealed partial class DiskCopy42 { static uint DC42CheckSum(byte[] buffer) { diff --git a/Aaru.Images/DiskCopy42/Identify.cs b/Aaru.Images/DiskCopy42/Identify.cs index 8e91efd51..495e6ffb0 100644 --- a/Aaru.Images/DiskCopy42/Identify.cs +++ b/Aaru.Images/DiskCopy42/Identify.cs @@ -39,7 +39,7 @@ using Claunia.Encoding; namespace Aaru.DiscImages { - public partial class DiskCopy42 + public sealed partial class DiskCopy42 { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/DiskCopy42/Properties.cs b/Aaru.Images/DiskCopy42/Properties.cs index 89e4e1ead..8e8765495 100644 --- a/Aaru.Images/DiskCopy42/Properties.cs +++ b/Aaru.Images/DiskCopy42/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class DiskCopy42 + public sealed partial class DiskCopy42 { public ImageInfo Info => imageInfo; public string Name => "Apple DiskCopy 4.2"; diff --git a/Aaru.Images/DiskCopy42/Read.cs b/Aaru.Images/DiskCopy42/Read.cs index 11a6ec52d..3256c3ac5 100644 --- a/Aaru.Images/DiskCopy42/Read.cs +++ b/Aaru.Images/DiskCopy42/Read.cs @@ -45,7 +45,7 @@ using Version = Resources.Version; namespace Aaru.DiscImages { - public partial class DiskCopy42 + public sealed partial class DiskCopy42 { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/DiskCopy42/Structs.cs b/Aaru.Images/DiskCopy42/Structs.cs index 200f65eed..ba463fe68 100644 --- a/Aaru.Images/DiskCopy42/Structs.cs +++ b/Aaru.Images/DiskCopy42/Structs.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class DiskCopy42 + public sealed partial class DiskCopy42 { // DiskCopy 4.2 header, big-endian, data-fork, start of file, 84 bytes struct Dc42Header diff --git a/Aaru.Images/DiskCopy42/Unsupported.cs b/Aaru.Images/DiskCopy42/Unsupported.cs index 6586b93f7..769da95a6 100644 --- a/Aaru.Images/DiskCopy42/Unsupported.cs +++ b/Aaru.Images/DiskCopy42/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class DiskCopy42 + public sealed partial class DiskCopy42 { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/DiskCopy42/Verify.cs b/Aaru.Images/DiskCopy42/Verify.cs index 59759e010..25da042d6 100644 --- a/Aaru.Images/DiskCopy42/Verify.cs +++ b/Aaru.Images/DiskCopy42/Verify.cs @@ -35,7 +35,7 @@ using Aaru.Console; namespace Aaru.DiscImages { - public partial class DiskCopy42 + public sealed partial class DiskCopy42 { public bool? VerifyMediaImage() { diff --git a/Aaru.Images/DiskCopy42/Write.cs b/Aaru.Images/DiskCopy42/Write.cs index 16fe8cd08..d9dc103ef 100644 --- a/Aaru.Images/DiskCopy42/Write.cs +++ b/Aaru.Images/DiskCopy42/Write.cs @@ -41,7 +41,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class DiskCopy42 + public sealed partial class DiskCopy42 { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -175,7 +175,7 @@ namespace Aaru.DiscImages break; default: - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/DriDiskCopy/Constants.cs b/Aaru.Images/DriDiskCopy/Constants.cs index c536a68c2..9d30e7aec 100644 --- a/Aaru.Images/DriDiskCopy/Constants.cs +++ b/Aaru.Images/DriDiskCopy/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class DriDiskCopy + public sealed partial class DriDiskCopy { const string REGEX_DRI = @"DiskImage\s(?\d+.\d+)\s\(C\)\s\d+\,*\d*\s+Digital Research Inc"; } diff --git a/Aaru.Images/DriDiskCopy/DriDiskCopy.cs b/Aaru.Images/DriDiskCopy/DriDiskCopy.cs index f5d7fa3a9..fe762d393 100644 --- a/Aaru.Images/DriDiskCopy/DriDiskCopy.cs +++ b/Aaru.Images/DriDiskCopy/DriDiskCopy.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class DriDiskCopy : IWritableImage + public sealed partial class DriDiskCopy : IWritableImage { /// Disk image file IFilter _driImageFilter; diff --git a/Aaru.Images/DriDiskCopy/Enums.cs b/Aaru.Images/DriDiskCopy/Enums.cs index db4fcbf8f..798f1540a 100644 --- a/Aaru.Images/DriDiskCopy/Enums.cs +++ b/Aaru.Images/DriDiskCopy/Enums.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class DriDiskCopy + public sealed partial class DriDiskCopy { /// Drive codes change according to CMOS stored valued [SuppressMessage("ReSharper", "InconsistentNaming")] diff --git a/Aaru.Images/DriDiskCopy/Identify.cs b/Aaru.Images/DriDiskCopy/Identify.cs index 236c94a88..f0e6e0087 100644 --- a/Aaru.Images/DriDiskCopy/Identify.cs +++ b/Aaru.Images/DriDiskCopy/Identify.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class DriDiskCopy + public sealed partial class DriDiskCopy { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/DriDiskCopy/Properties.cs b/Aaru.Images/DriDiskCopy/Properties.cs index 51b08dc1a..0661e267a 100644 --- a/Aaru.Images/DriDiskCopy/Properties.cs +++ b/Aaru.Images/DriDiskCopy/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class DriDiskCopy + public sealed partial class DriDiskCopy { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/DriDiskCopy/Read.cs b/Aaru.Images/DriDiskCopy/Read.cs index 757927c65..6ed1e6a2b 100644 --- a/Aaru.Images/DriDiskCopy/Read.cs +++ b/Aaru.Images/DriDiskCopy/Read.cs @@ -41,7 +41,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class DriDiskCopy + public sealed partial class DriDiskCopy { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/DriDiskCopy/Structs.cs b/Aaru.Images/DriDiskCopy/Structs.cs index c864c9ed3..c9e8d1b5c 100644 --- a/Aaru.Images/DriDiskCopy/Structs.cs +++ b/Aaru.Images/DriDiskCopy/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class DriDiskCopy + public sealed partial class DriDiskCopy { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DriFooter diff --git a/Aaru.Images/DriDiskCopy/Unsupported.cs b/Aaru.Images/DriDiskCopy/Unsupported.cs index 11918689f..14a04f8cf 100644 --- a/Aaru.Images/DriDiskCopy/Unsupported.cs +++ b/Aaru.Images/DriDiskCopy/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class DriDiskCopy + public sealed partial class DriDiskCopy { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/DriDiskCopy/Write.cs b/Aaru.Images/DriDiskCopy/Write.cs index 5d58b50c3..ad3682f0f 100644 --- a/Aaru.Images/DriDiskCopy/Write.cs +++ b/Aaru.Images/DriDiskCopy/Write.cs @@ -43,7 +43,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class DriDiskCopy + public sealed partial class DriDiskCopy { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -64,7 +64,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/GDI/Constants.cs b/Aaru.Images/GDI/Constants.cs index 47379adee..be67d10f6 100644 --- a/Aaru.Images/GDI/Constants.cs +++ b/Aaru.Images/GDI/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Gdi + public sealed partial class Gdi { const string REGEX_TRACK = @"\s?(?\d+)\s+(?\d+)\s(?\d)\s(?2352|2048)\s(?.+)\s(?\d+)$"; diff --git a/Aaru.Images/GDI/GDI.cs b/Aaru.Images/GDI/GDI.cs index a7fb05aba..dfa7627ae 100644 --- a/Aaru.Images/GDI/GDI.cs +++ b/Aaru.Images/GDI/GDI.cs @@ -41,7 +41,7 @@ namespace Aaru.DiscImages { // TODO: There seems no be no clear definition on how to treat pregaps that are not included in the file, so this is just appending it to start of track // TODO: This format doesn't support to specify pregaps that are included in the file (like Redump ones) - public partial class Gdi : IOpticalMediaImage + public sealed partial class Gdi : IOpticalMediaImage { ulong _densitySeparationSectors; GdiDisc _discimage; diff --git a/Aaru.Images/GDI/Identify.cs b/Aaru.Images/GDI/Identify.cs index ccf4ae874..f2ffc57c1 100644 --- a/Aaru.Images/GDI/Identify.cs +++ b/Aaru.Images/GDI/Identify.cs @@ -38,7 +38,7 @@ using Aaru.Console; namespace Aaru.DiscImages { - public partial class Gdi + public sealed partial class Gdi { // Due to .gdi format, this method must parse whole file, ignoring errors (those will be thrown by OpenImage()). public bool Identify(IFilter imageFilter) diff --git a/Aaru.Images/GDI/Properties.cs b/Aaru.Images/GDI/Properties.cs index 5d3f50660..b4fc6c35f 100644 --- a/Aaru.Images/GDI/Properties.cs +++ b/Aaru.Images/GDI/Properties.cs @@ -40,7 +40,7 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType; namespace Aaru.DiscImages { - public partial class Gdi + public sealed partial class Gdi { public string Name => "Dreamcast GDI image"; public Guid Id => new Guid("281ECBF2-D2A7-414C-8497-1A33F6DCB2DD"); diff --git a/Aaru.Images/GDI/Read.cs b/Aaru.Images/GDI/Read.cs index b63881c18..6b73df71c 100644 --- a/Aaru.Images/GDI/Read.cs +++ b/Aaru.Images/GDI/Read.cs @@ -46,7 +46,7 @@ using Session = Aaru.CommonTypes.Structs.Session; namespace Aaru.DiscImages { - public partial class Gdi + public sealed partial class Gdi { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/GDI/Structs.cs b/Aaru.Images/GDI/Structs.cs index d2f3af335..f62a651ac 100644 --- a/Aaru.Images/GDI/Structs.cs +++ b/Aaru.Images/GDI/Structs.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Gdi + public sealed partial class Gdi { struct GdiTrack { diff --git a/Aaru.Images/GDI/Unsupported.cs b/Aaru.Images/GDI/Unsupported.cs index 44deb94c8..744f0fd38 100644 --- a/Aaru.Images/GDI/Unsupported.cs +++ b/Aaru.Images/GDI/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Gdi + public sealed partial class Gdi { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/GDI/Verify.cs b/Aaru.Images/GDI/Verify.cs index ea8027abb..b136dd579 100644 --- a/Aaru.Images/GDI/Verify.cs +++ b/Aaru.Images/GDI/Verify.cs @@ -36,7 +36,7 @@ using Aaru.Checksums; namespace Aaru.DiscImages { - public partial class Gdi + public sealed partial class Gdi { public bool? VerifySector(ulong sectorAddress) { diff --git a/Aaru.Images/HDCopy/HDCopy.cs b/Aaru.Images/HDCopy/HDCopy.cs index 58fbf74eb..103d2c2ca 100644 --- a/Aaru.Images/HDCopy/HDCopy.cs +++ b/Aaru.Images/HDCopy/HDCopy.cs @@ -72,7 +72,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class HdCopy : IMediaImage + public sealed partial class HdCopy : IMediaImage { /// Every track that has been read is cached here readonly Dictionary _trackCache = new Dictionary(); diff --git a/Aaru.Images/HDCopy/Helpers.cs b/Aaru.Images/HDCopy/Helpers.cs index ac9084e14..94dd2c1ce 100644 --- a/Aaru.Images/HDCopy/Helpers.cs +++ b/Aaru.Images/HDCopy/Helpers.cs @@ -36,7 +36,7 @@ using System.IO; namespace Aaru.DiscImages { - public partial class HdCopy + public sealed partial class HdCopy { void ReadTrackIntoCache(Stream stream, int tracknum) { diff --git a/Aaru.Images/HDCopy/Identify.cs b/Aaru.Images/HDCopy/Identify.cs index 556b31f8d..0b44a0b48 100644 --- a/Aaru.Images/HDCopy/Identify.cs +++ b/Aaru.Images/HDCopy/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class HdCopy + public sealed partial class HdCopy { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/HDCopy/Properties.cs b/Aaru.Images/HDCopy/Properties.cs index a28538ec9..eac751285 100644 --- a/Aaru.Images/HDCopy/Properties.cs +++ b/Aaru.Images/HDCopy/Properties.cs @@ -38,7 +38,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class HdCopy + public sealed partial class HdCopy { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/HDCopy/Read.cs b/Aaru.Images/HDCopy/Read.cs index 5156e453b..65c983f73 100644 --- a/Aaru.Images/HDCopy/Read.cs +++ b/Aaru.Images/HDCopy/Read.cs @@ -41,7 +41,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class HdCopy + public sealed partial class HdCopy { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/HDCopy/Structs.cs b/Aaru.Images/HDCopy/Structs.cs index 36829738f..7013b3aff 100644 --- a/Aaru.Images/HDCopy/Structs.cs +++ b/Aaru.Images/HDCopy/Structs.cs @@ -37,7 +37,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedType.Local")] - public partial class HdCopy + public sealed partial class HdCopy { /// The global header of a HDCP image file [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Images/HDCopy/Unsupported.cs b/Aaru.Images/HDCopy/Unsupported.cs index 2eaf7e071..5767a96c1 100644 --- a/Aaru.Images/HDCopy/Unsupported.cs +++ b/Aaru.Images/HDCopy/Unsupported.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class HdCopy + public sealed partial class HdCopy { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/IMD/Constants.cs b/Aaru.Images/IMD/Constants.cs index 5f638f5a6..2b10cb3e6 100644 --- a/Aaru.Images/IMD/Constants.cs +++ b/Aaru.Images/IMD/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Imd + public sealed partial class Imd { const byte SECTOR_CYLINDER_MAP_MASK = 0x80; const byte SECTOR_HEAD_MAP_MASK = 0x40; diff --git a/Aaru.Images/IMD/Enums.cs b/Aaru.Images/IMD/Enums.cs index 4f08186f5..66dd00100 100644 --- a/Aaru.Images/IMD/Enums.cs +++ b/Aaru.Images/IMD/Enums.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Imd + public sealed partial class Imd { enum TransferRate : byte { diff --git a/Aaru.Images/IMD/IMD.cs b/Aaru.Images/IMD/IMD.cs index 6cf7f7d78..5cd571e77 100644 --- a/Aaru.Images/IMD/IMD.cs +++ b/Aaru.Images/IMD/IMD.cs @@ -37,7 +37,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Imd : IMediaImage + public sealed partial class Imd : IMediaImage { ImageInfo _imageInfo; List _sectorsData; diff --git a/Aaru.Images/IMD/Identify.cs b/Aaru.Images/IMD/Identify.cs index 893479acd..c8135ed3f 100644 --- a/Aaru.Images/IMD/Identify.cs +++ b/Aaru.Images/IMD/Identify.cs @@ -37,7 +37,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class Imd + public sealed partial class Imd { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/IMD/Properties.cs b/Aaru.Images/IMD/Properties.cs index bfc04ffbb..c63e73417 100644 --- a/Aaru.Images/IMD/Properties.cs +++ b/Aaru.Images/IMD/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Imd + public sealed partial class Imd { public string Name => "Dunfield's IMD"; public Guid Id => new Guid("0D67162E-38A3-407D-9B1A-CF40080A48CB"); diff --git a/Aaru.Images/IMD/Read.cs b/Aaru.Images/IMD/Read.cs index 1dc267470..ae930e252 100644 --- a/Aaru.Images/IMD/Read.cs +++ b/Aaru.Images/IMD/Read.cs @@ -42,7 +42,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Imd + public sealed partial class Imd { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/IMD/Unsupported.cs b/Aaru.Images/IMD/Unsupported.cs index 3dd5fa015..2bf82714f 100644 --- a/Aaru.Images/IMD/Unsupported.cs +++ b/Aaru.Images/IMD/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Imd + public sealed partial class Imd { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/KryoFlux/Constants.cs b/Aaru.Images/KryoFlux/Constants.cs index 518d50e1a..8bfa97ff0 100644 --- a/Aaru.Images/KryoFlux/Constants.cs +++ b/Aaru.Images/KryoFlux/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class KryoFlux + public sealed partial class KryoFlux { const string _hostDate = "host_date"; const string _hostTime = "host_time"; diff --git a/Aaru.Images/KryoFlux/Enums.cs b/Aaru.Images/KryoFlux/Enums.cs index 6ca0a7d8b..9438f02e0 100644 --- a/Aaru.Images/KryoFlux/Enums.cs +++ b/Aaru.Images/KryoFlux/Enums.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class KryoFlux + public sealed partial class KryoFlux { enum BlockIds : byte { diff --git a/Aaru.Images/KryoFlux/Identify.cs b/Aaru.Images/KryoFlux/Identify.cs index fa021cf9d..44b439ea1 100644 --- a/Aaru.Images/KryoFlux/Identify.cs +++ b/Aaru.Images/KryoFlux/Identify.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class KryoFlux + public sealed partial class KryoFlux { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/KryoFlux/KryoFlux.cs b/Aaru.Images/KryoFlux/KryoFlux.cs index 7fee14197..956adc39f 100644 --- a/Aaru.Images/KryoFlux/KryoFlux.cs +++ b/Aaru.Images/KryoFlux/KryoFlux.cs @@ -39,7 +39,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "InconsistentNaming")] - public partial class KryoFlux : IMediaImage, IVerifiableSectorsImage + public sealed partial class KryoFlux : IMediaImage, IVerifiableSectorsImage { // TODO: These variables have been made public so create-sidecar can access to this information until I define an API >4.0 public SortedDictionary tracks; diff --git a/Aaru.Images/KryoFlux/Properties.cs b/Aaru.Images/KryoFlux/Properties.cs index 203a32f15..feefe9187 100644 --- a/Aaru.Images/KryoFlux/Properties.cs +++ b/Aaru.Images/KryoFlux/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class KryoFlux + public sealed partial class KryoFlux { public ImageInfo imageInfo; public ImageInfo Info => imageInfo; diff --git a/Aaru.Images/KryoFlux/Read.cs b/Aaru.Images/KryoFlux/Read.cs index fedca15ba..d18a2e428 100644 --- a/Aaru.Images/KryoFlux/Read.cs +++ b/Aaru.Images/KryoFlux/Read.cs @@ -43,7 +43,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class KryoFlux + public sealed partial class KryoFlux { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/KryoFlux/Structs.cs b/Aaru.Images/KryoFlux/Structs.cs index 22233eff0..13e03b80b 100644 --- a/Aaru.Images/KryoFlux/Structs.cs +++ b/Aaru.Images/KryoFlux/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class KryoFlux + public sealed partial class KryoFlux { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct OobBlock diff --git a/Aaru.Images/KryoFlux/Verify.cs b/Aaru.Images/KryoFlux/Verify.cs index 2ee78680e..647b7da6f 100644 --- a/Aaru.Images/KryoFlux/Verify.cs +++ b/Aaru.Images/KryoFlux/Verify.cs @@ -35,7 +35,7 @@ using System.Collections.Generic; namespace Aaru.DiscImages { - public partial class KryoFlux + public sealed partial class KryoFlux { public bool? VerifySector(ulong sectorAddress) => throw new NotImplementedException("Flux decoding is not yet implemented."); diff --git a/Aaru.Images/MaxiDisk/Enums.cs b/Aaru.Images/MaxiDisk/Enums.cs index 08dca214d..19151f6cb 100644 --- a/Aaru.Images/MaxiDisk/Enums.cs +++ b/Aaru.Images/MaxiDisk/Enums.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class MaxiDisk + public sealed partial class MaxiDisk { enum HdkDiskTypes : byte { diff --git a/Aaru.Images/MaxiDisk/Identify.cs b/Aaru.Images/MaxiDisk/Identify.cs index 9e7464d12..b1d744755 100644 --- a/Aaru.Images/MaxiDisk/Identify.cs +++ b/Aaru.Images/MaxiDisk/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class MaxiDisk + public sealed partial class MaxiDisk { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/MaxiDisk/MaxiDisk.cs b/Aaru.Images/MaxiDisk/MaxiDisk.cs index 9ef19308f..f8d16a445 100644 --- a/Aaru.Images/MaxiDisk/MaxiDisk.cs +++ b/Aaru.Images/MaxiDisk/MaxiDisk.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class MaxiDisk : IWritableImage + public sealed partial class MaxiDisk : IWritableImage { /// Disk image file IFilter _hdkImageFilter; diff --git a/Aaru.Images/MaxiDisk/Properties.cs b/Aaru.Images/MaxiDisk/Properties.cs index fedabbf14..3a038080a 100644 --- a/Aaru.Images/MaxiDisk/Properties.cs +++ b/Aaru.Images/MaxiDisk/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class MaxiDisk + public sealed partial class MaxiDisk { public ImageInfo Info => _imageInfo; public string Author => "Natalia Portillo"; diff --git a/Aaru.Images/MaxiDisk/Read.cs b/Aaru.Images/MaxiDisk/Read.cs index 3bf53787f..02da81dbb 100644 --- a/Aaru.Images/MaxiDisk/Read.cs +++ b/Aaru.Images/MaxiDisk/Read.cs @@ -39,7 +39,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class MaxiDisk + public sealed partial class MaxiDisk { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/MaxiDisk/Structs.cs b/Aaru.Images/MaxiDisk/Structs.cs index 25ceaa5df..815f526b0 100644 --- a/Aaru.Images/MaxiDisk/Structs.cs +++ b/Aaru.Images/MaxiDisk/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class MaxiDisk + public sealed partial class MaxiDisk { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct HdkHeader diff --git a/Aaru.Images/MaxiDisk/Unsupported.cs b/Aaru.Images/MaxiDisk/Unsupported.cs index 4da50a933..937084686 100644 --- a/Aaru.Images/MaxiDisk/Unsupported.cs +++ b/Aaru.Images/MaxiDisk/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class MaxiDisk + public sealed partial class MaxiDisk { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/MaxiDisk/Write.cs b/Aaru.Images/MaxiDisk/Write.cs index 8af85dc30..13a88be2b 100644 --- a/Aaru.Images/MaxiDisk/Write.cs +++ b/Aaru.Images/MaxiDisk/Write.cs @@ -42,7 +42,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class MaxiDisk + public sealed partial class MaxiDisk { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -64,7 +64,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/NDIF/Constants.cs b/Aaru.Images/NDIF/Constants.cs index 064e51ef8..8965928f6 100644 --- a/Aaru.Images/NDIF/Constants.cs +++ b/Aaru.Images/NDIF/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Ndif + public sealed partial class Ndif { /// Resource OSType for NDIF is "bcem" const uint NDIF_RESOURCE = 0x6263656D; diff --git a/Aaru.Images/NDIF/Identify.cs b/Aaru.Images/NDIF/Identify.cs index 84a5a4e3a..83193a3ab 100644 --- a/Aaru.Images/NDIF/Identify.cs +++ b/Aaru.Images/NDIF/Identify.cs @@ -36,7 +36,7 @@ using Claunia.RsrcFork; namespace Aaru.DiscImages { - public partial class Ndif + public sealed partial class Ndif { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/NDIF/NDIF.cs b/Aaru.Images/NDIF/NDIF.cs index 36a28579e..b1c8475cd 100644 --- a/Aaru.Images/NDIF/NDIF.cs +++ b/Aaru.Images/NDIF/NDIF.cs @@ -42,7 +42,7 @@ namespace Aaru.DiscImages // TODO: Check checksum // TODO: Implement segments // TODO: Implement compression - public partial class Ndif : IMediaImage + public sealed partial class Ndif : IMediaImage { uint _buffersize; Dictionary _chunkCache; diff --git a/Aaru.Images/NDIF/Properties.cs b/Aaru.Images/NDIF/Properties.cs index c737f0d63..cd5588f3a 100644 --- a/Aaru.Images/NDIF/Properties.cs +++ b/Aaru.Images/NDIF/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Ndif + public sealed partial class Ndif { public ImageInfo Info => _imageInfo; public string Name => "Apple New Disk Image Format"; diff --git a/Aaru.Images/NDIF/Read.cs b/Aaru.Images/NDIF/Read.cs index 3e5687fd5..5214353b7 100644 --- a/Aaru.Images/NDIF/Read.cs +++ b/Aaru.Images/NDIF/Read.cs @@ -48,7 +48,7 @@ using Version = Resources.Version; namespace Aaru.DiscImages { - public partial class Ndif + public sealed partial class Ndif { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/NDIF/Structs.cs b/Aaru.Images/NDIF/Structs.cs index 684ba1854..c6e855bab 100644 --- a/Aaru.Images/NDIF/Structs.cs +++ b/Aaru.Images/NDIF/Structs.cs @@ -37,7 +37,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedType.Local")] - public partial class Ndif + public sealed partial class Ndif { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ChunkHeader diff --git a/Aaru.Images/NDIF/Unsupported.cs b/Aaru.Images/NDIF/Unsupported.cs index 79f088477..2f47b46ec 100644 --- a/Aaru.Images/NDIF/Unsupported.cs +++ b/Aaru.Images/NDIF/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Ndif + public sealed partial class Ndif { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/NHDr0/Constants.cs b/Aaru.Images/NHDr0/Constants.cs index 14ae04606..00d4b45f9 100644 --- a/Aaru.Images/NHDr0/Constants.cs +++ b/Aaru.Images/NHDr0/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Nhdr0 + public sealed partial class Nhdr0 { readonly byte[] _signature = { diff --git a/Aaru.Images/NHDr0/Identify.cs b/Aaru.Images/NHDr0/Identify.cs index 2b109a74e..385ffbc3a 100644 --- a/Aaru.Images/NHDr0/Identify.cs +++ b/Aaru.Images/NHDr0/Identify.cs @@ -39,7 +39,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Nhdr0 + public sealed partial class Nhdr0 { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/NHDr0/NHDr0.cs b/Aaru.Images/NHDr0/NHDr0.cs index 4ac1f8d80..07cc3f80a 100644 --- a/Aaru.Images/NHDr0/NHDr0.cs +++ b/Aaru.Images/NHDr0/NHDr0.cs @@ -39,7 +39,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { // Info from http://www.geocities.jp/t98next/nhdr0.txt - public partial class Nhdr0 : IWritableImage + public sealed partial class Nhdr0 : IWritableImage { ImageInfo _imageInfo; Nhdr0Header _nhdhdr; diff --git a/Aaru.Images/NHDr0/Properties.cs b/Aaru.Images/NHDr0/Properties.cs index 6da800773..b67038904 100644 --- a/Aaru.Images/NHDr0/Properties.cs +++ b/Aaru.Images/NHDr0/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Nhdr0 + public sealed partial class Nhdr0 { public string Name => "T98-Next NHD r0 Disk Image"; public Guid Id => new Guid("6ECACD0A-8F4D-4465-8815-AEA000D370E3"); diff --git a/Aaru.Images/NHDr0/Read.cs b/Aaru.Images/NHDr0/Read.cs index c0e4b8724..ef9ab477d 100644 --- a/Aaru.Images/NHDr0/Read.cs +++ b/Aaru.Images/NHDr0/Read.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Nhdr0 + public sealed partial class Nhdr0 { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/NHDr0/Structs.cs b/Aaru.Images/NHDr0/Structs.cs index 81e4fdb85..be454dd64 100644 --- a/Aaru.Images/NHDr0/Structs.cs +++ b/Aaru.Images/NHDr0/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Nhdr0 + public sealed partial class Nhdr0 { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Nhdr0Header diff --git a/Aaru.Images/NHDr0/Unsupported.cs b/Aaru.Images/NHDr0/Unsupported.cs index f91257fc7..4c63567bb 100644 --- a/Aaru.Images/NHDr0/Unsupported.cs +++ b/Aaru.Images/NHDr0/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Nhdr0 + public sealed partial class Nhdr0 { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/NHDr0/Write.cs b/Aaru.Images/NHDr0/Write.cs index cca2b271e..71e67625f 100644 --- a/Aaru.Images/NHDr0/Write.cs +++ b/Aaru.Images/NHDr0/Write.cs @@ -43,7 +43,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Nhdr0 + public sealed partial class Nhdr0 { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -57,7 +57,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/Nero/Constants.cs b/Aaru.Images/Nero/Constants.cs index e95efd3aa..80834d98b 100644 --- a/Aaru.Images/Nero/Constants.cs +++ b/Aaru.Images/Nero/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Nero + public sealed partial class Nero { const uint NERO_FOOTER_V1 = 0x4E45524F; // "NERO" const uint NERO_FOOTER_V2 = 0x4E455235; // "NER5" diff --git a/Aaru.Images/Nero/Enums.cs b/Aaru.Images/Nero/Enums.cs index 47f6e2023..9621d4a47 100644 --- a/Aaru.Images/Nero/Enums.cs +++ b/Aaru.Images/Nero/Enums.cs @@ -36,7 +36,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Nero + public sealed partial class Nero { enum DaoMode : ushort { diff --git a/Aaru.Images/Nero/Helpers.cs b/Aaru.Images/Nero/Helpers.cs index f18cc76d8..7cbb99c94 100644 --- a/Aaru.Images/Nero/Helpers.cs +++ b/Aaru.Images/Nero/Helpers.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Enums; namespace Aaru.DiscImages { - public partial class Nero + public sealed partial class Nero { static MediaType NeroMediaTypeToMediaType(NeroMediaTypes type) { diff --git a/Aaru.Images/Nero/Identify.cs b/Aaru.Images/Nero/Identify.cs index 163612ae4..13b2046e0 100644 --- a/Aaru.Images/Nero/Identify.cs +++ b/Aaru.Images/Nero/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Nero + public sealed partial class Nero { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/Nero/Nero.cs b/Aaru.Images/Nero/Nero.cs index 23d1a226b..f3f571168 100644 --- a/Aaru.Images/Nero/Nero.cs +++ b/Aaru.Images/Nero/Nero.cs @@ -47,7 +47,7 @@ namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "NotAccessedField.Local"), SuppressMessage("ReSharper", "CollectionNeverQueried.Local")] - public partial class Nero : IOpticalMediaImage + public sealed partial class Nero : IOpticalMediaImage { bool _imageNewFormat; Stream _imageStream; diff --git a/Aaru.Images/Nero/Properties.cs b/Aaru.Images/Nero/Properties.cs index 62b5b3fe9..02cde7178 100644 --- a/Aaru.Images/Nero/Properties.cs +++ b/Aaru.Images/Nero/Properties.cs @@ -38,7 +38,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Nero + public sealed partial class Nero { public ImageInfo Info => _imageInfo; public string Name => "Nero Burning ROM image"; diff --git a/Aaru.Images/Nero/Read.cs b/Aaru.Images/Nero/Read.cs index 0ee34d457..0ee0d64b2 100644 --- a/Aaru.Images/Nero/Read.cs +++ b/Aaru.Images/Nero/Read.cs @@ -47,7 +47,7 @@ using Session = Aaru.CommonTypes.Structs.Session; namespace Aaru.DiscImages { - public partial class Nero + public sealed partial class Nero { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/Nero/Structs.cs b/Aaru.Images/Nero/Structs.cs index f2284db99..c9accf24e 100644 --- a/Aaru.Images/Nero/Structs.cs +++ b/Aaru.Images/Nero/Structs.cs @@ -38,7 +38,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedType.Local")] - public partial class Nero + public sealed partial class Nero { struct NeroV1Footer { diff --git a/Aaru.Images/Nero/Verify.cs b/Aaru.Images/Nero/Verify.cs index b94def1c8..ad60695c5 100644 --- a/Aaru.Images/Nero/Verify.cs +++ b/Aaru.Images/Nero/Verify.cs @@ -36,7 +36,7 @@ using Aaru.Checksums; namespace Aaru.DiscImages { - public partial class Nero + public sealed partial class Nero { public bool? VerifySector(ulong sectorAddress) { diff --git a/Aaru.Images/Parallels/Constants.cs b/Aaru.Images/Parallels/Constants.cs index 83cca54e0..bfb21cabd 100644 --- a/Aaru.Images/Parallels/Constants.cs +++ b/Aaru.Images/Parallels/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Parallels + public sealed partial class Parallels { const uint PARALLELS_VERSION = 2; const uint PARALLELS_INUSE = 0x746F6E59; diff --git a/Aaru.Images/Parallels/Identify.cs b/Aaru.Images/Parallels/Identify.cs index c36543e01..83d7647f8 100644 --- a/Aaru.Images/Parallels/Identify.cs +++ b/Aaru.Images/Parallels/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Parallels + public sealed partial class Parallels { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/Parallels/Parallels.cs b/Aaru.Images/Parallels/Parallels.cs index eecaffae8..2eb3ef81f 100644 --- a/Aaru.Images/Parallels/Parallels.cs +++ b/Aaru.Images/Parallels/Parallels.cs @@ -40,7 +40,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Parallels : IWritableImage + public sealed partial class Parallels : IWritableImage { uint[] _bat; uint _clusterBytes; diff --git a/Aaru.Images/Parallels/Properties.cs b/Aaru.Images/Parallels/Properties.cs index 8b0eb73b3..f804a5f18 100644 --- a/Aaru.Images/Parallels/Properties.cs +++ b/Aaru.Images/Parallels/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Parallels + public sealed partial class Parallels { public string Name => "Parallels disk image"; public Guid Id => new Guid("E314DE35-C103-48A3-AD36-990F68523C46"); diff --git a/Aaru.Images/Parallels/Read.cs b/Aaru.Images/Parallels/Read.cs index 043b4eb61..bfa4e3912 100644 --- a/Aaru.Images/Parallels/Read.cs +++ b/Aaru.Images/Parallels/Read.cs @@ -42,7 +42,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Parallels + public sealed partial class Parallels { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/Parallels/Structs.cs b/Aaru.Images/Parallels/Structs.cs index 2350e3b5c..b2b092b51 100644 --- a/Aaru.Images/Parallels/Structs.cs +++ b/Aaru.Images/Parallels/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Parallels + public sealed partial class Parallels { /// Parallels disk image header, little-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -49,7 +49,7 @@ namespace Aaru.DiscImages public uint heads; /// Disk geometry parameter public uint cylinders; - /// Cluser size in sectors + /// Cluster size in sectors public uint cluster_size; /// Entries in BAT (clusters in image) public uint bat_entries; diff --git a/Aaru.Images/Parallels/Unsupported.cs b/Aaru.Images/Parallels/Unsupported.cs index 367551e7e..06494c428 100644 --- a/Aaru.Images/Parallels/Unsupported.cs +++ b/Aaru.Images/Parallels/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Parallels + public sealed partial class Parallels { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/Parallels/Write.cs b/Aaru.Images/Parallels/Write.cs index cee38cdb0..13b2afaeb 100644 --- a/Aaru.Images/Parallels/Write.cs +++ b/Aaru.Images/Parallels/Write.cs @@ -42,7 +42,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Parallels + public sealed partial class Parallels { // TODO: Support extended public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, @@ -57,7 +57,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/PartClone/Constants.cs b/Aaru.Images/PartClone/Constants.cs index 8cda4bf1f..7d9cad211 100644 --- a/Aaru.Images/PartClone/Constants.cs +++ b/Aaru.Images/PartClone/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class PartClone + public sealed partial class PartClone { const int CRC_SIZE = 4; const uint MAX_CACHE_SIZE = 16777216; diff --git a/Aaru.Images/PartClone/Helpers.cs b/Aaru.Images/PartClone/Helpers.cs index 8efbcd763..63438ba3e 100644 --- a/Aaru.Images/PartClone/Helpers.cs +++ b/Aaru.Images/PartClone/Helpers.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class PartClone + public sealed partial class PartClone { ulong BlockOffset(ulong sectorAddress) { diff --git a/Aaru.Images/PartClone/Identify.cs b/Aaru.Images/PartClone/Identify.cs index 7508fbc0f..b54acf945 100644 --- a/Aaru.Images/PartClone/Identify.cs +++ b/Aaru.Images/PartClone/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class PartClone + public sealed partial class PartClone { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/PartClone/PartClone.cs b/Aaru.Images/PartClone/PartClone.cs index d8780bf14..6d393af39 100644 --- a/Aaru.Images/PartClone/PartClone.cs +++ b/Aaru.Images/PartClone/PartClone.cs @@ -39,7 +39,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class PartClone : IMediaImage, IVerifiableImage + public sealed partial class PartClone : IMediaImage, IVerifiableImage { // The used block "bitmap" uses one byte per block // TODO: Convert on-image bytemap to on-memory bitmap diff --git a/Aaru.Images/PartClone/Properties.cs b/Aaru.Images/PartClone/Properties.cs index c1c94f4e0..6680c9c09 100644 --- a/Aaru.Images/PartClone/Properties.cs +++ b/Aaru.Images/PartClone/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class PartClone + public sealed partial class PartClone { public string Name => "PartClone disk image"; public Guid Id => new Guid("AB1D7518-B548-4099-A4E2-C29C53DDE0C3"); diff --git a/Aaru.Images/PartClone/Read.cs b/Aaru.Images/PartClone/Read.cs index af772a852..7f2181e03 100644 --- a/Aaru.Images/PartClone/Read.cs +++ b/Aaru.Images/PartClone/Read.cs @@ -44,7 +44,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class PartClone + public sealed partial class PartClone { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/PartClone/Structs.cs b/Aaru.Images/PartClone/Structs.cs index 413d520d9..54e7c7eaa 100644 --- a/Aaru.Images/PartClone/Structs.cs +++ b/Aaru.Images/PartClone/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class PartClone + public sealed partial class PartClone { /// PartClone disk image header, little-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Images/PartClone/Unsupported.cs b/Aaru.Images/PartClone/Unsupported.cs index 45a839197..1df9f4ffb 100644 --- a/Aaru.Images/PartClone/Unsupported.cs +++ b/Aaru.Images/PartClone/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class PartClone + public sealed partial class PartClone { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/PartClone/Verify.cs b/Aaru.Images/PartClone/Verify.cs index 400863acd..d36ce9c10 100644 --- a/Aaru.Images/PartClone/Verify.cs +++ b/Aaru.Images/PartClone/Verify.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class PartClone + public sealed partial class PartClone { // TODO: All blocks contain a CRC32 that's incompatible with current implementation. Need to check for compatibility. public bool? VerifyMediaImage() => null; diff --git a/Aaru.Images/Partimage/Constants.cs b/Aaru.Images/Partimage/Constants.cs index 3d191fb3e..2f8324a97 100644 --- a/Aaru.Images/Partimage/Constants.cs +++ b/Aaru.Images/Partimage/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Partimage + public sealed partial class Partimage { const int MAX_DESCRIPTION = 4096; const int MAX_HOSTNAMESIZE = 128; diff --git a/Aaru.Images/Partimage/Enums.cs b/Aaru.Images/Partimage/Enums.cs index d4e4f811e..7d76ab473 100644 --- a/Aaru.Images/Partimage/Enums.cs +++ b/Aaru.Images/Partimage/Enums.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Partimage + public sealed partial class Partimage { enum PCompression : uint { diff --git a/Aaru.Images/Partimage/Helpers.cs b/Aaru.Images/Partimage/Helpers.cs index dad208341..24338f2cd 100644 --- a/Aaru.Images/Partimage/Helpers.cs +++ b/Aaru.Images/Partimage/Helpers.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Partimage + public sealed partial class Partimage { ulong BlockOffset(ulong sectorAddress) { diff --git a/Aaru.Images/Partimage/Identify.cs b/Aaru.Images/Partimage/Identify.cs index 19bc0c263..4768feb72 100644 --- a/Aaru.Images/Partimage/Identify.cs +++ b/Aaru.Images/Partimage/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Partimage + public sealed partial class Partimage { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/Partimage/Partimage.cs b/Aaru.Images/Partimage/Partimage.cs index 0b66cffe6..374e942a3 100644 --- a/Aaru.Images/Partimage/Partimage.cs +++ b/Aaru.Images/Partimage/Partimage.cs @@ -41,7 +41,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Partimage : IMediaImage, IVerifiableImage + public sealed partial class Partimage : IMediaImage, IVerifiableImage { byte[] _bitmap; PartimageMainHeader _cMainHeader; diff --git a/Aaru.Images/Partimage/Properties.cs b/Aaru.Images/Partimage/Properties.cs index 131bf9405..2676f21d0 100644 --- a/Aaru.Images/Partimage/Properties.cs +++ b/Aaru.Images/Partimage/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Partimage + public sealed partial class Partimage { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/Partimage/Read.cs b/Aaru.Images/Partimage/Read.cs index e427212ce..e2225ab89 100644 --- a/Aaru.Images/Partimage/Read.cs +++ b/Aaru.Images/Partimage/Read.cs @@ -43,7 +43,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Partimage + public sealed partial class Partimage { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/Partimage/Structs.cs b/Aaru.Images/Partimage/Structs.cs index 4cb4c5594..7e64860d6 100644 --- a/Aaru.Images/Partimage/Structs.cs +++ b/Aaru.Images/Partimage/Structs.cs @@ -36,7 +36,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedType.Local")] - public partial class Partimage + public sealed partial class Partimage { /// Partimage disk image header, little-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Images/Partimage/Unsupported.cs b/Aaru.Images/Partimage/Unsupported.cs index 3848b0261..37bae96ae 100644 --- a/Aaru.Images/Partimage/Unsupported.cs +++ b/Aaru.Images/Partimage/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Partimage + public sealed partial class Partimage { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/Partimage/Verify.cs b/Aaru.Images/Partimage/Verify.cs index bba1a8a6e..65e822a2c 100644 --- a/Aaru.Images/Partimage/Verify.cs +++ b/Aaru.Images/Partimage/Verify.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Partimage + public sealed partial class Partimage { // TODO: All blocks contain a CRC32 that's incompatible with current implementation. Need to check for compatibility. public bool? VerifyMediaImage() => null; diff --git a/Aaru.Images/QCOW/Constants.cs b/Aaru.Images/QCOW/Constants.cs index dc9e8166a..94ebf19fb 100644 --- a/Aaru.Images/QCOW/Constants.cs +++ b/Aaru.Images/QCOW/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Qcow + public sealed partial class Qcow { /// Magic number: 'Q', 'F', 'I', 0xFB const uint QCOW_MAGIC = 0x514649FB; diff --git a/Aaru.Images/QCOW/Identify.cs b/Aaru.Images/QCOW/Identify.cs index d4aa9cfa2..223864eba 100644 --- a/Aaru.Images/QCOW/Identify.cs +++ b/Aaru.Images/QCOW/Identify.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Qcow + public sealed partial class Qcow { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/QCOW/Properties.cs b/Aaru.Images/QCOW/Properties.cs index 4d34bc2a7..16edac3fd 100644 --- a/Aaru.Images/QCOW/Properties.cs +++ b/Aaru.Images/QCOW/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Qcow + public sealed partial class Qcow { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/QCOW/QCOW.cs b/Aaru.Images/QCOW/QCOW.cs index 9d2d0b642..75c447599 100644 --- a/Aaru.Images/QCOW/QCOW.cs +++ b/Aaru.Images/QCOW/QCOW.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Qcow : IWritableImage + public sealed partial class Qcow : IWritableImage { Dictionary _clusterCache; int _clusterSectors; diff --git a/Aaru.Images/QCOW/Read.cs b/Aaru.Images/QCOW/Read.cs index 8a96dbef6..6d7aa7a59 100644 --- a/Aaru.Images/QCOW/Read.cs +++ b/Aaru.Images/QCOW/Read.cs @@ -45,7 +45,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.DiscImages { - public partial class Qcow + public sealed partial class Qcow { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/QCOW/Structs.cs b/Aaru.Images/QCOW/Structs.cs index 265da617b..80f99ef24 100644 --- a/Aaru.Images/QCOW/Structs.cs +++ b/Aaru.Images/QCOW/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Qcow + public sealed partial class Qcow { /// QCOW header, big-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Images/QCOW/Unsupported.cs b/Aaru.Images/QCOW/Unsupported.cs index 9a473c1fc..c084031bc 100644 --- a/Aaru.Images/QCOW/Unsupported.cs +++ b/Aaru.Images/QCOW/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Qcow + public sealed partial class Qcow { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/QCOW/Write.cs b/Aaru.Images/QCOW/Write.cs index 1d411cfc0..24e80a6e1 100644 --- a/Aaru.Images/QCOW/Write.cs +++ b/Aaru.Images/QCOW/Write.cs @@ -44,7 +44,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.DiscImages { - public partial class Qcow + public sealed partial class Qcow { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -58,7 +58,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/QCOW2/Constants.cs b/Aaru.Images/QCOW2/Constants.cs index 848c0763c..01b4bc701 100644 --- a/Aaru.Images/QCOW2/Constants.cs +++ b/Aaru.Images/QCOW2/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Qcow2 + public sealed partial class Qcow2 { /// Magic number: 'Q', 'F', 'I', 0xFB const uint QCOW_MAGIC = 0x514649FB; diff --git a/Aaru.Images/QCOW2/Identify.cs b/Aaru.Images/QCOW2/Identify.cs index 435bb2771..a1d32450d 100644 --- a/Aaru.Images/QCOW2/Identify.cs +++ b/Aaru.Images/QCOW2/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Qcow2 + public sealed partial class Qcow2 { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/QCOW2/Properties.cs b/Aaru.Images/QCOW2/Properties.cs index e0ade9669..705ead7a9 100644 --- a/Aaru.Images/QCOW2/Properties.cs +++ b/Aaru.Images/QCOW2/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Qcow2 + public sealed partial class Qcow2 { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/QCOW2/QCOW2.cs b/Aaru.Images/QCOW2/QCOW2.cs index 0682dc2c6..edcc9768c 100644 --- a/Aaru.Images/QCOW2/QCOW2.cs +++ b/Aaru.Images/QCOW2/QCOW2.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Qcow2 : IWritableImage + public sealed partial class Qcow2 : IWritableImage { Dictionary _clusterCache; int _clusterSectors; diff --git a/Aaru.Images/QCOW2/Read.cs b/Aaru.Images/QCOW2/Read.cs index dcd7ac4e2..8cdfc1b79 100644 --- a/Aaru.Images/QCOW2/Read.cs +++ b/Aaru.Images/QCOW2/Read.cs @@ -46,7 +46,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.DiscImages { - public partial class Qcow2 + public sealed partial class Qcow2 { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/QCOW2/Structs.cs b/Aaru.Images/QCOW2/Structs.cs index 7e868e5de..ce5a473da 100644 --- a/Aaru.Images/QCOW2/Structs.cs +++ b/Aaru.Images/QCOW2/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Qcow2 + public sealed partial class Qcow2 { /// QCOW header, big-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Images/QCOW2/Unsupported.cs b/Aaru.Images/QCOW2/Unsupported.cs index 83c6454b4..26206f167 100644 --- a/Aaru.Images/QCOW2/Unsupported.cs +++ b/Aaru.Images/QCOW2/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Qcow2 + public sealed partial class Qcow2 { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/QCOW2/Write.cs b/Aaru.Images/QCOW2/Write.cs index a89a91447..1e48b4c9a 100644 --- a/Aaru.Images/QCOW2/Write.cs +++ b/Aaru.Images/QCOW2/Write.cs @@ -44,7 +44,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.DiscImages { - public partial class Qcow2 + public sealed partial class Qcow2 { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -58,7 +58,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/QED/Constants.cs b/Aaru.Images/QED/Constants.cs index fb86d7ca7..901cc5e0c 100644 --- a/Aaru.Images/QED/Constants.cs +++ b/Aaru.Images/QED/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Qed + public sealed partial class Qed { /// Magic number: 'Q', 'E', 'D', 0x00 const uint QED_MAGIC = 0x00444551; diff --git a/Aaru.Images/QED/Helpers.cs b/Aaru.Images/QED/Helpers.cs index 1e53110df..e018e0270 100644 --- a/Aaru.Images/QED/Helpers.cs +++ b/Aaru.Images/QED/Helpers.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Qed + public sealed partial class Qed { static bool IsPowerOfTwo(uint x) { diff --git a/Aaru.Images/QED/Identify.cs b/Aaru.Images/QED/Identify.cs index cc26ccd73..217c057d5 100644 --- a/Aaru.Images/QED/Identify.cs +++ b/Aaru.Images/QED/Identify.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Qed + public sealed partial class Qed { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/QED/Properties.cs b/Aaru.Images/QED/Properties.cs index e368f06e2..104f8ba29 100644 --- a/Aaru.Images/QED/Properties.cs +++ b/Aaru.Images/QED/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Qed + public sealed partial class Qed { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/QED/QED.cs b/Aaru.Images/QED/QED.cs index e9ccf1457..998261cca 100644 --- a/Aaru.Images/QED/QED.cs +++ b/Aaru.Images/QED/QED.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Qed : IWritableImage + public sealed partial class Qed : IWritableImage { int _clusterBits; Dictionary _clusterCache; diff --git a/Aaru.Images/QED/Read.cs b/Aaru.Images/QED/Read.cs index c99a95c4b..ce7201b11 100644 --- a/Aaru.Images/QED/Read.cs +++ b/Aaru.Images/QED/Read.cs @@ -42,7 +42,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.DiscImages { - public partial class Qed + public sealed partial class Qed { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/QED/Structs.cs b/Aaru.Images/QED/Structs.cs index b71269a00..93f5c7d58 100644 --- a/Aaru.Images/QED/Structs.cs +++ b/Aaru.Images/QED/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Qed + public sealed partial class Qed { /// QED header, big-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Images/QED/Unsupported.cs b/Aaru.Images/QED/Unsupported.cs index ee6420a7b..c6bf1dafa 100644 --- a/Aaru.Images/QED/Unsupported.cs +++ b/Aaru.Images/QED/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Qed + public sealed partial class Qed { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/QED/Write.cs b/Aaru.Images/QED/Write.cs index fbab600aa..b00f2b9db 100644 --- a/Aaru.Images/QED/Write.cs +++ b/Aaru.Images/QED/Write.cs @@ -44,7 +44,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.DiscImages { - public partial class Qed + public sealed partial class Qed { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -58,7 +58,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/RayDIM/Constants.cs b/Aaru.Images/RayDIM/Constants.cs index b98a3fb1f..b246ea3e9 100644 --- a/Aaru.Images/RayDIM/Constants.cs +++ b/Aaru.Images/RayDIM/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class RayDim + public sealed partial class RayDim { const string REGEX_SIGNATURE = @"Disk IMage VER (?\d).(?\d) Copyright \(C\) (?\d{4}) Ray Arachelian, All Rights Reserved\."; diff --git a/Aaru.Images/RayDIM/Enums.cs b/Aaru.Images/RayDIM/Enums.cs index 4b439de1d..1e8987196 100644 --- a/Aaru.Images/RayDIM/Enums.cs +++ b/Aaru.Images/RayDIM/Enums.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class RayDim + public sealed partial class RayDim { [SuppressMessage("ReSharper", "InconsistentNaming")] enum RayDiskTypes : byte diff --git a/Aaru.Images/RayDIM/Identify.cs b/Aaru.Images/RayDIM/Identify.cs index 5b4235cb0..fea8f9b52 100644 --- a/Aaru.Images/RayDIM/Identify.cs +++ b/Aaru.Images/RayDIM/Identify.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class RayDim + public sealed partial class RayDim { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/RayDIM/Properties.cs b/Aaru.Images/RayDIM/Properties.cs index 7ce04cffe..b4bb9fded 100644 --- a/Aaru.Images/RayDIM/Properties.cs +++ b/Aaru.Images/RayDIM/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class RayDim + public sealed partial class RayDim { public string Name => "Ray Arachelian's Disk IMage"; public Guid Id => new Guid("F541F4E7-C1E3-4A2D-B07F-D863E87AB961"); diff --git a/Aaru.Images/RayDIM/RayDIM.cs b/Aaru.Images/RayDIM/RayDIM.cs index c41457ca3..87abf7ea8 100644 --- a/Aaru.Images/RayDIM/RayDIM.cs +++ b/Aaru.Images/RayDIM/RayDIM.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class RayDim : IWritableImage + public sealed partial class RayDim : IWritableImage { MemoryStream _disk; ImageInfo _imageInfo; diff --git a/Aaru.Images/RayDIM/Read.cs b/Aaru.Images/RayDIM/Read.cs index b85918c8d..fe39e3490 100644 --- a/Aaru.Images/RayDIM/Read.cs +++ b/Aaru.Images/RayDIM/Read.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class RayDim + public sealed partial class RayDim { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/RayDIM/Structs.cs b/Aaru.Images/RayDIM/Structs.cs index 490756261..9023dffde 100644 --- a/Aaru.Images/RayDIM/Structs.cs +++ b/Aaru.Images/RayDIM/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class RayDim + public sealed partial class RayDim { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct RayHdr diff --git a/Aaru.Images/RayDIM/Unsupported.cs b/Aaru.Images/RayDIM/Unsupported.cs index 971b6480f..26eef7401 100644 --- a/Aaru.Images/RayDIM/Unsupported.cs +++ b/Aaru.Images/RayDIM/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class RayDim + public sealed partial class RayDim { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/RayDIM/Write.cs b/Aaru.Images/RayDIM/Write.cs index 0c88f8575..b96e20736 100644 --- a/Aaru.Images/RayDIM/Write.cs +++ b/Aaru.Images/RayDIM/Write.cs @@ -43,7 +43,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class RayDim + public sealed partial class RayDim { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -64,7 +64,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/Register.cs b/Aaru.Images/Register.cs index db6fa4fe3..0cdafb987 100644 --- a/Aaru.Images/Register.cs +++ b/Aaru.Images/Register.cs @@ -44,7 +44,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public class Register : IPluginRegister + public sealed class Register : IPluginRegister { public List GetAllChecksumPlugins() => null; diff --git a/Aaru.Images/RsIde/Constants.cs b/Aaru.Images/RsIde/Constants.cs index 35ea72aed..69b89d1ab 100644 --- a/Aaru.Images/RsIde/Constants.cs +++ b/Aaru.Images/RsIde/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class RsIde + public sealed partial class RsIde { readonly byte[] _signature = { diff --git a/Aaru.Images/RsIde/Enums.cs b/Aaru.Images/RsIde/Enums.cs index 8292637fa..8a3e6bf87 100644 --- a/Aaru.Images/RsIde/Enums.cs +++ b/Aaru.Images/RsIde/Enums.cs @@ -34,7 +34,7 @@ using System; namespace Aaru.DiscImages { - public partial class RsIde + public sealed partial class RsIde { [Flags] enum RsIdeFlags : byte diff --git a/Aaru.Images/RsIde/Helpers.cs b/Aaru.Images/RsIde/Helpers.cs index 8d2fc9f5d..bbbdcad19 100644 --- a/Aaru.Images/RsIde/Helpers.cs +++ b/Aaru.Images/RsIde/Helpers.cs @@ -35,7 +35,7 @@ using System.Text; namespace Aaru.DiscImages { - public partial class RsIde + public sealed partial class RsIde { static byte[] ScrambleAtaString(string text, int length) { diff --git a/Aaru.Images/RsIde/Identify.cs b/Aaru.Images/RsIde/Identify.cs index b6334373e..f566acec2 100644 --- a/Aaru.Images/RsIde/Identify.cs +++ b/Aaru.Images/RsIde/Identify.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class RsIde + public sealed partial class RsIde { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/RsIde/Properties.cs b/Aaru.Images/RsIde/Properties.cs index 88994d76b..faae589b9 100644 --- a/Aaru.Images/RsIde/Properties.cs +++ b/Aaru.Images/RsIde/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class RsIde + public sealed partial class RsIde { public string Name => "RS-IDE Hard Disk Image"; public Guid Id => new Guid("47C3E78D-2BE2-4BA5-AA6B-FEE27C86FC65"); diff --git a/Aaru.Images/RsIde/Read.cs b/Aaru.Images/RsIde/Read.cs index 2a265c87e..09e57c847 100644 --- a/Aaru.Images/RsIde/Read.cs +++ b/Aaru.Images/RsIde/Read.cs @@ -42,7 +42,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class RsIde + public sealed partial class RsIde { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/RsIde/RsIde.cs b/Aaru.Images/RsIde/RsIde.cs index 280d07ee1..b8cb24656 100644 --- a/Aaru.Images/RsIde/RsIde.cs +++ b/Aaru.Images/RsIde/RsIde.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class RsIde : IWritableImage + public sealed partial class RsIde : IWritableImage { ushort _dataOff; byte[] _identify; diff --git a/Aaru.Images/RsIde/Structs.cs b/Aaru.Images/RsIde/Structs.cs index 22a515d63..f85d0bbfb 100644 --- a/Aaru.Images/RsIde/Structs.cs +++ b/Aaru.Images/RsIde/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class RsIde + public sealed partial class RsIde { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct RsIdeHeader diff --git a/Aaru.Images/RsIde/Unsupported.cs b/Aaru.Images/RsIde/Unsupported.cs index ace467304..9659e1820 100644 --- a/Aaru.Images/RsIde/Unsupported.cs +++ b/Aaru.Images/RsIde/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class RsIde + public sealed partial class RsIde { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/RsIde/Write.cs b/Aaru.Images/RsIde/Write.cs index cfbe6d28f..805c96470 100644 --- a/Aaru.Images/RsIde/Write.cs +++ b/Aaru.Images/RsIde/Write.cs @@ -44,7 +44,7 @@ using Version = Aaru.CommonTypes.Interop.Version; namespace Aaru.DiscImages { - public partial class RsIde + public sealed partial class RsIde { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -66,7 +66,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/SaveDskF/Constants.cs b/Aaru.Images/SaveDskF/Constants.cs index ba593c44e..fc392b6d0 100644 --- a/Aaru.Images/SaveDskF/Constants.cs +++ b/Aaru.Images/SaveDskF/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class SaveDskF + public sealed partial class SaveDskF { const ushort SDF_MAGIC_OLD = 0x58AA; const ushort SDF_MAGIC = 0x59AA; diff --git a/Aaru.Images/SaveDskF/Identify.cs b/Aaru.Images/SaveDskF/Identify.cs index 5adf17a45..d33cf40bf 100644 --- a/Aaru.Images/SaveDskF/Identify.cs +++ b/Aaru.Images/SaveDskF/Identify.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class SaveDskF + public sealed partial class SaveDskF { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/SaveDskF/Properties.cs b/Aaru.Images/SaveDskF/Properties.cs index fa3cb784a..62bebdffd 100644 --- a/Aaru.Images/SaveDskF/Properties.cs +++ b/Aaru.Images/SaveDskF/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class SaveDskF + public sealed partial class SaveDskF { public string Name => "IBM SaveDskF"; public Guid Id => new Guid("288CE058-1A51-4034-8C45-5A256CAE1461"); diff --git a/Aaru.Images/SaveDskF/Read.cs b/Aaru.Images/SaveDskF/Read.cs index 16924bd2b..0dccb547d 100644 --- a/Aaru.Images/SaveDskF/Read.cs +++ b/Aaru.Images/SaveDskF/Read.cs @@ -42,7 +42,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class SaveDskF + public sealed partial class SaveDskF { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/SaveDskF/SaveDskF.cs b/Aaru.Images/SaveDskF/SaveDskF.cs index 994ad4e28..fc53f7ac4 100644 --- a/Aaru.Images/SaveDskF/SaveDskF.cs +++ b/Aaru.Images/SaveDskF/SaveDskF.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class SaveDskF : IWritableImage, IVerifiableImage + public sealed partial class SaveDskF : IWritableImage, IVerifiableImage { uint _calculatedChk; byte[] _decodedDisk; diff --git a/Aaru.Images/SaveDskF/Structs.cs b/Aaru.Images/SaveDskF/Structs.cs index faf3fa634..779c32c2c 100644 --- a/Aaru.Images/SaveDskF/Structs.cs +++ b/Aaru.Images/SaveDskF/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class SaveDskF + public sealed partial class SaveDskF { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SaveDskFHeader diff --git a/Aaru.Images/SaveDskF/Unsupported.cs b/Aaru.Images/SaveDskF/Unsupported.cs index 225d4b052..9d57e2250 100644 --- a/Aaru.Images/SaveDskF/Unsupported.cs +++ b/Aaru.Images/SaveDskF/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class SaveDskF + public sealed partial class SaveDskF { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/SaveDskF/Verify.cs b/Aaru.Images/SaveDskF/Verify.cs index a7d1f6c2f..479eee1ca 100644 --- a/Aaru.Images/SaveDskF/Verify.cs +++ b/Aaru.Images/SaveDskF/Verify.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class SaveDskF + public sealed partial class SaveDskF { public bool? VerifyMediaImage() => _calculatedChk == _header.checksum; } diff --git a/Aaru.Images/SaveDskF/Write.cs b/Aaru.Images/SaveDskF/Write.cs index 78b8d39ec..c90cd71d7 100644 --- a/Aaru.Images/SaveDskF/Write.cs +++ b/Aaru.Images/SaveDskF/Write.cs @@ -43,7 +43,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class SaveDskF + public sealed partial class SaveDskF { public bool WriteMediaTag(byte[] data, MediaTagType tag) { @@ -214,7 +214,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/SuperCardPro/Constants.cs b/Aaru.Images/SuperCardPro/Constants.cs index f9611b456..477cf9f86 100644 --- a/Aaru.Images/SuperCardPro/Constants.cs +++ b/Aaru.Images/SuperCardPro/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class SuperCardPro + public sealed partial class SuperCardPro { /// SuperCardPro footer signature: "FPCS" const uint FOOTER_SIGNATURE = 0x53435046; diff --git a/Aaru.Images/SuperCardPro/Enums.cs b/Aaru.Images/SuperCardPro/Enums.cs index 8bfe84045..15f38d78e 100644 --- a/Aaru.Images/SuperCardPro/Enums.cs +++ b/Aaru.Images/SuperCardPro/Enums.cs @@ -34,7 +34,7 @@ using System; namespace Aaru.DiscImages { - public partial class SuperCardPro + public sealed partial class SuperCardPro { public enum ScpDiskType : byte { diff --git a/Aaru.Images/SuperCardPro/Helpers.cs b/Aaru.Images/SuperCardPro/Helpers.cs index edd3c9f0c..4c5f58a31 100644 --- a/Aaru.Images/SuperCardPro/Helpers.cs +++ b/Aaru.Images/SuperCardPro/Helpers.cs @@ -36,7 +36,7 @@ using System.Text; namespace Aaru.DiscImages { - public partial class SuperCardPro + public sealed partial class SuperCardPro { static string ReadPStringUtf8(Stream stream, uint position) { diff --git a/Aaru.Images/SuperCardPro/Identify.cs b/Aaru.Images/SuperCardPro/Identify.cs index 57cfce2b3..4b305005e 100644 --- a/Aaru.Images/SuperCardPro/Identify.cs +++ b/Aaru.Images/SuperCardPro/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class SuperCardPro + public sealed partial class SuperCardPro { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/SuperCardPro/Properties.cs b/Aaru.Images/SuperCardPro/Properties.cs index 1f10af23e..3b67de10f 100644 --- a/Aaru.Images/SuperCardPro/Properties.cs +++ b/Aaru.Images/SuperCardPro/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class SuperCardPro + public sealed partial class SuperCardPro { public ImageInfo Info => _imageInfo; public string Name => "SuperCardPro"; diff --git a/Aaru.Images/SuperCardPro/Read.cs b/Aaru.Images/SuperCardPro/Read.cs index 29c96810a..2542e97a9 100644 --- a/Aaru.Images/SuperCardPro/Read.cs +++ b/Aaru.Images/SuperCardPro/Read.cs @@ -41,7 +41,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class SuperCardPro + public sealed partial class SuperCardPro { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/SuperCardPro/Structs.cs b/Aaru.Images/SuperCardPro/Structs.cs index 651a6e2eb..04749ba91 100644 --- a/Aaru.Images/SuperCardPro/Structs.cs +++ b/Aaru.Images/SuperCardPro/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class SuperCardPro + public sealed partial class SuperCardPro { [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ScpHeader diff --git a/Aaru.Images/SuperCardPro/SuperCardPro.cs b/Aaru.Images/SuperCardPro/SuperCardPro.cs index 52a37610b..3c0e674da 100644 --- a/Aaru.Images/SuperCardPro/SuperCardPro.cs +++ b/Aaru.Images/SuperCardPro/SuperCardPro.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class SuperCardPro : IMediaImage, IVerifiableImage, IVerifiableSectorsImage + public sealed partial class SuperCardPro : IMediaImage, IVerifiableImage, IVerifiableSectorsImage { ImageInfo _imageInfo; Stream _scpStream; diff --git a/Aaru.Images/SuperCardPro/Verify.cs b/Aaru.Images/SuperCardPro/Verify.cs index 5e8b2deac..d03b4fc97 100644 --- a/Aaru.Images/SuperCardPro/Verify.cs +++ b/Aaru.Images/SuperCardPro/Verify.cs @@ -35,7 +35,7 @@ using System.Collections.Generic; namespace Aaru.DiscImages { - public partial class SuperCardPro + public sealed partial class SuperCardPro { public bool? VerifyMediaImage() { diff --git a/Aaru.Images/T98/Identify.cs b/Aaru.Images/T98/Identify.cs index 72825e761..d6609e097 100644 --- a/Aaru.Images/T98/Identify.cs +++ b/Aaru.Images/T98/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Console; namespace Aaru.DiscImages { - public partial class T98 + public sealed partial class T98 { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/T98/Properties.cs b/Aaru.Images/T98/Properties.cs index f46f80e17..47d8e0a2c 100644 --- a/Aaru.Images/T98/Properties.cs +++ b/Aaru.Images/T98/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class T98 + public sealed partial class T98 { public string Name => "T98 Hard Disk Image"; public Guid Id => new Guid("0410003E-6E7B-40E6-9328-BA5651ADF6B7"); diff --git a/Aaru.Images/T98/Read.cs b/Aaru.Images/T98/Read.cs index 475c2575c..4c80675ca 100644 --- a/Aaru.Images/T98/Read.cs +++ b/Aaru.Images/T98/Read.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class T98 + public sealed partial class T98 { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/T98/T98.cs b/Aaru.Images/T98/T98.cs index 7f46d1b40..2a0951ff2 100644 --- a/Aaru.Images/T98/T98.cs +++ b/Aaru.Images/T98/T98.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class T98 : IWritableImage + public sealed partial class T98 : IWritableImage { ImageInfo _imageInfo; IFilter _t98ImageFilter; diff --git a/Aaru.Images/T98/Unsupported.cs b/Aaru.Images/T98/Unsupported.cs index 211069e82..8b37c5ad3 100644 --- a/Aaru.Images/T98/Unsupported.cs +++ b/Aaru.Images/T98/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class T98 + public sealed partial class T98 { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/T98/Write.cs b/Aaru.Images/T98/Write.cs index 004650bf7..cee8737ca 100644 --- a/Aaru.Images/T98/Write.cs +++ b/Aaru.Images/T98/Write.cs @@ -41,7 +41,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class T98 + public sealed partial class T98 { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -55,7 +55,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/TeleDisk/Constants.cs b/Aaru.Images/TeleDisk/Constants.cs index 6f6bcb2ce..891e9ee6c 100644 --- a/Aaru.Images/TeleDisk/Constants.cs +++ b/Aaru.Images/TeleDisk/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class TeleDisk + public sealed partial class TeleDisk { // "TD" as little endian uint. const ushort TD_MAGIC = 0x4454; diff --git a/Aaru.Images/TeleDisk/Helpers.cs b/Aaru.Images/TeleDisk/Helpers.cs index 172501609..9de2663d7 100644 --- a/Aaru.Images/TeleDisk/Helpers.cs +++ b/Aaru.Images/TeleDisk/Helpers.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class TeleDisk + public sealed partial class TeleDisk { (ushort cylinder, byte head, byte sector) LbaToChs(ulong lba) { diff --git a/Aaru.Images/TeleDisk/Identify.cs b/Aaru.Images/TeleDisk/Identify.cs index e319e0677..626641cbc 100644 --- a/Aaru.Images/TeleDisk/Identify.cs +++ b/Aaru.Images/TeleDisk/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Console; namespace Aaru.DiscImages { - public partial class TeleDisk + public sealed partial class TeleDisk { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/TeleDisk/Properties.cs b/Aaru.Images/TeleDisk/Properties.cs index d25e1d120..1d65c7fc4 100644 --- a/Aaru.Images/TeleDisk/Properties.cs +++ b/Aaru.Images/TeleDisk/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class TeleDisk + public sealed partial class TeleDisk { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/TeleDisk/Read.cs b/Aaru.Images/TeleDisk/Read.cs index b9e16ff1c..851382bc7 100644 --- a/Aaru.Images/TeleDisk/Read.cs +++ b/Aaru.Images/TeleDisk/Read.cs @@ -41,7 +41,7 @@ using Aaru.Console; namespace Aaru.DiscImages { - public partial class TeleDisk + public sealed partial class TeleDisk { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/TeleDisk/Structs.cs b/Aaru.Images/TeleDisk/Structs.cs index 2a8cba258..798c80181 100644 --- a/Aaru.Images/TeleDisk/Structs.cs +++ b/Aaru.Images/TeleDisk/Structs.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class TeleDisk + public sealed partial class TeleDisk { struct TeleDiskHeader { diff --git a/Aaru.Images/TeleDisk/TeleDisk.cs b/Aaru.Images/TeleDisk/TeleDisk.cs index 5035baefc..f01f19df0 100644 --- a/Aaru.Images/TeleDisk/TeleDisk.cs +++ b/Aaru.Images/TeleDisk/TeleDisk.cs @@ -40,7 +40,7 @@ namespace Aaru.DiscImages { // Created following notes from Dave Dunfield // http://www.classiccmp.org/dunfield/img54306/td0notes.txt - public partial class TeleDisk : IMediaImage, IVerifiableImage, IVerifiableSectorsImage + public sealed partial class TeleDisk : IMediaImage, IVerifiableImage, IVerifiableSectorsImage { readonly List _sectorsWhereCrcHasFailed; bool _aDiskCrcHasFailed; diff --git a/Aaru.Images/TeleDisk/Unsupported.cs b/Aaru.Images/TeleDisk/Unsupported.cs index a4f6a298f..b16792e9b 100644 --- a/Aaru.Images/TeleDisk/Unsupported.cs +++ b/Aaru.Images/TeleDisk/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class TeleDisk + public sealed partial class TeleDisk { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/TeleDisk/Verify.cs b/Aaru.Images/TeleDisk/Verify.cs index 5595eb3df..926da6d76 100644 --- a/Aaru.Images/TeleDisk/Verify.cs +++ b/Aaru.Images/TeleDisk/Verify.cs @@ -34,7 +34,7 @@ using System.Collections.Generic; namespace Aaru.DiscImages { - public partial class TeleDisk + public sealed partial class TeleDisk { public bool? VerifyMediaImage() => _aDiskCrcHasFailed; diff --git a/Aaru.Images/UDIF/Constants.cs b/Aaru.Images/UDIF/Constants.cs index bda15d94b..ba4d9ff2e 100644 --- a/Aaru.Images/UDIF/Constants.cs +++ b/Aaru.Images/UDIF/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Udif + public sealed partial class Udif { const uint UDIF_SIGNATURE = 0x6B6F6C79; const uint CHUNK_SIGNATURE = 0x6D697368; diff --git a/Aaru.Images/UDIF/Identify.cs b/Aaru.Images/UDIF/Identify.cs index 96fe06bb2..173c6016a 100644 --- a/Aaru.Images/UDIF/Identify.cs +++ b/Aaru.Images/UDIF/Identify.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Udif + public sealed partial class Udif { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/UDIF/Properties.cs b/Aaru.Images/UDIF/Properties.cs index c560cc25a..673d0c610 100644 --- a/Aaru.Images/UDIF/Properties.cs +++ b/Aaru.Images/UDIF/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Udif + public sealed partial class Udif { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/UDIF/Read.cs b/Aaru.Images/UDIF/Read.cs index a1d66b94c..6e76e56fe 100644 --- a/Aaru.Images/UDIF/Read.cs +++ b/Aaru.Images/UDIF/Read.cs @@ -52,7 +52,7 @@ using Version = Resources.Version; namespace Aaru.DiscImages { - public partial class Udif + public sealed partial class Udif { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/UDIF/Structs.cs b/Aaru.Images/UDIF/Structs.cs index 666306b38..e891f9651 100644 --- a/Aaru.Images/UDIF/Structs.cs +++ b/Aaru.Images/UDIF/Structs.cs @@ -35,7 +35,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Udif + public sealed partial class Udif { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct UdifFooter diff --git a/Aaru.Images/UDIF/UDIF.cs b/Aaru.Images/UDIF/UDIF.cs index ffd0de97c..8882798cd 100644 --- a/Aaru.Images/UDIF/UDIF.cs +++ b/Aaru.Images/UDIF/UDIF.cs @@ -41,7 +41,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Udif : IWritableImage + public sealed partial class Udif : IWritableImage { uint _buffersize; Dictionary _chunkCache; diff --git a/Aaru.Images/UDIF/Unsupported.cs b/Aaru.Images/UDIF/Unsupported.cs index 1fe9c8248..9d5027898 100644 --- a/Aaru.Images/UDIF/Unsupported.cs +++ b/Aaru.Images/UDIF/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Udif + public sealed partial class Udif { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/UDIF/Write.cs b/Aaru.Images/UDIF/Write.cs index c6beb217a..873ab32b6 100644 --- a/Aaru.Images/UDIF/Write.cs +++ b/Aaru.Images/UDIF/Write.cs @@ -45,7 +45,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Udif + public sealed partial class Udif { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -59,7 +59,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/UkvFdi/Constants.cs b/Aaru.Images/UkvFdi/Constants.cs index f357cbb8e..c59e13ad8 100644 --- a/Aaru.Images/UkvFdi/Constants.cs +++ b/Aaru.Images/UkvFdi/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class UkvFdi + public sealed partial class UkvFdi { readonly byte[] _signature = { diff --git a/Aaru.Images/UkvFdi/Enums.cs b/Aaru.Images/UkvFdi/Enums.cs index 4961c8a0b..ca7a20fe5 100644 --- a/Aaru.Images/UkvFdi/Enums.cs +++ b/Aaru.Images/UkvFdi/Enums.cs @@ -36,7 +36,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class UkvFdi + public sealed partial class UkvFdi { [Flags] enum DiskFlags : byte diff --git a/Aaru.Images/UkvFdi/Helpers.cs b/Aaru.Images/UkvFdi/Helpers.cs index 2366be9b1..b74c20e2f 100644 --- a/Aaru.Images/UkvFdi/Helpers.cs +++ b/Aaru.Images/UkvFdi/Helpers.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class UkvFdi + public sealed partial class UkvFdi { (ushort cylinder, byte head, byte sector) LbaToChs(ulong lba) { diff --git a/Aaru.Images/UkvFdi/Identify.cs b/Aaru.Images/UkvFdi/Identify.cs index 185abfcc5..95e1938c8 100644 --- a/Aaru.Images/UkvFdi/Identify.cs +++ b/Aaru.Images/UkvFdi/Identify.cs @@ -37,21 +37,19 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class UkvFdi + public sealed partial class UkvFdi { public bool Identify(IFilter imageFilter) { Stream stream = imageFilter.GetDataForkStream(); stream.Seek(0, SeekOrigin.Begin); - var hdr = new FdiHeader(); - if(stream.Length < Marshal.SizeOf()) return false; byte[] hdrB = new byte[Marshal.SizeOf()]; stream.Read(hdrB, 0, hdrB.Length); - hdr = Marshal.ByteArrayToStructureLittleEndian(hdrB); + FdiHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrB); return hdr.magic.SequenceEqual(_signature); } diff --git a/Aaru.Images/UkvFdi/Properties.cs b/Aaru.Images/UkvFdi/Properties.cs index 6c2b8ffff..1e1c811e8 100644 --- a/Aaru.Images/UkvFdi/Properties.cs +++ b/Aaru.Images/UkvFdi/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class UkvFdi + public sealed partial class UkvFdi { public string Name => "Spectrum Floppy Disk Image"; public Guid Id => new Guid("DADFC9B2-67C1-42A3-B124-825528163FC0"); diff --git a/Aaru.Images/UkvFdi/Read.cs b/Aaru.Images/UkvFdi/Read.cs index 034e91aba..f7ee10e03 100644 --- a/Aaru.Images/UkvFdi/Read.cs +++ b/Aaru.Images/UkvFdi/Read.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class UkvFdi + public sealed partial class UkvFdi { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/UkvFdi/Structs.cs b/Aaru.Images/UkvFdi/Structs.cs index 25901a749..2fcab94b2 100644 --- a/Aaru.Images/UkvFdi/Structs.cs +++ b/Aaru.Images/UkvFdi/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class UkvFdi + public sealed partial class UkvFdi { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct FdiHeader diff --git a/Aaru.Images/UkvFdi/UkvFdi.cs b/Aaru.Images/UkvFdi/UkvFdi.cs index f68b25f55..f06bd4020 100644 --- a/Aaru.Images/UkvFdi/UkvFdi.cs +++ b/Aaru.Images/UkvFdi/UkvFdi.cs @@ -37,7 +37,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class UkvFdi : IMediaImage + public sealed partial class UkvFdi : IMediaImage { ImageInfo _imageInfo; diff --git a/Aaru.Images/UkvFdi/Unsupported.cs b/Aaru.Images/UkvFdi/Unsupported.cs index 78194cc6a..4d15de9e2 100644 --- a/Aaru.Images/UkvFdi/Unsupported.cs +++ b/Aaru.Images/UkvFdi/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class UkvFdi + public sealed partial class UkvFdi { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/VDI/Constants.cs b/Aaru.Images/VDI/Constants.cs index 38334e136..0a30af190 100644 --- a/Aaru.Images/VDI/Constants.cs +++ b/Aaru.Images/VDI/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Vdi + public sealed partial class Vdi { const uint VDI_MAGIC = 0xBEDA107F; const uint VDI_EMPTY = 0xFFFFFFFF; diff --git a/Aaru.Images/VDI/Enums.cs b/Aaru.Images/VDI/Enums.cs index 78a35067e..92dd6264d 100644 --- a/Aaru.Images/VDI/Enums.cs +++ b/Aaru.Images/VDI/Enums.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Vdi + public sealed partial class Vdi { enum VdiImageType : uint { diff --git a/Aaru.Images/VDI/Identify.cs b/Aaru.Images/VDI/Identify.cs index c003d3172..561c3fe45 100644 --- a/Aaru.Images/VDI/Identify.cs +++ b/Aaru.Images/VDI/Identify.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Vdi + public sealed partial class Vdi { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/VDI/Properties.cs b/Aaru.Images/VDI/Properties.cs index 0f8190370..a7371f6e9 100644 --- a/Aaru.Images/VDI/Properties.cs +++ b/Aaru.Images/VDI/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Vdi + public sealed partial class Vdi { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/VDI/Read.cs b/Aaru.Images/VDI/Read.cs index d743bc0f0..aa07b0084 100644 --- a/Aaru.Images/VDI/Read.cs +++ b/Aaru.Images/VDI/Read.cs @@ -43,7 +43,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.DiscImages { - public partial class Vdi + public sealed partial class Vdi { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/VDI/Structs.cs b/Aaru.Images/VDI/Structs.cs index 4f32b1410..d084dd1e2 100644 --- a/Aaru.Images/VDI/Structs.cs +++ b/Aaru.Images/VDI/Structs.cs @@ -35,7 +35,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Vdi + public sealed partial class Vdi { /// VDI disk image header, little-endian [StructLayout(LayoutKind.Sequential, Pack = 1)] diff --git a/Aaru.Images/VDI/Unsupported.cs b/Aaru.Images/VDI/Unsupported.cs index 905beb670..778972ef8 100644 --- a/Aaru.Images/VDI/Unsupported.cs +++ b/Aaru.Images/VDI/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Vdi + public sealed partial class Vdi { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/VDI/VDI.cs b/Aaru.Images/VDI/VDI.cs index f94e00826..5b4d74ad5 100644 --- a/Aaru.Images/VDI/VDI.cs +++ b/Aaru.Images/VDI/VDI.cs @@ -41,7 +41,7 @@ namespace Aaru.DiscImages // TODO: Support version 0 // TODO: Support fixed images // TODO: Support version 1.2 geometry - public partial class Vdi : IWritableImage + public sealed partial class Vdi : IWritableImage { uint _currentWritingPosition; uint[] _ibm; diff --git a/Aaru.Images/VDI/Write.cs b/Aaru.Images/VDI/Write.cs index fcb091a51..21b09df83 100644 --- a/Aaru.Images/VDI/Write.cs +++ b/Aaru.Images/VDI/Write.cs @@ -44,7 +44,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.DiscImages { - public partial class Vdi + public sealed partial class Vdi { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -58,7 +58,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/VHD/Constants.cs b/Aaru.Images/VHD/Constants.cs index 40fb0c75b..6d9417600 100644 --- a/Aaru.Images/VHD/Constants.cs +++ b/Aaru.Images/VHD/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Vhd + public sealed partial class Vhd { /// File magic number, "conectix" const ulong IMAGE_COOKIE = 0x636F6E6563746978; diff --git a/Aaru.Images/VHD/Helpers.cs b/Aaru.Images/VHD/Helpers.cs index ebe78ed8c..05a719bd8 100644 --- a/Aaru.Images/VHD/Helpers.cs +++ b/Aaru.Images/VHD/Helpers.cs @@ -35,7 +35,7 @@ using System.Linq; namespace Aaru.DiscImages { - public partial class Vhd + public sealed partial class Vhd { static uint VhdChecksum(IEnumerable data) { diff --git a/Aaru.Images/VHD/Identify.cs b/Aaru.Images/VHD/Identify.cs index 2cca824c5..5733604f4 100644 --- a/Aaru.Images/VHD/Identify.cs +++ b/Aaru.Images/VHD/Identify.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Vhd + public sealed partial class Vhd { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/VHD/Properties.cs b/Aaru.Images/VHD/Properties.cs index 1540002a7..c87aeab1f 100644 --- a/Aaru.Images/VHD/Properties.cs +++ b/Aaru.Images/VHD/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Vhd + public sealed partial class Vhd { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/VHD/Read.cs b/Aaru.Images/VHD/Read.cs index 0f52937e6..2e130166f 100644 --- a/Aaru.Images/VHD/Read.cs +++ b/Aaru.Images/VHD/Read.cs @@ -44,7 +44,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Vhd + public sealed partial class Vhd { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/VHD/Structs.cs b/Aaru.Images/VHD/Structs.cs index 7071578bd..276f842d1 100644 --- a/Aaru.Images/VHD/Structs.cs +++ b/Aaru.Images/VHD/Structs.cs @@ -34,7 +34,7 @@ using System; namespace Aaru.DiscImages { - public partial class Vhd + public sealed partial class Vhd { struct HardDiskFooter { diff --git a/Aaru.Images/VHD/Unsupported.cs b/Aaru.Images/VHD/Unsupported.cs index 3caae0d8c..616fdcd68 100644 --- a/Aaru.Images/VHD/Unsupported.cs +++ b/Aaru.Images/VHD/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Vhd + public sealed partial class Vhd { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/VHD/VHD.cs b/Aaru.Images/VHD/VHD.cs index 0b2de2751..1446de8a9 100644 --- a/Aaru.Images/VHD/VHD.cs +++ b/Aaru.Images/VHD/VHD.cs @@ -45,7 +45,7 @@ namespace Aaru.DiscImages /// the hard disk image was merely a sector by sector (RAW) image with a resource fork giving information to Virtual PC /// itself. /// - public partial class Vhd : IWritableImage + public sealed partial class Vhd : IWritableImage { uint _bitmapSize; uint[] _blockAllocationTable; diff --git a/Aaru.Images/VHD/Write.cs b/Aaru.Images/VHD/Write.cs index 6723fcc81..812797069 100644 --- a/Aaru.Images/VHD/Write.cs +++ b/Aaru.Images/VHD/Write.cs @@ -45,7 +45,7 @@ using Version = System.Version; namespace Aaru.DiscImages { - public partial class Vhd + public sealed partial class Vhd { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -59,7 +59,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/VHDX/Constants.cs b/Aaru.Images/VHDX/Constants.cs index 3c7bf4d91..68f32f316 100644 --- a/Aaru.Images/VHDX/Constants.cs +++ b/Aaru.Images/VHDX/Constants.cs @@ -36,7 +36,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class Vhdx + public sealed partial class Vhdx { const ulong VHDX_SIGNATURE = 0x656C696678646876; const uint VHDX_HEADER_SIG = 0x64616568; diff --git a/Aaru.Images/VHDX/Helpers.cs b/Aaru.Images/VHDX/Helpers.cs index a314c34a5..5ff727915 100644 --- a/Aaru.Images/VHDX/Helpers.cs +++ b/Aaru.Images/VHDX/Helpers.cs @@ -35,7 +35,7 @@ using System.Linq; namespace Aaru.DiscImages { - public partial class Vhdx + public sealed partial class Vhdx { bool CheckBitmap(ulong sectorAddress) { diff --git a/Aaru.Images/VHDX/Identify.cs b/Aaru.Images/VHDX/Identify.cs index b5404d7cf..7849a16c0 100644 --- a/Aaru.Images/VHDX/Identify.cs +++ b/Aaru.Images/VHDX/Identify.cs @@ -36,7 +36,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Vhdx + public sealed partial class Vhdx { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/VHDX/Properties.cs b/Aaru.Images/VHDX/Properties.cs index 6d7a616e8..829b221fb 100644 --- a/Aaru.Images/VHDX/Properties.cs +++ b/Aaru.Images/VHDX/Properties.cs @@ -37,7 +37,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Vhdx + public sealed partial class Vhdx { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/VHDX/Read.cs b/Aaru.Images/VHDX/Read.cs index 1c0eabe7f..b06711d33 100644 --- a/Aaru.Images/VHDX/Read.cs +++ b/Aaru.Images/VHDX/Read.cs @@ -43,7 +43,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Vhdx + public sealed partial class Vhdx { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/VHDX/Structs.cs b/Aaru.Images/VHDX/Structs.cs index 2ea509d20..4162552a0 100644 --- a/Aaru.Images/VHDX/Structs.cs +++ b/Aaru.Images/VHDX/Structs.cs @@ -35,7 +35,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Vhdx + public sealed partial class Vhdx { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct VhdxIdentifier diff --git a/Aaru.Images/VHDX/Unsupported.cs b/Aaru.Images/VHDX/Unsupported.cs index 3a0a69455..afb16c2de 100644 --- a/Aaru.Images/VHDX/Unsupported.cs +++ b/Aaru.Images/VHDX/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Vhdx + public sealed partial class Vhdx { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/VHDX/VHDX.cs b/Aaru.Images/VHDX/VHDX.cs index ee000a8e9..dbd4ff024 100644 --- a/Aaru.Images/VHDX/VHDX.cs +++ b/Aaru.Images/VHDX/VHDX.cs @@ -41,7 +41,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class Vhdx : IMediaImage + public sealed partial class Vhdx : IMediaImage { long _batOffset; ulong[] _blockAllocationTable; diff --git a/Aaru.Images/VMware/Constants.cs b/Aaru.Images/VMware/Constants.cs index f7617a3ef..e940d9323 100644 --- a/Aaru.Images/VMware/Constants.cs +++ b/Aaru.Images/VMware/Constants.cs @@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public partial class VMware + public sealed partial class VMware { const uint VMWARE_EXTENT_MAGIC = 0x564D444B; const uint VMWARE_COW_MAGIC = 0x44574F43; diff --git a/Aaru.Images/VMware/Identify.cs b/Aaru.Images/VMware/Identify.cs index 74c6aa7fa..6f69485af 100644 --- a/Aaru.Images/VMware/Identify.cs +++ b/Aaru.Images/VMware/Identify.cs @@ -37,7 +37,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class VMware + public sealed partial class VMware { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/VMware/Properties.cs b/Aaru.Images/VMware/Properties.cs index c35cd3885..e8b5d9ac2 100644 --- a/Aaru.Images/VMware/Properties.cs +++ b/Aaru.Images/VMware/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class VMware + public sealed partial class VMware { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/VMware/Read.cs b/Aaru.Images/VMware/Read.cs index 10e631526..0192e31d3 100644 --- a/Aaru.Images/VMware/Read.cs +++ b/Aaru.Images/VMware/Read.cs @@ -46,7 +46,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.DiscImages { - public partial class VMware + public sealed partial class VMware { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/VMware/Structs.cs b/Aaru.Images/VMware/Structs.cs index f33cf5aa6..18e400035 100644 --- a/Aaru.Images/VMware/Structs.cs +++ b/Aaru.Images/VMware/Structs.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class VMware + public sealed partial class VMware { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct VMwareExtentHeader diff --git a/Aaru.Images/VMware/Unsupported.cs b/Aaru.Images/VMware/Unsupported.cs index 140327022..9bededb09 100644 --- a/Aaru.Images/VMware/Unsupported.cs +++ b/Aaru.Images/VMware/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class VMware + public sealed partial class VMware { public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/VMware/VMware.cs b/Aaru.Images/VMware/VMware.cs index a2b4daff4..aeec032b1 100644 --- a/Aaru.Images/VMware/VMware.cs +++ b/Aaru.Images/VMware/VMware.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class VMware : IWritableImage + public sealed partial class VMware : IWritableImage { string _adapterType; uint _cid; diff --git a/Aaru.Images/VMware/Write.cs b/Aaru.Images/VMware/Write.cs index d6d0681e7..343443750 100644 --- a/Aaru.Images/VMware/Write.cs +++ b/Aaru.Images/VMware/Write.cs @@ -42,7 +42,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class VMware + public sealed partial class VMware { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -131,7 +131,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } @@ -145,7 +145,9 @@ namespace Aaru.DiscImages try { - _writingBaseName = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)); + _writingBaseName = + Path.Combine(Path.GetDirectoryName(path) ?? "", Path.GetFileNameWithoutExtension(path)); + _descriptorStream = new StreamWriter(path, false, Encoding.ASCII); // TODO: Support split diff --git a/Aaru.Images/Virtual98/Constants.cs b/Aaru.Images/Virtual98/Constants.cs index 2db2e44df..f58f8c763 100644 --- a/Aaru.Images/Virtual98/Constants.cs +++ b/Aaru.Images/Virtual98/Constants.cs @@ -32,7 +32,7 @@ namespace Aaru.DiscImages { - public partial class Virtual98 + public sealed partial class Virtual98 { readonly byte[] _signature = { diff --git a/Aaru.Images/Virtual98/Identify.cs b/Aaru.Images/Virtual98/Identify.cs index 089dafe50..123542a45 100644 --- a/Aaru.Images/Virtual98/Identify.cs +++ b/Aaru.Images/Virtual98/Identify.cs @@ -39,7 +39,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Virtual98 + public sealed partial class Virtual98 { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/Virtual98/Properties.cs b/Aaru.Images/Virtual98/Properties.cs index f50b92a53..e1bc850da 100644 --- a/Aaru.Images/Virtual98/Properties.cs +++ b/Aaru.Images/Virtual98/Properties.cs @@ -39,7 +39,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Virtual98 + public sealed partial class Virtual98 { public ImageInfo Info => _imageInfo; public string Name => "Virtual98 Disk Image"; diff --git a/Aaru.Images/Virtual98/Read.cs b/Aaru.Images/Virtual98/Read.cs index 2fde43b86..b0dbc08c6 100644 --- a/Aaru.Images/Virtual98/Read.cs +++ b/Aaru.Images/Virtual98/Read.cs @@ -40,7 +40,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class Virtual98 + public sealed partial class Virtual98 { public bool Open(IFilter imageFilter) { diff --git a/Aaru.Images/Virtual98/Structs.cs b/Aaru.Images/Virtual98/Structs.cs index 6ab20d236..5f96c55cf 100644 --- a/Aaru.Images/Virtual98/Structs.cs +++ b/Aaru.Images/Virtual98/Structs.cs @@ -34,7 +34,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class Virtual98 + public sealed partial class Virtual98 { [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Virtual98Header diff --git a/Aaru.Images/Virtual98/Unsupported.cs b/Aaru.Images/Virtual98/Unsupported.cs index 27b03fb36..8c49bd578 100644 --- a/Aaru.Images/Virtual98/Unsupported.cs +++ b/Aaru.Images/Virtual98/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class Virtual98 + public sealed partial class Virtual98 { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/Virtual98/Virtual98.cs b/Aaru.Images/Virtual98/Virtual98.cs index 2f6d5ab40..f1cd8f594 100644 --- a/Aaru.Images/Virtual98/Virtual98.cs +++ b/Aaru.Images/Virtual98/Virtual98.cs @@ -39,7 +39,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { // Info from Neko Project II emulator - public partial class Virtual98 : IWritableImage + public sealed partial class Virtual98 : IWritableImage { ImageInfo _imageInfo; IFilter _nhdImageFilter; diff --git a/Aaru.Images/Virtual98/Write.cs b/Aaru.Images/Virtual98/Write.cs index 72f551857..c9d33bcae 100644 --- a/Aaru.Images/Virtual98/Write.cs +++ b/Aaru.Images/Virtual98/Write.cs @@ -43,7 +43,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class Virtual98 + public sealed partial class Virtual98 { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -64,7 +64,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } diff --git a/Aaru.Images/WCDiskImage/Identify.cs b/Aaru.Images/WCDiskImage/Identify.cs index 003e85ad9..e4349b5e2 100644 --- a/Aaru.Images/WCDiskImage/Identify.cs +++ b/Aaru.Images/WCDiskImage/Identify.cs @@ -38,7 +38,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class WCDiskImage + public sealed partial class WCDiskImage { public bool Identify(IFilter imageFilter) { @@ -79,12 +79,9 @@ namespace Aaru.DiscImages fheader.extraTracks[3] > 1) return false; - if(((byte)fheader.extraFlags & ~0x03) != 0) - return false; - // TODO: validate all sectors // For now, having a valid header will suffice. - return true; + return ((byte)fheader.extraFlags & ~0x03) == 0; } } } \ No newline at end of file diff --git a/Aaru.Images/WCDiskImage/Properties.cs b/Aaru.Images/WCDiskImage/Properties.cs index af131e4f1..3016d537e 100644 --- a/Aaru.Images/WCDiskImage/Properties.cs +++ b/Aaru.Images/WCDiskImage/Properties.cs @@ -38,7 +38,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class WCDiskImage + public sealed partial class WCDiskImage { public ImageInfo Info => _imageInfo; diff --git a/Aaru.Images/WCDiskImage/Read.cs b/Aaru.Images/WCDiskImage/Read.cs index 08b41143e..0313992dc 100644 --- a/Aaru.Images/WCDiskImage/Read.cs +++ b/Aaru.Images/WCDiskImage/Read.cs @@ -43,7 +43,7 @@ using Aaru.Helpers; namespace Aaru.DiscImages { - public partial class WCDiskImage + public sealed partial class WCDiskImage { public bool Open(IFilter imageFilter) { @@ -129,8 +129,7 @@ namespace Aaru.DiscImages Marshal.ByteArrayToStructureLittleEndian(sheaderBuffer); if(sheader.flag != SectorFlag.Comment) - throw new InvalidDataException(string.Format("Invalid sector type '{0}' encountered", - sheader.flag.ToString())); + throw new InvalidDataException($"Invalid sector type '{sheader.flag.ToString()}' encountered"); byte[] comm = new byte[sheader.crc]; stream.Read(comm, 0, sheader.crc); @@ -147,8 +146,7 @@ namespace Aaru.DiscImages Marshal.ByteArrayToStructureLittleEndian(sheaderBuffer); if(sheader.flag != SectorFlag.Directory) - throw new InvalidDataException(string.Format("Invalid sector type '{0}' encountered", - sheader.flag.ToString())); + throw new InvalidDataException($"Invalid sector type '{sheader.flag.ToString()}' encountered"); byte[] dir = new byte[sheader.crc]; stream.Read(dir, 0, sheader.crc); @@ -225,10 +223,7 @@ namespace Aaru.DiscImages sheader.head != head || sheader.sector != sect) throw new - InvalidDataException(string. - Format("Unexpected sector encountered. Found CHS {0},{1},{2} but expected {3},{4},{5}", - sheader.cylinder, sheader.head, sheader.sector, cyl, head, - sect)); + InvalidDataException($"Unexpected sector encountered. Found CHS {sheader.cylinder},{sheader.head},{sheader.sector} but expected {cyl},{head},{sect}"); sectorData = new byte[512]; @@ -273,8 +268,7 @@ namespace Aaru.DiscImages break; default: - throw new InvalidDataException(string.Format("Invalid sector type '{0}' encountered", - sheader.flag.ToString())); + throw new InvalidDataException($"Invalid sector type '{sheader.flag.ToString()}' encountered"); } } } diff --git a/Aaru.Images/WCDiskImage/Structs.cs b/Aaru.Images/WCDiskImage/Structs.cs index 1ccd7d314..4ac0f676c 100644 --- a/Aaru.Images/WCDiskImage/Structs.cs +++ b/Aaru.Images/WCDiskImage/Structs.cs @@ -35,7 +35,7 @@ using System.Runtime.InteropServices; namespace Aaru.DiscImages { - public partial class WCDiskImage + public sealed partial class WCDiskImage { /// The expected signature of a proper image file. const string _fileSignature = "WC DISK IMAGE\x1a\x1a"; diff --git a/Aaru.Images/WCDiskImage/Unsupported.cs b/Aaru.Images/WCDiskImage/Unsupported.cs index 6abf903a7..0c3a84c74 100644 --- a/Aaru.Images/WCDiskImage/Unsupported.cs +++ b/Aaru.Images/WCDiskImage/Unsupported.cs @@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions; namespace Aaru.DiscImages { - public partial class WCDiskImage + public sealed partial class WCDiskImage { public byte[] ReadDiskTag(MediaTagType tag) => throw new FeatureUnsupportedImageException("Feature not supported by image format"); diff --git a/Aaru.Images/WCDiskImage/WCDiskImage.cs b/Aaru.Images/WCDiskImage/WCDiskImage.cs index e4c3d2f67..d05fa1083 100644 --- a/Aaru.Images/WCDiskImage/WCDiskImage.cs +++ b/Aaru.Images/WCDiskImage/WCDiskImage.cs @@ -40,7 +40,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { [SuppressMessage("ReSharper", "NotAccessedField.Local")] - public partial class WCDiskImage : IMediaImage + public sealed partial class WCDiskImage : IMediaImage { public Dictionary<(int cylinder, int head, int sector), bool> badSectors = new Dictionary<(int cylinder, int head, int sector), bool>(); diff --git a/Aaru.Images/ZZZRawImage/Constants.cs b/Aaru.Images/ZZZRawImage/Constants.cs index 1565710ea..2ffb9239f 100644 --- a/Aaru.Images/ZZZRawImage/Constants.cs +++ b/Aaru.Images/ZZZRawImage/Constants.cs @@ -34,7 +34,7 @@ using Aaru.CommonTypes.Enums; namespace Aaru.DiscImages { - public partial class ZZZRawImage + public sealed partial class ZZZRawImage { readonly byte[] _cdSync = { diff --git a/Aaru.Images/ZZZRawImage/Helpers.cs b/Aaru.Images/ZZZRawImage/Helpers.cs index 6017844eb..696860ab6 100644 --- a/Aaru.Images/ZZZRawImage/Helpers.cs +++ b/Aaru.Images/ZZZRawImage/Helpers.cs @@ -34,7 +34,7 @@ using Aaru.CommonTypes; namespace Aaru.DiscImages { - public partial class ZZZRawImage + public sealed partial class ZZZRawImage { MediaType CalculateDiskType() { diff --git a/Aaru.Images/ZZZRawImage/Identify.cs b/Aaru.Images/ZZZRawImage/Identify.cs index 38b635f1b..58b6d2894 100644 --- a/Aaru.Images/ZZZRawImage/Identify.cs +++ b/Aaru.Images/ZZZRawImage/Identify.cs @@ -36,7 +36,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.DiscImages { - public partial class ZZZRawImage + public sealed partial class ZZZRawImage { public bool Identify(IFilter imageFilter) { diff --git a/Aaru.Images/ZZZRawImage/Properties.cs b/Aaru.Images/ZZZRawImage/Properties.cs index e95bdfe86..c4aacdea6 100644 --- a/Aaru.Images/ZZZRawImage/Properties.cs +++ b/Aaru.Images/ZZZRawImage/Properties.cs @@ -42,7 +42,7 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType; namespace Aaru.DiscImages { - public partial class ZZZRawImage + public sealed partial class ZZZRawImage { public OpticalImageCapabilities OpticalCapabilities => OpticalImageCapabilities.CanStoreAudioTracks | OpticalImageCapabilities.CanStoreDataTracks | diff --git a/Aaru.Images/ZZZRawImage/Read.cs b/Aaru.Images/ZZZRawImage/Read.cs index e0aeb7b63..fbb4c1aa4 100644 --- a/Aaru.Images/ZZZRawImage/Read.cs +++ b/Aaru.Images/ZZZRawImage/Read.cs @@ -55,7 +55,7 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType; namespace Aaru.DiscImages { - public partial class ZZZRawImage + public sealed partial class ZZZRawImage { public bool Open(IFilter imageFilter) { @@ -318,8 +318,7 @@ namespace Aaru.DiscImages var filters = new FiltersList(); IFilter filter = filters.GetFilter(basename + sidecar.name); - if(filter == null || - !filter.IsOpened()) + if(filter?.IsOpened() != true) continue; AaruConsole.DebugWriteLine("ZZZRawImage Plugin", "Found media tag {0}", sidecar.tag); diff --git a/Aaru.Images/ZZZRawImage/Verify.cs b/Aaru.Images/ZZZRawImage/Verify.cs index 9fa7c8b18..bc0fdd881 100644 --- a/Aaru.Images/ZZZRawImage/Verify.cs +++ b/Aaru.Images/ZZZRawImage/Verify.cs @@ -36,7 +36,7 @@ using Aaru.Checksums; namespace Aaru.DiscImages { - public partial class ZZZRawImage + public sealed partial class ZZZRawImage { public bool? VerifySector(ulong sectorAddress) { diff --git a/Aaru.Images/ZZZRawImage/Write.cs b/Aaru.Images/ZZZRawImage/Write.cs index ff79ee66e..85170545c 100644 --- a/Aaru.Images/ZZZRawImage/Write.cs +++ b/Aaru.Images/ZZZRawImage/Write.cs @@ -40,7 +40,7 @@ using Schemas; namespace Aaru.DiscImages { - public partial class ZZZRawImage + public sealed partial class ZZZRawImage { public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors, uint sectorSize) @@ -54,7 +54,7 @@ namespace Aaru.DiscImages if(!SupportedMediaTypes.Contains(mediaType)) { - ErrorMessage = $"Unsupport media format {mediaType}"; + ErrorMessage = $"Unsupported media format {mediaType}"; return false; } @@ -77,7 +77,7 @@ namespace Aaru.DiscImages return false; } - _basepath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)); + _basepath = Path.Combine(Path.GetDirectoryName(path) ?? "", Path.GetFileNameWithoutExtension(path)); _mediaTags = new Dictionary(); IsWriting = true; diff --git a/Aaru.Images/ZZZRawImage/ZZZRawImage.cs b/Aaru.Images/ZZZRawImage/ZZZRawImage.cs index dfc1f5962..21f5748cc 100644 --- a/Aaru.Images/ZZZRawImage/ZZZRawImage.cs +++ b/Aaru.Images/ZZZRawImage/ZZZRawImage.cs @@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs; namespace Aaru.DiscImages { - public partial class ZZZRawImage : IWritableOpticalImage + public sealed partial class ZZZRawImage : IWritableOpticalImage { string _basepath; bool _differentTrackZeroSize; diff --git a/Aaru.Partitions/Acorn.cs b/Aaru.Partitions/Acorn.cs index a7625132b..8cf90be78 100644 --- a/Aaru.Partitions/Acorn.cs +++ b/Aaru.Partitions/Acorn.cs @@ -41,7 +41,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { - public class Acorn : IPartition + public sealed class Acorn : IPartition { const ulong ADFS_SB_POS = 0xC00; const uint LINUX_MAGIC = 0xDEAFA1DE; diff --git a/Aaru.Partitions/AppleMap.cs b/Aaru.Partitions/AppleMap.cs index ceff8334a..3a9ff49bd 100644 --- a/Aaru.Partitions/AppleMap.cs +++ b/Aaru.Partitions/AppleMap.cs @@ -46,7 +46,7 @@ namespace Aaru.Partitions // Information about structures learnt from Inside Macintosh // Constants from image testing [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class AppleMap : IPartition + public sealed class AppleMap : IPartition { /// "ER", driver descriptor magic const ushort DDM_MAGIC = 0x4552; @@ -388,7 +388,7 @@ namespace Aaru.Partitions } else AaruConsole.DebugWriteLine("AppleMap Plugin", - "Not adding partition becaus start ({0}) is outside media size ({1})", + "Not adding partition because start ({0}) is outside media size ({1})", partition.Start, imagePlugin.Info.Sectors - 1); } @@ -400,7 +400,7 @@ namespace Aaru.Partitions { /// Signature public readonly ushort sbSig; - /// Byter per sector + /// Bytes per sector public readonly ushort sbBlockSize; /// Sectors of the disk public readonly uint sbBlocks; diff --git a/Aaru.Partitions/Apricot.cs b/Aaru.Partitions/Apricot.cs index 04436e14a..6c2798ad3 100644 --- a/Aaru.Partitions/Apricot.cs +++ b/Aaru.Partitions/Apricot.cs @@ -41,7 +41,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { - public class Apricot : IPartition + public sealed class Apricot : IPartition { readonly int[] baudRates = { diff --git a/Aaru.Partitions/Atari.cs b/Aaru.Partitions/Atari.cs index 5b6316dca..f5481aba8 100644 --- a/Aaru.Partitions/Atari.cs +++ b/Aaru.Partitions/Atari.cs @@ -41,7 +41,7 @@ using Aaru.Helpers; namespace Aaru.Partitions { - public class AtariPartitions : IPartition + public sealed class AtariPartitions : IPartition { const uint TypeGEMDOS = 0x0047454D; const uint TypeBigGEMDOS = 0x0042474D; diff --git a/Aaru.Partitions/BSD.cs b/Aaru.Partitions/BSD.cs index 9da4aa6d6..b85f2e0b0 100644 --- a/Aaru.Partitions/BSD.cs +++ b/Aaru.Partitions/BSD.cs @@ -44,7 +44,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class BSD : IPartition + public sealed class BSD : IPartition { const uint DISKMAGIC = 0x82564557; const uint DISKCIGAM = 0x57455682; diff --git a/Aaru.Partitions/DEC.cs b/Aaru.Partitions/DEC.cs index 0e18cb5a7..c622638ef 100644 --- a/Aaru.Partitions/DEC.cs +++ b/Aaru.Partitions/DEC.cs @@ -40,7 +40,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { - public class DEC : IPartition + public sealed class DEC : IPartition { const int PT_MAGIC = 0x032957; const int PT_VALID = 1; diff --git a/Aaru.Partitions/DragonFlyBSD.cs b/Aaru.Partitions/DragonFlyBSD.cs index 51e3b40b0..cf4f74453 100644 --- a/Aaru.Partitions/DragonFlyBSD.cs +++ b/Aaru.Partitions/DragonFlyBSD.cs @@ -41,7 +41,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class DragonFlyBSD : IPartition + public sealed class DragonFlyBSD : IPartition { const uint DISK_MAGIC64 = 0xC4464C59; diff --git a/Aaru.Partitions/GPT.cs b/Aaru.Partitions/GPT.cs index 1be7aba9a..fe4903cfb 100644 --- a/Aaru.Partitions/GPT.cs +++ b/Aaru.Partitions/GPT.cs @@ -44,7 +44,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class GuidPartitionTable : IPartition + public sealed class GuidPartitionTable : IPartition { const ulong GPT_MAGIC = 0x5452415020494645; const uint GPT_REVISION1 = 0x00010000; diff --git a/Aaru.Partitions/Human68k.cs b/Aaru.Partitions/Human68k.cs index 5d03425b3..469e97fec 100644 --- a/Aaru.Partitions/Human68k.cs +++ b/Aaru.Partitions/Human68k.cs @@ -42,7 +42,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { - public class Human68K : IPartition + public sealed class Human68K : IPartition { const uint X68K_MAGIC = 0x5836384B; diff --git a/Aaru.Partitions/MBR.cs b/Aaru.Partitions/MBR.cs index cd851c0b5..79f795885 100644 --- a/Aaru.Partitions/MBR.cs +++ b/Aaru.Partitions/MBR.cs @@ -44,7 +44,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { // TODO: Support AAP extensions - public class MBR : IPartition + public sealed class MBR : IPartition { const ulong GPT_MAGIC = 0x5452415020494645; diff --git a/Aaru.Partitions/NeXT.cs b/Aaru.Partitions/NeXT.cs index 2f9e4ec6c..8169bb94c 100644 --- a/Aaru.Partitions/NeXT.cs +++ b/Aaru.Partitions/NeXT.cs @@ -46,7 +46,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { [SuppressMessage("ReSharper", "UnusedMember.Local"), SuppressMessage("ReSharper", "UnusedType.Local")] - public class NeXTDisklabel : IPartition + public sealed class NeXTDisklabel : IPartition { /// "NeXT" const uint NEXT_MAGIC1 = 0x4E655854; diff --git a/Aaru.Partitions/PC98.cs b/Aaru.Partitions/PC98.cs index e5ec5383b..b0ef9c21d 100644 --- a/Aaru.Partitions/PC98.cs +++ b/Aaru.Partitions/PC98.cs @@ -42,7 +42,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { - public class PC98 : IPartition + public sealed class PC98 : IPartition { public string Name => "NEC PC-9800 partition table"; public Guid Id => new Guid("27333401-C7C2-447D-961C-22AD0641A09A"); diff --git a/Aaru.Partitions/Plan9.cs b/Aaru.Partitions/Plan9.cs index c33742fb9..25dd254be 100644 --- a/Aaru.Partitions/Plan9.cs +++ b/Aaru.Partitions/Plan9.cs @@ -44,7 +44,7 @@ namespace Aaru.Partitions // "part type start end\n" // One line per partition, start and end relative to offset // e.g.: "part nvram 10110 10112\npart fossil 10112 3661056\n" - public class Plan9 : IPartition + public sealed class Plan9 : IPartition { public string Name => "Plan9 partition table"; public Guid Id => new Guid("F0BF4FFC-056E-4E7C-8B65-4EAEE250ADD9"); diff --git a/Aaru.Partitions/RDB.cs b/Aaru.Partitions/RDB.cs index 19a091fef..f854330fa 100644 --- a/Aaru.Partitions/RDB.cs +++ b/Aaru.Partitions/RDB.cs @@ -46,7 +46,7 @@ using Aaru.Helpers; namespace Aaru.Partitions { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class AmigaRigidDiskBlock : IPartition + public sealed class AmigaRigidDiskBlock : IPartition { /// RDB magic number "RDSK" const uint RIGID_DISK_BLOCK_MAGIC = 0x5244534B; diff --git a/Aaru.Partitions/Register.cs b/Aaru.Partitions/Register.cs index 9b5d08f16..5db7d8630 100644 --- a/Aaru.Partitions/Register.cs +++ b/Aaru.Partitions/Register.cs @@ -44,7 +44,7 @@ using Aaru.CommonTypes.Interfaces; namespace Aaru.Partitions { - public class Register : IPluginRegister + public sealed class Register : IPluginRegister { public List GetAllChecksumPlugins() => null; diff --git a/Aaru.Partitions/RioKarma.cs b/Aaru.Partitions/RioKarma.cs index 9bd282336..a92094e40 100644 --- a/Aaru.Partitions/RioKarma.cs +++ b/Aaru.Partitions/RioKarma.cs @@ -40,7 +40,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { - public class RioKarma : IPartition + public sealed class RioKarma : IPartition { const ushort KARMA_MAGIC = 0xAB56; const byte ENTRY_MAGIC = 0x4D; diff --git a/Aaru.Partitions/SGI.cs b/Aaru.Partitions/SGI.cs index d584e4dda..ba709f50e 100644 --- a/Aaru.Partitions/SGI.cs +++ b/Aaru.Partitions/SGI.cs @@ -46,7 +46,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { [SuppressMessage("ReSharper", "InconsistentNaming")] - public class SGI : IPartition + public sealed class SGI : IPartition { const int SGI_MAGIC = 0x0BE5A941; diff --git a/Aaru.Partitions/Sun.cs b/Aaru.Partitions/Sun.cs index 9b6cf28fd..eba506e3d 100644 --- a/Aaru.Partitions/Sun.cs +++ b/Aaru.Partitions/Sun.cs @@ -44,7 +44,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { [SuppressMessage("ReSharper", "InconsistentNaming")] - public class SunDisklabel : IPartition + public sealed class SunDisklabel : IPartition { /// Sun disklabel magic number const ushort DKL_MAGIC = 0xDABE; diff --git a/Aaru.Partitions/UNIX.cs b/Aaru.Partitions/UNIX.cs index 2a4a6f5a1..e964e6d88 100644 --- a/Aaru.Partitions/UNIX.cs +++ b/Aaru.Partitions/UNIX.cs @@ -41,7 +41,7 @@ namespace Aaru.Partitions // These partitions are hardwired in kernel sources for some UNIX versions predating System V. // They depend on exact device, indeed the kernel chooses what to use depending on the disk driver, so that's what we do. // Currently only DEC devices used in Ultrix are added, probably it's missing a lot of entries. - public class UNIX : IPartition + public sealed class UNIX : IPartition { readonly Partition[] RA60 = { diff --git a/Aaru.Partitions/VTOC.cs b/Aaru.Partitions/VTOC.cs index 6c7c412a4..99235a00c 100644 --- a/Aaru.Partitions/VTOC.cs +++ b/Aaru.Partitions/VTOC.cs @@ -44,7 +44,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class VTOC : IPartition + public sealed class VTOC : IPartition { const uint PD_MAGIC = 0xCA5E600D; const uint VTOC_SANE = 0x600DDEEE; diff --git a/Aaru.Partitions/XENIX.cs b/Aaru.Partitions/XENIX.cs index a8fa011e1..8bbf26dfa 100644 --- a/Aaru.Partitions/XENIX.cs +++ b/Aaru.Partitions/XENIX.cs @@ -40,7 +40,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { // TODO: Find better documentation, this is working for XENIX 2 but not for SCO OpenServer... - public class XENIX : IPartition + public sealed class XENIX : IPartition { const ushort PAMAGIC = 0x1234; const int MAXPARTS = 16; diff --git a/Aaru.Partitions/Xbox.cs b/Aaru.Partitions/Xbox.cs index 9213dfc8b..d703cc7de 100644 --- a/Aaru.Partitions/Xbox.cs +++ b/Aaru.Partitions/Xbox.cs @@ -41,7 +41,7 @@ using Marshal = Aaru.Helpers.Marshal; namespace Aaru.Partitions { [SuppressMessage("ReSharper", "UnusedMember.Local")] - public class Xbox : IPartition + public sealed class Xbox : IPartition { const uint XboxCigam = 0x46415458; const uint XboxMagic = 0x58544146; @@ -53,7 +53,6 @@ namespace Aaru.Partitions const long Xbox360SysExt2Off = 0x118EB0000; const long Xbox360CompatOff = 0x120EB0000; const long Xbox360DataOff = 0x130EB0000; - const long Xbox360SecuritySectorLen = 0x80000; const long Xbox360SystemCacheLen = 0x80000000; const long Xbox360GameCacheLen = 0xA0E30000; diff --git a/Aaru.Tests/Devices/IomegaJaz.cs b/Aaru.Tests/Devices/IomegaJaz.cs index b8f49c442..260a98422 100644 --- a/Aaru.Tests/Devices/IomegaJaz.cs +++ b/Aaru.Tests/Devices/IomegaJaz.cs @@ -38,12 +38,12 @@ namespace Aaru.Tests.Devices [TestFixture] public class IomegaJaz { - readonly string[] _testfiles = + readonly string[] _testFiles = { "jaz1.bin.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.Jaz }; @@ -53,7 +53,7 @@ namespace Aaru.Tests.Devices 2091050 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -61,16 +61,16 @@ namespace Aaru.Tests.Devices [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Device test dumps", "JAZ", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Device test dumps", "JAZ", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); } } } diff --git a/Aaru.Tests/Devices/LS120.cs b/Aaru.Tests/Devices/LS120.cs index 298b8e3d7..7f4a68ead 100644 --- a/Aaru.Tests/Devices/LS120.cs +++ b/Aaru.Tests/Devices/LS120.cs @@ -38,12 +38,12 @@ namespace Aaru.Tests.Devices [TestFixture] public class Ls120 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "ls120.bin.lz", "mf2dd.bin.lz", "mf2hd.bin.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.LS120, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD }; @@ -53,7 +53,7 @@ namespace Aaru.Tests.Devices 246528, 1440, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512 }; @@ -61,16 +61,16 @@ namespace Aaru.Tests.Devices [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Device test dumps", "LS-120", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Device test dumps", "LS-120", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); } } } diff --git a/Aaru.Tests/Devices/PocketZip.cs b/Aaru.Tests/Devices/PocketZip.cs index 7bfa324a4..85ac720de 100644 --- a/Aaru.Tests/Devices/PocketZip.cs +++ b/Aaru.Tests/Devices/PocketZip.cs @@ -38,12 +38,12 @@ namespace Aaru.Tests.Devices [TestFixture] public class PocketZip { - readonly string[] _testfiles = + readonly string[] _testFiles = { "clik!.bin.lz", "pocketzip.bin.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.PocketZip, MediaType.PocketZip }; @@ -53,7 +53,7 @@ namespace Aaru.Tests.Devices 78882, 78882 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -61,16 +61,16 @@ namespace Aaru.Tests.Devices [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Device test dumps", "PocketZIP", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Device test dumps", "PocketZIP", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/ADFS.cs b/Aaru.Tests/Filesystems/ADFS.cs index f1c34f66b..b8a882846 100644 --- a/Aaru.Tests/Filesystems/ADFS.cs +++ b/Aaru.Tests/Filesystems/ADFS.cs @@ -39,13 +39,13 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Adfs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "adfs_d.adf.lz", "adfs_e.adf.lz", "adfs_f.adf.lz", "adfs_e+.adf.lz", "adfs_f+.adf.lz", "adfs_s.adf.lz", "adfs_m.adf.lz", "adfs_l.adf.lz", "hdd_old.hdf.lz", "hdd_new.hdf.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.ACORN_35_DS_DD, MediaType.ACORN_35_DS_DD, MediaType.ACORN_35_DS_HD, MediaType.ACORN_35_DS_DD, MediaType.ACORN_35_DS_HD, MediaType.ACORN_525_SS_DD_40, MediaType.ACORN_525_SS_DD_80, @@ -57,7 +57,7 @@ namespace Aaru.Tests.Filesystems 800, 800, 1600, 800, 1600, 640, 1280, 2560, 78336, 78336 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 1024, 1024, 1024, 1024, 1024, 256, 256, 256, 256, 256 }; @@ -72,17 +72,17 @@ namespace Aaru.Tests.Filesystems 800, 800, 1600, 800, 1600, 640, 1280, 2560, 78336, 78336 }; - readonly uint[] _clustersize = + readonly uint[] _clusterSize = { 1024, 1024, 1024, 1024, 1024, 256, 256, 256, 256, 256 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "ADFSD", "ADFSE ", null, "ADFSE+ ", null, "$", "$", "$", "VolLablOld", null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "3E48", "E13A", null, "1142", null, "F20D", "D6CA", "0CA6", "080E", null }; @@ -90,18 +90,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "Acorn Advanced Disc Filing System", _testfiles[i]); + "Acorn Advanced Disc Filing System", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new AcornADFS(); var wholePart = new Partition @@ -111,14 +111,14 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_bootable[i], fs.XmlFsType.Bootable, _testfiles[i]); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Acorn Advanced Disc Filing System", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_bootable[i], fs.XmlFsType.Bootable, _testFiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Acorn Advanced Disc Filing System", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/AFFS.cs b/Aaru.Tests/Filesystems/AFFS.cs index 2a8df27f4..41197deab 100644 --- a/Aaru.Tests/Filesystems/AFFS.cs +++ b/Aaru.Tests/Filesystems/AFFS.cs @@ -40,12 +40,12 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Affs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD }; @@ -55,7 +55,7 @@ namespace Aaru.Tests.Filesystems 1760, 1760 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -65,17 +65,17 @@ namespace Aaru.Tests.Filesystems 1760, 1760 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "A5D9FAE2", "A5DA0CC9" }; @@ -83,18 +83,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new AmigaDOSPlugin(); var wholePart = new Partition @@ -104,13 +104,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -118,7 +118,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class AffsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "aros.aif", "aros_intl.aif" }; @@ -128,7 +128,7 @@ namespace Aaru.Tests.Filesystems 409600, 409600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -138,17 +138,17 @@ namespace Aaru.Tests.Filesystems 408240, 408240 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "A582DCA4", "A582BC91" }; @@ -156,17 +156,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AmigaDOSPlugin(); int part = -1; @@ -180,14 +180,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -195,7 +195,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class AffsMbrRdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "aros.aif", "aros_intl.aif" }; @@ -205,7 +205,7 @@ namespace Aaru.Tests.Filesystems 409600, 409600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -215,17 +215,17 @@ namespace Aaru.Tests.Filesystems 406224, 406224 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "A58348CE", "A5833CD0" }; @@ -233,17 +233,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "Amiga Fast File System (MBR+RDB)", _testfiles[i]); + "Amiga Fast File System (MBR+RDB)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AmigaDOSPlugin(); int part = -1; @@ -257,14 +257,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -272,7 +272,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class AffsRdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amigaos_3.9.aif", "amigaos_3.9_intl.aif", "aros.aif", "aros_intl.aif", "amigaos_4.0.aif", "amigaos_4.0_intl.aif", "amigaos_4.0_cache.aif" @@ -283,7 +283,7 @@ namespace Aaru.Tests.Filesystems 1024128, 1024128, 409600, 409600, 1024128, 1024128, 1024128 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512 }; @@ -293,18 +293,18 @@ namespace Aaru.Tests.Filesystems 510032, 510032, 407232, 407232, 511040, 511040, 511040 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 512, 512, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "A56D0F5C", "A56D049C", "A58307A9", "A58304BE", "A56CC7EE", "A56CDDC4", "A56CC133" }; @@ -312,17 +312,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System (RDB)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AmigaDOSPlugin(); int part = -1; @@ -337,14 +337,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/AFFS2.cs b/Aaru.Tests/Filesystems/AFFS2.cs index 673570cac..cabd0038a 100644 --- a/Aaru.Tests/Filesystems/AFFS2.cs +++ b/Aaru.Tests/Filesystems/AFFS2.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Affs2Rdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amigaos_4.0.aif" }; @@ -50,7 +50,7 @@ namespace Aaru.Tests.Filesystems 1024128 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -60,17 +60,17 @@ namespace Aaru.Tests.Filesystems 511040 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "611D85E5" }; @@ -78,17 +78,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System 2 (RDB)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AmigaDOSPlugin(); int part = -1; @@ -101,14 +101,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Amiga FFS2", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Amiga FFS2", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/AFS.cs b/Aaru.Tests/Filesystems/AFS.cs index 146aff82c..5a9223ac9 100644 --- a/Aaru.Tests/Filesystems/AFS.cs +++ b/Aaru.Tests/Filesystems/AFS.cs @@ -40,14 +40,14 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Afs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", "scoopenserver_5.0.7hw_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD }; @@ -57,7 +57,7 @@ namespace Aaru.Tests.Filesystems 3360, 2400, 1440, 5760, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512 }; @@ -67,17 +67,17 @@ namespace Aaru.Tests.Filesystems 1680, 1200, 720, 2880, 1440 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "", "", "", "", "" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null }; @@ -91,18 +91,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Acer File System", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new SysVfs(); var wholePart = new Partition @@ -112,13 +112,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -126,7 +126,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class AfsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "scoopenserver_5.0.7hw.aif" }; @@ -136,7 +136,7 @@ namespace Aaru.Tests.Filesystems 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -146,17 +146,17 @@ namespace Aaru.Tests.Filesystems 510048 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null }; @@ -169,17 +169,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Acer File System (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SysVfs(); int part = -1; @@ -192,14 +192,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/AOFS.cs b/Aaru.Tests/Filesystems/AOFS.cs index 434297c49..4d48c2091 100644 --- a/Aaru.Tests/Filesystems/AOFS.cs +++ b/Aaru.Tests/Filesystems/AOFS.cs @@ -40,12 +40,12 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Aofs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD }; @@ -55,7 +55,7 @@ namespace Aaru.Tests.Filesystems 1760, 1760 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -65,17 +65,17 @@ namespace Aaru.Tests.Filesystems 1760, 1760 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "A5D9FE71", "A5D9F14F" }; @@ -83,18 +83,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new AmigaDOSPlugin(); var wholePart = new Partition @@ -104,13 +104,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -118,7 +118,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class AofsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "aros.aif", "aros_intl.aif" }; @@ -128,7 +128,7 @@ namespace Aaru.Tests.Filesystems 409600, 409600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -138,17 +138,17 @@ namespace Aaru.Tests.Filesystems 408240, 408240 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "A582C90C", "A582CE0D" }; @@ -156,17 +156,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AmigaDOSPlugin(); int part = -1; @@ -179,14 +179,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -194,7 +194,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class AofsMbrRdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "aros.aif", "aros_intl.aif" }; @@ -204,7 +204,7 @@ namespace Aaru.Tests.Filesystems 409600, 409600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -214,17 +214,17 @@ namespace Aaru.Tests.Filesystems 406224, 406224 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "A5833C5B", "A5833085" }; @@ -232,17 +232,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (MBR+RDB)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AmigaDOSPlugin(); int part = -1; @@ -255,14 +255,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -270,7 +270,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class AofsRdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amigaos_3.9.aif", "amigaos_3.9_intl.aif", "aros.aif", "aros_intl.aif" }; @@ -280,7 +280,7 @@ namespace Aaru.Tests.Filesystems 1024128, 1024128, 409600, 409600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512 }; @@ -290,17 +290,17 @@ namespace Aaru.Tests.Filesystems 510032, 510032, 407232, 407232 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label", "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "A56D13BB", "A56D0415", "A582F3A0", "A5830B06" }; @@ -308,17 +308,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (RDB)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AmigaDOSPlugin(); int part = -1; @@ -333,14 +333,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/Atheos.cs b/Aaru.Tests/Filesystems/Atheos.cs index c78071972..96ff883cc 100644 --- a/Aaru.Tests/Filesystems/Atheos.cs +++ b/Aaru.Tests/Filesystems/Atheos.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class AtheosMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "syllable_0.6.7.aif" }; @@ -50,7 +50,7 @@ namespace Aaru.Tests.Filesystems 4194304 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -60,17 +60,17 @@ namespace Aaru.Tests.Filesystems 2097120 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; @@ -78,15 +78,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "AtheOS (MBR)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "AtheOS (MBR)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AtheOS(); int part = -1; @@ -99,14 +99,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("AtheOS filesystem", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("AtheOS filesystem", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/BeFS.cs b/Aaru.Tests/Filesystems/BeFS.cs index 0c607dd40..56b228f3d 100644 --- a/Aaru.Tests/Filesystems/BeFS.cs +++ b/Aaru.Tests/Filesystems/BeFS.cs @@ -40,12 +40,12 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class BeFs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "beos_r3.1.img.lz", "beos_r4.5.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DOS_35_HD, MediaType.DOS_35_HD }; @@ -55,7 +55,7 @@ namespace Aaru.Tests.Filesystems 2880, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -65,22 +65,22 @@ namespace Aaru.Tests.Filesystems 1440, 1440 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null }; - readonly string[] _oemid = + readonly string[] _oemId = { null, null }; @@ -88,16 +88,16 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new BeFS(); var wholePart = new Partition @@ -107,14 +107,14 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -122,7 +122,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class BeFsApm { - readonly string[] _testfiles = + readonly string[] _testFiles = { "beos_r3.1.aif", "beos_r4.5.aif" }; @@ -132,7 +132,7 @@ namespace Aaru.Tests.Filesystems 1572864, 1572864 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -142,22 +142,22 @@ namespace Aaru.Tests.Filesystems 786336, 786336 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null }; - readonly string[] _oemid = + readonly string[] _oemId = { null, null }; @@ -165,17 +165,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (APM)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new BeFS(); int part = -1; @@ -188,15 +188,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -204,7 +204,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class BeFsGpt { - readonly string[] _testfiles = + readonly string[] _testFiles = { "haiku_hrev51259.aif" }; @@ -214,7 +214,7 @@ namespace Aaru.Tests.Filesystems 8388608 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -224,17 +224,17 @@ namespace Aaru.Tests.Filesystems 2096640 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 2048 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null }; @@ -242,17 +242,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (GPT)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new BeFS(); int part = -1; @@ -265,14 +265,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -280,7 +280,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class BeFsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "beos_r3.1.aif", "beos_r4.5.aif", "haiku_hrev51259.aif", "syllable_0.6.7.aif" }; @@ -290,7 +290,7 @@ namespace Aaru.Tests.Filesystems 1572864, 1572864, 8388608, 2097152 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512 }; @@ -300,17 +300,17 @@ namespace Aaru.Tests.Filesystems 786400, 785232, 2096640, 524272 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 2048, 2048 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label", "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null }; @@ -318,17 +318,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new BeFS(); int part = -1; @@ -341,14 +341,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/COHERENT.cs b/Aaru.Tests/Filesystems/COHERENT.cs index 2d87f7b5b..865674685 100644 --- a/Aaru.Tests/Filesystems/COHERENT.cs +++ b/Aaru.Tests/Filesystems/COHERENT.cs @@ -40,13 +40,13 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Coherent { - readonly string[] _testfiles = + readonly string[] _testFiles = { "coherentunix_4.2.10_dsdd.img.lz", "coherentunix_4.2.10_dshd.img.lz", "coherentunix_4.2.10_mf2dd.img.lz", "coherentunix_4.2.10_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD }; @@ -56,7 +56,7 @@ namespace Aaru.Tests.Filesystems 720, 2400, 1440, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512 }; @@ -66,17 +66,17 @@ namespace Aaru.Tests.Filesystems 720, 2400, 1440, 2880 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512, 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "noname", "noname", "noname", "noname" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null }; @@ -89,18 +89,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "COHERENT filesystem", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new SysVfs(); var wholePart = new Partition @@ -110,13 +110,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -124,7 +124,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class CoherentMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "coherentunix_4.2.10.aif" }; @@ -134,7 +134,7 @@ namespace Aaru.Tests.Filesystems 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -144,17 +144,17 @@ namespace Aaru.Tests.Filesystems 510048 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; @@ -167,17 +167,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "COHERENT filesystem (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SysVfs(); int part = -1; @@ -190,14 +190,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/DTFS.cs b/Aaru.Tests/Filesystems/DTFS.cs index 7018f0d6a..26be52e97 100644 --- a/Aaru.Tests/Filesystems/DTFS.cs +++ b/Aaru.Tests/Filesystems/DTFS.cs @@ -40,14 +40,14 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Dtfs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", "scoopenserver_5.0.7hw_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD }; @@ -57,7 +57,7 @@ namespace Aaru.Tests.Filesystems 3360, 2400, 1440, 5760, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512 }; @@ -67,17 +67,17 @@ namespace Aaru.Tests.Filesystems 1680, 1200, 720, 2880, 1440 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "", "", "", "", "" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null }; @@ -90,16 +90,16 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "DTFS", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "DTFS", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new SysVfs(); var wholePart = new Partition @@ -109,13 +109,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -123,7 +123,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class DtfsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "scoopenserver_5.0.7hw.aif" }; @@ -133,7 +133,7 @@ namespace Aaru.Tests.Filesystems 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -143,17 +143,17 @@ namespace Aaru.Tests.Filesystems 510048 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; @@ -166,15 +166,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "DTFS (MBR)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "DTFS (MBR)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SysVfs(); int part = -1; @@ -187,14 +187,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/EAFS.cs b/Aaru.Tests/Filesystems/EAFS.cs index 53671631d..1bc7bc968 100644 --- a/Aaru.Tests/Filesystems/EAFS.cs +++ b/Aaru.Tests/Filesystems/EAFS.cs @@ -40,14 +40,14 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Eafs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", "scoopenserver_5.0.7hw_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD }; @@ -57,7 +57,7 @@ namespace Aaru.Tests.Filesystems 3360, 2400, 1440, 5760, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512 }; @@ -67,17 +67,17 @@ namespace Aaru.Tests.Filesystems 1680, 1200, 720, 2880, 1440 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "", "", "", "", "" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null }; @@ -91,16 +91,16 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "EAFS", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "EAFS", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new SysVfs(); var wholePart = new Partition @@ -110,13 +110,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -124,7 +124,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class EafsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "scoopenserver_5.0.7hw.aif" }; @@ -134,7 +134,7 @@ namespace Aaru.Tests.Filesystems 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -144,17 +144,17 @@ namespace Aaru.Tests.Filesystems 510048 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; @@ -167,15 +167,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "EAFS (MBR)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "EAFS (MBR)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SysVfs(); int part = -1; @@ -188,14 +188,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/F2FS.cs b/Aaru.Tests/Filesystems/F2FS.cs index ed672c5b6..cd2d10da1 100644 --- a/Aaru.Tests/Filesystems/F2FS.cs +++ b/Aaru.Tests/Filesystems/F2FS.cs @@ -41,7 +41,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class F2Fs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif", "linux_4.19_f2fs_flashdrive.aif" }; @@ -51,7 +51,7 @@ namespace Aaru.Tests.Filesystems 262144, 2097152 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -61,17 +61,17 @@ namespace Aaru.Tests.Filesystems 32512, 261888 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VolumeLabel", "DicSetter" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "81bd3a4e-de0c-484c-becc-aaa479b2070a", "422bd2a8-68ab-6f45-9a04-9c264d07dd6e" }; @@ -79,17 +79,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "F2FS", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "F2FS", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IPartition parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), _testfiles[i]); + Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), _testFiles[i]); IFilesystem fs = new F2FS(); int part = -1; @@ -101,14 +101,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("F2FS filesystem", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("F2FS filesystem", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/FAT12.cs b/Aaru.Tests/Filesystems/FAT12.cs index 01ba72488..f5438c0c4 100644 --- a/Aaru.Tests/Filesystems/FAT12.cs +++ b/Aaru.Tests/Filesystems/FAT12.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat12 { - readonly string[] _testfiles = + readonly string[] _testFiles = { // Concurrent DOS 6.00 "concurrentdos_6.00_dshd.img.lz", "concurrentdos_6.00_mf2dd.img.lz", "concurrentdos_6.00_mf2hd.img.lz", @@ -375,7 +375,7 @@ namespace Aaru.Tests.Filesystems "geos41_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { // Concurrent DOS 6.00 MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, @@ -963,7 +963,7 @@ namespace Aaru.Tests.Filesystems 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { // Concurrent DOS 6.00 512, 512, 512, @@ -1503,7 +1503,7 @@ namespace Aaru.Tests.Filesystems 2880 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { // Concurrent DOS 6.00 512, 1024, 512, @@ -1773,7 +1773,7 @@ namespace Aaru.Tests.Filesystems 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { // Concurrent DOS 6.00 null, null, null, @@ -2049,7 +2049,7 @@ namespace Aaru.Tests.Filesystems "GEOS41" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { // Concurrent DOS 6.00 null, null, null, @@ -2319,7 +2319,7 @@ namespace Aaru.Tests.Filesystems "8D684C67" }; - readonly string[] _oemid = + readonly string[] _oemId = { // Concurrent DOS 6.00 "DIGITAL ", "DIGITAL ", "DIGITAL ", @@ -2592,16 +2592,16 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new FAT(); var wholePart = new Partition @@ -2611,14 +2611,14 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -2626,7 +2626,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat12Apm { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif" }; @@ -2636,7 +2636,7 @@ namespace Aaru.Tests.Filesystems 16384 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -2646,22 +2646,22 @@ namespace Aaru.Tests.Filesystems 4076 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 2048 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VOLUMELABEL" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "32181F09" }; - readonly string[] _oemid = + readonly string[] _oemId = { "BSD 4.4" }; @@ -2669,15 +2669,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (APM)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (APM)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; @@ -2690,15 +2690,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -2706,7 +2706,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat12Gpt { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif" }; @@ -2716,7 +2716,7 @@ namespace Aaru.Tests.Filesystems 16384 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -2726,22 +2726,22 @@ namespace Aaru.Tests.Filesystems 4076 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 2048 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VOLUMELABEL" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "66901F1B" }; - readonly string[] _oemid = + readonly string[] _oemId = { "BSD 4.4" }; @@ -2749,15 +2749,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (GPT)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (GPT)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; @@ -2770,15 +2770,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -2786,7 +2786,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat12Mbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "compaqmsdos331.aif", "drdos_3.40.aif", "drdos_3.41.aif", "drdos_5.00.aif", "drdos_6.00.aif", "drdos_7.02.aif", "drdos_7.03.aif", "drdos_8.00.aif", "msdos331.aif", "msdos401.aif", "msdos500.aif", @@ -2810,7 +2810,7 @@ namespace Aaru.Tests.Filesystems 16384, 16384 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, @@ -2825,7 +2825,7 @@ namespace Aaru.Tests.Filesystems 2044, 2044, 4016, 3072, 2040, 3584, 2044, 2044, 2044 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, @@ -2833,7 +2833,7 @@ namespace Aaru.Tests.Filesystems 4096, 4096, 2048, 2048, 4096, 2048, 4096, 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", @@ -2846,7 +2846,7 @@ namespace Aaru.Tests.Filesystems "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null, null, null, "1BFB1273", null, "407D1907", "345D18FB", "332518F4", "395718E9", "076718EF", "1371181B", "23281816", "2F781809", null, null, "294F100F", null, null, null, null, null, @@ -2857,7 +2857,7 @@ namespace Aaru.Tests.Filesystems "02140E0B" }; - readonly string[] _oemid = + readonly string[] _oemId = { "IBM 3.3", "IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3", "MSDOS4.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "IBM 3.3", @@ -2871,25 +2871,25 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (MBR)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (MBR)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); - Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testFiles[i]); fs.GetInformation(image, partitions[0], out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -2897,12 +2897,12 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat12Human { - readonly string[] _testfiles = + readonly string[] _testFiles = { "diska.aif", "diskb.aif" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.SHARP_525, MediaType.SHARP_525 }; @@ -2912,7 +2912,7 @@ namespace Aaru.Tests.Filesystems 1232, 1232 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 1024, 1024 }; @@ -2922,22 +2922,22 @@ namespace Aaru.Tests.Filesystems 1232, 1232 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null }; - readonly string[] _oemid = + readonly string[] _oemId = { "Hudson soft 2.00", "Hudson soft 2.00" }; @@ -2945,18 +2945,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (Human68K)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new FAT(); var wholePart = new Partition @@ -2966,14 +2966,14 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/FAT16.cs b/Aaru.Tests/Filesystems/FAT16.cs index 1e9c4f296..f6ab55ef2 100644 --- a/Aaru.Tests/Filesystems/FAT16.cs +++ b/Aaru.Tests/Filesystems/FAT16.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat16 { - readonly string[] _testfiles = + readonly string[] _testFiles = { // MS-DOS 3.30A "msdos_3.30A_mf2ed.img.lz", @@ -49,7 +49,7 @@ namespace Aaru.Tests.Filesystems "msdos_3.31_mf2ed.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { // MS-DOS 3.30A MediaType.DOS_35_ED, @@ -67,7 +67,7 @@ namespace Aaru.Tests.Filesystems 5760 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { // MS-DOS 3.30A 512, @@ -85,7 +85,7 @@ namespace Aaru.Tests.Filesystems 5760 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { // MS-DOS 3.30A 512, @@ -94,7 +94,7 @@ namespace Aaru.Tests.Filesystems 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { // MS-DOS 3.30A null, @@ -103,7 +103,7 @@ namespace Aaru.Tests.Filesystems null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { // MS-DOS 3.30A null, @@ -112,7 +112,7 @@ namespace Aaru.Tests.Filesystems null }; - readonly string[] _oemid = + readonly string[] _oemId = { // MS-DOS 3.30A "MSDOS3.3", @@ -124,16 +124,16 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new FAT(); var wholePart = new Partition @@ -143,14 +143,14 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -158,7 +158,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat16Apm { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif" }; @@ -168,7 +168,7 @@ namespace Aaru.Tests.Filesystems 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -178,22 +178,22 @@ namespace Aaru.Tests.Filesystems 63995 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 8192 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VOLUMELABEL" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "063D1F09" }; - readonly string[] _oemid = + readonly string[] _oemId = { "BSD 4.4" }; @@ -201,15 +201,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (APM)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (APM)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; @@ -222,15 +222,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -238,7 +238,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat16Atari { - readonly string[] _testfiles = + readonly string[] _testFiles = { "tos_1.04.aif", "tos_1.04_small.aif" }; @@ -248,7 +248,7 @@ namespace Aaru.Tests.Filesystems 81920, 16384 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -258,22 +258,22 @@ namespace Aaru.Tests.Filesystems 10239, 8191 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "BA9831", "2019E1" }; - readonly string[] _oemid = + readonly string[] _oemId = { null, null }; @@ -281,15 +281,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (Atari)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (Atari)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; @@ -303,15 +303,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -319,7 +319,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat16Gpt { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif" }; @@ -329,7 +329,7 @@ namespace Aaru.Tests.Filesystems 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -339,22 +339,22 @@ namespace Aaru.Tests.Filesystems 63995 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 8192 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VOLUMELABEL" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "2E8A1F1B" }; - readonly string[] _oemid = + readonly string[] _oemId = { "BSD 4.4" }; @@ -362,15 +362,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (GPT)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (GPT)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; @@ -383,15 +383,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -399,7 +399,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat16Mbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "drdos_3.40.aif", "drdos_3.41.aif", "drdos_5.00.aif", "drdos_6.00.aif", "drdos_7.02.aif", "drdos_7.03.aif", "drdos_8.00.aif", "msdos331.aif", "msdos401.aif", "msdos500.aif", "msdos600.aif", "msdos620rc1.aif", @@ -425,7 +425,7 @@ namespace Aaru.Tests.Filesystems 1024000, 1024000, 1024000, 1024000, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, @@ -442,7 +442,7 @@ namespace Aaru.Tests.Filesystems 63941, 63882, 63941, 63872, 63872 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, @@ -450,7 +450,7 @@ namespace Aaru.Tests.Filesystems 8192, 8192, 16384, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", @@ -464,7 +464,7 @@ namespace Aaru.Tests.Filesystems "DICSETTER", "DICSETTER" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null, null, "1BFB0748", null, "217B1909", "0C6D18FC", "382B18F4", "3E2018E9", "0D2418EF", "195A181B", "27761816", "356B1809", null, null, "2272100F", "07280FE1", "1F630FF9", "18340FFE", @@ -475,7 +475,7 @@ namespace Aaru.Tests.Filesystems "27761816", "27761816", "27761816", "66AAF014", "5CC78D47", "A552A493", "FCC308A7" }; - readonly string[] _oemid = + readonly string[] _oemId = { "IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3", "MSDOS4.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "IBM 3.3", "IBM 3.3", @@ -490,25 +490,25 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (MBR)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (MBR)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); - Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testFiles[i]); fs.GetInformation(image, partitions[0], out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -516,7 +516,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat16Rdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amigaos_3.9.aif" }; @@ -526,7 +526,7 @@ namespace Aaru.Tests.Filesystems 1024128 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -536,22 +536,22 @@ namespace Aaru.Tests.Filesystems 63689 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 8192 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VOLUMELABEL" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "374D40D1" }; - readonly string[] _oemid = + readonly string[] _oemId = { "CDP 5.0" }; @@ -559,15 +559,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (RDB)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (RDB)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; @@ -580,15 +580,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -596,7 +596,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat16Human { - readonly string[] _testfiles = + readonly string[] _testFiles = { "sasidisk.aif", "scsidisk.aif" }; @@ -606,7 +606,7 @@ namespace Aaru.Tests.Filesystems 162096, 204800 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 256, 512 }; @@ -616,22 +616,22 @@ namespace Aaru.Tests.Filesystems 40510, 102367 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null }; - readonly string[] _oemid = + readonly string[] _oemId = { "Hudson soft 2.00", " Hero Soft V1.10" }; @@ -639,17 +639,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (Human68K)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; @@ -662,15 +662,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/FAT32.cs b/Aaru.Tests/Filesystems/FAT32.cs index 700b8aad4..96d0bd232 100644 --- a/Aaru.Tests/Filesystems/FAT32.cs +++ b/Aaru.Tests/Filesystems/FAT32.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat32Apm { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif" }; @@ -50,7 +50,7 @@ namespace Aaru.Tests.Filesystems 4194304 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -60,22 +60,22 @@ namespace Aaru.Tests.Filesystems 524278 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VOLUMELABEL" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "35BD1F0A" }; - readonly string[] _oemid = + readonly string[] _oemId = { "BSD 4.4" }; @@ -83,15 +83,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (APM)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (APM)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; @@ -104,15 +104,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT32", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT32", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -120,7 +120,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat32Gpt { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif" }; @@ -130,7 +130,7 @@ namespace Aaru.Tests.Filesystems 4194304 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -140,22 +140,22 @@ namespace Aaru.Tests.Filesystems 523775 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VOLUMELABEL" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "7ABE1F1B" }; - readonly string[] _oemid = + readonly string[] _oemId = { "BSD 4.4" }; @@ -163,15 +163,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (GPT)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (GPT)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); int part = -1; @@ -184,15 +184,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT32", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT32", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -200,7 +200,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Fat32Mbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "drdos_7.03.aif", "drdos_8.00.aif", "msdos_7.10.aif", "macosx_10.11.aif", "win10.aif", "win2000.aif", "win95osr2.1.aif", "win95osr2.5.aif", "win95osr2.aif", "win98se.aif", "win98.aif", "winme.aif", @@ -215,7 +215,7 @@ namespace Aaru.Tests.Filesystems 4194304, 4194304, 262144, 4194304, 4194304, 4194304, 4194304, 8388608, 1024000, 1024000, 1024000, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 @@ -227,13 +227,13 @@ namespace Aaru.Tests.Filesystems 1048560, 260096, 524160, 524112, 524112, 65514, 1048233, 127744, 127882, 127744, 127744 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048, 512, 4096, 4096, 4096, 32768, 4096, 4096, 4096, 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", @@ -241,14 +241,14 @@ namespace Aaru.Tests.Filesystems "DICSETTER", "DICSETTER", "DICSETTER" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "5955996C", "1BFB1A43", "3B331809", "42D51EF1", "48073346", "EC62E6DE", "2A310DE4", "0C140DFC", "3E310D18", "0D3D0EED", "0E131162", "3F500F02", "82EB4C04", "00000000", "B488C502", "5CAC9B4E", "41540E0E", "4E600E0F", "26E20E0F", "3E0C1BE8", "63084BBA", "5CC7908D", "D1290612", "79BCA86E" }; - readonly string[] _oemid = + readonly string[] _oemId = { "DRDOS7.X", "IBM 7.1", "MSWIN4.1", "BSD 4.4", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSDOS5.0", "BeOS ", "mkfs.fat", "MSWIN4.1", "BSD 4.4", "BSD 4.4", @@ -258,25 +258,25 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (MBR)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (MBR)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FAT(); - Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testFiles[i]); fs.GetInformation(image, partitions[0], out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("FAT32", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("FAT32", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/HAMMER.cs b/Aaru.Tests/Filesystems/HAMMER.cs index f85251fd8..5a70f129c 100644 --- a/Aaru.Tests/Filesystems/HAMMER.cs +++ b/Aaru.Tests/Filesystems/HAMMER.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class HammerMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "dflybsd_3.6.1.vdi.lz", "dflybsd_4.0.5.vdi.lz" }; @@ -50,7 +50,7 @@ namespace Aaru.Tests.Filesystems 104857600, 104857600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -60,17 +60,17 @@ namespace Aaru.Tests.Filesystems 6310, 6310 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 8388608, 8388608 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "f8e1a8bb-626d-11e7-94b5-0900274691e4", "ff4dc664-6276-11e7-983f-090027c41b46" }; @@ -78,15 +78,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "HAMMER (MBR)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "HAMMER (MBR)", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new HAMMER(); int part = -1; @@ -99,14 +99,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HAMMER", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HAMMER", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/HFS.cs b/Aaru.Tests/Filesystems/HFS.cs index 10db6ef54..841019d98 100644 --- a/Aaru.Tests/Filesystems/HFS.cs +++ b/Aaru.Tests/Filesystems/HFS.cs @@ -40,14 +40,14 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Hfs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macos_1.1_mf2dd.img.lz", "macos_2.0_mf2dd.img.lz", "macos_6.0.7_mf2dd.img.lz", "nextstep_3.3_mf2hd.img.lz", "openstep_4.0_mf2hd.img.lz", "openstep_4.2_mf2hd.img.lz", "rhapsody_dr1_mf2hd.img.lz", "ecs20_mf2hd_fstester.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD @@ -58,7 +58,7 @@ namespace Aaru.Tests.Filesystems 1600, 1600, 1600, 2880, 2880, 2880, 2880, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -68,18 +68,18 @@ namespace Aaru.Tests.Filesystems 1594, 1594, 1594, 2874, 2874, 2874, 2874, 2874 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "VOLUME LABEL" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null, null, null, null }; @@ -87,16 +87,16 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new AppleHFS(); var wholePart = new Partition @@ -106,13 +106,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -120,7 +120,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class HfsApm { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amigaos_3.9.aif", "darwin_1.3.1.aif", "darwin_1.4.1.aif", "darwin_6.0.2.aif", "darwin_8.0.1.aif", "macos_1.1.aif", "macos_2.0.aif", "macos_6.0.7.aif", "macos_7.5.3.aif", "macos_7.5.aif", "macos_7.6.aif", @@ -138,7 +138,7 @@ namespace Aaru.Tests.Filesystems 54840, 54840, 54840, 54840, 41820, 54840, 54840, 262144, 51200, 51200, 54840 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 @@ -151,13 +151,13 @@ namespace Aaru.Tests.Filesystems 38950, 38950, 38950, 46071, 50382, 49135, 54643 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 8192, 4096, 4096, 3584, 3584, 512, 512, 1024, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 3584, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 1024, 512, 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", @@ -167,7 +167,7 @@ namespace Aaru.Tests.Filesystems "Volume label", "Volume label", "Untitled", "Untitled #1", "24 MB Disk", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, "AAFE1382AF5AA898", null, null, null, null, null, null, null, null, null, null, null, null, "5A7C38B0CAF279C4", "FB49083EBD150509", "632C0B1DB46FD188", null, null, null, null, null, null, @@ -177,15 +177,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (APM)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (APM)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFS(); int part = -1; @@ -198,14 +198,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -213,7 +213,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class HfsCdrom { - readonly string[] _testfiles = + readonly string[] _testFiles = { "toast_3.5.7_hfs_from_volume.aif", "toast_3.5.7_iso9660_hfs.aif", "toast_4.1.3_hfs_from_volume.aif", "toast_4.1.3_iso9660_hfs.aif", "toast_3.5.7_hfs_from_files.aif", "toast_4.1.3_hfs_from_files.aif" @@ -224,7 +224,7 @@ namespace Aaru.Tests.Filesystems 942, 1880, 943, 1882, 1509, 1529 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 2048, 2048, 2048, 2048, 2048, 2048 }; @@ -234,17 +234,17 @@ namespace Aaru.Tests.Filesystems 3724, 931, 931, 931, 249, 249 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 2048, 2048, 2048, 12288, 12288 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null, null }; @@ -252,17 +252,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (CD-ROM)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFS(); int part = -1; @@ -275,14 +275,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -290,7 +290,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class HfsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif", "darwin_1.3.1.aif", "darwin_1.4.1.aif", "darwin_6.0.2.aif", "darwin_8.0.1.aif", "linux_4.19_hfs_flashdrive.aif" @@ -301,7 +301,7 @@ namespace Aaru.Tests.Filesystems 262144, 409600, 409600, 409600, 409600, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512 }; @@ -311,17 +311,17 @@ namespace Aaru.Tests.Filesystems 65018, 51145, 51145, 58452, 58502, 63870 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 2048, 4096, 4096, 3584, 3584, 8192 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "DicSetter" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, "81FE805D61458753", null }; @@ -329,15 +329,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (MBR)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (MBR)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFS(); int part = -1; @@ -350,14 +350,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -365,7 +365,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class HfsRdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amigaos_3.9.aif" }; @@ -375,7 +375,7 @@ namespace Aaru.Tests.Filesystems 1024128 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -385,17 +385,17 @@ namespace Aaru.Tests.Filesystems 63752 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 8192 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; @@ -403,15 +403,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (RDB)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (RDB)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFS(); int part = -1; @@ -424,14 +424,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/HFSPlus.cs b/Aaru.Tests/Filesystems/HFSPlus.cs index 7e7c86993..708a7280e 100644 --- a/Aaru.Tests/Filesystems/HFSPlus.cs +++ b/Aaru.Tests/Filesystems/HFSPlus.cs @@ -41,7 +41,7 @@ namespace Aaru.Tests.Filesystems public class HfsPlusApm { // Missing Darwin 1.4.1 - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif", "macosx_10.11_journal.aif", "darwin_1.3.1.aif", "darwin_1.3.1_wrapped.aif", "darwin_1.4.1_wrapped.aif", "darwin_6.0.2.aif", "darwin_6.0.2_wrapped.aif", "darwin_8.0.1_journal.aif", @@ -56,7 +56,7 @@ namespace Aaru.Tests.Filesystems 4194304, 4194304, 4194304, 2097152, 4194304, 2097152, 4194304 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -67,26 +67,26 @@ namespace Aaru.Tests.Filesystems 524088, 524008, 261884, 491240, 261884, 491240 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "FA94762D086A18A9", "33D4A309C8E7BD10", null, null, null, null, null, "4D5140EB8F14A385", "0D592249833E2DC4", "AA616146576BD9BC", null, null, null, null, null, "EFA132FFFAC1ADA6", "009D570FFCF8F20B", "17F6F33AB313EE32", "AD5690C093F66FCF", "A7D63854DF76DDE6" }; - readonly string[] _oemid = + readonly string[] _oemId = { "10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "8.10", "8.10", "8.10", "8.10", "8.10", "10.0", "HFSJ", "10.0", "HFSJ", "10.0" @@ -95,17 +95,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (APM)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFSPlus(); int part = -1; @@ -118,15 +118,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HFS+", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HFS+", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -134,7 +134,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class HfsPlusGpt { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif", "macosx_10.11_journal.aif" }; @@ -144,7 +144,7 @@ namespace Aaru.Tests.Filesystems 409600, 614400 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -154,22 +154,22 @@ namespace Aaru.Tests.Filesystems 51190, 76790 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "D8C68470046E67BE", "FD3CB598F3C6294A" }; - readonly string[] _oemid = + readonly string[] _oemId = { "10.0", "HFSJ" }; @@ -177,17 +177,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (GPT)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFSPlus(); int part = -1; @@ -200,15 +200,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HFS+", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HFS+", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -217,7 +217,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class HfsPlusMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif", "macosx_10.11_journal.aif", "linux.aif", "linux_journal.aif", "darwin_1.3.1.aif", "darwin_1.3.1_wrapped.aif", "darwin_1.4.1.aif", "darwin_1.4.1_wrapped.aif", "darwin_6.0.2.aif", @@ -229,7 +229,7 @@ namespace Aaru.Tests.Filesystems 303104, 352256, 262144, 262144, 819200, 614400, 819200, 614400, 819200, 1228800, 819200, 614400, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -239,23 +239,23 @@ namespace Aaru.Tests.Filesystems 37878, 44021, 32512, 32512, 102178, 76708, 102178, 76708, 102178, 153592, 102392, 76774, 127744 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null, null, null, null, null, null, null, null, null, null, null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "C84F550907D13F50", "016599F88029F73D", null, null, null, null, null, null, null, "F92964F9B3F64ABB", "A8FAC484A0A2B177", "D5D5BF1346AD2B8D", "B9BAC6856878A404" }; - readonly string[] _oemid = + readonly string[] _oemId = { "10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "H+Lx" }; @@ -263,17 +263,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFSPlus(); int part = -1; @@ -286,15 +286,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HFS+", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HFS+", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/HFSX.cs b/Aaru.Tests/Filesystems/HFSX.cs index d44d22725..4b8d9717d 100644 --- a/Aaru.Tests/Filesystems/HFSX.cs +++ b/Aaru.Tests/Filesystems/HFSX.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class HfsxApm { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif", "macosx_10.11_journal.aif", "darwin_8.0.1_journal.aif", "darwin_8.0.1.aif", "macosx_10.4_journal.aif", "macosx_10.4.aif" @@ -51,7 +51,7 @@ namespace Aaru.Tests.Filesystems 819200, 1228800, 1638400, 1433600, 4194304, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512 }; @@ -61,23 +61,23 @@ namespace Aaru.Tests.Filesystems 102390, 153590, 204792, 179192, 491290, 127770 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096, 4096, 4096, 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null, null, null, null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "CC2D56884950D9AE", "7AF1175D8EA7A072", "BB4ABD7E7E2FF5AF", "E2F212D815EF77B5", "5A8C646A5D77EB16", "258C51A750F6A485" }; - readonly string[] _oemid = + readonly string[] _oemId = { "10.0", "HFSJ", "10.0", "10.0", "HFSJ", "10.0" }; @@ -85,17 +85,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (APM)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFSPlus(); int part = -1; @@ -108,15 +108,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HFSX", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HFSX", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -124,7 +124,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class HfsxGpt { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif", "macosx_10.11_journal.aif" }; @@ -134,7 +134,7 @@ namespace Aaru.Tests.Filesystems 819200, 1228800 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -144,22 +144,22 @@ namespace Aaru.Tests.Filesystems 102390, 153590 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "328343989312AE9F", "FB98504073464C5C" }; - readonly string[] _oemid = + readonly string[] _oemId = { "10.0", "HFSJ" }; @@ -167,17 +167,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (GPT)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFSPlus(); int part = -1; @@ -190,15 +190,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HFSX", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HFSX", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -206,7 +206,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class HfsxMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif", "macosx_10.11_journal.aif", "linux.aif", "linux_journal.aif", "darwin_8.0.1_journal.aif", "darwin_8.0.1.aif", "linux_4.19_hfsx_flashdrive.aif" @@ -217,7 +217,7 @@ namespace Aaru.Tests.Filesystems 393216, 409600, 262144, 262144, 1638400, 1433600, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512 }; @@ -227,23 +227,23 @@ namespace Aaru.Tests.Filesystems 49140, 51187, 32512, 32512, 204792, 179192, 127744 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096, 4096, 4096, 4096, 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null, null, null, null, null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "C2BCCCE6DE5BC98D", "AC54CD78C75CC30F", null, null, "7559DD01BCFADD9A", "AEA39CFBBF14C0FF", "5E4A8781D3C9286C" }; - readonly string[] _oemid = + readonly string[] _oemId = { "10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "H+Lx" }; @@ -251,17 +251,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new AppleHFSPlus(); int part = -1; @@ -274,15 +274,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HFSX", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HFSX", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/HPFS.cs b/Aaru.Tests/Filesystems/HPFS.cs index 66f14843d..3d30296ec 100644 --- a/Aaru.Tests/Filesystems/HPFS.cs +++ b/Aaru.Tests/Filesystems/HPFS.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Hpfs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "ecs.aif", "msos2_1.21.aif", "msos2_1.30.1.aif", "os2_1.20.aif", "os2_1.30.aif", "os2_6.307.aif", "os2_6.514.aif", "os2_6.617.aif", "os2_8.162.aif", "os2_9.023.aif", "winnt_3.10.aif", "winnt_3.50.aif", @@ -52,7 +52,7 @@ namespace Aaru.Tests.Filesystems 262144, 1024000, 1024000, 1024000, 1024000, 1024000, 262144, 262144, 262144, 262144, 262144, 262144, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -62,24 +62,24 @@ namespace Aaru.Tests.Filesystems 261072, 1023056, 1023056, 1023056, 1023056, 1023056, 262016, 262016, 262016, 262016, 262016, 262112, 1022112 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUME LABE" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "2BBBD814", "AC0DDC15", "ABEB2C15", "6C4EE015", "6C406015", "6C49B015", "2BCEB414", "2C157414", "2BF55414", "2BE31414", "E851CB14", "A4EDC29C", "AC096014" }; - readonly string[] _oemid = + readonly string[] _oemId = { "IBM 4.50", "OS2 10.1", "OS2 10.0", "OS2 10.0", "OS2 10.0", "OS2 20.0", "OS2 20.0", "OS2 20.1", "OS2 20.0", "OS2 20.0", "MSDOS5.0", "MSDOS5.0", "IBM 4.50" @@ -88,27 +88,27 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "High Performance File System", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new HPFS(); - Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testFiles[i]); fs.GetInformation(image, partitions[0], out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HPFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HPFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/HPOFS.cs b/Aaru.Tests/Filesystems/HPOFS.cs index 8b889389f..a8048e42d 100644 --- a/Aaru.Tests/Filesystems/HPOFS.cs +++ b/Aaru.Tests/Filesystems/HPOFS.cs @@ -39,12 +39,12 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Hpofs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "rid1.img.lz", "rid10.img.lz", "rid66percent.img.lz", "rid266.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD }; @@ -54,7 +54,7 @@ namespace Aaru.Tests.Filesystems 2880, 2880, 2880, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512 }; @@ -64,22 +64,22 @@ namespace Aaru.Tests.Filesystems 2880, 2880, 2880, 2880 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512, 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VOLUME LABEL", "VOLUME LABEL", "VOLUME LABEL", "VOLUME LABEL" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "AC226814", "AC160814", "AC306C14", "ABEF2C14" }; - readonly string[] _oemid = + readonly string[] _oemId = { "IBM 10.2", "IBM 10.2", "IBM 10.2", "IBM 10.2" }; @@ -87,18 +87,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "High Performance Optical File System", _testfiles[i]); + "High Performance Optical File System", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new HPOFS(); var wholePart = new Partition @@ -108,14 +108,14 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("HPOFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("HPOFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/HTFS.cs b/Aaru.Tests/Filesystems/HTFS.cs index b7a98ffb2..72a2b5ee6 100644 --- a/Aaru.Tests/Filesystems/HTFS.cs +++ b/Aaru.Tests/Filesystems/HTFS.cs @@ -40,14 +40,14 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Htfs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", "scoopenserver_5.0.7hw_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD }; @@ -57,7 +57,7 @@ namespace Aaru.Tests.Filesystems 3360, 2400, 1440, 5760, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512 }; @@ -67,17 +67,17 @@ namespace Aaru.Tests.Filesystems 1680, 1200, 720, 2880, 1440 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "", "", "", "", "" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null }; @@ -90,18 +90,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "High Throughtput File System", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new SysVfs(); var wholePart = new Partition @@ -111,13 +111,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -125,7 +125,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class HtfsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "scoopenserver_5.0.7hw.aif" }; @@ -135,7 +135,7 @@ namespace Aaru.Tests.Filesystems 2097152 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -145,17 +145,17 @@ namespace Aaru.Tests.Filesystems 1020096 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; @@ -168,17 +168,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "High Throughtput File System (MBR)", _testfiles[i]); + "High Throughtput File System (MBR)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SysVfs(); int part = -1; @@ -191,14 +191,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/ISO9660.cs b/Aaru.Tests/Filesystems/ISO9660.cs index 5d8c2cb90..4b2f39df0 100644 --- a/Aaru.Tests/Filesystems/ISO9660.cs +++ b/Aaru.Tests/Filesystems/ISO9660.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Iso9660 { - readonly string[] _testfiles = + readonly string[] _testFiles = { // Toast 3.5.7 "toast_3.5.7_iso9660_apple.aif", "toast_3.5.7_iso9660_dos_apple.aif", "toast_3.5.7_iso9660_dos.aif", @@ -89,7 +89,7 @@ namespace Aaru.Tests.Filesystems "xorriso_rockridge.aif", "xorriso_violating.aif", "xorriso_zisofs.aif", "xorriso_zisofs_rockridge.aif" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { // Toast 3.5.7 MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, MediaType.CD, @@ -151,7 +151,7 @@ namespace Aaru.Tests.Filesystems 3688, 3686, 3686, 3686, 3673, 3673, 3673, 3686, 3675, 3673, 3673, 3675 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { // Toast 3.5.7 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, @@ -205,7 +205,7 @@ namespace Aaru.Tests.Filesystems 3688, 3686, 3686, 3686, 3673, 3673, 3673, 3686, 3675, 3673, 3673, 3675 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { // Toast 3.5.7 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, @@ -232,7 +232,7 @@ namespace Aaru.Tests.Filesystems 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048 }; - readonly string[] _volumename = + readonly string[] _volumeName = { // Toast 3.5.7 "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "DISK_UTILS", "Disk utils", "Disk utils", @@ -264,7 +264,7 @@ namespace Aaru.Tests.Filesystems "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test", "test" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { // Toast 3.5.7 null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, @@ -419,16 +419,16 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "ISO9660", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "ISO9660", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), $"{_testfiles[i]}: Open()"); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, $"{_testfiles[i]}: MediaType"); - Assert.AreEqual(_sectors[i], image.Info.Sectors, $"{_testfiles[i]}: Sectors"); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, $"{_testfiles[i]}: SectorSize"); + Assert.AreEqual(true, image.Open(filter), $"{_testFiles[i]}: Open()"); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, $"{_testFiles[i]}: MediaType"); + Assert.AreEqual(_sectors[i], image.Info.Sectors, $"{_testFiles[i]}: Sectors"); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, $"{_testFiles[i]}: SectorSize"); IFilesystem fs = new ISO9660(); var wholePart = new Partition @@ -438,17 +438,17 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), $"{_testfiles[i]}: Identify()"); + Assert.AreEqual(true, fs.Identify(image, wholePart), $"{_testFiles[i]}: Identify()"); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, $"{_testfiles[i]}: Clusters"); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, $"{_testfiles[i]}: ClusterSize"); - Assert.AreEqual("ISO9660", fs.XmlFsType.Type, $"{_testfiles[i]}: Type"); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, $"{_testfiles[i]}: VolumeName"); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, $"{_testfiles[i]}: VolumeSerial"); - Assert.AreEqual(_sysid[i], fs.XmlFsType.SystemIdentifier, $"{_testfiles[i]}: SystemIdentifier"); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, $"{_testFiles[i]}: Clusters"); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, $"{_testFiles[i]}: ClusterSize"); + Assert.AreEqual("ISO9660", fs.XmlFsType.Type, $"{_testFiles[i]}: Type"); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, $"{_testFiles[i]}: VolumeName"); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, $"{_testFiles[i]}: VolumeSerial"); + Assert.AreEqual(_sysid[i], fs.XmlFsType.SystemIdentifier, $"{_testFiles[i]}: SystemIdentifier"); Assert.AreEqual(_appid[i], fs.XmlFsType.ApplicationIdentifier, - $"{_testfiles[i]}: ApplicationIdentifier"); + $"{_testFiles[i]}: ApplicationIdentifier"); } } } diff --git a/Aaru.Tests/Filesystems/JFS2.cs b/Aaru.Tests/Filesystems/JFS2.cs index 0fed7ec87..991ad5f60 100644 --- a/Aaru.Tests/Filesystems/JFS2.cs +++ b/Aaru.Tests/Filesystems/JFS2.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Jfs2 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif", "linux_caseinsensitive.aif", "ecs20_fstester.aif", "linux_4.19_jfs_flashdrive.aif", "linux_4.19_jfs_os2_flashdrive.aif" @@ -51,7 +51,7 @@ namespace Aaru.Tests.Filesystems 262144, 262144, 1024000, 1024000, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512 }; @@ -61,17 +61,17 @@ namespace Aaru.Tests.Filesystems 257632, 257632, 1017512, 1017416, 1017416 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096, 4096, 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume labe", "Volume labe", "Volume labe", "DicSetter", "DicSetter" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "8033b783-0cd1-1645-8ecc-f8f113ad6a47", "d6cd91e9-3899-7e40-8468-baab688ee2e2", "f4077ce9-0000-0000-0000-000000007c10", "91746c77-eb51-7441-85e2-902c925969f8", @@ -81,15 +81,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "JFS2", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "JFS2", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new JFS(); int part = -1; @@ -103,14 +103,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("JFS filesystem", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("JFS filesystem", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/LFS.cs b/Aaru.Tests/Filesystems/LFS.cs index 973a9b2a3..db6c1d34e 100644 --- a/Aaru.Tests/Filesystems/LFS.cs +++ b/Aaru.Tests/Filesystems/LFS.cs @@ -36,7 +36,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class LfsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "netbsd_1.6.aif" }; @@ -46,7 +46,7 @@ namespace Aaru.Tests.Filesystems 409600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -56,17 +56,17 @@ namespace Aaru.Tests.Filesystems 409600 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; diff --git a/Aaru.Tests/Filesystems/LisaFS.cs b/Aaru.Tests/Filesystems/LisaFS.cs index f26c30320..6f592b6ec 100644 --- a/Aaru.Tests/Filesystems/LisaFS.cs +++ b/Aaru.Tests/Filesystems/LisaFS.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class LisaFs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "166files.dc42.lz", "222files.dc42.lz", "blank2.0.dc42.lz", "blank-disk.dc42.lz", "file-with-a-password.dc42.lz", "tfwdndrc-has-been-erased.dc42.lz", "tfwdndrc-has-been-restored.dc42.lz", @@ -51,7 +51,7 @@ namespace Aaru.Tests.Filesystems "lisafs3.dc42.lz", "lisafs3_with_desktop.dc42.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, @@ -64,7 +64,7 @@ namespace Aaru.Tests.Filesystems 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 800, 1702, 800, 800, 800 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -74,19 +74,19 @@ namespace Aaru.Tests.Filesystems 800, 800, 792, 800, 800, 800, 800, 800, 800, 800, 800, 800, 1684, 792, 800, 800 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "166Files", "222Files", "AOS 4:59 pm 10/02/87", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 3.0", "AOS 4:15 pm 5/06/1983", "Office System 1 2.0", "Office System 1 3.0", "AOS 3.0" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "A23703A202010663", "A23703A201010663", "A32D261301010663", "A22CB48D01010663", "A22CC3A702010663", "A22CB48D14010663", "A22CB48D14010663", "A22CB48D01010663", "A22CB48D01010663", "A22CB48D01010663", @@ -94,7 +94,7 @@ namespace Aaru.Tests.Filesystems "A4FE1A191F011652" }; - readonly string[] _oemid = + readonly string[] _oemId = { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null }; @@ -102,18 +102,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple Lisa filesystem", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new DiskCopy42(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new LisaFS(); var wholePart = new Partition @@ -123,14 +123,14 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("LisaFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("LisaFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } diff --git a/Aaru.Tests/Filesystems/Locus.cs b/Aaru.Tests/Filesystems/Locus.cs index 6d896cb96..955e92b78 100644 --- a/Aaru.Tests/Filesystems/Locus.cs +++ b/Aaru.Tests/Filesystems/Locus.cs @@ -38,12 +38,12 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Locus { - readonly string[] _testfiles = + readonly string[] _testFiles = { "mf2dd.img.lz", "mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD }; @@ -53,7 +53,7 @@ namespace Aaru.Tests.Filesystems 1440, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -63,22 +63,22 @@ namespace Aaru.Tests.Filesystems 180, 360 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Label", "Label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null }; - readonly string[] _oemid = + readonly string[] _oemId = { null, null }; @@ -86,18 +86,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Locus filesystem", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new Aaru.Filesystems.Locus(); var wholePart = new Partition @@ -107,14 +107,14 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Locus filesystem", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Locus filesystem", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/MFS.cs b/Aaru.Tests/Filesystems/MFS.cs index 89271648c..ee1184417 100644 --- a/Aaru.Tests/Filesystems/MFS.cs +++ b/Aaru.Tests/Filesystems/MFS.cs @@ -39,13 +39,13 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Mfs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macos_0.1_mf1dd.img.lz", "macos_0.5_mf1dd.img.lz", "macos_1.1_mf1dd.img.lz", "macos_2.0_mf1dd.img.lz", "macos_6.0.7_mf1dd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS @@ -56,7 +56,7 @@ namespace Aaru.Tests.Filesystems 800, 800, 800, 800, 800 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512 }; @@ -66,17 +66,17 @@ namespace Aaru.Tests.Filesystems 391, 391, 391, 391, 391 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label", "Volume label", "Volume label", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null, null, null }; @@ -84,18 +84,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Macintosh File System", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new AppleMFS(); var wholePart = new Partition @@ -105,13 +105,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("MFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("MFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/MINIX.cs b/Aaru.Tests/Filesystems/MINIX.cs index 0f10d90c8..4b97f16d3 100644 --- a/Aaru.Tests/Filesystems/MINIX.cs +++ b/Aaru.Tests/Filesystems/MINIX.cs @@ -40,13 +40,13 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class MinixV1 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz", "minix_3.1.2a_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD }; @@ -56,7 +56,7 @@ namespace Aaru.Tests.Filesystems 720, 2400, 1440, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512 }; @@ -66,7 +66,7 @@ namespace Aaru.Tests.Filesystems 360, 1200, 720, 1440 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 1024 }; @@ -79,18 +79,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v1 filesystem", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new MinixFS(); var wholePart = new Partition @@ -100,11 +100,11 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]); } } } @@ -112,7 +112,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class MinixV1Mbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif", "minix_3.1.2a.aif", "linux_4.19_minix1_flashdrive.aif" }; @@ -122,7 +122,7 @@ namespace Aaru.Tests.Filesystems 262144, 102400, 131072 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512 }; @@ -132,7 +132,7 @@ namespace Aaru.Tests.Filesystems 65535, 50399, 64512 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024 }; @@ -145,17 +145,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v1 filesystem (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new MinixFS(); int part = -1; @@ -170,12 +170,12 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]); } } } @@ -183,13 +183,13 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class MinixV2 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz", "minix_3.1.2a_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD }; @@ -199,7 +199,7 @@ namespace Aaru.Tests.Filesystems 720, 2400, 1440, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512 }; @@ -209,7 +209,7 @@ namespace Aaru.Tests.Filesystems 360, 1200, 720, 1440 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 1024 }; @@ -222,18 +222,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v2 filesystem", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new MinixFS(); var wholePart = new Partition @@ -243,11 +243,11 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]); } } } @@ -255,7 +255,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class MinixV2Mbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "minix_3.1.2a.aif", "linux_4.19_minix2_flashdrive.aif" }; @@ -265,7 +265,7 @@ namespace Aaru.Tests.Filesystems 1024000, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -275,7 +275,7 @@ namespace Aaru.Tests.Filesystems 511055, 510976 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024 }; @@ -288,17 +288,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v2 filesystem (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new MinixFS(); int part = -1; @@ -312,12 +312,12 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]); } } } @@ -325,13 +325,13 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class MinixV3 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz", "minix_3.1.2a_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD }; @@ -341,7 +341,7 @@ namespace Aaru.Tests.Filesystems 720, 2400, 1440, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512 }; @@ -351,7 +351,7 @@ namespace Aaru.Tests.Filesystems 90, 300, 180, 360 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096, 4096, 4096 }; @@ -364,18 +364,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v3 filesystem", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new MinixFS(); var wholePart = new Partition @@ -385,11 +385,11 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]); } } } @@ -397,7 +397,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class MinixV3Mbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "minix_3.1.2a.aif", "linux_4.19_minix3_flashdrive.aif" }; @@ -407,7 +407,7 @@ namespace Aaru.Tests.Filesystems 4194304, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -417,7 +417,7 @@ namespace Aaru.Tests.Filesystems 523151, 510976 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 1024 }; @@ -430,17 +430,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v3 filesystem (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new MinixFS(); int part = -1; @@ -454,12 +454,12 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/NILFS2.cs b/Aaru.Tests/Filesystems/NILFS2.cs index f05bb55d5..c02e6c415 100644 --- a/Aaru.Tests/Filesystems/NILFS2.cs +++ b/Aaru.Tests/Filesystems/NILFS2.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Nilfs2 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif" }; @@ -50,7 +50,7 @@ namespace Aaru.Tests.Filesystems 262144 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -60,17 +60,17 @@ namespace Aaru.Tests.Filesystems 32512 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "6b1ca79e-7048-a748-93a0-89c74b02cb5a" }; @@ -78,17 +78,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "New Implementation of a Log-structured File System 2", _testfiles[i]); + "New Implementation of a Log-structured File System 2", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new NILFS2(); int part = -1; @@ -101,14 +101,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("NILFS2 filesystem", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("NILFS2 filesystem", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/NTFS.cs b/Aaru.Tests/Filesystems/NTFS.cs index aa3916d59..b8cba0a5c 100644 --- a/Aaru.Tests/Filesystems/NTFS.cs +++ b/Aaru.Tests/Filesystems/NTFS.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class NtfsGpt { - readonly string[] _testfiles = + readonly string[] _testFiles = { "haiku_hrev51259.aif" }; @@ -50,7 +50,7 @@ namespace Aaru.Tests.Filesystems 2097152 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -60,22 +60,22 @@ namespace Aaru.Tests.Filesystems 261887 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null, null, null, null, null, null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "106DA7693F7F6B3F" }; - readonly string[] _oemid = + readonly string[] _oemId = { null }; @@ -83,17 +83,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "New Technology File System (GPT)", _testfiles[i]); + "New Technology File System (GPT)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new NTFS(); int part = -1; @@ -106,15 +106,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("NTFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("NTFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -122,7 +122,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class NtfsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "win10.aif", "win2000.aif", "winnt_3.10.aif", "winnt_3.50.aif", "winnt_3.51.aif", "winnt_4.00.aif", "winvista.aif", "linux.aif", "haiku_hrev51259.aif", "linux_4.19_ntfs3g_flashdrive.aif" @@ -133,7 +133,7 @@ namespace Aaru.Tests.Filesystems 524288, 2097152, 1024000, 524288, 524288, 524288, 524288, 262144, 2097152, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -143,23 +143,23 @@ namespace Aaru.Tests.Filesystems 65263, 1046511, 1023057, 524256, 524256, 524096, 64767, 32511, 261887, 127743 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 1024, 512, 512, 512, 512, 4096, 4096, 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null, null, null, null, null, null, null, null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "C46C1B3C6C1B28A6", "8070C8EC70C8E9CC", "10CC6AC6CC6AA5A6", "7A14F50014F4BFE5", "24884447884419A6", "822C288D2C287E73", "E20AF54B0AF51D6B", "065BB96B7C1BCFDA", "46EC796749C6FA66", "1FC3802B52F9611C" }; - readonly string[] _oemid = + readonly string[] _oemId = { null, null, null, null, null, null, null, null, null, null }; @@ -167,17 +167,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", - "New Technology File System (MBR)", _testfiles[i]); + "New Technology File System (MBR)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new NTFS(); int part = -1; @@ -193,15 +193,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("NTFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("NTFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/NWFS386.cs b/Aaru.Tests/Filesystems/NWFS386.cs index 300375c29..f9d52ac4e 100644 --- a/Aaru.Tests/Filesystems/NWFS386.cs +++ b/Aaru.Tests/Filesystems/NWFS386.cs @@ -35,7 +35,7 @@ namespace Aaru.Tests.Filesystems [TestFixture, SuppressMessage("ReSharper", "UnusedMember.Local")] public class Nwfs386 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "netware_3.12.aif" }; @@ -45,7 +45,7 @@ namespace Aaru.Tests.Filesystems 104857600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -55,17 +55,17 @@ namespace Aaru.Tests.Filesystems 104856192 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "UNKNOWN" }; diff --git a/Aaru.Tests/Filesystems/OCFS2.cs b/Aaru.Tests/Filesystems/OCFS2.cs index f9ddf3d7d..2c0688c3a 100644 --- a/Aaru.Tests/Filesystems/OCFS2.cs +++ b/Aaru.Tests/Filesystems/OCFS2.cs @@ -36,7 +36,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Ocfs2 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif" }; @@ -46,7 +46,7 @@ namespace Aaru.Tests.Filesystems 104857600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -56,17 +56,17 @@ namespace Aaru.Tests.Filesystems 104856192 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "UNKNOWN" }; diff --git a/Aaru.Tests/Filesystems/PFS3.cs b/Aaru.Tests/Filesystems/PFS3.cs index 191d45402..0afd8186c 100644 --- a/Aaru.Tests/Filesystems/PFS3.cs +++ b/Aaru.Tests/Filesystems/PFS3.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Pfs3Rdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "uae.aif" }; @@ -50,7 +50,7 @@ namespace Aaru.Tests.Filesystems 1024128 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -60,22 +60,22 @@ namespace Aaru.Tests.Filesystems 1023552 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "PFS" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; - readonly string[] _oemid = + readonly string[] _oemId = { null }; @@ -83,17 +83,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Professional File System 3", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new PFS(); int part = -1; @@ -106,15 +106,15 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("PFS v3", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("PFS v3", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/ProDOS.cs b/Aaru.Tests/Filesystems/ProDOS.cs index b95f2d43c..14a0fb7e4 100644 --- a/Aaru.Tests/Filesystems/ProDOS.cs +++ b/Aaru.Tests/Filesystems/ProDOS.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class ProdosApm { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macos_7.5.3.aif", "macos_7.6.aif", "macos_8.0.aif", "macos_8.1.aif", "macos_9.0.4.aif", "macos_9.1.aif", "macos_9.2.1.aif", "macos_9.2.2.aif" @@ -51,7 +51,7 @@ namespace Aaru.Tests.Filesystems 49152, 49152, 49152, 49152, 49152, 49152, 49152, 49152 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -61,18 +61,18 @@ namespace Aaru.Tests.Filesystems 48438, 48438, 48438, 48438, 46326, 46326, 46326, 46326 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VOLUME.LABEL", "VOLUME.LABEL", "VOLUME.LABEL", "VOLUME.LABEL", "VOLUME.LABEL", "VOLUME.LABEL", "VOLUME.LABEL", "VOLUME.LABEL" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null, null, null, null }; @@ -80,17 +80,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "ProDOS filesystem (APM)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new ProDOSPlugin(); int part = -1; @@ -103,14 +103,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("ProDOS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("ProDOS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/QNX4.cs b/Aaru.Tests/Filesystems/QNX4.cs index 0d6902e32..b085ca94e 100644 --- a/Aaru.Tests/Filesystems/QNX4.cs +++ b/Aaru.Tests/Filesystems/QNX4.cs @@ -40,12 +40,12 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Qnx4 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "qnx_4.24_dsdd.img.lz", "qnx_4.24_dshd.img.lz", "qnx_4.24_mf2dd.img.lz", "qnx_4.24_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD }; @@ -55,7 +55,7 @@ namespace Aaru.Tests.Filesystems 720, 2400, 1440, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512 }; @@ -65,7 +65,7 @@ namespace Aaru.Tests.Filesystems 720, 2400, 1440, 2880 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512, 512, 512 }; @@ -73,18 +73,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "QNX 4 filesystem", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new QNX4(); var wholePart = new Partition @@ -94,11 +94,11 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("QNX4 filesystem", fs.XmlFsType.Type, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("QNX4 filesystem", fs.XmlFsType.Type, _testFiles[i]); } } } @@ -106,7 +106,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Qnx4Mbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "qnx_4.24.aif" }; @@ -116,7 +116,7 @@ namespace Aaru.Tests.Filesystems 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -126,7 +126,7 @@ namespace Aaru.Tests.Filesystems 1023104 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512 }; @@ -134,17 +134,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "QNX 4 filesystem (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new QNX4(); int part = -1; @@ -157,12 +157,12 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("QNX4 filesystem", fs.XmlFsType.Type, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("QNX4 filesystem", fs.XmlFsType.Type, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/ReFS.cs b/Aaru.Tests/Filesystems/ReFS.cs index 245fe8cc2..cc0aefb05 100644 --- a/Aaru.Tests/Filesystems/ReFS.cs +++ b/Aaru.Tests/Filesystems/ReFS.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class ReFsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "win10.vdi.lz" }; @@ -50,7 +50,7 @@ namespace Aaru.Tests.Filesystems 67108864 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -60,22 +60,22 @@ namespace Aaru.Tests.Filesystems 8372224 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; - readonly string[] _oemid = + readonly string[] _oemId = { null }; @@ -83,17 +83,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Resilient File System (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new Vdi(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); int part = -1; @@ -105,16 +105,16 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); + Assert.AreNotEqual(-1, part, $"Partition not found on {_testFiles[i]}"); IFilesystem fs = new ReFS(); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, partitions[part]), _testFiles[i]); fs.GetInformation(image, partitions[part], out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Resilient File System", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Resilient File System", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/Reiser3.cs b/Aaru.Tests/Filesystems/Reiser3.cs index b9a56be9d..19fe94af2 100644 --- a/Aaru.Tests/Filesystems/Reiser3.cs +++ b/Aaru.Tests/Filesystems/Reiser3.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Reiser3 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux_r3.5.aif", "linux_r3.6.aif", "linux_4.19_reiser_3.5_flashdrive.aif", "linux_4.19_reiser_3.6_flashdrive.aif" @@ -51,7 +51,7 @@ namespace Aaru.Tests.Filesystems 262144, 262144, 1024000, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512 }; @@ -61,7 +61,7 @@ namespace Aaru.Tests.Filesystems 32512, 32512, 127744, 127744 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096, 4096, 4096 }; @@ -74,17 +74,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Reiser filesystem v3", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new Reiser(); int part = -1; @@ -97,12 +97,12 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_reiserversion[i], fs.XmlFsType.Type, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_reiserversion[i], fs.XmlFsType.Type, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/Reiser4.cs b/Aaru.Tests/Filesystems/Reiser4.cs index 78db723ce..27d1068ee 100644 --- a/Aaru.Tests/Filesystems/Reiser4.cs +++ b/Aaru.Tests/Filesystems/Reiser4.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Reiser4 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif" }; @@ -49,7 +49,7 @@ namespace Aaru.Tests.Filesystems 262144 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -59,17 +59,17 @@ namespace Aaru.Tests.Filesystems 32511 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "b0c1924e-6f10-8c42-b6c5-66a457896460" }; @@ -77,17 +77,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Reiser filesystem v4", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new Aaru.Filesystems.Reiser4(); int part = -1; @@ -100,14 +100,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Reiser 4 filesystem", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Reiser 4 filesystem", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/SFS.cs b/Aaru.Tests/Filesystems/SFS.cs index af3036599..d2d9f3daa 100644 --- a/Aaru.Tests/Filesystems/SFS.cs +++ b/Aaru.Tests/Filesystems/SFS.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class SfsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "aros.aif" }; @@ -50,7 +50,7 @@ namespace Aaru.Tests.Filesystems 409600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -60,17 +60,17 @@ namespace Aaru.Tests.Filesystems 408240 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; @@ -78,17 +78,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SFS(); int part = -1; @@ -101,14 +101,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -116,7 +116,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class SfsMbrRdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "aros.aif" }; @@ -126,7 +126,7 @@ namespace Aaru.Tests.Filesystems 409600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -136,17 +136,17 @@ namespace Aaru.Tests.Filesystems 406224 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; @@ -154,17 +154,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (MBR+RDB)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SFS(); int part = -1; @@ -177,14 +177,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -192,7 +192,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class SfsRdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "uae.aif", "aros.aif", "amigaos_4.0.aif", "amigaos_4.0_sfs2.aif" }; @@ -202,7 +202,7 @@ namespace Aaru.Tests.Filesystems 1024128, 409600, 1024128, 1024128 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512 }; @@ -212,17 +212,17 @@ namespace Aaru.Tests.Filesystems 127000, 407232, 511040, 511040 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 2048, 512, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null, null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null }; @@ -230,17 +230,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (RDB)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SFS(); int part = -1; @@ -254,14 +254,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/SysV.cs b/Aaru.Tests/Filesystems/SysV.cs index b54873631..494940edf 100644 --- a/Aaru.Tests/Filesystems/SysV.cs +++ b/Aaru.Tests/Filesystems/SysV.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class SysV { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amix.adf.lz", "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_mf2dd.img.lz", "att_unix_svr4v2.1_mf2hd.img.lz", "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", @@ -48,7 +48,7 @@ namespace Aaru.Tests.Filesystems "scoopenserver_5.0.7hw_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.CBM_AMIGA_35_DD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD @@ -59,7 +59,7 @@ namespace Aaru.Tests.Filesystems 1760, 720, 1440, 2880, 3360, 2400, 1440, 5760, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -69,17 +69,17 @@ namespace Aaru.Tests.Filesystems 880, 360, 720, 1440, 1680, 1200, 720, 2880, 1440 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "", "", "", "", "", "", "", "", "" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null, null, null, null, null }; @@ -92,18 +92,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new SysVfs(); var wholePart = new Partition @@ -113,13 +113,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -127,7 +127,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class SysVMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "att_unix_svr4v2.1.aif", "att_unix_svr4v2.1_2k.aif", "scoopenserver_5.0.7hw.aif" }; @@ -137,7 +137,7 @@ namespace Aaru.Tests.Filesystems 1024000, 1024000, 2097152 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512 }; @@ -147,17 +147,17 @@ namespace Aaru.Tests.Filesystems 511056, 255528, 1020096 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 2048, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "/usr3", "/usr3", "Volume label" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null }; @@ -170,17 +170,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SysVfs(); int part = -1; @@ -194,14 +194,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -209,7 +209,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class SysVRdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amix.aif" }; @@ -219,7 +219,7 @@ namespace Aaru.Tests.Filesystems 1024128 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -229,17 +229,17 @@ namespace Aaru.Tests.Filesystems 511424 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; @@ -252,17 +252,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem (RDB)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SysVfs(); int part = -1; @@ -275,14 +275,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/UDF.cs b/Aaru.Tests/Filesystems/UDF.cs index 0d84395b3..3442757e3 100644 --- a/Aaru.Tests/Filesystems/UDF.cs +++ b/Aaru.Tests/Filesystems/UDF.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Udf { - readonly string[] _testfiles = + readonly string[] _testFiles = { "1.02/linux.aif", "1.02/macosx_10.11.aif", "1.50/linux.aif", "1.50/macosx_10.11.aif", "2.00/linux.aif", "2.00/macosx_10.11.aif", "2.01/linux.aif", "2.01/macosx_10.11.aif", "2.50/linux.aif", @@ -54,7 +54,7 @@ namespace Aaru.Tests.Filesystems 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -65,7 +65,7 @@ namespace Aaru.Tests.Filesystems 8388608, 8388608, 1024000, 1024000, 1024000, 1024000 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -77,14 +77,14 @@ namespace Aaru.Tests.Filesystems "UDF v2.01", "UDF v2.01" }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*", "anonymous", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF", "4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF", @@ -95,7 +95,7 @@ namespace Aaru.Tests.Filesystems "5cc7f4183e0d5f7aLinuxUDF", "5cc8816fcb3a3b38LinuxUDF", "595EB55A", "7cc94d726669d773" }; - readonly string[] _oemid = + readonly string[] _oemId = { "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", @@ -107,17 +107,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new UDF(); var wholePart = new Partition @@ -127,14 +127,14 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSetIdentifier, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } @@ -142,7 +142,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class UdfOptical { - readonly string[] _testfiles = + readonly string[] _testFiles = { "1.50/ecs20.aif", "2.00/ecs20.aif", "2.01/ecs20.aif", "2.01/ecs20_cdrw.aif" }; @@ -152,7 +152,7 @@ namespace Aaru.Tests.Filesystems 2295104, 2295104, 2295104, 295264 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 2048, 2048, 2048, 2048 }; @@ -162,7 +162,7 @@ namespace Aaru.Tests.Filesystems 2295104, 2295104, 2295104, 295264 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 2048, 2048, 2048, 2048 }; @@ -172,17 +172,17 @@ namespace Aaru.Tests.Filesystems "UDF v2.01", "UDF v2.01", "UDF v2.01", "UDF v2.01" }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "UDF5A5DEF48", "VolLabel", "UDF5A5DFF10" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "Volume Set ID not specified", "Volume Set ID not specified", "VolumeSetId", "Volume Set ID not specified" }; - readonly string[] _oemid = + readonly string[] _oemId = { "*ExpressUDF", "*ExpressUDF", "*ExpressUDF", "*ExpressUDF" }; @@ -190,17 +190,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new UDF(); var wholePart = new Partition @@ -210,14 +210,14 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSetIdentifier, _testfiles[i]); - Assert.AreEqual(_oemid[i], fs.XmlFsType.SystemIdentifier, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]); + Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/UFS.cs b/Aaru.Tests/Filesystems/UFS.cs index 8dc261c57..4e9a75b97 100644 --- a/Aaru.Tests/Filesystems/UFS.cs +++ b/Aaru.Tests/Filesystems/UFS.cs @@ -40,14 +40,14 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Ufs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amix_mf2dd.adf.lz", "netbsd_1.6_mf2hd.img.lz", "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_dshd.img.lz", "att_unix_svr4v2.1_mf2dd.img.lz", "att_unix_svr4v2.1_mf2hd.img.lz", "solaris_2.4_mf2dd.img.lz", "solaris_2.4_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.CBM_AMIGA_35_DD, MediaType.DOS_35_HD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD @@ -58,7 +58,7 @@ namespace Aaru.Tests.Filesystems 1760, 2880, 720, 2400, 1440, 2880, 1440, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -68,17 +68,17 @@ namespace Aaru.Tests.Filesystems 880, 2880, 360, 1200, 720, 1440, 711, 1422 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 512, 1024, 1024, 1024, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null, null, null, null, null, null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null, null, null, null }; @@ -91,16 +91,16 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new FFSPlugin(); var wholePart = new Partition @@ -110,13 +110,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -124,7 +124,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class UfsApm { - readonly string[] _testfiles = + readonly string[] _testFiles = { "ffs43/darwin_1.3.1.aif", "ffs43/darwin_1.4.1.aif", "ffs43/darwin_6.0.2.aif", "ffs43/darwin_8.0.1.aif", "ufs1/darwin_1.3.1.aif", "ufs1/darwin_1.4.1.aif", "ufs1/darwin_6.0.2.aif", "ufs1/darwin_8.0.1.aif", @@ -136,7 +136,7 @@ namespace Aaru.Tests.Filesystems 1024000, 1024000, 1024000, 1024000, 204800, 204800, 204800, 204800, 2097152, 2097152, 2097152 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -146,17 +146,17 @@ namespace Aaru.Tests.Filesystems 511488, 511488, 511488, 511488, 102368, 102368, 102368, 102368, 1047660, 1038952, 1038952 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null, null, null, null, null, null, null, null, null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null, null, null, null, null, null, null }; @@ -169,17 +169,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (APM)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FFSPlugin(); int part = -1; @@ -192,14 +192,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -207,7 +207,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class UfsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "ufs1/linux.aif", "ufs2/linux.aif", "ffs43/darwin_1.3.1.aif", "ffs43/darwin_1.4.1.aif", "ffs43/darwin_6.0.2.aif", "ffs43/darwin_8.0.1.aif", "ffs43/dflybsd_1.2.0.aif", "ffs43/dflybsd_3.6.1.aif", @@ -226,7 +226,7 @@ namespace Aaru.Tests.Filesystems 2097152, 16777216, 16777216, 16777216, 2097152 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 @@ -239,19 +239,19 @@ namespace Aaru.Tests.Filesystems 2096472, 2096472, 4192945, 524272 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 2048, 2048, 1024, 1024, 1024, 1024, 1024, 2048, 2048, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 2048, 2048, 4096, 4096, 2048, 2048, 1024, 1024, 1024, 4096, 4096, 2048, 2048 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, "VolumeLabel", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "VolumeLabel", "VolumeLabel", "VolumeLabel", "" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null @@ -266,17 +266,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FFSPlugin(); int part = -1; @@ -296,14 +296,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -311,7 +311,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class UfsNeXt { - readonly string[] _testfiles = + readonly string[] _testFiles = { "nextstep_3.3.aif", "openstep_4.0.aif", "openstep_4.2.aif", "rhapsody_dr1.aif", "rhapsody_dr2.aif" }; @@ -321,7 +321,7 @@ namespace Aaru.Tests.Filesystems 409600, 409600, 409600, 409600, 409600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512 }; @@ -331,17 +331,17 @@ namespace Aaru.Tests.Filesystems 204640, 204640, 204640, 204640, 204464 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null, null, null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null }; @@ -354,17 +354,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (NeXT)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FFSPlugin(); int part = -1; @@ -378,14 +378,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -393,7 +393,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class UfsNeXtFloppy { - readonly string[] _testfiles = + readonly string[] _testFiles = { "nextstep_3.3_mf2dd.img.lz", "nextstep_3.3_mf2hd.img.lz", "openstep_4.0_mf2dd.img.lz", "openstep_4.0_mf2hd.img.lz", "openstep_4.2_mf2dd.img.lz", "openstep_4.2_mf2hd.img.lz", @@ -406,7 +406,7 @@ namespace Aaru.Tests.Filesystems 1440, 2880, 1440, 2880, 1440, 2880, 1440, 2880, 1440, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -416,17 +416,17 @@ namespace Aaru.Tests.Filesystems 624, 1344, 624, 1344, 624, 1344, 624, 1344, 624, 1344 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null, null, null, null, null, null, null, null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null, null, null, null, null, null }; @@ -439,17 +439,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (NeXT)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FFSPlugin(); int part = -1; @@ -463,14 +463,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -478,7 +478,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class UfsRdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amix.aif" }; @@ -488,7 +488,7 @@ namespace Aaru.Tests.Filesystems 1024128 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -498,17 +498,17 @@ namespace Aaru.Tests.Filesystems 511424 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; @@ -521,17 +521,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (RDB)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FFSPlugin(); int part = -1; @@ -544,14 +544,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -559,7 +559,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class UfsSuni86 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "solaris_7.aif" }; @@ -569,7 +569,7 @@ namespace Aaru.Tests.Filesystems 4194304 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -579,17 +579,17 @@ namespace Aaru.Tests.Filesystems 2063376 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null }; @@ -602,17 +602,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "UNIX filesystem (SunOS x86)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new FFSPlugin(); int part = -1; @@ -625,14 +625,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/UNIXBFS.cs b/Aaru.Tests/Filesystems/UNIXBFS.cs index eb500caca..37c35c3dd 100644 --- a/Aaru.Tests/Filesystems/UNIXBFS.cs +++ b/Aaru.Tests/Filesystems/UNIXBFS.cs @@ -40,13 +40,13 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Unixbfs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amix_mf2dd.adf.lz", "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_dshd.img.lz", "att_unix_svr4v2.1_mf2dd.img.lz", "att_unix_svr4v2.1_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.CBM_AMIGA_35_DD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD @@ -57,7 +57,7 @@ namespace Aaru.Tests.Filesystems 1760, 720, 2400, 1440, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512 }; @@ -67,12 +67,12 @@ namespace Aaru.Tests.Filesystems 1760, 720, 2400, 1440, 2880 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512, 512, 512, 512, 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Label", null, null, null, null }; @@ -80,18 +80,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Boot File System", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new BFS(); var wholePart = new Partition @@ -101,12 +101,12 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("BFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("BFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); } } } @@ -114,7 +114,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class UnixbfsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif" }; @@ -124,7 +124,7 @@ namespace Aaru.Tests.Filesystems 262144 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -134,12 +134,12 @@ namespace Aaru.Tests.Filesystems 260096 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 512 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Label" }; @@ -147,17 +147,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Boot File System (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new BFS(); int part = -1; @@ -170,13 +170,13 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("BFS", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("BFS", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); } } } @@ -184,7 +184,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class UnixbfsRdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amix.aif" }; @@ -194,7 +194,7 @@ namespace Aaru.Tests.Filesystems 1024128 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -204,17 +204,17 @@ namespace Aaru.Tests.Filesystems 65024 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 2048 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "UNKNOWN" }; @@ -227,17 +227,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Boot File System (RDB)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new BFS(); int part = -1; @@ -250,14 +250,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/XENIX.cs b/Aaru.Tests/Filesystems/XENIX.cs index 9fdd41355..06488a193 100644 --- a/Aaru.Tests/Filesystems/XENIX.cs +++ b/Aaru.Tests/Filesystems/XENIX.cs @@ -40,14 +40,14 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Xenix { - readonly string[] _testfiles = + readonly string[] _testFiles = { "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz", "scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz", "scoopenserver_5.0.7hw_mf2hd.img.lz" }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD }; @@ -57,7 +57,7 @@ namespace Aaru.Tests.Filesystems 3360, 2400, 1440, 5760, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512 }; @@ -67,17 +67,17 @@ namespace Aaru.Tests.Filesystems 0, 0, 0, 0, 0, 1680, 1200, 720, 2880, 1440 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "", "", "", "", "" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null, null, null }; @@ -90,18 +90,18 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "XENIX filesystem", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new ZZZRawImage(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new SysVfs(); var wholePart = new Partition @@ -111,13 +111,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -125,7 +125,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class XenixMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "xenix_2.3.2d.aif", "xenix_2.3.4h.aif", "scoopenserver_5.0.7hw.aif" }; @@ -135,7 +135,7 @@ namespace Aaru.Tests.Filesystems 40960, 40960, 2097152 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512 }; @@ -145,17 +145,17 @@ namespace Aaru.Tests.Filesystems 0, 0, 0, 19624, 19624, 19624 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "", "", "" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null, null }; @@ -168,17 +168,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "XENIX filesystem (MBR)", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new SysVfs(); int part = -1; @@ -191,14 +191,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_type[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/XFS.cs b/Aaru.Tests/Filesystems/XFS.cs index 072870a4a..779747145 100644 --- a/Aaru.Tests/Filesystems/XFS.cs +++ b/Aaru.Tests/Filesystems/XFS.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class XfsMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif", "linux_4.19_xfs_flashdrive.aif" }; @@ -50,7 +50,7 @@ namespace Aaru.Tests.Filesystems 1048576, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -60,17 +60,17 @@ namespace Aaru.Tests.Filesystems 130816, 127744 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "Volume label", "DicSetter" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "230075b7-9834-b44e-a257-982a058311d8", "ed6b4d35-aa66-ce4a-9d8f-c56dbc6d7c8c" }; @@ -78,15 +78,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "XFS", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "XFS", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new XFS(); int part = -1; @@ -99,14 +99,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("XFS filesystem", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("XFS filesystem", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/Xia.cs b/Aaru.Tests/Filesystems/Xia.cs index f8a08f7ec..868c16fec 100644 --- a/Aaru.Tests/Filesystems/Xia.cs +++ b/Aaru.Tests/Filesystems/Xia.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class XiaMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif", "linux-files.aif" }; @@ -50,7 +50,7 @@ namespace Aaru.Tests.Filesystems 1024000, 2048000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -60,17 +60,17 @@ namespace Aaru.Tests.Filesystems 511528, 1023088 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { null, null }; @@ -78,15 +78,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Xia filesystem", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Xia filesystem", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new Xia(); int part = -1; @@ -99,14 +99,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("Xia filesystem", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("Xia filesystem", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/ZFS.cs b/Aaru.Tests/Filesystems/ZFS.cs index 0883ce18c..5223afd22 100644 --- a/Aaru.Tests/Filesystems/ZFS.cs +++ b/Aaru.Tests/Filesystems/ZFS.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Zfs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "netbsd_7.1.aif" }; @@ -49,7 +49,7 @@ namespace Aaru.Tests.Filesystems 33554432 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -59,17 +59,17 @@ namespace Aaru.Tests.Filesystems 0 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 0 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "NetBSD 7.1" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "2639895335654686206" }; @@ -77,17 +77,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Zettabyte File System", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IFilesystem fs = new ZFS(); var wholePart = new Partition @@ -97,13 +97,13 @@ namespace Aaru.Tests.Filesystems Size = image.Info.Sectors * image.Info.SectorSize }; - Assert.AreEqual(true, fs.Identify(image, wholePart), _testfiles[i]); + Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]); fs.GetInformation(image, wholePart, out _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("ZFS filesystem", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("ZFS filesystem", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/btrfs.cs b/Aaru.Tests/Filesystems/btrfs.cs index 8e59eeba1..cc766d63e 100644 --- a/Aaru.Tests/Filesystems/btrfs.cs +++ b/Aaru.Tests/Filesystems/btrfs.cs @@ -41,7 +41,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Btrfs { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif", "linux_4.19_btrfs_flashdrive.aif" }; @@ -51,7 +51,7 @@ namespace Aaru.Tests.Filesystems 262144, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512 }; @@ -61,17 +61,17 @@ namespace Aaru.Tests.Filesystems 32512, 127744 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VolumeLabel", "btrfs" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "a4fc5201-85cc-6840-8a68-998cab9ae897", "5af44541-0605-f541-af6d-c229576707ab" }; @@ -79,17 +79,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "btrfs", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "btrfs", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IPartition parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), _testfiles[i]); + Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), _testFiles[i]); IFilesystem fs = new BTRFS(); int part = -1; @@ -101,14 +101,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("B-tree file system", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("B-tree file system", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/exFAT.cs b/Aaru.Tests/Filesystems/exFAT.cs index f6257d92a..7e9e167cc 100644 --- a/Aaru.Tests/Filesystems/exFAT.cs +++ b/Aaru.Tests/Filesystems/exFAT.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class ExFatApm { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif" }; @@ -50,7 +50,7 @@ namespace Aaru.Tests.Filesystems 262144 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -60,17 +60,17 @@ namespace Aaru.Tests.Filesystems 32710 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "595AC82C" }; @@ -78,15 +78,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (APM)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (APM)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new exFAT(); int part = -1; @@ -99,14 +99,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("exFAT", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("exFAT", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -114,7 +114,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class ExFatGpt { - readonly string[] _testfiles = + readonly string[] _testFiles = { "macosx_10.11.aif" }; @@ -124,7 +124,7 @@ namespace Aaru.Tests.Filesystems 262144 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512 }; @@ -134,17 +134,17 @@ namespace Aaru.Tests.Filesystems 32208 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "595ACC39" }; @@ -152,15 +152,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (GPT)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (GPT)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new exFAT(); int part = -1; @@ -173,14 +173,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("exFAT", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("exFAT", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } @@ -188,7 +188,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class ExFatMbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif", "macosx_10.11.aif", "win10.aif", "winvista.aif", "linux_4.19_exfat_flashdrive.aif" }; @@ -198,7 +198,7 @@ namespace Aaru.Tests.Filesystems 262144, 262144, 262144, 262144, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512 }; @@ -208,17 +208,17 @@ namespace Aaru.Tests.Filesystems 32464, 32712, 32448, 32208, 15964 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 4096, 4096, 4096, 4096, 32768 }; - readonly string[] _volumename = + readonly string[] _volumeName = { null, null, null, null, null }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "603565AC", "595AC21E", "20126663", "0AC5CA52", "636E083B" }; @@ -226,15 +226,15 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (MBR)", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (MBR)", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); List partitions = Core.Partitions.GetAll(image); IFilesystem fs = new exFAT(); int part = -1; @@ -247,14 +247,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual("exFAT", fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual("exFAT", fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Filesystems/ext2.cs b/Aaru.Tests/Filesystems/ext2.cs index 584a14791..a1ffc47f8 100644 --- a/Aaru.Tests/Filesystems/ext2.cs +++ b/Aaru.Tests/Filesystems/ext2.cs @@ -41,7 +41,7 @@ namespace Aaru.Tests.Filesystems [TestFixture] public class Ext2 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux_ext2.aif", "linux_ext3.aif", "linux_ext4.aif", "netbsd_7.1.aif", "netbsd_7.1_r0.aif", "linux_4.19_ext2_flashdrive.aif", "linux_4.19_ext3_flashdrive.aif", "linux_4.19_ext4_flashdrive.aif" @@ -52,7 +52,7 @@ namespace Aaru.Tests.Filesystems 262144, 262144, 262144, 8388608, 2097152, 1024000, 1024000, 1024000 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512 }; @@ -62,18 +62,18 @@ namespace Aaru.Tests.Filesystems 130048, 130048, 130048, 1046567, 260135, 510976, 510976, 510976 }; - readonly int[] _clustersize = + readonly int[] _clusterSize = { 1024, 1024, 1024, 4096, 4096, 1024, 1024, 1024 }; - readonly string[] _volumename = + readonly string[] _volumeName = { "VolumeLabel", "VolumeLabel", "VolumeLabel", "Volume label", "Volume label", "DicSetter", "DicSetter", "DicSetter" }; - readonly string[] _volumeserial = + readonly string[] _volumeSerial = { "8e3992cf-7d98-e44a-b753-0591a35913eb", "1b411516-5415-4b42-95e6-1a247056a960", "b2f8f305-770f-ad47-abe4-f0484aa319e9", "e72aee05-627b-11e7-a573-0800272a08ec", @@ -89,17 +89,17 @@ namespace Aaru.Tests.Filesystems [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "ext2", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "ext2", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); IPartition parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), _testfiles[i]); + Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), _testFiles[i]); IFilesystem fs = new ext2FS(); int part = -1; @@ -111,14 +111,14 @@ namespace Aaru.Tests.Filesystems break; } - Assert.AreNotEqual(-1, part, $"Partition not found on {_testfiles[i]}"); - Assert.AreEqual(true, fs.Identify(image, partitions[part]), _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 _, null); - Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testfiles[i]); - Assert.AreEqual(_clustersize[i], fs.XmlFsType.ClusterSize, _testfiles[i]); - Assert.AreEqual(_extversion[i], fs.XmlFsType.Type, _testfiles[i]); - Assert.AreEqual(_volumename[i], fs.XmlFsType.VolumeName, _testfiles[i]); - Assert.AreEqual(_volumeserial[i], fs.XmlFsType.VolumeSerial, _testfiles[i]); + Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]); + Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]); + Assert.AreEqual(_extversion[i], fs.XmlFsType.Type, _testFiles[i]); + Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]); + Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]); } } } diff --git a/Aaru.Tests/Images/2MG.cs b/Aaru.Tests/Images/2MG.cs index 448b04b4f..af17eca1e 100644 --- a/Aaru.Tests/Images/2MG.cs +++ b/Aaru.Tests/Images/2MG.cs @@ -38,7 +38,7 @@ namespace Aaru.Tests.Images [TestFixture] public class Apple2Mg { - readonly string[] _testfiles = + readonly string[] _testFiles = { "blank140.2mg.lz", "dos32.2mg.lz", "dos33-do.2mg.lz", "dos33-nib.2mg.lz", "dos33-po.2mg.lz", "prodos1440.2mg.lz" @@ -49,12 +49,12 @@ namespace Aaru.Tests.Images 560, 455, 560, 560, 560, 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 256, 256, 256, 256, 256, 512 }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.Apple33SS, MediaType.Apple32SS, MediaType.Apple33SS, MediaType.Apple33SS, MediaType.Apple33SS, MediaType.DOS_35_HD @@ -69,16 +69,16 @@ namespace Aaru.Tests.Images [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "2mg", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "2mg", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new DiscImages.Apple2Mg(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); // How many sectors to read at once const uint sectorsToRead = 256; @@ -104,7 +104,7 @@ namespace Aaru.Tests.Images ctx.Update(sector); } - Assert.AreEqual(_md5S[i], ctx.End(), _testfiles[i]); + Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]); } } } diff --git a/Aaru.Tests/Images/Anex86.cs b/Aaru.Tests/Images/Anex86.cs index 1759963e1..855390bca 100644 --- a/Aaru.Tests/Images/Anex86.cs +++ b/Aaru.Tests/Images/Anex86.cs @@ -38,7 +38,7 @@ namespace Aaru.Tests.Images [TestFixture] public class Anex86 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "anex86_10mb.hdi.lz", "anex86_15mb.hdi.lz", "anex86_20mb.hdi.lz", "anex86_30mb.hdi.lz", "anex86_40mb.hdi.lz", "anex86_5mb.hdi.lz", "blank_md2hd.fdi.lz", "msdos33d_md2hd.fdi.lz", @@ -50,12 +50,12 @@ namespace Aaru.Tests.Images 40920, 61380, 81840, 121770, 162360, 20196, 1232, 1232, 1232, 1232, 1232 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 256, 256, 256, 256, 256, 256, 1024, 1024, 1024, 1024, 1024 }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.GENERIC_HDD, MediaType.NEC_525_HD, MediaType.NEC_525_HD, @@ -73,16 +73,16 @@ namespace Aaru.Tests.Images [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "Anex86", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "Anex86", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new DiscImages.Anex86(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); // How many sectors to read at once const uint sectorsToRead = 256; @@ -108,7 +108,7 @@ namespace Aaru.Tests.Images ctx.Update(sector); } - Assert.AreEqual(_md5S[i], ctx.End(), _testfiles[i]); + Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]); } } } diff --git a/Aaru.Tests/Images/CisCopy.cs b/Aaru.Tests/Images/CisCopy.cs index 2c569c812..c414752f9 100644 --- a/Aaru.Tests/Images/CisCopy.cs +++ b/Aaru.Tests/Images/CisCopy.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Images public class CisCopy { // TODO: Support compression - readonly string[] _testfiles = + readonly string[] _testFiles = { "md1dd8_all.dcf.lz", "md1dd8_belelung.dcf.lz", "md1dd8_fat.dcf.lz", "md1dd_all.dcf.lz", "md1dd_belelung.dcf.lz", "md1dd_fat.dcf.lz", "md2dd8_all.dcf.lz", "md2dd8_belelung.dcf.lz", @@ -54,12 +54,12 @@ namespace Aaru.Tests.Images 2880 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_8, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_SS_DD_9, MediaType.DOS_525_DS_DD_8, MediaType.DOS_525_DS_DD_8, @@ -83,16 +83,16 @@ namespace Aaru.Tests.Images [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CisCopy", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CisCopy", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new DiscImages.CisCopy(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); // How many sectors to read at once const uint sectorsToRead = 256; @@ -118,7 +118,7 @@ namespace Aaru.Tests.Images ctx.Update(sector); } - Assert.AreEqual(_md5S[i], ctx.End(), _testfiles[i]); + Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]); } } } diff --git a/Aaru.Tests/Images/CopyQM.cs b/Aaru.Tests/Images/CopyQM.cs index 9c5fe06dd..113e47ad2 100644 --- a/Aaru.Tests/Images/CopyQM.cs +++ b/Aaru.Tests/Images/CopyQM.cs @@ -38,7 +38,7 @@ namespace Aaru.Tests.Images [TestFixture] public class CopyQm { - readonly string[] _testfiles = + readonly string[] _testFiles = { "mf2dd.cqm.lz", "mf2dd_fdformat_800.cqm.lz", "mf2dd_freedos.cqm.lz", "mf2hd_blind.cqm.lz", "mf2hd.cqm.lz", "mf2hd_fdformat_168.cqm.lz", "mf2hd_freedos.cqm.lz" @@ -49,13 +49,13 @@ namespace Aaru.Tests.Images 1440, 1600, 1600, 2880, 2880, 3360, 3360 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512 }; // TODO: Add "unknown" media types - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.DOS_35_DS_DD_9, MediaType.CBM_35_DD, MediaType.CBM_35_DD, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DMF, MediaType.DMF @@ -71,16 +71,16 @@ namespace Aaru.Tests.Images [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CopyQM", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "CopyQM", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new DiscImages.CopyQm(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); // How many sectors to read at once const uint sectorsToRead = 256; @@ -106,7 +106,7 @@ namespace Aaru.Tests.Images ctx.Update(sector); } - Assert.AreEqual(_md5S[i], ctx.End(), _testfiles[i]); + Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]); } } } diff --git a/Aaru.Tests/Images/D88.cs b/Aaru.Tests/Images/D88.cs index 88ef2e87d..8d4626d04 100644 --- a/Aaru.Tests/Images/D88.cs +++ b/Aaru.Tests/Images/D88.cs @@ -38,7 +38,7 @@ namespace Aaru.Tests.Images [TestFixture] public class D88 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "1942 (1987)(ASCII)(JP).d77.lz", "'Ashe (1988)(Quasar)(Disk 4 of 4)(User Disk).d88.lz", "Crimsin (1988)(Xtalsoft)(Disk 3 of 3).d88.lz", "Dragon Slayer (1986)(Falcom - Login)(JP).d88.lz", @@ -57,13 +57,13 @@ namespace Aaru.Tests.Images 1280 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 256, 256, 256, 256, 256, 256, 256, 128, 512, 1024, 512, 1024, 512, 1024, 512, 1024, 1024, 1024, 256 }; // TODO: Add "unknown" media types - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.NEC_525_SS, MediaType.NEC_525_SS, MediaType.NEC_525_SS, MediaType.Unknown, MediaType.Unknown, MediaType.NEC_525_SS, MediaType.NEC_525_SS, MediaType.Unknown, MediaType.Unknown, MediaType.NEC_525_HD, @@ -85,16 +85,16 @@ namespace Aaru.Tests.Images [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "D88", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "D88", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new DiscImages.D88(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); // How many sectors to read at once const uint sectorsToRead = 256; @@ -120,7 +120,7 @@ namespace Aaru.Tests.Images ctx.Update(sector); } - Assert.AreEqual(_md5S[i], ctx.End(), _testfiles[i]); + Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]); } } } diff --git a/Aaru.Tests/Images/DART.cs b/Aaru.Tests/Images/DART.cs index 07743c0a8..c43cd7162 100644 --- a/Aaru.Tests/Images/DART.cs +++ b/Aaru.Tests/Images/DART.cs @@ -38,7 +38,7 @@ namespace Aaru.Tests.Images [TestFixture] public class Dart { - readonly string[] _testfiles = + readonly string[] _testFiles = { "mf1dd_hfs_best.dart.lz", "mf1dd_hfs_fast.dart.lz", "mf1dd_mfs_best.dart.lz", "mf1dd_mfs_fast.dart.lz", "mf2dd_hfs_best.dart.lz", "mf2dd_hfs_fast.dart.lz", "mf2dd_mfs_best.dart.lz", "mf2dd_mfs_fast.dart.lz" @@ -49,12 +49,12 @@ namespace Aaru.Tests.Images 800, 800, 800, 800, 1600, 1600, 1600, 1600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.AppleSonyDS @@ -70,16 +70,16 @@ namespace Aaru.Tests.Images [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DART", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DART", _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new DiscImages.Dart(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); // How many sectors to read at once const uint sectorsToRead = 256; @@ -105,7 +105,7 @@ namespace Aaru.Tests.Images ctx.Update(sector); } - Assert.AreEqual(_md5S[i], ctx.End(), _testfiles[i]); + Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]); } } } diff --git a/Aaru.Tests/Images/DiskCopy42.cs b/Aaru.Tests/Images/DiskCopy42.cs index 1fc93470a..195aa2f67 100644 --- a/Aaru.Tests/Images/DiskCopy42.cs +++ b/Aaru.Tests/Images/DiskCopy42.cs @@ -38,7 +38,7 @@ namespace Aaru.Tests.Images [TestFixture] public class DiskCopy42 { - readonly string[] _testfiles = + readonly string[] _testFiles = { // Made with DiskCopy 4.2 "Made by DiskCopy 4.2/mf1dd_hfs.img.lz", "Made by DiskCopy 4.2/mf1dd_mfs.img.lz", @@ -62,12 +62,12 @@ namespace Aaru.Tests.Images 1600 }; - readonly uint[] _sectorsize = + readonly uint[] _sectorSize = { 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512 }; - readonly MediaType[] _mediatypes = + readonly MediaType[] _mediaTypes = { MediaType.AppleSonySS, MediaType.AppleSonySS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.DOS_35_HD, MediaType.AppleSonyDS, MediaType.DOS_35_HD, MediaType.DOS_35_DS_DD_9, @@ -90,18 +90,18 @@ namespace Aaru.Tests.Images [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Media image formats", "DiskCopy 4.2", - _testfiles[i]); + _testFiles[i]); IFilter filter = new LZip(); filter.Open(location); IMediaImage image = new DiscImages.DiskCopy42(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); - Assert.AreEqual(_sectors[i], image.Info.Sectors, _testfiles[i]); - Assert.AreEqual(_sectorsize[i], image.Info.SectorSize, _testfiles[i]); - Assert.AreEqual(_mediatypes[i], image.Info.MediaType, _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); + Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]); + Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]); + Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]); // How many sectors to read at once const uint sectorsToRead = 256; @@ -127,7 +127,7 @@ namespace Aaru.Tests.Images ctx.Update(sector); } - Assert.AreEqual(_md5S[i], ctx.End(), _testfiles[i]); + Assert.AreEqual(_md5S[i], ctx.End(), _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/Acorn.cs b/Aaru.Tests/Partitions/Acorn.cs index b3d51290b..398993fcc 100644 --- a/Aaru.Tests/Partitions/Acorn.cs +++ b/Aaru.Tests/Partitions/Acorn.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class Acorn { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux_ics.aif" }; @@ -100,27 +100,27 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Acorn", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Acorn", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/AppleMap.cs b/Aaru.Tests/Partitions/AppleMap.cs index 1325c50d0..327e1ad5f 100644 --- a/Aaru.Tests/Partitions/AppleMap.cs +++ b/Aaru.Tests/Partitions/AppleMap.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class AppleMap { - readonly string[] _testfiles = + readonly string[] _testFiles = { "d2_driver.aif", "hdt_1.8_encrypted1.aif", "hdt_1.8_encrypted2.aif", "hdt_1.8_password.aif", "hdt_1.8.aif", "linux.aif", "macos_1.1.aif", "macos_2.0.aif", "macos_4.2.aif", "macos_4.3.aif", "macos_6.0.2.aif", @@ -2024,29 +2024,29 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Apple Partition Map", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/Atari.cs b/Aaru.Tests/Partitions/Atari.cs index 40f62a649..bf2f734c4 100644 --- a/Aaru.Tests/Partitions/Atari.cs +++ b/Aaru.Tests/Partitions/Atari.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class Atari { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux_ahdi.aif", "linux_icd.aif", "tos_1.04.aif" }; @@ -318,29 +318,29 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Atari ST", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/BSD.cs b/Aaru.Tests/Partitions/BSD.cs index e6d0d9ab2..8cf1570ce 100644 --- a/Aaru.Tests/Partitions/BSD.cs +++ b/Aaru.Tests/Partitions/BSD.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class Bsd { - readonly string[] _testfiles = + readonly string[] _testFiles = { "parted.aif", "netbsd_1.6.aif", "netbsd_6.1.5.aif", "netbsd_7.1.aif" }; @@ -397,29 +397,29 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "BSD slices", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/GPT.cs b/Aaru.Tests/Partitions/GPT.cs index cfe3baf50..93df13f7a 100644 --- a/Aaru.Tests/Partitions/GPT.cs +++ b/Aaru.Tests/Partitions/GPT.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class Gpt { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif", "parted.aif" }; @@ -159,29 +159,29 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "GUID Partition Table", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/MBR.cs b/Aaru.Tests/Partitions/MBR.cs index 11aded387..30d8a7f26 100644 --- a/Aaru.Tests/Partitions/MBR.cs +++ b/Aaru.Tests/Partitions/MBR.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class Mbr { - readonly string[] _testfiles = + readonly string[] _testFiles = { "concurrentdos_6.0.aif", "darwin_1.4.1.aif", "darwin_6.0.2.aif", "darwin_8.0.1.aif", "drdos_3.40.aif", "drdos_3.41.aif", "drdos_5.00.aif", "drdos_6.00.aif", "drdos_7.02.aif", "drdos_7.03.aif", "drdos_8.0.aif", @@ -1991,30 +1991,30 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Master Boot Record", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testFiles[i]); // Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/MINIX.cs b/Aaru.Tests/Partitions/MINIX.cs index d97a0d2b6..709646d97 100644 --- a/Aaru.Tests/Partitions/MINIX.cs +++ b/Aaru.Tests/Partitions/MINIX.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class Minix { - readonly string[] _testfiles = + readonly string[] _testFiles = { "minix_3.1.2a.aif" }; @@ -99,28 +99,28 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "MINIX", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "MINIX", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]); // Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/PC98.cs b/Aaru.Tests/Partitions/PC98.cs index 6fc9c95a1..b87a14710 100644 --- a/Aaru.Tests/Partitions/PC98.cs +++ b/Aaru.Tests/Partitions/PC98.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class Pc98 { - readonly string[] _testfiles = + readonly string[] _testFiles = { "msdos330.aif", "msdos330_alt.aif", "msdos500_epson.aif", "msdos500.aif", "msdos620.aif" }; @@ -381,25 +381,25 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "PC-98", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "PC-98", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/RDB.cs b/Aaru.Tests/Partitions/RDB.cs index ad7035fd3..07c4001a5 100644 --- a/Aaru.Tests/Partitions/RDB.cs +++ b/Aaru.Tests/Partitions/RDB.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class Rdb { - readonly string[] _testfiles = + readonly string[] _testFiles = { "amigaos_3.9.aif", "amigaos_4.0.aif", "parted.aif" }; @@ -230,29 +230,29 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Rigid Disk Block", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Size, partitions[j].Size, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Name, partitions[j].Name, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Offset, partitions[j].Offset, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/SGI.cs b/Aaru.Tests/Partitions/SGI.cs index 9e93ba506..94a62556f 100644 --- a/Aaru.Tests/Partitions/SGI.cs +++ b/Aaru.Tests/Partitions/SGI.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class Sgi { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif", "parted.aif" }; @@ -222,28 +222,28 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "SGI", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "SGI", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testFiles[i]); // Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/Sun.cs b/Aaru.Tests/Partitions/Sun.cs index da405c66b..bc11ae51a 100644 --- a/Aaru.Tests/Partitions/Sun.cs +++ b/Aaru.Tests/Partitions/Sun.cs @@ -40,7 +40,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class Sun { - readonly string[] _testfiles = + readonly string[] _testFiles = { "linux.aif", "parted.aif" }; @@ -151,28 +151,28 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Sun", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Sun", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testFiles[i]); // Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/VTOC.cs b/Aaru.Tests/Partitions/VTOC.cs index 725050ecc..d6a5d1f25 100644 --- a/Aaru.Tests/Partitions/VTOC.cs +++ b/Aaru.Tests/Partitions/VTOC.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class Vtoc { - readonly string[] _testfiles = + readonly string[] _testFiles = { "att_unix_vtoc.aif" }; @@ -199,30 +199,30 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "UNIX VTOC", - _testfiles[i]); + _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testFiles[i]); // Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); - Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Type, partitions[j].Type, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.Tests/Partitions/Xbox.cs b/Aaru.Tests/Partitions/Xbox.cs index 00e8e88c0..0b0a65f87 100644 --- a/Aaru.Tests/Partitions/Xbox.cs +++ b/Aaru.Tests/Partitions/Xbox.cs @@ -39,7 +39,7 @@ namespace Aaru.Tests.Partitions [TestFixture] public class Xbox { - readonly string[] _testfiles = + readonly string[] _testFiles = { "microsoft256mb.aif" }; @@ -72,25 +72,25 @@ namespace Aaru.Tests.Partitions [Test] public void Test() { - for(int i = 0; i < _testfiles.Length; i++) + for(int i = 0; i < _testFiles.Length; i++) { - string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Xbox", _testfiles[i]); + string location = Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Xbox", _testFiles[i]); IFilter filter = new ZZZNoFilter(); filter.Open(location); IMediaImage image = new AaruFormat(); - Assert.AreEqual(true, image.Open(filter), _testfiles[i]); + Assert.AreEqual(true, image.Open(filter), _testFiles[i]); List partitions = Core.Partitions.GetAll(image); - Assert.AreEqual(_wanted[i].Length, partitions.Count, _testfiles[i]); + Assert.AreEqual(_wanted[i].Length, partitions.Count, _testFiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty - Assert.AreEqual(_wanted[i][j].Description, partitions[j].Description, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testfiles[i]); - Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testfiles[i]); + Assert.AreEqual(_wanted[i][j].Description, partitions[j].Description, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length * 512, partitions[j].Size, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start * 512, partitions[j].Offset, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Length, partitions[j].Length, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Sequence, partitions[j].Sequence, _testFiles[i]); + Assert.AreEqual(_wanted[i][j].Start, partitions[j].Start, _testFiles[i]); } } } diff --git a/Aaru.sln.DotSettings b/Aaru.sln.DotSettings index 77d128266..b84999ede 100644 --- a/Aaru.sln.DotSettings +++ b/Aaru.sln.DotSettings @@ -226,22 +226,35 @@ True True True + True + True True + True + True + True + True True + True + True True True + True + True True True True True True True + True True True True True True + True True + True True True True @@ -253,12 +266,26 @@ True True True + True + True + True + True True True True + True + True + True + True + True True True + True + True + True True + True + True True True True @@ -273,15 +300,25 @@ True True True + True True True + True + True True True + True + True True True + True True True + True + True + True True + True True True True @@ -291,10 +328,19 @@ True True True + True + True + True + True + True + True True + True True True True + True + True True True True @@ -303,21 +349,38 @@ True True True + True + True True True True + True True True + True True True + True + True True + True + True + True + True True True True True True True + True + True + True + True True + True + True + True True True True @@ -329,8 +392,12 @@ True True True + True True + True True + True + True True True True @@ -341,25 +408,54 @@ True True True + True + True + True + True True True True + True True + True + True True True + True True + True True True True + True + True + True True True + True + True + True + True True + True + True + True + True True + True True + True + True + True + True True + True + True True True True True + True True - True \ No newline at end of file + True + True \ No newline at end of file diff --git a/Aaru/Commands/Configure.cs b/Aaru/Commands/Configure.cs index f1fd0cec1..34355e450 100644 --- a/Aaru/Commands/Configure.cs +++ b/Aaru/Commands/Configure.cs @@ -39,7 +39,7 @@ using Aaru.Settings; namespace Aaru.Commands { - internal class ConfigureCommand : Command + internal sealed class ConfigureCommand : Command { readonly bool _autoCall; readonly bool _gdprChange; @@ -53,7 +53,7 @@ namespace Aaru.Commands Handler = CommandHandler.Create((Func)Invoke); } - public int Invoke(bool debug, bool verbose) + int Invoke(bool debug, bool verbose) { if(!_autoCall) { @@ -93,14 +93,14 @@ namespace Aaru.Commands #region Device reports AaruConsole.WriteLine(); - AaruConsole.WriteLine( - "With the 'device-report' command, Aaru creates a report of a device, that includes its\n" + - "manufacturer, model, firmware revision and/or version, attached bus, size, and supported commands.\n" + - "The serial number of the device is not stored in the report. If used with the debug parameter,\n" + - "extra information about the device will be stored in the report. This information is known to contain\n" + - "the device serial number in non-standard places that prevent the automatic removal of it on a handful\n" + - "of devices. A human-readable copy of the report in XML format is always created in the same directory\n" + - "where Aaru is being run from."); + AaruConsole. + WriteLine("With the 'device-report' command, Aaru creates a report of a device, that includes its\n" + + "manufacturer, model, firmware revision and/or version, attached bus, size, and supported commands.\n" + + "The serial number of the device is not stored in the report. If used with the debug parameter,\n" + + "extra information about the device will be stored in the report. This information is known to contain\n" + + "the device serial number in non-standard places that prevent the automatic removal of it on a handful\n" + + "of devices. A human-readable copy of the report in XML format is always created in the same directory\n" + + "where Aaru is being run from."); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) diff --git a/Aaru/Commands/Database/DatabaseFamily.cs b/Aaru/Commands/Database/DatabaseFamily.cs index a772f21b7..7e91de2b7 100644 --- a/Aaru/Commands/Database/DatabaseFamily.cs +++ b/Aaru/Commands/Database/DatabaseFamily.cs @@ -34,10 +34,10 @@ using System.CommandLine; namespace Aaru.Commands.Database { - public class DatabaseFamily : Command + internal sealed class DatabaseFamily : Command { - public DatabaseFamily(bool mainDbUpdate) : base("database", - "Commands to manage the device and statistics database") + internal DatabaseFamily(bool mainDbUpdate) : base("database", + "Commands to manage the device and statistics database") { AddAlias("db"); diff --git a/Aaru/Commands/Database/Statistics.cs b/Aaru/Commands/Database/Statistics.cs index 562b45c42..bf75ad7ef 100644 --- a/Aaru/Commands/Database/Statistics.cs +++ b/Aaru/Commands/Database/Statistics.cs @@ -40,7 +40,7 @@ using Command = System.CommandLine.Command; namespace Aaru.Commands.Database { - internal class StatisticsCommand : Command + internal sealed class StatisticsCommand : Command { public StatisticsCommand() : base("stats", "Shows statistics.") => Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); diff --git a/Aaru/Commands/Database/Update.cs b/Aaru/Commands/Database/Update.cs index a6cfbf79f..619b8f085 100644 --- a/Aaru/Commands/Database/Update.cs +++ b/Aaru/Commands/Database/Update.cs @@ -43,7 +43,7 @@ using Microsoft.EntityFrameworkCore; namespace Aaru.Commands.Database { - internal class UpdateCommand : Command + internal sealed class UpdateCommand : Command { readonly bool _mainDbUpdate; @@ -66,7 +66,7 @@ namespace Aaru.Commands.Database Handler = CommandHandler.Create((Func)Invoke); } - public int Invoke(bool debug, bool verbose, bool clear, bool clearAll) + int Invoke(bool debug, bool verbose, bool clear, bool clearAll) { if(_mainDbUpdate) return (int)ErrorNumber.NoError; diff --git a/Aaru/Commands/Device/DeviceFamily.cs b/Aaru/Commands/Device/DeviceFamily.cs index bbc763107..353393e44 100644 --- a/Aaru/Commands/Device/DeviceFamily.cs +++ b/Aaru/Commands/Device/DeviceFamily.cs @@ -34,7 +34,7 @@ using System.CommandLine; namespace Aaru.Commands.Device { - public class DeviceFamily : Command + internal sealed class DeviceFamily : Command { public DeviceFamily() : base("device", "Commands that talks to devices") { diff --git a/Aaru/Commands/Device/DeviceReport.cs b/Aaru/Commands/Device/DeviceReport.cs index 7919c7ae4..2bd9de129 100644 --- a/Aaru/Commands/Device/DeviceReport.cs +++ b/Aaru/Commands/Device/DeviceReport.cs @@ -54,7 +54,7 @@ using DeviceReport = Aaru.Core.Devices.Report.DeviceReport; namespace Aaru.Commands.Device { - internal class DeviceReportCommand : Command + internal sealed class DeviceReportCommand : Command { public DeviceReportCommand() : base("report", "Tests the device capabilities and creates an JSON report of them.") @@ -119,16 +119,14 @@ namespace Aaru.Commands.Device } catch(DeviceException e) { - AaruConsole.ErrorWriteLine(e.Message ?? Error.Print(e.LastError)); + AaruConsole.ErrorWriteLine(e.Message); return (int)ErrorNumber.CannotOpenDevice; } Statistics.AddDevice(dev); - bool isAdmin; - - isAdmin = dev.IsRemote ? dev.IsRemoteAdmin : DetectOS.IsAdmin; + bool isAdmin = dev.IsRemote ? dev.IsRemoteAdmin : DetectOS.IsAdmin; if(!isAdmin) { @@ -444,7 +442,8 @@ namespace Aaru.Commands.Device case PeripheralDeviceTypes.MultiMediaDevice: { bool iomegaRev = dev.Manufacturer.ToLowerInvariant() == "iomega" && - dev.Model.ToLowerInvariant().StartsWith("rrd"); + dev.Model.ToLowerInvariant(). + StartsWith("rrd", StringComparison.OrdinalIgnoreCase); if(trapDisc) { @@ -1171,13 +1170,14 @@ namespace Aaru.Commands.Device when dev.Model.StartsWith("MDM", StringComparison.Ordinal) || dev.Model.StartsWith("MDH", StringComparison.Ordinal): { - List mediaTypes = new List(); - - mediaTypes.Add("MD DATA (140Mb data MiniDisc)"); - mediaTypes.Add("60 minutes rewritable MiniDisc"); - mediaTypes.Add("74 minutes rewritable MiniDisc"); - mediaTypes.Add("80 minutes rewritable MiniDisc"); - mediaTypes.Add("Embossed Audio MiniDisc"); + List mediaTypes = new List + { + "MD DATA (140Mb data MiniDisc)", + "60 minutes rewritable MiniDisc", + "74 minutes rewritable MiniDisc", + "80 minutes rewritable MiniDisc", + "Embossed Audio MiniDisc" + }; mediaTypes.Sort(); diff --git a/Aaru/Commands/Device/Info.cs b/Aaru/Commands/Device/Info.cs index e7f6b3991..d40adf20e 100644 --- a/Aaru/Commands/Device/Info.cs +++ b/Aaru/Commands/Device/Info.cs @@ -56,7 +56,7 @@ using Tuple = Aaru.Decoders.PCMCIA.Tuple; namespace Aaru.Commands.Device { - internal class DeviceInfoCommand : Command + internal sealed class DeviceInfoCommand : Command { public DeviceInfoCommand() : base("info", "Gets information about a device.") { @@ -828,149 +828,145 @@ namespace Aaru.Commands.Device } } - if(devInfo.PlextorFeatures != null) + if(devInfo.PlextorFeatures?.Eeprom != null) { - if(devInfo.PlextorFeatures.Eeprom != null) - { - DataFile.WriteTo("Device-Info command", outputPrefix, "_plextor_eeprom.bin", - "PLEXTOR READ EEPROM", devInfo.PlextorFeatures.Eeprom); + DataFile.WriteTo("Device-Info command", outputPrefix, "_plextor_eeprom.bin", "PLEXTOR READ EEPROM", + devInfo.PlextorFeatures.Eeprom); - AaruConsole.WriteLine("Drive has loaded a total of {0} discs", devInfo.PlextorFeatures.Discs); + AaruConsole.WriteLine("Drive has loaded a total of {0} discs", devInfo.PlextorFeatures.Discs); - AaruConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading CDs", - devInfo.PlextorFeatures.CdReadTime / 3600, - (devInfo.PlextorFeatures.CdReadTime / 60) % 60, - devInfo.PlextorFeatures.CdReadTime % 60); + AaruConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading CDs", + devInfo.PlextorFeatures.CdReadTime / 3600, + (devInfo.PlextorFeatures.CdReadTime / 60) % 60, + devInfo.PlextorFeatures.CdReadTime % 60); - AaruConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing CDs", - devInfo.PlextorFeatures.CdWriteTime / 3600, - (devInfo.PlextorFeatures.CdWriteTime / 60) % 60, - devInfo.PlextorFeatures.CdWriteTime % 60); - - if(devInfo.PlextorFeatures.IsDvd) - { - AaruConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading DVDs", - devInfo.PlextorFeatures.DvdReadTime / 3600, - (devInfo.PlextorFeatures.DvdReadTime / 60) % 60, - devInfo.PlextorFeatures.DvdReadTime % 60); - - AaruConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing DVDs", - devInfo.PlextorFeatures.DvdWriteTime / 3600, - (devInfo.PlextorFeatures.DvdWriteTime / 60) % 60, - devInfo.PlextorFeatures.DvdWriteTime % 60); - } - } - - if(devInfo.PlextorFeatures.PoweRec) - { - AaruConsole.Write("Drive supports PoweRec"); - - if(devInfo.PlextorFeatures.PoweRecEnabled) - { - AaruConsole.Write(", has it enabled"); - - if(devInfo.PlextorFeatures.PoweRecRecommendedSpeed > 0) - AaruConsole.WriteLine(" and recommends {0} Kb/sec.", - devInfo.PlextorFeatures.PoweRecRecommendedSpeed); - else - AaruConsole.WriteLine("."); - - if(devInfo.PlextorFeatures.PoweRecSelected > 0) - AaruConsole. - WriteLine("Selected PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", - devInfo.PlextorFeatures.PoweRecSelected, - devInfo.PlextorFeatures.PoweRecSelected / 177); - - if(devInfo.PlextorFeatures.PoweRecMax > 0) - AaruConsole. - WriteLine("Maximum PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", - devInfo.PlextorFeatures.PoweRecMax, - devInfo.PlextorFeatures.PoweRecMax / 177); - - if(devInfo.PlextorFeatures.PoweRecLast > 0) - AaruConsole.WriteLine("Last used PoweRec was {0} Kb/sec ({1}x)", - devInfo.PlextorFeatures.PoweRecLast, - devInfo.PlextorFeatures.PoweRecLast / 177); - } - else - { - AaruConsole.WriteLine("."); - AaruConsole.WriteLine("PoweRec is disabled"); - } - } - - if(devInfo.PlextorFeatures.SilentMode) - { - AaruConsole.WriteLine("Drive supports Plextor SilentMode"); - - if(devInfo.PlextorFeatures.SilentModeEnabled) - { - AaruConsole.WriteLine("Plextor SilentMode is enabled:"); - - AaruConsole.WriteLine(devInfo.PlextorFeatures.AccessTimeLimit == 2 ? "\tAccess time is slow" - : "\tAccess time is fast"); - - if(devInfo.PlextorFeatures.CdReadSpeedLimit > 0) - AaruConsole.WriteLine("\tCD read speed limited to {0}x", - devInfo.PlextorFeatures.CdReadSpeedLimit); - - if(devInfo.PlextorFeatures.DvdReadSpeedLimit > 0 && - devInfo.PlextorFeatures.IsDvd) - AaruConsole.WriteLine("\tDVD read speed limited to {0}x", - devInfo.PlextorFeatures.DvdReadSpeedLimit); - - if(devInfo.PlextorFeatures.CdWriteSpeedLimit > 0) - AaruConsole.WriteLine("\tCD write speed limited to {0}x", - devInfo.PlextorFeatures.CdWriteSpeedLimit); - } - } - - if(devInfo.PlextorFeatures.GigaRec) - AaruConsole.WriteLine("Drive supports Plextor GigaRec"); - - if(devInfo.PlextorFeatures.SecuRec) - AaruConsole.WriteLine("Drive supports Plextor SecuRec"); - - if(devInfo.PlextorFeatures.SpeedRead) - { - AaruConsole.Write("Drive supports Plextor SpeedRead"); - - if(devInfo.PlextorFeatures.SpeedReadEnabled) - AaruConsole.WriteLine("and has it enabled"); - else - AaruConsole.WriteLine(); - } - - if(devInfo.PlextorFeatures.Hiding) - { - AaruConsole.WriteLine("Drive supports hiding CD-Rs and forcing single session"); - - if(devInfo.PlextorFeatures.HidesRecordables) - AaruConsole.WriteLine("Drive currently hides CD-Rs"); - - if(devInfo.PlextorFeatures.HidesSessions) - AaruConsole.WriteLine("Drive currently forces single session"); - } - - if(devInfo.PlextorFeatures.VariRec) - AaruConsole.WriteLine("Drive supports Plextor VariRec"); + AaruConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing CDs", + devInfo.PlextorFeatures.CdWriteTime / 3600, + (devInfo.PlextorFeatures.CdWriteTime / 60) % 60, + devInfo.PlextorFeatures.CdWriteTime % 60); if(devInfo.PlextorFeatures.IsDvd) { - if(devInfo.PlextorFeatures.VariRecDvd) - AaruConsole.WriteLine("Drive supports Plextor VariRec for DVDs"); + AaruConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading DVDs", + devInfo.PlextorFeatures.DvdReadTime / 3600, + (devInfo.PlextorFeatures.DvdReadTime / 60) % 60, + devInfo.PlextorFeatures.DvdReadTime % 60); - if(devInfo.PlextorFeatures.BitSetting) - AaruConsole.WriteLine("Drive supports bitsetting DVD+R book type"); - - if(devInfo.PlextorFeatures.BitSettingDl) - AaruConsole.WriteLine("Drive supports bitsetting DVD+R DL book type"); - - if(devInfo.PlextorFeatures.DvdPlusWriteTest) - AaruConsole.WriteLine("Drive supports test writing DVD+"); + AaruConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing DVDs", + devInfo.PlextorFeatures.DvdWriteTime / 3600, + (devInfo.PlextorFeatures.DvdWriteTime / 60) % 60, + devInfo.PlextorFeatures.DvdWriteTime % 60); } } + if(devInfo.PlextorFeatures?.PoweRec == true) + { + AaruConsole.Write("Drive supports PoweRec"); + + if(devInfo.PlextorFeatures.PoweRecEnabled) + { + AaruConsole.Write(", has it enabled"); + + if(devInfo.PlextorFeatures.PoweRecRecommendedSpeed > 0) + AaruConsole.WriteLine(" and recommends {0} Kb/sec.", + devInfo.PlextorFeatures.PoweRecRecommendedSpeed); + else + AaruConsole.WriteLine("."); + + if(devInfo.PlextorFeatures.PoweRecSelected > 0) + AaruConsole. + WriteLine("Selected PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", + devInfo.PlextorFeatures.PoweRecSelected, + devInfo.PlextorFeatures.PoweRecSelected / 177); + + if(devInfo.PlextorFeatures.PoweRecMax > 0) + AaruConsole. + WriteLine("Maximum PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", + devInfo.PlextorFeatures.PoweRecMax, devInfo.PlextorFeatures.PoweRecMax / 177); + + if(devInfo.PlextorFeatures.PoweRecLast > 0) + AaruConsole.WriteLine("Last used PoweRec was {0} Kb/sec ({1}x)", + devInfo.PlextorFeatures.PoweRecLast, + devInfo.PlextorFeatures.PoweRecLast / 177); + } + else + { + AaruConsole.WriteLine("."); + AaruConsole.WriteLine("PoweRec is disabled"); + } + } + + if(devInfo.PlextorFeatures?.SilentMode == true) + { + AaruConsole.WriteLine("Drive supports Plextor SilentMode"); + + if(devInfo.PlextorFeatures.SilentModeEnabled) + { + AaruConsole.WriteLine("Plextor SilentMode is enabled:"); + + AaruConsole.WriteLine(devInfo.PlextorFeatures.AccessTimeLimit == 2 ? "\tAccess time is slow" + : "\tAccess time is fast"); + + if(devInfo.PlextorFeatures.CdReadSpeedLimit > 0) + AaruConsole.WriteLine("\tCD read speed limited to {0}x", + devInfo.PlextorFeatures.CdReadSpeedLimit); + + if(devInfo.PlextorFeatures.DvdReadSpeedLimit > 0 && + devInfo.PlextorFeatures.IsDvd) + AaruConsole.WriteLine("\tDVD read speed limited to {0}x", + devInfo.PlextorFeatures.DvdReadSpeedLimit); + + if(devInfo.PlextorFeatures.CdWriteSpeedLimit > 0) + AaruConsole.WriteLine("\tCD write speed limited to {0}x", + devInfo.PlextorFeatures.CdWriteSpeedLimit); + } + } + + if(devInfo.PlextorFeatures?.GigaRec == true) + AaruConsole.WriteLine("Drive supports Plextor GigaRec"); + + if(devInfo.PlextorFeatures?.SecuRec == true) + AaruConsole.WriteLine("Drive supports Plextor SecuRec"); + + if(devInfo.PlextorFeatures?.SpeedRead == true) + { + AaruConsole.Write("Drive supports Plextor SpeedRead"); + + if(devInfo.PlextorFeatures.SpeedReadEnabled) + AaruConsole.WriteLine("and has it enabled"); + else + AaruConsole.WriteLine(); + } + + if(devInfo.PlextorFeatures?.Hiding == true) + { + AaruConsole.WriteLine("Drive supports hiding CD-Rs and forcing single session"); + + if(devInfo.PlextorFeatures.HidesRecordables) + AaruConsole.WriteLine("Drive currently hides CD-Rs"); + + if(devInfo.PlextorFeatures.HidesSessions) + AaruConsole.WriteLine("Drive currently forces single session"); + } + + if(devInfo.PlextorFeatures?.VariRec == true) + AaruConsole.WriteLine("Drive supports Plextor VariRec"); + + if(devInfo.PlextorFeatures?.IsDvd == true) + { + if(devInfo.PlextorFeatures.VariRecDvd) + AaruConsole.WriteLine("Drive supports Plextor VariRec for DVDs"); + + if(devInfo.PlextorFeatures.BitSetting) + AaruConsole.WriteLine("Drive supports bitsetting DVD+R book type"); + + if(devInfo.PlextorFeatures.BitSettingDl) + AaruConsole.WriteLine("Drive supports bitsetting DVD+R DL book type"); + + if(devInfo.PlextorFeatures.DvdPlusWriteTest) + AaruConsole.WriteLine("Drive supports test writing DVD+"); + } + if(devInfo.ScsiInquiry.Value.KreonPresent) { AaruConsole.WriteLine("Drive has kreon firmware:"); diff --git a/Aaru/Commands/Device/List.cs b/Aaru/Commands/Device/List.cs index 77afed568..ad1491b52 100644 --- a/Aaru/Commands/Device/List.cs +++ b/Aaru/Commands/Device/List.cs @@ -37,10 +37,11 @@ using Aaru.CommonTypes.Enums; using Aaru.Console; using Aaru.Core; using Aaru.Devices; +using JetBrains.Annotations; namespace Aaru.Commands.Device { - internal class ListDevicesCommand : Command + internal sealed class ListDevicesCommand : Command { public ListDevicesCommand() : base("list", "Lists all connected devices.") { @@ -54,7 +55,7 @@ namespace Aaru.Commands.Device Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); } - public static int Invoke(bool debug, bool verbose, string aaruRemoteHost) + public static int Invoke(bool debug, bool verbose, [CanBeNull] string aaruRemoteHost) { MainClass.PrintCopyright(); diff --git a/Aaru/Commands/Filesystem/ExtractFiles.cs b/Aaru/Commands/Filesystem/ExtractFiles.cs index 5b7cdc46a..4afb19761 100644 --- a/Aaru/Commands/Filesystem/ExtractFiles.cs +++ b/Aaru/Commands/Filesystem/ExtractFiles.cs @@ -42,11 +42,12 @@ using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; using Aaru.Console; using Aaru.Core; +using JetBrains.Annotations; using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; namespace Aaru.Commands.Filesystem { - internal class ExtractFilesCommand : Command + internal sealed class ExtractFilesCommand : Command { public ExtractFilesCommand() : base("extract", "Extracts all files in disc image.") { @@ -231,10 +232,6 @@ namespace Aaru.Commands.Filesystem List partitions = Core.Partitions.GetAll(imageFormat); Core.Partitions.AddSchemesToStats(partitions); - List idPlugins; - IReadOnlyFilesystem plugin; - Errno error; - if(partitions.Count == 0) { AaruConsole.DebugWriteLine("Ls command", "No partitions found"); @@ -259,65 +256,73 @@ namespace Aaru.Commands.Filesystem AaruConsole.WriteLine("Identifying filesystem on partition"); - Core.Filesystems.Identify(imageFormat, out idPlugins, partitions[i]); + Core.Filesystems.Identify(imageFormat, out List idPlugins, partitions[i]); if(idPlugins.Count == 0) AaruConsole.WriteLine("Filesystem not identified"); - else if(idPlugins.Count > 1) - { - AaruConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); - - foreach(string pluginName in idPlugins) - if(plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out plugin)) - { - AaruConsole.WriteLine($"As identified by {plugin.Name}."); - - var fs = (IReadOnlyFilesystem)plugin. - GetType().GetConstructor(Type.EmptyTypes)?. - Invoke(new object[] - {}); - - error = fs.Mount(imageFormat, partitions[i], encodingClass, parsedOptions, @namespace); - - if(error == Errno.NoError) - { - string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName) ? "NO NAME" - : fs.XmlFsType.VolumeName; - - ExtractFilesInDir("/", fs, volumeName, outputDir, xattrs); - - Statistics.AddFilesystem(fs.XmlFsType.Type); - } - else - AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); - } - } else { - plugins.ReadOnlyFilesystems.TryGetValue(idPlugins[0], out plugin); + IReadOnlyFilesystem plugin; + Errno error; - if(plugin == null) - continue; - - AaruConsole.WriteLine($"Identified by {plugin.Name}."); - - var fs = (IReadOnlyFilesystem)plugin. - GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - {}); - - error = fs.Mount(imageFormat, partitions[i], encodingClass, parsedOptions, @namespace); - - if(error == Errno.NoError) + if(idPlugins.Count > 1) { - string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName) ? "NO NAME" - : fs.XmlFsType.VolumeName; + AaruConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); - ExtractFilesInDir("/", fs, volumeName, outputDir, xattrs); + foreach(string pluginName in idPlugins) + if(plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out plugin)) + { + AaruConsole.WriteLine($"As identified by {plugin.Name}."); - Statistics.AddFilesystem(fs.XmlFsType.Type); + var fs = (IReadOnlyFilesystem)plugin. + GetType().GetConstructor(Type.EmptyTypes)?. + Invoke(new object[] + {}); + + error = fs.Mount(imageFormat, partitions[i], encodingClass, parsedOptions, + @namespace); + + if(error == Errno.NoError) + { + string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName) ? "NO NAME" + : fs.XmlFsType.VolumeName; + + ExtractFilesInDir("/", fs, volumeName, outputDir, xattrs); + + Statistics.AddFilesystem(fs.XmlFsType.Type); + } + else + AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", + error.ToString()); + } } else - AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); + { + plugins.ReadOnlyFilesystems.TryGetValue(idPlugins[0], out plugin); + + if(plugin == null) + continue; + + AaruConsole.WriteLine($"Identified by {plugin.Name}."); + + var fs = (IReadOnlyFilesystem)plugin. + GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] + {}); + + error = fs.Mount(imageFormat, partitions[i], encodingClass, parsedOptions, @namespace); + + if(error == Errno.NoError) + { + string volumeName = string.IsNullOrEmpty(fs.XmlFsType.VolumeName) ? "NO NAME" + : fs.XmlFsType.VolumeName; + + ExtractFilesInDir("/", fs, volumeName, outputDir, xattrs); + + Statistics.AddFilesystem(fs.XmlFsType.Type); + } + else + AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); + } } } } @@ -332,10 +337,10 @@ namespace Aaru.Commands.Filesystem return (int)ErrorNumber.NoError; } - static void ExtractFilesInDir(string path, IReadOnlyFilesystem fs, string volumeName, string outputDir, - bool doXattrs) + static void ExtractFilesInDir(string path, [NotNull] IReadOnlyFilesystem fs, string volumeName, + string outputDir, bool doXattrs) { - if(path.StartsWith("/")) + if(path.StartsWith('/')) path = path.Substring(1); Errno error = fs.ReadDir(path, out List directory); diff --git a/Aaru/Commands/Filesystem/FilesystemFamily.cs b/Aaru/Commands/Filesystem/FilesystemFamily.cs index f5152d57d..70e905518 100644 --- a/Aaru/Commands/Filesystem/FilesystemFamily.cs +++ b/Aaru/Commands/Filesystem/FilesystemFamily.cs @@ -34,7 +34,7 @@ using System.CommandLine; namespace Aaru.Commands.Filesystem { - public class FilesystemFamily : Command + internal sealed class FilesystemFamily : Command { public FilesystemFamily() : base("filesystem", "Commands to manage filesystems") { diff --git a/Aaru/Commands/Filesystem/Ls.cs b/Aaru/Commands/Filesystem/Ls.cs index ddddb3d8f..3617e1fc7 100644 --- a/Aaru/Commands/Filesystem/Ls.cs +++ b/Aaru/Commands/Filesystem/Ls.cs @@ -42,10 +42,11 @@ using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; using Aaru.Console; using Aaru.Core; +using JetBrains.Annotations; namespace Aaru.Commands.Filesystem { - internal class LsCommand : Command + internal sealed class LsCommand : Command { public LsCommand() : base("list", "Lists files in disc image.") { @@ -204,10 +205,6 @@ namespace Aaru.Commands.Filesystem List partitions = Core.Partitions.GetAll(imageFormat); Core.Partitions.AddSchemesToStats(partitions); - List idPlugins; - IReadOnlyFilesystem plugin; - Errno error; - if(partitions.Count == 0) { AaruConsole.DebugWriteLine("Ls command", "No partitions found"); @@ -232,65 +229,73 @@ namespace Aaru.Commands.Filesystem AaruConsole.WriteLine("Identifying filesystem on partition"); - Core.Filesystems.Identify(imageFormat, out idPlugins, partitions[i]); + Core.Filesystems.Identify(imageFormat, out List idPlugins, partitions[i]); if(idPlugins.Count == 0) AaruConsole.WriteLine("Filesystem not identified"); - else if(idPlugins.Count > 1) - { - AaruConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); - - foreach(string pluginName in idPlugins) - if(plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out plugin)) - { - AaruConsole.WriteLine($"As identified by {plugin.Name}."); - - var fs = (IReadOnlyFilesystem)plugin. - GetType().GetConstructor(Type.EmptyTypes)?. - Invoke(new object[] - {}); - - if(fs == null) - continue; - - error = fs.Mount(imageFormat, partitions[i], encodingClass, parsedOptions, @namespace); - - if(error == Errno.NoError) - { - ListFilesInDir("/", fs, longFormat); - - Statistics.AddFilesystem(fs.XmlFsType.Type); - } - else - AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); - } - } else { - plugins.ReadOnlyFilesystems.TryGetValue(idPlugins[0], out plugin); + IReadOnlyFilesystem plugin; + Errno error; - if(plugin == null) - continue; - - AaruConsole.WriteLine($"Identified by {plugin.Name}."); - - var fs = (IReadOnlyFilesystem)plugin. - GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - {}); - - if(fs == null) - continue; - - error = fs.Mount(imageFormat, partitions[i], encodingClass, parsedOptions, @namespace); - - if(error == Errno.NoError) + if(idPlugins.Count > 1) { - ListFilesInDir("/", fs, longFormat); + AaruConsole.WriteLine($"Identified by {idPlugins.Count} plugins"); - Statistics.AddFilesystem(fs.XmlFsType.Type); + foreach(string pluginName in idPlugins) + if(plugins.ReadOnlyFilesystems.TryGetValue(pluginName, out plugin)) + { + AaruConsole.WriteLine($"As identified by {plugin.Name}."); + + var fs = (IReadOnlyFilesystem)plugin. + GetType().GetConstructor(Type.EmptyTypes)?. + Invoke(new object[] + {}); + + if(fs == null) + continue; + + error = fs.Mount(imageFormat, partitions[i], encodingClass, parsedOptions, + @namespace); + + if(error == Errno.NoError) + { + ListFilesInDir("/", fs, longFormat); + + Statistics.AddFilesystem(fs.XmlFsType.Type); + } + else + AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", + error.ToString()); + } } else - AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); + { + plugins.ReadOnlyFilesystems.TryGetValue(idPlugins[0], out plugin); + + if(plugin == null) + continue; + + AaruConsole.WriteLine($"Identified by {plugin.Name}."); + + var fs = (IReadOnlyFilesystem)plugin. + GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] + {}); + + if(fs == null) + continue; + + error = fs.Mount(imageFormat, partitions[i], encodingClass, parsedOptions, @namespace); + + if(error == Errno.NoError) + { + ListFilesInDir("/", fs, longFormat); + + Statistics.AddFilesystem(fs.XmlFsType.Type); + } + else + AaruConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString()); + } } } } @@ -305,9 +310,9 @@ namespace Aaru.Commands.Filesystem return (int)ErrorNumber.NoError; } - static void ListFilesInDir(string path, IReadOnlyFilesystem fs, bool longFormat) + static void ListFilesInDir(string path, [NotNull] IReadOnlyFilesystem fs, bool longFormat) { - if(path.StartsWith("/")) + if(path.StartsWith('/')) path = path.Substring(1); AaruConsole.WriteLine(string.IsNullOrEmpty(path) ? "Root directory" : $"Directory: {path}"); @@ -363,11 +368,9 @@ namespace Aaru.Commands.Filesystem } else { - if(entry.Value != null && - entry.Value.Attributes.HasFlag(FileAttributes.Directory)) - AaruConsole.WriteLine("{0}/", entry.Key); - else - AaruConsole.WriteLine("{0}", entry.Key); + AaruConsole. + WriteLine(entry.Value?.Attributes.HasFlag(FileAttributes.Directory) == true ? "{0}/" : "{0}", + entry.Key); } AaruConsole.WriteLine(); diff --git a/Aaru/Commands/Filesystem/Options.cs b/Aaru/Commands/Filesystem/Options.cs index daa4442db..580692eb4 100644 --- a/Aaru/Commands/Filesystem/Options.cs +++ b/Aaru/Commands/Filesystem/Options.cs @@ -40,10 +40,11 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Core; +using JetBrains.Annotations; namespace Aaru.Commands.Filesystem { - internal class ListOptionsCommand : Command + internal sealed class ListOptionsCommand : Command { public ListOptionsCommand() : base("options", "Lists all options supported by read-only filesystems.") => Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); @@ -86,7 +87,8 @@ namespace Aaru.Commands.Filesystem return (int)ErrorNumber.NoError; } - static string TypeToString(Type type) + [NotNull] + static string TypeToString([NotNull] Type type) { if(type == typeof(bool)) return "boolean"; diff --git a/Aaru/Commands/Formats.cs b/Aaru/Commands/Formats.cs index aa8b126cd..bffe83a00 100644 --- a/Aaru/Commands/Formats.cs +++ b/Aaru/Commands/Formats.cs @@ -39,11 +39,10 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Core; -using Aaru.Partitions; namespace Aaru.Commands { - internal class FormatsCommand : Command + internal sealed class FormatsCommand : Command { public FormatsCommand() : base("formats", "Lists all supported disc images, partition schemes and file systems.") => diff --git a/Aaru/Commands/Image/Analyze.cs b/Aaru/Commands/Image/Analyze.cs index 25d41aadd..52101a0da 100644 --- a/Aaru/Commands/Image/Analyze.cs +++ b/Aaru/Commands/Image/Analyze.cs @@ -43,7 +43,7 @@ using Aaru.Core; namespace Aaru.Commands.Image { - internal class AnalyzeCommand : Command + internal sealed class AnalyzeCommand : Command { public AnalyzeCommand() : base("analyze", "Analyzes a disc image and searches for partitions and/or filesystems.") diff --git a/Aaru/Commands/Image/Checksum.cs b/Aaru/Commands/Image/Checksum.cs index b428c0d1e..a31e69dd7 100644 --- a/Aaru/Commands/Image/Checksum.cs +++ b/Aaru/Commands/Image/Checksum.cs @@ -44,7 +44,7 @@ using Schemas; namespace Aaru.Commands.Image { - internal class ChecksumCommand : Command + internal sealed class ChecksumCommand : Command { // How many sectors to read at once const uint SECTORS_TO_READ = 256; diff --git a/Aaru/Commands/Image/Compare.cs b/Aaru/Commands/Image/Compare.cs index 9baa89078..288a97c2b 100644 --- a/Aaru/Commands/Image/Compare.cs +++ b/Aaru/Commands/Image/Compare.cs @@ -46,7 +46,7 @@ using ImageInfo = Aaru.CommonTypes.Structs.ImageInfo; namespace Aaru.Commands.Image { - internal class CompareCommand : Command + internal sealed class CompareCommand : Command { public CompareCommand() : base("compare", "Compares two disc images.") { @@ -171,12 +171,12 @@ namespace Aaru.Commands.Image Dictionary image1DiskTags = new Dictionary(); Dictionary image2DiskTags = new Dictionary(); - foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) + foreach(MediaTagType diskTag in Enum.GetValues(typeof(MediaTagType))) { try { - byte[] temparray = input1Format.ReadDiskTag(disktag); - image1DiskTags.Add(disktag, temparray); + byte[] tempArray = input1Format.ReadDiskTag(diskTag); + image1DiskTags.Add(diskTag, tempArray); } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch @@ -186,12 +186,12 @@ namespace Aaru.Commands.Image #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body } - foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) + foreach(MediaTagType diskTag in Enum.GetValues(typeof(MediaTagType))) { try { - byte[] temparray = input2Format.ReadDiskTag(disktag); - image2DiskTags.Add(disktag, temparray); + byte[] tempArray = input2Format.ReadDiskTag(diskTag); + image2DiskTags.Add(diskTag, tempArray); } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch @@ -280,10 +280,10 @@ namespace Aaru.Commands.Image sb.AppendFormat("{0,-38}{1,-20}{2}", "Drive serial number", image1Info.DriveSerialNumber, image2Info.DriveSerialNumber).AppendLine(); - foreach(MediaTagType disktag in + foreach(MediaTagType diskTag in (Enum.GetValues(typeof(MediaTagType)) as MediaTagType[]).OrderBy(e => e.ToString())) - sb.AppendFormat("{0,-38}{1,-20}{2}", $"Has {disktag}?", image1DiskTags.ContainsKey(disktag), - image2DiskTags.ContainsKey(disktag)).AppendLine(); + sb.AppendFormat("{0,-38}{1,-20}{2}", $"Has {diskTag}?", image1DiskTags.ContainsKey(diskTag), + image2DiskTags.ContainsKey(diskTag)).AppendLine(); } AaruConsole.WriteLine("Comparing disk image characteristics"); diff --git a/Aaru/Commands/Image/Convert.cs b/Aaru/Commands/Image/Convert.cs index f159b9fc1..33280b3ba 100644 --- a/Aaru/Commands/Image/Convert.cs +++ b/Aaru/Commands/Image/Convert.cs @@ -54,7 +54,7 @@ using Version = Aaru.CommonTypes.Interop.Version; namespace Aaru.Commands.Image { - internal class ConvertImageCommand : Command + internal sealed class ConvertImageCommand : Command { public ConvertImageCommand() : base("convert", "Converts one image to another format.") { @@ -556,11 +556,12 @@ namespace Aaru.Commands.Image return (int)ErrorNumber.UnsupportedMedia; } - foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags) + foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags.Where(mediaTag => + !outputFormat. + SupportedMediaTags. + Contains(mediaTag) && + !force)) { - if(outputFormat.SupportedMediaTags.Contains(mediaTag) || force) - continue; - AaruConsole.ErrorWriteLine("Converting image will lose media tag {0}, not continuing...", mediaTag); AaruConsole.ErrorWriteLine("If you don't care, use force option."); @@ -569,11 +570,11 @@ namespace Aaru.Commands.Image bool useLong = inputFormat.Info.ReadableSectorTags.Count != 0; - foreach(SectorTagType sectorTag in inputFormat.Info.ReadableSectorTags) + foreach(SectorTagType sectorTag in inputFormat.Info.ReadableSectorTags.Where(sectorTag => + !outputFormat. + SupportedSectorTags. + Contains(sectorTag))) { - if(outputFormat.SupportedSectorTags.Contains(sectorTag)) - continue; - if(force) { if(sectorTag != SectorTagType.CdTrackFlags && @@ -637,11 +638,11 @@ namespace Aaru.Commands.Image CICMMetadataType cicmMetadata = inputFormat.CicmMetadata; List dumpHardware = inputFormat.DumpHardware; - foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags) + foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags.Where(mediaTag => + !force || outputFormat. + SupportedMediaTags. + Contains(mediaTag))) { - if(force && !outputFormat.SupportedMediaTags.Contains(mediaTag)) - continue; - AaruConsole.WriteLine("Converting media tag {0}", mediaTag); byte[] tag = inputFormat.ReadDiskTag(mediaTag); @@ -811,11 +812,9 @@ namespace Aaru.Commands.Image subchannelExtents.Add((int)s); } - foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags.OrderBy(t => t)) + foreach(SectorTagType tag in inputFormat. + Info.ReadableSectorTags.OrderBy(t => t).TakeWhile(tag => useLong)) { - if(!useLong) - break; - switch(tag) { case SectorTagType.AppleSectorTag: @@ -986,11 +985,11 @@ namespace Aaru.Commands.Image SectorTagType.CdTrackIsrc); if(trackFlags.Count > 0) - foreach(KeyValuePair flags in trackFlags) + foreach((byte track, byte flags) in trackFlags) outputOptical.WriteSectorTag(new[] { - flags.Value - }, flags.Key, SectorTagType.CdTrackFlags); + flags + }, track, SectorTagType.CdTrackFlags); if(mcn != null) outputOptical.WriteMediaTag(Encoding.UTF8.GetBytes(mcn), MediaTagType.CD_MCN); @@ -1098,11 +1097,8 @@ namespace Aaru.Commands.Image AaruConsole.WriteLine(); - foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags) + foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags.TakeWhile(tag => useLong)) { - if(!useLong) - break; - switch(tag) { case SectorTagType.AppleSectorTag: diff --git a/Aaru/Commands/Image/CreateSidecar.cs b/Aaru/Commands/Image/CreateSidecar.cs index 5c2061335..2cdb85b3c 100644 --- a/Aaru/Commands/Image/CreateSidecar.cs +++ b/Aaru/Commands/Image/CreateSidecar.cs @@ -43,11 +43,12 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Core; +using JetBrains.Annotations; using Schemas; namespace Aaru.Commands.Image { - internal class CreateSidecarCommand : Command + internal sealed class CreateSidecarCommand : Command { public CreateSidecarCommand() : base("create-sidecar", "Creates CICM Metadata XML sidecar.") { @@ -90,8 +91,8 @@ namespace Aaru.Commands.Image Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); } - public static int Invoke(bool debug, bool verbose, uint blockSize, string encodingName, string imagePath, - bool tape) + public static int Invoke(bool debug, bool verbose, uint blockSize, [CanBeNull] string encodingName, + string imagePath, bool tape) { MainClass.PrintCopyright(); diff --git a/Aaru/Commands/Image/Decode.cs b/Aaru/Commands/Image/Decode.cs index 01ddb6caa..0db3f3042 100644 --- a/Aaru/Commands/Image/Decode.cs +++ b/Aaru/Commands/Image/Decode.cs @@ -43,7 +43,7 @@ using Aaru.Decoders.SCSI; namespace Aaru.Commands.Image { - internal class DecodeCommand : Command + internal sealed class DecodeCommand : Command { public DecodeCommand() : base("decode", "Decodes and pretty prints disk and/or sector tags.") { diff --git a/Aaru/Commands/Image/Entropy.cs b/Aaru/Commands/Image/Entropy.cs index 4cebb8051..447bee910 100644 --- a/Aaru/Commands/Image/Entropy.cs +++ b/Aaru/Commands/Image/Entropy.cs @@ -40,7 +40,7 @@ using Aaru.Core; namespace Aaru.Commands.Image { - internal class EntropyCommand : Command + internal sealed class EntropyCommand : Command { public EntropyCommand() : base("entropy", "Calculates entropy and/or duplicated sectors of an image.") { diff --git a/Aaru/Commands/Image/ImageFamily.cs b/Aaru/Commands/Image/ImageFamily.cs index 92dd61302..4ac4460dc 100644 --- a/Aaru/Commands/Image/ImageFamily.cs +++ b/Aaru/Commands/Image/ImageFamily.cs @@ -34,7 +34,7 @@ using System.CommandLine; namespace Aaru.Commands.Image { - public class ImageFamily : Command + internal sealed class ImageFamily : Command { public ImageFamily() : base("image", "Commands to manage images") { diff --git a/Aaru/Commands/Image/Info.cs b/Aaru/Commands/Image/Info.cs index 11aebe0db..241979172 100644 --- a/Aaru/Commands/Image/Info.cs +++ b/Aaru/Commands/Image/Info.cs @@ -41,7 +41,7 @@ using Aaru.Core; namespace Aaru.Commands.Image { - internal class ImageInfoCommand : Command + internal sealed class ImageInfoCommand : Command { public ImageInfoCommand() : base("info", "Opens a media image and shows information about the media it represents and metadata.") diff --git a/Aaru/Commands/Image/Options.cs b/Aaru/Commands/Image/Options.cs index bf49bfff5..1a826187a 100644 --- a/Aaru/Commands/Image/Options.cs +++ b/Aaru/Commands/Image/Options.cs @@ -40,10 +40,11 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Core; +using JetBrains.Annotations; namespace Aaru.Commands.Image { - internal class ListOptionsCommand : Command + internal sealed class ListOptionsCommand : Command { public ListOptionsCommand() : base("options", "Lists all options supported by writable media images.") => Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); @@ -88,7 +89,8 @@ namespace Aaru.Commands.Image return (int)ErrorNumber.NoError; } - static string TypeToString(Type type) + [NotNull] + static string TypeToString([NotNull] Type type) { if(type == typeof(bool)) return "boolean"; diff --git a/Aaru/Commands/Image/Print.cs b/Aaru/Commands/Image/Print.cs index a43411cd7..807754fb5 100644 --- a/Aaru/Commands/Image/Print.cs +++ b/Aaru/Commands/Image/Print.cs @@ -41,7 +41,7 @@ using Aaru.Helpers; namespace Aaru.Commands.Image { - internal class PrintHexCommand : Command + internal sealed class PrintHexCommand : Command { public PrintHexCommand() : base("print", "Prints a sector, in hexadecimal values, to the console.") { diff --git a/Aaru/Commands/Image/Verify.cs b/Aaru/Commands/Image/Verify.cs index ee718cb31..66a5b35bb 100644 --- a/Aaru/Commands/Image/Verify.cs +++ b/Aaru/Commands/Image/Verify.cs @@ -43,7 +43,7 @@ using Aaru.Core; namespace Aaru.Commands.Image { - internal class VerifyCommand : Command + internal sealed class VerifyCommand : Command { public VerifyCommand() : base("verify", "Verifies a disc image integrity, and if supported, sector integrity.") { @@ -131,7 +131,7 @@ namespace Aaru.Commands.Image { AaruConsole.ErrorWriteLine("The specified image does not support any kind of verification"); - return (int)ErrorNumber.NotVerificable; + return (int)ErrorNumber.NotVerifiable; } if(verifyDisc && verifiableImage != null) @@ -307,7 +307,7 @@ namespace Aaru.Commands.Image switch(correctImage) { - case null when correctSectors is null: return (int)ErrorNumber.NotVerificable; + case null when correctSectors is null: return (int)ErrorNumber.NotVerifiable; case null when correctSectors == false: return (int)ErrorNumber.BadSectorsImageNotVerified; case null when correctSectors == true: return (int)ErrorNumber.CorrectSectorsImageNotVerified; case false when correctSectors is null: return (int)ErrorNumber.BadImageSectorsNotVerified; diff --git a/Aaru/Commands/ListEncodings.cs b/Aaru/Commands/ListEncodings.cs index 32196645b..b86eaf457 100644 --- a/Aaru/Commands/ListEncodings.cs +++ b/Aaru/Commands/ListEncodings.cs @@ -41,7 +41,7 @@ using Aaru.Core; namespace Aaru.Commands { - internal class ListEncodingsCommand : Command + internal sealed class ListEncodingsCommand : Command { public ListEncodingsCommand() : base("list-encodings", "Lists all supported text encodings and code pages.") => Handler = CommandHandler.Create(GetType().GetMethod(nameof(Invoke))); diff --git a/Aaru/Commands/ListNamespaces.cs b/Aaru/Commands/ListNamespaces.cs index 94ba8c5a0..390807b10 100644 --- a/Aaru/Commands/ListNamespaces.cs +++ b/Aaru/Commands/ListNamespaces.cs @@ -42,7 +42,7 @@ using Aaru.Core; namespace Aaru.Commands { - internal class ListNamespacesCommand : Command + internal sealed class ListNamespacesCommand : Command { public ListNamespacesCommand() : base("list-namespaces", "Lists all namespaces supported by read-only filesystems.") => @@ -64,11 +64,9 @@ namespace Aaru.Commands PluginBase plugins = GetPluginBase.Instance; - foreach(KeyValuePair kvp in plugins.ReadOnlyFilesystems) + foreach(KeyValuePair kvp in + plugins.ReadOnlyFilesystems.Where(kvp => !(kvp.Value.Namespaces is null))) { - if(kvp.Value.Namespaces is null) - continue; - AaruConsole.WriteLine("\tNamespaces for {0}:", kvp.Value.Name); AaruConsole.WriteLine("\t\t{0,-16} {1,-16}", "Namespace", "Description"); diff --git a/Aaru/Commands/Media/Dump.cs b/Aaru/Commands/Media/Dump.cs index 6cedd0a3b..de5f5ce8e 100644 --- a/Aaru/Commands/Media/Dump.cs +++ b/Aaru/Commands/Media/Dump.cs @@ -55,7 +55,7 @@ using Schemas; namespace Aaru.Commands.Media { // TODO: Add raw dumping - internal class DumpMediaCommand : Command + internal sealed class DumpMediaCommand : Command { public DumpMediaCommand() : base("dump", "Dumps the media inserted on a device to a media image.") { @@ -279,7 +279,7 @@ namespace Aaru.Commands.Media bool trim, string outputPath, string options, bool persistent, ushort retryPasses, uint skip, byte speed, bool stopOnError, string format, string subchannel, bool @private, bool fixSubchannelPosition, bool retrySubchannel, bool fixSubchannel, - bool fixSubchannelCrc, bool generateSubchannels, bool skipCdireadyHole, bool eject) + bool fixSubchannelCrc, bool generateSubchannels, bool skipCdiReadyHole, bool eject) { MainClass.PrintCopyright(); @@ -322,7 +322,7 @@ namespace Aaru.Commands.Media AaruConsole.DebugWriteLine("Dump-Media command", "--fix-subchannel={0}", fixSubchannel); AaruConsole.DebugWriteLine("Dump-Media command", "--fix-subchannel-crc={0}", fixSubchannelCrc); AaruConsole.DebugWriteLine("Dump-Media command", "--generate-subchannels={0}", generateSubchannels); - AaruConsole.DebugWriteLine("Dump-Media command", "--skip-cdiready-hole={0}", skipCdireadyHole); + AaruConsole.DebugWriteLine("Dump-Media command", "--skip-cdiready-hole={0}", skipCdiReadyHole); AaruConsole.DebugWriteLine("Dump-Media command", "--eject={0}", eject); // TODO: Disabled temporarily @@ -610,7 +610,7 @@ namespace Aaru.Commands.Media outputPrefix + extension, parsedOptions, sidecar, skip, metadata, trim, firstPregap, fixOffset, debug, wantedSubchannel, speed, @private, fixSubchannelPosition, retrySubchannel, fixSubchannel, fixSubchannelCrc, - skipCdireadyHole, errorLog, generateSubchannels); + skipCdiReadyHole, errorLog, generateSubchannels); dumper.UpdateStatus += Progress.UpdateStatus; dumper.ErrorMessage += Progress.ErrorMessage; diff --git a/Aaru/Commands/Media/Info.cs b/Aaru/Commands/Media/Info.cs index 70decf689..27f5662d9 100644 --- a/Aaru/Commands/Media/Info.cs +++ b/Aaru/Commands/Media/Info.cs @@ -61,7 +61,7 @@ using Spare = Aaru.Decoders.DVD.Spare; namespace Aaru.Commands.Media { - internal class MediaInfoCommand : Command + internal sealed class MediaInfoCommand : Command { public MediaInfoCommand() : base("info", "Gets information about the media inserted on a device.") { @@ -567,9 +567,8 @@ namespace Aaru.Commands.Media { uint blockSize = 2352; - Track[] tracks = Dump.GetCdTracks(ref blockSize, dev, scsiInfo.MediaType, null, false, - out long lastSector, null, null, null, TrackSubchannelType.None, - out _, null, null); + Track[] tracks = Dump.GetCdTracks(ref blockSize, dev, null, false, out long lastSector, null, null, + null, TrackSubchannelType.None, out _, null, null); if(tracks != null) { @@ -608,11 +607,9 @@ namespace Aaru.Commands.Media AaruConsole.WriteLine(); AaruConsole.WriteLine("Offsets:"); - CdOffset cdOffset = null; - // Search for read offset in main database - cdOffset = ctx.CdOffsets.FirstOrDefault(d => d.Manufacturer == dev.Manufacturer && - d.Model == dev.Model); + CdOffset cdOffset = ctx.CdOffsets.FirstOrDefault(d => d.Manufacturer == dev.Manufacturer && + d.Model == dev.Model); CompactDisc.GetOffset(cdOffset, dbDev, debug, dev, scsiInfo.MediaType, null, tracks, null, out int? driveOffset, out int? combinedOffset, out _); diff --git a/Aaru/Commands/Media/MediaFamily.cs b/Aaru/Commands/Media/MediaFamily.cs index 55f76799f..5808fbe61 100644 --- a/Aaru/Commands/Media/MediaFamily.cs +++ b/Aaru/Commands/Media/MediaFamily.cs @@ -34,7 +34,7 @@ using System.CommandLine; namespace Aaru.Commands.Media { - public class MediaFamily : Command + internal sealed class MediaFamily : Command { public MediaFamily() : base("media", "Commands to manage media inserted in devices") { diff --git a/Aaru/Commands/Media/Scan.cs b/Aaru/Commands/Media/Scan.cs index 9d48b9256..d41a2167b 100644 --- a/Aaru/Commands/Media/Scan.cs +++ b/Aaru/Commands/Media/Scan.cs @@ -40,7 +40,7 @@ using Aaru.Devices; namespace Aaru.Commands.Media { - internal class MediaScanCommand : Command + internal sealed class MediaScanCommand : Command { public MediaScanCommand() : base("scan", "Scans the media inserted on a device.") { @@ -115,7 +115,7 @@ namespace Aaru.Commands.Media } catch(DeviceException e) { - AaruConsole.ErrorWriteLine(e.Message ?? Error.Print(e.LastError)); + AaruConsole.ErrorWriteLine(e.Message); return (int)ErrorNumber.CannotOpenDevice; } @@ -159,15 +159,10 @@ namespace Aaru.Commands.Media AaruConsole.WriteLine(); - #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator + if(results.SeekTotal > 0 || + results.SeekMin < double.MaxValue || + results.SeekMax > double.MinValue) - // ReSharper disable CompareOfFloatsByEqualityOperator - if(results.SeekTotal != 0 || - results.SeekMin != double.MaxValue || - results.SeekMax != double.MinValue) - - // ReSharper restore CompareOfFloatsByEqualityOperator - #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator AaruConsole. WriteLine("Testing {0} seeks, longest seek took {1:F3} ms, fastest one took {2:F3} ms. ({3:F3} ms average)", results.SeekTimes, results.SeekMax, results.SeekMin, results.SeekTotal / 1000); diff --git a/Aaru/Commands/Remote.cs b/Aaru/Commands/Remote.cs index 91cac2633..cb2619c05 100644 --- a/Aaru/Commands/Remote.cs +++ b/Aaru/Commands/Remote.cs @@ -42,7 +42,7 @@ using Remote = Aaru.Devices.Remote.Remote; namespace Aaru.Commands { - internal class RemoteCommand : Command + internal sealed class RemoteCommand : Command { public RemoteCommand() : base("remote", "Tests connection to a Aaru Remote Server.") { @@ -74,7 +74,7 @@ namespace Aaru.Commands try { - if(host.ToLowerInvariant().StartsWith("aaru://")) + if(host.StartsWith("aaru://", StringComparison.CurrentCultureIgnoreCase)) host = host.Substring(7); var remote = new Remote(host); diff --git a/Aaru/Main.cs b/Aaru/Main.cs index 89204ba00..15797e4ef 100644 --- a/Aaru/Main.cs +++ b/Aaru/Main.cs @@ -106,20 +106,20 @@ namespace Aaru } // Remove duplicates - foreach(var duplicate in ctx.SeenDevices.AsEnumerable().GroupBy(a => new + foreach(var duplicate in ctx.SeenDevices.AsEnumerable()!.GroupBy(a => new { a.Manufacturer, a.Model, a.Revision, a.Bus }).Where(a => a.Count() > 1).Distinct().Select(a => a.Key)) - ctx.RemoveRange(ctx.SeenDevices. - Where(d => d.Manufacturer == duplicate.Manufacturer && d.Model == duplicate.Model && - d.Revision == duplicate.Revision && d.Bus == duplicate.Bus).Skip(1)); + ctx.RemoveRange(ctx.SeenDevices!. + Where(d => d.Manufacturer == duplicate.Manufacturer && d.Model == duplicate.Model && + d.Revision == duplicate.Revision && d.Bus == duplicate.Bus).Skip(1)); // Remove nulls - ctx.RemoveRange(ctx.SeenDevices.Where(d => d.Manufacturer == null && d.Model == null && - d.Revision == null)); + ctx.RemoveRange(ctx.SeenDevices!.Where(d => d.Manufacturer == null && d.Model == null && + d.Revision == null)); ctx.SaveChanges();