From c4fa4e8674357d4b426c414e812e9636792c465c Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 15 Nov 2022 15:58:40 +0000 Subject: [PATCH] General code cleanup and style refactor. --- Aaru.CommonTypes.csproj | 256 ++++++++++---------- Aaru.CommonTypes.csproj.DotSettings | 7 +- Enums/ErrorNumber.cs | 4 +- Enums/Images.cs | 4 +- Enums/Nes.cs | 122 +++------- Extents/ExtentsByte.cs | 6 +- Extents/ExtentsConverter.cs | 10 +- Extents/ExtentsInt.cs | 6 +- Extents/ExtentsLong.cs | 6 +- Extents/ExtentsSByte.cs | 6 +- Extents/ExtentsShort.cs | 6 +- Extents/ExtentsUInt.cs | 6 +- Extents/ExtentsULong.cs | 6 +- Extents/ExtentsUShort.cs | 6 +- Filters.cs | 7 +- Geometry.cs | 4 +- Interfaces/IArchive.cs | 4 +- Interfaces/IBaseImage.cs | 4 +- Interfaces/IBaseWritableImage.cs | 4 +- Interfaces/IByteAddressableImage.cs | 4 +- Interfaces/IFilesystem.cs | 4 +- Interfaces/IFilter.cs | 8 +- Interfaces/IFloppyImage.cs | 6 +- Interfaces/IMediaImage.cs | 4 +- Interfaces/IOpticalMediaImage.cs | 4 +- Interfaces/IPartition.cs | 4 +- Interfaces/IPartitionableMediaImage.cs | 4 +- Interfaces/IPluginRegister.cs | 4 +- Interfaces/IReadOnlyFilesystem.cs | 4 +- Interfaces/ITapeImage.cs | 4 +- Interfaces/IVerifiableSectorsImage.cs | 4 +- Interfaces/IWritableFloppyImage.cs | 4 +- Interfaces/IWritableImage.cs | 4 +- Interfaces/IWritableOpticalImage.cs | 4 +- Interfaces/IWritableTapeImage.cs | 4 +- Interop/DetectOS.cs | 4 +- Interop/PlatformID.cs | 4 +- Interop/Version.cs | 4 +- MediaType.cs | 319 +++++++------------------ MediaTypeFromDevice/FromAta.cs | 5 +- MediaTypeFromDevice/FromMmc.cs | 4 +- MediaTypeFromDevice/FromOdc.cs | 4 +- MediaTypeFromDevice/FromSbc.cs | 4 +- MediaTypeFromDevice/FromScsi.cs | 4 +- MediaTypeFromDevice/FromSsc.cs | 4 +- Metadata/CdOffset.cs | 4 +- Metadata/DeviceReport.cs | 14 +- Metadata/DeviceReportV2.cs | 20 +- Metadata/Dimensions.cs | 4 +- Metadata/Resume.cs | 4 +- Metadata/Statistics.cs | 4 +- Metadata/Version.cs | 4 +- Partition.cs | 4 +- PluginBase.cs | 4 +- Structs/Devices/ATA/Identify.cs | 141 ++++------- Structs/Devices/SCSI/Enums.cs | 4 +- Structs/Devices/SCSI/Inquiry.cs | 26 +- Structs/Devices/SCSI/Modes/2A.cs | 28 +-- Structs/Filesystems.cs | 4 +- Structs/Images.cs | 4 +- 60 files changed, 453 insertions(+), 716 deletions(-) diff --git a/Aaru.CommonTypes.csproj b/Aaru.CommonTypes.csproj index f803ae399..df7255b25 100644 --- a/Aaru.CommonTypes.csproj +++ b/Aaru.CommonTypes.csproj @@ -1,131 +1,131 @@  - - 2.0 - {F2B84194-26EB-4227-B1C5-6602517E85AE} - Library - Aaru.CommonTypes - Aaru.CommonTypes - $(Version) - false - true - 6.0.0-alpha8 - Claunia.com - Copyright © 2011-2022 Natalia Portillo - Aaru Data Preservation Suite - Aaru.CommonTypes - $(Version) - net7.0 - 11 - Contains common types defined by the Aaru Data Preservation Suite. - https://github.com/aaru-dps/ - MIT - https://github.com/aaru-dps/Aaru.CommonTypes - true - en-US - true - true - snupkg - Natalia Portillo <claunia@claunia.com> - true - true - - - CS1591;CS1574 - - - - - - - $(Version)+{chash:8} - true - true - - - - Metadata/cicm.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LICENSE.MIT - - - - - - + + 2.0 + {F2B84194-26EB-4227-B1C5-6602517E85AE} + Library + Aaru.CommonTypes + Aaru.CommonTypes + $(Version) + false + true + 6.0.0-alpha8 + Claunia.com + Copyright © 2011-2022 Natalia Portillo + Aaru Data Preservation Suite + Aaru.CommonTypes + $(Version) + net7.0 + 11 + Contains common types defined by the Aaru Data Preservation Suite. + https://github.com/aaru-dps/ + MIT + https://github.com/aaru-dps/Aaru.CommonTypes + true + en-US + true + true + snupkg + Natalia Portillo <claunia@claunia.com> + true + true + + + CS1591;CS1574 + + + + + + + $(Version)+{chash:8} + true + true + + + + Metadata/cicm.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LICENSE.MIT + + + + + + diff --git a/Aaru.CommonTypes.csproj.DotSettings b/Aaru.CommonTypes.csproj.DotSettings index b76a6bac6..a3c439af3 100644 --- a/Aaru.CommonTypes.csproj.DotSettings +++ b/Aaru.CommonTypes.csproj.DotSettings @@ -1,2 +1,5 @@ - - True \ No newline at end of file + + True \ No newline at end of file diff --git a/Enums/ErrorNumber.cs b/Enums/ErrorNumber.cs index 4f2f36206..a43770faf 100644 --- a/Enums/ErrorNumber.cs +++ b/Enums/ErrorNumber.cs @@ -36,10 +36,10 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Enums; - using System.Diagnostics.CodeAnalysis; +namespace Aaru.CommonTypes.Enums; + /// Enumerates error codes. Negative for UNIX error number equivalents, positive for Aaru error numbers. [SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "UnusedMember.Global"), SuppressMessage("ReSharper", "IdentifierTypo")] diff --git a/Enums/Images.cs b/Enums/Images.cs index 2d1112138..8cc85b7c3 100644 --- a/Enums/Images.cs +++ b/Enums/Images.cs @@ -39,11 +39,11 @@ // ReSharper disable UnusedMember.Global -namespace Aaru.CommonTypes.Enums; - using System; using System.Diagnostics.CodeAnalysis; +namespace Aaru.CommonTypes.Enums; + /// Track (as partitioning element) types. public enum TrackType : byte { diff --git a/Enums/Nes.cs b/Enums/Nes.cs index ef63af05f..1f22a8646 100644 --- a/Enums/Nes.cs +++ b/Enums/Nes.cs @@ -1,119 +1,61 @@ // ReSharper disable InconsistentNaming + namespace Aaru.CommonTypes.Enums; public enum NesConsoleType : byte { - Nes = 0, - Vs = 1, - Playchoice = 2, - Extended = 3 + Nes = 0, Vs = 1, Playchoice = 2, + Extended = 3 } public enum NesTimingMode : byte { - RP2C02 = 0, - RP2C07 = 1, - Multiple = 2, + RP2C02 = 0, RP2C07 = 1, Multiple = 2, UMC6527P = 3 } public enum NesVsPpuType : byte { - RP2C03B = 0, - RP2C03G = 1, - RP2C04_0001 = 2, - RP2C04_0002 = 3, - RP2C04_0003 = 4, - RP2C04_0004 = 5, - RC2C03B = 6, - RC2C03C = 7, - RC2C05_01 = 8, - RC2C05_02 = 9, - RC2C05_03 = 10, - RC2C05_04 = 11, + RP2C03B = 0, RP2C03G = 1, RP2C04_0001 = 2, + RP2C04_0002 = 3, RP2C04_0003 = 4, RP2C04_0004 = 5, + RC2C03B = 6, RC2C03C = 7, RC2C05_01 = 8, + RC2C05_02 = 9, RC2C05_03 = 10, RC2C05_04 = 11, RC2C05_05 = 12 } public enum NesVsHardwareType : byte { - Normal = 0, - RBI = 1, - TKO = 2, - SuperXevious = 3, - IceClimber = 4, - Dual = 5, + Normal = 0, RBI = 1, TKO = 2, + SuperXevious = 3, IceClimber = 4, Dual = 5, RaidOnBungeling = 6 } public enum NesExtendedConsoleType : byte { - Normal = 0, - Vs = 1, - Playchoice = 2, - DecimalMode = 3, - VT01_Monochrome = 4, - VT01 = 5, - VT02 = 6, - VT03 = 7, - VT09 = 8, - VT32 = 9, - VT369 = 10, - UM6578 = 11 + Normal = 0, Vs = 1, Playchoice = 2, + DecimalMode = 3, VT01_Monochrome = 4, VT01 = 5, + VT02 = 6, VT03 = 7, VT09 = 8, + VT32 = 9, VT369 = 10, UM6578 = 11 } public enum NesDefaultExpansionDevice : byte { - Unspecified = 0, - Controller = 1, - FourScore = 2, - FourPlayersAdapter = 3, - Vs = 4, - VsSystem = 5, - VsPinball = 6, - VsZapper = 7, - Zapper = 8, - TwoZappers = 9, - HyperShotLightgun = 0xA, - PowerPadSideA = 0xB, - PowerPadSideB = 0xC, - FamilyTrainerSideA = 0xD, - FamilyTrainerSideB = 0xE, - ArkanoidVaus = 0xF, - ArkanoidVausFamicom = 0x10, - TwoVausDataRecorder = 0x11, - HyperShotController = 0x12, - CoconutsPachinko = 0x13, - ExcitingBoxing = 0x14, - JissenMahjong = 0x15, - PartyTap = 0x16, - OekaKidsTablet = 0x17, - SunsoftBarcodeBattler = 0x18, - PianoKeyboard = 0x19, - PokkunMoguraa = 0x1A, - TopRider = 0x1B, - DoubleFisted = 0x1C, - Famicom3DSystem = 0x1D, - DoremikkoKeyboard = 0x1E, - GyroSet = 0x1F, - DataRecorder = 0x20, - TurboFile = 0x21, - StorageBattleBox = 0x22, - FamilyBASICKeyboardDataRecorder = 0x23, - DongdaKeyboard = 0x24, - BitCorpKeyboard = 0x25, - SuborKeyboard = 0x26, - SuborKeyboardMouse = 0x27, - SuborKeyboardMouse24 = 0x28, - SNESMouse = 0x29, - Multicart = 0x2A, - SNESControllers = 0x2B, - RacerMateBicycle = 0x2C, - UForce = 0x2D, - StackUp = 0x2E, - PatrolmanLightgun = 0x2F, - C1CassetteInterface = 0x30, - SwappedController = 0x31, - SudokuPad = 0x32, - ABLPinball = 0x33, - GoldenNuggetCasino = 0x34 + Unspecified = 0, Controller = 1, FourScore = 2, + FourPlayersAdapter = 3, Vs = 4, VsSystem = 5, + VsPinball = 6, VsZapper = 7, Zapper = 8, + TwoZappers = 9, HyperShotLightgun = 0xA, PowerPadSideA = 0xB, + PowerPadSideB = 0xC, FamilyTrainerSideA = 0xD, FamilyTrainerSideB = 0xE, + ArkanoidVaus = 0xF, ArkanoidVausFamicom = 0x10, TwoVausDataRecorder = 0x11, + HyperShotController = 0x12, CoconutsPachinko = 0x13, ExcitingBoxing = 0x14, + JissenMahjong = 0x15, PartyTap = 0x16, OekaKidsTablet = 0x17, + SunsoftBarcodeBattler = 0x18, PianoKeyboard = 0x19, PokkunMoguraa = 0x1A, + TopRider = 0x1B, DoubleFisted = 0x1C, Famicom3DSystem = 0x1D, + DoremikkoKeyboard = 0x1E, GyroSet = 0x1F, DataRecorder = 0x20, + TurboFile = 0x21, StorageBattleBox = 0x22, FamilyBASICKeyboardDataRecorder = 0x23, + DongdaKeyboard = 0x24, BitCorpKeyboard = 0x25, SuborKeyboard = 0x26, + SuborKeyboardMouse = 0x27, SuborKeyboardMouse24 = 0x28, SNESMouse = 0x29, + Multicart = 0x2A, SNESControllers = 0x2B, RacerMateBicycle = 0x2C, + UForce = 0x2D, StackUp = 0x2E, PatrolmanLightgun = 0x2F, + C1CassetteInterface = 0x30, SwappedController = 0x31, SudokuPad = 0x32, + ABLPinball = 0x33, GoldenNuggetCasino = 0x34 } \ No newline at end of file diff --git a/Extents/ExtentsByte.cs b/Extents/ExtentsByte.cs index dba965adf..cb388b9d6 100644 --- a/Extents/ExtentsByte.cs +++ b/Extents/ExtentsByte.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Extents; - using System; using System.Collections.Generic; using System.Linq; +namespace Aaru.CommonTypes.Extents; + /// Implements extents for public class ExtentsByte { @@ -72,7 +72,7 @@ public class ExtentsByte Tuple removeTwo = null; Tuple itemToAdd = null; - for(var i = 0; i < _backend.Count; i++) + for(int i = 0; i < _backend.Count; i++) { // Already contained in an extent if(item >= _backend[i].Item1 && diff --git a/Extents/ExtentsConverter.cs b/Extents/ExtentsConverter.cs index 0c2be46ef..421a74925 100644 --- a/Extents/ExtentsConverter.cs +++ b/Extents/ExtentsConverter.cs @@ -36,12 +36,13 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Extents; - using System; +using System.Collections.Generic; using System.Linq; using Schemas; +namespace Aaru.CommonTypes.Extents; + /// Converts extents public static class ExtentsConverter { @@ -54,7 +55,7 @@ public static class ExtentsConverter return null; Tuple[] tuples = extents.ToArray(); - var array = new ExtentType[tuples.Length]; + ExtentType[] array = new ExtentType[tuples.Length]; for(ulong i = 0; i < (ulong)array.LongLength; i++) array[i] = new ExtentType @@ -74,7 +75,8 @@ public static class ExtentsConverter if(extents == null) return null; - var tuples = extents.Select(extent => new Tuple(extent.Start, extent.End)).ToList(); + List> tuples = extents.Select(extent => new Tuple(extent.Start, extent.End)). + ToList(); return new ExtentsULong(tuples); } diff --git a/Extents/ExtentsInt.cs b/Extents/ExtentsInt.cs index 9b4ef21ff..0b5ed01c8 100644 --- a/Extents/ExtentsInt.cs +++ b/Extents/ExtentsInt.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Extents; - using System; using System.Collections.Generic; using System.Linq; +namespace Aaru.CommonTypes.Extents; + /// Implements extents for public class ExtentsInt { @@ -72,7 +72,7 @@ public class ExtentsInt Tuple removeTwo = null; Tuple itemToAdd = null; - for(var i = 0; i < _backend.Count; i++) + for(int i = 0; i < _backend.Count; i++) { // Already contained in an extent if(item >= _backend[i].Item1 && diff --git a/Extents/ExtentsLong.cs b/Extents/ExtentsLong.cs index 219a6d054..0b8be7298 100644 --- a/Extents/ExtentsLong.cs +++ b/Extents/ExtentsLong.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Extents; - using System; using System.Collections.Generic; using System.Linq; +namespace Aaru.CommonTypes.Extents; + /// Implements extents for public class ExtentsLong { @@ -72,7 +72,7 @@ public class ExtentsLong Tuple removeTwo = null; Tuple itemToAdd = null; - for(var i = 0; i < _backend.Count; i++) + for(int i = 0; i < _backend.Count; i++) { // Already contained in an extent if(item >= _backend[i].Item1 && diff --git a/Extents/ExtentsSByte.cs b/Extents/ExtentsSByte.cs index 75fb71a38..db5f81dd3 100644 --- a/Extents/ExtentsSByte.cs +++ b/Extents/ExtentsSByte.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Extents; - using System; using System.Collections.Generic; using System.Linq; +namespace Aaru.CommonTypes.Extents; + /// Implements extents for public class ExtentsSByte { @@ -72,7 +72,7 @@ public class ExtentsSByte Tuple removeTwo = null; Tuple itemToAdd = null; - for(var i = 0; i < _backend.Count; i++) + for(int i = 0; i < _backend.Count; i++) { // Already contained in an extent if(item >= _backend[i].Item1 && diff --git a/Extents/ExtentsShort.cs b/Extents/ExtentsShort.cs index a77b15031..23b1df582 100644 --- a/Extents/ExtentsShort.cs +++ b/Extents/ExtentsShort.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Extents; - using System; using System.Collections.Generic; using System.Linq; +namespace Aaru.CommonTypes.Extents; + /// Implements extents for public class ExtentsShort { @@ -72,7 +72,7 @@ public class ExtentsShort Tuple removeTwo = null; Tuple itemToAdd = null; - for(var i = 0; i < _backend.Count; i++) + for(int i = 0; i < _backend.Count; i++) { // Already contained in an extent if(item >= _backend[i].Item1 && diff --git a/Extents/ExtentsUInt.cs b/Extents/ExtentsUInt.cs index 3f9649d8e..0f8c80005 100644 --- a/Extents/ExtentsUInt.cs +++ b/Extents/ExtentsUInt.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Extents; - using System; using System.Collections.Generic; using System.Linq; +namespace Aaru.CommonTypes.Extents; + /// Implements extents for public class ExtentsUInt { @@ -72,7 +72,7 @@ public class ExtentsUInt Tuple removeTwo = null; Tuple itemToAdd = null; - for(var i = 0; i < _backend.Count; i++) + for(int i = 0; i < _backend.Count; i++) { // Already contained in an extent if(item >= _backend[i].Item1 && diff --git a/Extents/ExtentsULong.cs b/Extents/ExtentsULong.cs index d7cbc35bb..7ad783d3d 100644 --- a/Extents/ExtentsULong.cs +++ b/Extents/ExtentsULong.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Extents; - using System; using System.Collections.Generic; using System.Linq; +namespace Aaru.CommonTypes.Extents; + /// Implements extents for public class ExtentsULong { @@ -72,7 +72,7 @@ public class ExtentsULong Tuple removeTwo = null; Tuple itemToAdd = null; - for(var i = 0; i < _backend.Count; i++) + for(int i = 0; i < _backend.Count; i++) { // Already contained in an extent if(item >= _backend[i].Item1 && diff --git a/Extents/ExtentsUShort.cs b/Extents/ExtentsUShort.cs index 298f23ff0..f016a84cf 100644 --- a/Extents/ExtentsUShort.cs +++ b/Extents/ExtentsUShort.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Extents; - using System; using System.Collections.Generic; using System.Linq; +namespace Aaru.CommonTypes.Extents; + /// Implements extents for public class ExtentsUShort { @@ -72,7 +72,7 @@ public class ExtentsUShort Tuple removeTwo = null; Tuple itemToAdd = null; - for(var i = 0; i < _backend.Count; i++) + for(int i = 0; i < _backend.Count; i++) { // Already contained in an extent if(item >= _backend[i].Item1 && diff --git a/Filters.cs b/Filters.cs index ad7a15dce..9c64b0d4e 100644 --- a/Filters.cs +++ b/Filters.cs @@ -36,8 +36,6 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes; - using System; using System.Collections.Generic; using System.IO; @@ -47,6 +45,8 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; +namespace Aaru.CommonTypes; + /// Manages the known filters public sealed class FiltersList { @@ -89,7 +89,8 @@ public sealed class FiltersList if(!filter.Identify(path)) continue; - var foundFilter = (IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(Array.Empty()); + var foundFilter = (IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?. + Invoke(Array.Empty()); if(foundFilter?.Open(path) == ErrorNumber.NoError) return foundFilter; diff --git a/Geometry.cs b/Geometry.cs index 4ad0df35c..56eed199e 100644 --- a/Geometry.cs +++ b/Geometry.cs @@ -36,10 +36,10 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes; - using System.Linq; +namespace Aaru.CommonTypes; + /// Handles CHS geometries public static class Geometry { diff --git a/Interfaces/IArchive.cs b/Interfaces/IArchive.cs index ef7665d89..b821c7f09 100644 --- a/Interfaces/IArchive.cs +++ b/Interfaces/IArchive.cs @@ -33,13 +33,13 @@ // ReSharper disable UnusedMember.Global -namespace Aaru.CommonTypes.Interfaces; - using System; using System.Collections.Generic; using System.IO; using Aaru.CommonTypes.Enums; +namespace Aaru.CommonTypes.Interfaces; + /// Supported archive features [Flags] public enum ArchiveSupportedFeature : uint diff --git a/Interfaces/IBaseImage.cs b/Interfaces/IBaseImage.cs index d647c21e5..7f0d12ccd 100644 --- a/Interfaces/IBaseImage.cs +++ b/Interfaces/IBaseImage.cs @@ -36,14 +36,14 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System; using System.Collections.Generic; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; using Schemas; +namespace Aaru.CommonTypes.Interfaces; + /// Base interface for all images public interface IBaseImage { diff --git a/Interfaces/IBaseWritableImage.cs b/Interfaces/IBaseWritableImage.cs index 662b6065a..1ea854c1a 100644 --- a/Interfaces/IBaseWritableImage.cs +++ b/Interfaces/IBaseWritableImage.cs @@ -36,14 +36,14 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System; using System.Collections.Generic; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; using Schemas; +namespace Aaru.CommonTypes.Interfaces; + /// /// Base interface for all writable images public interface IBaseWritableImage : IBaseImage diff --git a/Interfaces/IByteAddressableImage.cs b/Interfaces/IByteAddressableImage.cs index 8e3d65b55..9346eaa21 100644 --- a/Interfaces/IByteAddressableImage.cs +++ b/Interfaces/IByteAddressableImage.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System.Collections.Generic; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; +namespace Aaru.CommonTypes.Interfaces; + /// /// Interface defining linear media (chips, game carts, etc) images public interface IByteAddressableImage : IBaseWritableImage diff --git a/Interfaces/IFilesystem.cs b/Interfaces/IFilesystem.cs index 0536a0b2b..5bcd46d15 100644 --- a/Interfaces/IFilesystem.cs +++ b/Interfaces/IFilesystem.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System; using System.Text; using Schemas; +namespace Aaru.CommonTypes.Interfaces; + /// Interface to implement filesystem plugins. public interface IFilesystem { diff --git a/Interfaces/IFilter.cs b/Interfaces/IFilter.cs index 8006aaef5..fe150cb67 100644 --- a/Interfaces/IFilter.cs +++ b/Interfaces/IFilter.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System; using System.IO; using Aaru.CommonTypes.Enums; +namespace Aaru.CommonTypes.Interfaces; + /// /// Defines a filter, that is, a transformation of the data from a file, like, for example, a compressor (e.g. /// GZIP), or a container (e.g. AppleDouble) @@ -96,8 +96,8 @@ public interface IFilter /// /// Gets path to parent folder to the file referenced by this filter. If it's an archive, it's the full path to - /// the archive itself.
UNIX: /path/to/archive.zip/path/to/file.bin => /path/to/archive.zip
Windows: - /// C:\path\to\archive.zip\path\to\file.bin => C:\path\to\archive.zip + /// the archive itself.
UNIX: /path/to/archive.zip/path/to/file.bin => /path/to/archive.zip
Windows: + /// C:\path\to\archive.zip\path\to\file.bin = > C:\path\to\archive.zip ///
/// The parent folder. string ParentFolder { get; } diff --git a/Interfaces/IFloppyImage.cs b/Interfaces/IFloppyImage.cs index 4542f2236..85c823959 100644 --- a/Interfaces/IFloppyImage.cs +++ b/Interfaces/IFloppyImage.cs @@ -36,15 +36,15 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; +namespace Aaru.CommonTypes.Interfaces; + /// /// /// Abstract class to implement disk image reading plugins that can contain floppy images. This interface is -/// needed because floppy formatting characteristics are not necesarily compatible with the whole. LBA-oriented +/// needed because floppy formatting characteristics are not necessarily compatible with the whole. LBA-oriented /// interface is defined by . All data returned by these /// methods is already decoded from its corresponding bitstream. /// diff --git a/Interfaces/IMediaImage.cs b/Interfaces/IMediaImage.cs index 0b6b71a7f..93eacfc39 100644 --- a/Interfaces/IMediaImage.cs +++ b/Interfaces/IMediaImage.cs @@ -37,10 +37,10 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using Aaru.CommonTypes.Enums; +namespace Aaru.CommonTypes.Interfaces; + /// /// Abstract class to implement disk image reading plugins. public interface IMediaImage : IBaseImage diff --git a/Interfaces/IOpticalMediaImage.cs b/Interfaces/IOpticalMediaImage.cs index 9a567f1bd..617045fc8 100644 --- a/Interfaces/IOpticalMediaImage.cs +++ b/Interfaces/IOpticalMediaImage.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System.Collections.Generic; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; +namespace Aaru.CommonTypes.Interfaces; + /// /// Abstract class to implement disk image reading plugins. public interface IOpticalMediaImage : IMediaImage, IPartitionableMediaImage, IVerifiableSectorsImage diff --git a/Interfaces/IPartition.cs b/Interfaces/IPartition.cs index c4916e3d4..c1eb4fa7e 100644 --- a/Interfaces/IPartition.cs +++ b/Interfaces/IPartition.cs @@ -37,11 +37,11 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System; using System.Collections.Generic; +namespace Aaru.CommonTypes.Interfaces; + /// Abstract class to implement partitioning schemes interpreting plugins. public interface IPartition { diff --git a/Interfaces/IPartitionableMediaImage.cs b/Interfaces/IPartitionableMediaImage.cs index 5be998605..f4529bf01 100644 --- a/Interfaces/IPartitionableMediaImage.cs +++ b/Interfaces/IPartitionableMediaImage.cs @@ -37,10 +37,10 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System.Collections.Generic; +namespace Aaru.CommonTypes.Interfaces; + /// Defines an image that can contain partitions public interface IPartitionableMediaImage { diff --git a/Interfaces/IPluginRegister.cs b/Interfaces/IPluginRegister.cs index c3ec27114..d27ab298f 100644 --- a/Interfaces/IPluginRegister.cs +++ b/Interfaces/IPluginRegister.cs @@ -36,11 +36,11 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System; using System.Collections.Generic; +namespace Aaru.CommonTypes.Interfaces; + /// Defines a register of all known plugins public interface IPluginRegister { diff --git a/Interfaces/IReadOnlyFilesystem.cs b/Interfaces/IReadOnlyFilesystem.cs index 0c776e410..c8c526a01 100644 --- a/Interfaces/IReadOnlyFilesystem.cs +++ b/Interfaces/IReadOnlyFilesystem.cs @@ -37,14 +37,14 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System; using System.Collections.Generic; using System.Text; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; +namespace Aaru.CommonTypes.Interfaces; + /// /// Defines the interface to implement reading the contents of a filesystem public interface IReadOnlyFilesystem : IFilesystem diff --git a/Interfaces/ITapeImage.cs b/Interfaces/ITapeImage.cs index ed1138e20..028cc64c4 100644 --- a/Interfaces/ITapeImage.cs +++ b/Interfaces/ITapeImage.cs @@ -37,11 +37,11 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System.Collections.Generic; using Aaru.CommonTypes.Structs; +namespace Aaru.CommonTypes.Interfaces; + /// /// Defines an image that can store the information from streaming, digital, tapes public interface ITapeImage : IMediaImage diff --git a/Interfaces/IVerifiableSectorsImage.cs b/Interfaces/IVerifiableSectorsImage.cs index 2f8347041..0b46701b3 100644 --- a/Interfaces/IVerifiableSectorsImage.cs +++ b/Interfaces/IVerifiableSectorsImage.cs @@ -37,10 +37,10 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System.Collections.Generic; +namespace Aaru.CommonTypes.Interfaces; + /// Defines an image that can verify the integrity of the sectors it contains public interface IVerifiableSectorsImage { diff --git a/Interfaces/IWritableFloppyImage.cs b/Interfaces/IWritableFloppyImage.cs index 0c16c6372..ca8b270cf 100644 --- a/Interfaces/IWritableFloppyImage.cs +++ b/Interfaces/IWritableFloppyImage.cs @@ -36,11 +36,11 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; +namespace Aaru.CommonTypes.Interfaces; + /// /// /// Abstract class to implement disk image reading plugins that can contain floppy images. This interface is diff --git a/Interfaces/IWritableImage.cs b/Interfaces/IWritableImage.cs index d3080410c..95c04c72b 100644 --- a/Interfaces/IWritableImage.cs +++ b/Interfaces/IWritableImage.cs @@ -36,10 +36,10 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using Aaru.CommonTypes.Enums; +namespace Aaru.CommonTypes.Interfaces; + /// /// /// Abstract class to implement disk image writing plugins. TODO: This interface is subject to change until diff --git a/Interfaces/IWritableOpticalImage.cs b/Interfaces/IWritableOpticalImage.cs index 5b8af4ed5..fbdcac132 100644 --- a/Interfaces/IWritableOpticalImage.cs +++ b/Interfaces/IWritableOpticalImage.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using System.Collections.Generic; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; +namespace Aaru.CommonTypes.Interfaces; + /// /// Defines an image that is writable and can store an optical disc (CD, DVD, etc) public interface IWritableOpticalImage : IWritableImage, IOpticalMediaImage diff --git a/Interfaces/IWritableTapeImage.cs b/Interfaces/IWritableTapeImage.cs index 7d11a30dc..072832b4d 100644 --- a/Interfaces/IWritableTapeImage.cs +++ b/Interfaces/IWritableTapeImage.cs @@ -37,10 +37,10 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces; - using Aaru.CommonTypes.Structs; +namespace Aaru.CommonTypes.Interfaces; + /// /// Defines an image that is writable and can store information about a streaming, digital, tape public interface IWritableTapeImage : ITapeImage, IWritableImage diff --git a/Interop/DetectOS.cs b/Interop/DetectOS.cs index 4b45757bf..72c0f104a 100644 --- a/Interop/DetectOS.cs +++ b/Interop/DetectOS.cs @@ -36,14 +36,14 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interop; - using System; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Security.Principal; +namespace Aaru.CommonTypes.Interop; + /// Detects the underlying execution framework and operating system public static class DetectOS { diff --git a/Interop/PlatformID.cs b/Interop/PlatformID.cs index f5d1f13e7..f9e4e2fd4 100644 --- a/Interop/PlatformID.cs +++ b/Interop/PlatformID.cs @@ -36,10 +36,10 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interop; - using System.Diagnostics.CodeAnalysis; +namespace Aaru.CommonTypes.Interop; + /// Contains an arbitrary list of OSes, even if .NET does not run on them [SuppressMessage("ReSharper", "InconsistentNaming")] public enum PlatformID diff --git a/Interop/Version.cs b/Interop/Version.cs index ad4441b96..4ef6b542e 100644 --- a/Interop/Version.cs +++ b/Interop/Version.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interop; - using System; using System.Reflection; using System.Runtime; +namespace Aaru.CommonTypes.Interop; + /// Gets our own, or the runtime's version public static class Version { diff --git a/MediaType.cs b/MediaType.cs index 788b30ba9..10ac4bdfa 100644 --- a/MediaType.cs +++ b/MediaType.cs @@ -39,6 +39,8 @@ // ReSharper disable InconsistentNaming // TODO: Rename contents +using System; + #pragma warning disable 1591 // ReSharper disable UnusedMember.Global @@ -46,16 +48,10 @@ namespace Aaru.CommonTypes; -using System; - public enum MediaEncoding { - Unknown, - FM, - MFM, - M2FM, - AppleGCR, - CommodoreGCR + Unknown, FM, MFM, + M2FM, AppleGCR, CommodoreGCR } /// Contains an enumeration of all known types of media. @@ -214,9 +210,7 @@ public enum MediaType : uint /// Pioneer LaserDisc LD = 80, /// Pioneer LaserDisc data - LDROM = 81, LDROM2 = 82, - LVROM = 83, - MegaLD = 84, + LDROM = 81, LDROM2 = 82, LVROM = 83, MegaLD = 84, /// Writable LaserDisc with support for component video CRVdisc = 85, #endregion LaserDisc based, types 80 to 89 @@ -248,8 +242,7 @@ public enum MediaType : uint #endregion Plasmon UDO, types 100 to 109 #region Sony game media, types 110 to 129 - PlayStationMemoryCard = 110, - PlayStationMemoryCard2 = 111, + PlayStationMemoryCard = 110, PlayStationMemoryCard2 = 111, /// Sony PlayStation game CD PS1CD = 112, /// Sony PlayStation 2 game CD @@ -287,14 +280,9 @@ public enum MediaType : uint /// Sega/Yamaha Gigabyte Disc GDROM = 152, /// Sega/Yamaha recordable Gigabyte Disc - GDR = 153, SegaCard = 154, - MilCD = 155, - MegaDriveCartridge = 156, - _32XCartridge = 157, - SegaPicoCartridge = 158, - MasterSystemCartridge = 159, - GameGearCartridge = 160, - SegaSaturnCartridge = 161, + GDR = 153, SegaCard = 154, MilCD = 155, MegaDriveCartridge = 156, + _32XCartridge = 157, SegaPicoCartridge = 158, MasterSystemCartridge = 159, + GameGearCartridge = 160, SegaSaturnCartridge = 161, #endregion Sega game media, types 150 to 169 #region Other game media, types 170 to 179 @@ -567,25 +555,15 @@ public enum MediaType : uint #endregion Apricot ACT standard floppy formats, type 309 #region OnStream ADR, types 310 to 319 - ADR2120 = 310, - ADR260 = 311, - ADR30 = 312, + ADR2120 = 310, ADR260 = 311, ADR30 = 312, ADR50 = 313, #endregion OnStream ADR, types 310 to 319 #region Advanced Intelligent Tape, types 320 to 339 - AIT1 = 320, - AIT1Turbo = 321, - AIT2 = 322, - AIT2Turbo = 323, - AIT3 = 324, - AIT3Ex = 325, - AIT3Turbo = 326, - AIT4 = 327, - AIT5 = 328, - AITETurbo = 329, - SAIT1 = 330, - SAIT2 = 331, + AIT1 = 320, AIT1Turbo = 321, AIT2 = 322, + AIT2Turbo = 323, AIT3 = 324, AIT3Ex = 325, + AIT3Turbo = 326, AIT4 = 327, AIT5 = 328, + AITETurbo = 329, SAIT1 = 330, SAIT2 = 331, #endregion Advanced Intelligent Tape, types 320 to 339 #region Iomega, types 340 to 359 @@ -594,17 +572,10 @@ public enum MediaType : uint Bernoulli = 340, /// Obsolete type for 5⅓" Bernoulli Box II disks [Obsolete] - Bernoulli2 = 341, Ditto = 342, - DittoMax = 343, - Jaz = 344, - Jaz2 = 345, - PocketZip = 346, - REV120 = 347, - REV35 = 348, - REV70 = 349, - ZIP100 = 350, - ZIP250 = 351, - ZIP750 = 352, + Bernoulli2 = 341, Ditto = 342, DittoMax = 343, Jaz = 344, + Jaz2 = 345, PocketZip = 346, REV120 = 347, + REV35 = 348, REV70 = 349, ZIP100 = 350, + ZIP250 = 351, ZIP750 = 352, /// 5⅓" Bernoulli Box II disk with 35Mb capacity Bernoulli35 = 353, /// 5⅓" Bernoulli Box II disk with 44Mb capacity @@ -622,9 +593,7 @@ public enum MediaType : uint #endregion Iomega, types 340 to 359 #region Audio or video media, types 360 to 369 - CompactCassette = 360, - Data8 = 361, - MiniDV = 362, + CompactCassette = 360, Data8 = 361, MiniDV = 362, /// D/CAS-25: Digital data on Compact Cassette form factor, special magnetic media, 9-track Dcas25 = 363, /// D/CAS-85: Digital data on Compact Cassette form factor, special magnetic media, 17-track @@ -634,62 +603,34 @@ public enum MediaType : uint #endregion Audio media, types 360 to 369 #region CompactFlash Association, types 370 to 379 - CFast = 370, - CompactFlash = 371, - CompactFlashType2 = 372, + CFast = 370, CompactFlash = 371, CompactFlashType2 = 372, #endregion CompactFlash Association, types 370 to 379 #region Digital Audio Tape / Digital Data Storage, types 380 to 389 - DigitalAudioTape = 380, - DAT160 = 381, - DAT320 = 382, - DAT72 = 383, - DDS1 = 384, - DDS2 = 385, - DDS3 = 386, - DDS4 = 387, + DigitalAudioTape = 380, DAT160 = 381, DAT320 = 382, + DAT72 = 383, DDS1 = 384, DDS2 = 385, + DDS3 = 386, DDS4 = 387, #endregion Digital Audio Tape / Digital Data Storage, types 380 to 389 #region DEC, types 390 to 399 - CompactTapeI = 390, - CompactTapeII = 391, - DECtapeII = 392, - DLTtapeIII = 393, - DLTtapeIIIxt = 394, - DLTtapeIV = 395, - DLTtapeS4 = 396, - SDLT1 = 397, - SDLT2 = 398, - VStapeI = 399, + CompactTapeI = 390, CompactTapeII = 391, DECtapeII = 392, + DLTtapeIII = 393, DLTtapeIIIxt = 394, DLTtapeIV = 395, + DLTtapeS4 = 396, SDLT1 = 397, SDLT2 = 398, + VStapeI = 399, #endregion DEC, types 390 to 399 #region Exatape, types 400 to 419 - Exatape15m = 400, - Exatape22m = 401, - Exatape22mAME = 402, - Exatape28m = 403, - Exatape40m = 404, - Exatape45m = 405, - Exatape54m = 406, - Exatape75m = 407, - Exatape76m = 408, - Exatape80m = 409, - Exatape106m = 410, - Exatape160mXL = 411, - Exatape112m = 412, - Exatape125m = 413, - Exatape150m = 414, - Exatape170m = 415, - Exatape225m = 416, + Exatape15m = 400, Exatape22m = 401, Exatape22mAME = 402, + Exatape28m = 403, Exatape40m = 404, Exatape45m = 405, + Exatape54m = 406, Exatape75m = 407, Exatape76m = 408, + Exatape80m = 409, Exatape106m = 410, Exatape160mXL = 411, + Exatape112m = 412, Exatape125m = 413, Exatape150m = 414, + Exatape170m = 415, Exatape225m = 416, #endregion Exatape, types 400 to 419 #region PCMCIA / ExpressCard, types 420 to 429 - ExpressCard34 = 420, - ExpressCard54 = 421, - PCCardTypeI = 422, - PCCardTypeII = 423, - PCCardTypeIII = 424, - PCCardTypeIV = 425, + ExpressCard34 = 420, ExpressCard54 = 421, PCCardTypeI = 422, + PCCardTypeII = 423, PCCardTypeIII = 424, PCCardTypeIV = 425, #endregion PCMCIA / ExpressCard, types 420 to 429 #region SyQuest, types 430 to 449 @@ -725,19 +666,11 @@ public enum MediaType : uint #endregion SyQuest, types 430 to 449 #region Nintendo, types 450 to 469 - FamicomGamePak = 450, - GameBoyAdvanceGamePak = 451, - GameBoyGamePak = 452, + FamicomGamePak = 450, GameBoyAdvanceGamePak = 451, GameBoyGamePak = 452, /// Nintendo GameCube Optical Disc - GOD = 453, N64DD = 454, - N64GamePak = 455, - NESGamePak = 456, - Nintendo3DSGameCard = 457, - NintendoDiskCard = 458, - NintendoDSGameCard = 459, - NintendoDSiGameCard = 460, - SNESGamePak = 461, - SNESGamePakUS = 462, + GOD = 453, N64DD = 454, N64GamePak = 455, NESGamePak = 456, + Nintendo3DSGameCard = 457, NintendoDiskCard = 458, NintendoDSGameCard = 459, + NintendoDSiGameCard = 460, SNESGamePak = 461, SNESGamePakUS = 462, /// Nintendo Wii Optical Disc WOD = 463, /// Nintendo Wii U Optical Disc @@ -745,121 +678,66 @@ public enum MediaType : uint #endregion Nintendo, types 450 to 469 #region IBM Tapes, types 470 to 479 - IBM3470 = 470, - IBM3480 = 471, - IBM3490 = 472, - IBM3490E = 473, - IBM3592 = 474, + IBM3470 = 470, IBM3480 = 471, IBM3490 = 472, + IBM3490E = 473, IBM3592 = 474, #endregion IBM Tapes, types 470 to 479 #region LTO Ultrium, types 480 to 509 - LTO = 480, - LTO2 = 481, - LTO3 = 482, - LTO3WORM = 483, - LTO4 = 484, - LTO4WORM = 485, - LTO5 = 486, - LTO5WORM = 487, - LTO6 = 488, - LTO6WORM = 489, - LTO7 = 490, - LTO7WORM = 491, + LTO = 480, LTO2 = 481, LTO3 = 482, + LTO3WORM = 483, LTO4 = 484, LTO4WORM = 485, + LTO5 = 486, LTO5WORM = 487, LTO6 = 488, + LTO6WORM = 489, LTO7 = 490, LTO7WORM = 491, #endregion LTO Ultrium, types 480 to 509 #region MemoryStick, types 510 to 519 - MemoryStick = 510, - MemoryStickDuo = 511, - MemoryStickMicro = 512, - MemoryStickPro = 513, - MemoryStickProDuo = 514, + MemoryStick = 510, MemoryStickDuo = 511, MemoryStickMicro = 512, + MemoryStickPro = 513, MemoryStickProDuo = 514, #endregion MemoryStick, types 510 to 519 #region SecureDigital, types 520 to 529 - microSD = 520, - miniSD = 521, - SecureDigital = 522, + microSD = 520, miniSD = 521, SecureDigital = 522, #endregion SecureDigital, types 520 to 529 #region MultiMediaCard, types 530 to 539 - MMC = 530, - MMCmicro = 531, - RSMMC = 532, - MMCplus = 533, - MMCmobile = 534, + MMC = 530, MMCmicro = 531, RSMMC = 532, + MMCplus = 533, MMCmobile = 534, #endregion MultiMediaCard, types 530 to 539 #region SLR, types 540 to 569 - MLR1 = 540, - MLR1SL = 541, - MLR3 = 542, - SLR1 = 543, - SLR2 = 544, - SLR3 = 545, - SLR32 = 546, - SLR32SL = 547, - SLR4 = 548, - SLR5 = 549, - SLR5SL = 550, - SLR6 = 551, - SLRtape7 = 552, - SLRtape7SL = 553, - SLRtape24 = 554, - SLRtape24SL = 555, - SLRtape40 = 556, - SLRtape50 = 557, - SLRtape60 = 558, - SLRtape75 = 559, - SLRtape100 = 560, + MLR1 = 540, MLR1SL = 541, MLR3 = 542, + SLR1 = 543, SLR2 = 544, SLR3 = 545, + SLR32 = 546, SLR32SL = 547, SLR4 = 548, + SLR5 = 549, SLR5SL = 550, SLR6 = 551, + SLRtape7 = 552, SLRtape7SL = 553, SLRtape24 = 554, + SLRtape24SL = 555, SLRtape40 = 556, SLRtape50 = 557, + SLRtape60 = 558, SLRtape75 = 559, SLRtape100 = 560, SLRtape140 = 561, #endregion SLR, types 540 to 569 #region QIC, types 570 to 589 - QIC11 = 570, - QIC120 = 571, - QIC1350 = 572, - QIC150 = 573, - QIC24 = 574, - QIC3010 = 575, - QIC3020 = 576, - QIC3080 = 577, - QIC3095 = 578, - QIC320 = 579, - QIC40 = 580, - QIC525 = 581, + QIC11 = 570, QIC120 = 571, QIC1350 = 572, + QIC150 = 573, QIC24 = 574, QIC3010 = 575, + QIC3020 = 576, QIC3080 = 577, QIC3095 = 578, + QIC320 = 579, QIC40 = 580, QIC525 = 581, QIC80 = 582, #endregion QIC, types 570 to 589 #region StorageTek tapes, types 590 to 609 - STK4480 = 590, - STK4490 = 591, - STK9490 = 592, - T9840A = 593, - T9840B = 594, - T9840C = 595, - T9840D = 596, - T9940A = 597, - T9940B = 598, - T10000A = 599, - T10000B = 600, - T10000C = 601, + STK4480 = 590, STK4490 = 591, STK9490 = 592, + T9840A = 593, T9840B = 594, T9840C = 595, + T9840D = 596, T9940A = 597, T9940B = 598, + T10000A = 599, T10000B = 600, T10000C = 601, T10000D = 602, #endregion StorageTek tapes, types 590 to 609 #region Travan, types 610 to 619 - Travan = 610, - Travan1Ex = 611, - Travan3 = 612, - Travan3Ex = 613, - Travan4 = 614, - Travan5 = 615, + Travan = 610, Travan1Ex = 611, Travan3 = 612, + Travan3Ex = 613, Travan4 = 614, Travan5 = 615, Travan7 = 616, #endregion Travan, types 610 to 619 #region VXA, types 620 to 629 - VXA1 = 620, - VXA2 = 621, - VXA3 = 622, + VXA1 = 620, VXA2 = 621, VXA3 = 622, #endregion VXA, types 620 to 629 #region Magneto-optical, types 630 to 659 @@ -926,47 +804,27 @@ public enum MediaType : uint #endregion Magneto-optical, types 630 to 659 #region Other floppy standards, types 660 to 689 - CompactFloppy = 660, - DemiDiskette = 661, + CompactFloppy = 660, DemiDiskette = 661, /// 3.5", 652 tracks, 2 sides, 512 bytes/sector, Floptical, ECMA-207, ISO 14169 - Floptical = 662, HiFD = 663, - QuickDisk = 664, - UHD144 = 665, - VideoFloppy = 666, - Wafer = 667, - ZXMicrodrive = 668, + Floptical = 662, HiFD = 663, QuickDisk = 664, UHD144 = 665, + VideoFloppy = 666, Wafer = 667, ZXMicrodrive = 668, /// 5.25", SS, DD, 77 tracks, 16 spt, 256 bytes/sector, MFM, 100 tpi, 300rpm MetaFloppy_Mod_II = 669, #endregion Other floppy standards, types 660 to 669 #region Miscellaneous, types 670 to 689 - BeeCard = 670, - Borsu = 671, - DataStore = 672, - DIR = 673, - DST = 674, - DTF = 675, - DTF2 = 676, - Flextra3020 = 677, - Flextra3225 = 678, - HiTC1 = 679, - HiTC2 = 680, - LT1 = 681, - MiniCard = 872, - Orb = 683, - Orb5 = 684, - SmartMedia = 685, - xD = 686, - XQD = 687, - DataPlay = 688, + BeeCard = 670, Borsu = 671, DataStore = 672, + DIR = 673, DST = 674, DTF = 675, + DTF2 = 676, Flextra3020 = 677, Flextra3225 = 678, + HiTC1 = 679, HiTC2 = 680, LT1 = 681, + MiniCard = 872, Orb = 683, Orb5 = 684, + SmartMedia = 685, xD = 686, XQD = 687, + DataPlay = 688, #endregion Miscellaneous, types 670 to 689 #region Apple specific media, types 690 to 699 - AppleProfile = 690, - AppleWidget = 691, - AppleHD20 = 692, - PriamDataTower = 693, - Pippin = 694, + AppleProfile = 690, AppleWidget = 691, AppleHD20 = 692, + PriamDataTower = 693, Pippin = 694, #endregion Apple specific media, types 690 to 699 #region DEC hard disks, types 700 to 729 @@ -1108,18 +966,14 @@ public enum MediaType : uint #endregion DEC hard disks, types 700 to 729 #region Imation, types 730 to 739 - LS120 = 730, - LS240 = 731, - FD32MB = 732, - RDX = 733, + LS120 = 730, LS240 = 731, FD32MB = 732, + RDX = 733, /// Imation 320Gb RDX RDX320 = 734, #endregion Imation, types 730 to 739 #region VideoNow, types 740 to 749 - VideoNow = 740, - VideoNowColor = 741, - VideoNowXp = 742, + VideoNow = 740, VideoNowColor = 741, VideoNowXp = 742, #endregion #region Iomega, types 750 to 759 @@ -1132,9 +986,7 @@ public enum MediaType : uint #endregion Iomega, types 750 to 759 #region Kodak, types 760 to 769 - KodakVerbatim3 = 760, - KodakVerbatim6 = 761, - KodakVerbatim12 = 762, + KodakVerbatim3 = 760, KodakVerbatim6 = 761, KodakVerbatim12 = 762, #endregion Kodak, types 760 to 769 #region Sony and Panasonic Blu-ray derived, types 770 to 799 @@ -1192,6 +1044,5 @@ public enum MediaType : uint MetaFloppy_Mod_I = 820, #endregion - AtariLynxCard = 821, - AtariJaguarCartridge = 822 + AtariLynxCard = 821, AtariJaguarCartridge = 822 } \ No newline at end of file diff --git a/MediaTypeFromDevice/FromAta.cs b/MediaTypeFromDevice/FromAta.cs index c00acddb4..fa21ed64a 100644 --- a/MediaTypeFromDevice/FromAta.cs +++ b/MediaTypeFromDevice/FromAta.cs @@ -32,10 +32,10 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes; - using Aaru.Console; +namespace Aaru.CommonTypes; + public static partial class MediaTypeFromDevice { /// Gets the media type from an ATA (not ATAPI) device @@ -66,6 +66,5 @@ public static partial class MediaTypeFromDevice "Drive manufacturer is SyQuest, media has 1961069 blocks of 512 bytes, setting media type to SparQ."); return MediaType.SparQ; - } } \ No newline at end of file diff --git a/MediaTypeFromDevice/FromMmc.cs b/MediaTypeFromDevice/FromMmc.cs index 4be5e22dd..71efdb9e1 100644 --- a/MediaTypeFromDevice/FromMmc.cs +++ b/MediaTypeFromDevice/FromMmc.cs @@ -32,11 +32,11 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes; - using System; using Aaru.Console; +namespace Aaru.CommonTypes; + /// Gets the media type from a real device public static partial class MediaTypeFromDevice { diff --git a/MediaTypeFromDevice/FromOdc.cs b/MediaTypeFromDevice/FromOdc.cs index c1f07bfc0..80be560a4 100644 --- a/MediaTypeFromDevice/FromOdc.cs +++ b/MediaTypeFromDevice/FromOdc.cs @@ -32,10 +32,10 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes; - using Aaru.Console; +namespace Aaru.CommonTypes; + public static partial class MediaTypeFromDevice { /// Gets the device type from a SCSI Optical Device diff --git a/MediaTypeFromDevice/FromSbc.cs b/MediaTypeFromDevice/FromSbc.cs index 72548a35c..ef94318f2 100644 --- a/MediaTypeFromDevice/FromSbc.cs +++ b/MediaTypeFromDevice/FromSbc.cs @@ -32,11 +32,11 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes; - using System; using Aaru.Console; +namespace Aaru.CommonTypes; + public static partial class MediaTypeFromDevice { /// Gets the media type from a SCSI Block Commands compliant device diff --git a/MediaTypeFromDevice/FromScsi.cs b/MediaTypeFromDevice/FromScsi.cs index 699135603..f7fd84ceb 100644 --- a/MediaTypeFromDevice/FromScsi.cs +++ b/MediaTypeFromDevice/FromScsi.cs @@ -32,11 +32,11 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes; - using System; using Aaru.Console; +namespace Aaru.CommonTypes; + public static partial class MediaTypeFromDevice { /// Tries to guess, from SCSI information, the media type of a device and/or its inserted media diff --git a/MediaTypeFromDevice/FromSsc.cs b/MediaTypeFromDevice/FromSsc.cs index c36a8f8db..fd1838f85 100644 --- a/MediaTypeFromDevice/FromSsc.cs +++ b/MediaTypeFromDevice/FromSsc.cs @@ -32,11 +32,11 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes; - using System; using Aaru.Console; +namespace Aaru.CommonTypes; + public static partial class MediaTypeFromDevice { /// Gets the media type from an SCSI Streaming Commands compliant device diff --git a/Metadata/CdOffset.cs b/Metadata/CdOffset.cs index 6f73773db..53887c93a 100644 --- a/Metadata/CdOffset.cs +++ b/Metadata/CdOffset.cs @@ -36,10 +36,10 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Metadata; - using System.ComponentModel.DataAnnotations; +namespace Aaru.CommonTypes.Metadata; + /// Describes CD reading offset public class CdOffset { diff --git a/Metadata/DeviceReport.cs b/Metadata/DeviceReport.cs index dabd98b3b..0aaa8f4c2 100644 --- a/Metadata/DeviceReport.cs +++ b/Metadata/DeviceReport.cs @@ -38,13 +38,6 @@ // This is obsolete -#pragma warning disable 1591 - -// ReSharper disable InconsistentNaming -// ReSharper disable UnusedAutoPropertyAccessor.Global - -namespace Aaru.CommonTypes.Metadata; - using System; using System.ComponentModel; using System.Xml.Serialization; @@ -53,6 +46,13 @@ using Aaru.CommonTypes.Structs.Devices.SCSI; using Aaru.CommonTypes.Structs.Devices.SCSI.Modes; using Newtonsoft.Json; +#pragma warning disable 1591 + +// ReSharper disable InconsistentNaming +// ReSharper disable UnusedAutoPropertyAccessor.Global + +namespace Aaru.CommonTypes.Metadata; + [Serializable, XmlRoot("DicDeviceReport", Namespace = "", IsNullable = false)] public class DeviceReport { diff --git a/Metadata/DeviceReportV2.cs b/Metadata/DeviceReportV2.cs index b83abbda7..1889220c0 100644 --- a/Metadata/DeviceReportV2.cs +++ b/Metadata/DeviceReportV2.cs @@ -38,16 +38,6 @@ // TODO: Re-enable CS1591 in this file -#pragma warning disable 1591 - -// ReSharper disable VirtualMemberNeverOverridden.Global -// ReSharper disable VirtualMemberCallInConstructor - -// ReSharper disable InconsistentNaming -// ReSharper disable UnusedAutoPropertyAccessor.Global - -namespace Aaru.CommonTypes.Metadata; - using System; using System.Collections.Generic; using System.ComponentModel; @@ -60,6 +50,16 @@ using Aaru.CommonTypes.Structs.Devices.SCSI; using Aaru.CommonTypes.Structs.Devices.SCSI.Modes; using Newtonsoft.Json; +#pragma warning disable 1591 + +// ReSharper disable VirtualMemberNeverOverridden.Global +// ReSharper disable VirtualMemberCallInConstructor + +// ReSharper disable InconsistentNaming +// ReSharper disable UnusedAutoPropertyAccessor.Global + +namespace Aaru.CommonTypes.Metadata; + public class DeviceReportV2 { public DeviceReportV2() {} diff --git a/Metadata/Dimensions.cs b/Metadata/Dimensions.cs index e9cd3f331..b3423bfaf 100644 --- a/Metadata/Dimensions.cs +++ b/Metadata/Dimensions.cs @@ -36,12 +36,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ +using Schemas; + #pragma warning disable 612 namespace Aaru.CommonTypes.Metadata; -using Schemas; - /// Physical dimensions for media types public static class Dimensions { diff --git a/Metadata/Resume.cs b/Metadata/Resume.cs index 20ef7c9df..382b65b4f 100644 --- a/Metadata/Resume.cs +++ b/Metadata/Resume.cs @@ -36,13 +36,13 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Metadata; - using System; using System.Collections.Generic; using System.Xml.Serialization; using Schemas; +namespace Aaru.CommonTypes.Metadata; + /// Information that allows to resume a dump [Serializable, XmlRoot("DicResume", Namespace = "", IsNullable = false)] public class Resume diff --git a/Metadata/Statistics.cs b/Metadata/Statistics.cs index bed7787dc..bfd89d35c 100644 --- a/Metadata/Statistics.cs +++ b/Metadata/Statistics.cs @@ -39,12 +39,12 @@ // ReSharper disable ClassNeverInstantiated.Global // ReSharper disable UnusedMember.Global -namespace Aaru.CommonTypes.Metadata; - using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Xml.Serialization; +namespace Aaru.CommonTypes.Metadata; + /// Statistics [XmlRoot("DicStats", Namespace = "", IsNullable = false)] public class Stats diff --git a/Metadata/Version.cs b/Metadata/Version.cs index 1786c316f..18394b641 100644 --- a/Metadata/Version.cs +++ b/Metadata/Version.cs @@ -36,11 +36,11 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Metadata; - using Aaru.CommonTypes.Interop; using Schemas; +namespace Aaru.CommonTypes.Metadata; + /// Manages Aaru's version for metadata public static class Version { diff --git a/Partition.cs b/Partition.cs index 95d750d07..2d9ce88dc 100644 --- a/Partition.cs +++ b/Partition.cs @@ -36,11 +36,11 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ +using System; + #pragma warning disable CS1591 namespace Aaru.CommonTypes; -using System; - /// /// Partition structure. public struct Partition : IEquatable, IComparable diff --git a/PluginBase.cs b/PluginBase.cs index e848273cc..ddc4b81ee 100644 --- a/PluginBase.cs +++ b/PluginBase.cs @@ -36,13 +36,13 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes; - using System; using System.Collections.Generic; using System.Linq; using Aaru.CommonTypes.Interfaces; +namespace Aaru.CommonTypes; + /// Contain all plugins (filesystem, partition and image) public class PluginBase { diff --git a/Structs/Devices/ATA/Identify.cs b/Structs/Devices/ATA/Identify.cs index d9a35fa9c..0a7cc761a 100644 --- a/Structs/Devices/ATA/Identify.cs +++ b/Structs/Devices/ATA/Identify.cs @@ -38,8 +38,6 @@ // ReSharper disable UnusedMember.Global -namespace Aaru.CommonTypes.Structs.Devices.ATA; - using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -49,6 +47,8 @@ using Aaru.Console; using Aaru.Helpers; using Marshal = Aaru.Helpers.Marshal; +namespace Aaru.CommonTypes.Structs.Devices.ATA; + /// /// Information from following standards: T10-791D rev. 4c (ATA) T10-948D rev. 4c (ATA-2) T13-1153D rev. 18 /// (ATA/ATAPI-4) T13-1321D rev. 3 (ATA/ATAPI-5) T13-1410D rev. 3b (ATA/ATAPI-6) T13-1532D rev. 4b (ATA/ATAPI-7) @@ -108,18 +108,10 @@ public static class Identify /// MUST be set MustBeSet = 0x4000, #pragma warning disable 1591 - Reserved13 = 0x2000, - Reserved12 = 0x1000, - Reserved11 = 0x0800, - Reserved10 = 0x0400, - Reserved09 = 0x0200, - Reserved08 = 0x0100, - Reserved07 = 0x0080, - Reserved06 = 0x0040, - Reserved05 = 0x0020, - Reserved04 = 0x0010, - Reserved03 = 0x0008, - Reserved02 = 0x0004, + Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800, + Reserved10 = 0x0400, Reserved09 = 0x0200, Reserved08 = 0x0100, + Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020, + Reserved04 = 0x0010, Reserved03 = 0x0008, Reserved02 = 0x0004, Reserved01 = 0x0002, #pragma warning restore 1591 /// Indicates a device specific minimum standby timer value @@ -272,9 +264,7 @@ public static class Identify /// MUST be set MustBeSet = 0x4000, #pragma warning disable 1591 - Reserved13 = 0x2000, - Reserved12 = 0x1000, - Reserved11 = 0x0800, + Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400, #pragma warning restore 1591 /// DSN feature set is supported @@ -342,21 +332,11 @@ public static class Identify public enum DataSetMgmtBit : ushort { #pragma warning disable 1591 - Reserved15 = 0x8000, - Reserved14 = 0x4000, - Reserved13 = 0x2000, - Reserved12 = 0x1000, - Reserved11 = 0x0800, - Reserved10 = 0x0400, - Reserved09 = 0x0200, - Reserved08 = 0x0100, - Reserved07 = 0x0080, - Reserved06 = 0x0040, - Reserved05 = 0x0020, - Reserved04 = 0x0010, - Reserved03 = 0x0008, - Reserved02 = 0x0004, - Reserved01 = 0x0002, + Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000, + Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400, + Reserved09 = 0x0200, Reserved08 = 0x0100, Reserved07 = 0x0080, + Reserved06 = 0x0040, Reserved05 = 0x0020, Reserved04 = 0x0010, + Reserved03 = 0x0008, Reserved02 = 0x0004, Reserved01 = 0x0002, #pragma warning restore 1591 /// TRIM is supported Trim = 0x0001 @@ -446,9 +426,7 @@ public static class Identify public enum MajorVersionBit : ushort { #pragma warning disable 1591 - Reserved15 = 0x8000, - Reserved14 = 0x4000, - Reserved13 = 0x2000, + Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000, Reserved12 = 0x1000, #pragma warning restore 1591 /// ACS-4 @@ -499,9 +477,7 @@ public static class Identify /// Supports NCQ NCQ = 0x0100, #pragma warning disable 1591 - Reserved07 = 0x0080, - Reserved06 = 0x0040, - Reserved05 = 0x0020, + Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020, Reserved04 = 0x0010, #pragma warning restore 1591 /// Supports SATA Gen. 3 Signaling Speed (6.0Gb/s) @@ -519,15 +495,9 @@ public static class Identify public enum SATACapabilitiesBit2 : ushort { #pragma warning disable 1591 - Reserved15 = 0x8000, - Reserved14 = 0x4000, - Reserved13 = 0x2000, - Reserved12 = 0x1000, - Reserved11 = 0x0800, - Reserved10 = 0x0400, - Reserved09 = 0x0200, - Reserved08 = 0x0100, - Reserved07 = 0x0080, + Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000, + Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400, + Reserved09 = 0x0200, Reserved08 = 0x0100, Reserved07 = 0x0080, #pragma warning restore 1591 /// Supports RECEIVE FPDMA QUEUED and SEND FPDMA QUEUED FPDMAQ = 0x0040, @@ -554,14 +524,9 @@ public static class Identify public enum SATAFeaturesBit : ushort { #pragma warning disable 1591 - Reserved15 = 0x8000, - Reserved14 = 0x4000, - Reserved13 = 0x2000, - Reserved12 = 0x1000, - Reserved11 = 0x0800, - Reserved10 = 0x0400, - Reserved09 = 0x0200, - Reserved08 = 0x0100, + Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000, + Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400, + Reserved09 = 0x0200, Reserved08 = 0x0100, #pragma warning restore 1591 /// Supports NCQ autosense NCQAutoSense = 0x0080, @@ -590,15 +555,9 @@ public static class Identify public enum SCTCommandTransportBit : ushort { #pragma warning disable 1591 - Vendor15 = 0x8000, - Vendor14 = 0x4000, - Vendor13 = 0x2000, - Vendor12 = 0x1000, - Reserved11 = 0x0800, - Reserved10 = 0x0400, - Reserved09 = 0x0200, - Reserved08 = 0x0100, - Reserved07 = 0x0080, + Vendor15 = 0x8000, Vendor14 = 0x4000, Vendor13 = 0x2000, + Vendor12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400, + Reserved09 = 0x0200, Reserved08 = 0x0100, Reserved07 = 0x0080, Reserved06 = 0x0040, #pragma warning restore 1591 /// SCT Command Transport Data Tables supported @@ -620,19 +579,14 @@ public static class Identify public enum SecurityStatusBit : ushort { #pragma warning disable 1591 - Reserved15 = 0x8000, - Reserved14 = 0x4000, - Reserved13 = 0x2000, - Reserved12 = 0x1000, - Reserved11 = 0x0800, - Reserved10 = 0x0400, + Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000, + Reserved12 = 0x1000, Reserved11 = 0x0800, Reserved10 = 0x0400, Reserved09 = 0x0200, #pragma warning restore 1591 /// Maximum security level Maximum = 0x0100, #pragma warning disable 1591 - Reserved07 = 0x0080, - Reserved06 = 0x0040, + Reserved07 = 0x0080, Reserved06 = 0x0040, #pragma warning restore 1591 /// Supports enhanced security erase Enhanced = 0x0020, @@ -666,14 +620,9 @@ public static class Identify public enum TransferMode : byte { #pragma warning disable 1591 - Mode7 = 0x80, - Mode6 = 0x40, - Mode5 = 0x20, - Mode4 = 0x10, - Mode3 = 0x08, - Mode2 = 0x04, - Mode1 = 0x02, - Mode0 = 0x01 + Mode7 = 0x80, Mode6 = 0x40, Mode5 = 0x20, + Mode4 = 0x10, Mode3 = 0x08, Mode2 = 0x04, + Mode1 = 0x02, Mode0 = 0x01 #pragma warning restore 1591 } @@ -686,18 +635,10 @@ public static class Identify /// MUST be set Set = 0x4000, #pragma warning disable 1591 - Reserved13 = 0x2000, - Reserved12 = 0x1000, - Reserved11 = 0x0800, - Reserved10 = 0x0400, - Reserved09 = 0x0200, - Reserved08 = 0x0100, - Reserved07 = 0x0080, - Reserved06 = 0x0040, - Reserved05 = 0x0020, - Reserved04 = 0x0010, - Reserved03 = 0x0008, - Reserved02 = 0x0004, + Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800, + Reserved10 = 0x0400, Reserved09 = 0x0200, Reserved08 = 0x0100, + Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020, + Reserved04 = 0x0010, Reserved03 = 0x0008, Reserved02 = 0x0004, Reserved01 = 0x0002, #pragma warning restore 1591 /// Trusted Computing feature set is supported @@ -1100,8 +1041,8 @@ public static class Identify ataId.WWN = DescrambleWWN(ataId.WWN); ataId.WWNExtension = DescrambleWWN(ataId.WWNExtension); - var buf = new byte[512]; - IntPtr ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(512); + byte[] buf = new byte[512]; + nint ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(512); System.Runtime.InteropServices.Marshal.StructureToPtr(ataId, ptr, false); System.Runtime.InteropServices.Marshal.Copy(ptr, buf, 0, 512); System.Runtime.InteropServices.Marshal.FreeHGlobal(ptr); @@ -1125,7 +1066,7 @@ public static class Identify static ulong DescrambleWWN(ulong WWN) { byte[] qwb = BitConverter.GetBytes(WWN); - var qword = new byte[8]; + byte[] qword = new byte[8]; qword[7] = qwb[1]; qword[6] = qwb[0]; @@ -1143,7 +1084,7 @@ public static class Identify { byte[] outbuf = buffer[offset + length - 1] != 0x00 ? new byte[length + 1] : new byte[length]; - for(var i = 0; i < length; i += 2) + for(int i = 0; i < length; i += 2) { outbuf[i] = buffer[offset + i + 1]; outbuf[i + 1] = buffer[offset + i]; @@ -1156,9 +1097,9 @@ public static class Identify static byte[] ScrambleATAString(string str, int length) { - var buf = new byte[length]; + byte[] buf = new byte[length]; - for(var i = 0; i < length; i++) + for(int i = 0; i < length; i++) buf[i] = 0x20; if(str is null) @@ -1168,13 +1109,13 @@ public static class Identify if(bytes.Length % 2 != 0) { - var tmp = new byte[bytes.Length + 1]; + byte[] tmp = new byte[bytes.Length + 1]; tmp[^1] = 0x20; Array.Copy(bytes, 0, tmp, 0, bytes.Length); bytes = tmp; } - for(var i = 0; i < bytes.Length; i += 2) + for(int i = 0; i < bytes.Length; i += 2) { buf[i] = bytes[i + 1]; buf[i + 1] = bytes[i]; diff --git a/Structs/Devices/SCSI/Enums.cs b/Structs/Devices/SCSI/Enums.cs index 01dbf7d84..55ab2e1a5 100644 --- a/Structs/Devices/SCSI/Enums.cs +++ b/Structs/Devices/SCSI/Enums.cs @@ -30,10 +30,10 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Structs.Devices.SCSI; - using System.Diagnostics.CodeAnalysis; +namespace Aaru.CommonTypes.Structs.Devices.SCSI; + /// List of known SCSI peripheral qualifiers public enum PeripheralQualifiers : byte { diff --git a/Structs/Devices/SCSI/Inquiry.cs b/Structs/Devices/SCSI/Inquiry.cs index 3986e67bf..cd5743439 100644 --- a/Structs/Devices/SCSI/Inquiry.cs +++ b/Structs/Devices/SCSI/Inquiry.cs @@ -36,13 +36,13 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Structs.Devices.SCSI; - using System; using System.Diagnostics.CodeAnalysis; using System.Linq; using Aaru.Console; +namespace Aaru.CommonTypes.Structs.Devices.SCSI; + /// /// Information from the following standards: T9/375-D revision 10l T10/995-D revision 10 T10/1236-D revision 20 /// T10/1416-D revision 23 T10/1731-D revision 16 T10/502 revision 05 RFC 7144 ECMA-111 @@ -469,8 +469,8 @@ public struct Inquiry decoded.VersionDescriptors = new ushort[descriptorsNo]; - for(var i = 0; i < descriptorsNo; i++) - decoded.VersionDescriptors[i] = BitConverter.ToUInt16(SCSIInquiryResponse, 58 + i * 2); + for(int i = 0; i < descriptorsNo; i++) + decoded.VersionDescriptors[i] = BitConverter.ToUInt16(SCSIInquiryResponse, 58 + (i * 2)); } switch(SCSIInquiryResponse.Length) @@ -522,8 +522,8 @@ public struct Inquiry Inquiry decoded = inq.Value; - var buffer = new byte[512]; - byte length = 0; + byte[] buffer = new byte[512]; + byte length = 0; buffer[0] = (byte)(decoded.PeripheralQualifier << 5); buffer[0] += decoded.PeripheralDeviceType; @@ -686,8 +686,7 @@ public struct Inquiry Array.Copy(decoded.Seagate_DriveSerialNumber, 0, buffer, 36, 8); } - if(decoded.KreonIdentifier != null && - decoded.KreonVersion != null) + if(decoded is { KreonIdentifier: {}, KreonVersion: {} }) { length = 46; Array.Copy(decoded.KreonIdentifier, 0, buffer, 36, 5); @@ -717,8 +716,7 @@ public struct Inquiry Array.Copy(decoded.HiMDSpecific, 0, buffer, 44, 12); } - if(decoded.VendorSpecific != null && - !decoded.IsHiMD) + if(decoded is { VendorSpecific: {}, IsHiMD: false }) { length = 56; Array.Copy(decoded.VendorSpecific, 0, buffer, 36, 20); @@ -748,10 +746,10 @@ public struct Inquiry if(decoded.VersionDescriptors != null) { - length = (byte)(58 + decoded.VersionDescriptors.Length * 2); + length = (byte)(58 + (decoded.VersionDescriptors.Length * 2)); - for(var i = 0; i < decoded.VersionDescriptors.Length; i++) - Array.Copy(BitConverter.GetBytes(decoded.VersionDescriptors[i]), 0, buffer, 56 + i * 2, 2); + for(int i = 0; i < decoded.VersionDescriptors.Length; i++) + Array.Copy(BitConverter.GetBytes(decoded.VersionDescriptors[i]), 0, buffer, 56 + (i * 2), 2); } if(decoded.Reserved5 != null) @@ -779,7 +777,7 @@ public struct Inquiry } buffer[4] = length; - var dest = new byte[length]; + byte[] dest = new byte[length]; Array.Copy(buffer, 0, dest, 0, length); return dest; diff --git a/Structs/Devices/SCSI/Modes/2A.cs b/Structs/Devices/SCSI/Modes/2A.cs index 711db9172..407d6a191 100644 --- a/Structs/Devices/SCSI/Modes/2A.cs +++ b/Structs/Devices/SCSI/Modes/2A.cs @@ -30,13 +30,13 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes; - using System; using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; +namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes; + #region Mode Page 0x2A: CD-ROM capabilities page /// /// CD-ROM capabilities page Page code 0x2A 16 bytes in OB-U0077C 20 bytes in SFF-8020i 22 bytes in MMC-1 26 bytes @@ -263,14 +263,14 @@ public class ModePage_2A decoded.RotationControlSelected = (byte)(pageResponse[27] & 0x03); decoded.CurrentWriteSpeedSelected = (ushort)((pageResponse[28] << 8) + pageResponse[29]); - var descriptors = (ushort)((pageResponse.Length - 32) / 4); + ushort descriptors = (ushort)((pageResponse.Length - 32) / 4); decoded.WriteSpeedPerformanceDescriptors = new ModePage_2A_WriteDescriptor[descriptors]; - for(var i = 0; i < descriptors; i++) + for(int i = 0; i < descriptors; i++) decoded.WriteSpeedPerformanceDescriptors[i] = new ModePage_2A_WriteDescriptor { - RotationControl = (byte)(pageResponse[1 + 32 + i * 4] & 0x07), - WriteSpeed = (ushort)((pageResponse[2 + 32 + i * 4] << 8) + pageResponse[3 + 32 + i * 4]) + RotationControl = (byte)(pageResponse[1 + 32 + (i * 4)] & 0x07), + WriteSpeed = (ushort)((pageResponse[2 + 32 + (i * 4)] << 8) + pageResponse[3 + 32 + (i * 4)]) }; return decoded; @@ -281,8 +281,8 @@ public class ModePage_2A /// Raw page 2Ah public static byte[] Encode(ModePage_2A decoded) { - var pageResponse = new byte[512]; - byte length = 16; + byte[] pageResponse = new byte[512]; + byte length = 16; pageResponse[0] = 0x2A; @@ -480,20 +480,20 @@ public class ModePage_2A { length = 32; - for(var i = 0; i < decoded.WriteSpeedPerformanceDescriptors.Length; i++) + for(int i = 0; i < decoded.WriteSpeedPerformanceDescriptors.Length; i++) { - length += 4; - pageResponse[1 + 32 + i * 4] = decoded.WriteSpeedPerformanceDescriptors[i].RotationControl; + length += 4; + pageResponse[1 + 32 + (i * 4)] = decoded.WriteSpeedPerformanceDescriptors[i].RotationControl; - pageResponse[2 + 32 + i * 4] = + pageResponse[2 + 32 + (i * 4)] = (byte)((decoded.WriteSpeedPerformanceDescriptors[i].WriteSpeed & 0xFF00) >> 8); - pageResponse[3 + 32 + i * 4] = (byte)(decoded.WriteSpeedPerformanceDescriptors[i].WriteSpeed & 0xFF); + pageResponse[3 + 32 + (i * 4)] = (byte)(decoded.WriteSpeedPerformanceDescriptors[i].WriteSpeed & 0xFF); } } pageResponse[1] = (byte)(length - 2); - var buf = new byte[length]; + byte[] buf = new byte[length]; Array.Copy(pageResponse, 0, buf, 0, length); return buf; diff --git a/Structs/Filesystems.cs b/Structs/Filesystems.cs index 869a8423a..ac4273cf5 100644 --- a/Structs/Filesystems.cs +++ b/Structs/Filesystems.cs @@ -37,12 +37,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Structs; - using System; using System.Runtime.InteropServices; using Newtonsoft.Json; +namespace Aaru.CommonTypes.Structs; + /// File attributes. [Flags] public enum FileAttributes : ulong diff --git a/Structs/Images.cs b/Structs/Images.cs index 6547fab14..d30a370ba 100644 --- a/Structs/Images.cs +++ b/Structs/Images.cs @@ -36,14 +36,14 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Structs; - using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; +namespace Aaru.CommonTypes.Structs; + /// Contains information about a dump image and its contents public struct ImageInfo {