diff --git a/Enums/Images.cs b/Enums/Images.cs index 4e9b77d..8625cdb 100644 --- a/Enums/Images.cs +++ b/Enums/Images.cs @@ -44,11 +44,16 @@ namespace Aaru.CommonTypes.Enums public enum TrackType : byte { /// Audio track - Audio = 0, /// Data track (not any of the below defined ones) - Data = 1, /// Data track, compact disc mode 1 - CdMode1 = 2, /// Data track, compact disc mode 2, formless - CdMode2Formless = 3, /// Data track, compact disc mode 2, form 1 - CdMode2Form1 = 4, /// Data track, compact disc mode 2, form 2 + Audio = 0, + /// Data track (not any of the below defined ones) + Data = 1, + /// Data track, compact disc mode 1 + CdMode1 = 2, + /// Data track, compact disc mode 2, formless + CdMode2Formless = 3, + /// Data track, compact disc mode 2, form 1 + CdMode2Form1 = 4, + /// Data track, compact disc mode 2, form 2 CdMode2Form2 = 5 } @@ -56,12 +61,16 @@ namespace Aaru.CommonTypes.Enums public enum TrackSubchannelType : byte { /// Track does not has subchannel dumped, or it's not a CD - None = 0, /// Subchannel is packed and error corrected - Packed = 1, /// Subchannel is interleaved - Raw = 2, /// Subchannel is packed and comes interleaved with main channel in same file + None = 0, + /// Subchannel is packed and error corrected + Packed = 1, + /// Subchannel is interleaved + Raw = 2, + /// Subchannel is packed and comes interleaved with main channel in same file PackedInterleaved = 3, /// Subchannel is interleaved and comes interleaved with main channel in same file - RawInterleaved = 4, /// Only Q subchannel is stored as 16 bytes + RawInterleaved = 4, + /// Only Q subchannel is stored as 16 bytes Q16 = 5, /// Only Q subchannel is stored as 16 bytes and comes interleaved with main channel in same file Q16Interleaved = 6 @@ -71,19 +80,32 @@ namespace Aaru.CommonTypes.Enums public enum SectorTagType { /// Apple's GCR sector tags, 12 bytes - AppleSectorTag = 0, /// Sync frame from CD sector, 12 bytes - CdSectorSync = 1, /// CD sector header, 4 bytes - CdSectorHeader = 2, /// CD mode 2 sector subheader - CdSectorSubHeader = 3, /// CD sector EDC, 4 bytes - CdSectorEdc = 4, /// CD sector ECC P, 172 bytes - CdSectorEccP = 5, /// CD sector ECC Q, 104 bytes - CdSectorEccQ = 6, /// CD sector ECC (P and Q), 276 bytes - CdSectorEcc = 7, /// CD sector subchannel, 96 bytes - CdSectorSubchannel = 8, /// CD track ISRC, string, 12 bytes - CdTrackIsrc = 9, /// CD track text, string, 13 bytes - CdTrackText = 10, /// CD track flags, 1 byte - CdTrackFlags = 11, /// DVD sector copyright information - DvdCmi = 12, /// Floppy address mark (contents depend on underlying floppy format) + AppleSectorTag = 0, + /// Sync frame from CD sector, 12 bytes + CdSectorSync = 1, + /// CD sector header, 4 bytes + CdSectorHeader = 2, + /// CD mode 2 sector subheader + CdSectorSubHeader = 3, + /// CD sector EDC, 4 bytes + CdSectorEdc = 4, + /// CD sector ECC P, 172 bytes + CdSectorEccP = 5, + /// CD sector ECC Q, 104 bytes + CdSectorEccQ = 6, + /// CD sector ECC (P and Q), 276 bytes + CdSectorEcc = 7, + /// CD sector subchannel, 96 bytes + CdSectorSubchannel = 8, + /// CD track ISRC, string, 12 bytes + CdTrackIsrc = 9, + /// CD track text, string, 13 bytes + CdTrackText = 10, + /// CD track flags, 1 byte + CdTrackFlags = 11, + /// DVD sector copyright information + DvdCmi = 12, + /// Floppy address mark (contents depend on underlying floppy format) FloppyAddressMark = 13 } @@ -91,77 +113,145 @@ namespace Aaru.CommonTypes.Enums public enum MediaTagType { /// CD table of contents - CD_TOC = 0, /// CD session information - CD_SessionInfo = 1, /// CD full table of contents - CD_FullTOC = 2, /// CD PMA - CD_PMA = 3, /// CD Adress-Time-In-Pregroove - CD_ATIP = 4, /// CD-Text - CD_TEXT = 5, /// CD Media Catalogue Number - CD_MCN = 6, /// DVD/HD DVD Physical Format Information - DVD_PFI = 7, /// DVD Lead-in Copyright Management Information - DVD_CMI = 8, /// DVD disc key - DVD_DiscKey = 9, /// DVD/HD DVD Burst Cutting Area - DVD_BCA = 10, /// DVD/HD DVD Lead-in Disc Manufacturer Information - DVD_DMI = 11, /// Media identifier - DVD_MediaIdentifier = 12, /// Media key block - DVD_MKB = 13, /// DVD-RAM/HD DVD-RAM DDS information - DVDRAM_DDS = 14, /// DVD-RAM/HD DVD-RAM Medium status - DVDRAM_MediumStatus = 15, /// DVD-RAM/HD DVD-RAM Spare area information - DVDRAM_SpareArea = 16, /// DVD-R/-RW/HD DVD-R RMD in last border-out - DVDR_RMD = 17, /// Pre-recorded information from DVD-R/-RW lead-in - DVDR_PreRecordedInfo = 18, /// DVD-R/-RW/HD DVD-R media identifier - DVDR_MediaIdentifier = 19, /// DVD-R/-RW/HD DVD-R physical format information - DVDR_PFI = 20, /// ADIP information - DVD_ADIP = 21, /// HD DVD Lead-in copyright protection information - HDDVD_CPI = 22, /// HD DVD-R Medium Status - HDDVD_MediumStatus = 23, /// DVD+/-R DL Layer capacity - DVDDL_LayerCapacity = 24, /// DVD-R DL Middle Zone start address - DVDDL_MiddleZoneAddress = 25, /// DVD-R DL Jump Interval Size - DVDDL_JumpIntervalSize = 26, /// DVD-R DL Start LBA of the manual layer jump - DVDDL_ManualLayerJumpLBA = 27, /// Blu-ray Disc Information - BD_DI = 28, /// Blu-ray Burst Cutting Area - BD_BCA = 29, /// Blu-ray Disc Definition Structure - BD_DDS = 30, /// Blu-ray Cartridge Status - BD_CartridgeStatus = 31, /// Blu-ray Status of Spare Area - BD_SpareArea = 32, /// AACS volume identifier - AACS_VolumeIdentifier = 33, /// AACS pre-recorded media serial number - AACS_SerialNumber = 34, /// AACS media identifier - AACS_MediaIdentifier = 35, /// Lead-in AACS media key block - AACS_MKB = 36, /// AACS data keys - AACS_DataKeys = 37, /// LBA extents flagged for bus encryption by AACS - AACS_LBAExtents = 38, /// CPRM media key block in Lead-in - AACS_CPRM_MKB = 39, /// Recognized layer formats in hybrid discs - Hybrid_RecognizedLayers = 40, /// Disc write protection status - MMC_WriteProtection = 41, /// Disc standard information - MMC_DiscInformation = 42, /// Disc track resources information - MMC_TrackResourcesInformation = 43, /// BD-R Pseudo-overwrite information - MMC_POWResourcesInformation = 44, /// SCSI INQUIRY response - SCSI_INQUIRY = 45, /// SCSI MODE PAGE 2Ah - SCSI_MODEPAGE_2A = 46, /// ATA IDENTIFY DEVICE response - ATA_IDENTIFY = 47, /// ATA IDENTIFY PACKET DEVICE response - ATAPI_IDENTIFY = 48, /// PCMCIA/CardBus Card Information Structure - PCMCIA_CIS = 49, /// SecureDigital CID - SD_CID = 50, /// SecureDigital CSD - SD_CSD = 51, /// SecureDigital SCR - SD_SCR = 52, /// SecureDigital OCR - SD_OCR = 53, /// MultiMediaCard CID - MMC_CID = 54, /// MultiMediaCard CSD - MMC_CSD = 55, /// MultiMediaCard OCR - MMC_OCR = 56, /// MultiMediaCard Extended CSD - MMC_ExtendedCSD = 57, /// Xbox Security Sector - Xbox_SecuritySector = 58, /// + CD_TOC = 0, + /// CD session information + CD_SessionInfo = 1, + /// CD full table of contents + CD_FullTOC = 2, + /// CD PMA + CD_PMA = 3, + /// CD Adress-Time-In-Pregroove + CD_ATIP = 4, + /// CD-Text + CD_TEXT = 5, + /// CD Media Catalogue Number + CD_MCN = 6, + /// DVD/HD DVD Physical Format Information + DVD_PFI = 7, + /// DVD Lead-in Copyright Management Information + DVD_CMI = 8, + /// DVD disc key + DVD_DiscKey = 9, + /// DVD/HD DVD Burst Cutting Area + DVD_BCA = 10, + /// DVD/HD DVD Lead-in Disc Manufacturer Information + DVD_DMI = 11, + /// Media identifier + DVD_MediaIdentifier = 12, + /// Media key block + DVD_MKB = 13, + /// DVD-RAM/HD DVD-RAM DDS information + DVDRAM_DDS = 14, + /// DVD-RAM/HD DVD-RAM Medium status + DVDRAM_MediumStatus = 15, + /// DVD-RAM/HD DVD-RAM Spare area information + DVDRAM_SpareArea = 16, + /// DVD-R/-RW/HD DVD-R RMD in last border-out + DVDR_RMD = 17, + /// Pre-recorded information from DVD-R/-RW lead-in + DVDR_PreRecordedInfo = 18, + /// DVD-R/-RW/HD DVD-R media identifier + DVDR_MediaIdentifier = 19, + /// DVD-R/-RW/HD DVD-R physical format information + DVDR_PFI = 20, + /// ADIP information + DVD_ADIP = 21, + /// HD DVD Lead-in copyright protection information + HDDVD_CPI = 22, + /// HD DVD-R Medium Status + HDDVD_MediumStatus = 23, + /// DVD+/-R DL Layer capacity + DVDDL_LayerCapacity = 24, + /// DVD-R DL Middle Zone start address + DVDDL_MiddleZoneAddress = 25, + /// DVD-R DL Jump Interval Size + DVDDL_JumpIntervalSize = 26, + /// DVD-R DL Start LBA of the manual layer jump + DVDDL_ManualLayerJumpLBA = 27, + /// Blu-ray Disc Information + BD_DI = 28, + /// Blu-ray Burst Cutting Area + BD_BCA = 29, + /// Blu-ray Disc Definition Structure + BD_DDS = 30, + /// Blu-ray Cartridge Status + BD_CartridgeStatus = 31, + /// Blu-ray Status of Spare Area + BD_SpareArea = 32, + /// AACS volume identifier + AACS_VolumeIdentifier = 33, + /// AACS pre-recorded media serial number + AACS_SerialNumber = 34, + /// AACS media identifier + AACS_MediaIdentifier = 35, + /// Lead-in AACS media key block + AACS_MKB = 36, + /// AACS data keys + AACS_DataKeys = 37, + /// LBA extents flagged for bus encryption by AACS + AACS_LBAExtents = 38, + /// CPRM media key block in Lead-in + AACS_CPRM_MKB = 39, + /// Recognized layer formats in hybrid discs + Hybrid_RecognizedLayers = 40, + /// Disc write protection status + MMC_WriteProtection = 41, + /// Disc standard information + MMC_DiscInformation = 42, + /// Disc track resources information + MMC_TrackResourcesInformation = 43, + /// BD-R Pseudo-overwrite information + MMC_POWResourcesInformation = 44, + /// SCSI INQUIRY response + SCSI_INQUIRY = 45, + /// SCSI MODE PAGE 2Ah + SCSI_MODEPAGE_2A = 46, + /// ATA IDENTIFY DEVICE response + ATA_IDENTIFY = 47, + /// ATA IDENTIFY PACKET DEVICE response + ATAPI_IDENTIFY = 48, + /// PCMCIA/CardBus Card Information Structure + PCMCIA_CIS = 49, + /// SecureDigital CID + SD_CID = 50, + /// SecureDigital CSD + SD_CSD = 51, + /// SecureDigital SCR + SD_SCR = 52, + /// SecureDigital OCR + SD_OCR = 53, + /// MultiMediaCard CID + MMC_CID = 54, + /// MultiMediaCard CSD + MMC_CSD = 55, + /// MultiMediaCard OCR + MMC_OCR = 56, + /// MultiMediaCard Extended CSD + MMC_ExtendedCSD = 57, + /// Xbox Security Sector + Xbox_SecuritySector = 58, + /// /// On floppy disks, data in last cylinder usually in a different format that contains duplication or /// manufacturing information /// - Floppy_LeadOut = 59, /// DVD Disc Control Blocks - DCB = 60, /// Compact Disc First Track Pregap - CD_FirstTrackPregap = 61, /// Compact Disc Lead-out - CD_LeadOut = 62, /// SCSI MODE SENSE (6) - SCSI_MODESENSE_6 = 63, /// SCSI MODE SENSE (10) - SCSI_MODESENSE_10 = 64, /// USB descriptors - USB_Descriptors = 65, /// XGD unlocked DMI - Xbox_DMI = 66, /// XDG unlocked PFI - Xbox_PFI = 67, /// Compact Disc Lead-in + Floppy_LeadOut = 59, + /// DVD Disc Control Blocks + DCB = 60, + /// Compact Disc First Track Pregap + CD_FirstTrackPregap = 61, + /// Compact Disc Lead-out + CD_LeadOut = 62, + /// SCSI MODE SENSE (6) + SCSI_MODESENSE_6 = 63, + /// SCSI MODE SENSE (10) + SCSI_MODESENSE_10 = 64, + /// USB descriptors + USB_Descriptors = 65, + /// XGD unlocked DMI + Xbox_DMI = 66, + /// XDG unlocked PFI + Xbox_PFI = 67, + /// Compact Disc Lead-in CD_LeadIn = 68 } @@ -169,9 +259,12 @@ namespace Aaru.CommonTypes.Enums public enum XmlMediaType : byte { /// Purely optical discs - OpticalDisc = 0, /// Media that is physically block-based or abstracted like that - BlockMedia = 1, /// Media that can be accessed by-byte or by-bit, like chips - LinearMedia = 2, /// Media that can only store data when it is modulated to audio + OpticalDisc = 0, + /// Media that is physically block-based or abstracted like that + BlockMedia = 1, + /// Media that can be accessed by-byte or by-bit, like chips + LinearMedia = 2, + /// Media that can only store data when it is modulated to audio AudioMedia = 3 } @@ -180,9 +273,12 @@ namespace Aaru.CommonTypes.Enums public enum CdFlags : byte { /// Track is quadraphonic. - FourChannel = 0x08, /// Track is non-audio (data). - DataTrack = 0x04, /// Track is copy protected. - CopyPermitted = 0x02, /// Track has pre-emphasis. + FourChannel = 0x08, + /// Track is non-audio (data). + DataTrack = 0x04, + /// Track is copy protected. + CopyPermitted = 0x02, + /// Track has pre-emphasis. PreEmphasis = 0x01 } @@ -191,12 +287,16 @@ namespace Aaru.CommonTypes.Enums public enum FloppySectorStatus : byte { /// Both address mark and data checksums are correct. - Correct = 0x01, /// Data checksum is incorrect. - DataError = 0x02, /// Addres mark checksum is incorrect. + Correct = 0x01, + /// Data checksum is incorrect. + DataError = 0x02, + /// Addres mark checksum is incorrect. AddressMarkError = 0x04, /// There is another sector in the same track/head with same sector id. - Duplicated = 0x08, /// Sector data section is not magnetized. - Demagnetized = 0x10, /// Sector data section has a physically visible hole. + Duplicated = 0x08, + /// Sector data section is not magnetized. + Demagnetized = 0x10, + /// Sector data section has a physically visible hole. Hole = 0x20, /// There is no address mark containing the requested sector id in the track/head. NotFound = 0x40 @@ -205,11 +305,16 @@ namespace Aaru.CommonTypes.Enums public enum FloppyTypes : byte { /// 8" floppy - Floppy, /// 5.25" floppy - MiniFloppy, /// 3.5" floppy - MicroFloppy, /// 3" floppy - CompactFloppy, /// 5.25" twiggy - FileWare, /// 2.5" quickdisk + Floppy, + /// 5.25" floppy + MiniFloppy, + /// 3.5" floppy + MicroFloppy, + /// 3" floppy + CompactFloppy, + /// 5.25" twiggy + FileWare, + /// 2.5" quickdisk QuickDisk } @@ -218,8 +323,10 @@ namespace Aaru.CommonTypes.Enums /// Standard coercitivity (about 300Oe as found in 8" and 5.25"-double-density disks). Standard, /// Double density coercitivity (about 600Oe as found in 5.25" HD and 3.5" DD disks). - Double, /// High density coercitivity (about 700Oe as found in 3.5" HD disks). - High, /// Extended density coercitivity (about 750Oe as found in 3.5" ED disks). + Double, + /// High density coercitivity (about 700Oe as found in 3.5" HD disks). + High, + /// Extended density coercitivity (about 750Oe as found in 3.5" ED disks). Extended } } \ No newline at end of file diff --git a/Exceptions/Images.cs b/Exceptions/Images.cs index ba0e67a..f04a553 100644 --- a/Exceptions/Images.cs +++ b/Exceptions/Images.cs @@ -49,11 +49,11 @@ namespace Aaru.CommonTypes.Exceptions /// Message. /// Inner. public FeatureSupportedButNotImplementedImageException(string message, Exception inner) : - base(message, inner) { } + base(message, inner) {} /// Feature is supported by image but not implemented yet. /// Message. - public FeatureSupportedButNotImplementedImageException(string message) : base(message) { } + public FeatureSupportedButNotImplementedImageException(string message) : base(message) {} /// Feature is supported by image but not implemented yet. /// Info. @@ -72,11 +72,11 @@ namespace Aaru.CommonTypes.Exceptions /// Feature is not supported by image. /// Message. /// Inner. - public FeatureUnsupportedImageException(string message, Exception inner) : base(message, inner) { } + public FeatureUnsupportedImageException(string message, Exception inner) : base(message, inner) {} /// Feature is not supported by image. /// Message. - public FeatureUnsupportedImageException(string message) : base(message) { } + public FeatureUnsupportedImageException(string message) : base(message) {} /// Feature is not supported by image. /// Info. @@ -95,11 +95,11 @@ namespace Aaru.CommonTypes.Exceptions /// Feature is supported by image but not present on it. /// Message. /// Inner. - public FeatureNotPresentImageException(string message, Exception inner) : base(message, inner) { } + public FeatureNotPresentImageException(string message, Exception inner) : base(message, inner) {} /// Feature is supported by image but not present on it. /// Message. - public FeatureNotPresentImageException(string message) : base(message) { } + public FeatureNotPresentImageException(string message) : base(message) {} /// Feature is supported by image but not present on it. /// Info. @@ -118,11 +118,11 @@ namespace Aaru.CommonTypes.Exceptions /// Feature is supported by image but not by the disc it represents. /// Message. /// Inner. - public FeaturedNotSupportedByDiscImageException(string message, Exception inner) : base(message, inner) { } + public FeaturedNotSupportedByDiscImageException(string message, Exception inner) : base(message, inner) {} /// Feature is supported by image but not by the disc it represents. /// Message. - public FeaturedNotSupportedByDiscImageException(string message) : base(message) { } + public FeaturedNotSupportedByDiscImageException(string message) : base(message) {} /// Feature is supported by image but not by the disc it represents. /// Info. @@ -141,11 +141,11 @@ namespace Aaru.CommonTypes.Exceptions /// Corrupt, incorrect or unhandled feature found on image /// Message. /// Inner. - public ImageNotSupportedException(string message, Exception inner) : base(message, inner) { } + public ImageNotSupportedException(string message, Exception inner) : base(message, inner) {} /// Corrupt, incorrect or unhandled feature found on image /// Message. - public ImageNotSupportedException(string message) : base(message) { } + public ImageNotSupportedException(string message) : base(message) {} /// Corrupt, incorrect or unhandled feature found on image /// Info. diff --git a/Extents/ExtentsByte.cs b/Extents/ExtentsByte.cs index 040d640..f43d4f5 100644 --- a/Extents/ExtentsByte.cs +++ b/Extents/ExtentsByte.cs @@ -132,7 +132,7 @@ namespace Aaru.CommonTypes.Extents byte realEnd; if(run) - realEnd = (byte)(start + end - 1); + realEnd = (byte)((start + end) - 1); else realEnd = end; diff --git a/Extents/ExtentsInt.cs b/Extents/ExtentsInt.cs index 00a7116..dda4894 100644 --- a/Extents/ExtentsInt.cs +++ b/Extents/ExtentsInt.cs @@ -132,7 +132,7 @@ namespace Aaru.CommonTypes.Extents int realEnd; if(run) - realEnd = start + end - 1; + realEnd = (start + end) - 1; else realEnd = end; diff --git a/Extents/ExtentsLong.cs b/Extents/ExtentsLong.cs index 9cf1327..a1bd4db 100644 --- a/Extents/ExtentsLong.cs +++ b/Extents/ExtentsLong.cs @@ -132,7 +132,7 @@ namespace Aaru.CommonTypes.Extents long realEnd; if(run) - realEnd = start + end - 1; + realEnd = (start + end) - 1; else realEnd = end; diff --git a/Extents/ExtentsSByte.cs b/Extents/ExtentsSByte.cs index fa03d95..a070afd 100644 --- a/Extents/ExtentsSByte.cs +++ b/Extents/ExtentsSByte.cs @@ -132,7 +132,7 @@ namespace Aaru.CommonTypes.Extents sbyte realEnd; if(run) - realEnd = (sbyte)(start + end - 1); + realEnd = (sbyte)((start + end) - 1); else realEnd = end; diff --git a/Extents/ExtentsShort.cs b/Extents/ExtentsShort.cs index 13b8d9e..ce43fd2 100644 --- a/Extents/ExtentsShort.cs +++ b/Extents/ExtentsShort.cs @@ -132,7 +132,7 @@ namespace Aaru.CommonTypes.Extents short realEnd; if(run) - realEnd = (short)(start + end - 1); + realEnd = (short)((start + end) - 1); else realEnd = end; diff --git a/Extents/ExtentsUInt.cs b/Extents/ExtentsUInt.cs index 7985426..bb9ad11 100644 --- a/Extents/ExtentsUInt.cs +++ b/Extents/ExtentsUInt.cs @@ -132,7 +132,7 @@ namespace Aaru.CommonTypes.Extents uint realEnd; if(run) - realEnd = start + end - 1; + realEnd = (start + end) - 1; else realEnd = end; diff --git a/Extents/ExtentsULong.cs b/Extents/ExtentsULong.cs index 7fb399a..953577f 100644 --- a/Extents/ExtentsULong.cs +++ b/Extents/ExtentsULong.cs @@ -132,7 +132,7 @@ namespace Aaru.CommonTypes.Extents ulong realEnd; if(run) - realEnd = start + end - 1; + realEnd = (start + end) - 1; else realEnd = end; diff --git a/Extents/ExtentsUShort.cs b/Extents/ExtentsUShort.cs index ae318e5..c3ef1b3 100644 --- a/Extents/ExtentsUShort.cs +++ b/Extents/ExtentsUShort.cs @@ -132,7 +132,7 @@ namespace Aaru.CommonTypes.Extents ushort realEnd; if(run) - realEnd = (ushort)(start + end - 1); + realEnd = (ushort)((start + end) - 1); else realEnd = end; diff --git a/Filters.cs b/Filters.cs index 3b07103..cbdb316 100644 --- a/Filters.cs +++ b/Filters.cs @@ -53,14 +53,14 @@ namespace Aaru.CommonTypes /// Fills the list of all known filters public FiltersList() { - Assembly assembly = Assembly.Load("Aaru.Filters"); + var assembly = Assembly.Load("Aaru.Filters"); Filters = new SortedDictionary(); foreach(Type type in assembly.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IFilter)))) try { var filter = (IFilter)type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - { }); + {}); if(filter != null && !Filters.ContainsKey(filter.Name.ToLower())) @@ -88,7 +88,7 @@ namespace Aaru.CommonTypes continue; var foundFilter = (IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - { }); + {}); foundFilter?.Open(path); diff --git a/Geometry.cs b/Geometry.cs index 8f7ff6f..fb9c10e 100644 --- a/Geometry.cs +++ b/Geometry.cs @@ -42,7 +42,7 @@ namespace Aaru.CommonTypes { public static class Geometry { - static readonly(ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding + static readonly (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding, bool variableSectorsPerTrack, MediaType type)[] KnownGeometries = { (32, 1, 8, 319, MediaEncoding.FM, false, MediaType.IBM23FD), @@ -128,8 +128,8 @@ namespace Aaru.CommonTypes geometry.variableSectorsPerTrack select geom.type). FirstOrDefault(); - public static(ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding, - bool variableSectorsPerTrack, MediaType type) GetGeometry(MediaType mediaType) => + public static (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding + , bool variableSectorsPerTrack, MediaType type) GetGeometry(MediaType mediaType) => (from geom in KnownGeometries where geom.type == mediaType select geom).FirstOrDefault(); } } \ No newline at end of file diff --git a/Interfaces/IArchive.cs b/Interfaces/IArchive.cs index 548c65a..6366db3 100644 --- a/Interfaces/IArchive.cs +++ b/Interfaces/IArchive.cs @@ -41,15 +41,18 @@ namespace Aaru.CommonTypes.Interfaces public enum ArchiveSupportedFeature : uint { /// The archive supports filenames for its entries. If this flag is not set, files can only be accessed by number. - SupportsFilenames = 1 << 0, /// + SupportsFilenames = 1 << 0, + /// /// The archive supports compression. If this flag is not set, compressed and uncompressed lengths are always the /// same. /// - SupportsCompression = 1 << 1, /// + SupportsCompression = 1 << 1, + /// /// The archive supports subdirectories. If this flag is not set, all filenames are guaranteed to not contain any /// "/" character. /// - SupportsSubdirectories = 1 << 2, /// + SupportsSubdirectories = 1 << 2, + /// /// The archive supports explicit entries for directories (like Zip, for example). If this flag is not set, /// directories are implicit by the relative name of the files. /// diff --git a/Interop/DetectOS.cs b/Interop/DetectOS.cs index 23e6765..6ae39f6 100644 --- a/Interop/DetectOS.cs +++ b/Interop/DetectOS.cs @@ -114,7 +114,7 @@ namespace Aaru.CommonTypes.Interop { if((int)Environment.OSVersion.Platform < 4 || (int)Environment.OSVersion.Platform == 5) - return(PlatformID)(int)Environment.OSVersion.Platform; + return (PlatformID)(int)Environment.OSVersion.Platform; int error = uname(out utsname unixname); @@ -124,7 +124,7 @@ namespace Aaru.CommonTypes.Interop switch(unixname.sysname) { // TODO: Differentiate Linux, Android, Tizen - case"Linux": + case "Linux": { #if __ANDROID__ return PlatformID.Android; @@ -133,7 +133,7 @@ namespace Aaru.CommonTypes.Interop #endif } - case"Darwin": + case "Darwin": { IntPtr pLen = Marshal.AllocHGlobal(sizeof(int)); int osxError = OSX_sysctlbyname("hw.machine", IntPtr.Zero, pLen, IntPtr.Zero, 0); @@ -171,29 +171,29 @@ namespace Aaru.CommonTypes.Interop return PlatformID.MacOSX; } - case"GNU": return PlatformID.Hurd; - case"FreeBSD": - case"GNU/kFreeBSD": return PlatformID.FreeBSD; - case"DragonFly": return PlatformID.DragonFly; - case"Haiku": return PlatformID.Haiku; - case"HP-UX": return PlatformID.HPUX; - case"AIX": return PlatformID.AIX; - case"OS400": return PlatformID.OS400; - case"IRIX": - case"IRIX64": return PlatformID.IRIX; - case"Minix": return PlatformID.Minix; - case"NetBSD": return PlatformID.NetBSD; - case"NONSTOP_KERNEL": return PlatformID.NonStop; - case"OpenBSD": return PlatformID.OpenBSD; - case"QNX": return PlatformID.QNX; - case"SINIX-Y": return PlatformID.SINIX; - case"SunOS": return PlatformID.Solaris; - case"OSF1": return PlatformID.Tru64; - case"ULTRIX": return PlatformID.Ultrix; - case"SCO_SV": return PlatformID.OpenServer; - case"UnixWare": return PlatformID.UnixWare; - case"Interix": - case"UWIN-W7": return PlatformID.Win32NT; + case "GNU": return PlatformID.Hurd; + case "FreeBSD": + case "GNU/kFreeBSD": return PlatformID.FreeBSD; + case "DragonFly": return PlatformID.DragonFly; + case "Haiku": return PlatformID.Haiku; + case "HP-UX": return PlatformID.HPUX; + case "AIX": return PlatformID.AIX; + case "OS400": return PlatformID.OS400; + case "IRIX": + case "IRIX64": return PlatformID.IRIX; + case "Minix": return PlatformID.Minix; + case "NetBSD": return PlatformID.NetBSD; + case "NONSTOP_KERNEL": return PlatformID.NonStop; + case "OpenBSD": return PlatformID.OpenBSD; + case "QNX": return PlatformID.QNX; + case "SINIX-Y": return PlatformID.SINIX; + case "SunOS": return PlatformID.Solaris; + case "OSF1": return PlatformID.Tru64; + case "ULTRIX": return PlatformID.Ultrix; + case "SCO_SV": return PlatformID.OpenServer; + case "UnixWare": return PlatformID.UnixWare; + case "Interix": + case "UWIN-W7": return PlatformID.Win32NT; default: { if(unixname.sysname.StartsWith("CYGWIN_NT", StringComparison.Ordinal) || @@ -217,18 +217,18 @@ namespace Aaru.CommonTypes.Interop { case PlatformID.MacOSX: if(Environment.OSVersion.Version.Major != 1) - return$"10.{Environment.OSVersion.Version.Major - 4}.{Environment.OSVersion.Version.Minor}"; + return $"10.{Environment.OSVersion.Version.Major - 4}.{Environment.OSVersion.Version.Minor}"; switch(Environment.OSVersion.Version.Minor) { - case 3: return"10.0"; - case 4: return"10.1"; + case 3: return "10.0"; + case 4: return "10.1"; } goto default; case PlatformID.Win32NT: // From Windows 8.1 the reported version is simply falsified... - if(Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Major >= 2 || + if((Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Major >= 2) || Environment.OSVersion.Version.Major > 6) return FileVersionInfo. GetVersionInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), @@ -247,18 +247,18 @@ namespace Aaru.CommonTypes.Interop { switch(id) { - case PlatformID.AIX: return"AIX"; - case PlatformID.Android: return"Android"; - case PlatformID.DragonFly: return"DragonFly BSD"; - case PlatformID.FreeBSD: return"FreeBSD"; - case PlatformID.Haiku: return"Haiku"; - case PlatformID.HPUX: return"HP/UX"; - case PlatformID.Hurd: return"Hurd"; - case PlatformID.iOS: return"iOS"; - case PlatformID.IRIX: return"IRIX"; + case PlatformID.AIX: return "AIX"; + case PlatformID.Android: return "Android"; + case PlatformID.DragonFly: return "DragonFly BSD"; + case PlatformID.FreeBSD: return "FreeBSD"; + case PlatformID.Haiku: return "Haiku"; + case PlatformID.HPUX: return "HP/UX"; + case PlatformID.Hurd: return "Hurd"; + case PlatformID.iOS: return "iOS"; + case PlatformID.IRIX: return "IRIX"; case PlatformID.Linux: if(!File.Exists("/proc/version")) - return"Linux"; + return "Linux"; string s = File.ReadAllText("/proc/version"); @@ -266,95 +266,95 @@ namespace Aaru.CommonTypes.Interop case PlatformID.MacOSX: if(string.IsNullOrEmpty(version)) - return"macOS"; + return "macOS"; string[] pieces = version.Split('.'); if(pieces.Length < 2 || !int.TryParse(pieces[1], out int minor)) - return"macOS"; + return "macOS"; if(minor >= 12) - return"macOS"; + return "macOS"; if(minor >= 8) - return"OS X"; + return "OS X"; - return"Mac OS X"; + return "Mac OS X"; - case PlatformID.Minix: return"MINIX"; - case PlatformID.NetBSD: return"NetBSD"; - case PlatformID.NonStop: return"NonStop OS"; - case PlatformID.OpenBSD: return"OpenBSD"; - case PlatformID.OpenServer: return"SCO OpenServer"; - case PlatformID.OS400: return"OS/400"; - case PlatformID.PlayStation3: return"Sony CellOS"; - case PlatformID.PlayStation4: return"Sony Orbis OS"; - case PlatformID.QNX: return"QNX"; - case PlatformID.SINIX: return"SINIX"; - case PlatformID.Solaris: return"Sun Solaris"; - case PlatformID.Tizen: return"Samsung Tizen"; - case PlatformID.Tru64: return"Tru64 UNIX"; - case PlatformID.Ultrix: return"Ultrix"; - case PlatformID.Unix: return"UNIX"; - case PlatformID.UnixWare: return"SCO UnixWare"; - case PlatformID.Wii: return"Nintendo Wii"; - case PlatformID.WiiU: return"Nintendo Wii U"; + case PlatformID.Minix: return "MINIX"; + case PlatformID.NetBSD: return "NetBSD"; + case PlatformID.NonStop: return "NonStop OS"; + case PlatformID.OpenBSD: return "OpenBSD"; + case PlatformID.OpenServer: return "SCO OpenServer"; + case PlatformID.OS400: return "OS/400"; + case PlatformID.PlayStation3: return "Sony CellOS"; + case PlatformID.PlayStation4: return "Sony Orbis OS"; + case PlatformID.QNX: return "QNX"; + case PlatformID.SINIX: return "SINIX"; + case PlatformID.Solaris: return "Sun Solaris"; + case PlatformID.Tizen: return "Samsung Tizen"; + case PlatformID.Tru64: return "Tru64 UNIX"; + case PlatformID.Ultrix: return "Ultrix"; + case PlatformID.Unix: return "UNIX"; + case PlatformID.UnixWare: return "SCO UnixWare"; + case PlatformID.Wii: return "Nintendo Wii"; + case PlatformID.WiiU: return "Nintendo Wii U"; case PlatformID.Win32NT: if(string.IsNullOrEmpty(version)) - return"Windows NT/2000/XP/Vista/7/10"; + return "Windows NT/2000/XP/Vista/7/10"; if(version.StartsWith("3.", StringComparison.Ordinal) || version.StartsWith("4.", StringComparison.Ordinal)) - return"Windows NT"; + return "Windows NT"; if(version.StartsWith("5.0", StringComparison.Ordinal)) - return"Windows 2000"; + return "Windows 2000"; if(version.StartsWith("5.1", StringComparison.Ordinal)) - return"Windows XP"; + return "Windows XP"; if(version.StartsWith("5.2", StringComparison.Ordinal)) - return"Windows 2003"; + return "Windows 2003"; if(version.StartsWith("6.0", StringComparison.Ordinal)) - return"Windows Vista"; + return "Windows Vista"; if(version.StartsWith("6.1", StringComparison.Ordinal)) - return"Windows 7"; + return "Windows 7"; if(version.StartsWith("6.2", StringComparison.Ordinal)) - return"Windows 8"; + return "Windows 8"; if(version.StartsWith("6.3", StringComparison.Ordinal)) - return"Windows 8.1"; + return "Windows 8.1"; if(version.StartsWith("10.0", StringComparison.Ordinal)) - return"Windows 10"; + return "Windows 10"; - return"Windows NT/2000/XP/Vista/7/10"; - case PlatformID.Win32S: return"Windows 3.x with win32s"; + return "Windows NT/2000/XP/Vista/7/10"; + case PlatformID.Win32S: return "Windows 3.x with win32s"; case PlatformID.Win32Windows: if(string.IsNullOrEmpty(version)) - return"Windows 9x/Me"; + return "Windows 9x/Me"; if(version.StartsWith("4.0", StringComparison.Ordinal)) - return"Windows 95"; + return "Windows 95"; if(version.StartsWith("4.10.2222", StringComparison.Ordinal)) - return"Windows 98 SE"; + return "Windows 98 SE"; if(version.StartsWith("4.1", StringComparison.Ordinal)) - return"Windows 98"; + return "Windows 98"; if(version.StartsWith("4.9", StringComparison.Ordinal)) - return"Windows Me"; + return "Windows Me"; - return"Windows 9x/Me"; - case PlatformID.WinCE: return"Windows CE/Mobile"; - case PlatformID.WindowsPhone: return"Windows Phone"; - case PlatformID.Xbox: return"Xbox OS"; - case PlatformID.zOS: return"z/OS"; + return "Windows 9x/Me"; + case PlatformID.WinCE: return "Windows CE/Mobile"; + case PlatformID.WindowsPhone: return "Windows Phone"; + case PlatformID.Xbox: return "Xbox OS"; + case PlatformID.zOS: return "z/OS"; default: return id.ToString(); } } diff --git a/Interop/PlatformID.cs b/Interop/PlatformID.cs index ede5d1c..d51b684 100644 --- a/Interop/PlatformID.cs +++ b/Interop/PlatformID.cs @@ -42,41 +42,76 @@ namespace Aaru.CommonTypes.Interop public enum PlatformID { /// Win32s - Win32S = 0, /// Win32 (Windows 9x) - Win32Windows = 1, /// Windows NT - Win32NT = 2, /// Windows Mobile - WinCE = 3, /// UNIX (do not use, too generic) - Unix = 4, /// Xbox 360 - Xbox = 5, /// OS X - MacOSX = 6, /// iOS is not OS X - iOS = 7, /// Linux - Linux = 8, /// Sun Solaris - Solaris = 9, /// NetBSD - NetBSD = 10, /// OpenBSD - OpenBSD = 11, /// FreeBSD - FreeBSD = 12, /// DragonFly BSD - DragonFly = 13, /// Nintendo Wii - Wii = 14, /// Nintendo Wii U - WiiU = 15, /// Sony PlayStation 3 - PlayStation3 = 16, /// Sony Playstation 4 - PlayStation4 = 17, /// Google Android - Android = 18, /// Samsung Tizen - Tizen = 19, /// Windows Phone - WindowsPhone = 20, /// GNU/Hurd - Hurd = 21, /// Haiku - Haiku = 22, /// HP-UX - HPUX = 23, /// AIX - AIX = 24, /// OS/400 - OS400 = 25, /// IRIX - IRIX = 26, /// Minix - Minix = 27, /// NonStop - NonStop = 28, /// QNX - QNX = 29, /// SINIX - SINIX = 30, /// Tru64 UNIX - Tru64 = 31, /// Ultrix - Ultrix = 32, /// SCO OpenServer / SCO UNIX - OpenServer = 33, /// SCO UnixWare - UnixWare = 34, /// IBM z/OS + Win32S = 0, + /// Win32 (Windows 9x) + Win32Windows = 1, + /// Windows NT + Win32NT = 2, + /// Windows Mobile + WinCE = 3, + /// UNIX (do not use, too generic) + Unix = 4, + /// Xbox 360 + Xbox = 5, + /// OS X + MacOSX = 6, + /// iOS is not OS X + iOS = 7, + /// Linux + Linux = 8, + /// Sun Solaris + Solaris = 9, + /// NetBSD + NetBSD = 10, + /// OpenBSD + OpenBSD = 11, + /// FreeBSD + FreeBSD = 12, + /// DragonFly BSD + DragonFly = 13, + /// Nintendo Wii + Wii = 14, + /// Nintendo Wii U + WiiU = 15, + /// Sony PlayStation 3 + PlayStation3 = 16, + /// Sony Playstation 4 + PlayStation4 = 17, + /// Google Android + Android = 18, + /// Samsung Tizen + Tizen = 19, + /// Windows Phone + WindowsPhone = 20, + /// GNU/Hurd + Hurd = 21, + /// Haiku + Haiku = 22, + /// HP-UX + HPUX = 23, + /// AIX + AIX = 24, + /// OS/400 + OS400 = 25, + /// IRIX + IRIX = 26, + /// Minix + Minix = 27, + /// NonStop + NonStop = 28, + /// QNX + QNX = 29, + /// SINIX + SINIX = 30, + /// Tru64 UNIX + Tru64 = 31, + /// Ultrix + Ultrix = 32, + /// SCO OpenServer / SCO UNIX + OpenServer = 33, + /// SCO UnixWare + UnixWare = 34, + /// IBM z/OS zOS = 35, Unknown = -1 } } \ No newline at end of file diff --git a/Interop/Version.cs b/Interop/Version.cs index 6caf6e7..cee18f5 100644 --- a/Interop/Version.cs +++ b/Interop/Version.cs @@ -75,7 +75,7 @@ namespace Aaru.CommonTypes.Interop GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static); if(monoDisplayName != null) - return(string)monoDisplayName.Invoke(null, null); + return (string)monoDisplayName.Invoke(null, null); return null; } diff --git a/Metadata/DeviceReportV2.cs b/Metadata/DeviceReportV2.cs index 21f4c60..5d934d1 100644 --- a/Metadata/DeviceReportV2.cs +++ b/Metadata/DeviceReportV2.cs @@ -58,7 +58,7 @@ namespace Aaru.CommonTypes.Metadata { public class DeviceReportV2 { - public DeviceReportV2() { } + public DeviceReportV2() {} public DeviceReportV2(DeviceReport reportV1) { @@ -161,7 +161,7 @@ namespace Aaru.CommonTypes.Metadata public class Usb { - public Usb() { } + public Usb() {} public Usb(usbType usb) { @@ -188,7 +188,7 @@ namespace Aaru.CommonTypes.Metadata public class FireWire { - public FireWire() { } + public FireWire() {} public FireWire(firewireType firewire) { @@ -215,7 +215,7 @@ namespace Aaru.CommonTypes.Metadata public class Ata { - public Ata() { } + public Ata() {} public Ata(ataType ata) { @@ -488,7 +488,7 @@ namespace Aaru.CommonTypes.Metadata public class Chs { - public Chs() { } + public Chs() {} public Chs(chsType chs) { @@ -506,7 +506,7 @@ namespace Aaru.CommonTypes.Metadata public class Scsi { - public Scsi() { } + public Scsi() {} public Scsi(scsiType scsi) { @@ -660,7 +660,7 @@ namespace Aaru.CommonTypes.Metadata public class ScsiMode { - public ScsiMode() { } + public ScsiMode() {} public ScsiMode(modeType mode) { @@ -714,7 +714,7 @@ namespace Aaru.CommonTypes.Metadata public class BlockDescriptor { - public BlockDescriptor() { } + public BlockDescriptor() {} public BlockDescriptor(blockDescriptorType descriptor) { @@ -737,7 +737,7 @@ namespace Aaru.CommonTypes.Metadata public class ScsiPage { - public ScsiPage() { } + public ScsiPage() {} public ScsiPage(pageType evpdPage) { @@ -761,7 +761,7 @@ namespace Aaru.CommonTypes.Metadata public class Mmc { - public Mmc() { } + public Mmc() {} public Mmc(mmcType mmc) { @@ -843,7 +843,7 @@ namespace Aaru.CommonTypes.Metadata public class MmcFeatures { - public MmcFeatures() { } + public MmcFeatures() {} public MmcFeatures(mmcFeaturesType features) { @@ -1256,7 +1256,7 @@ namespace Aaru.CommonTypes.Metadata { public Identify.IdentifyDevice? IdentifyDevice; - public TestedMedia() { } + public TestedMedia() {} public TestedMedia(testedMediaType mediaType, bool ata) { @@ -1852,7 +1852,7 @@ namespace Aaru.CommonTypes.Metadata public class Ssc { - public Ssc() { } + public Ssc() {} public Ssc(sscType ssc) { @@ -1901,7 +1901,7 @@ namespace Aaru.CommonTypes.Metadata public class TestedSequentialMedia { - public TestedSequentialMedia() { } + public TestedSequentialMedia() {} public TestedSequentialMedia(SequentialMedia media) { @@ -1963,7 +1963,7 @@ namespace Aaru.CommonTypes.Metadata { public string[] AdditionalInformation; - public Pcmcia() { } + public Pcmcia() {} public Pcmcia(pcmciaType pcmcia) { @@ -1996,7 +1996,7 @@ namespace Aaru.CommonTypes.Metadata public class MmcSd { - public MmcSd() { } + public MmcSd() {} public MmcSd(mmcsdType mmcSd) { @@ -2018,7 +2018,7 @@ namespace Aaru.CommonTypes.Metadata public class SscSupportedMedia { - public SscSupportedMedia() { } + public SscSupportedMedia() {} public SscSupportedMedia(SupportedMedia media) { diff --git a/Metadata/MediaType.cs b/Metadata/MediaType.cs index fbf02fb..0de6019 100644 --- a/Metadata/MediaType.cs +++ b/Metadata/MediaType.cs @@ -40,7 +40,7 @@ namespace Aaru.CommonTypes.Metadata { public static class MediaType { - public static(string type, string subType) MediaTypeToString(CommonTypes.MediaType dskType) + public static (string type, string subType) MediaTypeToString(CommonTypes.MediaType dskType) { string discType; string discSubType; @@ -2492,7 +2492,7 @@ namespace Aaru.CommonTypes.Metadata break; } - return(discType, discSubType); + return (discType, discSubType); } } } \ No newline at end of file diff --git a/Partition.cs b/Partition.cs index 349969f..dc6cf56 100644 --- a/Partition.cs +++ b/Partition.cs @@ -60,7 +60,7 @@ namespace Aaru.CommonTypes /// Information that does not find space in this struct public string Description; /// LBA of last partition sector - public ulong End => Start + Length - 1; + public ulong End => (Start + Length) - 1; /// Name of partition scheme that contains this partition public string Scheme; @@ -89,7 +89,7 @@ namespace Aaru.CommonTypes End > other.End) return 1; - return-1; + return -1; } // Define the equality operator. diff --git a/PluginBase.cs b/PluginBase.cs index ec709de..c5d4704 100644 --- a/PluginBase.cs +++ b/PluginBase.cs @@ -84,54 +84,54 @@ namespace Aaru.CommonTypes { foreach(Type type in pluginRegister.GetAllChecksumPlugins() ?? Enumerable.Empty()) if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - { }) is IChecksum plugin) + {}) is IChecksum plugin) Checksums.Add(plugin); foreach(Type type in pluginRegister.GetAllFilesystemPlugins() ?? Enumerable.Empty()) if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - { }) is IFilesystem plugin && + {}) is IFilesystem plugin && !PluginsList.ContainsKey(plugin.Name.ToLower())) PluginsList.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllFilterPlugins() ?? Enumerable.Empty()) if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - { }) is IFilter plugin && + {}) is IFilter plugin && !Filters.ContainsKey(plugin.Name.ToLower())) Filters.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllFloppyImagePlugins() ?? Enumerable.Empty()) if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - { }) is IFloppyImage plugin && + {}) is IFloppyImage plugin && !FloppyImages.ContainsKey(plugin.Name.ToLower())) FloppyImages.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllMediaImagePlugins() ?? Enumerable.Empty()) if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - { }) is IMediaImage plugin && + {}) is IMediaImage plugin && !ImagePluginsList.ContainsKey(plugin.Name.ToLower())) ImagePluginsList.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllPartitionPlugins() ?? Enumerable.Empty()) if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - { }) is IPartition plugin && + {}) is IPartition plugin && !PartPluginsList.ContainsKey(plugin.Name.ToLower())) PartPluginsList.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllReadOnlyFilesystemPlugins() ?? Enumerable.Empty()) if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - { }) is IReadOnlyFilesystem plugin && + {}) is IReadOnlyFilesystem plugin && !ReadOnlyFilesystems.ContainsKey(plugin.Name.ToLower())) ReadOnlyFilesystems.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllWritableFloppyImagePlugins() ?? Enumerable.Empty()) if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - { }) is IWritableFloppyImage plugin && + {}) is IWritableFloppyImage plugin && !WritableFloppyImages.ContainsKey(plugin.Name.ToLower())) WritableFloppyImages.Add(plugin.Name.ToLower(), plugin); foreach(Type type in pluginRegister.GetAllWritableImagePlugins() ?? Enumerable.Empty()) if(type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - { }) is IWritableImage plugin && + {}) is IWritableImage plugin && !WritableImages.ContainsKey(plugin.Name.ToLower())) WritableImages.Add(plugin.Name.ToLower(), plugin); } diff --git a/Structs/Devices/ATA/Identify.cs b/Structs/Devices/ATA/Identify.cs index e52497f..d35d0d7 100644 --- a/Structs/Devices/ATA/Identify.cs +++ b/Structs/Devices/ATA/Identify.cs @@ -917,7 +917,7 @@ namespace Aaru.CommonTypes.Structs.Devices.ATA if(IdentifyDeviceResponse.Length != 512) { AaruConsole.DebugWriteLine("ATA/ATAPI IDENTIFY decoder", - "IDENTIFY response is different than 512 bytes, not decoding."); + "IDENTIFY response is different than 512 bytes, not decoding."); return null; } diff --git a/Structs/Devices/SCSI/Inquiry.cs b/Structs/Devices/SCSI/Inquiry.cs index 26401b3..022ce9e 100644 --- a/Structs/Devices/SCSI/Inquiry.cs +++ b/Structs/Devices/SCSI/Inquiry.cs @@ -223,8 +223,8 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI SCSIInquiryResponse.Length != 5) { AaruConsole.DebugWriteLine("SCSI INQUIRY decoder", - "INQUIRY response is {0} bytes, less than minimum of 36 bytes, decoded data can be incorrect, not decoding.", - SCSIInquiryResponse.Length); + "INQUIRY response is {0} bytes, less than minimum of 36 bytes, decoded data can be incorrect, not decoding.", + SCSIInquiryResponse.Length); return null; } @@ -233,8 +233,8 @@ namespace Aaru.CommonTypes.Structs.Devices.SCSI SCSIInquiryResponse.Length != SCSIInquiryResponse[4]) { AaruConsole.DebugWriteLine("SCSI INQUIRY decoder", - "INQUIRY response length ({0} bytes) is different than specified in length field ({1} bytes), decoded data can be incorrect, not decoding.", - SCSIInquiryResponse.Length, SCSIInquiryResponse[4] + 4); + "INQUIRY response length ({0} bytes) is different than specified in length field ({1} bytes), decoded data can be incorrect, not decoding.", + SCSIInquiryResponse.Length, SCSIInquiryResponse[4] + 4); return null; } diff --git a/Structs/Filesystems.cs b/Structs/Filesystems.cs index 9db71f9..7d862af 100644 --- a/Structs/Filesystems.cs +++ b/Structs/Filesystems.cs @@ -47,63 +47,106 @@ namespace Aaru.CommonTypes.Structs public enum FileAttributes : ulong { /// File has no attributes - None = 0, /// File is an alias (Mac OS) - Alias = 0x01, /// Indicates that the file can only be writable appended - AppendOnly = 0x02, /// File is candidate for archival/backup - Archive = 0x04, /// File is a block device - BlockDevice = 0x08, /// File is stored on filesystem block units instead of device sectors - BlockUnits = 0x10, /// Directory is a bundle or file contains a BNDL resource - Bundle = 0x20, /// File is a char device - CharDevice = 0x40, /// File is compressed - Compressed = 0x80, /// File is compressed and should not be uncompressed on read - CompressedRaw = 0x100, /// File has compression errors - CompressionError = 0x200, /// Compressed file is dirty - CompressionDirty = 0x400, /// File is a device - Device = 0x800, /// File is a directory - Directory = 0x1000, /// File is encrypted - Encrypted = 0x2000, /// File is stored on disk using extents - Extents = 0x4000, /// File is a FIFO - FIFO = 0x8000, /// File is a normal file + None = 0, + /// File is an alias (Mac OS) + Alias = 0x01, + /// Indicates that the file can only be writable appended + AppendOnly = 0x02, + /// File is candidate for archival/backup + Archive = 0x04, + /// File is a block device + BlockDevice = 0x08, + /// File is stored on filesystem block units instead of device sectors + BlockUnits = 0x10, + /// Directory is a bundle or file contains a BNDL resource + Bundle = 0x20, + /// File is a char device + CharDevice = 0x40, + /// File is compressed + Compressed = 0x80, + /// File is compressed and should not be uncompressed on read + CompressedRaw = 0x100, + /// File has compression errors + CompressionError = 0x200, + /// Compressed file is dirty + CompressionDirty = 0x400, + /// File is a device + Device = 0x800, + /// File is a directory + Directory = 0x1000, + /// File is encrypted + Encrypted = 0x2000, + /// File is stored on disk using extents + Extents = 0x4000, + /// File is a FIFO + FIFO = 0x8000, + /// File is a normal file File = 0x10000, /// File is a Mac OS file containing desktop databases that has already been added to the desktop database - HasBeenInited = 0x20000, /// File contains an icon resource / EA + HasBeenInited = 0x20000, + /// File contains an icon resource / EA HasCustomIcon = 0x40000, /// File is a Mac OS extension or control panel lacking INIT resources - HasNoINITs = 0x80000, /// File is hidden/invisible - Hidden = 0x100000, /// File cannot be written, deleted, modified or linked to - Immutable = 0x200000, /// Directory is indexed using hashed trees - IndexedDirectory = 0x400000, /// File contents are stored alongside its inode (or equivalent) - Inline = 0x800000, /// File contains integrity checks - IntegrityStream = 0x1000000, /// File is on desktop + HasNoINITs = 0x80000, + /// File is hidden/invisible + Hidden = 0x100000, + /// File cannot be written, deleted, modified or linked to + Immutable = 0x200000, + /// Directory is indexed using hashed trees + IndexedDirectory = 0x400000, + /// File contents are stored alongside its inode (or equivalent) + Inline = 0x800000, + /// File contains integrity checks + IntegrityStream = 0x1000000, + /// File is on desktop IsOnDesk = 0x2000000, /// File changes are written to filesystem journal before being written to file itself - Journaled = 0x4000000, /// Access time will not be modified - NoAccessTime = 0x8000000, /// File will not be subject to copy-on-write - NoCopyOnWrite = 0x10000000, /// File will not be backed up - NoDump = 0x20000000, /// File contents should not be scrubbed - NoScrub = 0x40000000, /// File contents should not be indexed - NotIndexed = 0x80000000, /// File is offline - Offline = 0x100000000, /// File is password protected, but contents are not encrypted on disk - Password = 0x200000000, /// File is read-only - ReadOnly = 0x400000000, /// File is a reparse point + Journaled = 0x4000000, + /// Access time will not be modified + NoAccessTime = 0x8000000, + /// File will not be subject to copy-on-write + NoCopyOnWrite = 0x10000000, + /// File will not be backed up + NoDump = 0x20000000, + /// File contents should not be scrubbed + NoScrub = 0x40000000, + /// File contents should not be indexed + NotIndexed = 0x80000000, + /// File is offline + Offline = 0x100000000, + /// File is password protected, but contents are not encrypted on disk + Password = 0x200000000, + /// File is read-only + ReadOnly = 0x400000000, + /// File is a reparse point ReparsePoint = 0x800000000, /// When file is removed its content will be overwritten with zeroes - Secured = 0x1000000000, /// File contents are sparse - Sparse = 0x2000000000, /// File is a shadow (OS/2) - Shadow = 0x4000000000, /// File is shared - Shared = 0x8000000000, /// File is a stationery - Stationery = 0x10000000000, /// File is a symbolic link - Symlink = 0x20000000000, /// File writes are synchronously written to disk - Sync = 0x40000000000, /// File belongs to the operating system + Secured = 0x1000000000, + /// File contents are sparse + Sparse = 0x2000000000, + /// File is a shadow (OS/2) + Shadow = 0x4000000000, + /// File is shared + Shared = 0x8000000000, + /// File is a stationery + Stationery = 0x10000000000, + /// File is a symbolic link + Symlink = 0x20000000000, + /// File writes are synchronously written to disk + Sync = 0x40000000000, + /// File belongs to the operating system System = 0x80000000000, /// If file end is a partial block its content will be merged with other files - TailMerged = 0x100000000000, /// File is temporary + TailMerged = 0x100000000000, + /// File is temporary Temporary = 0x200000000000, /// Subdirectories inside of this directory are not related and should be allocated elsewhere TopDirectory = 0x400000000000, /// If file is deleted, contents should be stored, for a possible future undeletion - Undeletable = 0x800000000000, /// File is a pipe - Pipe = 0x1000000000000, /// File is a socket + Undeletable = 0x800000000000, + /// File is a pipe + Pipe = 0x1000000000000, + /// File is a socket Socket = 0x2000000000000 } @@ -223,36 +266,66 @@ namespace Aaru.CommonTypes.Structs public enum Errno { /// No error happened - NoError = 0, /// Access denied - AccessDenied = -13, /// Busy, cannot complete - Busy = -16, /// File is too large - FileTooLarge = -27, /// Invalid argument - InvalidArgument = -22, /// I/O error - InOutError = -5, /// Is a directory (e.g.: trying to Read() a dir) - IsDirectory = -21, /// Name is too long - NameTooLong = -36, /// There is no data available - NoData = 61, /// There is no such attribute - NoSuchExtendedAttribute = NoData, /// No such device - NoSuchDevice = -19, /// No such file or directory - NoSuchFile = -2, /// Is not a directory (e.g.: trying to ReadDir() a file) - NotDirectory = -20, /// Not implemented - NotImplemented = -38, /// Not supported - NotSupported = -252, /// Link is severed - SeveredLink = -67, /// Access denied - EACCES = AccessDenied, /// Busy, cannot complete - EBUSY = Busy, /// File is too large - EFBIG = FileTooLarge, /// Invalid argument - EINVAL = InvalidArgument, /// I/O error - EIO = InOutError, /// Is a directory (e.g.: trying to Read() a dir) - EISDIR = IsDirectory, /// Name is too long - ENAMETOOLONG = NameTooLong, /// There is no such attribute - ENOATTR = NoSuchExtendedAttribute, /// There is no data available - ENODATA = NoData, /// No such device - ENODEV = NoSuchDevice, /// No such file or directory - ENOENT = NoSuchFile, /// Link is severed - ENOLINK = SeveredLink, /// Not implemented - ENOSYS = NotImplemented, /// Is not a directory (e.g.: trying to ReadDir() a file) - ENOTDIR = NotDirectory, /// Not supported + NoError = 0, + /// Access denied + AccessDenied = -13, + /// Busy, cannot complete + Busy = -16, + /// File is too large + FileTooLarge = -27, + /// Invalid argument + InvalidArgument = -22, + /// I/O error + InOutError = -5, + /// Is a directory (e.g.: trying to Read() a dir) + IsDirectory = -21, + /// Name is too long + NameTooLong = -36, + /// There is no data available + NoData = 61, + /// There is no such attribute + NoSuchExtendedAttribute = NoData, + /// No such device + NoSuchDevice = -19, + /// No such file or directory + NoSuchFile = -2, + /// Is not a directory (e.g.: trying to ReadDir() a file) + NotDirectory = -20, + /// Not implemented + NotImplemented = -38, + /// Not supported + NotSupported = -252, + /// Link is severed + SeveredLink = -67, + /// Access denied + EACCES = AccessDenied, + /// Busy, cannot complete + EBUSY = Busy, + /// File is too large + EFBIG = FileTooLarge, + /// Invalid argument + EINVAL = InvalidArgument, + /// I/O error + EIO = InOutError, + /// Is a directory (e.g.: trying to Read() a dir) + EISDIR = IsDirectory, + /// Name is too long + ENAMETOOLONG = NameTooLong, + /// There is no such attribute + ENOATTR = NoSuchExtendedAttribute, + /// There is no data available + ENODATA = NoData, + /// No such device + ENODEV = NoSuchDevice, + /// No such file or directory + ENOENT = NoSuchFile, + /// Link is severed + ENOLINK = SeveredLink, + /// Not implemented + ENOSYS = NotImplemented, + /// Is not a directory (e.g.: trying to ReadDir() a file) + ENOTDIR = NotDirectory, + /// Not supported ENOTSUP = NotSupported } } \ No newline at end of file