diff --git a/Delegates.cs b/Delegates.cs index 454c7c95f..357142152 100644 --- a/Delegates.cs +++ b/Delegates.cs @@ -30,61 +30,60 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes -{ - /// Initializes a progress indicator (e.g. makes a progress bar visible) - public delegate void InitProgressHandler(); +namespace Aaru.CommonTypes; - /// Updates a progress indicator with text - public delegate void UpdateProgressHandler(string text, long current, long maximum); +/// Initializes a progress indicator (e.g. makes a progress bar visible) +public delegate void InitProgressHandler(); - /// Pulses a progress indicator with indeterminate boundaries - public delegate void PulseProgressHandler(string text); +/// Updates a progress indicator with text +public delegate void UpdateProgressHandler(string text, long current, long maximum); - /// Uninitializes a progress indicator (e.g. adds a newline to the console) - public delegate void EndProgressHandler(); +/// Pulses a progress indicator with indeterminate boundaries +public delegate void PulseProgressHandler(string text); - /// Initializes a secondary progress indicator (e.g. makes a progress bar visible) - public delegate void InitProgressHandler2(); +/// Uninitializes a progress indicator (e.g. adds a newline to the console) +public delegate void EndProgressHandler(); - /// Updates a secondary progress indicator with text - public delegate void UpdateProgressHandler2(string text, long current, long maximum); +/// Initializes a secondary progress indicator (e.g. makes a progress bar visible) +public delegate void InitProgressHandler2(); - /// Pulses a secondary progress indicator with indeterminate boundaries - public delegate void PulseProgressHandler2(string text); +/// Updates a secondary progress indicator with text +public delegate void UpdateProgressHandler2(string text, long current, long maximum); - /// Uninitializes a secondary progress indicator (e.g. adds a newline to the console) - public delegate void EndProgressHandler2(); +/// Pulses a secondary progress indicator with indeterminate boundaries +public delegate void PulseProgressHandler2(string text); - /// Initializes two progress indicators (e.g. makes a progress bar visible) - public delegate void InitTwoProgressHandler(); +/// Uninitializes a secondary progress indicator (e.g. adds a newline to the console) +public delegate void EndProgressHandler2(); - /// Updates two progress indicators with text - public delegate void UpdateTwoProgressHandler(string text, long current, long maximum, string text2, long current2, - long maximum2); +/// Initializes two progress indicators (e.g. makes a progress bar visible) +public delegate void InitTwoProgressHandler(); - /// Pulses a progress indicator with indeterminate boundaries - public delegate void PulseTwoProgressHandler(string text, string text2); +/// Updates two progress indicators with text +public delegate void UpdateTwoProgressHandler(string text, long current, long maximum, string text2, long current2, + long maximum2); - /// Uninitializes a progress indicator (e.g. adds a newline to the console) - public delegate void EndTwoProgressHandler(); +/// Pulses a progress indicator with indeterminate boundaries +public delegate void PulseTwoProgressHandler(string text, string text2); - /// Updates a status indicator - public delegate void UpdateStatusHandler(string text); +/// Uninitializes a progress indicator (e.g. adds a newline to the console) +public delegate void EndTwoProgressHandler(); - /// Shows an error message - public delegate void ErrorMessageHandler(string text); +/// Updates a status indicator +public delegate void UpdateStatusHandler(string text); - /// Initializes a block map that's going to be filled with a media scan - public delegate void InitBlockMapHandler(ulong blocks, ulong blockSize, ulong blocksToRead, ushort currentProfile); +/// Shows an error message +public delegate void ErrorMessageHandler(string text); - /// Updates lists of time taken on scanning from the specified sector - /// Time in milliseconds - public delegate void ScanTimeHandler(ulong sector, double duration); +/// Initializes a block map that's going to be filled with a media scan +public delegate void InitBlockMapHandler(ulong blocks, ulong blockSize, ulong blocksToRead, ushort currentProfile); - /// Specified a number of blocks could not be read on scan - public delegate void ScanUnreadableHandler(ulong sector); +/// Updates lists of time taken on scanning from the specified sector +/// Time in milliseconds +public delegate void ScanTimeHandler(ulong sector, double duration); - /// Sends the speed of scanning a specific sector - public delegate void ScanSpeedHandler(ulong sector, double currentSpeed); -} \ No newline at end of file +/// Specified a number of blocks could not be read on scan +public delegate void ScanUnreadableHandler(ulong sector); + +/// Sends the speed of scanning a specific sector +public delegate void ScanSpeedHandler(ulong sector, double currentSpeed); \ No newline at end of file diff --git a/Enums/DeviceType.cs b/Enums/DeviceType.cs index 7c7b32ff9..f4ae1c326 100644 --- a/Enums/DeviceType.cs +++ b/Enums/DeviceType.cs @@ -36,24 +36,23 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Enums +namespace Aaru.CommonTypes.Enums; + +/// Device types +public enum DeviceType { - /// Device types - public enum DeviceType - { - /// Unknown device type - Unknown = -1, - /// ATA device - ATA = 1, - /// ATA Packet device (aka SCSI over ATA) - ATAPI = 2, - /// SCSI device (or USB-MSC, SBP2, FC, UAS, etc) - SCSI = 3, - /// SecureDigital memory card - SecureDigital = 4, - /// MultiMediaCard memory card - MMC = 5, - /// NVMe device - NVMe = 6 - } + /// Unknown device type + Unknown = -1, + /// ATA device + ATA = 1, + /// ATA Packet device (aka SCSI over ATA) + ATAPI = 2, + /// SCSI device (or USB-MSC, SBP2, FC, UAS, etc) + SCSI = 3, + /// SecureDigital memory card + SecureDigital = 4, + /// MultiMediaCard memory card + MMC = 5, + /// NVMe device + NVMe = 6 } \ No newline at end of file diff --git a/Extents/ExtentsByte.cs b/Extents/ExtentsByte.cs index e74a81691..cb388b9d6 100644 --- a/Extents/ExtentsByte.cs +++ b/Extents/ExtentsByte.cs @@ -40,215 +40,214 @@ using System; using System.Collections.Generic; using System.Linq; -namespace Aaru.CommonTypes.Extents +namespace Aaru.CommonTypes.Extents; + +/// Implements extents for +public class ExtentsByte { - /// Implements extents for - public class ExtentsByte + List> _backend; + + /// Initialize an empty list of extents + public ExtentsByte() => _backend = new List>(); + + /// Initializes extents with an specific list + /// List of extents as tuples "start, end" + public ExtentsByte(IEnumerable> list) { - List> _backend; + _backend = new List>(); - /// Initialize an empty list of extents - public ExtentsByte() => _backend = new List>(); + // This ensure no overlapping extents are added on creation + foreach(Tuple t in list) + Add(t.Item1, t.Item2); + } - /// Initializes extents with an specific list - /// List of extents as tuples "start, end" - public ExtentsByte(IEnumerable> list) + /// Gets a count of how many extents are stored + public int Count => _backend.Count; + + /// Adds the specified number to the corresponding extent, or creates a new one + /// + public void Add(byte item) + { + Tuple removeOne = null; + Tuple removeTwo = null; + Tuple itemToAdd = null; + + for(int i = 0; i < _backend.Count; i++) { - _backend = new List>(); + // Already contained in an extent + if(item >= _backend[i].Item1 && + item <= _backend[i].Item2) + return; - // This ensure no overlapping extents are added on creation - foreach(Tuple t in list) - Add(t.Item1, t.Item2); - } - - /// Gets a count of how many extents are stored - public int Count => _backend.Count; - - /// Adds the specified number to the corresponding extent, or creates a new one - /// - public void Add(byte item) - { - Tuple removeOne = null; - Tuple removeTwo = null; - Tuple itemToAdd = null; - - for(int i = 0; i < _backend.Count; i++) + // Expands existing extent start + if(item == _backend[i].Item1 - 1) { - // Already contained in an extent - if(item >= _backend[i].Item1 && - item <= _backend[i].Item2) - return; - - // Expands existing extent start - if(item == _backend[i].Item1 - 1) - { - removeOne = _backend[i]; - - if(i > 0 && - item == _backend[i - 1].Item2 + 1) - { - removeTwo = _backend[i - 1]; - itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); - } - else - itemToAdd = new Tuple(item, _backend[i].Item2); - - break; - } - - // Expands existing extent end - if(item != _backend[i].Item2 + 1) - continue; - removeOne = _backend[i]; - if(i < _backend.Count - 1 && - item == _backend[i + 1].Item1 - 1) + if(i > 0 && + item == _backend[i - 1].Item2 + 1) { - removeTwo = _backend[i + 1]; - itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); + removeTwo = _backend[i - 1]; + itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); } else - itemToAdd = new Tuple(_backend[i].Item1, item); + itemToAdd = new Tuple(item, _backend[i].Item2); break; } - if(itemToAdd != null) + // Expands existing extent end + if(item != _backend[i].Item2 + 1) + continue; + + removeOne = _backend[i]; + + if(i < _backend.Count - 1 && + item == _backend[i + 1].Item1 - 1) { - _backend.Remove(removeOne); - _backend.Remove(removeTwo); - _backend.Add(itemToAdd); + removeTwo = _backend[i + 1]; + itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); } else - _backend.Add(new Tuple(item, item)); + itemToAdd = new Tuple(_backend[i].Item1, item); - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + break; } - /// Adds a new extent - /// First element of the extent - /// - /// Last element of the extent or if is true how many elements the extent runs - /// for - /// - /// If set to true, indicates how many elements the extent runs for - public void Add(byte start, byte end, bool run = false) + if(itemToAdd != null) { - byte realEnd; - - if(run) - realEnd = (byte)(start + end - 1); - else - realEnd = end; - - // TODO: Optimize this - for(byte t = start; t <= realEnd; t++) - Add(t); + _backend.Remove(removeOne); + _backend.Remove(removeTwo); + _backend.Add(itemToAdd); } + else + _backend.Add(new Tuple(item, item)); - /// Checks if the specified item is contained by an extent on this instance - /// Item to search for - /// true if any of the extents on this instance contains the item - public bool Contains(byte item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + } - /// Removes all extents from this instance - public void Clear() => _backend.Clear(); + /// Adds a new extent + /// First element of the extent + /// + /// Last element of the extent or if is true how many elements the extent runs + /// for + /// + /// If set to true, indicates how many elements the extent runs for + public void Add(byte start, byte end, bool run = false) + { + byte realEnd; - /// Removes an item from the extents in this instance - /// Item to remove - /// true if the item was contained in a known extent and removed, false otherwise - public bool Remove(byte item) + if(run) + realEnd = (byte)(start + end - 1); + else + realEnd = end; + + // TODO: Optimize this + for(byte t = start; t <= realEnd; t++) + Add(t); + } + + /// Checks if the specified item is contained by an extent on this instance + /// Item to search for + /// true if any of the extents on this instance contains the item + public bool Contains(byte item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + + /// Removes all extents from this instance + public void Clear() => _backend.Clear(); + + /// Removes an item from the extents in this instance + /// Item to remove + /// true if the item was contained in a known extent and removed, false otherwise + public bool Remove(byte item) + { + Tuple toRemove = null; + Tuple toAddOne = null; + Tuple toAddTwo = null; + + foreach(Tuple extent in _backend) { - Tuple toRemove = null; - Tuple toAddOne = null; - Tuple toAddTwo = null; - - foreach(Tuple extent in _backend) + // Extent is contained and not a border + if(item > extent.Item1 && + item < extent.Item2) { - // Extent is contained and not a border - if(item > extent.Item1 && - item < extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, (byte)(item - 1)); - toAddTwo = new Tuple((byte)(item + 1), extent.Item2); - - break; - } - - // Extent is left border, but not only element - if(item == extent.Item1 && - item != extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple((byte)(item + 1), extent.Item2); - - break; - } - - // Extent is right border, but not only element - if(item != extent.Item1 && - item == extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, (byte)(item - 1)); - - break; - } - - // Extent is only element - if(item != extent.Item1 || - item != extent.Item2) - continue; - toRemove = extent; + toAddOne = new Tuple(extent.Item1, (byte)(item - 1)); + toAddTwo = new Tuple((byte)(item + 1), extent.Item2); break; } - // Item not found - if(toRemove == null) - return false; + // Extent is left border, but not only element + if(item == extent.Item1 && + item != extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple((byte)(item + 1), extent.Item2); - _backend.Remove(toRemove); + break; + } - if(toAddOne != null) - _backend.Add(toAddOne); + // Extent is right border, but not only element + if(item != extent.Item1 && + item == extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple(extent.Item1, (byte)(item - 1)); - if(toAddTwo != null) - _backend.Add(toAddTwo); + break; + } - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + // Extent is only element + if(item != extent.Item1 || + item != extent.Item2) + continue; + + toRemove = extent; + + break; + } + + // Item not found + if(toRemove == null) + return false; + + _backend.Remove(toRemove); + + if(toAddOne != null) + _backend.Add(toAddOne); + + if(toAddTwo != null) + _backend.Add(toAddTwo); + + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + + return true; + } + + /// + /// Converts the list of extents to an array of where T1 is first element of the extent and + /// T2 is last element + /// + /// Array of + public Tuple[] ToArray() => _backend.ToArray(); + + /// Gets the first element of the extent that contains the specified item + /// Item + /// First element of extent + /// true if item was found in an extent, false otherwise + public bool GetStart(byte item, out byte start) + { + start = 0; + + foreach(Tuple extent in _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) + { + start = extent.Item1; return true; } - /// - /// Converts the list of extents to an array of where T1 is first element of the extent and - /// T2 is last element - /// - /// Array of - public Tuple[] ToArray() => _backend.ToArray(); - - /// Gets the first element of the extent that contains the specified item - /// Item - /// First element of extent - /// true if item was found in an extent, false otherwise - public bool GetStart(byte item, out byte start) - { - start = 0; - - foreach(Tuple extent in _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) - { - start = extent.Item1; - - return true; - } - - return false; - } + return false; } } \ No newline at end of file diff --git a/Extents/ExtentsConverter.cs b/Extents/ExtentsConverter.cs index dde75e6c7..f3a3ad7aa 100644 --- a/Extents/ExtentsConverter.cs +++ b/Extents/ExtentsConverter.cs @@ -41,44 +41,43 @@ using System.Collections.Generic; using System.Linq; using Schemas; -namespace Aaru.CommonTypes.Extents +namespace Aaru.CommonTypes.Extents; + +/// Converts extents +public static class ExtentsConverter { - /// Converts extents - public static class ExtentsConverter + /// Converts unsigned long integer extents into XML based extents + /// Extents + /// XML based extents + public static ExtentType[] ToMetadata(ExtentsULong extents) { - /// Converts unsigned long integer extents into XML based extents - /// Extents - /// XML based extents - public static ExtentType[] ToMetadata(ExtentsULong extents) - { - if(extents == null) - return null; + if(extents == null) + return null; - Tuple[] tuples = extents.ToArray(); - ExtentType[] array = new ExtentType[tuples.Length]; + Tuple[] tuples = extents.ToArray(); + ExtentType[] array = new ExtentType[tuples.Length]; - for(ulong i = 0; i < (ulong)array.LongLength; i++) - array[i] = new ExtentType - { - Start = tuples[i].Item1, - End = tuples[i].Item2 - }; + for(ulong i = 0; i < (ulong)array.LongLength; i++) + array[i] = new ExtentType + { + Start = tuples[i].Item1, + End = tuples[i].Item2 + }; - return array; - } + return array; + } - /// Converts XML based extents into unsigned long integer extents - /// XML based extents - /// Extents - public static ExtentsULong FromMetadata(ExtentType[] extents) - { - if(extents == null) - return null; + /// Converts XML based extents into unsigned long integer extents + /// XML based extents + /// Extents + public static ExtentsULong FromMetadata(ExtentType[] extents) + { + if(extents == null) + return null; - List> 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); - } + return new ExtentsULong(tuples); } } \ No newline at end of file diff --git a/Extents/ExtentsInt.cs b/Extents/ExtentsInt.cs index c98382d9e..0b5ed01c8 100644 --- a/Extents/ExtentsInt.cs +++ b/Extents/ExtentsInt.cs @@ -40,215 +40,214 @@ using System; using System.Collections.Generic; using System.Linq; -namespace Aaru.CommonTypes.Extents +namespace Aaru.CommonTypes.Extents; + +/// Implements extents for +public class ExtentsInt { - /// Implements extents for - public class ExtentsInt + List> _backend; + + /// Initialize an empty list of extents + public ExtentsInt() => _backend = new List>(); + + /// Initializes extents with an specific list + /// List of extents as tuples "start, end" + public ExtentsInt(IEnumerable> list) { - List> _backend; + _backend = new List>(); - /// Initialize an empty list of extents - public ExtentsInt() => _backend = new List>(); + // This ensure no overlapping extents are added on creation + foreach(Tuple t in list) + Add(t.Item1, t.Item2); + } - /// Initializes extents with an specific list - /// List of extents as tuples "start, end" - public ExtentsInt(IEnumerable> list) + /// Gets a count of how many extents are stored + public int Count => _backend.Count; + + /// Adds the specified number to the corresponding extent, or creates a new one + /// + public void Add(int item) + { + Tuple removeOne = null; + Tuple removeTwo = null; + Tuple itemToAdd = null; + + for(int i = 0; i < _backend.Count; i++) { - _backend = new List>(); + // Already contained in an extent + if(item >= _backend[i].Item1 && + item <= _backend[i].Item2) + return; - // This ensure no overlapping extents are added on creation - foreach(Tuple t in list) - Add(t.Item1, t.Item2); - } - - /// Gets a count of how many extents are stored - public int Count => _backend.Count; - - /// Adds the specified number to the corresponding extent, or creates a new one - /// - public void Add(int item) - { - Tuple removeOne = null; - Tuple removeTwo = null; - Tuple itemToAdd = null; - - for(int i = 0; i < _backend.Count; i++) + // Expands existing extent start + if(item == _backend[i].Item1 - 1) { - // Already contained in an extent - if(item >= _backend[i].Item1 && - item <= _backend[i].Item2) - return; - - // Expands existing extent start - if(item == _backend[i].Item1 - 1) - { - removeOne = _backend[i]; - - if(i > 0 && - item == _backend[i - 1].Item2 + 1) - { - removeTwo = _backend[i - 1]; - itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); - } - else - itemToAdd = new Tuple(item, _backend[i].Item2); - - break; - } - - // Expands existing extent end - if(item != _backend[i].Item2 + 1) - continue; - removeOne = _backend[i]; - if(i < _backend.Count - 1 && - item == _backend[i + 1].Item1 - 1) + if(i > 0 && + item == _backend[i - 1].Item2 + 1) { - removeTwo = _backend[i + 1]; - itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); + removeTwo = _backend[i - 1]; + itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); } else - itemToAdd = new Tuple(_backend[i].Item1, item); + itemToAdd = new Tuple(item, _backend[i].Item2); break; } - if(itemToAdd != null) + // Expands existing extent end + if(item != _backend[i].Item2 + 1) + continue; + + removeOne = _backend[i]; + + if(i < _backend.Count - 1 && + item == _backend[i + 1].Item1 - 1) { - _backend.Remove(removeOne); - _backend.Remove(removeTwo); - _backend.Add(itemToAdd); + removeTwo = _backend[i + 1]; + itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); } else - _backend.Add(new Tuple(item, item)); + itemToAdd = new Tuple(_backend[i].Item1, item); - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + break; } - /// Adds a new extent - /// First element of the extent - /// - /// Last element of the extent or if is true how many elements the extent runs - /// for - /// - /// If set to true, indicates how many elements the extent runs for - public void Add(int start, int end, bool run = false) + if(itemToAdd != null) { - int realEnd; - - if(run) - realEnd = start + end - 1; - else - realEnd = end; - - // TODO: Optimize this - for(int t = start; t <= realEnd; t++) - Add(t); + _backend.Remove(removeOne); + _backend.Remove(removeTwo); + _backend.Add(itemToAdd); } + else + _backend.Add(new Tuple(item, item)); - /// Checks if the specified item is contained by an extent on this instance - /// Item to search for - /// true if any of the extents on this instance contains the item - public bool Contains(int item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + } - /// Removes all extents from this instance - public void Clear() => _backend.Clear(); + /// Adds a new extent + /// First element of the extent + /// + /// Last element of the extent or if is true how many elements the extent runs + /// for + /// + /// If set to true, indicates how many elements the extent runs for + public void Add(int start, int end, bool run = false) + { + int realEnd; - /// Removes an item from the extents in this instance - /// Item to remove - /// true if the item was contained in a known extent and removed, false otherwise - public bool Remove(int item) + if(run) + realEnd = start + end - 1; + else + realEnd = end; + + // TODO: Optimize this + for(int t = start; t <= realEnd; t++) + Add(t); + } + + /// Checks if the specified item is contained by an extent on this instance + /// Item to search for + /// true if any of the extents on this instance contains the item + public bool Contains(int item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + + /// Removes all extents from this instance + public void Clear() => _backend.Clear(); + + /// Removes an item from the extents in this instance + /// Item to remove + /// true if the item was contained in a known extent and removed, false otherwise + public bool Remove(int item) + { + Tuple toRemove = null; + Tuple toAddOne = null; + Tuple toAddTwo = null; + + foreach(Tuple extent in _backend) { - Tuple toRemove = null; - Tuple toAddOne = null; - Tuple toAddTwo = null; - - foreach(Tuple extent in _backend) + // Extent is contained and not a border + if(item > extent.Item1 && + item < extent.Item2) { - // Extent is contained and not a border - if(item > extent.Item1 && - item < extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, item - 1); - toAddTwo = new Tuple(item + 1, extent.Item2); - - break; - } - - // Extent is left border, but not only element - if(item == extent.Item1 && - item != extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(item + 1, extent.Item2); - - break; - } - - // Extent is right border, but not only element - if(item != extent.Item1 && - item == extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, item - 1); - - break; - } - - // Extent is only element - if(item != extent.Item1 || - item != extent.Item2) - continue; - toRemove = extent; + toAddOne = new Tuple(extent.Item1, item - 1); + toAddTwo = new Tuple(item + 1, extent.Item2); break; } - // Item not found - if(toRemove == null) - return false; + // Extent is left border, but not only element + if(item == extent.Item1 && + item != extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple(item + 1, extent.Item2); - _backend.Remove(toRemove); + break; + } - if(toAddOne != null) - _backend.Add(toAddOne); + // Extent is right border, but not only element + if(item != extent.Item1 && + item == extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple(extent.Item1, item - 1); - if(toAddTwo != null) - _backend.Add(toAddTwo); + break; + } - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + // Extent is only element + if(item != extent.Item1 || + item != extent.Item2) + continue; + + toRemove = extent; + + break; + } + + // Item not found + if(toRemove == null) + return false; + + _backend.Remove(toRemove); + + if(toAddOne != null) + _backend.Add(toAddOne); + + if(toAddTwo != null) + _backend.Add(toAddTwo); + + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + + return true; + } + + /// + /// Converts the list of extents to an array of where T1 is first element of the extent and + /// T2 is last element + /// + /// Array of + public Tuple[] ToArray() => _backend.ToArray(); + + /// Gets the first element of the extent that contains the specified item + /// Item + /// First element of extent + /// true if item was found in an extent, false otherwise + public bool GetStart(int item, out int start) + { + start = 0; + + foreach(Tuple extent in _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) + { + start = extent.Item1; return true; } - /// - /// Converts the list of extents to an array of where T1 is first element of the extent and - /// T2 is last element - /// - /// Array of - public Tuple[] ToArray() => _backend.ToArray(); - - /// Gets the first element of the extent that contains the specified item - /// Item - /// First element of extent - /// true if item was found in an extent, false otherwise - public bool GetStart(int item, out int start) - { - start = 0; - - foreach(Tuple extent in _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) - { - start = extent.Item1; - - return true; - } - - return false; - } + return false; } } \ No newline at end of file diff --git a/Extents/ExtentsLong.cs b/Extents/ExtentsLong.cs index ec64998ab..0b8be7298 100644 --- a/Extents/ExtentsLong.cs +++ b/Extents/ExtentsLong.cs @@ -40,215 +40,214 @@ using System; using System.Collections.Generic; using System.Linq; -namespace Aaru.CommonTypes.Extents +namespace Aaru.CommonTypes.Extents; + +/// Implements extents for +public class ExtentsLong { - /// Implements extents for - public class ExtentsLong + List> _backend; + + /// Initialize an empty list of extents + public ExtentsLong() => _backend = new List>(); + + /// Initializes extents with an specific list + /// List of extents as tuples "start, end" + public ExtentsLong(IEnumerable> list) { - List> _backend; + _backend = new List>(); - /// Initialize an empty list of extents - public ExtentsLong() => _backend = new List>(); + // This ensure no overlapping extents are added on creation + foreach(Tuple t in list) + Add(t.Item1, t.Item2); + } - /// Initializes extents with an specific list - /// List of extents as tuples "start, end" - public ExtentsLong(IEnumerable> list) + /// Gets a count of how many extents are stored + public int Count => _backend.Count; + + /// Adds the specified number to the corresponding extent, or creates a new one + /// + public void Add(long item) + { + Tuple removeOne = null; + Tuple removeTwo = null; + Tuple itemToAdd = null; + + for(int i = 0; i < _backend.Count; i++) { - _backend = new List>(); + // Already contained in an extent + if(item >= _backend[i].Item1 && + item <= _backend[i].Item2) + return; - // This ensure no overlapping extents are added on creation - foreach(Tuple t in list) - Add(t.Item1, t.Item2); - } - - /// Gets a count of how many extents are stored - public int Count => _backend.Count; - - /// Adds the specified number to the corresponding extent, or creates a new one - /// - public void Add(long item) - { - Tuple removeOne = null; - Tuple removeTwo = null; - Tuple itemToAdd = null; - - for(int i = 0; i < _backend.Count; i++) + // Expands existing extent start + if(item == _backend[i].Item1 - 1) { - // Already contained in an extent - if(item >= _backend[i].Item1 && - item <= _backend[i].Item2) - return; - - // Expands existing extent start - if(item == _backend[i].Item1 - 1) - { - removeOne = _backend[i]; - - if(i > 0 && - item == _backend[i - 1].Item2 + 1) - { - removeTwo = _backend[i - 1]; - itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); - } - else - itemToAdd = new Tuple(item, _backend[i].Item2); - - break; - } - - // Expands existing extent end - if(item != _backend[i].Item2 + 1) - continue; - removeOne = _backend[i]; - if(i < _backend.Count - 1 && - item == _backend[i + 1].Item1 - 1) + if(i > 0 && + item == _backend[i - 1].Item2 + 1) { - removeTwo = _backend[i + 1]; - itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); + removeTwo = _backend[i - 1]; + itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); } else - itemToAdd = new Tuple(_backend[i].Item1, item); + itemToAdd = new Tuple(item, _backend[i].Item2); break; } - if(itemToAdd != null) + // Expands existing extent end + if(item != _backend[i].Item2 + 1) + continue; + + removeOne = _backend[i]; + + if(i < _backend.Count - 1 && + item == _backend[i + 1].Item1 - 1) { - _backend.Remove(removeOne); - _backend.Remove(removeTwo); - _backend.Add(itemToAdd); + removeTwo = _backend[i + 1]; + itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); } else - _backend.Add(new Tuple(item, item)); + itemToAdd = new Tuple(_backend[i].Item1, item); - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + break; } - /// Adds a new extent - /// First element of the extent - /// - /// Last element of the extent or if is true how many elements the extent runs - /// for - /// - /// If set to true, indicates how many elements the extent runs for - public void Add(long start, long end, bool run = false) + if(itemToAdd != null) { - long realEnd; - - if(run) - realEnd = start + end - 1; - else - realEnd = end; - - // TODO: Optimize this - for(long t = start; t <= realEnd; t++) - Add(t); + _backend.Remove(removeOne); + _backend.Remove(removeTwo); + _backend.Add(itemToAdd); } + else + _backend.Add(new Tuple(item, item)); - /// Checks if the specified item is contained by an extent on this instance - /// Item to search for - /// true if any of the extents on this instance contains the item - public bool Contains(long item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + } - /// Removes all extents from this instance - public void Clear() => _backend.Clear(); + /// Adds a new extent + /// First element of the extent + /// + /// Last element of the extent or if is true how many elements the extent runs + /// for + /// + /// If set to true, indicates how many elements the extent runs for + public void Add(long start, long end, bool run = false) + { + long realEnd; - /// Removes an item from the extents in this instance - /// Item to remove - /// true if the item was contained in a known extent and removed, false otherwise - public bool Remove(long item) + if(run) + realEnd = start + end - 1; + else + realEnd = end; + + // TODO: Optimize this + for(long t = start; t <= realEnd; t++) + Add(t); + } + + /// Checks if the specified item is contained by an extent on this instance + /// Item to search for + /// true if any of the extents on this instance contains the item + public bool Contains(long item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + + /// Removes all extents from this instance + public void Clear() => _backend.Clear(); + + /// Removes an item from the extents in this instance + /// Item to remove + /// true if the item was contained in a known extent and removed, false otherwise + public bool Remove(long item) + { + Tuple toRemove = null; + Tuple toAddOne = null; + Tuple toAddTwo = null; + + foreach(Tuple extent in _backend) { - Tuple toRemove = null; - Tuple toAddOne = null; - Tuple toAddTwo = null; - - foreach(Tuple extent in _backend) + // Extent is contained and not a border + if(item > extent.Item1 && + item < extent.Item2) { - // Extent is contained and not a border - if(item > extent.Item1 && - item < extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, item - 1); - toAddTwo = new Tuple(item + 1, extent.Item2); - - break; - } - - // Extent is left border, but not only element - if(item == extent.Item1 && - item != extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(item + 1, extent.Item2); - - break; - } - - // Extent is right border, but not only element - if(item != extent.Item1 && - item == extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, item - 1); - - break; - } - - // Extent is only element - if(item != extent.Item1 || - item != extent.Item2) - continue; - toRemove = extent; + toAddOne = new Tuple(extent.Item1, item - 1); + toAddTwo = new Tuple(item + 1, extent.Item2); break; } - // Item not found - if(toRemove == null) - return false; + // Extent is left border, but not only element + if(item == extent.Item1 && + item != extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple(item + 1, extent.Item2); - _backend.Remove(toRemove); + break; + } - if(toAddOne != null) - _backend.Add(toAddOne); + // Extent is right border, but not only element + if(item != extent.Item1 && + item == extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple(extent.Item1, item - 1); - if(toAddTwo != null) - _backend.Add(toAddTwo); + break; + } - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + // Extent is only element + if(item != extent.Item1 || + item != extent.Item2) + continue; + + toRemove = extent; + + break; + } + + // Item not found + if(toRemove == null) + return false; + + _backend.Remove(toRemove); + + if(toAddOne != null) + _backend.Add(toAddOne); + + if(toAddTwo != null) + _backend.Add(toAddTwo); + + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + + return true; + } + + /// + /// Converts the list of extents to an array of where T1 is first element of the extent and + /// T2 is last element + /// + /// Array of + public Tuple[] ToArray() => _backend.ToArray(); + + /// Gets the first element of the extent that contains the specified item + /// Item + /// First element of extent + /// true if item was found in an extent, false otherwise + public bool GetStart(long item, out long start) + { + start = 0; + + foreach(Tuple extent in _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) + { + start = extent.Item1; return true; } - /// - /// Converts the list of extents to an array of where T1 is first element of the extent and - /// T2 is last element - /// - /// Array of - public Tuple[] ToArray() => _backend.ToArray(); - - /// Gets the first element of the extent that contains the specified item - /// Item - /// First element of extent - /// true if item was found in an extent, false otherwise - public bool GetStart(long item, out long start) - { - start = 0; - - foreach(Tuple extent in _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) - { - start = extent.Item1; - - return true; - } - - return false; - } + return false; } } \ No newline at end of file diff --git a/Extents/ExtentsSByte.cs b/Extents/ExtentsSByte.cs index dd9a4cb53..9bf246eff 100644 --- a/Extents/ExtentsSByte.cs +++ b/Extents/ExtentsSByte.cs @@ -40,216 +40,215 @@ using System; using System.Collections.Generic; using System.Linq; -namespace Aaru.CommonTypes.Extents +namespace Aaru.CommonTypes.Extents; + +/// Implements extents for +public class ExtentsSByte { - /// Implements extents for - public class ExtentsSByte + List> _backend; + + /// Initialize an empty list of extents + public ExtentsSByte() => _backend = new List>(); + + /// Initializes extents with an specific list + /// List of extents as tuples "start, end" + public ExtentsSByte(IEnumerable> list) { - List> _backend; + _backend = new List>(); - /// Initialize an empty list of extents - public ExtentsSByte() => _backend = new List>(); + // This ensure no overlapping extents are added on creation + foreach(Tuple t in list) + Add(t.Item1, t.Item2); + } - /// Initializes extents with an specific list - /// List of extents as tuples "start, end" - public ExtentsSByte(IEnumerable> list) + /// Gets a count of how many extents are stored + public int Count => _backend.Count; + + /// Adds the specified number to the corresponding extent, or creates a new one + /// + public void Add(sbyte item) + { + Tuple removeOne = null; + Tuple removeTwo = null; + Tuple itemToAdd = null; + + for(int i = 0; i < _backend.Count; i++) { - _backend = new List>(); + // Already contained in an extent + if(item >= _backend[i].Item1 && + item <= _backend[i].Item2) + return; - // This ensure no overlapping extents are added on creation - foreach(Tuple t in list) - Add(t.Item1, t.Item2); - } - - /// Gets a count of how many extents are stored - public int Count => _backend.Count; - - /// Adds the specified number to the corresponding extent, or creates a new one - /// - public void Add(sbyte item) - { - Tuple removeOne = null; - Tuple removeTwo = null; - Tuple itemToAdd = null; - - for(int i = 0; i < _backend.Count; i++) + // Expands existing extent start + if(item == _backend[i].Item1 - 1) { - // Already contained in an extent - if(item >= _backend[i].Item1 && - item <= _backend[i].Item2) - return; - - // Expands existing extent start - if(item == _backend[i].Item1 - 1) - { - removeOne = _backend[i]; - - if(i > 0 && - item == _backend[i - 1].Item2 + 1) - { - removeTwo = _backend[i - 1]; - itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); - } - else - itemToAdd = new Tuple(item, _backend[i].Item2); - - break; - } - - // Expands existing extent end - if(item != _backend[i].Item2 + 1) - continue; - removeOne = _backend[i]; - if(i < _backend.Count - 1 && - item == _backend[i + 1].Item1 - 1) + if(i > 0 && + item == _backend[i - 1].Item2 + 1) { - removeTwo = _backend[i + 1]; - itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); + removeTwo = _backend[i - 1]; + itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); } else - itemToAdd = new Tuple(_backend[i].Item1, item); + itemToAdd = new Tuple(item, _backend[i].Item2); break; } - if(itemToAdd != null) + // Expands existing extent end + if(item != _backend[i].Item2 + 1) + continue; + + removeOne = _backend[i]; + + if(i < _backend.Count - 1 && + item == _backend[i + 1].Item1 - 1) { - _backend.Remove(removeOne); - _backend.Remove(removeTwo); - _backend.Add(itemToAdd); + removeTwo = _backend[i + 1]; + itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); } else - _backend.Add(new Tuple(item, item)); + itemToAdd = new Tuple(_backend[i].Item1, item); - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + break; } - /// Adds a new extent - /// First element of the extent - /// - /// Last element of the extent or if is true how many elements the extent runs - /// for - /// - /// If set to true, indicates how many elements the extent runs for - public void Add(sbyte start, sbyte end, bool run = false) + if(itemToAdd != null) { - sbyte realEnd; - - if(run) - realEnd = (sbyte)(start + end - 1); - else - realEnd = end; - - // TODO: Optimize this - for(sbyte t = start; t <= realEnd; t++) - Add(t); + _backend.Remove(removeOne); + _backend.Remove(removeTwo); + _backend.Add(itemToAdd); } + else + _backend.Add(new Tuple(item, item)); - /// Checks if the specified item is contained by an extent on this instance - /// Item to search for - /// true if any of the extents on this instance contains the item - public bool Contains(sbyte item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + } - /// Removes all extents from this instance - public void Clear() => _backend.Clear(); + /// Adds a new extent + /// First element of the extent + /// + /// Last element of the extent or if is true how many elements the extent runs + /// for + /// + /// If set to true, indicates how many elements the extent runs for + public void Add(sbyte start, sbyte end, bool run = false) + { + sbyte realEnd; - /// Removes an item from the extents in this instance - /// Item to remove - /// true if the item was contained in a known extent and removed, false otherwise - public bool Remove(sbyte item) + if(run) + realEnd = (sbyte)(start + end - 1); + else + realEnd = end; + + // TODO: Optimize this + for(sbyte t = start; t <= realEnd; t++) + Add(t); + } + + /// Checks if the specified item is contained by an extent on this instance + /// Item to search for + /// true if any of the extents on this instance contains the item + public bool Contains(sbyte item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + + /// Removes all extents from this instance + public void Clear() => _backend.Clear(); + + /// Removes an item from the extents in this instance + /// Item to remove + /// true if the item was contained in a known extent and removed, false otherwise + public bool Remove(sbyte item) + { + Tuple toRemove = null; + Tuple toAddOne = null; + Tuple toAddTwo = null; + + foreach(Tuple extent in _backend) { - Tuple toRemove = null; - Tuple toAddOne = null; - Tuple toAddTwo = null; - - foreach(Tuple extent in _backend) + // Extent is contained and not a border + if(item > extent.Item1 && + item < extent.Item2) { - // Extent is contained and not a border - if(item > extent.Item1 && - item < extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, (sbyte)(item - 1)); - toAddTwo = new Tuple((sbyte)(item + 1), extent.Item2); - - break; - } - - // Extent is left border, but not only element - if(item == extent.Item1 && - item != extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple((sbyte)(item + 1), extent.Item2); - - break; - } - - // Extent is right border, but not only element - if(item != extent.Item1 && - item == extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, (sbyte)(item - 1)); - - break; - } - - // Extent is only element - if(item != extent.Item1 || - item != extent.Item2) - continue; - toRemove = extent; + toAddOne = new Tuple(extent.Item1, (sbyte)(item - 1)); + toAddTwo = new Tuple((sbyte)(item + 1), extent.Item2); break; } - // Item not found - if(toRemove == null) - return false; + // Extent is left border, but not only element + if(item == extent.Item1 && + item != extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple((sbyte)(item + 1), extent.Item2); - _backend.Remove(toRemove); + break; + } - if(toAddOne != null) - _backend.Add(toAddOne); + // Extent is right border, but not only element + if(item != extent.Item1 && + item == extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple(extent.Item1, (sbyte)(item - 1)); - if(toAddTwo != null) - _backend.Add(toAddTwo); + break; + } - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + // Extent is only element + if(item != extent.Item1 || + item != extent.Item2) + continue; + + toRemove = extent; + + break; + } + + // Item not found + if(toRemove == null) + return false; + + _backend.Remove(toRemove); + + if(toAddOne != null) + _backend.Add(toAddOne); + + if(toAddTwo != null) + _backend.Add(toAddTwo); + + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + + return true; + } + + /// + /// Converts the list of extents to an array of where T1 is first element of the extent and + /// T2 is last element + /// + /// Array of + public Tuple[] ToArray() => _backend.ToArray(); + + /// Gets the first element of the extent that contains the specified item + /// Item + /// First element of extent + /// true if item was found in an extent, false otherwise + public bool GetStart(sbyte item, out sbyte start) + { + start = 0; + + foreach(Tuple extent in + _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) + { + start = extent.Item1; return true; } - /// - /// Converts the list of extents to an array of where T1 is first element of the extent and - /// T2 is last element - /// - /// Array of - public Tuple[] ToArray() => _backend.ToArray(); - - /// Gets the first element of the extent that contains the specified item - /// Item - /// First element of extent - /// true if item was found in an extent, false otherwise - public bool GetStart(sbyte item, out sbyte start) - { - start = 0; - - foreach(Tuple extent in - _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) - { - start = extent.Item1; - - return true; - } - - return false; - } + return false; } } \ No newline at end of file diff --git a/Extents/ExtentsShort.cs b/Extents/ExtentsShort.cs index acbd5d62f..086d7e47c 100644 --- a/Extents/ExtentsShort.cs +++ b/Extents/ExtentsShort.cs @@ -40,216 +40,215 @@ using System; using System.Collections.Generic; using System.Linq; -namespace Aaru.CommonTypes.Extents +namespace Aaru.CommonTypes.Extents; + +/// Implements extents for +public class ExtentsShort { - /// Implements extents for - public class ExtentsShort + List> _backend; + + /// Initialize an empty list of extents + public ExtentsShort() => _backend = new List>(); + + /// Initializes extents with an specific list + /// List of extents as tuples "start, end" + public ExtentsShort(IEnumerable> list) { - List> _backend; + _backend = new List>(); - /// Initialize an empty list of extents - public ExtentsShort() => _backend = new List>(); + // This ensure no overlapping extents are added on creation + foreach(Tuple t in list) + Add(t.Item1, t.Item2); + } - /// Initializes extents with an specific list - /// List of extents as tuples "start, end" - public ExtentsShort(IEnumerable> list) + /// Gets a count of how many extents are stored + public int Count => _backend.Count; + + /// Adds the specified number to the corresponding extent, or creates a new one + /// + public void Add(short item) + { + Tuple removeOne = null; + Tuple removeTwo = null; + Tuple itemToAdd = null; + + for(int i = 0; i < _backend.Count; i++) { - _backend = new List>(); + // Already contained in an extent + if(item >= _backend[i].Item1 && + item <= _backend[i].Item2) + return; - // This ensure no overlapping extents are added on creation - foreach(Tuple t in list) - Add(t.Item1, t.Item2); - } - - /// Gets a count of how many extents are stored - public int Count => _backend.Count; - - /// Adds the specified number to the corresponding extent, or creates a new one - /// - public void Add(short item) - { - Tuple removeOne = null; - Tuple removeTwo = null; - Tuple itemToAdd = null; - - for(int i = 0; i < _backend.Count; i++) + // Expands existing extent start + if(item == _backend[i].Item1 - 1) { - // Already contained in an extent - if(item >= _backend[i].Item1 && - item <= _backend[i].Item2) - return; - - // Expands existing extent start - if(item == _backend[i].Item1 - 1) - { - removeOne = _backend[i]; - - if(i > 0 && - item == _backend[i - 1].Item2 + 1) - { - removeTwo = _backend[i - 1]; - itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); - } - else - itemToAdd = new Tuple(item, _backend[i].Item2); - - break; - } - - // Expands existing extent end - if(item != _backend[i].Item2 + 1) - continue; - removeOne = _backend[i]; - if(i < _backend.Count - 1 && - item == _backend[i + 1].Item1 - 1) + if(i > 0 && + item == _backend[i - 1].Item2 + 1) { - removeTwo = _backend[i + 1]; - itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); + removeTwo = _backend[i - 1]; + itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); } else - itemToAdd = new Tuple(_backend[i].Item1, item); + itemToAdd = new Tuple(item, _backend[i].Item2); break; } - if(itemToAdd != null) + // Expands existing extent end + if(item != _backend[i].Item2 + 1) + continue; + + removeOne = _backend[i]; + + if(i < _backend.Count - 1 && + item == _backend[i + 1].Item1 - 1) { - _backend.Remove(removeOne); - _backend.Remove(removeTwo); - _backend.Add(itemToAdd); + removeTwo = _backend[i + 1]; + itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); } else - _backend.Add(new Tuple(item, item)); + itemToAdd = new Tuple(_backend[i].Item1, item); - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + break; } - /// Adds a new extent - /// First element of the extent - /// - /// Last element of the extent or if is true how many elements the extent runs - /// for - /// - /// If set to true, indicates how many elements the extent runs for - public void Add(short start, short end, bool run = false) + if(itemToAdd != null) { - short realEnd; - - if(run) - realEnd = (short)(start + end - 1); - else - realEnd = end; - - // TODO: Optimize this - for(short t = start; t <= realEnd; t++) - Add(t); + _backend.Remove(removeOne); + _backend.Remove(removeTwo); + _backend.Add(itemToAdd); } + else + _backend.Add(new Tuple(item, item)); - /// Checks if the specified item is contained by an extent on this instance - /// Item to search for - /// true if any of the extents on this instance contains the item - public bool Contains(short item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + } - /// Removes all extents from this instance - public void Clear() => _backend.Clear(); + /// Adds a new extent + /// First element of the extent + /// + /// Last element of the extent or if is true how many elements the extent runs + /// for + /// + /// If set to true, indicates how many elements the extent runs for + public void Add(short start, short end, bool run = false) + { + short realEnd; - /// Removes an item from the extents in this instance - /// Item to remove - /// true if the item was contained in a known extent and removed, false otherwise - public bool Remove(short item) + if(run) + realEnd = (short)(start + end - 1); + else + realEnd = end; + + // TODO: Optimize this + for(short t = start; t <= realEnd; t++) + Add(t); + } + + /// Checks if the specified item is contained by an extent on this instance + /// Item to search for + /// true if any of the extents on this instance contains the item + public bool Contains(short item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + + /// Removes all extents from this instance + public void Clear() => _backend.Clear(); + + /// Removes an item from the extents in this instance + /// Item to remove + /// true if the item was contained in a known extent and removed, false otherwise + public bool Remove(short item) + { + Tuple toRemove = null; + Tuple toAddOne = null; + Tuple toAddTwo = null; + + foreach(Tuple extent in _backend) { - Tuple toRemove = null; - Tuple toAddOne = null; - Tuple toAddTwo = null; - - foreach(Tuple extent in _backend) + // Extent is contained and not a border + if(item > extent.Item1 && + item < extent.Item2) { - // Extent is contained and not a border - if(item > extent.Item1 && - item < extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, (short)(item - 1)); - toAddTwo = new Tuple((short)(item + 1), extent.Item2); - - break; - } - - // Extent is left border, but not only element - if(item == extent.Item1 && - item != extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple((short)(item + 1), extent.Item2); - - break; - } - - // Extent is right border, but not only element - if(item != extent.Item1 && - item == extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, (short)(item - 1)); - - break; - } - - // Extent is only element - if(item != extent.Item1 || - item != extent.Item2) - continue; - toRemove = extent; + toAddOne = new Tuple(extent.Item1, (short)(item - 1)); + toAddTwo = new Tuple((short)(item + 1), extent.Item2); break; } - // Item not found - if(toRemove == null) - return false; + // Extent is left border, but not only element + if(item == extent.Item1 && + item != extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple((short)(item + 1), extent.Item2); - _backend.Remove(toRemove); + break; + } - if(toAddOne != null) - _backend.Add(toAddOne); + // Extent is right border, but not only element + if(item != extent.Item1 && + item == extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple(extent.Item1, (short)(item - 1)); - if(toAddTwo != null) - _backend.Add(toAddTwo); + break; + } - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + // Extent is only element + if(item != extent.Item1 || + item != extent.Item2) + continue; + + toRemove = extent; + + break; + } + + // Item not found + if(toRemove == null) + return false; + + _backend.Remove(toRemove); + + if(toAddOne != null) + _backend.Add(toAddOne); + + if(toAddTwo != null) + _backend.Add(toAddTwo); + + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + + return true; + } + + /// + /// Converts the list of extents to an array of where T1 is first element of the extent and + /// T2 is last element + /// + /// Array of + public Tuple[] ToArray() => _backend.ToArray(); + + /// Gets the first element of the extent that contains the specified item + /// Item + /// First element of extent + /// true if item was found in an extent, false otherwise + public bool GetStart(short item, out short start) + { + start = 0; + + foreach(Tuple extent in + _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) + { + start = extent.Item1; return true; } - /// - /// Converts the list of extents to an array of where T1 is first element of the extent and - /// T2 is last element - /// - /// Array of - public Tuple[] ToArray() => _backend.ToArray(); - - /// Gets the first element of the extent that contains the specified item - /// Item - /// First element of extent - /// true if item was found in an extent, false otherwise - public bool GetStart(short item, out short start) - { - start = 0; - - foreach(Tuple extent in - _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) - { - start = extent.Item1; - - return true; - } - - return false; - } + return false; } } \ No newline at end of file diff --git a/Extents/ExtentsUInt.cs b/Extents/ExtentsUInt.cs index 4b72dfb17..0f8c80005 100644 --- a/Extents/ExtentsUInt.cs +++ b/Extents/ExtentsUInt.cs @@ -40,215 +40,214 @@ using System; using System.Collections.Generic; using System.Linq; -namespace Aaru.CommonTypes.Extents +namespace Aaru.CommonTypes.Extents; + +/// Implements extents for +public class ExtentsUInt { - /// Implements extents for - public class ExtentsUInt + List> _backend; + + /// Initialize an empty list of extents + public ExtentsUInt() => _backend = new List>(); + + /// Initializes extents with an specific list + /// List of extents as tuples "start, end" + public ExtentsUInt(IEnumerable> list) { - List> _backend; + _backend = new List>(); - /// Initialize an empty list of extents - public ExtentsUInt() => _backend = new List>(); + // This ensure no overlapping extents are added on creation + foreach(Tuple t in list) + Add(t.Item1, t.Item2); + } - /// Initializes extents with an specific list - /// List of extents as tuples "start, end" - public ExtentsUInt(IEnumerable> list) + /// Gets a count of how many extents are stored + public int Count => _backend.Count; + + /// Adds the specified number to the corresponding extent, or creates a new one + /// + public void Add(uint item) + { + Tuple removeOne = null; + Tuple removeTwo = null; + Tuple itemToAdd = null; + + for(int i = 0; i < _backend.Count; i++) { - _backend = new List>(); + // Already contained in an extent + if(item >= _backend[i].Item1 && + item <= _backend[i].Item2) + return; - // This ensure no overlapping extents are added on creation - foreach(Tuple t in list) - Add(t.Item1, t.Item2); - } - - /// Gets a count of how many extents are stored - public int Count => _backend.Count; - - /// Adds the specified number to the corresponding extent, or creates a new one - /// - public void Add(uint item) - { - Tuple removeOne = null; - Tuple removeTwo = null; - Tuple itemToAdd = null; - - for(int i = 0; i < _backend.Count; i++) + // Expands existing extent start + if(item == _backend[i].Item1 - 1) { - // Already contained in an extent - if(item >= _backend[i].Item1 && - item <= _backend[i].Item2) - return; - - // Expands existing extent start - if(item == _backend[i].Item1 - 1) - { - removeOne = _backend[i]; - - if(i > 0 && - item == _backend[i - 1].Item2 + 1) - { - removeTwo = _backend[i - 1]; - itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); - } - else - itemToAdd = new Tuple(item, _backend[i].Item2); - - break; - } - - // Expands existing extent end - if(item != _backend[i].Item2 + 1) - continue; - removeOne = _backend[i]; - if(i < _backend.Count - 1 && - item == _backend[i + 1].Item1 - 1) + if(i > 0 && + item == _backend[i - 1].Item2 + 1) { - removeTwo = _backend[i + 1]; - itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); + removeTwo = _backend[i - 1]; + itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); } else - itemToAdd = new Tuple(_backend[i].Item1, item); + itemToAdd = new Tuple(item, _backend[i].Item2); break; } - if(itemToAdd != null) + // Expands existing extent end + if(item != _backend[i].Item2 + 1) + continue; + + removeOne = _backend[i]; + + if(i < _backend.Count - 1 && + item == _backend[i + 1].Item1 - 1) { - _backend.Remove(removeOne); - _backend.Remove(removeTwo); - _backend.Add(itemToAdd); + removeTwo = _backend[i + 1]; + itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); } else - _backend.Add(new Tuple(item, item)); + itemToAdd = new Tuple(_backend[i].Item1, item); - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + break; } - /// Adds a new extent - /// First element of the extent - /// - /// Last element of the extent or if is true how many elements the extent runs - /// for - /// - /// If set to true, indicates how many elements the extent runs for - public void Add(uint start, uint end, bool run = false) + if(itemToAdd != null) { - uint realEnd; - - if(run) - realEnd = start + end - 1; - else - realEnd = end; - - // TODO: Optimize this - for(uint t = start; t <= realEnd; t++) - Add(t); + _backend.Remove(removeOne); + _backend.Remove(removeTwo); + _backend.Add(itemToAdd); } + else + _backend.Add(new Tuple(item, item)); - /// Checks if the specified item is contained by an extent on this instance - /// Item to search for - /// true if any of the extents on this instance contains the item - public bool Contains(uint item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + } - /// Removes all extents from this instance - public void Clear() => _backend.Clear(); + /// Adds a new extent + /// First element of the extent + /// + /// Last element of the extent or if is true how many elements the extent runs + /// for + /// + /// If set to true, indicates how many elements the extent runs for + public void Add(uint start, uint end, bool run = false) + { + uint realEnd; - /// Removes an item from the extents in this instance - /// Item to remove - /// true if the item was contained in a known extent and removed, false otherwise - public bool Remove(uint item) + if(run) + realEnd = start + end - 1; + else + realEnd = end; + + // TODO: Optimize this + for(uint t = start; t <= realEnd; t++) + Add(t); + } + + /// Checks if the specified item is contained by an extent on this instance + /// Item to search for + /// true if any of the extents on this instance contains the item + public bool Contains(uint item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + + /// Removes all extents from this instance + public void Clear() => _backend.Clear(); + + /// Removes an item from the extents in this instance + /// Item to remove + /// true if the item was contained in a known extent and removed, false otherwise + public bool Remove(uint item) + { + Tuple toRemove = null; + Tuple toAddOne = null; + Tuple toAddTwo = null; + + foreach(Tuple extent in _backend) { - Tuple toRemove = null; - Tuple toAddOne = null; - Tuple toAddTwo = null; - - foreach(Tuple extent in _backend) + // Extent is contained and not a border + if(item > extent.Item1 && + item < extent.Item2) { - // Extent is contained and not a border - if(item > extent.Item1 && - item < extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, item - 1); - toAddTwo = new Tuple(item + 1, extent.Item2); - - break; - } - - // Extent is left border, but not only element - if(item == extent.Item1 && - item != extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(item + 1, extent.Item2); - - break; - } - - // Extent is right border, but not only element - if(item != extent.Item1 && - item == extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, item - 1); - - break; - } - - // Extent is only element - if(item != extent.Item1 || - item != extent.Item2) - continue; - toRemove = extent; + toAddOne = new Tuple(extent.Item1, item - 1); + toAddTwo = new Tuple(item + 1, extent.Item2); break; } - // Item not found - if(toRemove == null) - return false; + // Extent is left border, but not only element + if(item == extent.Item1 && + item != extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple(item + 1, extent.Item2); - _backend.Remove(toRemove); + break; + } - if(toAddOne != null) - _backend.Add(toAddOne); + // Extent is right border, but not only element + if(item != extent.Item1 && + item == extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple(extent.Item1, item - 1); - if(toAddTwo != null) - _backend.Add(toAddTwo); + break; + } - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + // Extent is only element + if(item != extent.Item1 || + item != extent.Item2) + continue; + + toRemove = extent; + + break; + } + + // Item not found + if(toRemove == null) + return false; + + _backend.Remove(toRemove); + + if(toAddOne != null) + _backend.Add(toAddOne); + + if(toAddTwo != null) + _backend.Add(toAddTwo); + + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + + return true; + } + + /// + /// Converts the list of extents to an array of where T1 is first element of the extent and + /// T2 is last element + /// + /// Array of + public Tuple[] ToArray() => _backend.ToArray(); + + /// Gets the first element of the extent that contains the specified item + /// Item + /// First element of extent + /// true if item was found in an extent, false otherwise + public bool GetStart(uint item, out uint start) + { + start = 0; + + foreach(Tuple extent in _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) + { + start = extent.Item1; return true; } - /// - /// Converts the list of extents to an array of where T1 is first element of the extent and - /// T2 is last element - /// - /// Array of - public Tuple[] ToArray() => _backend.ToArray(); - - /// Gets the first element of the extent that contains the specified item - /// Item - /// First element of extent - /// true if item was found in an extent, false otherwise - public bool GetStart(uint item, out uint start) - { - start = 0; - - foreach(Tuple extent in _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) - { - start = extent.Item1; - - return true; - } - - return false; - } + return false; } } \ No newline at end of file diff --git a/Extents/ExtentsULong.cs b/Extents/ExtentsULong.cs index 9080f9149..1d0e12c60 100644 --- a/Extents/ExtentsULong.cs +++ b/Extents/ExtentsULong.cs @@ -40,216 +40,215 @@ using System; using System.Collections.Generic; using System.Linq; -namespace Aaru.CommonTypes.Extents +namespace Aaru.CommonTypes.Extents; + +/// Implements extents for +public class ExtentsULong { - /// Implements extents for - public class ExtentsULong + List> _backend; + + /// Initialize an empty list of extents + public ExtentsULong() => _backend = new List>(); + + /// Initializes extents with an specific list + /// List of extents as tuples "start, end" + public ExtentsULong(IEnumerable> list) { - List> _backend; + _backend = new List>(); - /// Initialize an empty list of extents - public ExtentsULong() => _backend = new List>(); + // This ensure no overlapping extents are added on creation + foreach(Tuple t in list) + Add(t.Item1, t.Item2); + } - /// Initializes extents with an specific list - /// List of extents as tuples "start, end" - public ExtentsULong(IEnumerable> list) + /// Gets a count of how many extents are stored + public int Count => _backend.Count; + + /// Adds the specified number to the corresponding extent, or creates a new one + /// + public void Add(ulong item) + { + Tuple removeOne = null; + Tuple removeTwo = null; + Tuple itemToAdd = null; + + for(int i = 0; i < _backend.Count; i++) { - _backend = new List>(); + // Already contained in an extent + if(item >= _backend[i].Item1 && + item <= _backend[i].Item2) + return; - // This ensure no overlapping extents are added on creation - foreach(Tuple t in list) - Add(t.Item1, t.Item2); - } - - /// Gets a count of how many extents are stored - public int Count => _backend.Count; - - /// Adds the specified number to the corresponding extent, or creates a new one - /// - public void Add(ulong item) - { - Tuple removeOne = null; - Tuple removeTwo = null; - Tuple itemToAdd = null; - - for(int i = 0; i < _backend.Count; i++) + // Expands existing extent start + if(item == _backend[i].Item1 - 1) { - // Already contained in an extent - if(item >= _backend[i].Item1 && - item <= _backend[i].Item2) - return; - - // Expands existing extent start - if(item == _backend[i].Item1 - 1) - { - removeOne = _backend[i]; - - if(i > 0 && - item == _backend[i - 1].Item2 + 1) - { - removeTwo = _backend[i - 1]; - itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); - } - else - itemToAdd = new Tuple(item, _backend[i].Item2); - - break; - } - - // Expands existing extent end - if(item != _backend[i].Item2 + 1) - continue; - removeOne = _backend[i]; - if(i < _backend.Count - 1 && - item == _backend[i + 1].Item1 - 1) + if(i > 0 && + item == _backend[i - 1].Item2 + 1) { - removeTwo = _backend[i + 1]; - itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); + removeTwo = _backend[i - 1]; + itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); } else - itemToAdd = new Tuple(_backend[i].Item1, item); + itemToAdd = new Tuple(item, _backend[i].Item2); break; } - if(itemToAdd != null) + // Expands existing extent end + if(item != _backend[i].Item2 + 1) + continue; + + removeOne = _backend[i]; + + if(i < _backend.Count - 1 && + item == _backend[i + 1].Item1 - 1) { - _backend.Remove(removeOne); - _backend.Remove(removeTwo); - _backend.Add(itemToAdd); + removeTwo = _backend[i + 1]; + itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); } else - _backend.Add(new Tuple(item, item)); + itemToAdd = new Tuple(_backend[i].Item1, item); - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + break; } - /// Adds a new extent - /// First element of the extent - /// - /// Last element of the extent or if is true how many elements the extent runs - /// for - /// - /// If set to true, indicates how many elements the extent runs for - public void Add(ulong start, ulong end, bool run = false) + if(itemToAdd != null) { - ulong realEnd; - - if(run) - realEnd = start + end - 1; - else - realEnd = end; - - // TODO: Optimize this - for(ulong t = start; t <= realEnd; t++) - Add(t); + _backend.Remove(removeOne); + _backend.Remove(removeTwo); + _backend.Add(itemToAdd); } + else + _backend.Add(new Tuple(item, item)); - /// Checks if the specified item is contained by an extent on this instance - /// Item to search for - /// true if any of the extents on this instance contains the item - public bool Contains(ulong item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + } - /// Removes all extents from this instance - public void Clear() => _backend.Clear(); + /// Adds a new extent + /// First element of the extent + /// + /// Last element of the extent or if is true how many elements the extent runs + /// for + /// + /// If set to true, indicates how many elements the extent runs for + public void Add(ulong start, ulong end, bool run = false) + { + ulong realEnd; - /// Removes an item from the extents in this instance - /// Item to remove - /// true if the item was contained in a known extent and removed, false otherwise - public bool Remove(ulong item) + if(run) + realEnd = start + end - 1; + else + realEnd = end; + + // TODO: Optimize this + for(ulong t = start; t <= realEnd; t++) + Add(t); + } + + /// Checks if the specified item is contained by an extent on this instance + /// Item to search for + /// true if any of the extents on this instance contains the item + public bool Contains(ulong item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + + /// Removes all extents from this instance + public void Clear() => _backend.Clear(); + + /// Removes an item from the extents in this instance + /// Item to remove + /// true if the item was contained in a known extent and removed, false otherwise + public bool Remove(ulong item) + { + Tuple toRemove = null; + Tuple toAddOne = null; + Tuple toAddTwo = null; + + foreach(Tuple extent in _backend) { - Tuple toRemove = null; - Tuple toAddOne = null; - Tuple toAddTwo = null; - - foreach(Tuple extent in _backend) + // Extent is contained and not a border + if(item > extent.Item1 && + item < extent.Item2) { - // Extent is contained and not a border - if(item > extent.Item1 && - item < extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, item - 1); - toAddTwo = new Tuple(item + 1, extent.Item2); - - break; - } - - // Extent is left border, but not only element - if(item == extent.Item1 && - item != extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(item + 1, extent.Item2); - - break; - } - - // Extent is right border, but not only element - if(item != extent.Item1 && - item == extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, item - 1); - - break; - } - - // Extent is only element - if(item != extent.Item1 || - item != extent.Item2) - continue; - toRemove = extent; + toAddOne = new Tuple(extent.Item1, item - 1); + toAddTwo = new Tuple(item + 1, extent.Item2); break; } - // Item not found - if(toRemove == null) - return false; + // Extent is left border, but not only element + if(item == extent.Item1 && + item != extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple(item + 1, extent.Item2); - _backend.Remove(toRemove); + break; + } - if(toAddOne != null) - _backend.Add(toAddOne); + // Extent is right border, but not only element + if(item != extent.Item1 && + item == extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple(extent.Item1, item - 1); - if(toAddTwo != null) - _backend.Add(toAddTwo); + break; + } - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + // Extent is only element + if(item != extent.Item1 || + item != extent.Item2) + continue; + + toRemove = extent; + + break; + } + + // Item not found + if(toRemove == null) + return false; + + _backend.Remove(toRemove); + + if(toAddOne != null) + _backend.Add(toAddOne); + + if(toAddTwo != null) + _backend.Add(toAddTwo); + + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + + return true; + } + + /// + /// Converts the list of extents to an array of where T1 is first element of the extent and + /// T2 is last element + /// + /// Array of + public Tuple[] ToArray() => _backend.ToArray(); + + /// Gets the first element of the extent that contains the specified item + /// Item + /// First element of extent + /// true if item was found in an extent, false otherwise + public bool GetStart(ulong item, out ulong start) + { + start = 0; + + foreach(Tuple extent in + _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) + { + start = extent.Item1; return true; } - /// - /// Converts the list of extents to an array of where T1 is first element of the extent and - /// T2 is last element - /// - /// Array of - public Tuple[] ToArray() => _backend.ToArray(); - - /// Gets the first element of the extent that contains the specified item - /// Item - /// First element of extent - /// true if item was found in an extent, false otherwise - public bool GetStart(ulong item, out ulong start) - { - start = 0; - - foreach(Tuple extent in - _backend.Where(extent => item >= extent.Item1 && item <= extent.Item2)) - { - start = extent.Item1; - - return true; - } - - return false; - } + return false; } } \ No newline at end of file diff --git a/Extents/ExtentsUShort.cs b/Extents/ExtentsUShort.cs index 1caa328f2..f944d573f 100644 --- a/Extents/ExtentsUShort.cs +++ b/Extents/ExtentsUShort.cs @@ -40,216 +40,215 @@ using System; using System.Collections.Generic; using System.Linq; -namespace Aaru.CommonTypes.Extents +namespace Aaru.CommonTypes.Extents; + +/// Implements extents for +public class ExtentsUShort { - /// Implements extents for - public class ExtentsUShort + List> _backend; + + /// Initialize an empty list of extents + public ExtentsUShort() => _backend = new List>(); + + /// Initializes extents with an specific list + /// List of extents as tuples "start, end" + public ExtentsUShort(IEnumerable> list) { - List> _backend; + _backend = new List>(); - /// Initialize an empty list of extents - public ExtentsUShort() => _backend = new List>(); + // This ensure no overlapping extents are added on creation + foreach(Tuple t in list) + Add(t.Item1, t.Item2); + } - /// Initializes extents with an specific list - /// List of extents as tuples "start, end" - public ExtentsUShort(IEnumerable> list) + /// Gets a count of how many extents are stored + public int Count => _backend.Count; + + /// Adds the specified number to the corresponding extent, or creates a new one + /// + public void Add(ushort item) + { + Tuple removeOne = null; + Tuple removeTwo = null; + Tuple itemToAdd = null; + + for(int i = 0; i < _backend.Count; i++) { - _backend = new List>(); + // Already contained in an extent + if(item >= _backend[i].Item1 && + item <= _backend[i].Item2) + return; - // This ensure no overlapping extents are added on creation - foreach(Tuple t in list) - Add(t.Item1, t.Item2); - } - - /// Gets a count of how many extents are stored - public int Count => _backend.Count; - - /// Adds the specified number to the corresponding extent, or creates a new one - /// - public void Add(ushort item) - { - Tuple removeOne = null; - Tuple removeTwo = null; - Tuple itemToAdd = null; - - for(int i = 0; i < _backend.Count; i++) + // Expands existing extent start + if(item == _backend[i].Item1 - 1) { - // Already contained in an extent - if(item >= _backend[i].Item1 && - item <= _backend[i].Item2) - return; - - // Expands existing extent start - if(item == _backend[i].Item1 - 1) - { - removeOne = _backend[i]; - - if(i > 0 && - item == _backend[i - 1].Item2 + 1) - { - removeTwo = _backend[i - 1]; - itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); - } - else - itemToAdd = new Tuple(item, _backend[i].Item2); - - break; - } - - // Expands existing extent end - if(item != _backend[i].Item2 + 1) - continue; - removeOne = _backend[i]; - if(i < _backend.Count - 1 && - item == _backend[i + 1].Item1 - 1) + if(i > 0 && + item == _backend[i - 1].Item2 + 1) { - removeTwo = _backend[i + 1]; - itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); + removeTwo = _backend[i - 1]; + itemToAdd = new Tuple(_backend[i - 1].Item1, _backend[i].Item2); } else - itemToAdd = new Tuple(_backend[i].Item1, item); + itemToAdd = new Tuple(item, _backend[i].Item2); break; } - if(itemToAdd != null) + // Expands existing extent end + if(item != _backend[i].Item2 + 1) + continue; + + removeOne = _backend[i]; + + if(i < _backend.Count - 1 && + item == _backend[i + 1].Item1 - 1) { - _backend.Remove(removeOne); - _backend.Remove(removeTwo); - _backend.Add(itemToAdd); + removeTwo = _backend[i + 1]; + itemToAdd = new Tuple(_backend[i].Item1, _backend[i + 1].Item2); } else - _backend.Add(new Tuple(item, item)); + itemToAdd = new Tuple(_backend[i].Item1, item); - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + break; } - /// Adds a new extent - /// First element of the extent - /// - /// Last element of the extent or if is true how many elements the extent runs - /// for - /// - /// If set to true, indicates how many elements the extent runs for - public void Add(ushort start, ushort end, bool run = false) + if(itemToAdd != null) { - ushort realEnd; - - if(run) - realEnd = (ushort)(start + end - 1); - else - realEnd = end; - - // TODO: Optimize this - for(ushort t = start; t <= realEnd; t++) - Add(t); + _backend.Remove(removeOne); + _backend.Remove(removeTwo); + _backend.Add(itemToAdd); } + else + _backend.Add(new Tuple(item, item)); - /// Checks if the specified item is contained by an extent on this instance - /// Item to search for - /// true if any of the extents on this instance contains the item - public bool Contains(ushort item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + } - /// Removes all extents from this instance - public void Clear() => _backend.Clear(); + /// Adds a new extent + /// First element of the extent + /// + /// Last element of the extent or if is true how many elements the extent runs + /// for + /// + /// If set to true, indicates how many elements the extent runs for + public void Add(ushort start, ushort end, bool run = false) + { + ushort realEnd; - /// Removes an item from the extents in this instance - /// Item to remove - /// true if the item was contained in a known extent and removed, false otherwise - public bool Remove(ushort item) + if(run) + realEnd = (ushort)(start + end - 1); + else + realEnd = end; + + // TODO: Optimize this + for(ushort t = start; t <= realEnd; t++) + Add(t); + } + + /// Checks if the specified item is contained by an extent on this instance + /// Item to search for + /// true if any of the extents on this instance contains the item + public bool Contains(ushort item) => _backend.Any(extent => item >= extent.Item1 && item <= extent.Item2); + + /// Removes all extents from this instance + public void Clear() => _backend.Clear(); + + /// Removes an item from the extents in this instance + /// Item to remove + /// true if the item was contained in a known extent and removed, false otherwise + public bool Remove(ushort item) + { + Tuple toRemove = null; + Tuple toAddOne = null; + Tuple toAddTwo = null; + + foreach(Tuple extent in _backend) { - Tuple toRemove = null; - Tuple toAddOne = null; - Tuple toAddTwo = null; - - foreach(Tuple extent in _backend) + // Extent is contained and not a border + if(item > extent.Item1 && + item < extent.Item2) { - // Extent is contained and not a border - if(item > extent.Item1 && - item < extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, (ushort)(item - 1)); - toAddTwo = new Tuple((ushort)(item + 1), extent.Item2); - - break; - } - - // Extent is left border, but not only element - if(item == extent.Item1 && - item != extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple((ushort)(item + 1), extent.Item2); - - break; - } - - // Extent is right border, but not only element - if(item != extent.Item1 && - item == extent.Item2) - { - toRemove = extent; - toAddOne = new Tuple(extent.Item1, (ushort)(item - 1)); - - break; - } - - // Extent is only element - if(item != extent.Item1 || - item != extent.Item2) - continue; - toRemove = extent; + toAddOne = new Tuple(extent.Item1, (ushort)(item - 1)); + toAddTwo = new Tuple((ushort)(item + 1), extent.Item2); break; } - // Item not found - if(toRemove == null) - return false; + // Extent is left border, but not only element + if(item == extent.Item1 && + item != extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple((ushort)(item + 1), extent.Item2); - _backend.Remove(toRemove); + break; + } - if(toAddOne != null) - _backend.Add(toAddOne); + // Extent is right border, but not only element + if(item != extent.Item1 && + item == extent.Item2) + { + toRemove = extent; + toAddOne = new Tuple(extent.Item1, (ushort)(item - 1)); - if(toAddTwo != null) - _backend.Add(toAddTwo); + break; + } - // Sort - _backend = _backend.OrderBy(t => t.Item1).ToList(); + // Extent is only element + if(item != extent.Item1 || + item != extent.Item2) + continue; + + toRemove = extent; + + break; + } + + // Item not found + if(toRemove == null) + return false; + + _backend.Remove(toRemove); + + if(toAddOne != null) + _backend.Add(toAddOne); + + if(toAddTwo != null) + _backend.Add(toAddTwo); + + // Sort + _backend = _backend.OrderBy(t => t.Item1).ToList(); + + return true; + } + + /// + /// Converts the list of extents to an array of where T1 is first element of the extent and + /// T2 is last element + /// + /// Array of + public Tuple[] ToArray() => _backend.ToArray(); + + /// Gets the first element of the extent that contains the specified item + /// Item + /// First element of extent + /// true if item was found in an extent, false otherwise + public bool GetStart(ushort item, out ushort start) + { + start = 0; + + foreach(Tuple extent in _backend.Where(extent => item >= extent.Item1 && + item <= extent.Item2)) + { + start = extent.Item1; return true; } - /// - /// Converts the list of extents to an array of where T1 is first element of the extent and - /// T2 is last element - /// - /// Array of - public Tuple[] ToArray() => _backend.ToArray(); - - /// Gets the first element of the extent that contains the specified item - /// Item - /// First element of extent - /// true if item was found in an extent, false otherwise - public bool GetStart(ushort item, out ushort start) - { - start = 0; - - foreach(Tuple extent in _backend.Where(extent => item >= extent.Item1 && - item <= extent.Item2)) - { - start = extent.Item1; - - return true; - } - - return false; - } + return false; } } \ No newline at end of file diff --git a/Filters.cs b/Filters.cs index d965ca25d..ca7bd1c70 100644 --- a/Filters.cs +++ b/Filters.cs @@ -45,73 +45,72 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; -namespace Aaru.CommonTypes +namespace Aaru.CommonTypes; + +/// Manages the known filters +public sealed class FiltersList { - /// Manages the known filters - public sealed class FiltersList + /// List of known filters + public readonly SortedDictionary Filters; + + /// Fills the list of all known filters + public FiltersList() { - /// List of known filters - public readonly SortedDictionary Filters; + var assembly = Assembly.Load("Aaru.Filters"); + Filters = new SortedDictionary(); - /// Fills the list of all known filters - public FiltersList() + 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())) + Filters.Add(filter.Name.ToLower(), filter); + } + catch(Exception exception) + { + AaruConsole.ErrorWriteLine("Exception {0}", exception); + } + } + + /// Gets the filter that allows to read the specified path + /// Path + /// The filter that allows reading the specified path + public IFilter GetFilter(string path) + { + IFilter noFilter = null; + + foreach(IFilter filter in Filters.Values) { - var assembly = Assembly.Load("Aaru.Filters"); - Filters = new SortedDictionary(); - - foreach(Type type in assembly.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IFilter)))) - try + try + { + if(filter.Id != new Guid("12345678-AAAA-BBBB-CCCC-123456789000")) { - var filter = (IFilter)type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] + if(!filter.Identify(path)) + continue; + + var foundFilter = (IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] {}); - if(filter != null && - !Filters.ContainsKey(filter.Name.ToLower())) - Filters.Add(filter.Name.ToLower(), filter); - } - catch(Exception exception) - { - AaruConsole.ErrorWriteLine("Exception {0}", exception); - } - } - - /// Gets the filter that allows to read the specified path - /// Path - /// The filter that allows reading the specified path - public IFilter GetFilter(string path) - { - IFilter noFilter = null; - - foreach(IFilter filter in Filters.Values) - { - try - { - if(filter.Id != new Guid("12345678-AAAA-BBBB-CCCC-123456789000")) - { - if(!filter.Identify(path)) - continue; - - var foundFilter = (IFilter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] - {}); - - if(foundFilter?.Open(path) == ErrorNumber.NoError) - return foundFilter; - } - else - noFilter = filter; - } - catch(IOException) - { - // Ignore and continue + if(foundFilter?.Open(path) == ErrorNumber.NoError) + return foundFilter; } + else + noFilter = filter; + } + catch(IOException) + { + // Ignore and continue } - - if(!noFilter?.Identify(path) == true) - return null; - - noFilter?.Open(path); - - return noFilter; } + + if(!noFilter?.Identify(path) == true) + return null; + + noFilter?.Open(path); + + return noFilter; } } \ No newline at end of file diff --git a/Geometry.cs b/Geometry.cs index c0c02cf47..eb4382760 100644 --- a/Geometry.cs +++ b/Geometry.cs @@ -38,108 +38,107 @@ using System.Linq; -namespace Aaru.CommonTypes +namespace Aaru.CommonTypes; + +/// Handles CHS geometries +public static class Geometry { - /// Handles CHS geometries - public static class Geometry - { - /// List of known disk geometries - public 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), - (35, 1, 9, 256, MediaEncoding.FM, false, MediaType.ECMA_66), - (35, 1, 13, 256, MediaEncoding.AppleGCR, false, MediaType.Apple32SS), - (35, 1, 16, 256, MediaEncoding.MFM, false, MediaType.MetaFloppy_Mod_I), - (35, 1, 16, 256, MediaEncoding.AppleGCR, false, MediaType.Apple33SS), - (35, 1, 19, 256, MediaEncoding.CommodoreGCR, false, MediaType.CBM_1540), - (35, 2, 13, 256, MediaEncoding.AppleGCR, false, MediaType.Apple32DS), - (35, 2, 16, 256, MediaEncoding.AppleGCR, false, MediaType.Apple33DS), - (35, 2, 19, 256, MediaEncoding.CommodoreGCR, false, MediaType.CBM_1571), - (40, 1, 8, 512, MediaEncoding.MFM, false, MediaType.DOS_525_SS_DD_8), - (40, 1, 9, 512, MediaEncoding.MFM, false, MediaType.DOS_525_SS_DD_9), - (40, 1, 10, 256, MediaEncoding.FM, false, MediaType.ACORN_525_SS_SD_40), - (40, 1, 16, 256, MediaEncoding.MFM, false, MediaType.ACORN_525_SS_DD_40), - (40, 1, 18, 128, MediaEncoding.FM, false, MediaType.ATARI_525_SD), - (40, 1, 18, 256, MediaEncoding.MFM, false, MediaType.ATARI_525_DD), - (40, 1, 19, 256, MediaEncoding.CommodoreGCR, false, MediaType.CBM_1540_Ext), - (40, 1, 26, 128, MediaEncoding.MFM, false, MediaType.ATARI_525_ED), - (40, 2, 8, 512, MediaEncoding.MFM, false, MediaType.DOS_525_DS_DD_8), - (40, 2, 9, 512, MediaEncoding.MFM, false, MediaType.DOS_525_DS_DD_9), - (40, 2, 16, 256, MediaEncoding.FM, false, MediaType.ECMA_70), - (70, 2, 9, 512, MediaEncoding.MFM, false, MediaType.Apricot_35), - (74, 1, 8, 512, MediaEncoding.FM, false, MediaType.IBM33FD_512), - (74, 1, 15, 256, MediaEncoding.FM, false, MediaType.IBM33FD_256), - (74, 1, 26, 128, MediaEncoding.FM, false, MediaType.IBM33FD_128), - (74, 2, 8, 1024, MediaEncoding.MFM, false, MediaType.IBM53FD_1024), - (74, 2, 15, 256, MediaEncoding.FM, false, MediaType.IBM43FD_256), - (74, 2, 15, 512, MediaEncoding.MFM, false, MediaType.IBM53FD_512), - (74, 2, 26, 128, MediaEncoding.FM, false, MediaType.IBM43FD_128), - (74, 2, 26, 256, MediaEncoding.MFM, false, MediaType.IBM53FD_256), - (77, 1, 16, 256, MediaEncoding.MFM, false, MediaType.MetaFloppy_Mod_II), - (77, 1, 26, 128, MediaEncoding.FM, false, MediaType.RX01), - (77, 1, 26, 256, MediaEncoding.MFM, false, MediaType.RX02), - (77, 2, 8, 1024, MediaEncoding.MFM, false, MediaType.NEC_525_HD), - (77, 2, 15, 512, MediaEncoding.MFM, false, MediaType.ECMA_99_15), - (77, 2, 26, 128, MediaEncoding.FM, false, MediaType.NEC_8_SD), - (77, 2, 26, 256, MediaEncoding.MFM, false, MediaType.RX03), - (80, 1, 8, 512, MediaEncoding.MFM, false, MediaType.DOS_35_SS_DD_8), - (80, 1, 9, 512, MediaEncoding.MFM, false, MediaType.DOS_35_SS_DD_9), - (80, 1, 10, 256, MediaEncoding.FM, false, MediaType.ACORN_525_SS_SD_80), - (80, 1, 10, 512, MediaEncoding.AppleGCR, true, MediaType.AppleSonySS), - (80, 1, 10, 512, MediaEncoding.MFM, false, MediaType.RX50), - (80, 1, 11, 512, MediaEncoding.MFM, false, MediaType.ATARI_35_SS_DD_11), - (80, 1, 16, 256, MediaEncoding.MFM, false, MediaType.ACORN_525_SS_DD_80), - (80, 2, 5, 1024, MediaEncoding.MFM, false, MediaType.ACORN_35_DS_DD), - (80, 2, 8, 512, MediaEncoding.MFM, false, MediaType.DOS_35_DS_DD_8), - (80, 2, 9, 512, MediaEncoding.MFM, false, MediaType.DOS_35_DS_DD_9), - (80, 2, 10, 512, MediaEncoding.AppleGCR, true, MediaType.AppleSonyDS), - (80, 2, 10, 512, MediaEncoding.MFM, false, MediaType.CBM_35_DD), - (80, 2, 10, 1024, MediaEncoding.MFM, false, MediaType.ACORN_35_DS_HD), - (80, 2, 11, 512, MediaEncoding.MFM, false, MediaType.CBM_AMIGA_35_DD), - (80, 2, 15, 512, MediaEncoding.MFM, false, MediaType.DOS_525_HD), - (80, 2, 16, 256, MediaEncoding.FM, false, MediaType.ECMA_78), - (80, 2, 16, 256, MediaEncoding.MFM, false, MediaType.ACORN_525_DS_DD), - (80, 2, 18, 512, MediaEncoding.MFM, false, MediaType.DOS_35_HD), - (80, 2, 19, 512, MediaEncoding.MFM, false, MediaType.XDF_525), - (80, 2, 21, 512, MediaEncoding.MFM, false, MediaType.DMF), - (80, 2, 22, 512, MediaEncoding.MFM, false, MediaType.CBM_AMIGA_35_HD), - (80, 2, 23, 512, MediaEncoding.MFM, false, MediaType.XDF_35), - (80, 2, 36, 512, MediaEncoding.MFM, false, MediaType.DOS_35_ED), - (82, 2, 10, 512, MediaEncoding.MFM, false, MediaType.FDFORMAT_35_DD), - (82, 2, 17, 512, MediaEncoding.MFM, false, MediaType.FDFORMAT_525_HD), - (82, 2, 21, 512, MediaEncoding.MFM, false, MediaType.FDFORMAT_35_HD), - (240, 2, 38, 512, MediaEncoding.MFM, false, MediaType.NEC_35_TD), - (753, 2, 27, 512, MediaEncoding.MFM, false, MediaType.Floptical), + /// List of known disk geometries + public 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), + (35, 1, 9, 256, MediaEncoding.FM, false, MediaType.ECMA_66), + (35, 1, 13, 256, MediaEncoding.AppleGCR, false, MediaType.Apple32SS), + (35, 1, 16, 256, MediaEncoding.MFM, false, MediaType.MetaFloppy_Mod_I), + (35, 1, 16, 256, MediaEncoding.AppleGCR, false, MediaType.Apple33SS), + (35, 1, 19, 256, MediaEncoding.CommodoreGCR, false, MediaType.CBM_1540), + (35, 2, 13, 256, MediaEncoding.AppleGCR, false, MediaType.Apple32DS), + (35, 2, 16, 256, MediaEncoding.AppleGCR, false, MediaType.Apple33DS), + (35, 2, 19, 256, MediaEncoding.CommodoreGCR, false, MediaType.CBM_1571), + (40, 1, 8, 512, MediaEncoding.MFM, false, MediaType.DOS_525_SS_DD_8), + (40, 1, 9, 512, MediaEncoding.MFM, false, MediaType.DOS_525_SS_DD_9), + (40, 1, 10, 256, MediaEncoding.FM, false, MediaType.ACORN_525_SS_SD_40), + (40, 1, 16, 256, MediaEncoding.MFM, false, MediaType.ACORN_525_SS_DD_40), + (40, 1, 18, 128, MediaEncoding.FM, false, MediaType.ATARI_525_SD), + (40, 1, 18, 256, MediaEncoding.MFM, false, MediaType.ATARI_525_DD), + (40, 1, 19, 256, MediaEncoding.CommodoreGCR, false, MediaType.CBM_1540_Ext), + (40, 1, 26, 128, MediaEncoding.MFM, false, MediaType.ATARI_525_ED), + (40, 2, 8, 512, MediaEncoding.MFM, false, MediaType.DOS_525_DS_DD_8), + (40, 2, 9, 512, MediaEncoding.MFM, false, MediaType.DOS_525_DS_DD_9), + (40, 2, 16, 256, MediaEncoding.FM, false, MediaType.ECMA_70), + (70, 2, 9, 512, MediaEncoding.MFM, false, MediaType.Apricot_35), + (74, 1, 8, 512, MediaEncoding.FM, false, MediaType.IBM33FD_512), + (74, 1, 15, 256, MediaEncoding.FM, false, MediaType.IBM33FD_256), + (74, 1, 26, 128, MediaEncoding.FM, false, MediaType.IBM33FD_128), + (74, 2, 8, 1024, MediaEncoding.MFM, false, MediaType.IBM53FD_1024), + (74, 2, 15, 256, MediaEncoding.FM, false, MediaType.IBM43FD_256), + (74, 2, 15, 512, MediaEncoding.MFM, false, MediaType.IBM53FD_512), + (74, 2, 26, 128, MediaEncoding.FM, false, MediaType.IBM43FD_128), + (74, 2, 26, 256, MediaEncoding.MFM, false, MediaType.IBM53FD_256), + (77, 1, 16, 256, MediaEncoding.MFM, false, MediaType.MetaFloppy_Mod_II), + (77, 1, 26, 128, MediaEncoding.FM, false, MediaType.RX01), + (77, 1, 26, 256, MediaEncoding.MFM, false, MediaType.RX02), + (77, 2, 8, 1024, MediaEncoding.MFM, false, MediaType.NEC_525_HD), + (77, 2, 15, 512, MediaEncoding.MFM, false, MediaType.ECMA_99_15), + (77, 2, 26, 128, MediaEncoding.FM, false, MediaType.NEC_8_SD), + (77, 2, 26, 256, MediaEncoding.MFM, false, MediaType.RX03), + (80, 1, 8, 512, MediaEncoding.MFM, false, MediaType.DOS_35_SS_DD_8), + (80, 1, 9, 512, MediaEncoding.MFM, false, MediaType.DOS_35_SS_DD_9), + (80, 1, 10, 256, MediaEncoding.FM, false, MediaType.ACORN_525_SS_SD_80), + (80, 1, 10, 512, MediaEncoding.AppleGCR, true, MediaType.AppleSonySS), + (80, 1, 10, 512, MediaEncoding.MFM, false, MediaType.RX50), + (80, 1, 11, 512, MediaEncoding.MFM, false, MediaType.ATARI_35_SS_DD_11), + (80, 1, 16, 256, MediaEncoding.MFM, false, MediaType.ACORN_525_SS_DD_80), + (80, 2, 5, 1024, MediaEncoding.MFM, false, MediaType.ACORN_35_DS_DD), + (80, 2, 8, 512, MediaEncoding.MFM, false, MediaType.DOS_35_DS_DD_8), + (80, 2, 9, 512, MediaEncoding.MFM, false, MediaType.DOS_35_DS_DD_9), + (80, 2, 10, 512, MediaEncoding.AppleGCR, true, MediaType.AppleSonyDS), + (80, 2, 10, 512, MediaEncoding.MFM, false, MediaType.CBM_35_DD), + (80, 2, 10, 1024, MediaEncoding.MFM, false, MediaType.ACORN_35_DS_HD), + (80, 2, 11, 512, MediaEncoding.MFM, false, MediaType.CBM_AMIGA_35_DD), + (80, 2, 15, 512, MediaEncoding.MFM, false, MediaType.DOS_525_HD), + (80, 2, 16, 256, MediaEncoding.FM, false, MediaType.ECMA_78), + (80, 2, 16, 256, MediaEncoding.MFM, false, MediaType.ACORN_525_DS_DD), + (80, 2, 18, 512, MediaEncoding.MFM, false, MediaType.DOS_35_HD), + (80, 2, 19, 512, MediaEncoding.MFM, false, MediaType.XDF_525), + (80, 2, 21, 512, MediaEncoding.MFM, false, MediaType.DMF), + (80, 2, 22, 512, MediaEncoding.MFM, false, MediaType.CBM_AMIGA_35_HD), + (80, 2, 23, 512, MediaEncoding.MFM, false, MediaType.XDF_35), + (80, 2, 36, 512, MediaEncoding.MFM, false, MediaType.DOS_35_ED), + (82, 2, 10, 512, MediaEncoding.MFM, false, MediaType.FDFORMAT_35_DD), + (82, 2, 17, 512, MediaEncoding.MFM, false, MediaType.FDFORMAT_525_HD), + (82, 2, 21, 512, MediaEncoding.MFM, false, MediaType.FDFORMAT_35_HD), + (240, 2, 38, 512, MediaEncoding.MFM, false, MediaType.NEC_35_TD), + (753, 2, 27, 512, MediaEncoding.MFM, false, MediaType.Floptical), - // Following ones are what the device itself report, not the physical geometry - (154, 16, 32, 512, MediaEncoding.MFM, false, MediaType.PocketZip), - (262, 32, 56, 512, MediaEncoding.MFM, false, MediaType.LS240), - (963, 8, 32, 512, MediaEncoding.MFM, false, MediaType.LS120), - (1021, 64, 32, 512, MediaEncoding.MFM, false, MediaType.Jaz), - (1024, 2, 32, 512, MediaEncoding.MFM, false, MediaType.FD32MB) - }; + // Following ones are what the device itself report, not the physical geometry + (154, 16, 32, 512, MediaEncoding.MFM, false, MediaType.PocketZip), + (262, 32, 56, 512, MediaEncoding.MFM, false, MediaType.LS240), + (963, 8, 32, 512, MediaEncoding.MFM, false, MediaType.LS120), + (1021, 64, 32, 512, MediaEncoding.MFM, false, MediaType.Jaz), + (1024, 2, 32, 512, MediaEncoding.MFM, false, MediaType.FD32MB) + }; - /// Gets the media type for a given geometry - /// Geometry - /// Media type - public static MediaType GetMediaType( - (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding, bool - variableSectorsPerTrack) geometry) => (from geom in KnownGeometries - where geom.cylinders == geometry.cylinders && - geom.heads == geometry.heads && - geom.sectorsPerTrack == geometry.sectorsPerTrack && - geom.bytesPerSector == geometry.bytesPerSector && - geom.encoding == geometry.encoding && - geom.variableSectorsPerTrack == - geometry.variableSectorsPerTrack select geom.type). - FirstOrDefault(); + /// Gets the media type for a given geometry + /// Geometry + /// Media type + public static MediaType GetMediaType( + (ushort cylinders, byte heads, ushort sectorsPerTrack, uint bytesPerSector, MediaEncoding encoding, bool + variableSectorsPerTrack) geometry) => (from geom in KnownGeometries + where geom.cylinders == geometry.cylinders && + geom.heads == geometry.heads && + geom.sectorsPerTrack == geometry.sectorsPerTrack && + geom.bytesPerSector == geometry.bytesPerSector && + geom.encoding == geometry.encoding && + geom.variableSectorsPerTrack == + geometry.variableSectorsPerTrack select geom.type). + FirstOrDefault(); - /// Gets the geometry for a given media type - /// Media type - /// Geometry - 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(); - } + /// Gets the geometry for a given media type + /// Media type + /// Geometry + 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 3bacb2b34..79c2c53ef 100644 --- a/Interfaces/IArchive.cs +++ b/Interfaces/IArchive.cs @@ -38,166 +38,165 @@ using Aaru.CommonTypes.Enums; // ReSharper disable UnusedMember.Global -namespace Aaru.CommonTypes.Interfaces +namespace Aaru.CommonTypes.Interfaces; + +/// Supported archive features +[Flags] +public enum ArchiveSupportedFeature : uint { - /// Supported archive features - [Flags] - 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, - /// - /// The archive supports compression. If this flag is not set, compressed and uncompressed lengths are always the - /// same. - /// - 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, - /// - /// 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. - /// - HasExplicitDirectories = 1 << 3, - /// The archive stores a timestamp with each entry if this flag is set. - HasEntryTimestamp = 1 << 4, - /// If this flag is set, individual files or the whole archive might be encrypted or password-protected. - SupportsProtection = 1 << 5, // TODO: not implemented yet + /// The archive supports filenames for its entries. If this flag is not set, files can only be accessed by number. + SupportsFilenames = 1 << 0, + /// + /// The archive supports compression. If this flag is not set, compressed and uncompressed lengths are always the + /// same. + /// + 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, + /// + /// 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. + /// + HasExplicitDirectories = 1 << 3, + /// The archive stores a timestamp with each entry if this flag is set. + HasEntryTimestamp = 1 << 4, + /// If this flag is set, individual files or the whole archive might be encrypted or password-protected. + SupportsProtection = 1 << 5, // TODO: not implemented yet - /// If this flag is set, the archive supports returning extended attributes (Xattrs) for each entry. - SupportsXAttrs = 1 << 6 - } + /// If this flag is set, the archive supports returning extended attributes (Xattrs) for each entry. + SupportsXAttrs = 1 << 6 +} - /// Defines the interface to handle an archive (e.g. ZIP, WAD, etc) - public interface IArchive - { - /// Descriptive name of the plugin - string Name { get; } +/// Defines the interface to handle an archive (e.g. ZIP, WAD, etc) +public interface IArchive +{ + /// Descriptive name of the plugin + string Name { get; } - /// Unique UUID of the plugin - Guid Id { get; } + /// Unique UUID of the plugin + Guid Id { get; } - /// Identifies if the specified path contains data recognizable by this archive instance - /// Path. - bool Identify(string path); + /// Identifies if the specified path contains data recognizable by this archive instance + /// Path. + bool Identify(string path); - /// Identifies if the specified stream contains data recognizable by this archive instance - /// Stream. - bool Identify(Stream stream); + /// Identifies if the specified stream contains data recognizable by this archive instance + /// Stream. + bool Identify(Stream stream); - /// Identifies if the specified buffer contains data recognizable by this archive instance - /// Buffer. - bool Identify(byte[] buffer); + /// Identifies if the specified buffer contains data recognizable by this archive instance + /// Buffer. + bool Identify(byte[] buffer); - /// Opens the specified path with this archive instance - /// Path. - ErrorNumber Open(string path); + /// Opens the specified path with this archive instance + /// Path. + ErrorNumber Open(string path); - /// Opens the specified stream with this archive instance - /// Stream. - ErrorNumber Open(Stream stream); + /// Opens the specified stream with this archive instance + /// Stream. + ErrorNumber Open(Stream stream); - /// Opens the specified buffer with this archive instance - /// Buffer. - ErrorNumber Open(byte[] buffer); + /// Opens the specified buffer with this archive instance + /// Buffer. + ErrorNumber Open(byte[] buffer); - /// - /// Returns true if the archive has a file/stream/buffer currently opened and no - /// has been issued. - /// - bool IsOpened(); + /// + /// Returns true if the archive has a file/stream/buffer currently opened and no + /// has been issued. + /// + bool IsOpened(); - /// Closes all opened streams. - void Close(); + /// Closes all opened streams. + void Close(); - /// Return a bitfield indicating the features supported by this archive type. - /// The ArchiveSupportedFeature bitfield. - /// - /// This should be a constant, tied to the archive type, not to the particular features used by the - /// currently-opened archive file. - /// - ArchiveSupportedFeature GetArchiveFeatures(); + /// Return a bitfield indicating the features supported by this archive type. + /// The ArchiveSupportedFeature bitfield. + /// + /// This should be a constant, tied to the archive type, not to the particular features used by the + /// currently-opened archive file. + /// + ArchiveSupportedFeature GetArchiveFeatures(); - /// Gets the number of entries (i.e. files) that are contained in this archive. - /// - /// Entries in this context can also mean directories or volume labels, for some types of archives that store - /// these explicitly. Do not rely on all entries being regular files! - /// - /// The number of files. - int GetNumberOfEntries(); + /// Gets the number of entries (i.e. files) that are contained in this archive. + /// + /// Entries in this context can also mean directories or volume labels, for some types of archives that store + /// these explicitly. Do not rely on all entries being regular files! + /// + /// The number of files. + int GetNumberOfEntries(); - /// Gets the file name (and path) of the given entry in the archive. - /// - /// The path components are separated by a forward slash "/".
The path should not start with a leading - /// slash (i.e. it should be relative, not absolute). - ///
- /// - /// The entry in the archive for which to return the file name. - /// The file name, with (relative) path - string GetFilename(int entryNumber); + /// Gets the file name (and path) of the given entry in the archive. + /// + /// The path components are separated by a forward slash "/".
The path should not start with a leading + /// slash (i.e. it should be relative, not absolute). + ///
+ /// + /// The entry in the archive for which to return the file name. + /// The file name, with (relative) path + string GetFilename(int entryNumber); - /// - /// Gets the entry number for a particular file path in the archive. fileName is the relative path of the - /// file in the archive. If the file cannot be found, -1 is returned. - /// - /// - /// The path should be relative (no leading slash), using regular slashes as path separator, and be normalized, - /// i.e. no "foo//bar" or "foo/../bar" path components. - /// - /// The relative path for which to get the entry number. - /// If set, do a case insensitive matching and return the first file that matches. - /// The number of the entry corresponding to the given path, or -1 if the path does not exist. - int GetEntryNumber(string fileName, bool caseInsensitiveMatch); + /// + /// Gets the entry number for a particular file path in the archive. fileName is the relative path of the + /// file in the archive. If the file cannot be found, -1 is returned. + /// + /// + /// The path should be relative (no leading slash), using regular slashes as path separator, and be normalized, + /// i.e. no "foo//bar" or "foo/../bar" path components. + /// + /// The relative path for which to get the entry number. + /// If set, do a case insensitive matching and return the first file that matches. + /// The number of the entry corresponding to the given path, or -1 if the path does not exist. + int GetEntryNumber(string fileName, bool caseInsensitiveMatch); - /// Gets the (compressed) size of the given entry. - /// The entry for which to get the compressed size. - /// The compressed size of the entry, or 0 if the entry is not a regular file. - /// The return value is equal to the return value of GetUncompressedSize() if the file is not compressed. - /// - long GetCompressedSize(int entryNumber); + /// Gets the (compressed) size of the given entry. + /// The entry for which to get the compressed size. + /// The compressed size of the entry, or 0 if the entry is not a regular file. + /// The return value is equal to the return value of GetUncompressedSize() if the file is not compressed. + /// + long GetCompressedSize(int entryNumber); - /// Gets the uncompressed size of the given entry. - /// The entry for which to get the uncompressed size. - /// The uncompressed size of the entry, or 0 if the entry is not a regular file. - /// The return value is equal to the return value of GetCompressedSize() if the file is not compressed. - /// - long GetUncompressedSize(int entryNumber); + /// Gets the uncompressed size of the given entry. + /// The entry for which to get the uncompressed size. + /// The uncompressed size of the entry, or 0 if the entry is not a regular file. + /// The return value is equal to the return value of GetCompressedSize() if the file is not compressed. + /// + long GetUncompressedSize(int entryNumber); - /// Gets the attributes of a file or directory. - /// - /// Error number. - /// The entry in the archive for which to retrieve the attributes. - /// File attributes, or zero if the archive does not support attributes. - FileAttributes GetAttributes(int entryNumber); + /// Gets the attributes of a file or directory. + /// + /// Error number. + /// The entry in the archive for which to retrieve the attributes. + /// File attributes, or zero if the archive does not support attributes. + FileAttributes GetAttributes(int entryNumber); - /// Lists all extended attributes, alternate data streams and forks of the given file. - /// The entry in the archive for which to retrieve the list of attributes. - /// List of extended attributes, alternate data streams and forks. - List GetXAttrs(int entryNumber); + /// Lists all extended attributes, alternate data streams and forks of the given file. + /// The entry in the archive for which to retrieve the list of attributes. + /// List of extended attributes, alternate data streams and forks. + List GetXAttrs(int entryNumber); - /// Reads an extended attribute, alternate data stream or fork from the given file. - /// Error number. - /// The entry in the archive for which to retrieve the XAttr. - /// Extended attribute, alternate data stream or fork name. - /// Buffer with the XAttr data. - ErrorNumber GetXattr(int entryNumber, string xattr, out byte[] buffer); + /// Reads an extended attribute, alternate data stream or fork from the given file. + /// Error number. + /// The entry in the archive for which to retrieve the XAttr. + /// Extended attribute, alternate data stream or fork name. + /// Buffer with the XAttr data. + ErrorNumber GetXattr(int entryNumber, string xattr, out byte[] buffer); - /// Gets information about an entry in the archive. - /// Note that some of the data might be incomplete or not available at all, depending on the type of archive. - /// - /// - /// The entry int he archive for which to get the information - /// The available information about the entry in the archive - FileSystemInfo Stat(int entryNumber); + /// Gets information about an entry in the archive. + /// Note that some of the data might be incomplete or not available at all, depending on the type of archive. + /// + /// + /// The entry int he archive for which to get the information + /// The available information about the entry in the archive + FileSystemInfo Stat(int entryNumber); - /// - /// Returns the Filter for the given entry. It will return null if the entry in question is not a regular - /// file (i.e. directory, volume label, etc.) - /// - /// The entry for which the Filter should be returned. - /// The Filter for the given entry. - IFilter GetEntry(int entryNumber); - } + /// + /// Returns the Filter for the given entry. It will return null if the entry in question is not a regular + /// file (i.e. directory, volume label, etc.) + /// + /// The entry for which the Filter should be returned. + /// The Filter for the given entry. + IFilter GetEntry(int entryNumber); } \ No newline at end of file diff --git a/Interfaces/IChecksum.cs b/Interfaces/IChecksum.cs index 6f9075791..ab9dc9bf2 100644 --- a/Interfaces/IChecksum.cs +++ b/Interfaces/IChecksum.cs @@ -36,24 +36,23 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces +namespace Aaru.CommonTypes.Interfaces; + +/// Defines the interface to implement a checksum or hashing algorithm +public interface IChecksum { - /// Defines the interface to implement a checksum or hashing algorithm - public interface IChecksum - { - /// Updates the hash with data. - /// Data buffer. - /// Length of buffer to hash. - void Update(byte[] data, uint len); + /// Updates the hash with data. + /// Data buffer. + /// Length of buffer to hash. + void Update(byte[] data, uint len); - /// Updates the hash with data. - /// Data buffer. - void Update(byte[] data); + /// Updates the hash with data. + /// Data buffer. + void Update(byte[] data); - /// Returns a byte array of the hash value. - byte[] Final(); + /// Returns a byte array of the hash value. + byte[] Final(); - /// Returns a hexadecimal representation of the hash value. - string End(); - } + /// Returns a hexadecimal representation of the hash value. + string End(); } \ No newline at end of file diff --git a/Interfaces/IFilesystem.cs b/Interfaces/IFilesystem.cs index 18ae3ee42..5bcd46d15 100644 --- a/Interfaces/IFilesystem.cs +++ b/Interfaces/IFilesystem.cs @@ -40,34 +40,33 @@ using System; using System.Text; using Schemas; -namespace Aaru.CommonTypes.Interfaces +namespace Aaru.CommonTypes.Interfaces; + +/// Interface to implement filesystem plugins. +public interface IFilesystem { - /// Interface to implement filesystem plugins. - public interface IFilesystem - { - /// Defines the encoding used to interpret strings in the filesystem - Encoding Encoding { get; } - /// Plugin name. - string Name { get; } - /// Plugin UUID. - Guid Id { get; } - /// Information about the filesystem as expected by CICM Metadata XML - /// Information about the filesystem as expected by CICM Metadata XML - FileSystemType XmlFsType { get; } - /// Plugin author - string Author { get; } + /// Defines the encoding used to interpret strings in the filesystem + Encoding Encoding { get; } + /// Plugin name. + string Name { get; } + /// Plugin UUID. + Guid Id { get; } + /// Information about the filesystem as expected by CICM Metadata XML + /// Information about the filesystem as expected by CICM Metadata XML + FileSystemType XmlFsType { get; } + /// Plugin author + string Author { get; } - /// Identifies the filesystem in the specified LBA - /// Disk image. - /// Partition. - /// true, if the filesystem is recognized, false otherwise. - bool Identify(IMediaImage imagePlugin, Partition partition); + /// Identifies the filesystem in the specified LBA + /// Disk image. + /// Partition. + /// true, if the filesystem is recognized, false otherwise. + bool Identify(IMediaImage imagePlugin, Partition partition); - /// Gets information about the identified filesystem. - /// Disk image. - /// Partition. - /// Filesystem information. - /// Which encoding to use for this filesystem. - void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding); - } + /// Gets information about the identified filesystem. + /// Disk image. + /// Partition. + /// Filesystem information. + /// Which encoding to use for this filesystem. + void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding); } \ No newline at end of file diff --git a/Interfaces/IFilter.cs b/Interfaces/IFilter.cs index 0db3db707..fc3bbfb46 100644 --- a/Interfaces/IFilter.cs +++ b/Interfaces/IFilter.cs @@ -40,108 +40,107 @@ using System; using System.IO; using Aaru.CommonTypes.Enums; -namespace Aaru.CommonTypes.Interfaces +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) +/// +public interface IFilter { + /// Descriptive name of the plugin + string Name { get; } + /// Unique UUID of the plugin + Guid Id { get; } + /// Plugin author + string Author { get; } + /// - /// 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) + /// Gets the path used to open this filter.
UNIX: /path/to/archive.zip/path/to/file.bin => + /// /path/to/archive.zip/path/to/file.bin
Windows: C:\path\to\archive.zip\path\to\file.bin => + /// C:\path\to\archive.zip\path\to\file.bin ///
- public interface IFilter - { - /// Descriptive name of the plugin - string Name { get; } - /// Unique UUID of the plugin - Guid Id { get; } - /// Plugin author - string Author { get; } + /// Path used to open this filter. + string BasePath { get; } - /// - /// Gets the path used to open this filter.
UNIX: /path/to/archive.zip/path/to/file.bin => - /// /path/to/archive.zip/path/to/file.bin
Windows: C:\path\to\archive.zip\path\to\file.bin => - /// C:\path\to\archive.zip\path\to\file.bin - ///
- /// Path used to open this filter. - string BasePath { get; } + /// Gets creation time of file referenced by this filter. + /// The creation time. + DateTime CreationTime { get; } - /// Gets creation time of file referenced by this filter. - /// The creation time. - DateTime CreationTime { get; } + /// Gets length of this filter's data fork. + /// The data fork length. + long DataForkLength { get; } - /// Gets length of this filter's data fork. - /// The data fork length. - long DataForkLength { get; } + /// + /// Gets the filename for the file referenced by this filter.
UNIX: /path/to/archive.zip/path/to/file.bin = + /// > file.bin
Windows: C:\path\to\archive.zip\path\to\file.bin => file.bin + ///
+ /// The filename. + string Filename { get; } - /// - /// Gets the filename for the file referenced by this filter.
UNIX: /path/to/archive.zip/path/to/file.bin = - /// > file.bin
Windows: C:\path\to\archive.zip\path\to\file.bin => file.bin - ///
- /// The filename. - string Filename { get; } + /// Gets last write time of file referenced by this filter. + /// The last write time. + DateTime LastWriteTime { get; } - /// Gets last write time of file referenced by this filter. - /// The last write time. - DateTime LastWriteTime { get; } + /// Gets length of file referenced by ths filter. + /// The length. + long Length { get; } - /// Gets length of file referenced by ths filter. - /// The length. - long Length { get; } + /// + /// Gets full path to file referenced by this filter. If it's an archive, it's the path inside the archive.
+ /// UNIX: /path/to/archive.zip/path/to/file.bin => /path/to/file.bin
Windows: + /// C:\path\to\archive.zip\path\to\file.bin => \path\to\file.bin + ///
+ /// The path. + string Path { get; } - /// - /// Gets full path to file referenced by this filter. If it's an archive, it's the path inside the archive.
- /// UNIX: /path/to/archive.zip/path/to/file.bin => /path/to/file.bin
Windows: - /// C:\path\to\archive.zip\path\to\file.bin => \path\to\file.bin - ///
- /// The path. - string Path { get; } + /// + /// 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 parent folder. + string ParentFolder { get; } - /// - /// 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 parent folder. - string ParentFolder { get; } + /// Gets length of this filter's resource fork. + /// The resource fork length. + long ResourceForkLength { get; } - /// Gets length of this filter's resource fork. - /// The resource fork length. - long ResourceForkLength { get; } + /// Returns true if the file referenced by this filter has a resource fork + bool HasResourceFork { get; } - /// Returns true if the file referenced by this filter has a resource fork - bool HasResourceFork { get; } + /// Closes all opened streams. + void Close(); - /// Closes all opened streams. - void Close(); + /// Gets a stream to access the data fork contents. + /// The data fork stream. + Stream GetDataForkStream(); - /// Gets a stream to access the data fork contents. - /// The data fork stream. - Stream GetDataForkStream(); + /// Gets a stream to access the resource fork contents. + /// The resource fork stream. + Stream GetResourceForkStream(); - /// Gets a stream to access the resource fork contents. - /// The resource fork stream. - Stream GetResourceForkStream(); + /// Identifies if the specified path contains data recognizable by this filter instance + /// Path. + bool Identify(string path); - /// Identifies if the specified path contains data recognizable by this filter instance - /// Path. - bool Identify(string path); + /// Identifies if the specified stream contains data recognizable by this filter instance + /// Stream. + bool Identify(Stream stream); - /// Identifies if the specified stream contains data recognizable by this filter instance - /// Stream. - bool Identify(Stream stream); + /// Identifies if the specified buffer contains data recognizable by this filter instance + /// Buffer. + bool Identify(byte[] buffer); - /// Identifies if the specified buffer contains data recognizable by this filter instance - /// Buffer. - bool Identify(byte[] buffer); + /// Opens the specified path with this filter instance + /// Path. + ErrorNumber Open(string path); - /// Opens the specified path with this filter instance - /// Path. - ErrorNumber Open(string path); + /// Opens the specified stream with this filter instance + /// Stream. + ErrorNumber Open(Stream stream); - /// Opens the specified stream with this filter instance - /// Stream. - ErrorNumber Open(Stream stream); - - /// Opens the specified buffer with this filter instance - /// Buffer. - ErrorNumber Open(byte[] buffer); - } + /// Opens the specified buffer with this filter instance + /// Buffer. + ErrorNumber Open(byte[] buffer); } \ No newline at end of file diff --git a/Interfaces/IFloppyImage.cs b/Interfaces/IFloppyImage.cs index 01a47e095..164c7d943 100644 --- a/Interfaces/IFloppyImage.cs +++ b/Interfaces/IFloppyImage.cs @@ -39,86 +39,85 @@ 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 - /// interface is defined by . All data returned by these - /// methods is already decoded from its corresponding bitstream. - /// - public interface IFloppyImage : IMediaImage - { - /// - /// Floppy info, contains information about physical characteristics of floppy, like size, bitrate, track density, - /// etc... - /// - FloppyInfo FloppyInfo { get; } +namespace Aaru.CommonTypes.Interfaces; - /// Reads a sector's user data. - /// - /// If is one of the duplicates is returned - /// randomly. If is or - /// random data is returned. If is - /// null is returned. Otherwise, whatever is in the sector is - /// returned. - /// - /// Physical track (position of the heads over the floppy media, 0-based). - /// Physical head (0-based). - /// Logical sector ID. - /// Status of request. - ErrorNumber ReadSector(ushort track, byte head, ushort sector, out FloppySectorStatus status, +/// +/// +/// 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 +/// interface is defined by . All data returned by these +/// methods is already decoded from its corresponding bitstream. +/// +public interface IFloppyImage : IMediaImage +{ + /// + /// Floppy info, contains information about physical characteristics of floppy, like size, bitrate, track density, + /// etc... + /// + FloppyInfo FloppyInfo { get; } + + /// Reads a sector's user data. + /// + /// If is one of the duplicates is returned + /// randomly. If is or + /// random data is returned. If is + /// null is returned. Otherwise, whatever is in the sector is + /// returned. + /// + /// Physical track (position of the heads over the floppy media, 0-based). + /// Physical head (0-based). + /// Logical sector ID. + /// Status of request. + ErrorNumber ReadSector(ushort track, byte head, ushort sector, out FloppySectorStatus status, + out byte[] buffer); + + /// Reads a sector's tag. + /// + /// If is one of the duplicates is returned + /// randomly. If is or + /// random data is returned. If is + /// null is returned. Otherwise, whatever tag is in the sector is + /// returned. + /// + /// Physical track (position of the heads over the floppy media, 0-based). + /// Physical head (0-based). + /// Logical sector ID. + /// Status of request. + /// Sector tag + ErrorNumber ReadSectorTag(ushort track, byte head, ushort sector, out FloppySectorStatus status, + SectorTagType tag, out byte[] buffer); + + /// Reads a whole track. It includes all gaps, address marks, sectors data, etc. + /// The track data. + /// Physical track (position of the heads over the floppy media, 0-based). + /// Physical head (0-based). + ErrorNumber ReadTrack(ushort track, byte head, out byte[] buffer); + + /// Reads a sector's data including all tags, address mark, and so, in a format dependent of represented media. + /// + /// If is one of the duplicates is returned + /// randomly. If is or + /// random data is returned. If is + /// null is returned. Otherwise, whatever is in the sector is + /// returned. + /// + /// Physical track (position of the heads over the floppy media, 0-based). + /// Physical head (0-based). + /// Logical sector ID. + /// Status of request. + ErrorNumber ReadSectorLong(ushort track, byte head, ushort sector, out FloppySectorStatus status, out byte[] buffer); - /// Reads a sector's tag. - /// - /// If is one of the duplicates is returned - /// randomly. If is or - /// random data is returned. If is - /// null is returned. Otherwise, whatever tag is in the sector is - /// returned. - /// - /// Physical track (position of the heads over the floppy media, 0-based). - /// Physical head (0-based). - /// Logical sector ID. - /// Status of request. - /// Sector tag - ErrorNumber ReadSectorTag(ushort track, byte head, ushort sector, out FloppySectorStatus status, - SectorTagType tag, out byte[] buffer); + /// Verifies a track. + /// True if correct, false if incorrect, null if uncheckable. + /// Physical track (position of the heads over the floppy media, 0-based). + /// Physical head (0-based). + bool? VerifyTrack(ushort track, byte head); - /// Reads a whole track. It includes all gaps, address marks, sectors data, etc. - /// The track data. - /// Physical track (position of the heads over the floppy media, 0-based). - /// Physical head (0-based). - ErrorNumber ReadTrack(ushort track, byte head, out byte[] buffer); - - /// Reads a sector's data including all tags, address mark, and so, in a format dependent of represented media. - /// - /// If is one of the duplicates is returned - /// randomly. If is or - /// random data is returned. If is - /// null is returned. Otherwise, whatever is in the sector is - /// returned. - /// - /// Physical track (position of the heads over the floppy media, 0-based). - /// Physical head (0-based). - /// Logical sector ID. - /// Status of request. - ErrorNumber ReadSectorLong(ushort track, byte head, ushort sector, out FloppySectorStatus status, - out byte[] buffer); - - /// Verifies a track. - /// True if correct, false if incorrect, null if uncheckable. - /// Physical track (position of the heads over the floppy media, 0-based). - /// Physical head (0-based). - bool? VerifyTrack(ushort track, byte head); - - /// Verifies a sector, relative to track. - /// True if correct, false if incorrect, null if uncheckable. - /// Physical track (position of the heads over the floppy media, 0-based). - /// Physical head (0-based). - /// Logical sector ID. - bool? VerifySector(ushort track, byte head, ushort sector); - } + /// Verifies a sector, relative to track. + /// True if correct, false if incorrect, null if uncheckable. + /// Physical track (position of the heads over the floppy media, 0-based). + /// Physical head (0-based). + /// Logical sector ID. + bool? VerifySector(ushort track, byte head, ushort sector); } \ No newline at end of file diff --git a/Interfaces/IOpticalMediaImage.cs b/Interfaces/IOpticalMediaImage.cs index be445c26a..617045fc8 100644 --- a/Interfaces/IOpticalMediaImage.cs +++ b/Interfaces/IOpticalMediaImage.cs @@ -40,84 +40,83 @@ using System.Collections.Generic; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; -namespace Aaru.CommonTypes.Interfaces +namespace Aaru.CommonTypes.Interfaces; + +/// +/// Abstract class to implement disk image reading plugins. +public interface IOpticalMediaImage : IMediaImage, IPartitionableMediaImage, IVerifiableSectorsImage { - /// - /// Abstract class to implement disk image reading plugins. - public interface IOpticalMediaImage : IMediaImage, IPartitionableMediaImage, IVerifiableSectorsImage - { - /// Gets the disc track extents (start, length). - /// The track extents. - List Tracks { get; } - /// Gets the sessions (optical discs only). - /// The sessions. - List Sessions { get; } + /// Gets the disc track extents (start, length). + /// The track extents. + List Tracks { get; } + /// Gets the sessions (optical discs only). + /// The sessions. + List Sessions { get; } - /// Reads a sector's user data, relative to track. - /// The sector's user data. - /// Sector address (relative LBA). - /// Track. - /// - ErrorNumber ReadSector(ulong sectorAddress, uint track, out byte[] buffer); + /// Reads a sector's user data, relative to track. + /// The sector's user data. + /// Sector address (relative LBA). + /// Track. + /// + ErrorNumber ReadSector(ulong sectorAddress, uint track, out byte[] buffer); - /// Reads a sector's tag, relative to track. - /// The sector's tag. - /// Sector address (relative LBA). - /// Track. - /// Tag type. - /// - ErrorNumber ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag, out byte[] buffer); + /// Reads a sector's tag, relative to track. + /// The sector's tag. + /// Sector address (relative LBA). + /// Track. + /// Tag type. + /// + ErrorNumber ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag, out byte[] buffer); - /// Reads user data from several sectors, relative to track. - /// The sectors user data. - /// Starting sector address (relative LBA). - /// How many sectors to read. - /// Track. - /// - ErrorNumber ReadSectors(ulong sectorAddress, uint length, uint track, out byte[] buffer); + /// Reads user data from several sectors, relative to track. + /// The sectors user data. + /// Starting sector address (relative LBA). + /// How many sectors to read. + /// Track. + /// + ErrorNumber ReadSectors(ulong sectorAddress, uint length, uint track, out byte[] buffer); - /// Reads tag from several sectors, relative to track. - /// The sectors tag. - /// Starting sector address (relative LBA). - /// How many sectors to read. - /// Track. - /// Tag type. - /// - ErrorNumber ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag, out byte[] buffer); + /// Reads tag from several sectors, relative to track. + /// The sectors tag. + /// Starting sector address (relative LBA). + /// How many sectors to read. + /// Track. + /// Tag type. + /// + ErrorNumber ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag, out byte[] buffer); - /// Reads a complete sector (user data + all tags), relative to track. - /// The complete sector. Format depends on disk type. - /// Sector address (relative LBA). - /// Track. - /// - ErrorNumber ReadSectorLong(ulong sectorAddress, uint track, out byte[] buffer); + /// Reads a complete sector (user data + all tags), relative to track. + /// The complete sector. Format depends on disk type. + /// Sector address (relative LBA). + /// Track. + /// + ErrorNumber ReadSectorLong(ulong sectorAddress, uint track, out byte[] buffer); - /// Reads several complete sector (user data + all tags), relative to track. - /// The complete sectors. Format depends on disk type. - /// Starting sector address (relative LBA). - /// How many sectors to read. - /// Track. - /// - ErrorNumber ReadSectorsLong(ulong sectorAddress, uint length, uint track, out byte[] buffer); + /// Reads several complete sector (user data + all tags), relative to track. + /// The complete sectors. Format depends on disk type. + /// Starting sector address (relative LBA). + /// How many sectors to read. + /// Track. + /// + ErrorNumber ReadSectorsLong(ulong sectorAddress, uint length, uint track, out byte[] buffer); - /// Gets the disc track extents for a specified session. - /// The track extents for that session. - /// Session. - List GetSessionTracks(Session session); + /// Gets the disc track extents for a specified session. + /// The track extents for that session. + /// Session. + List GetSessionTracks(Session session); - /// Gets the disc track extents for a specified session. - /// The track extents for that session. - /// Session. - List GetSessionTracks(ushort session); + /// Gets the disc track extents for a specified session. + /// The track extents for that session. + /// Session. + List GetSessionTracks(ushort session); - /// Verifies several sectors, relative to track. - /// True if all are correct, false if any is incorrect, null if any is uncheckable. - /// Starting sector address (relative LBA). - /// How many sectors to read. - /// Track. - /// List of incorrect sectors - /// List of uncheckable sectors - bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, - out List unknownLbas); - } + /// Verifies several sectors, relative to track. + /// True if all are correct, false if any is incorrect, null if any is uncheckable. + /// Starting sector address (relative LBA). + /// How many sectors to read. + /// Track. + /// List of incorrect sectors + /// List of uncheckable sectors + bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, + out List unknownLbas); } \ No newline at end of file diff --git a/Interfaces/IPartition.cs b/Interfaces/IPartition.cs index bfb91184d..c1eb4fa7e 100644 --- a/Interfaces/IPartition.cs +++ b/Interfaces/IPartition.cs @@ -40,23 +40,22 @@ using System; using System.Collections.Generic; -namespace Aaru.CommonTypes.Interfaces -{ - /// Abstract class to implement partitioning schemes interpreting plugins. - public interface IPartition - { - /// Plugin name. - string Name { get; } - /// Plugin UUID. - Guid Id { get; } - /// Plugin author - string Author { get; } +namespace Aaru.CommonTypes.Interfaces; - /// Interprets a partitioning scheme. - /// true, if partitioning scheme is recognized, false otherwise. - /// Disk image. - /// Returns list of partitions. - /// At which sector to start searching for the partition scheme. - bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset); - } +/// Abstract class to implement partitioning schemes interpreting plugins. +public interface IPartition +{ + /// Plugin name. + string Name { get; } + /// Plugin UUID. + Guid Id { get; } + /// Plugin author + string Author { get; } + + /// Interprets a partitioning scheme. + /// true, if partitioning scheme is recognized, false otherwise. + /// Disk image. + /// Returns list of partitions. + /// At which sector to start searching for the partition scheme. + bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset); } \ No newline at end of file diff --git a/Interfaces/IPartitionableMediaImage.cs b/Interfaces/IPartitionableMediaImage.cs index 06ef13a0d..f4529bf01 100644 --- a/Interfaces/IPartitionableMediaImage.cs +++ b/Interfaces/IPartitionableMediaImage.cs @@ -39,16 +39,15 @@ using System.Collections.Generic; -namespace Aaru.CommonTypes.Interfaces +namespace Aaru.CommonTypes.Interfaces; + +/// Defines an image that can contain partitions +public interface IPartitionableMediaImage { - /// Defines an image that can contain partitions - public interface IPartitionableMediaImage - { - /// - /// Gets an array partitions. Typically only useful for optical disc images where each track and index means a - /// different partition, as reads can be relative to them. - /// - /// The partitions. - List Partitions { get; } - } + /// + /// Gets an array partitions. Typically only useful for optical disc images where each track and index means a + /// different partition, as reads can be relative to them. + /// + /// The partitions. + List Partitions { get; } } \ No newline at end of file diff --git a/Interfaces/IReadOnlyFilesystem.cs b/Interfaces/IReadOnlyFilesystem.cs index 3787c326f..c8c526a01 100644 --- a/Interfaces/IReadOnlyFilesystem.cs +++ b/Interfaces/IReadOnlyFilesystem.cs @@ -43,83 +43,82 @@ using System.Text; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; -namespace Aaru.CommonTypes.Interfaces +namespace Aaru.CommonTypes.Interfaces; + +/// +/// Defines the interface to implement reading the contents of a filesystem +public interface IReadOnlyFilesystem : IFilesystem { - /// - /// Defines the interface to implement reading the contents of a filesystem - public interface IReadOnlyFilesystem : IFilesystem - { - /// Retrieves a list of options supported by the filesystem, with name, type and description - IEnumerable<(string name, Type type, string description)> SupportedOptions { get; } + /// Retrieves a list of options supported by the filesystem, with name, type and description + IEnumerable<(string name, Type type, string description)> SupportedOptions { get; } - /// Supported namespaces - Dictionary Namespaces { get; } + /// Supported namespaces + Dictionary Namespaces { get; } - /// - /// Initializes whatever internal structures the filesystem plugin needs to be able to read files and directories - /// from the filesystem. - /// - /// - /// - /// Which encoding to use for this filesystem. - /// Dictionary of key=value pairs containing options to pass to the filesystem - /// Filename namespace - ErrorNumber Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, - Dictionary options, string @namespace); + /// + /// Initializes whatever internal structures the filesystem plugin needs to be able to read files and directories + /// from the filesystem. + /// + /// + /// + /// Which encoding to use for this filesystem. + /// Dictionary of key=value pairs containing options to pass to the filesystem + /// Filename namespace + ErrorNumber Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, + Dictionary options, string @namespace); - /// Frees all internal structures created by - ErrorNumber Unmount(); + /// Frees all internal structures created by + ErrorNumber Unmount(); - /// Maps a filesystem block from a file to a block from the underlying device. - /// Error number. - /// File path. - /// File block. - /// Device block. - ErrorNumber MapBlock(string path, long fileBlock, out long deviceBlock); + /// Maps a filesystem block from a file to a block from the underlying device. + /// Error number. + /// File path. + /// File block. + /// Device block. + ErrorNumber MapBlock(string path, long fileBlock, out long deviceBlock); - /// Gets the attributes of a file or directory - /// Error number. - /// File path. - /// File attributes. - ErrorNumber GetAttributes(string path, out FileAttributes attributes); + /// Gets the attributes of a file or directory + /// Error number. + /// File path. + /// File attributes. + ErrorNumber GetAttributes(string path, out FileAttributes attributes); - /// Lists all extended attributes, alternate data streams and forks of the given file. - /// Error number. - /// Path. - /// List of extended attributes, alternate data streams and forks. - ErrorNumber ListXAttr(string path, out List xattrs); + /// Lists all extended attributes, alternate data streams and forks of the given file. + /// Error number. + /// Path. + /// List of extended attributes, alternate data streams and forks. + ErrorNumber ListXAttr(string path, out List xattrs); - /// Reads an extended attribute, alternate data stream or fork from the given file. - /// Error number. - /// File path. - /// Extended attribute, alternate data stream or fork name. - /// Buffer. - ErrorNumber GetXattr(string path, string xattr, ref byte[] buf); + /// Reads an extended attribute, alternate data stream or fork from the given file. + /// Error number. + /// File path. + /// Extended attribute, alternate data stream or fork name. + /// Buffer. + ErrorNumber GetXattr(string path, string xattr, ref byte[] buf); - /// Reads data from a file (main/only data stream or data fork). - /// File path. - /// Offset. - /// Bytes to read. - /// Buffer. - ErrorNumber Read(string path, long offset, long size, ref byte[] buf); + /// Reads data from a file (main/only data stream or data fork). + /// File path. + /// Offset. + /// Bytes to read. + /// Buffer. + ErrorNumber Read(string path, long offset, long size, ref byte[] buf); - /// Lists contents from a directory. - /// Directory path. - /// Directory contents. - ErrorNumber ReadDir(string path, out List contents); + /// Lists contents from a directory. + /// Directory path. + /// Directory contents. + ErrorNumber ReadDir(string path, out List contents); - /// Gets information about the mounted volume. - /// Information about the mounted volume. - ErrorNumber StatFs(out FileSystemInfo stat); + /// Gets information about the mounted volume. + /// Information about the mounted volume. + ErrorNumber StatFs(out FileSystemInfo stat); - /// Gets information about a file or directory. - /// File path. - /// File information. - ErrorNumber Stat(string path, out FileEntryInfo stat); + /// Gets information about a file or directory. + /// File path. + /// File information. + ErrorNumber Stat(string path, out FileEntryInfo stat); - /// Solves a symbolic link. - /// Link path. - /// Link destination. - ErrorNumber ReadLink(string path, out string dest); - } + /// Solves a symbolic link. + /// Link path. + /// Link destination. + ErrorNumber ReadLink(string path, out string dest); } \ No newline at end of file diff --git a/Interfaces/ITapeImage.cs b/Interfaces/ITapeImage.cs index 69b1c37a2..028cc64c4 100644 --- a/Interfaces/ITapeImage.cs +++ b/Interfaces/ITapeImage.cs @@ -40,17 +40,16 @@ using System.Collections.Generic; using Aaru.CommonTypes.Structs; -namespace Aaru.CommonTypes.Interfaces +namespace Aaru.CommonTypes.Interfaces; + +/// +/// Defines an image that can store the information from streaming, digital, tapes +public interface ITapeImage : IMediaImage { - /// - /// Defines an image that can store the information from streaming, digital, tapes - public interface ITapeImage : IMediaImage - { - /// Gets a list of all the files registered in the image - List Files { get; } - /// Gets a list of all the partitions registered in the image - List TapePartitions { get; } - /// If the media is a really a tape, as some formats can store non-tapes - bool IsTape { get; } - } + /// Gets a list of all the files registered in the image + List Files { get; } + /// Gets a list of all the partitions registered in the image + List TapePartitions { get; } + /// If the media is a really a tape, as some formats can store non-tapes + bool IsTape { get; } } \ No newline at end of file diff --git a/Interfaces/IVerifiableImage.cs b/Interfaces/IVerifiableImage.cs index 74db05b0c..d66b95c8e 100644 --- a/Interfaces/IVerifiableImage.cs +++ b/Interfaces/IVerifiableImage.cs @@ -37,13 +37,12 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Interfaces +namespace Aaru.CommonTypes.Interfaces; + +/// Defines an image that can verify the integrity of the image itself, but not its contents +public interface IVerifiableImage { - /// Defines an image that can verify the integrity of the image itself, but not its contents - public interface IVerifiableImage - { - /// Verifies media image internal checksum. - /// True if correct, false if incorrect, null if there is no internal checksum available - bool? VerifyMediaImage(); - } + /// Verifies media image internal checksum. + /// True if correct, false if incorrect, null if there is no internal checksum available + bool? VerifyMediaImage(); } \ No newline at end of file diff --git a/Interfaces/IVerifiableSectorsImage.cs b/Interfaces/IVerifiableSectorsImage.cs index a8cd6dea6..0b46701b3 100644 --- a/Interfaces/IVerifiableSectorsImage.cs +++ b/Interfaces/IVerifiableSectorsImage.cs @@ -39,22 +39,21 @@ using System.Collections.Generic; -namespace Aaru.CommonTypes.Interfaces -{ - /// Defines an image that can verify the integrity of the sectors it contains - public interface IVerifiableSectorsImage - { - /// Verifies a sector. - /// True if correct, false if incorrect, null if uncheckable. - /// Sector address (LBA). - bool? VerifySector(ulong sectorAddress); +namespace Aaru.CommonTypes.Interfaces; - /// Verifies several sectors. - /// True if all are correct, false if any is incorrect, null if any is uncheckable. - /// Starting sector address (LBA). - /// How many sectors to read. - /// List of incorrect sectors - /// List of uncheckable sectors - bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, out List unknownLbas); - } +/// Defines an image that can verify the integrity of the sectors it contains +public interface IVerifiableSectorsImage +{ + /// Verifies a sector. + /// True if correct, false if incorrect, null if uncheckable. + /// Sector address (LBA). + bool? VerifySector(ulong sectorAddress); + + /// Verifies several sectors. + /// True if all are correct, false if any is incorrect, null if any is uncheckable. + /// Starting sector address (LBA). + /// How many sectors to read. + /// List of incorrect sectors + /// List of uncheckable sectors + bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas, out List unknownLbas); } \ No newline at end of file diff --git a/Interfaces/IWritableFloppyImage.cs b/Interfaces/IWritableFloppyImage.cs index 1cb26e387..ca8b270cf 100644 --- a/Interfaces/IWritableFloppyImage.cs +++ b/Interfaces/IWritableFloppyImage.cs @@ -39,59 +39,58 @@ using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; -namespace Aaru.CommonTypes.Interfaces +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 necessarily compatible with the whole LBA-oriented +/// interface defined by . All data expected by these methods +/// is already decoded from its corresponding bitstream. +/// +public interface IWritableFloppyImage : IFloppyImage, IWritableImage { - /// /// - /// Abstract class to implement disk image reading plugins that can contain floppy images. This interface is - /// needed because floppy formatting characteristics are not necessarily compatible with the whole LBA-oriented - /// interface defined by . All data expected by these methods - /// is already decoded from its corresponding bitstream. + /// Indicates the image plugin the floppy physical characteristics and must be called before following methods are + /// called. Once this is called, LBA-based methods should not be used. /// - public interface IWritableFloppyImage : IFloppyImage, IWritableImage - { - /// - /// Indicates the image plugin the floppy physical characteristics and must be called before following methods are - /// called. Once this is called, LBA-based methods should not be used. - /// - /// - /// Floppy info, contains information about physical characteristics of floppy, like size, bitrate, - /// track density, etc... - /// - /// true if operating completed successfully, false otherwise - bool SetFloppyCharacteristics(FloppyInfo info); + /// + /// Floppy info, contains information about physical characteristics of floppy, like size, bitrate, + /// track density, etc... + /// + /// true if operating completed successfully, false otherwise + bool SetFloppyCharacteristics(FloppyInfo info); - /// Writes a sector's user data. - /// - /// If is one of the duplicates. If - /// is , , - /// it will be ignored. Otherwise, whatever data should be in the sector. - /// - /// Physical track (position of the heads over the floppy media, 0-based). - /// Physical head (0-based). - /// Logical sector ID. - /// Status of sector. - /// true if operating completed successfully, false otherwise - bool WriteSector(byte[] data, ushort track, byte head, ushort sector, FloppySectorStatus status); + /// Writes a sector's user data. + /// + /// If is one of the duplicates. If + /// is , , + /// it will be ignored. Otherwise, whatever data should be in the sector. + /// + /// Physical track (position of the heads over the floppy media, 0-based). + /// Physical head (0-based). + /// Logical sector ID. + /// Status of sector. + /// true if operating completed successfully, false otherwise + bool WriteSector(byte[] data, ushort track, byte head, ushort sector, FloppySectorStatus status); - /// Writes a whole track, including all gaps, address marks, sectors data, etc. - /// The track data. - /// Physical track (position of the heads over the floppy media, 0-based). - /// Physical head (0-based). - /// true if operating completed successfully, false otherwise - bool WriteTrack(byte[] data, ushort track, byte head); + /// Writes a whole track, including all gaps, address marks, sectors data, etc. + /// The track data. + /// Physical track (position of the heads over the floppy media, 0-based). + /// Physical head (0-based). + /// true if operating completed successfully, false otherwise + bool WriteTrack(byte[] data, ushort track, byte head); - /// Writes a sector's data including all tags, address mark, and so, in a format dependent of represented media. - /// - /// If is one of the duplicates. If - /// is , , - /// it will be ignored. Otherwise, whatever data should be in the sector. - /// - /// Physical track (position of the heads over the floppy media, 0-based). - /// Physical head (0-based). - /// Logical sector ID. - /// Status of request. - /// true if operating completed successfully, false otherwise - bool WriteSectorLong(byte[] data, ushort track, byte head, ushort sector, out FloppySectorStatus status); - } + /// Writes a sector's data including all tags, address mark, and so, in a format dependent of represented media. + /// + /// If is one of the duplicates. If + /// is , , + /// it will be ignored. Otherwise, whatever data should be in the sector. + /// + /// Physical track (position of the heads over the floppy media, 0-based). + /// Physical head (0-based). + /// Logical sector ID. + /// Status of request. + /// true if operating completed successfully, false otherwise + bool WriteSectorLong(byte[] data, ushort track, byte head, ushort sector, out FloppySectorStatus status); } \ No newline at end of file diff --git a/Interfaces/IWritableOpticalImage.cs b/Interfaces/IWritableOpticalImage.cs index 8e30dbeda..d22f30af3 100644 --- a/Interfaces/IWritableOpticalImage.cs +++ b/Interfaces/IWritableOpticalImage.cs @@ -40,17 +40,16 @@ 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 - { - /// Image format capabilities - OpticalImageCapabilities OpticalCapabilities { get; } +namespace Aaru.CommonTypes.Interfaces; - /// Sets tracks for optical media - /// List of tracks - /// true if operating completed successfully, false otherwise - bool SetTracks(List tracks); - } +/// Defines an image that is writable and can store an optical disc (CD, DVD, etc) +public interface IWritableOpticalImage : IWritableImage, IOpticalMediaImage +{ + /// Image format capabilities + OpticalImageCapabilities OpticalCapabilities { get; } + + /// Sets tracks for optical media + /// List of tracks + /// true if operating completed successfully, false otherwise + bool SetTracks(List tracks); } \ No newline at end of file diff --git a/Interfaces/IWritableTapeImage.cs b/Interfaces/IWritableTapeImage.cs index 752ec4fb9..d3f0b5a27 100644 --- a/Interfaces/IWritableTapeImage.cs +++ b/Interfaces/IWritableTapeImage.cs @@ -39,26 +39,25 @@ using Aaru.CommonTypes.Structs; -namespace Aaru.CommonTypes.Interfaces +namespace Aaru.CommonTypes.Interfaces; + +/// Defines an image that is writable and can store information about a streaming, digital, tape +public interface IWritableTapeImage : ITapeImage, IWritableImage { - /// Defines an image that is writable and can store information about a streaming, digital, tape - public interface IWritableTapeImage : ITapeImage, IWritableImage - { - /// Registers a new file in the image - /// Tape file descriptor - /// true if successful, false otherwise - bool AddFile(TapeFile file); + /// Registers a new file in the image + /// Tape file descriptor + /// true if successful, false otherwise + bool AddFile(TapeFile file); - /// Registers a new partition - /// Tape partition descriptor - /// true if successful, false otherwise - bool AddPartition(TapePartition partition); + /// Registers a new partition + /// Tape partition descriptor + /// true if successful, false otherwise + bool AddPartition(TapePartition partition); - /// - /// Tells the image plugin to set the internal structures to expect a tape (e.g. unknown block count and size). - /// Must be called before - /// - /// true if successful, false otherwise - bool SetTape(); - } + /// + /// Tells the image plugin to set the internal structures to expect a tape (e.g. unknown block count and size). + /// Must be called before + /// + /// true if successful, false otherwise + bool SetTape(); } \ No newline at end of file diff --git a/Interop/DetectOS.cs b/Interop/DetectOS.cs index 274a9d2c9..efc247595 100644 --- a/Interop/DetectOS.cs +++ b/Interop/DetectOS.cs @@ -42,349 +42,348 @@ using System.IO; using System.Runtime.InteropServices; using System.Security.Principal; -namespace Aaru.CommonTypes.Interop +namespace Aaru.CommonTypes.Interop; + +/// Detects the underlying execution framework and operating system +public static class DetectOS { - /// Detects the underlying execution framework and operating system - public static class DetectOS + /// Are we running under Mono? + public static readonly bool IsMono = + RuntimeInformation.FrameworkDescription.StartsWith("Mono", StringComparison.Ordinal); + /// Are we running under .NET Framework? + public static readonly bool IsNetFramework = + RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.Ordinal); + /// Are we running under .NET Core? + public static readonly bool IsNetCore = + RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.Ordinal); + /// Are we running under .NET Native? + public static readonly bool IsNetNative = + RuntimeInformation.FrameworkDescription.StartsWith(".NET Native", StringComparison.Ordinal); + + /// Checks if the underlying runtime runs in 64-bit mode + public static readonly bool Is64Bit = IntPtr.Size == 8; + + /// Checks if the underlying runtime runs in 32-bit mode + public static readonly bool Is32Bit = IntPtr.Size == 4; + + /// Are we running under Windows? + public static bool IsWindows => GetRealPlatformID() == PlatformID.Win32NT || + GetRealPlatformID() == PlatformID.Win32S || + GetRealPlatformID() == PlatformID.Win32Windows || + GetRealPlatformID() == PlatformID.WinCE || + GetRealPlatformID() == PlatformID.WindowsPhone || + GetRealPlatformID() == PlatformID.Xbox; + + /// Are we running with administrative (root) privileges? + public static bool IsAdmin { - /// Are we running under Mono? - public static readonly bool IsMono = - RuntimeInformation.FrameworkDescription.StartsWith("Mono", StringComparison.Ordinal); - /// Are we running under .NET Framework? - public static readonly bool IsNetFramework = - RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.Ordinal); - /// Are we running under .NET Core? - public static readonly bool IsNetCore = - RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.Ordinal); - /// Are we running under .NET Native? - public static readonly bool IsNetNative = - RuntimeInformation.FrameworkDescription.StartsWith(".NET Native", StringComparison.Ordinal); - - /// Checks if the underlying runtime runs in 64-bit mode - public static readonly bool Is64Bit = IntPtr.Size == 8; - - /// Checks if the underlying runtime runs in 32-bit mode - public static readonly bool Is32Bit = IntPtr.Size == 4; - - /// Are we running under Windows? - public static bool IsWindows => GetRealPlatformID() == PlatformID.Win32NT || - GetRealPlatformID() == PlatformID.Win32S || - GetRealPlatformID() == PlatformID.Win32Windows || - GetRealPlatformID() == PlatformID.WinCE || - GetRealPlatformID() == PlatformID.WindowsPhone || - GetRealPlatformID() == PlatformID.Xbox; - - /// Are we running with administrative (root) privileges? - public static bool IsAdmin + get { - get + if(!IsWindows) + return Environment.UserName == "root"; + + bool isAdmin; + WindowsIdentity user = null; + + try { - if(!IsWindows) - return Environment.UserName == "root"; - - bool isAdmin; - WindowsIdentity user = null; - - try - { - user = WindowsIdentity.GetCurrent(); - var principal = new WindowsPrincipal(user); - isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator); - } - catch(UnauthorizedAccessException) - { - isAdmin = false; - } - catch(Exception) - { - isAdmin = false; - } - finally - { - user?.Dispose(); - } - - return isAdmin; + user = WindowsIdentity.GetCurrent(); + var principal = new WindowsPrincipal(user); + isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator); } - } - - [DllImport("libc", SetLastError = true)] - static extern int uname(out utsname name); - - [DllImport("libc", SetLastError = true, EntryPoint = "sysctlbyname", CharSet = CharSet.Ansi)] - static extern int OSX_sysctlbyname(string name, IntPtr oldp, IntPtr oldlenp, IntPtr newp, uint newlen); - - /// Gets the real platform ID, not the incomplete .NET framework one - /// Platform ID - /// Unhandled exception - public static PlatformID GetRealPlatformID() - { - if((int)Environment.OSVersion.Platform < 4 || - (int)Environment.OSVersion.Platform == 5) - return (PlatformID)(int)Environment.OSVersion.Platform; - - int error = uname(out utsname unixname); - - if(error != 0) - throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); - - switch(unixname.sysname) + catch(UnauthorizedAccessException) { - // TODO: Differentiate Linux, Android, Tizen - case "Linux": - { - #if __ANDROID__ + isAdmin = false; + } + catch(Exception) + { + isAdmin = false; + } + finally + { + user?.Dispose(); + } + + return isAdmin; + } + } + + [DllImport("libc", SetLastError = true)] + static extern int uname(out utsname name); + + [DllImport("libc", SetLastError = true, EntryPoint = "sysctlbyname", CharSet = CharSet.Ansi)] + static extern int OSX_sysctlbyname(string name, IntPtr oldp, IntPtr oldlenp, IntPtr newp, uint newlen); + + /// Gets the real platform ID, not the incomplete .NET framework one + /// Platform ID + /// Unhandled exception + public static PlatformID GetRealPlatformID() + { + if((int)Environment.OSVersion.Platform < 4 || + (int)Environment.OSVersion.Platform == 5) + return (PlatformID)(int)Environment.OSVersion.Platform; + + int error = uname(out utsname unixname); + + if(error != 0) + throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); + + switch(unixname.sysname) + { + // TODO: Differentiate Linux, Android, Tizen + case "Linux": + { + #if __ANDROID__ return PlatformID.Android; - #else - return PlatformID.Linux; - #endif + #else + return PlatformID.Linux; + #endif + } + + case "Darwin": + { + IntPtr pLen = Marshal.AllocHGlobal(sizeof(int)); + int osxError = OSX_sysctlbyname("hw.machine", IntPtr.Zero, pLen, IntPtr.Zero, 0); + + if(osxError != 0) + { + Marshal.FreeHGlobal(pLen); + + throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); } - case "Darwin": + int length = Marshal.ReadInt32(pLen); + IntPtr pStr = Marshal.AllocHGlobal(length); + osxError = OSX_sysctlbyname("hw.machine", pStr, pLen, IntPtr.Zero, 0); + + if(osxError != 0) { - IntPtr pLen = Marshal.AllocHGlobal(sizeof(int)); - int osxError = OSX_sysctlbyname("hw.machine", IntPtr.Zero, pLen, IntPtr.Zero, 0); - - if(osxError != 0) - { - Marshal.FreeHGlobal(pLen); - - throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); - } - - int length = Marshal.ReadInt32(pLen); - IntPtr pStr = Marshal.AllocHGlobal(length); - osxError = OSX_sysctlbyname("hw.machine", pStr, pLen, IntPtr.Zero, 0); - - if(osxError != 0) - { - Marshal.FreeHGlobal(pStr); - Marshal.FreeHGlobal(pLen); - - throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); - } - - string machine = Marshal.PtrToStringAnsi(pStr); - Marshal.FreeHGlobal(pStr); Marshal.FreeHGlobal(pLen); - if(machine != null && - (machine.StartsWith("iPad", StringComparison.Ordinal) || - machine.StartsWith("iPod", StringComparison.Ordinal) || - machine.StartsWith("iPhone", StringComparison.Ordinal))) - return PlatformID.iOS; - - return PlatformID.MacOSX; + throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}"); } - 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) || - unixname.sysname.StartsWith("MINGW32_NT", StringComparison.Ordinal) || - unixname.sysname.StartsWith("MSYS_NT", StringComparison.Ordinal) || - unixname.sysname.StartsWith("UWIN", StringComparison.Ordinal)) - return PlatformID.Win32NT; + string machine = Marshal.PtrToStringAnsi(pStr); - return PlatformID.Unknown; - } + Marshal.FreeHGlobal(pStr); + Marshal.FreeHGlobal(pLen); + + if(machine != null && + (machine.StartsWith("iPad", StringComparison.Ordinal) || + machine.StartsWith("iPod", StringComparison.Ordinal) || + machine.StartsWith("iPhone", StringComparison.Ordinal))) + return PlatformID.iOS; + + return PlatformID.MacOSX; } - } - /// Gets a string for the current operating system REAL version (handles Darwin 1.4 and Windows 10 falsifying) - /// Current operating system version - public static string GetVersion() - { - string environ = Environment.OSVersion.Version.ToString(); - - switch(GetRealPlatformID()) + 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: { - case PlatformID.MacOSX: - if(Environment.OSVersion.Version.Major != 1) - return $"10.{Environment.OSVersion.Version.Major - 4}.{Environment.OSVersion.Version.Minor}"; + if(unixname.sysname.StartsWith("CYGWIN_NT", StringComparison.Ordinal) || + unixname.sysname.StartsWith("MINGW32_NT", StringComparison.Ordinal) || + unixname.sysname.StartsWith("MSYS_NT", StringComparison.Ordinal) || + unixname.sysname.StartsWith("UWIN", StringComparison.Ordinal)) + return PlatformID.Win32NT; - switch(Environment.OSVersion.Version.Minor) - { - 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) || - Environment.OSVersion.Version.Major > 6) - return FileVersionInfo. - GetVersionInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), - "KERNEL32.DLL")).ProductVersion; - - return environ; - default: return environ; + return PlatformID.Unknown; } } - - /// From a platform ID and version returns a human-readable version - /// Platform ID - /// Version number - /// Operating system name - public static string GetPlatformName(PlatformID id, string version = null) - { - 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.Linux: - if(!File.Exists("/proc/version")) - return "Linux"; - - string s = File.ReadAllText("/proc/version"); - - return s.Contains("Microsoft") || s.Contains("WSL") ? "Windows Subsystem for Linux" : "Linux"; - - case PlatformID.MacOSX: - if(string.IsNullOrEmpty(version)) - return "macOS"; - - string[] pieces = version.Split('.'); - - if(pieces.Length < 2 || - !int.TryParse(pieces[1], out int minor)) - return "macOS"; - - if(minor >= 12) - return "macOS"; - - if(minor >= 8) - return "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.Win32NT: - if(string.IsNullOrEmpty(version)) - return "Windows NT/2000/XP/Vista/7/10"; - - if(version.StartsWith("3.", StringComparison.Ordinal) || - version.StartsWith("4.", StringComparison.Ordinal)) - return "Windows NT"; - - if(version.StartsWith("5.0", StringComparison.Ordinal)) - return "Windows 2000"; - - if(version.StartsWith("5.1", StringComparison.Ordinal)) - return "Windows XP"; - - if(version.StartsWith("5.2", StringComparison.Ordinal)) - return "Windows 2003"; - - if(version.StartsWith("6.0", StringComparison.Ordinal)) - return "Windows Vista"; - - if(version.StartsWith("6.1", StringComparison.Ordinal)) - return "Windows 7"; - - if(version.StartsWith("6.2", StringComparison.Ordinal)) - return "Windows 8"; - - if(version.StartsWith("6.3", StringComparison.Ordinal)) - return "Windows 8.1"; - - if(version.StartsWith("10.0", StringComparison.Ordinal)) - return "Windows 10"; - - 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"; - - if(version.StartsWith("4.0", StringComparison.Ordinal)) - return "Windows 95"; - - if(version.StartsWith("4.10.2222", StringComparison.Ordinal)) - return "Windows 98 SE"; - - if(version.StartsWith("4.1", StringComparison.Ordinal)) - return "Windows 98"; - - if(version.StartsWith("4.9", StringComparison.Ordinal)) - 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"; - default: return id.ToString(); - } - } - - /// POSIX uname structure, size from OSX, big enough to handle extra fields - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] - struct utsname - { - /// System name - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public readonly string sysname; - /// Node name - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public readonly string nodename; - /// Release level - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public readonly string release; - /// Version level - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public readonly string version; - /// Hardware level - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] - public readonly string machine; - } + } + + /// Gets a string for the current operating system REAL version (handles Darwin 1.4 and Windows 10 falsifying) + /// Current operating system version + public static string GetVersion() + { + string environ = Environment.OSVersion.Version.ToString(); + + switch(GetRealPlatformID()) + { + case PlatformID.MacOSX: + if(Environment.OSVersion.Version.Major != 1) + 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"; + } + + 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) || + Environment.OSVersion.Version.Major > 6) + return FileVersionInfo. + GetVersionInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), + "KERNEL32.DLL")).ProductVersion; + + return environ; + default: return environ; + } + } + + /// From a platform ID and version returns a human-readable version + /// Platform ID + /// Version number + /// Operating system name + public static string GetPlatformName(PlatformID id, string version = null) + { + 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.Linux: + if(!File.Exists("/proc/version")) + return "Linux"; + + string s = File.ReadAllText("/proc/version"); + + return s.Contains("Microsoft") || s.Contains("WSL") ? "Windows Subsystem for Linux" : "Linux"; + + case PlatformID.MacOSX: + if(string.IsNullOrEmpty(version)) + return "macOS"; + + string[] pieces = version.Split('.'); + + if(pieces.Length < 2 || + !int.TryParse(pieces[1], out int minor)) + return "macOS"; + + if(minor >= 12) + return "macOS"; + + if(minor >= 8) + return "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.Win32NT: + if(string.IsNullOrEmpty(version)) + return "Windows NT/2000/XP/Vista/7/10"; + + if(version.StartsWith("3.", StringComparison.Ordinal) || + version.StartsWith("4.", StringComparison.Ordinal)) + return "Windows NT"; + + if(version.StartsWith("5.0", StringComparison.Ordinal)) + return "Windows 2000"; + + if(version.StartsWith("5.1", StringComparison.Ordinal)) + return "Windows XP"; + + if(version.StartsWith("5.2", StringComparison.Ordinal)) + return "Windows 2003"; + + if(version.StartsWith("6.0", StringComparison.Ordinal)) + return "Windows Vista"; + + if(version.StartsWith("6.1", StringComparison.Ordinal)) + return "Windows 7"; + + if(version.StartsWith("6.2", StringComparison.Ordinal)) + return "Windows 8"; + + if(version.StartsWith("6.3", StringComparison.Ordinal)) + return "Windows 8.1"; + + if(version.StartsWith("10.0", StringComparison.Ordinal)) + return "Windows 10"; + + 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"; + + if(version.StartsWith("4.0", StringComparison.Ordinal)) + return "Windows 95"; + + if(version.StartsWith("4.10.2222", StringComparison.Ordinal)) + return "Windows 98 SE"; + + if(version.StartsWith("4.1", StringComparison.Ordinal)) + return "Windows 98"; + + if(version.StartsWith("4.9", StringComparison.Ordinal)) + 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"; + default: return id.ToString(); + } + } + + /// POSIX uname structure, size from OSX, big enough to handle extra fields + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + struct utsname + { + /// System name + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public readonly string sysname; + /// Node name + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public readonly string nodename; + /// Release level + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public readonly string release; + /// Version level + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public readonly string version; + /// Hardware level + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public readonly string machine; } } \ No newline at end of file diff --git a/Interop/PlatformID.cs b/Interop/PlatformID.cs index 6c37c890b..f9e4e2fd4 100644 --- a/Interop/PlatformID.cs +++ b/Interop/PlatformID.cs @@ -38,85 +38,84 @@ using System.Diagnostics.CodeAnalysis; -namespace Aaru.CommonTypes.Interop +namespace Aaru.CommonTypes.Interop; + +/// Contains an arbitrary list of OSes, even if .NET does not run on them +[SuppressMessage("ReSharper", "InconsistentNaming")] +public enum PlatformID { - /// Contains an arbitrary list of OSes, even if .NET does not run on them - [SuppressMessage("ReSharper", "InconsistentNaming")] - 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 - zOS = 35, - /// Unknown - Unknown = -1 - } + /// 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 + zOS = 35, + /// Unknown + Unknown = -1 } \ No newline at end of file diff --git a/Interop/Version.cs b/Interop/Version.cs index fa3e2bb72..4ef6b542e 100644 --- a/Interop/Version.cs +++ b/Interop/Version.cs @@ -40,52 +40,51 @@ using System; using System.Reflection; using System.Runtime; -namespace Aaru.CommonTypes.Interop +namespace Aaru.CommonTypes.Interop; + +/// Gets our own, or the runtime's version +public static class Version { - /// Gets our own, or the runtime's version - public static class Version + /// Gets version string + /// Version + public static string GetVersion() => typeof(Version).Assembly.GetName().Version?.ToString(); + + /// Gets .NET Core version + /// Version + public static string GetNetCoreVersion() { - /// Gets version string - /// Version - public static string GetVersion() => typeof(Version).Assembly.GetName().Version?.ToString(); + Assembly assembly = typeof(GCSettings).Assembly; - /// Gets .NET Core version - /// Version - public static string GetNetCoreVersion() + string[] assemblyPath = assembly.CodeBase?.Split(new[] { - Assembly assembly = typeof(GCSettings).Assembly; - - string[] assemblyPath = assembly.CodeBase?.Split(new[] - { - '/', '\\' - }, StringSplitOptions.RemoveEmptyEntries); - - if(assemblyPath is null) - return null; - - int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App"); - - if(netCoreAppIndex > 0 && - netCoreAppIndex < assemblyPath.Length - 2) - return assemblyPath[netCoreAppIndex + 1]; + '/', '\\' + }, StringSplitOptions.RemoveEmptyEntries); + if(assemblyPath is null) return null; - } - /// Gets Mono version - /// Version - public static string GetMonoVersion() - { - if(!DetectOS.IsMono) - return null; + int netCoreAppIndex = Array.IndexOf(assemblyPath, "Microsoft.NETCore.App"); - MethodInfo monoDisplayName = Type.GetType("Mono.Runtime")?. - GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static); + if(netCoreAppIndex > 0 && + netCoreAppIndex < assemblyPath.Length - 2) + return assemblyPath[netCoreAppIndex + 1]; - if(monoDisplayName != null) - return (string)monoDisplayName.Invoke(null, null); + return null; + } + /// Gets Mono version + /// Version + public static string GetMonoVersion() + { + if(!DetectOS.IsMono) return null; - } + + MethodInfo monoDisplayName = Type.GetType("Mono.Runtime")?. + GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static); + + if(monoDisplayName != null) + return (string)monoDisplayName.Invoke(null, null); + + return null; } } \ No newline at end of file diff --git a/MediaTypeFromDevice/FromAta.cs b/MediaTypeFromDevice/FromAta.cs index 075271244..564ca3e35 100644 --- a/MediaTypeFromDevice/FromAta.cs +++ b/MediaTypeFromDevice/FromAta.cs @@ -34,40 +34,39 @@ using Aaru.Console; -namespace Aaru.CommonTypes +namespace Aaru.CommonTypes; + +public static partial class MediaTypeFromDevice { - public static partial class MediaTypeFromDevice + /// Gets the media type from an ATA (not ATAPI) device + /// Manufacturer string + /// Model string + /// Is the device removable? + /// Does the device self-identify as CompactFlash? + /// Is the device attached thru PCMCIA or CardBus? + /// Number of blocks in device + /// The media type + public static MediaType GetFromAta(string manufacturer, string model, bool removable, bool compactFlash, + bool pcmcia, ulong blocks) { - /// Gets the media type from an ATA (not ATAPI) device - /// Manufacturer string - /// Model string - /// Is the device removable? - /// Does the device self-identify as CompactFlash? - /// Is the device attached thru PCMCIA or CardBus? - /// Number of blocks in device - /// The media type - public static MediaType GetFromAta(string manufacturer, string model, bool removable, bool compactFlash, - bool pcmcia, ulong blocks) + if(!removable) { - if(!removable) - { - if(compactFlash) - return MediaType.CompactFlash; + if(compactFlash) + return MediaType.CompactFlash; - return pcmcia ? MediaType.PCCardTypeI : MediaType.GENERIC_HDD; - } - - if(manufacturer.ToLowerInvariant() == "syquest" && - model.ToLowerInvariant() == "sparq" && - blocks == 1961069) - { - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is SyQuest, media has 1961069 blocks of 512 bytes, setting media type to SparQ."); - - return MediaType.SparQ; - } - - return MediaType.Unknown; + return pcmcia ? MediaType.PCCardTypeI : MediaType.GENERIC_HDD; } + + if(manufacturer.ToLowerInvariant() == "syquest" && + model.ToLowerInvariant() == "sparq" && + blocks == 1961069) + { + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 1961069 blocks of 512 bytes, setting media type to SparQ."); + + return MediaType.SparQ; + } + + return MediaType.Unknown; } } \ No newline at end of file diff --git a/MediaTypeFromDevice/FromMmc.cs b/MediaTypeFromDevice/FromMmc.cs index 87c844fb5..33f0cf712 100644 --- a/MediaTypeFromDevice/FromMmc.cs +++ b/MediaTypeFromDevice/FromMmc.cs @@ -35,145 +35,144 @@ using System; using Aaru.Console; -namespace Aaru.CommonTypes +namespace Aaru.CommonTypes; + +/// Gets the media type from a real device +public static partial class MediaTypeFromDevice { - /// Gets the media type from a real device - public static partial class MediaTypeFromDevice + /// Gets the media type from an SCSI MultiMedia Commands compliant device + /// Model string + /// Medium type from MODE SENSE + /// Density code from MODE SENSE + /// Number of blocks in media + /// Size of a block in bytes + /// Is the device USB attached + /// Is the media an optical disc + /// Media type + static MediaType GetFromMmc(string model, byte mediumType, byte densityCode, ulong blocks, uint blockSize, + bool isUsb, bool opticalDisc) { - /// Gets the media type from an SCSI MultiMedia Commands compliant device - /// Model string - /// Medium type from MODE SENSE - /// Density code from MODE SENSE - /// Number of blocks in media - /// Size of a block in bytes - /// Is the device USB attached - /// Is the media an optical disc - /// Media type - static MediaType GetFromMmc(string model, byte mediumType, byte densityCode, ulong blocks, uint blockSize, - bool isUsb, bool opticalDisc) + switch(mediumType) { - switch(mediumType) - { - case 0x00: - if(blockSize == 512) - if(blocks == 1281856) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM PD-650.", - mediumType, blocks, blockSize); + case 0x00: + if(blockSize == 512) + if(blocks == 1281856) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM PD-650.", + mediumType, blocks, blockSize); - return MediaType.PD650_WORM; - } - else - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PD-650.", - mediumType, blocks, blockSize); - - return MediaType.PD650; - } + return MediaType.PD650_WORM; + } else { AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, setting media type to Compact Disc.", - mediumType); + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PD-650.", + mediumType, blocks, blockSize); - return MediaType.CD; + return MediaType.PD650; } - case 0x01: - case 0x05: + else + { AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, setting media type to CD-ROM.", + "SCSI medium type is {0:X2}h, setting media type to Compact Disc.", mediumType); - return MediaType.CDROM; - case 0x02: - case 0x06: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, setting media type to Compact Disc Digital Audio.", - mediumType); + return MediaType.CD; + } + case 0x01: + case 0x05: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, setting media type to CD-ROM.", + mediumType); - return MediaType.CDDA; - case 0x03: - case 0x07: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, setting media type to CD+.", mediumType); + return MediaType.CDROM; + case 0x02: + case 0x06: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, setting media type to Compact Disc Digital Audio.", + mediumType); - return MediaType.CDPLUS; - case 0x04: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, setting media type to Photo CD.", - mediumType); + return MediaType.CDDA; + case 0x03: + case 0x07: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, setting media type to CD+.", mediumType); - return MediaType.PCD; - case 0x10: - case 0x11: - case 0x12: - case 0x13: - case 0x14: - case 0x15: - case 0x16: - case 0x17: - case 0x18: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, setting media type to CD-R.", mediumType); + return MediaType.CDPLUS; + case 0x04: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, setting media type to Photo CD.", + mediumType); - return MediaType.CDR; - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - case 0x25: - case 0x26: - case 0x27: - case 0x28: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, setting media type to CD-RW.", mediumType); + return MediaType.PCD; + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + case 0x18: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, setting media type to CD-R.", mediumType); - return MediaType.CDRW; - case 0x40 when isUsb && !opticalDisc: - case 0x41 when isUsb && !opticalDisc: - case 0x42 when isUsb && !opticalDisc: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h and device is USB, setting media type to Flash Drive.", - mediumType); + return MediaType.CDR; + case 0x20: + case 0x21: + case 0x22: + case 0x23: + case 0x24: + case 0x25: + case 0x26: + case 0x27: + case 0x28: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, setting media type to CD-RW.", mediumType); - return MediaType.FlashDrive; - case 0x80: - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - switch(densityCode) - { - case 0x42: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.", - mediumType, densityCode); + return MediaType.CDRW; + case 0x40 when isUsb && !opticalDisc: + case 0x41 when isUsb && !opticalDisc: + case 0x42 when isUsb && !opticalDisc: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h and device is USB, setting media type to Flash Drive.", + mediumType); - return MediaType.LTO2; - case 0x44: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.", - mediumType, densityCode); + return MediaType.FlashDrive; + case 0x80: + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + switch(densityCode) + { + case 0x42: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.", + mediumType, densityCode); - return MediaType.LTO3; - case 0x46: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.", - mediumType, densityCode); + return MediaType.LTO2; + case 0x44: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.", + mediumType, densityCode); - return MediaType.LTO4; - case 0x58: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.", - mediumType, densityCode); + return MediaType.LTO3; + case 0x46: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.", + mediumType, densityCode); - return MediaType.LTO5; - } + return MediaType.LTO4; + case 0x58: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive starts with \"ult\", setting media type to LTO-2.", + mediumType, densityCode); - break; - } + return MediaType.LTO5; + } - return MediaType.Unknown; + break; } + + return MediaType.Unknown; } } \ No newline at end of file diff --git a/MediaTypeFromDevice/FromOdc.cs b/MediaTypeFromDevice/FromOdc.cs index 0ef047385..80be560a4 100644 --- a/MediaTypeFromDevice/FromOdc.cs +++ b/MediaTypeFromDevice/FromOdc.cs @@ -34,309 +34,308 @@ using Aaru.Console; -namespace Aaru.CommonTypes +namespace Aaru.CommonTypes; + +public static partial class MediaTypeFromDevice { - public static partial class MediaTypeFromDevice + /// Gets the device type from a SCSI Optical Device + /// Medium type from MODE SENSE + /// Number of blocks in device + /// Size in bytes of a block + /// Media type + static MediaType GetFromOdc(byte mediumType, ulong blocks, uint blockSize) { - /// Gets the device type from a SCSI Optical Device - /// Medium type from MODE SENSE - /// Number of blocks in device - /// Size in bytes of a block - /// Media type - static MediaType GetFromOdc(byte mediumType, ulong blocks, uint blockSize) + if(mediumType != 0x01 && + mediumType != 0x02 && + mediumType != 0x03 && + mediumType != 0x05 && + mediumType != 0x07) { - if(mediumType != 0x01 && - mediumType != 0x02 && - mediumType != 0x03 && - mediumType != 0x05 && - mediumType != 0x07) + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, setting media type to unknown magneto-optical.", + mediumType); + + return MediaType.UnknownMO; + } + + switch(blockSize) + { + case 512: { + switch(blocks) + { + case 248826: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-154 / ISO 10090 conforming 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_154; + case 429975: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-201 / ISO 13963 conforming 3½\" embossed magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_201_ROM; + case 446325: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-201 / ISO 13963 conforming 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_201; + case 694929: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-223 conforming 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_223_512; + case 904995: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-183 / ISO 13481 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_183_512; + case 1041500: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15041 conforming 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ISO_15041_512; + case 1128772: + case 1163337: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_184_512; + case 1281856: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM PD-650.", + mediumType, blocks, blockSize); + + return MediaType.PD650_WORM; + case 1298496: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PD-650.", + mediumType, blocks, blockSize); + + return MediaType.PD650; + case 1644581: + case 1647371: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-195 / ISO 13842 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_195_512; + case 2244958: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 14517 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ISO_14517_512; + default: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.UnknownMO; + } + } + + case 1024: + { + switch(blocks) + { + case 314569: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 10089 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ISO_10089; + case 371371: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-223 conforming 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_223; + case 498526: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_183; + case 603466: + case 637041: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_184; + case 936921: + case 948770: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-195 / ISO 13842 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_195; + case 1244621: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-238 / ISO 15486 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_238; + case 1273011: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 14517 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ISO_14517; + case 2319786: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15286 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ISO_15286_1024; + case 4383356: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_322_1k; + case 14476734: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-260 / ISO 15898 conforming 356mm magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_260; + case 24445990: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-260 / ISO 15898 conforming 356mm magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_260_Double; + default: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.UnknownMO; + } + } + + case 2048: + { + switch(blocks) + { + case 310352: // Found in real media + case 318988: + case 320332: + case 321100: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-239 / ISO 15498 conforming 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_239; + case 605846: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to GigaMO 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.GigaMo; + case 1063146: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to GigaMO 2 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.GigaMo2; + case 1128134: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-280 / ISO 18093 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_280; + case 1263472: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15286 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ISO_15286; + case 2043664: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_322_2k; + case 7355716: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-317 / ISO 20162 conforming 300mm magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_317; + default: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.UnknownMO; + } + } + + case 4096: + { + switch(blocks) + { + case 1095840: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_322; + default: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.UnknownMO; + } + } + + case 8192: + { + switch(blocks) + { + case 1834348: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to UDO.", + mediumType, blocks, blockSize); + + return MediaType.UDO; + case 3668759: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM UDO2.", + mediumType, blocks, blockSize); + + return MediaType.UDO2_WORM; + case 3669724: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to UDO2.", + mediumType, blocks, blockSize); + + return MediaType.UDO2; + default: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.UnknownMO; + } + } + + default: AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, setting media type to unknown magneto-optical.", - mediumType); + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.", + mediumType, blocks, blockSize); return MediaType.UnknownMO; - } - - switch(blockSize) - { - case 512: - { - switch(blocks) - { - case 248826: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-154 / ISO 10090 conforming 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_154; - case 429975: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-201 / ISO 13963 conforming 3½\" embossed magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_201_ROM; - case 446325: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-201 / ISO 13963 conforming 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_201; - case 694929: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-223 conforming 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_223_512; - case 904995: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-183 / ISO 13481 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_183_512; - case 1041500: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15041 conforming 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ISO_15041_512; - case 1128772: - case 1163337: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_184_512; - case 1281856: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM PD-650.", - mediumType, blocks, blockSize); - - return MediaType.PD650_WORM; - case 1298496: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PD-650.", - mediumType, blocks, blockSize); - - return MediaType.PD650; - case 1644581: - case 1647371: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-195 / ISO 13842 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_195_512; - case 2244958: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 14517 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ISO_14517_512; - default: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.UnknownMO; - } - } - - case 1024: - { - switch(blocks) - { - case 314569: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 10089 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ISO_10089; - case 371371: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-223 conforming 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_223; - case 498526: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_183; - case 603466: - case 637041: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_184; - case 936921: - case 948770: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-195 / ISO 13842 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_195; - case 1244621: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-238 / ISO 15486 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_238; - case 1273011: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 14517 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ISO_14517; - case 2319786: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15286 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ISO_15286_1024; - case 4383356: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_322_1k; - case 14476734: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-260 / ISO 15898 conforming 356mm magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_260; - case 24445990: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-260 / ISO 15898 conforming 356mm magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_260_Double; - default: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.UnknownMO; - } - } - - case 2048: - { - switch(blocks) - { - case 310352: // Found in real media - case 318988: - case 320332: - case 321100: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-239 / ISO 15498 conforming 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_239; - case 605846: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to GigaMO 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.GigaMo; - case 1063146: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to GigaMO 2 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.GigaMo2; - case 1128134: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-280 / ISO 18093 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_280; - case 1263472: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15286 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ISO_15286; - case 2043664: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_322_2k; - case 7355716: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-317 / ISO 20162 conforming 300mm magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_317; - default: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.UnknownMO; - } - } - - case 4096: - { - switch(blocks) - { - case 1095840: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_322; - default: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.UnknownMO; - } - } - - case 8192: - { - switch(blocks) - { - case 1834348: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to UDO.", - mediumType, blocks, blockSize); - - return MediaType.UDO; - case 3668759: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM UDO2.", - mediumType, blocks, blockSize); - - return MediaType.UDO2_WORM; - case 3669724: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to UDO2.", - mediumType, blocks, blockSize); - - return MediaType.UDO2; - default: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.UnknownMO; - } - } - - default: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.UnknownMO; - } } } } \ No newline at end of file diff --git a/MediaTypeFromDevice/FromSbc.cs b/MediaTypeFromDevice/FromSbc.cs index 72cdc09b8..aa01a5722 100644 --- a/MediaTypeFromDevice/FromSbc.cs +++ b/MediaTypeFromDevice/FromSbc.cs @@ -35,917 +35,916 @@ using System; using Aaru.Console; -namespace Aaru.CommonTypes +namespace Aaru.CommonTypes; + +public static partial class MediaTypeFromDevice { - public static partial class MediaTypeFromDevice + /// Gets the media type from a SCSI Block Commands compliant device + /// Vendor string + /// Model string + /// Medium type from MODE SENSE + /// Number of blocks in device + /// Size of a block in bytes + /// Media type + static MediaType GetFromSbc(string vendor, string model, byte mediumType, ulong blocks, uint blockSize) { - /// Gets the media type from a SCSI Block Commands compliant device - /// Vendor string - /// Model string - /// Medium type from MODE SENSE - /// Number of blocks in device - /// Size of a block in bytes - /// Media type - static MediaType GetFromSbc(string vendor, string model, byte mediumType, ulong blocks, uint blockSize) + switch(mediumType) { - switch(mediumType) - { - case 0x09: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-54 formatted 8\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_54; - case 0x0A: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-59 formatted 8\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_59; - case 0x0B: - switch(blockSize) - { - case 256: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-69 formatted 8\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_69_26; - case 512: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-69 formatted 8\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_69_15; - case 1024: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-69 formatted 8\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_69_8; - } - - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown.", - mediumType, blocks, blockSize); - - return MediaType.Unknown; - case 0x0E: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-66 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_66; - case 0x12: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-70 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_70; - case 0x16: - switch(blockSize) - { - case 256: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-78 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_78; - case 512: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-78 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_78_2; - } - - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown.", - mediumType, blocks, blockSize); - - return MediaType.Unknown; - case 0x1A: - switch(blockSize) - { - case 256: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_99_26; - case 512: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_99_15; - case 1024: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_99_8; - } - - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown.", - mediumType, blocks, blockSize); - - return MediaType.Unknown; - case 0x1E: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density floppy.", - mediumType, blocks, blockSize); - - return MediaType.DOS_35_DS_DD_9; - case 0x41: - switch(blocks) - { - case 58620544: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 120Gb REV.", - mediumType, blocks, blockSize); - - return MediaType.REV120; - case 34185728: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 70Gb REV.", - mediumType, blocks, blockSize); - - return MediaType.REV70; - case 17090880: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 35Gb REV.", - mediumType, blocks, blockSize); - - return MediaType.REV35; - } - - break; - case 0x93: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PC-98 formatted 3½\" high density floppy (15 sectors).", - mediumType, blocks, blockSize); - - return MediaType.NEC_35_HD_15; - case 0x94: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" high density floppy.", - mediumType, blocks, blockSize); - - return MediaType.DOS_35_HD; - } - - switch(blockSize) - { - case 128: - switch(blocks) - { - case 720: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Atari formatted 5¼\" single density floppy.", - mediumType, blocks, blockSize); - - return MediaType.ATARI_525_SD; - case 1040: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Atari formatted 5¼\" double density floppy.", - mediumType, blocks, blockSize); - - return MediaType.ATARI_525_DD; - case 1898: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (33FD) floppy.", - mediumType, blocks, blockSize); - - return MediaType.IBM33FD_128; - case 2002: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-54 formatted 8\" single density floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_54; - case 3848: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (43FD) floppy.", - mediumType, blocks, blockSize); - - return MediaType.IBM43FD_128; - case 4004: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-59 formatted 8\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_59; - } - - break; - case 256: - switch(blocks) - { - case 322: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-56 formatted 5¼\" double density floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_66; - case 400: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 5¼\" single density floppy.", - mediumType, blocks, blockSize); - - return MediaType.ACORN_525_SS_SD_40; - case 455: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple DOS 3.2 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.Apple32SS; - case 560: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple DOS 3.3 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.Apple33SS; - case 640: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 5¼\" double density floppy.", - mediumType, blocks, blockSize); - - return MediaType.ACORN_525_SS_DD_40; - case 720: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Atari formatted 5¼\" double density floppy.", - mediumType, blocks, blockSize); - - return MediaType.ATARI_525_DD; - case 800: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 5¼\" double density floppy (80 tracks).", - mediumType, blocks, blockSize); - - return MediaType.ACORN_525_SS_SD_80; - case 910: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple DOS 3.2 formatted 5¼\" double sided floppy.", - mediumType, blocks, blockSize); - - return MediaType.Apple32DS; - case 1120: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple DOS 3.3 formatted 5¼\" double sided floppy.", - mediumType, blocks, blockSize); - - return MediaType.Apple33DS; - case 1121: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (33FD) floppy.", - mediumType, blocks, blockSize); - - return MediaType.IBM33FD_256; - case 1232: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to MetaFloppy formatted 5¼\" double density single sided floppy.", - mediumType, blocks, blockSize); - - return MediaType.MetaFloppy_Mod_II; - case 1280 when mediumType == 0x01: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 5¼\" double density floppy with 80 tracks.", - mediumType, blocks, blockSize); - - return MediaType.ACORN_525_SS_DD_80; - case 1280: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-70 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_70; - case 2002: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to DEC RX02 floppy.", - mediumType, blocks, blockSize); - - return MediaType.RX02; - case 2560: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-78 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_78; - case 3848: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (53FD) floppy.", - mediumType, blocks, blockSize); - - return MediaType.IBM53FD_256; - case 4004: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_99_26; - case 39168 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): - case 41004 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is IOMEGA, media has {0} blocks of 256 bytes, setting media type to 10Mb Bernoulli Box.", - blocks); - - return MediaType.Bernoulli10; - } - - break; - case 319: - switch(blocks) - { - case 256: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (23FD) floppy.", - mediumType, blocks, blockSize); - - return MediaType.IBM23FD; - } - - break; - case 512: - switch(blocks) - { - case 320: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" double density single sided floppy (8 sectors).", - mediumType, blocks, blockSize); - - return MediaType.DOS_525_SS_DD_8; - case 360: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" double density single sided floppy.", - mediumType, blocks, blockSize); - - return MediaType.DOS_525_SS_DD_9; - case 610: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (33FD) floppy.", - mediumType, blocks, blockSize); - - return MediaType.IBM33FD_512; - case 630 when mediumType == 0x01: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apricot formatted 3½\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.Apricot_35; - case 640 when mediumType == 0x01: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density single sided floppy (8 sectors).", - mediumType, blocks, blockSize); - - return MediaType.DOS_35_SS_DD_8; - case 640: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" double density floppy (8 sectors).", - mediumType, blocks, blockSize); - - return MediaType.DOS_525_DS_DD_8; - case 720 when mediumType == 0x01: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density single sided floppy.", - mediumType, blocks, blockSize); - - return MediaType.DOS_35_SS_DD_9; - case 720: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" double density floppy.", - mediumType, blocks, blockSize); - - return MediaType.DOS_525_DS_DD_9; - case 800: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple formatted 3½\" double density single sided floppy.", - mediumType, blocks, blockSize); - - return MediaType.AppleSonySS; - case 1280: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density floppy (8 sectors).", - mediumType, blocks, blockSize); - - return MediaType.DOS_35_DS_DD_8; - case 1440: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density floppy.", - mediumType, blocks, blockSize); - - return MediaType.DOS_35_DS_DD_9; - case 1640: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to FDFORMAT formatted 3½\" double density floppy.", - mediumType, blocks, blockSize); - - return MediaType.FDFORMAT_35_DD; - case 1760: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Amiga formatted 3½\" double density floppy.", - mediumType, blocks, blockSize); - - return MediaType.CBM_AMIGA_35_DD; - case 2242: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (53FD) floppy.", - mediumType, blocks, blockSize); - - return MediaType.IBM53FD_512; - case 2332: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_99_15; - case 2400: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" high density floppy.", - mediumType, blocks, blockSize); - - return MediaType.DOS_525_HD; - case 2788: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to FDFORMAT formatted 5¼\" high density floppy.", - mediumType, blocks, blockSize); - - return MediaType.FDFORMAT_525_HD; - case 2880: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" high density floppy.", - mediumType, blocks, blockSize); - - return MediaType.DOS_35_HD; - case 3360: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Microsoft DMF formatted 3½\" high density floppy.", - mediumType, blocks, blockSize); - - return MediaType.DMF; - case 3444: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to FDFORMAT formatted 3½\" high density floppy.", - mediumType, blocks, blockSize); - - return MediaType.FDFORMAT_35_HD; - case 3520: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Amiga formatted 3½\" high density floppy.", - mediumType, blocks, blockSize); - - return MediaType.CBM_AMIGA_35_HD; - case 5760: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" extra density floppy.", - mediumType, blocks, blockSize); - - return MediaType.DOS_35_ED; - case 40662 when mediumType == 0x20: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Floptical.", - mediumType, blocks, blockSize); - - return MediaType.Floptical; - case 65536 when model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal): - AaruConsole.DebugWriteLine("Media detection", - "Drive model is LS (SuperDisk), media has 65536 blocks of 512 bytes, setting media type to FD32MB."); - - return MediaType.FD32MB; - case 78882 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is IOMEGA, media has 78882 blocks of 512 bytes, setting media type to PocketZIP."); - - return MediaType.PocketZip; - case 86700 when vendor.ToLowerInvariant() == "syquest": - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is SyQuest, media has 86700 blocks of 512 bytes, setting media type to SQ400."); - - return MediaType.SQ400; - case 87040 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is IOMEGA, media has 87040 blocks of 512 bytes, setting media type to 44Mb Bernoulli Box II."); - - return MediaType.Bernoulli44; - case 173456 when vendor.ToLowerInvariant() == "syquest": - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is SyQuest, media has 173456 blocks of 512 bytes, setting media type to SQ800."); - - return MediaType.SQ800; - case 175856 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is IOMEGA, media has 175856 blocks of 512 bytes, setting media type to 90Mb Bernoulli Box II."); - - return MediaType.Bernoulli90; - case 196608 when model.ToLowerInvariant().StartsWith("zip", StringComparison.OrdinalIgnoreCase): - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is IOMEGA, drive model is ZIP, media has 196608 blocks of 512 bytes, setting media type to 100Mb ZIP."); - - return MediaType.ZIP100; - - case 215440 when vendor.ToLowerInvariant() == "syquest": - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is SyQuest, media has 215440 blocks of 512 bytes, setting media type to SQ310."); - - return MediaType.SQ310; - case 246528 when model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal): - AaruConsole.DebugWriteLine("Media detection", - "Drive model is LS (SuperDisk), media has 246528 blocks of 512 bytes, setting media type to LS-120."); - - return MediaType.LS120; - case 248826 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-154 / ISO 10090 conforming 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_154; - case 262144 when vendor.ToLowerInvariant() == "syquest": - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is SyQuest, media has 262144 blocks of 512 bytes, setting media type to EZ135."); - - return MediaType.EZ135; - case 294918 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is IOMEGA, media has 294918 blocks of 512 bytes, setting media type to 150Mb Bernoulli Box II."); - - return MediaType.Bernoulli150; - case 390696 when vendor.ToLowerInvariant() == "syquest": - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is SyQuest, media has 390696 blocks of 512 bytes, setting media type to SQ2000."); - - return MediaType.SQ2000; - case 393380 when model.ToLowerInvariant().StartsWith("hifd", StringComparison.Ordinal): - AaruConsole.DebugWriteLine("Media detection", - "Drive model is HiFD, media has 393380 blocks of 512 bytes, setting media type to HiFD.", - blocks, blockSize); - - return MediaType.HiFD; - case 429975 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-201 / ISO 13963 conforming 3½\" embossed magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_201_ROM; - case 446325 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-201 / ISO 13963 conforming 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_201; - case 450560 when vendor.ToLowerInvariant() == "syquest": - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is SyQuest, media has 450560 blocks of 512 bytes, setting media type to EZ230."); - - return MediaType.EZ230; - case 469504 when model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal): - AaruConsole.DebugWriteLine("Media detection", - "Drive model is LS (SuperDisk), media has 469504 blocks of 512 bytes, setting media type to LS-240."); - - return MediaType.LS240; - case 489532 when model.ToLowerInvariant().StartsWith("zip", StringComparison.OrdinalIgnoreCase): - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is IOMEGA, drive model is ZIP, media has 489532 blocks of 512 bytes, setting media type to 250Mb ZIP."); - - return MediaType.ZIP250; - case 524288 when vendor.ToLowerInvariant() == "syquest": - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is SyQuest, media has 524288 blocks of 512 bytes, setting media type to SQ327."); - - return MediaType.SQ327; - case 694929 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-223 conforming 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_223_512; - case 904995 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-183 / ISO 13481 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_183_512; - case 1041500 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15041 conforming 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ISO_15041_512; - case 1128772 when mediumType == 0x01 || mediumType == 0x02: - case 1163337 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_184_512; - case 1281856 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM PD-650.", - mediumType, blocks, blockSize); - - return MediaType.PD650_WORM; - case 1298496 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PD-650.", - mediumType, blocks, blockSize); - - return MediaType.PD650; - case 1470500 - when model.ToLowerInvariant().StartsWith("zip", StringComparison.OrdinalIgnoreCase): - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is IOMEGA, drive model is ZIP, media has 489532 blocks of 512 bytes, setting media type to 250Mb ZIP."); - - return MediaType.ZIP750; - case 1644581 when mediumType == 0x01 || mediumType == 0x02: - case 1647371 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-195 / ISO 13842 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_195_512; - case 1961069 when vendor.ToLowerInvariant() == "syquest": - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is SyQuest, media has 1961069 blocks of 512 bytes, setting media type to SparQ."); - - return MediaType.SparQ; - case 2091050 when model.ToLowerInvariant().StartsWith("jaz", StringComparison.Ordinal): - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is IOMEGA, drive model is JAZ, media has 2091050 blocks of 512 bytes, setting media type to 1Gb JAZ."); - - return MediaType.Jaz; - case 2244958 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 14517 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ISO_14517_512; - case 2929800 when vendor.ToLowerInvariant() == "syquest": - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is SyQuest, media has 2929800 blocks of 512 bytes, setting media type to SyJet."); - - return MediaType.SyJet; - case 3915600 when model.ToLowerInvariant().StartsWith("jaz", StringComparison.Ordinal): - AaruConsole.DebugWriteLine("Media detection", - "Drive manufacturer is IOMEGA, drive model is JAZ, media has 3915600 blocks of 512 bytes, setting media type to 2Gb JAZ."); - - return MediaType.Jaz2; - case 4307184 when vendor.ToLowerInvariant().StartsWith("cws orb", StringComparison.Ordinal): - AaruConsole.DebugWriteLine("Media detection", - "Drive model is Castlewood Orb, media has 4307184 blocks of 512 bytes, setting media type to Orb."); - - return MediaType.Orb; - case 625134256 when model.ToLowerInvariant().StartsWith("rdx", StringComparison.Ordinal): - AaruConsole.DebugWriteLine("Media detection", - "Drive model is LS (SuperDisk), media has {0} blocks of {1} bytes, setting media type to unknown.", - blocks, blockSize); - - return MediaType.RDX320; - } - - break; - case 1024: + case 0x09: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-54 formatted 8\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_54; + case 0x0A: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-59 formatted 8\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_59; + case 0x0B: + switch(blockSize) { - switch(blocks) - { - case 800 when mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 3½\" double density floppy.", - mediumType, blocks, blockSize); + case 256: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-69 formatted 8\" floppy.", + mediumType, blocks, blockSize); - return MediaType.ACORN_35_DS_DD; - case 1220: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (53FD) floppy.", - mediumType, blocks, blockSize); + return MediaType.ECMA_69_26; + case 512: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-69 formatted 8\" floppy.", + mediumType, blocks, blockSize); - return MediaType.IBM53FD_1024; - case 1232 when model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal): - AaruConsole.DebugWriteLine("Media detection", - "Drive model is LS (SuperDisk), media has 2880 blocks of 512 bytes, setting media type to PC-98 formatted 3½\" high density floppy."); + return MediaType.ECMA_69_15; + case 1024: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-69 formatted 8\" floppy.", + mediumType, blocks, blockSize); - return MediaType.NEC_35_HD_8; - case 1232: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Sharp formatted 3½\" high density floppy.", - mediumType, blocks, blockSize); - - return MediaType.SHARP_35; - case 1268: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-69 formatted 8\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_69_8; - case 1280: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PC-98 formatted 5¼\" high density floppy.", - mediumType, blocks, blockSize); - - return MediaType.NEC_525_HD; - case 1316: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_99_8; - case 1600 when mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 3½\" high density floppy.", - mediumType, blocks, blockSize); - - return MediaType.ACORN_35_DS_HD; - case 314569 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 10089 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ISO_10089; - case 371371 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-223 conforming 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_223; - case 498526 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-183 / ISO 13481 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_183; - case 603466 when mediumType == 0x01 || mediumType == 0x02: - case 637041 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_184; - case 936921 when mediumType == 0x01 || mediumType == 0x02: - case 948770 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-195 / ISO 13842 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_195; - case 1244621 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-238 / ISO 15486 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_238; - case 1273011 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 14517 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ISO_14517; - case 2319786 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15286 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ISO_15286_1024; - case 4383356 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_322_1k; - case 14476734 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-260 / ISO 15898 conforming 356mm magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_260; - case 24445990 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-260 / ISO 15898 conforming 356mm magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_260_Double; - } + return MediaType.ECMA_69_8; } - break; - case 2048: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown.", + mediumType, blocks, blockSize); + + return MediaType.Unknown; + case 0x0E: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-66 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_66; + case 0x12: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-70 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_70; + case 0x16: + switch(blockSize) { - switch(blocks) - { - case 112311: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 60 minute MiniDisc.", - mediumType, blocks, blockSize); + case 256: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-78 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); - return MediaType.MD60; - case 138363: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 74 minute MiniDisc.", - mediumType, blocks, blockSize); + return MediaType.ECMA_78; + case 512: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-78 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); - return MediaType.MD74; - case 149373: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 80 minute MiniDisc.", - mediumType, blocks, blockSize); - - return MediaType.MD80; - case 310352 when mediumType == 0x01 || mediumType == 0x02: // Found in real media - case 318988 when mediumType == 0x01 || mediumType == 0x02: - case 320332 when mediumType == 0x01 || mediumType == 0x02: - case 321100 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-239 / ISO 15498 conforming 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_239; - case 494023: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Sony HiMD.", - mediumType, blocks, blockSize); - - return MediaType.HiMD; - case 605846 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to GigaMO 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.GigaMo; - case 1063146 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to GigaMO 2 3½\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.GigaMo2; - case 1128134 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-280 / ISO 18093 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_280; - case 1263472 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15286 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ISO_15286; - case 2043664 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_322_2k; - case 7355716 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-317 / ISO 20162 conforming 300mm magneto-optical.", - mediumType, blocks, blockSize); - - return MediaType.ECMA_317; - } + return MediaType.ECMA_78_2; } - break; - case 4096: - { - switch(blocks) - { - case 1095840 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.", - mediumType, blocks, blockSize); + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown.", + mediumType, blocks, blockSize); - return MediaType.ECMA_322; - } + return MediaType.Unknown; + case 0x1A: + switch(blockSize) + { + case 256: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_99_26; + case 512: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_99_15; + case 1024: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_99_8; } - break; - case 8192: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to unknown.", + mediumType, blocks, blockSize); + + return MediaType.Unknown; + case 0x1E: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_DS_DD_9; + case 0x41: + switch(blocks) { - switch(blocks) - { - case 1834348 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to UDO.", - mediumType, blocks, blockSize); + case 58620544: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 120Gb REV.", + mediumType, blocks, blockSize); - return MediaType.UDO; - case 3668759 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM UDO2.", - mediumType, blocks, blockSize); + return MediaType.REV120; + case 34185728: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 70Gb REV.", + mediumType, blocks, blockSize); - return MediaType.UDO2_WORM; - case 3669724 when mediumType == 0x01 || mediumType == 0x02: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to UDO2.", - mediumType, blocks, blockSize); + return MediaType.REV70; + case 17090880: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 35Gb REV.", + mediumType, blocks, blockSize); - return MediaType.UDO2; - } + return MediaType.REV35; } - break; - } + break; + case 0x93: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PC-98 formatted 3½\" high density floppy (15 sectors).", + mediumType, blocks, blockSize); - return MediaType.Unknown; + return MediaType.NEC_35_HD_15; + case 0x94: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_HD; } + + switch(blockSize) + { + case 128: + switch(blocks) + { + case 720: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Atari formatted 5¼\" single density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ATARI_525_SD; + case 1040: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Atari formatted 5¼\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ATARI_525_DD; + case 1898: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (33FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM33FD_128; + case 2002: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-54 formatted 8\" single density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_54; + case 3848: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (43FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM43FD_128; + case 4004: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-59 formatted 8\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_59; + } + + break; + case 256: + switch(blocks) + { + case 322: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-56 formatted 5¼\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_66; + case 400: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 5¼\" single density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ACORN_525_SS_SD_40; + case 455: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple DOS 3.2 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.Apple32SS; + case 560: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple DOS 3.3 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.Apple33SS; + case 640: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 5¼\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ACORN_525_SS_DD_40; + case 720: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Atari formatted 5¼\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ATARI_525_DD; + case 800: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 5¼\" double density floppy (80 tracks).", + mediumType, blocks, blockSize); + + return MediaType.ACORN_525_SS_SD_80; + case 910: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple DOS 3.2 formatted 5¼\" double sided floppy.", + mediumType, blocks, blockSize); + + return MediaType.Apple32DS; + case 1120: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple DOS 3.3 formatted 5¼\" double sided floppy.", + mediumType, blocks, blockSize); + + return MediaType.Apple33DS; + case 1121: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (33FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM33FD_256; + case 1232: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to MetaFloppy formatted 5¼\" double density single sided floppy.", + mediumType, blocks, blockSize); + + return MediaType.MetaFloppy_Mod_II; + case 1280 when mediumType == 0x01: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 5¼\" double density floppy with 80 tracks.", + mediumType, blocks, blockSize); + + return MediaType.ACORN_525_SS_DD_80; + case 1280: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-70 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_70; + case 2002: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to DEC RX02 floppy.", + mediumType, blocks, blockSize); + + return MediaType.RX02; + case 2560: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-78 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_78; + case 3848: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (53FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM53FD_256; + case 4004: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_99_26; + case 39168 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): + case 41004 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, media has {0} blocks of 256 bytes, setting media type to 10Mb Bernoulli Box.", + blocks); + + return MediaType.Bernoulli10; + } + + break; + case 319: + switch(blocks) + { + case 256: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (23FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM23FD; + } + + break; + case 512: + switch(blocks) + { + case 320: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" double density single sided floppy (8 sectors).", + mediumType, blocks, blockSize); + + return MediaType.DOS_525_SS_DD_8; + case 360: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" double density single sided floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_525_SS_DD_9; + case 610: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (33FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM33FD_512; + case 630 when mediumType == 0x01: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apricot formatted 3½\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.Apricot_35; + case 640 when mediumType == 0x01: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density single sided floppy (8 sectors).", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_SS_DD_8; + case 640: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" double density floppy (8 sectors).", + mediumType, blocks, blockSize); + + return MediaType.DOS_525_DS_DD_8; + case 720 when mediumType == 0x01: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density single sided floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_SS_DD_9; + case 720: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_525_DS_DD_9; + case 800: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Apple formatted 3½\" double density single sided floppy.", + mediumType, blocks, blockSize); + + return MediaType.AppleSonySS; + case 1280: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density floppy (8 sectors).", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_DS_DD_8; + case 1440: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_DS_DD_9; + case 1640: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to FDFORMAT formatted 3½\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.FDFORMAT_35_DD; + case 1760: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Amiga formatted 3½\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.CBM_AMIGA_35_DD; + case 2242: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (53FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM53FD_512; + case 2332: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_99_15; + case 2400: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 5¼\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_525_HD; + case 2788: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to FDFORMAT formatted 5¼\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.FDFORMAT_525_HD; + case 2880: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_HD; + case 3360: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Microsoft DMF formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DMF; + case 3444: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to FDFORMAT formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.FDFORMAT_35_HD; + case 3520: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Amiga formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.CBM_AMIGA_35_HD; + case 5760: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 3½\" extra density floppy.", + mediumType, blocks, blockSize); + + return MediaType.DOS_35_ED; + case 40662 when mediumType == 0x20: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Floptical.", + mediumType, blocks, blockSize); + + return MediaType.Floptical; + case 65536 when model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is LS (SuperDisk), media has 65536 blocks of 512 bytes, setting media type to FD32MB."); + + return MediaType.FD32MB; + case 78882 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, media has 78882 blocks of 512 bytes, setting media type to PocketZIP."); + + return MediaType.PocketZip; + case 86700 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 86700 blocks of 512 bytes, setting media type to SQ400."); + + return MediaType.SQ400; + case 87040 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, media has 87040 blocks of 512 bytes, setting media type to 44Mb Bernoulli Box II."); + + return MediaType.Bernoulli44; + case 173456 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 173456 blocks of 512 bytes, setting media type to SQ800."); + + return MediaType.SQ800; + case 175856 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, media has 175856 blocks of 512 bytes, setting media type to 90Mb Bernoulli Box II."); + + return MediaType.Bernoulli90; + case 196608 when model.ToLowerInvariant().StartsWith("zip", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, drive model is ZIP, media has 196608 blocks of 512 bytes, setting media type to 100Mb ZIP."); + + return MediaType.ZIP100; + + case 215440 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 215440 blocks of 512 bytes, setting media type to SQ310."); + + return MediaType.SQ310; + case 246528 when model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is LS (SuperDisk), media has 246528 blocks of 512 bytes, setting media type to LS-120."); + + return MediaType.LS120; + case 248826 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-154 / ISO 10090 conforming 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_154; + case 262144 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 262144 blocks of 512 bytes, setting media type to EZ135."); + + return MediaType.EZ135; + case 294918 when vendor.StartsWith("iomega", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, media has 294918 blocks of 512 bytes, setting media type to 150Mb Bernoulli Box II."); + + return MediaType.Bernoulli150; + case 390696 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 390696 blocks of 512 bytes, setting media type to SQ2000."); + + return MediaType.SQ2000; + case 393380 when model.ToLowerInvariant().StartsWith("hifd", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is HiFD, media has 393380 blocks of 512 bytes, setting media type to HiFD.", + blocks, blockSize); + + return MediaType.HiFD; + case 429975 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-201 / ISO 13963 conforming 3½\" embossed magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_201_ROM; + case 446325 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-201 / ISO 13963 conforming 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_201; + case 450560 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 450560 blocks of 512 bytes, setting media type to EZ230."); + + return MediaType.EZ230; + case 469504 when model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is LS (SuperDisk), media has 469504 blocks of 512 bytes, setting media type to LS-240."); + + return MediaType.LS240; + case 489532 when model.ToLowerInvariant().StartsWith("zip", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, drive model is ZIP, media has 489532 blocks of 512 bytes, setting media type to 250Mb ZIP."); + + return MediaType.ZIP250; + case 524288 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 524288 blocks of 512 bytes, setting media type to SQ327."); + + return MediaType.SQ327; + case 694929 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-223 conforming 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_223_512; + case 904995 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-183 / ISO 13481 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_183_512; + case 1041500 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15041 conforming 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ISO_15041_512; + case 1128772 when mediumType == 0x01 || mediumType == 0x02: + case 1163337 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_184_512; + case 1281856 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM PD-650.", + mediumType, blocks, blockSize); + + return MediaType.PD650_WORM; + case 1298496 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PD-650.", + mediumType, blocks, blockSize); + + return MediaType.PD650; + case 1470500 + when model.ToLowerInvariant().StartsWith("zip", StringComparison.OrdinalIgnoreCase): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, drive model is ZIP, media has 489532 blocks of 512 bytes, setting media type to 250Mb ZIP."); + + return MediaType.ZIP750; + case 1644581 when mediumType == 0x01 || mediumType == 0x02: + case 1647371 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-195 / ISO 13842 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_195_512; + case 1961069 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 1961069 blocks of 512 bytes, setting media type to SparQ."); + + return MediaType.SparQ; + case 2091050 when model.ToLowerInvariant().StartsWith("jaz", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, drive model is JAZ, media has 2091050 blocks of 512 bytes, setting media type to 1Gb JAZ."); + + return MediaType.Jaz; + case 2244958 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 14517 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ISO_14517_512; + case 2929800 when vendor.ToLowerInvariant() == "syquest": + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is SyQuest, media has 2929800 blocks of 512 bytes, setting media type to SyJet."); + + return MediaType.SyJet; + case 3915600 when model.ToLowerInvariant().StartsWith("jaz", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive manufacturer is IOMEGA, drive model is JAZ, media has 3915600 blocks of 512 bytes, setting media type to 2Gb JAZ."); + + return MediaType.Jaz2; + case 4307184 when vendor.ToLowerInvariant().StartsWith("cws orb", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is Castlewood Orb, media has 4307184 blocks of 512 bytes, setting media type to Orb."); + + return MediaType.Orb; + case 625134256 when model.ToLowerInvariant().StartsWith("rdx", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is LS (SuperDisk), media has {0} blocks of {1} bytes, setting media type to unknown.", + blocks, blockSize); + + return MediaType.RDX320; + } + + break; + case 1024: + { + switch(blocks) + { + case 800 when mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 3½\" double density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ACORN_35_DS_DD; + case 1220: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to IBM formatted 8\" (53FD) floppy.", + mediumType, blocks, blockSize); + + return MediaType.IBM53FD_1024; + case 1232 when model.ToLowerInvariant().StartsWith("ls-", StringComparison.Ordinal): + AaruConsole.DebugWriteLine("Media detection", + "Drive model is LS (SuperDisk), media has 2880 blocks of 512 bytes, setting media type to PC-98 formatted 3½\" high density floppy."); + + return MediaType.NEC_35_HD_8; + case 1232: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Sharp formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.SHARP_35; + case 1268: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-69 formatted 8\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_69_8; + case 1280: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to PC-98 formatted 5¼\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.NEC_525_HD; + case 1316: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-99 formatted 5¼\" floppy.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_99_8; + case 1600 when mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Acorn formatted 3½\" high density floppy.", + mediumType, blocks, blockSize); + + return MediaType.ACORN_35_DS_HD; + case 314569 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 10089 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ISO_10089; + case 371371 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-223 conforming 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_223; + case 498526 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-183 / ISO 13481 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_183; + case 603466 when mediumType == 0x01 || mediumType == 0x02: + case 637041 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-184 / ISO 13549 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_184; + case 936921 when mediumType == 0x01 || mediumType == 0x02: + case 948770 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-195 / ISO 13842 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_195; + case 1244621 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-238 / ISO 15486 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_238; + case 1273011 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 14517 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ISO_14517; + case 2319786 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15286 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ISO_15286_1024; + case 4383356 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_322_1k; + case 14476734 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-260 / ISO 15898 conforming 356mm magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_260; + case 24445990 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-260 / ISO 15898 conforming 356mm magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_260_Double; + } + } + + break; + case 2048: + { + switch(blocks) + { + case 112311: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 60 minute MiniDisc.", + mediumType, blocks, blockSize); + + return MediaType.MD60; + case 138363: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 74 minute MiniDisc.", + mediumType, blocks, blockSize); + + return MediaType.MD74; + case 149373: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 80 minute MiniDisc.", + mediumType, blocks, blockSize); + + return MediaType.MD80; + case 310352 when mediumType == 0x01 || mediumType == 0x02: // Found in real media + case 318988 when mediumType == 0x01 || mediumType == 0x02: + case 320332 when mediumType == 0x01 || mediumType == 0x02: + case 321100 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-239 / ISO 15498 conforming 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_239; + case 494023: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to Sony HiMD.", + mediumType, blocks, blockSize); + + return MediaType.HiMD; + case 605846 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to GigaMO 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.GigaMo; + case 1063146 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to GigaMO 2 3½\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.GigaMo2; + case 1128134 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-280 / ISO 18093 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_280; + case 1263472 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ISO 15286 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ISO_15286; + case 2043664 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_322_2k; + case 7355716 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-317 / ISO 20162 conforming 300mm magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_317; + } + } + + break; + case 4096: + { + switch(blocks) + { + case 1095840 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to ECMA-322 / ISO 22092 conforming 5¼\" magneto-optical.", + mediumType, blocks, blockSize); + + return MediaType.ECMA_322; + } + } + + break; + case 8192: + { + switch(blocks) + { + case 1834348 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to UDO.", + mediumType, blocks, blockSize); + + return MediaType.UDO; + case 3668759 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to WORM UDO2.", + mediumType, blocks, blockSize); + + return MediaType.UDO2_WORM; + case 3669724 when mediumType == 0x01 || mediumType == 0x02: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to UDO2.", + mediumType, blocks, blockSize); + + return MediaType.UDO2; + } + } + + break; + } + + return MediaType.Unknown; } } \ No newline at end of file diff --git a/MediaTypeFromDevice/FromScsi.cs b/MediaTypeFromDevice/FromScsi.cs index 5f4be91b4..ff44187ba 100644 --- a/MediaTypeFromDevice/FromScsi.cs +++ b/MediaTypeFromDevice/FromScsi.cs @@ -35,100 +35,99 @@ using System; using Aaru.Console; -namespace Aaru.CommonTypes +namespace Aaru.CommonTypes; + +public static partial class MediaTypeFromDevice { - public static partial class MediaTypeFromDevice + /// Tries to guess, from SCSI information, the media type of a device and/or its inserted media + /// The SCSI Peripheral Type as indicated in the INQUIRY response + /// The vendor string of the device + /// The model string of the device + /// The medium type byte from MODE SENSE + /// The density type byte from MODE SENSE + /// How many blocks are on the media + /// Size in bytes of each block + /// Device is USB + /// Is media an optical disc? + /// The media type + public static MediaType GetFromScsi(byte scsiPeripheralType, string vendor, string model, byte mediumType, + byte densityCode, ulong blocks, uint blockSize, bool isUsb, + bool opticalDisc) { - /// Tries to guess, from SCSI information, the media type of a device and/or its inserted media - /// The SCSI Peripheral Type as indicated in the INQUIRY response - /// The vendor string of the device - /// The model string of the device - /// The medium type byte from MODE SENSE - /// The density type byte from MODE SENSE - /// How many blocks are on the media - /// Size in bytes of each block - /// Device is USB - /// Is media an optical disc? - /// The media type - public static MediaType GetFromScsi(byte scsiPeripheralType, string vendor, string model, byte mediumType, - byte densityCode, ulong blocks, uint blockSize, bool isUsb, - bool opticalDisc) + switch(scsiPeripheralType) { - switch(scsiPeripheralType) - { - // Direct access device - case 0x00: - // Simplified access device - case 0x0E: - if(mediumType == 0x03 || - mediumType == 0x05 || - mediumType == 0x07) - goto case 0x07; + // Direct access device + case 0x00: + // Simplified access device + case 0x0E: + if(mediumType == 0x03 || + mediumType == 0x05 || + mediumType == 0x07) + goto case 0x07; - return GetFromSbc(vendor, model, mediumType, blocks, blockSize); + return GetFromSbc(vendor, model, mediumType, blocks, blockSize); - // Sequential access device - case 0x01: - return GetFromSsc(scsiPeripheralType, vendor, model, mediumType, densityCode, blocks, blockSize); + // Sequential access device + case 0x01: + return GetFromSsc(scsiPeripheralType, vendor, model, mediumType, densityCode, blocks, blockSize); - // Write-once device - case 0x04: - // Optical device - case 0x07: return GetFromOdc(mediumType, blocks, blockSize); + // Write-once device + case 0x04: + // Optical device + case 0x07: return GetFromOdc(mediumType, blocks, blockSize); - // MultiMedia Device - case 0x05: return GetFromMmc(model, mediumType, densityCode, blocks, blockSize, isUsb, opticalDisc); + // MultiMedia Device + case 0x05: return GetFromMmc(model, mediumType, densityCode, blocks, blockSize, isUsb, opticalDisc); - // MD DATA drives - case 0x10 when model.StartsWith("MDM", StringComparison.Ordinal) || - model.StartsWith("MDH", StringComparison.Ordinal): - if(blockSize == 2048) - { + // MD DATA drives + case 0x10 when model.StartsWith("MDM", StringComparison.Ordinal) || + model.StartsWith("MDH", StringComparison.Ordinal): + if(blockSize == 2048) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to MiniDisc for Data.", + scsiPeripheralType, blocks, blockSize); + + return MediaType.MDData; + } + + switch(blocks) + { + case 57312: AaruConsole.DebugWriteLine("Media detection", - "SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to MiniDisc for Data.", + "SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 60 minute MiniDisc.", scsiPeripheralType, blocks, blockSize); - return MediaType.MDData; - } + return MediaType.MD60; + case 70464: + AaruConsole.DebugWriteLine("Media detection", + "SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 74 minute MiniDisc.", + scsiPeripheralType, blocks, blockSize); - switch(blocks) - { - case 57312: - AaruConsole.DebugWriteLine("Media detection", - "SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 60 minute MiniDisc.", - scsiPeripheralType, blocks, blockSize); + return MediaType.MD74; + case 76096: + AaruConsole.DebugWriteLine("Media detection", + "SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 80 minute MiniDisc.", + scsiPeripheralType, blocks, blockSize); - return MediaType.MD60; - case 70464: - AaruConsole.DebugWriteLine("Media detection", - "SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 74 minute MiniDisc.", - scsiPeripheralType, blocks, blockSize); + return MediaType.MD80; + } - return MediaType.MD74; - case 76096: - AaruConsole.DebugWriteLine("Media detection", - "SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 80 minute MiniDisc.", - scsiPeripheralType, blocks, blockSize); + AaruConsole.DebugWriteLine("Media detection", + "SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 60 minute MiniDisc.", + scsiPeripheralType, blocks, blockSize); - return MediaType.MD80; - } + return MediaType.MD; - AaruConsole.DebugWriteLine("Media detection", - "SCSI peripheral type is {0:X2}h, media has {1} blocks of {2} bytes, setting media type to 60 minute MiniDisc.", - scsiPeripheralType, blocks, blockSize); + // Host managed zoned block device + case 0x14: + AaruConsole.DebugWriteLine("Media detection", + "SCSI peripheral type is {0:X2}h, setting media type to host managed zoned block device.", + scsiPeripheralType, blocks, blockSize); - return MediaType.MD; - - // Host managed zoned block device - case 0x14: - AaruConsole.DebugWriteLine("Media detection", - "SCSI peripheral type is {0:X2}h, setting media type to host managed zoned block device.", - scsiPeripheralType, blocks, blockSize); - - return MediaType.Zone_HDD; - } - - return MediaType.Unknown; + return MediaType.Zone_HDD; } + + return MediaType.Unknown; } } \ No newline at end of file diff --git a/MediaTypeFromDevice/FromSsc.cs b/MediaTypeFromDevice/FromSsc.cs index 7f0de79a2..fd1838f85 100644 --- a/MediaTypeFromDevice/FromSsc.cs +++ b/MediaTypeFromDevice/FromSsc.cs @@ -35,1577 +35,1576 @@ using System; using Aaru.Console; -namespace Aaru.CommonTypes +namespace Aaru.CommonTypes; + +public static partial class MediaTypeFromDevice { - public static partial class MediaTypeFromDevice + /// Gets the media type from an SCSI Streaming Commands compliant device + /// Peripheral type + /// Vendor string + /// Model string + /// Medium type from MODE SENSE + /// Density code from MODE SENSE + /// Number of blocks in media + /// Size of a block in bytes + /// Media type + public static MediaType GetFromSsc(byte scsiPeripheralType, string vendor, string model, byte mediumType, + byte densityCode, ulong blocks, uint blockSize) { - /// Gets the media type from an SCSI Streaming Commands compliant device - /// Peripheral type - /// Vendor string - /// Model string - /// Medium type from MODE SENSE - /// Density code from MODE SENSE - /// Number of blocks in media - /// Size of a block in bytes - /// Media type - public static MediaType GetFromSsc(byte scsiPeripheralType, string vendor, string model, byte mediumType, - byte densityCode, ulong blocks, uint blockSize) + switch(mediumType) { - switch(mediumType) - { - case 0x00: - switch(densityCode) - { - case 0x04: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to QIC-11.", - mediumType, densityCode); - - return MediaType.QIC11; - case 0x05: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to QIC-24.", - mediumType, densityCode); - - return MediaType.QIC24; - case 0x09: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to IBM 3490.", - mediumType, densityCode); - - return MediaType.IBM3490; - case 0x0F: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to QIC-120.", - mediumType, densityCode); - - return MediaType.QIC120; - case 0x10: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to QIC-150.", - mediumType, densityCode); - - return MediaType.QIC150; - case 0x13: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS.", - mediumType, densityCode); - - return MediaType.DDS1; - case 0x24: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS-2.", - mediumType, densityCode); - - return MediaType.DDS2; - case 0x25: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS-3.", - mediumType, densityCode); - - return MediaType.DDS3; - case 0x26: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS-4.", - mediumType, densityCode); - - return MediaType.DDS4; - case 0x28: - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to IBM 3490E.", - mediumType, densityCode); - - return MediaType.IBM3490E; - case 0x40: - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO.", - mediumType, densityCode); - - return MediaType.LTO; - } - - if(model.ToLowerInvariant().StartsWith("sdz", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"sdz\" setting media type to Super AIT.", - mediumType, densityCode); - - return MediaType.SAIT1; - } - - break; - - case 0x41: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-2.", - mediumType, densityCode); - - return MediaType.LTO2; - } - - break; - } - - case 0x42: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-2.", - mediumType, densityCode); - - return MediaType.LTO2; - } - - if(vendor.ToLowerInvariant() == "stk") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9840A.", - mediumType, densityCode); - - return MediaType.T9840A; - } - - break; - } - - case 0x43: - { - if(vendor.ToLowerInvariant() == "stk") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9940A.", - mediumType, densityCode); - - return MediaType.T9940A; - } - - break; - } - - case 0x44: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-3.", - mediumType, densityCode); - - return MediaType.LTO3; - } - - if(vendor.ToLowerInvariant() == "stk") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9940B.", - mediumType, densityCode); - - return MediaType.T9940B; - } - - break; - } - - case 0x45: - { - if(vendor.ToLowerInvariant() == "stk") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9840C.", - mediumType, densityCode); - - return MediaType.T9840C; - } - - break; - } - - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-4.", - mediumType, densityCode); - - return MediaType.LTO4; - } - - if(vendor.ToLowerInvariant() == "stk") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9840D.", - mediumType, densityCode); - - return MediaType.T9840D; - } - - break; - } - - case 0x4A: - { - if(vendor.ToLowerInvariant() == "stk") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T10000A.", - mediumType, densityCode); - - return MediaType.T10000A; - } - - break; - } - - case 0x4B: - { - if(vendor.ToLowerInvariant() == "stk") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T10000B.", - mediumType, densityCode); - - return MediaType.T10000B; - } - - break; - } - - case 0x4C: - { - if(vendor.ToLowerInvariant() == "stk") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T10000C.", - mediumType, densityCode); - - return MediaType.T10000C; - } - - break; - } - - case 0x4D: - { - if(vendor.ToLowerInvariant() == "stk") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T10000D.", - mediumType, densityCode); - - return MediaType.T10000D; - } - - break; - } - - case 0x58: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-5.", - mediumType, densityCode); - - return MediaType.LTO5; - } - - break; - } - - // Used by some HP drives for all generations - case 0x8C: - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS.", - mediumType, densityCode); - - return MediaType.DDS1; - } - } - - break; - case 0x01: + case 0x00: + switch(densityCode) { - switch(densityCode) - { - case 0x44: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-3.", - mediumType, densityCode); + case 0x04: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to QIC-11.", + mediumType, densityCode); - return MediaType.LTO3WORM; - } + return MediaType.QIC11; + case 0x05: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to QIC-24.", + mediumType, densityCode); - break; - } + return MediaType.QIC24; + case 0x09: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to IBM 3490.", + mediumType, densityCode); - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-4.", - mediumType, densityCode); + return MediaType.IBM3490; + case 0x0F: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to QIC-120.", + mediumType, densityCode); - return MediaType.LTO4WORM; - } + return MediaType.QIC120; + case 0x10: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to QIC-150.", + mediumType, densityCode); - break; - } + return MediaType.QIC150; + case 0x13: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS.", + mediumType, densityCode); - case 0x58: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-5.", - mediumType, densityCode); + return MediaType.DDS1; + case 0x24: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS-2.", + mediumType, densityCode); - return MediaType.LTO5WORM; - } + return MediaType.DDS2; + case 0x25: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS-3.", + mediumType, densityCode); - break; - } - } - } + return MediaType.DDS3; + case 0x26: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS-4.", + mediumType, densityCode); - break; - case 0x18: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO.", - mediumType, densityCode); + return MediaType.DDS4; + case 0x28: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to IBM 3490E.", + mediumType, densityCode); - return MediaType.LTO; - } - - break; - } - - case 0x40: + return MediaType.IBM3490E; + case 0x40: + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) { AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to LTO.", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO.", mediumType, densityCode); return MediaType.LTO; } - } - } - break; - case 0x28: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-2.", - mediumType, densityCode); - - return MediaType.LTO2; - } - - break; - } - - case 0x42: + if(model.ToLowerInvariant().StartsWith("sdz", StringComparison.Ordinal)) { AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to LTO-2.", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"sdz\" setting media type to Super AIT.", + mediumType, densityCode); + + return MediaType.SAIT1; + } + + break; + + case 0x41: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-2.", mediumType, densityCode); return MediaType.LTO2; } + + break; } - } - break; - case 0x33: - { - switch(densityCode) + case 0x42: { - case 0x00: - case 0x25: + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) { - if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to DDS-3.", - mediumType, densityCode); - - return MediaType.DDS3; - } - - break; - } - } - } - - break; - case 0x34: - { - switch(densityCode) - { - case 0x00: - case 0x26: - { - if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to DDS-4.", - mediumType, densityCode); - - return MediaType.DDS4; - } - - break; - } - } - } - - break; - case 0x35: - { - switch(densityCode) - { - case 0x00: - case 0x47: - { - if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to DAT72.", - mediumType, densityCode); - - return MediaType.DAT72; - } - - break; - } - } - } - - break; - case 0x38: - { - switch(densityCode) - { - case 0x00: - case 0x44: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-3.", - mediumType, densityCode); - - return MediaType.LTO3; - } - - break; - } - } - } - - break; - case 0x3C: - { - switch(densityCode) - { - case 0x00: - case 0x44: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-3.", - mediumType, densityCode); - - return MediaType.LTO3WORM; - } - - break; - } - } - } - - break; - case 0x48: - { - switch(densityCode) - { - case 0x00: - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-4.", - mediumType, densityCode); - - return MediaType.LTO4; - } - - break; - } - } - } - - break; - case 0x4C: - { - switch(densityCode) - { - case 0x00: - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-4.", - mediumType, densityCode); - - return MediaType.LTO4WORM; - } - - break; - } - } - } - - break; - case 0x50: - { - switch(densityCode) - { - case 0x00: - case 0x24: - { - if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to DDS-2.", - mediumType, densityCode); - - return MediaType.DDS2; - } - - break; - } - } - } - - break; - case 0x58: - { - switch(densityCode) - { - case 0x00: - case 0x58: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-5.", - mediumType, densityCode); - - return MediaType.LTO5; - } - - break; - } - } - } - - break; - case 0x5C: - { - switch(densityCode) - { - case 0x00: - case 0x58: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-5.", - mediumType, densityCode); - - return MediaType.LTO5WORM; - } - - break; - } - } - } - - break; - case 0x68: - { - switch(densityCode) - { - case 0x00: - case 0x5A: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-6.", - mediumType, densityCode); - - return MediaType.LTO6; - } - - break; - } - } - } - - break; - case 0x6C: - { - switch(densityCode) - { - case 0x00: - case 0x5A: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-6.", - mediumType, densityCode); - - return MediaType.LTO6WORM; - } - - break; - } - } - } - - break; - case 0x78: - { - switch(densityCode) - { - case 0x00: - case 0x5C: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-7.", - mediumType, densityCode); - - return MediaType.LTO7; - } - - break; - } - } - } - - break; - case 0x7C: - { - switch(densityCode) - { - case 0x00: - case 0x5C: - { - if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-7.", - mediumType, densityCode); - - return MediaType.LTO7WORM; - } - - break; - } - } - } - - break; - case 0x81: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 15m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape15m; - } - - if(vendor.ToLowerInvariant() == "ibm") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is IBM, setting media type to IBM 3592.", - mediumType, densityCode); - - return MediaType.IBM3592; - } - - if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"vxa\" setting media type to VXA.", - mediumType, densityCode); - - return MediaType.VXA1; - } - - break; - } - - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 15m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape15m; - } - - break; - } - - case 0x29: - case 0x2A: - { - if(vendor.ToLowerInvariant() == "ibm") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is IBM, setting media type to IBM 3592.", - mediumType, densityCode); - - return MediaType.IBM3592; - } - - break; - } - - case 0x80: - { - if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"vxa\" setting media type to VXA.", - mediumType, densityCode); - - return MediaType.VXA1; - } - - break; - } - } - } - - break; - case 0x82: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 28m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape28m; - } - - if(vendor.ToLowerInvariant() == "ibm") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is IBM, setting media type to IBM 3592.", - mediumType, densityCode); - - return MediaType.IBM3592; - } - - break; - } - - case 0x0A: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to CompactTape.", - mediumType, densityCode); - - return MediaType.CompactTapeI; - } - - break; - } - - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 28m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape28m; - } - - break; - } - - case 0x16: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to CompactTape II.", - mediumType, densityCode); - - return MediaType.CompactTapeII; - } - - break; - } - - case 0x29: - case 0x2A: - { - if(vendor.ToLowerInvariant() == "ibm") - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is IBM, setting media type to IBM 3592.", - mediumType, densityCode); - - return MediaType.IBM3592; - } - - break; - } - - case 0x81: - { - if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"vxa\" setting media type to VXA 2.", - mediumType, densityCode); - - return MediaType.VXA2; - } - - break; - } - - case 0x82: - { - if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"vxa\" setting media type to VXA 3.", - mediumType, densityCode); - - return MediaType.VXA3; - } - - break; - } - } - } - - break; - case 0x83: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 54m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape54m; - } - - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape III.", - mediumType, densityCode); - - return MediaType.DLTtapeIII; - } - - break; - } - - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 54m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape54m; - } - - break; - } - - case 0x17: - case 0x18: - case 0x19: - case 0x80: - case 0x81: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape III.", - mediumType, densityCode); - - return MediaType.DLTtapeIII; - } - - break; - } - } - } - - break; - case 0x84: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 80m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape80m; - } - - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape IIIxt.", - mediumType, densityCode); - - return MediaType.DLTtapeIIIxt; - } - - break; - } - - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 80m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape80m; - } - - break; - } - - case 0x19: - case 0x80: - case 0x81: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape IIIxt.", - mediumType, densityCode); - - return MediaType.DLTtapeIIIxt; - } - - break; - } - } - } - - break; - case 0x85: - { - switch(densityCode) - { - case 0x00: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 106m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape106m; - } - - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape IV.", - mediumType, densityCode); - - return MediaType.DLTtapeIV; - } - - if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"stt\" setting media type to Travan 5.", - mediumType, densityCode); - - return MediaType.Travan5; - } - - break; - } - - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 106m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape106m; - } - - break; - } - - case 0x1A: - case 0x1B: - case 0x40: - case 0x41: - case 0x82: - case 0x83: - case 0x84: - case 0x85: - case 0x86: - case 0x87: - case 0x88: - case 0x89: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape IV.", - mediumType, densityCode); - - return MediaType.DLTtapeIV; - } - - break; - } - - case 0x46: - { - if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"stt\" setting media type to Travan 5.", - mediumType, densityCode); - - return MediaType.Travan5; - } - - break; - } - } - } - - break; - case 0x86: - { - switch(densityCode) - { - case 0x00: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 160m Exatape XL.", - mediumType, densityCode); - - return MediaType.Exatape160mXL; - } - - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to SuperDLT.", - mediumType, densityCode); - - return MediaType.SDLT1; - } - - break; - } - - case 0x8C: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 160m Exatape XL.", - mediumType, densityCode); - - return MediaType.Exatape160mXL; - } - - break; - } - - case 0x91: - case 0x92: - case 0x93: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to SuperDLT.", - mediumType, densityCode); - - return MediaType.SDLT1; - } - - break; - } - } - } - - break; - case 0x87: - { - switch(densityCode) - { - case 0x00: - case 0x4A: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to SuperDLT 2.", - mediumType, densityCode); - - return MediaType.SDLT2; - } - - break; - } - } - } - - break; - case 0x90: - { - switch(densityCode) - { - case 0x00: - case 0x50: - case 0x98: - case 0x99: - { - if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || - model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to VStape I.", - mediumType, densityCode); - - return MediaType.VStapeI; - } - - break; - } - } - } - - break; - case 0x95: - { - if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"stt\" setting media type to Travan 7.", - mediumType, densityCode); - - return MediaType.Travan7; - } - } - - break; - case 0xB6: - { - switch(densityCode) - { - case 0x45: - // HP Colorado tapes have a different capacity but return same density code at least in Seagate drives AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to Travan 4.", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-2.", mediumType, densityCode); - return MediaType.Travan4; + return MediaType.LTO2; + } + + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9840A.", + mediumType, densityCode); + + return MediaType.T9840A; + } + + break; + } + + case 0x43: + { + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9940A.", + mediumType, densityCode); + + return MediaType.T9940A; + } + + break; + } + + case 0x44: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-3.", + mediumType, densityCode); + + return MediaType.LTO3; + } + + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9940B.", + mediumType, densityCode); + + return MediaType.T9940B; + } + + break; + } + + case 0x45: + { + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9840C.", + mediumType, densityCode); + + return MediaType.T9840C; + } + + break; + } + + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-4.", + mediumType, densityCode); + + return MediaType.LTO4; + } + + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T9840D.", + mediumType, densityCode); + + return MediaType.T9840D; + } + + break; + } + + case 0x4A: + { + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T10000A.", + mediumType, densityCode); + + return MediaType.T10000A; + } + + break; + } + + case 0x4B: + { + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T10000B.", + mediumType, densityCode); + + return MediaType.T10000B; + } + + break; + } + + case 0x4C: + { + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T10000C.", + mediumType, densityCode); + + return MediaType.T10000C; + } + + break; + } + + case 0x4D: + { + if(vendor.ToLowerInvariant() == "stk") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is StorageTek, setting media type to T10000D.", + mediumType, densityCode); + + return MediaType.T10000D; + } + + break; + } + + case 0x58: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-5.", + mediumType, densityCode); + + return MediaType.LTO5; + } + + break; + } + + // Used by some HP drives for all generations + case 0x8C: + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to DDS.", + mediumType, densityCode); + + return MediaType.DDS1; } } - break; - case 0xB7: + break; + case 0x01: + { + switch(densityCode) { - switch(densityCode) + case 0x44: { - case 0x47: + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to Travan 5.", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-3.", + mediumType, densityCode); + + return MediaType.LTO3WORM; + } + + break; + } + + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-4.", + mediumType, densityCode); + + return MediaType.LTO4WORM; + } + + break; + } + + case 0x58: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-5.", + mediumType, densityCode); + + return MediaType.LTO5WORM; + } + + break; + } + } + } + + break; + case 0x18: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO.", + mediumType, densityCode); + + return MediaType.LTO; + } + + break; + } + + case 0x40: + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to LTO.", + mediumType, densityCode); + + return MediaType.LTO; + } + } + } + + break; + case 0x28: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-2.", + mediumType, densityCode); + + return MediaType.LTO2; + } + + break; + } + + case 0x42: + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to LTO-2.", + mediumType, densityCode); + + return MediaType.LTO2; + } + } + } + + break; + case 0x33: + { + switch(densityCode) + { + case 0x00: + case 0x25: + { + if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to DDS-3.", + mediumType, densityCode); + + return MediaType.DDS3; + } + + break; + } + } + } + + break; + case 0x34: + { + switch(densityCode) + { + case 0x00: + case 0x26: + { + if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to DDS-4.", + mediumType, densityCode); + + return MediaType.DDS4; + } + + break; + } + } + } + + break; + case 0x35: + { + switch(densityCode) + { + case 0x00: + case 0x47: + { + if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to DAT72.", + mediumType, densityCode); + + return MediaType.DAT72; + } + + break; + } + } + } + + break; + case 0x38: + { + switch(densityCode) + { + case 0x00: + case 0x44: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-3.", + mediumType, densityCode); + + return MediaType.LTO3; + } + + break; + } + } + } + + break; + case 0x3C: + { + switch(densityCode) + { + case 0x00: + case 0x44: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-3.", + mediumType, densityCode); + + return MediaType.LTO3WORM; + } + + break; + } + } + } + + break; + case 0x48: + { + switch(densityCode) + { + case 0x00: + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-4.", + mediumType, densityCode); + + return MediaType.LTO4; + } + + break; + } + } + } + + break; + case 0x4C: + { + switch(densityCode) + { + case 0x00: + case 0x46: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-4.", + mediumType, densityCode); + + return MediaType.LTO4WORM; + } + + break; + } + } + } + + break; + case 0x50: + { + switch(densityCode) + { + case 0x00: + case 0x24: + { + if(model.ToLowerInvariant().StartsWith("dat", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to DDS-2.", + mediumType, densityCode); + + return MediaType.DDS2; + } + + break; + } + } + } + + break; + case 0x58: + { + switch(densityCode) + { + case 0x00: + case 0x58: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-5.", + mediumType, densityCode); + + return MediaType.LTO5; + } + + break; + } + } + } + + break; + case 0x5C: + { + switch(densityCode) + { + case 0x00: + case 0x58: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-5.", + mediumType, densityCode); + + return MediaType.LTO5WORM; + } + + break; + } + } + } + + break; + case 0x68: + { + switch(densityCode) + { + case 0x00: + case 0x5A: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-6.", + mediumType, densityCode); + + return MediaType.LTO6; + } + + break; + } + } + } + + break; + case 0x6C: + { + switch(densityCode) + { + case 0x00: + case 0x5A: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-6.", + mediumType, densityCode); + + return MediaType.LTO6WORM; + } + + break; + } + } + } + + break; + case 0x78: + { + switch(densityCode) + { + case 0x00: + case 0x5C: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to LTO-7.", + mediumType, densityCode); + + return MediaType.LTO7; + } + + break; + } + } + } + + break; + case 0x7C: + { + switch(densityCode) + { + case 0x00: + case 0x5C: + { + if(model.ToLowerInvariant().StartsWith("ult", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"ult\" setting media type to WORM LTO-7.", + mediumType, densityCode); + + return MediaType.LTO7WORM; + } + + break; + } + } + } + + break; + case 0x81: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 15m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape15m; + } + + if(vendor.ToLowerInvariant() == "ibm") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is IBM, setting media type to IBM 3592.", + mediumType, densityCode); + + return MediaType.IBM3592; + } + + if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"vxa\" setting media type to VXA.", + mediumType, densityCode); + + return MediaType.VXA1; + } + + break; + } + + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 15m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape15m; + } + + break; + } + + case 0x29: + case 0x2A: + { + if(vendor.ToLowerInvariant() == "ibm") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is IBM, setting media type to IBM 3592.", + mediumType, densityCode); + + return MediaType.IBM3592; + } + + break; + } + + case 0x80: + { + if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"vxa\" setting media type to VXA.", + mediumType, densityCode); + + return MediaType.VXA1; + } + + break; + } + } + } + + break; + case 0x82: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 28m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape28m; + } + + if(vendor.ToLowerInvariant() == "ibm") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is IBM, setting media type to IBM 3592.", + mediumType, densityCode); + + return MediaType.IBM3592; + } + + break; + } + + case 0x0A: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to CompactTape.", + mediumType, densityCode); + + return MediaType.CompactTapeI; + } + + break; + } + + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 28m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape28m; + } + + break; + } + + case 0x16: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to CompactTape II.", + mediumType, densityCode); + + return MediaType.CompactTapeII; + } + + break; + } + + case 0x29: + case 0x2A: + { + if(vendor.ToLowerInvariant() == "ibm") + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive manufacturer is IBM, setting media type to IBM 3592.", + mediumType, densityCode); + + return MediaType.IBM3592; + } + + break; + } + + case 0x81: + { + if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"vxa\" setting media type to VXA 2.", + mediumType, densityCode); + + return MediaType.VXA2; + } + + break; + } + + case 0x82: + { + if(model.ToLowerInvariant().StartsWith("vxa", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"vxa\" setting media type to VXA 3.", + mediumType, densityCode); + + return MediaType.VXA3; + } + + break; + } + } + } + + break; + case 0x83: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 54m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape54m; + } + + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape III.", + mediumType, densityCode); + + return MediaType.DLTtapeIII; + } + + break; + } + + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 54m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape54m; + } + + break; + } + + case 0x17: + case 0x18: + case 0x19: + case 0x80: + case 0x81: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape III.", + mediumType, densityCode); + + return MediaType.DLTtapeIII; + } + + break; + } + } + } + + break; + case 0x84: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 80m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape80m; + } + + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape IIIxt.", + mediumType, densityCode); + + return MediaType.DLTtapeIIIxt; + } + + break; + } + + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 80m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape80m; + } + + break; + } + + case 0x19: + case 0x80: + case 0x81: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape IIIxt.", + mediumType, densityCode); + + return MediaType.DLTtapeIIIxt; + } + + break; + } + } + } + + break; + case 0x85: + { + switch(densityCode) + { + case 0x00: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 106m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape106m; + } + + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape IV.", + mediumType, densityCode); + + return MediaType.DLTtapeIV; + } + + if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"stt\" setting media type to Travan 5.", mediumType, densityCode); return MediaType.Travan5; - } - } - - break; - case 0xC1: - { - switch(densityCode) - { - case 0x00: - case 0x14: - case 0x15: - case 0x8C: - case 0x90: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 22m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape22m; - } - - break; } - } - } - break; - case 0xC2: - { - switch(densityCode) + break; + } + + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: { - case 0x00: - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 40m Exatape.", - mediumType, densityCode); + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 106m Exatape.", + mediumType, densityCode); - return MediaType.Exatape40m; - } - - break; + return MediaType.Exatape106m; } - } - } - break; - case 0xC3: - { - switch(densityCode) + break; + } + + case 0x1A: + case 0x1B: + case 0x40: + case 0x41: + case 0x82: + case 0x83: + case 0x84: + case 0x85: + case 0x86: + case 0x87: + case 0x88: + case 0x89: { - case 0x00: - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 76m Exatape.", - mediumType, densityCode); + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to DLTtape IV.", + mediumType, densityCode); - return MediaType.Exatape76m; - } - - break; + return MediaType.DLTtapeIV; } - } - } - break; - case 0xC4: - { - switch(densityCode) + break; + } + + case 0x46: { - case 0x00: - case 0x14: - case 0x15: - case 0x27: - case 0x8C: - case 0x90: + if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 112m Exatape.", - mediumType, densityCode); + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"stt\" setting media type to Travan 5.", + mediumType, densityCode); - return MediaType.Exatape112m; - } - - break; + return MediaType.Travan5; } + + break; } } - - break; - case 0xD1: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 22m Exatape AME.", - mediumType, densityCode); - - return MediaType.Exatape22mAME; - } - - break; - } - } - } - - break; - case 0xD2: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 170m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape170m; - } - - break; - } - } - } - - break; - case 0xD3: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 125m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape125m; - } - - break; - } - } - } - - break; - case 0xD4: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 45m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape45m; - } - - break; - } - } - } - - break; - case 0xD5: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 225m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape225m; - } - - break; - } - } - } - - break; - case 0xD6: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 150m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape150m; - } - - break; - } - } - } - - break; - case 0xD7: - { - switch(densityCode) - { - case 0x00: - case 0x27: - case 0x28: - { - if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) - { - AaruConsole.DebugWriteLine("Media detection", - "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 75m Exatape.", - mediumType, densityCode); - - return MediaType.Exatape75m; - } - - break; - } - } - } - - break; } - return MediaType.Unknown; + break; + case 0x86: + { + switch(densityCode) + { + case 0x00: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 160m Exatape XL.", + mediumType, densityCode); + + return MediaType.Exatape160mXL; + } + + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to SuperDLT.", + mediumType, densityCode); + + return MediaType.SDLT1; + } + + break; + } + + case 0x8C: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 160m Exatape XL.", + mediumType, densityCode); + + return MediaType.Exatape160mXL; + } + + break; + } + + case 0x91: + case 0x92: + case 0x93: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to SuperDLT.", + mediumType, densityCode); + + return MediaType.SDLT1; + } + + break; + } + } + } + + break; + case 0x87: + { + switch(densityCode) + { + case 0x00: + case 0x4A: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to SuperDLT 2.", + mediumType, densityCode); + + return MediaType.SDLT2; + } + + break; + } + } + } + + break; + case 0x90: + { + switch(densityCode) + { + case 0x00: + case 0x50: + case 0x98: + case 0x99: + { + if(model.ToLowerInvariant().StartsWith("dlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("sdlt", StringComparison.Ordinal) || + model.ToLowerInvariant().StartsWith("superdlt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"dlt\" setting media type to VStape I.", + mediumType, densityCode); + + return MediaType.VStapeI; + } + + break; + } + } + } + + break; + case 0x95: + { + if(model.ToLowerInvariant().StartsWith("stt", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"stt\" setting media type to Travan 7.", + mediumType, densityCode); + + return MediaType.Travan7; + } + } + + break; + case 0xB6: + { + switch(densityCode) + { + case 0x45: + // HP Colorado tapes have a different capacity but return same density code at least in Seagate drives + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to Travan 4.", + mediumType, densityCode); + + return MediaType.Travan4; + } + } + + break; + case 0xB7: + { + switch(densityCode) + { + case 0x47: + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, setting media type to Travan 5.", + mediumType, densityCode); + + return MediaType.Travan5; + } + } + + break; + case 0xC1: + { + switch(densityCode) + { + case 0x00: + case 0x14: + case 0x15: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 22m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape22m; + } + + break; + } + } + } + + break; + case 0xC2: + { + switch(densityCode) + { + case 0x00: + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 40m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape40m; + } + + break; + } + } + } + + break; + case 0xC3: + { + switch(densityCode) + { + case 0x00: + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 76m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape76m; + } + + break; + } + } + } + + break; + case 0xC4: + { + switch(densityCode) + { + case 0x00: + case 0x14: + case 0x15: + case 0x27: + case 0x8C: + case 0x90: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 112m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape112m; + } + + break; + } + } + } + + break; + case 0xD1: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 22m Exatape AME.", + mediumType, densityCode); + + return MediaType.Exatape22mAME; + } + + break; + } + } + } + + break; + case 0xD2: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 170m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape170m; + } + + break; + } + } + } + + break; + case 0xD3: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 125m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape125m; + } + + break; + } + } + } + + break; + case 0xD4: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 45m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape45m; + } + + break; + } + } + } + + break; + case 0xD5: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 225m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape225m; + } + + break; + } + } + } + + break; + case 0xD6: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 150m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape150m; + } + + break; + } + } + } + + break; + case 0xD7: + { + switch(densityCode) + { + case 0x00: + case 0x27: + case 0x28: + { + if(model.ToLowerInvariant().StartsWith("exb", StringComparison.Ordinal)) + { + AaruConsole.DebugWriteLine("Media detection", + "SCSI medium type is {0:X2}h, density code is {1:X2}h, drive model starts with \"exb\" setting media type to 75m Exatape.", + mediumType, densityCode); + + return MediaType.Exatape75m; + } + + break; + } + } + } + + break; } + + return MediaType.Unknown; } } \ No newline at end of file diff --git a/Metadata/CdOffset.cs b/Metadata/CdOffset.cs index 32475cd44..53887c93a 100644 --- a/Metadata/CdOffset.cs +++ b/Metadata/CdOffset.cs @@ -38,21 +38,20 @@ using System.ComponentModel.DataAnnotations; -namespace Aaru.CommonTypes.Metadata +namespace Aaru.CommonTypes.Metadata; + +/// Describes CD reading offset +public class CdOffset { - /// Describes CD reading offset - public class CdOffset - { - /// Drive manufacturer - public string Manufacturer { get; set; } - /// Drive model - public string Model { get; set; } - /// Reading offset - public short Offset { get; set; } - /// Number of times this offset has been submitted - public int Submissions { get; set; } - /// Percentage of submissions in agreement with this offset - [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:P0}")] - public float Agreement { get; set; } - } + /// Drive manufacturer + public string Manufacturer { get; set; } + /// Drive model + public string Model { get; set; } + /// Reading offset + public short Offset { get; set; } + /// Number of times this offset has been submitted + public int Submissions { get; set; } + /// Percentage of submissions in agreement with this offset + [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:P0}")] + public float Agreement { get; set; } } \ No newline at end of file diff --git a/Metadata/DeviceReport.cs b/Metadata/DeviceReport.cs index f85ee9279..3d2430368 100644 --- a/Metadata/DeviceReport.cs +++ b/Metadata/DeviceReport.cs @@ -50,1021 +50,1020 @@ using Newtonsoft.Json; // ReSharper disable InconsistentNaming // ReSharper disable UnusedAutoPropertyAccessor.Global -namespace Aaru.CommonTypes.Metadata +namespace Aaru.CommonTypes.Metadata; + +[Serializable, XmlRoot("DicDeviceReport", Namespace = "", IsNullable = false)] +public class DeviceReport { - [Serializable, XmlRoot("DicDeviceReport", Namespace = "", IsNullable = false)] - public class DeviceReport - { - public usbType USB { get; set; } - public firewireType FireWire { get; set; } - public pcmciaType PCMCIA { get; set; } - public bool CompactFlash { get; set; } - public ataType ATA { get; set; } - public ataType ATAPI { get; set; } - public scsiType SCSI { get; set; } - public mmcsdType MultiMediaCard { get; set; } - public mmcsdType SecureDigital { get; set; } + public usbType USB { get; set; } + public firewireType FireWire { get; set; } + public pcmciaType PCMCIA { get; set; } + public bool CompactFlash { get; set; } + public ataType ATA { get; set; } + public ataType ATAPI { get; set; } + public scsiType SCSI { get; set; } + public mmcsdType MultiMediaCard { get; set; } + public mmcsdType SecureDigital { get; set; } - [XmlIgnore] - public bool CompactFlashSpecified { get; set; } - } + [XmlIgnore] + public bool CompactFlashSpecified { get; set; } +} - public class usbType - { - public ushort VendorID { get; set; } - public ushort ProductID { get; set; } - public string Manufacturer { get; set; } - public string Product { get; set; } - public bool RemovableMedia { get; set; } - public byte[] Descriptors { get; set; } - } +public class usbType +{ + public ushort VendorID { get; set; } + public ushort ProductID { get; set; } + public string Manufacturer { get; set; } + public string Product { get; set; } + public bool RemovableMedia { get; set; } + public byte[] Descriptors { get; set; } +} - public class firewireType - { - public uint VendorID { get; set; } - public uint ProductID { get; set; } - public string Manufacturer { get; set; } - public string Product { get; set; } - public bool RemovableMedia { get; set; } - } +public class firewireType +{ + public uint VendorID { get; set; } + public uint ProductID { get; set; } + public string Manufacturer { get; set; } + public string Product { get; set; } + public bool RemovableMedia { get; set; } +} - public class ataType - { - public string AdditionalPID { get; set; } - public Identify.TransferMode APIOSupported { get; set; } - public ushort ATAPIByteCount { get; set; } - public ushort BufferType { get; set; } - public ushort BufferSize { get; set; } - public Identify.CapabilitiesBit Capabilities { get; set; } - public Identify.CapabilitiesBit2 Capabilities2 { get; set; } - public Identify.CapabilitiesBit3 Capabilities3 { get; set; } - public ushort CFAPowerMode { get; set; } - public Identify.CommandSetBit CommandSet { get; set; } - public Identify.CommandSetBit2 CommandSet2 { get; set; } - public Identify.CommandSetBit3 CommandSet3 { get; set; } - public Identify.CommandSetBit4 CommandSet4 { get; set; } - public Identify.CommandSetBit5 CommandSet5 { get; set; } - public byte CurrentAAM { get; set; } - public ushort CurrentAPM { get; set; } - public Identify.DataSetMgmtBit DataSetMgmt { get; set; } - public ushort DataSetMgmtSize { get; set; } - public Identify.DeviceFormFactorEnum DeviceFormFactor { get; set; } - public Identify.TransferMode DMAActive { get; set; } - public Identify.TransferMode DMASupported { get; set; } - public byte DMATransferTimingMode { get; set; } - public ushort EnhancedSecurityEraseTime { get; set; } - public Identify.CommandSetBit EnabledCommandSet { get; set; } - public Identify.CommandSetBit2 EnabledCommandSet2 { get; set; } - public Identify.CommandSetBit3 EnabledCommandSet3 { get; set; } - public Identify.CommandSetBit4 EnabledCommandSet4 { get; set; } - public Identify.SATAFeaturesBit EnabledSATAFeatures { get; set; } - public ulong ExtendedUserSectors { get; set; } - public byte FreeFallSensitivity { get; set; } - public string FirmwareRevision { get; set; } - public Identify.GeneralConfigurationBit GeneralConfiguration { get; set; } - public ushort HardwareResetResult { get; set; } - public ushort InterseekDelay { get; set; } - public Identify.MajorVersionBit MajorVersion { get; set; } - public ushort MasterPasswordRevisionCode { get; set; } - public ushort MaxDownloadMicroMode3 { get; set; } - public ushort MaxQueueDepth { get; set; } - public Identify.TransferMode MDMAActive { get; set; } - public Identify.TransferMode MDMASupported { get; set; } - public ushort MinDownloadMicroMode3 { get; set; } - public ushort MinMDMACycleTime { get; set; } - public ushort MinorVersion { get; set; } - public ushort MinPIOCycleTimeNoFlow { get; set; } - public ushort MinPIOCycleTimeFlow { get; set; } - public string Model { get; set; } - public byte MultipleMaxSectors { get; set; } - public byte MultipleSectorNumber { get; set; } - public ushort NVCacheCaps { get; set; } - public uint NVCacheSize { get; set; } - public ushort NVCacheWriteSpeed { get; set; } - public byte NVEstimatedSpinUp { get; set; } - public ushort PacketBusRelease { get; set; } - public byte PIOTransferTimingMode { get; set; } - public byte RecommendedAAM { get; set; } - public ushort RecommendedMDMACycleTime { get; set; } - public ushort RemovableStatusSet { get; set; } - public Identify.SATACapabilitiesBit SATACapabilities { get; set; } - public Identify.SATACapabilitiesBit2 SATACapabilities2 { get; set; } - public Identify.SATAFeaturesBit SATAFeatures { get; set; } - public Identify.SCTCommandTransportBit SCTCommandTransport { get; set; } - public uint SectorsPerCard { get; set; } - public ushort SecurityEraseTime { get; set; } - public Identify.SecurityStatusBit SecurityStatus { get; set; } - public ushort ServiceBusyClear { get; set; } - public Identify.SpecificConfigurationEnum SpecificConfiguration { get; set; } - public ushort StreamAccessLatency { get; set; } - public ushort StreamMinReqSize { get; set; } - public uint StreamPerformanceGranularity { get; set; } - public ushort StreamTransferTimeDMA { get; set; } - public ushort StreamTransferTimePIO { get; set; } - public ushort TransportMajorVersion { get; set; } - public ushort TransportMinorVersion { get; set; } - public Identify.TrustedComputingBit TrustedComputing { get; set; } - public Identify.TransferMode UDMAActive { get; set; } - public Identify.TransferMode UDMASupported { get; set; } - public byte WRVMode { get; set; } - public uint WRVSectorCountMode3 { get; set; } - public uint WRVSectorCountMode2 { get; set; } +public class ataType +{ + public string AdditionalPID { get; set; } + public Identify.TransferMode APIOSupported { get; set; } + public ushort ATAPIByteCount { get; set; } + public ushort BufferType { get; set; } + public ushort BufferSize { get; set; } + public Identify.CapabilitiesBit Capabilities { get; set; } + public Identify.CapabilitiesBit2 Capabilities2 { get; set; } + public Identify.CapabilitiesBit3 Capabilities3 { get; set; } + public ushort CFAPowerMode { get; set; } + public Identify.CommandSetBit CommandSet { get; set; } + public Identify.CommandSetBit2 CommandSet2 { get; set; } + public Identify.CommandSetBit3 CommandSet3 { get; set; } + public Identify.CommandSetBit4 CommandSet4 { get; set; } + public Identify.CommandSetBit5 CommandSet5 { get; set; } + public byte CurrentAAM { get; set; } + public ushort CurrentAPM { get; set; } + public Identify.DataSetMgmtBit DataSetMgmt { get; set; } + public ushort DataSetMgmtSize { get; set; } + public Identify.DeviceFormFactorEnum DeviceFormFactor { get; set; } + public Identify.TransferMode DMAActive { get; set; } + public Identify.TransferMode DMASupported { get; set; } + public byte DMATransferTimingMode { get; set; } + public ushort EnhancedSecurityEraseTime { get; set; } + public Identify.CommandSetBit EnabledCommandSet { get; set; } + public Identify.CommandSetBit2 EnabledCommandSet2 { get; set; } + public Identify.CommandSetBit3 EnabledCommandSet3 { get; set; } + public Identify.CommandSetBit4 EnabledCommandSet4 { get; set; } + public Identify.SATAFeaturesBit EnabledSATAFeatures { get; set; } + public ulong ExtendedUserSectors { get; set; } + public byte FreeFallSensitivity { get; set; } + public string FirmwareRevision { get; set; } + public Identify.GeneralConfigurationBit GeneralConfiguration { get; set; } + public ushort HardwareResetResult { get; set; } + public ushort InterseekDelay { get; set; } + public Identify.MajorVersionBit MajorVersion { get; set; } + public ushort MasterPasswordRevisionCode { get; set; } + public ushort MaxDownloadMicroMode3 { get; set; } + public ushort MaxQueueDepth { get; set; } + public Identify.TransferMode MDMAActive { get; set; } + public Identify.TransferMode MDMASupported { get; set; } + public ushort MinDownloadMicroMode3 { get; set; } + public ushort MinMDMACycleTime { get; set; } + public ushort MinorVersion { get; set; } + public ushort MinPIOCycleTimeNoFlow { get; set; } + public ushort MinPIOCycleTimeFlow { get; set; } + public string Model { get; set; } + public byte MultipleMaxSectors { get; set; } + public byte MultipleSectorNumber { get; set; } + public ushort NVCacheCaps { get; set; } + public uint NVCacheSize { get; set; } + public ushort NVCacheWriteSpeed { get; set; } + public byte NVEstimatedSpinUp { get; set; } + public ushort PacketBusRelease { get; set; } + public byte PIOTransferTimingMode { get; set; } + public byte RecommendedAAM { get; set; } + public ushort RecommendedMDMACycleTime { get; set; } + public ushort RemovableStatusSet { get; set; } + public Identify.SATACapabilitiesBit SATACapabilities { get; set; } + public Identify.SATACapabilitiesBit2 SATACapabilities2 { get; set; } + public Identify.SATAFeaturesBit SATAFeatures { get; set; } + public Identify.SCTCommandTransportBit SCTCommandTransport { get; set; } + public uint SectorsPerCard { get; set; } + public ushort SecurityEraseTime { get; set; } + public Identify.SecurityStatusBit SecurityStatus { get; set; } + public ushort ServiceBusyClear { get; set; } + public Identify.SpecificConfigurationEnum SpecificConfiguration { get; set; } + public ushort StreamAccessLatency { get; set; } + public ushort StreamMinReqSize { get; set; } + public uint StreamPerformanceGranularity { get; set; } + public ushort StreamTransferTimeDMA { get; set; } + public ushort StreamTransferTimePIO { get; set; } + public ushort TransportMajorVersion { get; set; } + public ushort TransportMinorVersion { get; set; } + public Identify.TrustedComputingBit TrustedComputing { get; set; } + public Identify.TransferMode UDMAActive { get; set; } + public Identify.TransferMode UDMASupported { get; set; } + public byte WRVMode { get; set; } + public uint WRVSectorCountMode3 { get; set; } + public uint WRVSectorCountMode2 { get; set; } - public byte[] Identify { get; set; } + public byte[] Identify { get; set; } - public testedMediaType ReadCapabilities { get; set; } - public testedMediaType[] RemovableMedias { get; set; } + public testedMediaType ReadCapabilities { get; set; } + public testedMediaType[] RemovableMedias { get; set; } - [XmlIgnore] - public bool AdditionalPIDSpecified { get; set; } - [XmlIgnore] - public bool APIOSupportedSpecified { get; set; } - [XmlIgnore] - public bool ATAPIByteCountSpecified { get; set; } - [XmlIgnore] - public bool BufferTypeSpecified { get; set; } - [XmlIgnore] - public bool BufferSizeSpecified { get; set; } - [XmlIgnore] - public bool CapabilitiesSpecified { get; set; } - [XmlIgnore] - public bool Capabilities2Specified { get; set; } - [XmlIgnore] - public bool Capabilities3Specified { get; set; } - [XmlIgnore] - public bool CFAPowerModeSpecified { get; set; } - [XmlIgnore] - public bool CommandSetSpecified { get; set; } - [XmlIgnore] - public bool CommandSet2Specified { get; set; } - [XmlIgnore] - public bool CommandSet3Specified { get; set; } - [XmlIgnore] - public bool CommandSet4Specified { get; set; } - [XmlIgnore] - public bool CommandSet5Specified { get; set; } - [XmlIgnore] - public bool CurrentAAMSpecified { get; set; } - [XmlIgnore] - public bool CurrentAPMSpecified { get; set; } - [XmlIgnore] - public bool DataSetMgmtSpecified { get; set; } - [XmlIgnore] - public bool DataSetMgmtSizeSpecified { get; set; } - [XmlIgnore] - public bool DeviceFormFactorSpecified { get; set; } - [XmlIgnore] - public bool DMAActiveSpecified { get; set; } - [XmlIgnore] - public bool DMASupportedSpecified { get; set; } - [XmlIgnore] - public bool DMATransferTimingModeSpecified { get; set; } - [XmlIgnore] - public bool EnhancedSecurityEraseTimeSpecified { get; set; } - [XmlIgnore] - public bool EnabledCommandSetSpecified { get; set; } - [XmlIgnore] - public bool EnabledCommandSet2Specified { get; set; } - [XmlIgnore] - public bool EnabledCommandSet3Specified { get; set; } - [XmlIgnore] - public bool EnabledCommandSet4Specified { get; set; } - [XmlIgnore] - public bool EnabledSATAFeaturesSpecified { get; set; } - [XmlIgnore] - public bool ExtendedIdentifySpecified { get; set; } - [XmlIgnore] - public bool ExtendedUserSectorsSpecified { get; set; } - [XmlIgnore] - public bool FreeFallSensitivitySpecified { get; set; } - [XmlIgnore] - public bool FirmwareRevisionSpecified { get; set; } - [XmlIgnore] - public bool GeneralConfigurationSpecified { get; set; } - [XmlIgnore] - public bool HardwareResetResultSpecified { get; set; } - [XmlIgnore] - public bool InterseekDelaySpecified { get; set; } - [XmlIgnore] - public bool MajorVersionSpecified { get; set; } - [XmlIgnore] - public bool MasterPasswordRevisionCodeSpecified { get; set; } - [XmlIgnore] - public bool MaxDownloadMicroMode3Specified { get; set; } - [XmlIgnore] - public bool MaxQueueDepthSpecified { get; set; } - [XmlIgnore] - public bool MDMAActiveSpecified { get; set; } - [XmlIgnore] - public bool MDMASupportedSpecified { get; set; } - [XmlIgnore] - public bool MinDownloadMicroMode3Specified { get; set; } - [XmlIgnore] - public bool MinMDMACycleTimeSpecified { get; set; } - [XmlIgnore] - public bool MinorVersionSpecified { get; set; } - [XmlIgnore] - public bool MinPIOCycleTimeNoFlowSpecified { get; set; } - [XmlIgnore] - public bool MinPIOCycleTimeFlowSpecified { get; set; } - [XmlIgnore] - public bool ModelSpecified { get; set; } - [XmlIgnore] - public bool MultipleMaxSectorsSpecified { get; set; } - [XmlIgnore] - public bool MultipleSectorNumberSpecified { get; set; } - [XmlIgnore] - public bool NVCacheCapsSpecified { get; set; } - [XmlIgnore] - public bool NVCacheSizeSpecified { get; set; } - [XmlIgnore] - public bool NVCacheWriteSpeedSpecified { get; set; } - [XmlIgnore] - public bool NVEstimatedSpinUpSpecified { get; set; } - [XmlIgnore] - public bool PacketBusReleaseSpecified { get; set; } - [XmlIgnore] - public bool PIOTransferTimingModeSpecified { get; set; } - [XmlIgnore] - public bool RecommendedAAMSpecified { get; set; } - [XmlIgnore] - public bool RecommendedMDMACycleTimeSpecified { get; set; } - [XmlIgnore] - public bool RemovableStatusSetSpecified { get; set; } - [XmlIgnore] - public bool SATACapabilitiesSpecified { get; set; } - [XmlIgnore] - public bool SATACapabilities2Specified { get; set; } - [XmlIgnore] - public bool SATAFeaturesSpecified { get; set; } - [XmlIgnore] - public bool SCTCommandTransportSpecified { get; set; } - [XmlIgnore] - public bool SectorsPerCardSpecified { get; set; } - [XmlIgnore] - public bool SecurityEraseTimeSpecified { get; set; } - [XmlIgnore] - public bool SecurityStatusSpecified { get; set; } - [XmlIgnore] - public bool ServiceBusyClearSpecified { get; set; } - [XmlIgnore] - public bool SpecificConfigurationSpecified { get; set; } - [XmlIgnore] - public bool StreamAccessLatencySpecified { get; set; } - [XmlIgnore] - public bool StreamMinReqSizeSpecified { get; set; } - [XmlIgnore] - public bool StreamPerformanceGranularitySpecified { get; set; } - [XmlIgnore] - public bool StreamTransferTimeDMASpecified { get; set; } - [XmlIgnore] - public bool StreamTransferTimePIOSpecified { get; set; } - [XmlIgnore] - public bool TransportMajorVersionSpecified { get; set; } - [XmlIgnore] - public bool TransportMinorVersionSpecified { get; set; } - [XmlIgnore] - public bool TrustedComputingSpecified { get; set; } - [XmlIgnore] - public bool UDMAActiveSpecified { get; set; } - [XmlIgnore] - public bool UDMASupportedSpecified { get; set; } - [XmlIgnore] - public bool WRVModeSpecified { get; set; } - [XmlIgnore] - public bool WRVSectorCountMode3Specified { get; set; } - [XmlIgnore] - public bool WRVSectorCountMode2Specified { get; set; } - } + [XmlIgnore] + public bool AdditionalPIDSpecified { get; set; } + [XmlIgnore] + public bool APIOSupportedSpecified { get; set; } + [XmlIgnore] + public bool ATAPIByteCountSpecified { get; set; } + [XmlIgnore] + public bool BufferTypeSpecified { get; set; } + [XmlIgnore] + public bool BufferSizeSpecified { get; set; } + [XmlIgnore] + public bool CapabilitiesSpecified { get; set; } + [XmlIgnore] + public bool Capabilities2Specified { get; set; } + [XmlIgnore] + public bool Capabilities3Specified { get; set; } + [XmlIgnore] + public bool CFAPowerModeSpecified { get; set; } + [XmlIgnore] + public bool CommandSetSpecified { get; set; } + [XmlIgnore] + public bool CommandSet2Specified { get; set; } + [XmlIgnore] + public bool CommandSet3Specified { get; set; } + [XmlIgnore] + public bool CommandSet4Specified { get; set; } + [XmlIgnore] + public bool CommandSet5Specified { get; set; } + [XmlIgnore] + public bool CurrentAAMSpecified { get; set; } + [XmlIgnore] + public bool CurrentAPMSpecified { get; set; } + [XmlIgnore] + public bool DataSetMgmtSpecified { get; set; } + [XmlIgnore] + public bool DataSetMgmtSizeSpecified { get; set; } + [XmlIgnore] + public bool DeviceFormFactorSpecified { get; set; } + [XmlIgnore] + public bool DMAActiveSpecified { get; set; } + [XmlIgnore] + public bool DMASupportedSpecified { get; set; } + [XmlIgnore] + public bool DMATransferTimingModeSpecified { get; set; } + [XmlIgnore] + public bool EnhancedSecurityEraseTimeSpecified { get; set; } + [XmlIgnore] + public bool EnabledCommandSetSpecified { get; set; } + [XmlIgnore] + public bool EnabledCommandSet2Specified { get; set; } + [XmlIgnore] + public bool EnabledCommandSet3Specified { get; set; } + [XmlIgnore] + public bool EnabledCommandSet4Specified { get; set; } + [XmlIgnore] + public bool EnabledSATAFeaturesSpecified { get; set; } + [XmlIgnore] + public bool ExtendedIdentifySpecified { get; set; } + [XmlIgnore] + public bool ExtendedUserSectorsSpecified { get; set; } + [XmlIgnore] + public bool FreeFallSensitivitySpecified { get; set; } + [XmlIgnore] + public bool FirmwareRevisionSpecified { get; set; } + [XmlIgnore] + public bool GeneralConfigurationSpecified { get; set; } + [XmlIgnore] + public bool HardwareResetResultSpecified { get; set; } + [XmlIgnore] + public bool InterseekDelaySpecified { get; set; } + [XmlIgnore] + public bool MajorVersionSpecified { get; set; } + [XmlIgnore] + public bool MasterPasswordRevisionCodeSpecified { get; set; } + [XmlIgnore] + public bool MaxDownloadMicroMode3Specified { get; set; } + [XmlIgnore] + public bool MaxQueueDepthSpecified { get; set; } + [XmlIgnore] + public bool MDMAActiveSpecified { get; set; } + [XmlIgnore] + public bool MDMASupportedSpecified { get; set; } + [XmlIgnore] + public bool MinDownloadMicroMode3Specified { get; set; } + [XmlIgnore] + public bool MinMDMACycleTimeSpecified { get; set; } + [XmlIgnore] + public bool MinorVersionSpecified { get; set; } + [XmlIgnore] + public bool MinPIOCycleTimeNoFlowSpecified { get; set; } + [XmlIgnore] + public bool MinPIOCycleTimeFlowSpecified { get; set; } + [XmlIgnore] + public bool ModelSpecified { get; set; } + [XmlIgnore] + public bool MultipleMaxSectorsSpecified { get; set; } + [XmlIgnore] + public bool MultipleSectorNumberSpecified { get; set; } + [XmlIgnore] + public bool NVCacheCapsSpecified { get; set; } + [XmlIgnore] + public bool NVCacheSizeSpecified { get; set; } + [XmlIgnore] + public bool NVCacheWriteSpeedSpecified { get; set; } + [XmlIgnore] + public bool NVEstimatedSpinUpSpecified { get; set; } + [XmlIgnore] + public bool PacketBusReleaseSpecified { get; set; } + [XmlIgnore] + public bool PIOTransferTimingModeSpecified { get; set; } + [XmlIgnore] + public bool RecommendedAAMSpecified { get; set; } + [XmlIgnore] + public bool RecommendedMDMACycleTimeSpecified { get; set; } + [XmlIgnore] + public bool RemovableStatusSetSpecified { get; set; } + [XmlIgnore] + public bool SATACapabilitiesSpecified { get; set; } + [XmlIgnore] + public bool SATACapabilities2Specified { get; set; } + [XmlIgnore] + public bool SATAFeaturesSpecified { get; set; } + [XmlIgnore] + public bool SCTCommandTransportSpecified { get; set; } + [XmlIgnore] + public bool SectorsPerCardSpecified { get; set; } + [XmlIgnore] + public bool SecurityEraseTimeSpecified { get; set; } + [XmlIgnore] + public bool SecurityStatusSpecified { get; set; } + [XmlIgnore] + public bool ServiceBusyClearSpecified { get; set; } + [XmlIgnore] + public bool SpecificConfigurationSpecified { get; set; } + [XmlIgnore] + public bool StreamAccessLatencySpecified { get; set; } + [XmlIgnore] + public bool StreamMinReqSizeSpecified { get; set; } + [XmlIgnore] + public bool StreamPerformanceGranularitySpecified { get; set; } + [XmlIgnore] + public bool StreamTransferTimeDMASpecified { get; set; } + [XmlIgnore] + public bool StreamTransferTimePIOSpecified { get; set; } + [XmlIgnore] + public bool TransportMajorVersionSpecified { get; set; } + [XmlIgnore] + public bool TransportMinorVersionSpecified { get; set; } + [XmlIgnore] + public bool TrustedComputingSpecified { get; set; } + [XmlIgnore] + public bool UDMAActiveSpecified { get; set; } + [XmlIgnore] + public bool UDMASupportedSpecified { get; set; } + [XmlIgnore] + public bool WRVModeSpecified { get; set; } + [XmlIgnore] + public bool WRVSectorCountMode3Specified { get; set; } + [XmlIgnore] + public bool WRVSectorCountMode2Specified { get; set; } +} - public class chsType - { - public ushort Cylinders { get; set; } - public ushort Heads { get; set; } - public ushort Sectors { get; set; } - } +public class chsType +{ + public ushort Cylinders { get; set; } + public ushort Heads { get; set; } + public ushort Sectors { get; set; } +} - public class scsiType - { - public scsiInquiryType Inquiry { get; set; } - public pageType[] EVPDPages { get; set; } - public bool SupportsModeSense6 { get; set; } - public bool SupportsModeSense10 { get; set; } - public bool SupportsModeSubpages { get; set; } - public modeType ModeSense { get; set; } - public mmcType MultiMediaDevice { get; set; } - public testedMediaType ReadCapabilities { get; set; } - public testedMediaType[] RemovableMedias { get; set; } - public sscType SequentialDevice { get; set; } - public byte[] ModeSense6Data { get; set; } - public byte[] ModeSense10Data { get; set; } +public class scsiType +{ + public scsiInquiryType Inquiry { get; set; } + public pageType[] EVPDPages { get; set; } + public bool SupportsModeSense6 { get; set; } + public bool SupportsModeSense10 { get; set; } + public bool SupportsModeSubpages { get; set; } + public modeType ModeSense { get; set; } + public mmcType MultiMediaDevice { get; set; } + public testedMediaType ReadCapabilities { get; set; } + public testedMediaType[] RemovableMedias { get; set; } + public sscType SequentialDevice { get; set; } + public byte[] ModeSense6Data { get; set; } + public byte[] ModeSense10Data { get; set; } - [XmlIgnore] - public bool ReadCapabilitiesSpecified { get; set; } - } + [XmlIgnore] + public bool ReadCapabilitiesSpecified { get; set; } +} - public class scsiInquiryType - { - public bool AccessControlCoordinator { get; set; } - public bool ACKRequests { get; set; } - public bool AERCSupported { get; set; } - public bool Address16 { get; set; } - public bool Address32 { get; set; } - public byte ANSIVersion { get; set; } - public TGPSValues AsymmetricalLUNAccess { get; set; } - public bool BasicQueueing { get; set; } - public byte DeviceTypeModifier { get; set; } - public byte ECMAVersion { get; set; } - public bool EnclosureServices { get; set; } - public bool HierarchicalLUN { get; set; } - public bool IUS { get; set; } - public byte ISOVersion { get; set; } - public bool LinkedCommands { get; set; } - public bool MediumChanger { get; set; } - public bool MultiPortDevice { get; set; } - public bool NormalACA { get; set; } - public PeripheralDeviceTypes PeripheralDeviceType { get; set; } - public PeripheralQualifiers PeripheralQualifier { get; set; } - public string ProductIdentification { get; set; } - public string ProductRevisionLevel { get; set; } - public bool Protection { get; set; } - public bool QAS { get; set; } - public bool RelativeAddressing { get; set; } - public bool Removable { get; set; } - public byte ResponseDataFormat { get; set; } - public bool TaggedCommandQueue { get; set; } - public bool TerminateTaskSupported { get; set; } - public bool ThirdPartyCopy { get; set; } - public bool TranferDisable { get; set; } - public bool SoftReset { get; set; } - public SPIClocking SPIClocking { get; set; } - public bool StorageArrayController { get; set; } - public bool SyncTransfer { get; set; } - public string VendorIdentification { get; set; } - public ushort[] VersionDescriptors { get; set; } - public bool WideBus16 { get; set; } - public bool WideBus32 { get; set; } - public byte[] Data { get; set; } +public class scsiInquiryType +{ + public bool AccessControlCoordinator { get; set; } + public bool ACKRequests { get; set; } + public bool AERCSupported { get; set; } + public bool Address16 { get; set; } + public bool Address32 { get; set; } + public byte ANSIVersion { get; set; } + public TGPSValues AsymmetricalLUNAccess { get; set; } + public bool BasicQueueing { get; set; } + public byte DeviceTypeModifier { get; set; } + public byte ECMAVersion { get; set; } + public bool EnclosureServices { get; set; } + public bool HierarchicalLUN { get; set; } + public bool IUS { get; set; } + public byte ISOVersion { get; set; } + public bool LinkedCommands { get; set; } + public bool MediumChanger { get; set; } + public bool MultiPortDevice { get; set; } + public bool NormalACA { get; set; } + public PeripheralDeviceTypes PeripheralDeviceType { get; set; } + public PeripheralQualifiers PeripheralQualifier { get; set; } + public string ProductIdentification { get; set; } + public string ProductRevisionLevel { get; set; } + public bool Protection { get; set; } + public bool QAS { get; set; } + public bool RelativeAddressing { get; set; } + public bool Removable { get; set; } + public byte ResponseDataFormat { get; set; } + public bool TaggedCommandQueue { get; set; } + public bool TerminateTaskSupported { get; set; } + public bool ThirdPartyCopy { get; set; } + public bool TranferDisable { get; set; } + public bool SoftReset { get; set; } + public SPIClocking SPIClocking { get; set; } + public bool StorageArrayController { get; set; } + public bool SyncTransfer { get; set; } + public string VendorIdentification { get; set; } + public ushort[] VersionDescriptors { get; set; } + public bool WideBus16 { get; set; } + public bool WideBus32 { get; set; } + public byte[] Data { get; set; } - [XmlIgnore] - public bool ANSIVersionSpecified { get; set; } - [XmlIgnore] - public bool ECMAVersionSpecified { get; set; } - [XmlIgnore] - public bool DeviceTypeModifierSpecified { get; set; } - [XmlIgnore] - public bool ISOVersionSpecified { get; set; } - [XmlIgnore] - public bool ProductIdentificationSpecified { get; set; } - [XmlIgnore] - public bool ProductRevisionLevelSpecified { get; set; } - [XmlIgnore] - public bool ResponseDataFormatSpecified { get; set; } - [XmlIgnore] - public bool VendorIdentificationSpecified { get; set; } - } + [XmlIgnore] + public bool ANSIVersionSpecified { get; set; } + [XmlIgnore] + public bool ECMAVersionSpecified { get; set; } + [XmlIgnore] + public bool DeviceTypeModifierSpecified { get; set; } + [XmlIgnore] + public bool ISOVersionSpecified { get; set; } + [XmlIgnore] + public bool ProductIdentificationSpecified { get; set; } + [XmlIgnore] + public bool ProductRevisionLevelSpecified { get; set; } + [XmlIgnore] + public bool ResponseDataFormatSpecified { get; set; } + [XmlIgnore] + public bool VendorIdentificationSpecified { get; set; } +} - [Serializable] - public class pageType - { - [XmlAttribute] - public byte page { get; set; } +[Serializable] +public class pageType +{ + [XmlAttribute] + public byte page { get; set; } - [XmlText] - public byte[] value { get; set; } - } + [XmlText] + public byte[] value { get; set; } +} - public class modeType - { - public byte MediumType { get; set; } - public bool WriteProtected { get; set; } - public blockDescriptorType[] BlockDescriptors { get; set; } - public byte Speed { get; set; } - public byte BufferedMode { get; set; } - public bool BlankCheckEnabled { get; set; } - public bool DPOandFUA { get; set; } - public modePageType[] ModePages { get; set; } +public class modeType +{ + public byte MediumType { get; set; } + public bool WriteProtected { get; set; } + public blockDescriptorType[] BlockDescriptors { get; set; } + public byte Speed { get; set; } + public byte BufferedMode { get; set; } + public bool BlankCheckEnabled { get; set; } + public bool DPOandFUA { get; set; } + public modePageType[] ModePages { get; set; } - [XmlIgnore] - public bool MediumTypeSpecified { get; set; } - [XmlIgnore] - public bool SpeedSpecified { get; set; } - [XmlIgnore] - public bool BufferedModeSpecified { get; set; } - } + [XmlIgnore] + public bool MediumTypeSpecified { get; set; } + [XmlIgnore] + public bool SpeedSpecified { get; set; } + [XmlIgnore] + public bool BufferedModeSpecified { get; set; } +} - public class blockDescriptorType - { - public byte Density { get; set; } - public ulong Blocks { get; set; } - public uint BlockLength { get; set; } +public class blockDescriptorType +{ + public byte Density { get; set; } + public ulong Blocks { get; set; } + public uint BlockLength { get; set; } - [XmlIgnore] - public bool BlocksSpecified { get; set; } - [XmlIgnore] - public bool BlockLengthSpecified { get; set; } - } + [XmlIgnore] + public bool BlocksSpecified { get; set; } + [XmlIgnore] + public bool BlockLengthSpecified { get; set; } +} - [Serializable] - public class modePageType - { - [XmlAttribute] - public byte page { get; set; } +[Serializable] +public class modePageType +{ + [XmlAttribute] + public byte page { get; set; } - [XmlAttribute] - public byte subpage { get; set; } + [XmlAttribute] + public byte subpage { get; set; } - [XmlText] - public byte[] value { get; set; } - } + [XmlText] + public byte[] value { get; set; } +} - public class mmcType - { - public mmcModeType ModeSense2A { get; set; } - public mmcFeaturesType Features { get; set; } - public testedMediaType[] TestedMedia { get; set; } - } +public class mmcType +{ + public mmcModeType ModeSense2A { get; set; } + public mmcFeaturesType Features { get; set; } + public testedMediaType[] TestedMedia { get; set; } +} - public class mmcModeType - { - public bool AccurateCDDA { get; set; } - public bool BCK { get; set; } - public ushort BufferSize { get; set; } - public bool BufferUnderRunProtection { get; set; } - public bool CanEject { get; set; } - public bool CanLockMedia { get; set; } - public bool CDDACommand { get; set; } - public bool CompositeAudioVideo { get; set; } - public bool CSSandCPPMSupported { get; set; } - public ushort CurrentSpeed { get; set; } - public ushort CurrentWriteSpeed { get; set; } - public ushort CurrentWriteSpeedSelected { get; set; } - public bool DeterministicSlotChanger { get; set; } - public bool DigitalPort1 { get; set; } - public bool DigitalPort2 { get; set; } - public bool LeadInPW { get; set; } - public byte LoadingMechanismType { get; set; } - public bool LockStatus { get; set; } - public bool LSBF { get; set; } - public ushort MaximumSpeed { get; set; } - public ushort MaximumWriteSpeed { get; set; } - public bool PlaysAudio { get; set; } - public bool PreventJumperStatus { get; set; } - public bool RCK { get; set; } - public bool ReadsBarcode { get; set; } - public bool ReadsBothSides { get; set; } - public bool ReadsCDR { get; set; } - public bool ReadsCDRW { get; set; } - public bool ReadsDeinterlavedSubchannel { get; set; } - public bool ReadsDVDR { get; set; } - public bool ReadsDVDRAM { get; set; } - public bool ReadsDVDROM { get; set; } - public bool ReadsISRC { get; set; } - public bool ReadsMode2Form2 { get; set; } - public bool ReadsMode2Form1 { get; set; } - public bool ReadsPacketCDR { get; set; } - public bool ReadsSubchannel { get; set; } - public bool ReadsUPC { get; set; } - public bool ReturnsC2Pointers { get; set; } - public byte RotationControlSelected { get; set; } - public bool SeparateChannelMute { get; set; } - public bool SeparateChannelVolume { get; set; } - public bool SSS { get; set; } - public bool SupportsMultiSession { get; set; } - public ushort SupportedVolumeLevels { get; set; } - public bool TestWrite { get; set; } - public bool WritesCDR { get; set; } - public bool WritesCDRW { get; set; } - public bool WritesDVDR { get; set; } - public bool WritesDVDRAM { get; set; } - public ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors { get; set; } +public class mmcModeType +{ + public bool AccurateCDDA { get; set; } + public bool BCK { get; set; } + public ushort BufferSize { get; set; } + public bool BufferUnderRunProtection { get; set; } + public bool CanEject { get; set; } + public bool CanLockMedia { get; set; } + public bool CDDACommand { get; set; } + public bool CompositeAudioVideo { get; set; } + public bool CSSandCPPMSupported { get; set; } + public ushort CurrentSpeed { get; set; } + public ushort CurrentWriteSpeed { get; set; } + public ushort CurrentWriteSpeedSelected { get; set; } + public bool DeterministicSlotChanger { get; set; } + public bool DigitalPort1 { get; set; } + public bool DigitalPort2 { get; set; } + public bool LeadInPW { get; set; } + public byte LoadingMechanismType { get; set; } + public bool LockStatus { get; set; } + public bool LSBF { get; set; } + public ushort MaximumSpeed { get; set; } + public ushort MaximumWriteSpeed { get; set; } + public bool PlaysAudio { get; set; } + public bool PreventJumperStatus { get; set; } + public bool RCK { get; set; } + public bool ReadsBarcode { get; set; } + public bool ReadsBothSides { get; set; } + public bool ReadsCDR { get; set; } + public bool ReadsCDRW { get; set; } + public bool ReadsDeinterlavedSubchannel { get; set; } + public bool ReadsDVDR { get; set; } + public bool ReadsDVDRAM { get; set; } + public bool ReadsDVDROM { get; set; } + public bool ReadsISRC { get; set; } + public bool ReadsMode2Form2 { get; set; } + public bool ReadsMode2Form1 { get; set; } + public bool ReadsPacketCDR { get; set; } + public bool ReadsSubchannel { get; set; } + public bool ReadsUPC { get; set; } + public bool ReturnsC2Pointers { get; set; } + public byte RotationControlSelected { get; set; } + public bool SeparateChannelMute { get; set; } + public bool SeparateChannelVolume { get; set; } + public bool SSS { get; set; } + public bool SupportsMultiSession { get; set; } + public ushort SupportedVolumeLevels { get; set; } + public bool TestWrite { get; set; } + public bool WritesCDR { get; set; } + public bool WritesCDRW { get; set; } + public bool WritesDVDR { get; set; } + public bool WritesDVDRAM { get; set; } + public ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors { get; set; } - [XmlIgnore] - public bool MaximumSpeedSpecified { get; set; } - [XmlIgnore] - public bool SupportedVolumeLevelsSpecified { get; set; } - [XmlIgnore] - public bool BufferSizeSpecified { get; set; } - [XmlIgnore] - public bool CurrentSpeedSpecified { get; set; } - [XmlIgnore] - public bool MaximumWriteSpeedSpecified { get; set; } - [XmlIgnore] - public bool CurrentWriteSpeedSpecified { get; set; } - [XmlIgnore] - public bool RotationControlSelectedSpecified { get; set; } - [XmlIgnore] - public bool CurrentWriteSpeedSelectedSpecified { get; set; } - } + [XmlIgnore] + public bool MaximumSpeedSpecified { get; set; } + [XmlIgnore] + public bool SupportedVolumeLevelsSpecified { get; set; } + [XmlIgnore] + public bool BufferSizeSpecified { get; set; } + [XmlIgnore] + public bool CurrentSpeedSpecified { get; set; } + [XmlIgnore] + public bool MaximumWriteSpeedSpecified { get; set; } + [XmlIgnore] + public bool CurrentWriteSpeedSpecified { get; set; } + [XmlIgnore] + public bool RotationControlSelectedSpecified { get; set; } + [XmlIgnore] + public bool CurrentWriteSpeedSelectedSpecified { get; set; } +} - public class mmcFeaturesType - { - public byte AACSVersion { get; set; } - public byte AGIDs { get; set; } - public byte BindingNonceBlocks { get; set; } - public ushort BlocksPerReadableUnit { get; set; } - public bool BufferUnderrunFreeInDVD { get; set; } - public bool BufferUnderrunFreeInSAO { get; set; } - public bool BufferUnderrunFreeInTAO { get; set; } - public bool CanAudioScan { get; set; } - public bool CanEject { get; set; } - public bool CanEraseSector { get; set; } - public bool CanExpandBDRESpareArea { get; set; } - public bool CanFormat { get; set; } - public bool CanFormatBDREWithoutSpare { get; set; } - public bool CanFormatCert { get; set; } - public bool CanFormatFRF { get; set; } - public bool CanFormatQCert { get; set; } - public bool CanFormatRRM { get; set; } - public bool CanGenerateBindingNonce { get; set; } - public bool CanLoad { get; set; } - public bool CanMuteSeparateChannels { get; set; } - public bool CanOverwriteSAOTrack { get; set; } - public bool CanOverwriteTAOTrack { get; set; } - public bool CanPlayCDAudio { get; set; } - public bool CanPseudoOverwriteBDR { get; set; } - public bool CanReadAllDualR { get; set; } - public bool CanReadAllDualRW { get; set; } - public bool CanReadBD { get; set; } - public bool CanReadBDR { get; set; } - public bool CanReadBDRE1 { get; set; } - public bool CanReadBDRE2 { get; set; } - public bool CanReadBDROM { get; set; } - public bool CanReadBluBCA { get; set; } - public bool CanReadCD { get; set; } - public bool CanReadCDMRW { get; set; } - public bool CanReadCPRM_MKB { get; set; } - public bool CanReadDDCD { get; set; } - public bool CanReadDVD { get; set; } - public bool CanReadDVDPlusMRW { get; set; } - public bool CanReadDVDPlusR { get; set; } - public bool CanReadDVDPlusRDL { get; set; } - public bool CanReadDVDPlusRW { get; set; } - public bool CanReadDVDPlusRWDL { get; set; } - public bool CanReadDriveAACSCertificate { get; set; } - public bool CanReadHDDVD { get; set; } - public bool CanReadHDDVDR { get; set; } - public bool CanReadHDDVDRAM { get; set; } - public bool CanReadLeadInCDText { get; set; } - public bool CanReadOldBDR { get; set; } - public bool CanReadOldBDRE { get; set; } - public bool CanReadOldBDROM { get; set; } - public bool CanReadSpareAreaInformation { get; set; } - public bool CanReportDriveSerial { get; set; } - public bool CanReportMediaSerial { get; set; } - public bool CanTestWriteDDCDR { get; set; } - public bool CanTestWriteDVD { get; set; } - public bool CanTestWriteInSAO { get; set; } - public bool CanTestWriteInTAO { get; set; } - public bool CanUpgradeFirmware { get; set; } - public bool CanWriteBD { get; set; } - public bool CanWriteBDR { get; set; } - public bool CanWriteBDRE1 { get; set; } - public bool CanWriteBDRE2 { get; set; } - public bool CanWriteBusEncryptedBlocks { get; set; } - public bool CanWriteCDMRW { get; set; } - public bool CanWriteCDRW { get; set; } - public bool CanWriteCDRWCAV { get; set; } - public bool CanWriteCDSAO { get; set; } - public bool CanWriteCDTAO { get; set; } - public bool CanWriteCSSManagedDVD { get; set; } - public bool CanWriteDDCDR { get; set; } - public bool CanWriteDDCDRW { get; set; } - public bool CanWriteDVDPlusMRW { get; set; } - public bool CanWriteDVDPlusR { get; set; } - public bool CanWriteDVDPlusRDL { get; set; } - public bool CanWriteDVDPlusRW { get; set; } - public bool CanWriteDVDPlusRWDL { get; set; } - public bool CanWriteDVDR { get; set; } - public bool CanWriteDVDRDL { get; set; } - public bool CanWriteDVDRW { get; set; } - public bool CanWriteHDDVDR { get; set; } - public bool CanWriteHDDVDRAM { get; set; } - public bool CanWriteOldBDR { get; set; } - public bool CanWriteOldBDRE { get; set; } - public bool CanWritePackedSubchannelInTAO { get; set; } - public bool CanWriteRWSubchannelInSAO { get; set; } - public bool CanWriteRWSubchannelInTAO { get; set; } - public bool CanWriteRaw { get; set; } - public bool CanWriteRawMultiSession { get; set; } - public bool CanWriteRawSubchannelInTAO { get; set; } - public bool ChangerIsSideChangeCapable { get; set; } - public byte ChangerSlots { get; set; } - public bool ChangerSupportsDiscPresent { get; set; } - public byte CPRMVersion { get; set; } - public byte CSSVersion { get; set; } - public bool DBML { get; set; } - public bool DVDMultiRead { get; set; } - public bool EmbeddedChanger { get; set; } - public bool ErrorRecoveryPage { get; set; } - [XmlElement(DataType = "date")] - public DateTime FirmwareDate { get; set; } - public byte LoadingMechanismType { get; set; } - public bool Locked { get; set; } - public uint LogicalBlockSize { get; set; } - public bool MultiRead { get; set; } - public PhysicalInterfaces PhysicalInterfaceStandard { get; set; } - public uint PhysicalInterfaceStandardNumber { get; set; } - public bool PreventJumper { get; set; } - public bool SupportsAACS { get; set; } - public bool SupportsBusEncryption { get; set; } - public bool SupportsC2 { get; set; } - public bool SupportsCPRM { get; set; } - public bool SupportsCSS { get; set; } - public bool SupportsDAP { get; set; } - public bool SupportsDeviceBusyEvent { get; set; } - public bool SupportsHybridDiscs { get; set; } - public bool SupportsModePage1Ch { get; set; } - public bool SupportsOSSC { get; set; } - public bool SupportsPWP { get; set; } - public bool SupportsSWPP { get; set; } - public bool SupportsSecurDisc { get; set; } - public bool SupportsSeparateVolume { get; set; } - public bool SupportsVCPS { get; set; } - public bool SupportsWriteInhibitDCB { get; set; } - public bool SupportsWriteProtectPAC { get; set; } - public ushort VolumeLevels { get; set; } +public class mmcFeaturesType +{ + public byte AACSVersion { get; set; } + public byte AGIDs { get; set; } + public byte BindingNonceBlocks { get; set; } + public ushort BlocksPerReadableUnit { get; set; } + public bool BufferUnderrunFreeInDVD { get; set; } + public bool BufferUnderrunFreeInSAO { get; set; } + public bool BufferUnderrunFreeInTAO { get; set; } + public bool CanAudioScan { get; set; } + public bool CanEject { get; set; } + public bool CanEraseSector { get; set; } + public bool CanExpandBDRESpareArea { get; set; } + public bool CanFormat { get; set; } + public bool CanFormatBDREWithoutSpare { get; set; } + public bool CanFormatCert { get; set; } + public bool CanFormatFRF { get; set; } + public bool CanFormatQCert { get; set; } + public bool CanFormatRRM { get; set; } + public bool CanGenerateBindingNonce { get; set; } + public bool CanLoad { get; set; } + public bool CanMuteSeparateChannels { get; set; } + public bool CanOverwriteSAOTrack { get; set; } + public bool CanOverwriteTAOTrack { get; set; } + public bool CanPlayCDAudio { get; set; } + public bool CanPseudoOverwriteBDR { get; set; } + public bool CanReadAllDualR { get; set; } + public bool CanReadAllDualRW { get; set; } + public bool CanReadBD { get; set; } + public bool CanReadBDR { get; set; } + public bool CanReadBDRE1 { get; set; } + public bool CanReadBDRE2 { get; set; } + public bool CanReadBDROM { get; set; } + public bool CanReadBluBCA { get; set; } + public bool CanReadCD { get; set; } + public bool CanReadCDMRW { get; set; } + public bool CanReadCPRM_MKB { get; set; } + public bool CanReadDDCD { get; set; } + public bool CanReadDVD { get; set; } + public bool CanReadDVDPlusMRW { get; set; } + public bool CanReadDVDPlusR { get; set; } + public bool CanReadDVDPlusRDL { get; set; } + public bool CanReadDVDPlusRW { get; set; } + public bool CanReadDVDPlusRWDL { get; set; } + public bool CanReadDriveAACSCertificate { get; set; } + public bool CanReadHDDVD { get; set; } + public bool CanReadHDDVDR { get; set; } + public bool CanReadHDDVDRAM { get; set; } + public bool CanReadLeadInCDText { get; set; } + public bool CanReadOldBDR { get; set; } + public bool CanReadOldBDRE { get; set; } + public bool CanReadOldBDROM { get; set; } + public bool CanReadSpareAreaInformation { get; set; } + public bool CanReportDriveSerial { get; set; } + public bool CanReportMediaSerial { get; set; } + public bool CanTestWriteDDCDR { get; set; } + public bool CanTestWriteDVD { get; set; } + public bool CanTestWriteInSAO { get; set; } + public bool CanTestWriteInTAO { get; set; } + public bool CanUpgradeFirmware { get; set; } + public bool CanWriteBD { get; set; } + public bool CanWriteBDR { get; set; } + public bool CanWriteBDRE1 { get; set; } + public bool CanWriteBDRE2 { get; set; } + public bool CanWriteBusEncryptedBlocks { get; set; } + public bool CanWriteCDMRW { get; set; } + public bool CanWriteCDRW { get; set; } + public bool CanWriteCDRWCAV { get; set; } + public bool CanWriteCDSAO { get; set; } + public bool CanWriteCDTAO { get; set; } + public bool CanWriteCSSManagedDVD { get; set; } + public bool CanWriteDDCDR { get; set; } + public bool CanWriteDDCDRW { get; set; } + public bool CanWriteDVDPlusMRW { get; set; } + public bool CanWriteDVDPlusR { get; set; } + public bool CanWriteDVDPlusRDL { get; set; } + public bool CanWriteDVDPlusRW { get; set; } + public bool CanWriteDVDPlusRWDL { get; set; } + public bool CanWriteDVDR { get; set; } + public bool CanWriteDVDRDL { get; set; } + public bool CanWriteDVDRW { get; set; } + public bool CanWriteHDDVDR { get; set; } + public bool CanWriteHDDVDRAM { get; set; } + public bool CanWriteOldBDR { get; set; } + public bool CanWriteOldBDRE { get; set; } + public bool CanWritePackedSubchannelInTAO { get; set; } + public bool CanWriteRWSubchannelInSAO { get; set; } + public bool CanWriteRWSubchannelInTAO { get; set; } + public bool CanWriteRaw { get; set; } + public bool CanWriteRawMultiSession { get; set; } + public bool CanWriteRawSubchannelInTAO { get; set; } + public bool ChangerIsSideChangeCapable { get; set; } + public byte ChangerSlots { get; set; } + public bool ChangerSupportsDiscPresent { get; set; } + public byte CPRMVersion { get; set; } + public byte CSSVersion { get; set; } + public bool DBML { get; set; } + public bool DVDMultiRead { get; set; } + public bool EmbeddedChanger { get; set; } + public bool ErrorRecoveryPage { get; set; } + [XmlElement(DataType = "date")] + public DateTime FirmwareDate { get; set; } + public byte LoadingMechanismType { get; set; } + public bool Locked { get; set; } + public uint LogicalBlockSize { get; set; } + public bool MultiRead { get; set; } + public PhysicalInterfaces PhysicalInterfaceStandard { get; set; } + public uint PhysicalInterfaceStandardNumber { get; set; } + public bool PreventJumper { get; set; } + public bool SupportsAACS { get; set; } + public bool SupportsBusEncryption { get; set; } + public bool SupportsC2 { get; set; } + public bool SupportsCPRM { get; set; } + public bool SupportsCSS { get; set; } + public bool SupportsDAP { get; set; } + public bool SupportsDeviceBusyEvent { get; set; } + public bool SupportsHybridDiscs { get; set; } + public bool SupportsModePage1Ch { get; set; } + public bool SupportsOSSC { get; set; } + public bool SupportsPWP { get; set; } + public bool SupportsSWPP { get; set; } + public bool SupportsSecurDisc { get; set; } + public bool SupportsSeparateVolume { get; set; } + public bool SupportsVCPS { get; set; } + public bool SupportsWriteInhibitDCB { get; set; } + public bool SupportsWriteProtectPAC { get; set; } + public ushort VolumeLevels { get; set; } - [XmlIgnore] - public bool PhysicalInterfaceStandardSpecified { get; set; } - [XmlIgnore] - public bool PhysicalInterfaceStandardNumberSpecified { get; set; } - [XmlIgnore] - public bool AACSVersionSpecified { get; set; } - [XmlIgnore] - public bool AGIDsSpecified { get; set; } - [XmlIgnore] - public bool BindingNonceBlocksSpecified { get; set; } - [XmlIgnore] - public bool CPRMVersionSpecified { get; set; } - [XmlIgnore] - public bool CSSVersionSpecified { get; set; } - [XmlIgnore] - public bool ChangerHighestSlotNumberSpecified { get; set; } - [XmlIgnore] - public bool LoadingMechanismTypeSpecified { get; set; } - [XmlIgnore] - public bool LogicalBlockSizeSpecified { get; set; } - [XmlIgnore] - public bool BlocksPerReadableUnitSpecified { get; set; } - [XmlIgnore] - public bool FirmwareDateSpecified { get; set; } - [XmlIgnore] - public bool VolumeLevelsSpecified { get; set; } - } + [XmlIgnore] + public bool PhysicalInterfaceStandardSpecified { get; set; } + [XmlIgnore] + public bool PhysicalInterfaceStandardNumberSpecified { get; set; } + [XmlIgnore] + public bool AACSVersionSpecified { get; set; } + [XmlIgnore] + public bool AGIDsSpecified { get; set; } + [XmlIgnore] + public bool BindingNonceBlocksSpecified { get; set; } + [XmlIgnore] + public bool CPRMVersionSpecified { get; set; } + [XmlIgnore] + public bool CSSVersionSpecified { get; set; } + [XmlIgnore] + public bool ChangerHighestSlotNumberSpecified { get; set; } + [XmlIgnore] + public bool LoadingMechanismTypeSpecified { get; set; } + [XmlIgnore] + public bool LogicalBlockSizeSpecified { get; set; } + [XmlIgnore] + public bool BlocksPerReadableUnitSpecified { get; set; } + [XmlIgnore] + public bool FirmwareDateSpecified { get; set; } + [XmlIgnore] + public bool VolumeLevelsSpecified { get; set; } +} - public class testedMediaType - { - public ulong Blocks { get; set; } - public uint BlockSize { get; set; } - public bool CanReadAACS { get; set; } - public bool CanReadADIP { get; set; } - public bool CanReadATIP { get; set; } - public bool CanReadBCA { get; set; } - public bool CanReadC2Pointers { get; set; } - public bool CanReadCMI { get; set; } - public bool CanReadCorrectedSubchannel { get; set; } - public bool CanReadCorrectedSubchannelWithC2 { get; set; } - public bool CanReadDCB { get; set; } - public bool CanReadDDS { get; set; } - public bool CanReadDMI { get; set; } - public bool CanReadDiscInformation { get; set; } - public bool CanReadFullTOC { get; set; } - public bool CanReadHDCMI { get; set; } - public bool CanReadLayerCapacity { get; set; } - public bool CanReadLeadIn { get; set; } - public bool CanReadLeadOut { get; set; } - public bool CanReadMediaID { get; set; } - public bool CanReadMediaSerial { get; set; } - public bool CanReadPAC { get; set; } - public bool CanReadPFI { get; set; } - public bool CanReadPMA { get; set; } - public bool CanReadPQSubchannel { get; set; } - public bool CanReadPQSubchannelWithC2 { get; set; } - public bool CanReadPRI { get; set; } - public bool CanReadRWSubchannel { get; set; } - public bool CanReadRWSubchannelWithC2 { get; set; } - public bool CanReadRecordablePFI { get; set; } - public bool CanReadSpareAreaInformation { get; set; } - public bool CanReadTOC { get; set; } - public byte Density { get; set; } - public uint LongBlockSize { get; set; } - public string Manufacturer { get; set; } - public bool MediaIsRecognized { get; set; } - public byte MediumType { get; set; } - public string MediumTypeName { get; set; } - public string Model { get; set; } - public bool SupportsHLDTSTReadRawDVD { get; set; } - public bool SupportsNECReadCDDA { get; set; } - public bool SupportsPioneerReadCDDA { get; set; } - public bool SupportsPioneerReadCDDAMSF { get; set; } - public bool SupportsPlextorReadCDDA { get; set; } - public bool SupportsPlextorReadRawDVD { get; set; } - public bool SupportsRead10 { get; set; } - public bool SupportsRead12 { get; set; } - public bool SupportsRead16 { get; set; } - public bool SupportsRead { get; set; } - public bool SupportsReadCapacity16 { get; set; } - public bool SupportsReadCapacity { get; set; } - public bool SupportsReadCd { get; set; } - public bool SupportsReadCdMsf { get; set; } - public bool SupportsReadCdRaw { get; set; } - public bool SupportsReadCdMsfRaw { get; set; } - public bool SupportsReadLong16 { get; set; } - public bool SupportsReadLong { get; set; } +public class testedMediaType +{ + public ulong Blocks { get; set; } + public uint BlockSize { get; set; } + public bool CanReadAACS { get; set; } + public bool CanReadADIP { get; set; } + public bool CanReadATIP { get; set; } + public bool CanReadBCA { get; set; } + public bool CanReadC2Pointers { get; set; } + public bool CanReadCMI { get; set; } + public bool CanReadCorrectedSubchannel { get; set; } + public bool CanReadCorrectedSubchannelWithC2 { get; set; } + public bool CanReadDCB { get; set; } + public bool CanReadDDS { get; set; } + public bool CanReadDMI { get; set; } + public bool CanReadDiscInformation { get; set; } + public bool CanReadFullTOC { get; set; } + public bool CanReadHDCMI { get; set; } + public bool CanReadLayerCapacity { get; set; } + public bool CanReadLeadIn { get; set; } + public bool CanReadLeadOut { get; set; } + public bool CanReadMediaID { get; set; } + public bool CanReadMediaSerial { get; set; } + public bool CanReadPAC { get; set; } + public bool CanReadPFI { get; set; } + public bool CanReadPMA { get; set; } + public bool CanReadPQSubchannel { get; set; } + public bool CanReadPQSubchannelWithC2 { get; set; } + public bool CanReadPRI { get; set; } + public bool CanReadRWSubchannel { get; set; } + public bool CanReadRWSubchannelWithC2 { get; set; } + public bool CanReadRecordablePFI { get; set; } + public bool CanReadSpareAreaInformation { get; set; } + public bool CanReadTOC { get; set; } + public byte Density { get; set; } + public uint LongBlockSize { get; set; } + public string Manufacturer { get; set; } + public bool MediaIsRecognized { get; set; } + public byte MediumType { get; set; } + public string MediumTypeName { get; set; } + public string Model { get; set; } + public bool SupportsHLDTSTReadRawDVD { get; set; } + public bool SupportsNECReadCDDA { get; set; } + public bool SupportsPioneerReadCDDA { get; set; } + public bool SupportsPioneerReadCDDAMSF { get; set; } + public bool SupportsPlextorReadCDDA { get; set; } + public bool SupportsPlextorReadRawDVD { get; set; } + public bool SupportsRead10 { get; set; } + public bool SupportsRead12 { get; set; } + public bool SupportsRead16 { get; set; } + public bool SupportsRead { get; set; } + public bool SupportsReadCapacity16 { get; set; } + public bool SupportsReadCapacity { get; set; } + public bool SupportsReadCd { get; set; } + public bool SupportsReadCdMsf { get; set; } + public bool SupportsReadCdRaw { get; set; } + public bool SupportsReadCdMsfRaw { get; set; } + public bool SupportsReadLong16 { get; set; } + public bool SupportsReadLong { get; set; } - public byte[] ModeSense6Data { get; set; } - public byte[] ModeSense10Data { get; set; } + public byte[] ModeSense6Data { get; set; } + public byte[] ModeSense10Data { get; set; } - [XmlIgnore] - public bool BlocksSpecified { get; set; } - [XmlIgnore] - public bool BlockSizeSpecified { get; set; } - [XmlIgnore] - public bool CanReadAACSSpecified { get; set; } - [XmlIgnore] - public bool CanReadADIPSpecified { get; set; } - [XmlIgnore] - public bool CanReadATIPSpecified { get; set; } - [XmlIgnore] - public bool CanReadBCASpecified { get; set; } - [XmlIgnore] - public bool CanReadC2PointersSpecified { get; set; } - [XmlIgnore] - public bool CanReadCMISpecified { get; set; } - [XmlIgnore] - public bool CanReadCorrectedSubchannelSpecified { get; set; } - [XmlIgnore] - public bool CanReadCorrectedSubchannelWithC2Specified { get; set; } - [XmlIgnore] - public bool CanReadDCBSpecified { get; set; } - [XmlIgnore] - public bool CanReadDDSSpecified { get; set; } - [XmlIgnore] - public bool CanReadDMISpecified { get; set; } - [XmlIgnore] - public bool CanReadDiscInformationSpecified { get; set; } - [XmlIgnore] - public bool CanReadFullTOCSpecified { get; set; } - [XmlIgnore] - public bool CanReadHDCMISpecified { get; set; } - [XmlIgnore] - public bool CanReadLayerCapacitySpecified { get; set; } - [XmlIgnore] - public bool CanReadLeadInSpecified { get; set; } - [XmlIgnore] - public bool CanReadLeadOutSpecified { get; set; } - [XmlIgnore] - public bool CanReadMediaIDSpecified { get; set; } - [XmlIgnore] - public bool CanReadMediaSerialSpecified { get; set; } - [XmlIgnore] - public bool CanReadPACSpecified { get; set; } - [XmlIgnore] - public bool CanReadPFISpecified { get; set; } - [XmlIgnore] - public bool CanReadPMASpecified { get; set; } - [XmlIgnore] - public bool CanReadPQSubchannelSpecified { get; set; } - [XmlIgnore] - public bool CanReadPQSubchannelWithC2Specified { get; set; } - [XmlIgnore] - public bool CanReadPRISpecified { get; set; } - [XmlIgnore] - public bool CanReadRWSubchannelSpecified { get; set; } - [XmlIgnore] - public bool CanReadRWSubchannelWithC2Specified { get; set; } - [XmlIgnore] - public bool CanReadRecordablePFISpecified { get; set; } - [XmlIgnore] - public bool CanReadSpareAreaInformationSpecified { get; set; } - [XmlIgnore] - public bool CanReadTOCSpecified { get; set; } - [XmlIgnore] - public bool DensitySpecified { get; set; } - [XmlIgnore] - public bool LongBlockSizeSpecified { get; set; } - [XmlIgnore] - public bool ManufacturerSpecified { get; set; } - [XmlIgnore] - public bool MediumTypeSpecified { get; set; } - [XmlIgnore] - public bool ModelSpecified { get; set; } - [XmlIgnore] - public bool SupportsHLDTSTReadRawDVDSpecified { get; set; } - [XmlIgnore] - public bool SupportsNECReadCDDASpecified { get; set; } - [XmlIgnore] - public bool SupportsPioneerReadCDDASpecified { get; set; } - [XmlIgnore] - public bool SupportsPioneerReadCDDAMSFSpecified { get; set; } - [XmlIgnore] - public bool SupportsPlextorReadCDDASpecified { get; set; } - [XmlIgnore] - public bool SupportsPlextorReadRawDVDSpecified { get; set; } - [XmlIgnore] - public bool SupportsRead10Specified { get; set; } - [XmlIgnore] - public bool SupportsRead12Specified { get; set; } - [XmlIgnore] - public bool SupportsRead16Specified { get; set; } - [XmlIgnore] - public bool SupportsReadSpecified { get; set; } - [XmlIgnore] - public bool SupportsReadCapacity16Specified { get; set; } - [XmlIgnore] - public bool SupportsReadCapacitySpecified { get; set; } - [XmlIgnore] - public bool SupportsReadCdSpecified { get; set; } - [XmlIgnore] - public bool SupportsReadCdMsfSpecified { get; set; } - [XmlIgnore] - public bool SupportsReadCdRawSpecified { get; set; } - [XmlIgnore] - public bool SupportsReadCdMsfRawSpecified { get; set; } - [XmlIgnore] - public bool SupportsReadLong16Specified { get; set; } - [XmlIgnore] - public bool SupportsReadLongSpecified { get; set; } + [XmlIgnore] + public bool BlocksSpecified { get; set; } + [XmlIgnore] + public bool BlockSizeSpecified { get; set; } + [XmlIgnore] + public bool CanReadAACSSpecified { get; set; } + [XmlIgnore] + public bool CanReadADIPSpecified { get; set; } + [XmlIgnore] + public bool CanReadATIPSpecified { get; set; } + [XmlIgnore] + public bool CanReadBCASpecified { get; set; } + [XmlIgnore] + public bool CanReadC2PointersSpecified { get; set; } + [XmlIgnore] + public bool CanReadCMISpecified { get; set; } + [XmlIgnore] + public bool CanReadCorrectedSubchannelSpecified { get; set; } + [XmlIgnore] + public bool CanReadCorrectedSubchannelWithC2Specified { get; set; } + [XmlIgnore] + public bool CanReadDCBSpecified { get; set; } + [XmlIgnore] + public bool CanReadDDSSpecified { get; set; } + [XmlIgnore] + public bool CanReadDMISpecified { get; set; } + [XmlIgnore] + public bool CanReadDiscInformationSpecified { get; set; } + [XmlIgnore] + public bool CanReadFullTOCSpecified { get; set; } + [XmlIgnore] + public bool CanReadHDCMISpecified { get; set; } + [XmlIgnore] + public bool CanReadLayerCapacitySpecified { get; set; } + [XmlIgnore] + public bool CanReadLeadInSpecified { get; set; } + [XmlIgnore] + public bool CanReadLeadOutSpecified { get; set; } + [XmlIgnore] + public bool CanReadMediaIDSpecified { get; set; } + [XmlIgnore] + public bool CanReadMediaSerialSpecified { get; set; } + [XmlIgnore] + public bool CanReadPACSpecified { get; set; } + [XmlIgnore] + public bool CanReadPFISpecified { get; set; } + [XmlIgnore] + public bool CanReadPMASpecified { get; set; } + [XmlIgnore] + public bool CanReadPQSubchannelSpecified { get; set; } + [XmlIgnore] + public bool CanReadPQSubchannelWithC2Specified { get; set; } + [XmlIgnore] + public bool CanReadPRISpecified { get; set; } + [XmlIgnore] + public bool CanReadRWSubchannelSpecified { get; set; } + [XmlIgnore] + public bool CanReadRWSubchannelWithC2Specified { get; set; } + [XmlIgnore] + public bool CanReadRecordablePFISpecified { get; set; } + [XmlIgnore] + public bool CanReadSpareAreaInformationSpecified { get; set; } + [XmlIgnore] + public bool CanReadTOCSpecified { get; set; } + [XmlIgnore] + public bool DensitySpecified { get; set; } + [XmlIgnore] + public bool LongBlockSizeSpecified { get; set; } + [XmlIgnore] + public bool ManufacturerSpecified { get; set; } + [XmlIgnore] + public bool MediumTypeSpecified { get; set; } + [XmlIgnore] + public bool ModelSpecified { get; set; } + [XmlIgnore] + public bool SupportsHLDTSTReadRawDVDSpecified { get; set; } + [XmlIgnore] + public bool SupportsNECReadCDDASpecified { get; set; } + [XmlIgnore] + public bool SupportsPioneerReadCDDASpecified { get; set; } + [XmlIgnore] + public bool SupportsPioneerReadCDDAMSFSpecified { get; set; } + [XmlIgnore] + public bool SupportsPlextorReadCDDASpecified { get; set; } + [XmlIgnore] + public bool SupportsPlextorReadRawDVDSpecified { get; set; } + [XmlIgnore] + public bool SupportsRead10Specified { get; set; } + [XmlIgnore] + public bool SupportsRead12Specified { get; set; } + [XmlIgnore] + public bool SupportsRead16Specified { get; set; } + [XmlIgnore] + public bool SupportsReadSpecified { get; set; } + [XmlIgnore] + public bool SupportsReadCapacity16Specified { get; set; } + [XmlIgnore] + public bool SupportsReadCapacitySpecified { get; set; } + [XmlIgnore] + public bool SupportsReadCdSpecified { get; set; } + [XmlIgnore] + public bool SupportsReadCdMsfSpecified { get; set; } + [XmlIgnore] + public bool SupportsReadCdRawSpecified { get; set; } + [XmlIgnore] + public bool SupportsReadCdMsfRawSpecified { get; set; } + [XmlIgnore] + public bool SupportsReadLong16Specified { get; set; } + [XmlIgnore] + public bool SupportsReadLongSpecified { get; set; } - public chsType CHS { get; set; } - public chsType CurrentCHS { get; set; } - public uint LBASectors { get; set; } - public ulong LBA48Sectors { get; set; } - public ushort LogicalAlignment { get; set; } - public ushort NominalRotationRate { get; set; } - public uint PhysicalBlockSize { get; set; } - public bool SolidStateDevice { get; set; } - public ushort UnformattedBPT { get; set; } - public ushort UnformattedBPS { get; set; } + public chsType CHS { get; set; } + public chsType CurrentCHS { get; set; } + public uint LBASectors { get; set; } + public ulong LBA48Sectors { get; set; } + public ushort LogicalAlignment { get; set; } + public ushort NominalRotationRate { get; set; } + public uint PhysicalBlockSize { get; set; } + public bool SolidStateDevice { get; set; } + public ushort UnformattedBPT { get; set; } + public ushort UnformattedBPS { get; set; } - [XmlIgnore] - public bool LBASectorsSpecified { get; set; } - [XmlIgnore] - public bool LBA48SectorsSpecified { get; set; } - [XmlIgnore] - public bool LogicalAlignmentSpecified { get; set; } - [XmlIgnore] - public bool NominalRotationRateSpecified { get; set; } - [XmlIgnore] - public bool PhysicalBlockSizeSpecified { get; set; } - [XmlIgnore] - public bool SolidStateDeviceSpecified { get; set; } - [XmlIgnore] - public bool UnformattedBPTSpecified { get; set; } - [XmlIgnore] - public bool UnformattedBPSSpecified { get; set; } + [XmlIgnore] + public bool LBASectorsSpecified { get; set; } + [XmlIgnore] + public bool LBA48SectorsSpecified { get; set; } + [XmlIgnore] + public bool LogicalAlignmentSpecified { get; set; } + [XmlIgnore] + public bool NominalRotationRateSpecified { get; set; } + [XmlIgnore] + public bool PhysicalBlockSizeSpecified { get; set; } + [XmlIgnore] + public bool SolidStateDeviceSpecified { get; set; } + [XmlIgnore] + public bool UnformattedBPTSpecified { get; set; } + [XmlIgnore] + public bool UnformattedBPSSpecified { get; set; } - public bool SupportsReadDmaLba { get; set; } - public bool SupportsReadDmaRetryLba { get; set; } - public bool SupportsReadLba { get; set; } - public bool SupportsReadRetryLba { get; set; } - public bool SupportsReadLongLba { get; set; } - public bool SupportsReadLongRetryLba { get; set; } - public bool SupportsSeekLba { get; set; } + public bool SupportsReadDmaLba { get; set; } + public bool SupportsReadDmaRetryLba { get; set; } + public bool SupportsReadLba { get; set; } + public bool SupportsReadRetryLba { get; set; } + public bool SupportsReadLongLba { get; set; } + public bool SupportsReadLongRetryLba { get; set; } + public bool SupportsSeekLba { get; set; } - public bool SupportsReadDmaLba48 { get; set; } - public bool SupportsReadLba48 { get; set; } + public bool SupportsReadDmaLba48 { get; set; } + public bool SupportsReadLba48 { get; set; } - public bool SupportsReadDma { get; set; } - public bool SupportsReadDmaRetry { get; set; } - public bool SupportsReadRetry { get; set; } - public bool SupportsReadLongRetry { get; set; } - public bool SupportsSeek { get; set; } + public bool SupportsReadDma { get; set; } + public bool SupportsReadDmaRetry { get; set; } + public bool SupportsReadRetry { get; set; } + public bool SupportsReadLongRetry { get; set; } + public bool SupportsSeek { get; set; } - [XmlIgnore] - public bool SupportsReadDmaLbaSpecified { get; set; } - [XmlIgnore] - public bool SupportsReadDmaRetryLbaSpecified { get; set; } - [XmlIgnore] - public bool SupportsReadLbaSpecified { get; set; } - [XmlIgnore] - public bool SupportsReadRetryLbaSpecified { get; set; } - [XmlIgnore] - public bool SupportsReadLongLbaSpecified { get; set; } - [XmlIgnore] - public bool SupportsReadLongRetryLbaSpecified { get; set; } - [XmlIgnore] - public bool SupportsSeekLbaSpecified { get; set; } + [XmlIgnore] + public bool SupportsReadDmaLbaSpecified { get; set; } + [XmlIgnore] + public bool SupportsReadDmaRetryLbaSpecified { get; set; } + [XmlIgnore] + public bool SupportsReadLbaSpecified { get; set; } + [XmlIgnore] + public bool SupportsReadRetryLbaSpecified { get; set; } + [XmlIgnore] + public bool SupportsReadLongLbaSpecified { get; set; } + [XmlIgnore] + public bool SupportsReadLongRetryLbaSpecified { get; set; } + [XmlIgnore] + public bool SupportsSeekLbaSpecified { get; set; } - [XmlIgnore] - public bool SupportsReadDmaLba48Specified { get; set; } - [XmlIgnore] - public bool SupportsReadLba48Specified { get; set; } + [XmlIgnore] + public bool SupportsReadDmaLba48Specified { get; set; } + [XmlIgnore] + public bool SupportsReadLba48Specified { get; set; } - [XmlIgnore] - public bool SupportsReadDmaSpecified { get; set; } - [XmlIgnore] - public bool SupportsReadDmaRetrySpecified { get; set; } - [XmlIgnore] - public bool SupportsReadRetrySpecified { get; set; } - [XmlIgnore] - public bool SupportsReadLongRetrySpecified { get; set; } - [XmlIgnore] - public bool SupportsSeekSpecified { get; set; } - } + [XmlIgnore] + public bool SupportsReadDmaSpecified { get; set; } + [XmlIgnore] + public bool SupportsReadDmaRetrySpecified { get; set; } + [XmlIgnore] + public bool SupportsReadRetrySpecified { get; set; } + [XmlIgnore] + public bool SupportsReadLongRetrySpecified { get; set; } + [XmlIgnore] + public bool SupportsSeekSpecified { get; set; } +} - public class sscType - { - public byte BlockSizeGranularity { get; set; } - public uint MaxBlockLength { get; set; } - public uint MinBlockLength { get; set; } +public class sscType +{ + public byte BlockSizeGranularity { get; set; } + public uint MaxBlockLength { get; set; } + public uint MinBlockLength { get; set; } - public SupportedDensity[] SupportedDensities { get; set; } - public SupportedMedia[] SupportedMediaTypes { get; set; } - public SequentialMedia[] TestedMedia { get; set; } + public SupportedDensity[] SupportedDensities { get; set; } + public SupportedMedia[] SupportedMediaTypes { get; set; } + public SequentialMedia[] TestedMedia { get; set; } - [XmlIgnore] - public bool BlockSizeGranularitySpecified { get; set; } - [XmlIgnore] - public bool MaxBlockLengthSpecified { get; set; } - [XmlIgnore] - public bool MinBlockLengthSpecified { get; set; } - } + [XmlIgnore] + public bool BlockSizeGranularitySpecified { get; set; } + [XmlIgnore] + public bool MaxBlockLengthSpecified { get; set; } + [XmlIgnore] + public bool MinBlockLengthSpecified { get; set; } +} - public class SupportedDensity - { - [XmlIgnore, JsonIgnore] - public int Id { get; set; } - [DisplayName("Primary density code")] - public byte PrimaryCode { get; set; } - [DisplayName("Secondary density code")] - public byte SecondaryCode { get; set; } - public bool Writable { get; set; } - public bool Duplicate { get; set; } - [DisplayName("Default density code")] - public bool DefaultDensity { get; set; } - [DisplayName("Bits per mm")] - public uint BitsPerMm { get; set; } - public ushort Width { get; set; } - public ushort Tracks { get; set; } - [DisplayName("Nominal capacity (MiB)")] - public uint Capacity { get; set; } - public string Organization { get; set; } - public string Name { get; set; } - public string Description { get; set; } - } +public class SupportedDensity +{ + [XmlIgnore, JsonIgnore] + public int Id { get; set; } + [DisplayName("Primary density code")] + public byte PrimaryCode { get; set; } + [DisplayName("Secondary density code")] + public byte SecondaryCode { get; set; } + public bool Writable { get; set; } + public bool Duplicate { get; set; } + [DisplayName("Default density code")] + public bool DefaultDensity { get; set; } + [DisplayName("Bits per mm")] + public uint BitsPerMm { get; set; } + public ushort Width { get; set; } + public ushort Tracks { get; set; } + [DisplayName("Nominal capacity (MiB)")] + public uint Capacity { get; set; } + public string Organization { get; set; } + public string Name { get; set; } + public string Description { get; set; } +} - public class SupportedMedia - { - [XmlIgnore, JsonIgnore] - public int Id { get; set; } - public byte MediumType { get; set; } - public int[] DensityCodes { get; set; } - public ushort Width { get; set; } - public ushort Length { get; set; } - public string Organization { get; set; } - public string Name { get; set; } - public string Description { get; set; } - } +public class SupportedMedia +{ + [XmlIgnore, JsonIgnore] + public int Id { get; set; } + public byte MediumType { get; set; } + public int[] DensityCodes { get; set; } + public ushort Width { get; set; } + public ushort Length { get; set; } + public string Organization { get; set; } + public string Name { get; set; } + public string Description { get; set; } +} - public struct SequentialMedia - { - public bool CanReadMediaSerial { get; set; } - public byte Density { get; set; } - public string Manufacturer { get; set; } - public bool MediaIsRecognized { get; set; } - public byte MediumType { get; set; } - public string MediumTypeName { get; set; } - public string Model { get; set; } - public SupportedDensity[] SupportedDensities { get; set; } - public SupportedMedia[] SupportedMediaTypes { get; set; } +public struct SequentialMedia +{ + public bool CanReadMediaSerial { get; set; } + public byte Density { get; set; } + public string Manufacturer { get; set; } + public bool MediaIsRecognized { get; set; } + public byte MediumType { get; set; } + public string MediumTypeName { get; set; } + public string Model { get; set; } + public SupportedDensity[] SupportedDensities { get; set; } + public SupportedMedia[] SupportedMediaTypes { get; set; } - public byte[] ModeSense6Data { get; set; } - public byte[] ModeSense10Data { get; set; } + public byte[] ModeSense6Data { get; set; } + public byte[] ModeSense10Data { get; set; } - [XmlIgnore] - public bool CanReadMediaSerialSpecified { get; set; } - [XmlIgnore] - public bool DensitySpecified { get; set; } - [XmlIgnore] - public bool MediumTypeSpecified { get; set; } - } + [XmlIgnore] + public bool CanReadMediaSerialSpecified { get; set; } + [XmlIgnore] + public bool DensitySpecified { get; set; } + [XmlIgnore] + public bool MediumTypeSpecified { get; set; } +} - [Serializable] - public class pcmciaType - { - public byte[] CIS { get; set; } - public string Compliance { get; set; } - public ushort ManufacturerCode { get; set; } - public ushort CardCode { get; set; } - public string Manufacturer { get; set; } - public string ProductName { get; set; } - public string[] AdditionalInformation { get; set; } +[Serializable] +public class pcmciaType +{ + public byte[] CIS { get; set; } + public string Compliance { get; set; } + public ushort ManufacturerCode { get; set; } + public ushort CardCode { get; set; } + public string Manufacturer { get; set; } + public string ProductName { get; set; } + public string[] AdditionalInformation { get; set; } - [XmlIgnore] - public bool ManufacturerCodeSpecified { get; set; } - [XmlIgnore] - public bool CardCodeSpecified { get; set; } - } + [XmlIgnore] + public bool ManufacturerCodeSpecified { get; set; } + [XmlIgnore] + public bool CardCodeSpecified { get; set; } +} - [Serializable] - public class mmcsdType - { - public byte[] CID { get; set; } - public byte[] CSD { get; set; } - public byte[] OCR { get; set; } - public byte[] SCR { get; set; } - public byte[] ExtendedCSD { get; set; } - } +[Serializable] +public class mmcsdType +{ + public byte[] CID { get; set; } + public byte[] CSD { get; set; } + public byte[] OCR { get; set; } + public byte[] SCR { get; set; } + public byte[] ExtendedCSD { get; set; } } \ No newline at end of file diff --git a/Metadata/DeviceReportV2.cs b/Metadata/DeviceReportV2.cs index 7999dc73f..e7868ab54 100644 --- a/Metadata/DeviceReportV2.cs +++ b/Metadata/DeviceReportV2.cs @@ -57,2251 +57,2250 @@ using Newtonsoft.Json; // ReSharper disable InconsistentNaming // ReSharper disable UnusedAutoPropertyAccessor.Global -namespace Aaru.CommonTypes.Metadata +namespace Aaru.CommonTypes.Metadata; + +public class DeviceReportV2 { - public class DeviceReportV2 + public DeviceReportV2() {} + + public DeviceReportV2(DeviceReport reportV1) { - public DeviceReportV2() {} + if(reportV1.USB != null) + USB = new Usb(reportV1.USB); - public DeviceReportV2(DeviceReport reportV1) + if(reportV1.FireWire != null) + FireWire = new FireWire(reportV1.FireWire); + + if(reportV1.PCMCIA != null) + PCMCIA = new Pcmcia(reportV1.PCMCIA); + + if(reportV1.CompactFlashSpecified) + CompactFlash = reportV1.CompactFlash; + + if(reportV1.ATA != null) { - if(reportV1.USB != null) - USB = new Usb(reportV1.USB); + ATA = new Ata(reportV1.ATA); + Type = DeviceType.ATA; + } - if(reportV1.FireWire != null) - FireWire = new FireWire(reportV1.FireWire); + if(reportV1.SCSI != null) + { + SCSI = new Scsi(reportV1.SCSI); + Type = DeviceType.SCSI; - if(reportV1.PCMCIA != null) - PCMCIA = new Pcmcia(reportV1.PCMCIA); - - if(reportV1.CompactFlashSpecified) - CompactFlash = reportV1.CompactFlash; - - if(reportV1.ATA != null) + if(SCSI.ModeSense?.ModePages?.FirstOrDefault(p => p.page == 0x2A)?.value != null) { - ATA = new Ata(reportV1.ATA); - Type = DeviceType.ATA; - } - - if(reportV1.SCSI != null) - { - SCSI = new Scsi(reportV1.SCSI); - Type = DeviceType.SCSI; - - if(SCSI.ModeSense?.ModePages?.FirstOrDefault(p => p.page == 0x2A)?.value != null) - { - if(SCSI.MultiMediaDevice != null) - SCSI.MultiMediaDevice.ModeSense2AData = - SCSI.ModeSense?.ModePages?.FirstOrDefault(p => p.page == 0x2A)?.value; - else if(SCSI.Inquiry?.PeripheralDeviceType == (byte)PeripheralDeviceTypes.MultiMediaDevice) - SCSI.MultiMediaDevice = new Mmc - { - ModeSense2AData = SCSI.ModeSense?.ModePages?.FirstOrDefault(p => p.page == 0x2A)?.value - }; - } - } - - if(reportV1.ATAPI != null) - { - ATAPI = new Ata(reportV1.ATAPI); - Type = DeviceType.ATAPI; - } - - if(reportV1.MultiMediaCard != null) - { - MultiMediaCard = new MmcSd(reportV1.MultiMediaCard); - Type = DeviceType.MMC; - } - - if(reportV1.SecureDigital != null) - { - SecureDigital = new MmcSd(reportV1.SecureDigital); - Type = DeviceType.SecureDigital; - } - - if(reportV1.SCSI?.Inquiry != null) - { - Manufacturer = reportV1.SCSI.Inquiry.VendorIdentification; - Model = reportV1.SCSI.Inquiry.ProductIdentification; - Revision = reportV1.SCSI.Inquiry.ProductRevisionLevel; - } - else if(reportV1.ATA != null || - reportV1.ATAPI != null) - { - ataType ata = reportV1.ATA ?? reportV1.ATAPI; - - string[] split = ata.Model.Split(' '); - - if(split.Length > 1) - { - Manufacturer = split[0]; - Model = string.Join(" ", split, 1, split.Length - 1); - } - else - Model = ata.Model; - - Revision = ata.FirmwareRevision; + if(SCSI.MultiMediaDevice != null) + SCSI.MultiMediaDevice.ModeSense2AData = + SCSI.ModeSense?.ModePages?.FirstOrDefault(p => p.page == 0x2A)?.value; + else if(SCSI.Inquiry?.PeripheralDeviceType == (byte)PeripheralDeviceTypes.MultiMediaDevice) + SCSI.MultiMediaDevice = new Mmc + { + ModeSense2AData = SCSI.ModeSense?.ModePages?.FirstOrDefault(p => p.page == 0x2A)?.value + }; } } - [JsonIgnore] - public int Id { get; set; } - public virtual Usb USB { get; set; } - public virtual FireWire FireWire { get; set; } - public virtual Pcmcia PCMCIA { get; set; } - public bool CompactFlash { get; set; } - public virtual Ata ATA { get; set; } - public virtual Ata ATAPI { get; set; } - public virtual Scsi SCSI { get; set; } - public virtual MmcSd MultiMediaCard { get; set; } - public virtual MmcSd SecureDigital { get; set; } - public virtual GdRomSwapDiscCapabilities GdRomSwapDiscCapabilities { get; set; } - - public string Manufacturer { get; set; } - public string Model { get; set; } - public string Revision { get; set; } - public DeviceType Type { get; set; } - } - - public class Usb - { - public Usb() {} - - public Usb(usbType usb) + if(reportV1.ATAPI != null) { - VendorID = usb.VendorID; - ProductID = usb.ProductID; - Manufacturer = usb.Manufacturer; - Product = usb.Product; - RemovableMedia = usb.RemovableMedia; - Descriptors = usb.Descriptors; + ATAPI = new Ata(reportV1.ATAPI); + Type = DeviceType.ATAPI; } - [JsonIgnore] - public int Id { get; set; } - [DisplayName("Vendor ID"), DisplayFormat(DataFormatString = "0x{0:X4}")] - public ushort VendorID { get; set; } - [DisplayName("Product ID"), DisplayFormat(DataFormatString = "0x{0:X4}")] - public ushort ProductID { get; set; } - public string Manufacturer { get; set; } - public string Product { get; set; } - [DisplayName("Removable media")] - public bool RemovableMedia { get; set; } - public byte[] Descriptors { get; set; } - } - - public class FireWire - { - public FireWire() {} - - public FireWire(firewireType firewire) + if(reportV1.MultiMediaCard != null) { - VendorID = firewire.VendorID; - ProductID = firewire.ProductID; - Manufacturer = firewire.Manufacturer; - Product = firewire.Product; - RemovableMedia = firewire.RemovableMedia; + MultiMediaCard = new MmcSd(reportV1.MultiMediaCard); + Type = DeviceType.MMC; } - [JsonIgnore] - public int Id { get; set; } - [DisplayName("Vendor ID"), DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "0x{0:X8}")] - public uint VendorID { get; set; } - [DisplayName("Product ID"), DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "0x{0:X8}")] - public uint ProductID { get; set; } - [DisplayFormat(NullDisplayText = "Unknown")] - public string Manufacturer { get; set; } - [DisplayFormat(NullDisplayText = "Unknown")] - public string Product { get; set; } - [DisplayName("Is media removable?")] - public bool RemovableMedia { get; set; } - } - - public class Ata - { - public Ata() {} - - public Ata(ataType ata) + if(reportV1.SecureDigital != null) { - Identify = ata.Identify; + SecureDigital = new MmcSd(reportV1.SecureDigital); + Type = DeviceType.SecureDigital; + } - if(ata.ReadCapabilities != null) - ReadCapabilities = new TestedMedia(ata.ReadCapabilities, true); + if(reportV1.SCSI?.Inquiry != null) + { + Manufacturer = reportV1.SCSI.Inquiry.VendorIdentification; + Model = reportV1.SCSI.Inquiry.ProductIdentification; + Revision = reportV1.SCSI.Inquiry.ProductRevisionLevel; + } + else if(reportV1.ATA != null || + reportV1.ATAPI != null) + { + ataType ata = reportV1.ATA ?? reportV1.ATAPI; - if(ata.RemovableMedias != null) + string[] split = ata.Model.Split(' '); + + if(split.Length > 1) { - RemovableMedias = new List(); - - foreach(testedMediaType ataRemovableMedia in ata.RemovableMedias) - RemovableMedias.Add(new TestedMedia(ataRemovableMedia, true)); + Manufacturer = split[0]; + Model = string.Join(" ", split, 1, split.Length - 1); } + else + Model = ata.Model; - if(Identify != null) - return; - - var identifyDevice = new Identify.IdentifyDevice(); - - if(ata.AdditionalPIDSpecified) - identifyDevice.AdditionalPID = ata.AdditionalPID; - - if(ata.APIOSupportedSpecified) - identifyDevice.APIOSupported = ata.APIOSupported; - - if(ata.ATAPIByteCountSpecified) - identifyDevice.ATAPIByteCount = ata.ATAPIByteCount; - - if(ata.BufferTypeSpecified) - identifyDevice.BufferType = ata.BufferType; - - if(ata.BufferSizeSpecified) - identifyDevice.BufferSize = ata.BufferSize; - - if(ata.CapabilitiesSpecified) - identifyDevice.Capabilities = ata.Capabilities; - - if(ata.Capabilities2Specified) - identifyDevice.Capabilities2 = ata.Capabilities2; - - if(ata.Capabilities3Specified) - identifyDevice.Capabilities3 = ata.Capabilities3; - - if(ata.CFAPowerModeSpecified) - identifyDevice.CFAPowerMode = ata.CFAPowerMode; - - if(ata.CommandSetSpecified) - identifyDevice.CommandSet = ata.CommandSet; - - if(ata.CommandSet2Specified) - identifyDevice.CommandSet2 = ata.CommandSet2; - - if(ata.CommandSet3Specified) - identifyDevice.CommandSet3 = ata.CommandSet3; - - if(ata.CommandSet4Specified) - identifyDevice.CommandSet4 = ata.CommandSet4; - - if(ata.CommandSet5Specified) - identifyDevice.CommandSet4 = ata.CommandSet4; - - if(ata.CurrentAAMSpecified) - identifyDevice.CurrentAAM = ata.CurrentAAM; - - if(ata.CurrentAPMSpecified) - identifyDevice.CurrentAPM = ata.CurrentAPM; - - if(ata.DataSetMgmtSpecified) - identifyDevice.DataSetMgmt = ata.DataSetMgmt; - - if(ata.DataSetMgmtSizeSpecified) - identifyDevice.DataSetMgmtSize = ata.DataSetMgmtSize; - - if(ata.DeviceFormFactorSpecified) - identifyDevice.DeviceFormFactor = ata.DeviceFormFactor; - - if(ata.DMAActiveSpecified) - identifyDevice.DMAActive = ata.DMAActive; - - if(ata.DMASupportedSpecified) - identifyDevice.DMASupported = ata.DMASupported; - - if(ata.DMATransferTimingModeSpecified) - identifyDevice.DMATransferTimingMode = ata.DMATransferTimingMode; - - if(ata.EnhancedSecurityEraseTimeSpecified) - identifyDevice.EnhancedSecurityEraseTime = ata.EnhancedSecurityEraseTime; - - if(ata.EnabledCommandSetSpecified) - identifyDevice.EnabledCommandSet = ata.EnabledCommandSet; - - if(ata.EnabledCommandSet2Specified) - identifyDevice.EnabledCommandSet2 = ata.EnabledCommandSet2; - - if(ata.EnabledCommandSet3Specified) - identifyDevice.EnabledCommandSet3 = ata.EnabledCommandSet3; - - if(ata.EnabledCommandSet4Specified) - identifyDevice.EnabledCommandSet4 = ata.EnabledCommandSet4; - - if(ata.EnabledSATAFeaturesSpecified) - identifyDevice.EnabledSATAFeatures = ata.EnabledSATAFeatures; - - if(ata.ExtendedUserSectorsSpecified) - identifyDevice.ExtendedUserSectors = ata.ExtendedUserSectors; - - if(ata.FreeFallSensitivitySpecified) - identifyDevice.FreeFallSensitivity = ata.FreeFallSensitivity; - - if(ata.FirmwareRevisionSpecified) - identifyDevice.FirmwareRevision = ata.FirmwareRevision; - - if(ata.GeneralConfigurationSpecified) - identifyDevice.GeneralConfiguration = ata.GeneralConfiguration; - - if(ata.HardwareResetResultSpecified) - identifyDevice.HardwareResetResult = ata.HardwareResetResult; - - if(ata.InterseekDelaySpecified) - identifyDevice.InterseekDelay = ata.InterseekDelay; - - if(ata.MajorVersionSpecified) - identifyDevice.MajorVersion = ata.MajorVersion; - - if(ata.MasterPasswordRevisionCodeSpecified) - identifyDevice.MasterPasswordRevisionCode = ata.MasterPasswordRevisionCode; - - if(ata.MaxDownloadMicroMode3Specified) - identifyDevice.MaxDownloadMicroMode3 = ata.MaxDownloadMicroMode3; - - if(ata.MaxQueueDepthSpecified) - identifyDevice.MaxQueueDepth = ata.MaxQueueDepth; - - if(ata.MDMAActiveSpecified) - identifyDevice.MDMAActive = ata.MDMAActive; - - if(ata.MDMASupportedSpecified) - identifyDevice.MDMASupported = ata.MDMASupported; - - if(ata.MinDownloadMicroMode3Specified) - identifyDevice.MinDownloadMicroMode3 = ata.MinDownloadMicroMode3; - - if(ata.MinMDMACycleTimeSpecified) - identifyDevice.MinMDMACycleTime = ata.MinMDMACycleTime; - - if(ata.MinorVersionSpecified) - identifyDevice.MinorVersion = ata.MinorVersion; - - if(ata.MinPIOCycleTimeNoFlowSpecified) - identifyDevice.MinPIOCycleTimeNoFlow = ata.MinPIOCycleTimeNoFlow; - - if(ata.MinPIOCycleTimeFlowSpecified) - identifyDevice.MinPIOCycleTimeFlow = ata.MinPIOCycleTimeFlow; - - if(ata.ModelSpecified) - identifyDevice.Model = ata.Model; - - if(ata.MultipleMaxSectorsSpecified) - identifyDevice.MultipleMaxSectors = ata.MultipleMaxSectors; - - if(ata.MultipleSectorNumberSpecified) - identifyDevice.MultipleSectorNumber = ata.MultipleSectorNumber; - - if(ata.NVCacheCapsSpecified) - identifyDevice.NVCacheCaps = ata.NVCacheCaps; - - if(ata.NVCacheSizeSpecified) - identifyDevice.NVCacheSize = ata.NVCacheSize; - - if(ata.NVCacheWriteSpeedSpecified) - identifyDevice.NVCacheWriteSpeed = ata.NVCacheWriteSpeed; - - if(ata.NVEstimatedSpinUpSpecified) - identifyDevice.NVEstimatedSpinUp = ata.NVEstimatedSpinUp; - - if(ata.PacketBusReleaseSpecified) - identifyDevice.PacketBusRelease = ata.PacketBusRelease; - - if(ata.PIOTransferTimingModeSpecified) - identifyDevice.PIOTransferTimingMode = ata.PIOTransferTimingMode; - - if(ata.RecommendedAAMSpecified) - identifyDevice.RecommendedAAM = ata.RecommendedAAM; - - if(ata.RecommendedMDMACycleTimeSpecified) - identifyDevice.RecMDMACycleTime = ata.RecommendedMDMACycleTime; - - if(ata.RemovableStatusSetSpecified) - identifyDevice.RemovableStatusSet = ata.RemovableStatusSet; - - if(ata.SATACapabilitiesSpecified) - identifyDevice.SATACapabilities = ata.SATACapabilities; - - if(ata.SATACapabilities2Specified) - identifyDevice.SATACapabilities2 = ata.SATACapabilities2; - - if(ata.SATAFeaturesSpecified) - identifyDevice.SATAFeatures = ata.SATAFeatures; - - if(ata.SCTCommandTransportSpecified) - identifyDevice.SCTCommandTransport = ata.SCTCommandTransport; - - if(ata.SectorsPerCardSpecified) - identifyDevice.SectorsPerCard = ata.SectorsPerCard; - - if(ata.SecurityEraseTimeSpecified) - identifyDevice.SecurityEraseTime = ata.SecurityEraseTime; - - if(ata.SecurityStatusSpecified) - identifyDevice.SecurityStatus = ata.SecurityStatus; - - if(ata.ServiceBusyClearSpecified) - identifyDevice.ServiceBusyClear = ata.ServiceBusyClear; - - if(ata.SpecificConfigurationSpecified) - identifyDevice.SpecificConfiguration = ata.SpecificConfiguration; - - if(ata.StreamAccessLatencySpecified) - identifyDevice.StreamAccessLatency = ata.StreamAccessLatency; - - if(ata.StreamMinReqSizeSpecified) - identifyDevice.StreamMinReqSize = ata.StreamMinReqSize; - - if(ata.StreamPerformanceGranularitySpecified) - identifyDevice.StreamPerformanceGranularity = ata.StreamPerformanceGranularity; - - if(ata.StreamTransferTimeDMASpecified) - identifyDevice.StreamTransferTimeDMA = ata.StreamTransferTimeDMA; - - if(ata.StreamTransferTimePIOSpecified) - identifyDevice.StreamTransferTimePIO = ata.StreamTransferTimePIO; - - if(ata.TransportMajorVersionSpecified) - identifyDevice.TransportMajorVersion = ata.TransportMajorVersion; - - if(ata.TransportMinorVersionSpecified) - identifyDevice.TransportMinorVersion = ata.TransportMinorVersion; - - if(ata.TrustedComputingSpecified) - identifyDevice.TrustedComputing = ata.TrustedComputing; - - if(ata.UDMAActiveSpecified) - identifyDevice.UDMAActive = ata.UDMAActive; - - if(ata.UDMASupportedSpecified) - identifyDevice.UDMASupported = ata.UDMASupported; - - if(ata.WRVModeSpecified) - identifyDevice.WRVMode = ata.WRVMode; - - if(ata.WRVSectorCountMode3Specified) - identifyDevice.WRVSectorCountMode3 = ata.WRVSectorCountMode3; - - if(ata.WRVSectorCountMode2Specified) - identifyDevice.WRVSectorCountMode2 = ata.WRVSectorCountMode2; - - Identify = Structs.Devices.ATA.Identify.Encode(identifyDevice); + Revision = ata.FirmwareRevision; } - - public Identify.IdentifyDevice? IdentifyDevice => Structs.Devices.ATA.Identify.Decode(Identify); - - [JsonIgnore] - public int Id { get; set; } - public byte[] Identify { get; set; } - public virtual TestedMedia ReadCapabilities { get; set; } - public virtual List RemovableMedias { get; set; } } - public class Chs + [JsonIgnore] + public int Id { get; set; } + public virtual Usb USB { get; set; } + public virtual FireWire FireWire { get; set; } + public virtual Pcmcia PCMCIA { get; set; } + public bool CompactFlash { get; set; } + public virtual Ata ATA { get; set; } + public virtual Ata ATAPI { get; set; } + public virtual Scsi SCSI { get; set; } + public virtual MmcSd MultiMediaCard { get; set; } + public virtual MmcSd SecureDigital { get; set; } + public virtual GdRomSwapDiscCapabilities GdRomSwapDiscCapabilities { get; set; } + + public string Manufacturer { get; set; } + public string Model { get; set; } + public string Revision { get; set; } + public DeviceType Type { get; set; } +} + +public class Usb +{ + public Usb() {} + + public Usb(usbType usb) { - public Chs() {} - - public Chs(chsType chs) - { - Cylinders = chs.Cylinders; - Heads = chs.Heads; - Sectors = chs.Sectors; - } - - [JsonIgnore] - public int Id { get; set; } - public ushort Cylinders { get; set; } - public ushort Heads { get; set; } - public ushort Sectors { get; set; } + VendorID = usb.VendorID; + ProductID = usb.ProductID; + Manufacturer = usb.Manufacturer; + Product = usb.Product; + RemovableMedia = usb.RemovableMedia; + Descriptors = usb.Descriptors; } - public class Scsi + [JsonIgnore] + public int Id { get; set; } + [DisplayName("Vendor ID"), DisplayFormat(DataFormatString = "0x{0:X4}")] + public ushort VendorID { get; set; } + [DisplayName("Product ID"), DisplayFormat(DataFormatString = "0x{0:X4}")] + public ushort ProductID { get; set; } + public string Manufacturer { get; set; } + public string Product { get; set; } + [DisplayName("Removable media")] + public bool RemovableMedia { get; set; } + public byte[] Descriptors { get; set; } +} + +public class FireWire +{ + public FireWire() {} + + public FireWire(firewireType firewire) { - public Scsi() {} + VendorID = firewire.VendorID; + ProductID = firewire.ProductID; + Manufacturer = firewire.Manufacturer; + Product = firewire.Product; + RemovableMedia = firewire.RemovableMedia; + } - public Scsi(scsiType scsi) + [JsonIgnore] + public int Id { get; set; } + [DisplayName("Vendor ID"), DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "0x{0:X8}")] + public uint VendorID { get; set; } + [DisplayName("Product ID"), DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "0x{0:X8}")] + public uint ProductID { get; set; } + [DisplayFormat(NullDisplayText = "Unknown")] + public string Manufacturer { get; set; } + [DisplayFormat(NullDisplayText = "Unknown")] + public string Product { get; set; } + [DisplayName("Is media removable?")] + public bool RemovableMedia { get; set; } +} + +public class Ata +{ + public Ata() {} + + public Ata(ataType ata) + { + Identify = ata.Identify; + + if(ata.ReadCapabilities != null) + ReadCapabilities = new TestedMedia(ata.ReadCapabilities, true); + + if(ata.RemovableMedias != null) { - InquiryData = scsi.Inquiry.Data; - SupportsModeSense6 = scsi.SupportsModeSense6; - SupportsModeSense10 = scsi.SupportsModeSense10; - SupportsModeSubpages = scsi.SupportsModeSubpages; + RemovableMedias = new List(); - if(scsi.ReadCapabilitiesSpecified && - scsi.ReadCapabilities != null) - ReadCapabilities = new TestedMedia(scsi.ReadCapabilities, false); + foreach(testedMediaType ataRemovableMedia in ata.RemovableMedias) + RemovableMedias.Add(new TestedMedia(ataRemovableMedia, true)); + } - if(scsi.RemovableMedias != null) + if(Identify != null) + return; + + var identifyDevice = new Identify.IdentifyDevice(); + + if(ata.AdditionalPIDSpecified) + identifyDevice.AdditionalPID = ata.AdditionalPID; + + if(ata.APIOSupportedSpecified) + identifyDevice.APIOSupported = ata.APIOSupported; + + if(ata.ATAPIByteCountSpecified) + identifyDevice.ATAPIByteCount = ata.ATAPIByteCount; + + if(ata.BufferTypeSpecified) + identifyDevice.BufferType = ata.BufferType; + + if(ata.BufferSizeSpecified) + identifyDevice.BufferSize = ata.BufferSize; + + if(ata.CapabilitiesSpecified) + identifyDevice.Capabilities = ata.Capabilities; + + if(ata.Capabilities2Specified) + identifyDevice.Capabilities2 = ata.Capabilities2; + + if(ata.Capabilities3Specified) + identifyDevice.Capabilities3 = ata.Capabilities3; + + if(ata.CFAPowerModeSpecified) + identifyDevice.CFAPowerMode = ata.CFAPowerMode; + + if(ata.CommandSetSpecified) + identifyDevice.CommandSet = ata.CommandSet; + + if(ata.CommandSet2Specified) + identifyDevice.CommandSet2 = ata.CommandSet2; + + if(ata.CommandSet3Specified) + identifyDevice.CommandSet3 = ata.CommandSet3; + + if(ata.CommandSet4Specified) + identifyDevice.CommandSet4 = ata.CommandSet4; + + if(ata.CommandSet5Specified) + identifyDevice.CommandSet4 = ata.CommandSet4; + + if(ata.CurrentAAMSpecified) + identifyDevice.CurrentAAM = ata.CurrentAAM; + + if(ata.CurrentAPMSpecified) + identifyDevice.CurrentAPM = ata.CurrentAPM; + + if(ata.DataSetMgmtSpecified) + identifyDevice.DataSetMgmt = ata.DataSetMgmt; + + if(ata.DataSetMgmtSizeSpecified) + identifyDevice.DataSetMgmtSize = ata.DataSetMgmtSize; + + if(ata.DeviceFormFactorSpecified) + identifyDevice.DeviceFormFactor = ata.DeviceFormFactor; + + if(ata.DMAActiveSpecified) + identifyDevice.DMAActive = ata.DMAActive; + + if(ata.DMASupportedSpecified) + identifyDevice.DMASupported = ata.DMASupported; + + if(ata.DMATransferTimingModeSpecified) + identifyDevice.DMATransferTimingMode = ata.DMATransferTimingMode; + + if(ata.EnhancedSecurityEraseTimeSpecified) + identifyDevice.EnhancedSecurityEraseTime = ata.EnhancedSecurityEraseTime; + + if(ata.EnabledCommandSetSpecified) + identifyDevice.EnabledCommandSet = ata.EnabledCommandSet; + + if(ata.EnabledCommandSet2Specified) + identifyDevice.EnabledCommandSet2 = ata.EnabledCommandSet2; + + if(ata.EnabledCommandSet3Specified) + identifyDevice.EnabledCommandSet3 = ata.EnabledCommandSet3; + + if(ata.EnabledCommandSet4Specified) + identifyDevice.EnabledCommandSet4 = ata.EnabledCommandSet4; + + if(ata.EnabledSATAFeaturesSpecified) + identifyDevice.EnabledSATAFeatures = ata.EnabledSATAFeatures; + + if(ata.ExtendedUserSectorsSpecified) + identifyDevice.ExtendedUserSectors = ata.ExtendedUserSectors; + + if(ata.FreeFallSensitivitySpecified) + identifyDevice.FreeFallSensitivity = ata.FreeFallSensitivity; + + if(ata.FirmwareRevisionSpecified) + identifyDevice.FirmwareRevision = ata.FirmwareRevision; + + if(ata.GeneralConfigurationSpecified) + identifyDevice.GeneralConfiguration = ata.GeneralConfiguration; + + if(ata.HardwareResetResultSpecified) + identifyDevice.HardwareResetResult = ata.HardwareResetResult; + + if(ata.InterseekDelaySpecified) + identifyDevice.InterseekDelay = ata.InterseekDelay; + + if(ata.MajorVersionSpecified) + identifyDevice.MajorVersion = ata.MajorVersion; + + if(ata.MasterPasswordRevisionCodeSpecified) + identifyDevice.MasterPasswordRevisionCode = ata.MasterPasswordRevisionCode; + + if(ata.MaxDownloadMicroMode3Specified) + identifyDevice.MaxDownloadMicroMode3 = ata.MaxDownloadMicroMode3; + + if(ata.MaxQueueDepthSpecified) + identifyDevice.MaxQueueDepth = ata.MaxQueueDepth; + + if(ata.MDMAActiveSpecified) + identifyDevice.MDMAActive = ata.MDMAActive; + + if(ata.MDMASupportedSpecified) + identifyDevice.MDMASupported = ata.MDMASupported; + + if(ata.MinDownloadMicroMode3Specified) + identifyDevice.MinDownloadMicroMode3 = ata.MinDownloadMicroMode3; + + if(ata.MinMDMACycleTimeSpecified) + identifyDevice.MinMDMACycleTime = ata.MinMDMACycleTime; + + if(ata.MinorVersionSpecified) + identifyDevice.MinorVersion = ata.MinorVersion; + + if(ata.MinPIOCycleTimeNoFlowSpecified) + identifyDevice.MinPIOCycleTimeNoFlow = ata.MinPIOCycleTimeNoFlow; + + if(ata.MinPIOCycleTimeFlowSpecified) + identifyDevice.MinPIOCycleTimeFlow = ata.MinPIOCycleTimeFlow; + + if(ata.ModelSpecified) + identifyDevice.Model = ata.Model; + + if(ata.MultipleMaxSectorsSpecified) + identifyDevice.MultipleMaxSectors = ata.MultipleMaxSectors; + + if(ata.MultipleSectorNumberSpecified) + identifyDevice.MultipleSectorNumber = ata.MultipleSectorNumber; + + if(ata.NVCacheCapsSpecified) + identifyDevice.NVCacheCaps = ata.NVCacheCaps; + + if(ata.NVCacheSizeSpecified) + identifyDevice.NVCacheSize = ata.NVCacheSize; + + if(ata.NVCacheWriteSpeedSpecified) + identifyDevice.NVCacheWriteSpeed = ata.NVCacheWriteSpeed; + + if(ata.NVEstimatedSpinUpSpecified) + identifyDevice.NVEstimatedSpinUp = ata.NVEstimatedSpinUp; + + if(ata.PacketBusReleaseSpecified) + identifyDevice.PacketBusRelease = ata.PacketBusRelease; + + if(ata.PIOTransferTimingModeSpecified) + identifyDevice.PIOTransferTimingMode = ata.PIOTransferTimingMode; + + if(ata.RecommendedAAMSpecified) + identifyDevice.RecommendedAAM = ata.RecommendedAAM; + + if(ata.RecommendedMDMACycleTimeSpecified) + identifyDevice.RecMDMACycleTime = ata.RecommendedMDMACycleTime; + + if(ata.RemovableStatusSetSpecified) + identifyDevice.RemovableStatusSet = ata.RemovableStatusSet; + + if(ata.SATACapabilitiesSpecified) + identifyDevice.SATACapabilities = ata.SATACapabilities; + + if(ata.SATACapabilities2Specified) + identifyDevice.SATACapabilities2 = ata.SATACapabilities2; + + if(ata.SATAFeaturesSpecified) + identifyDevice.SATAFeatures = ata.SATAFeatures; + + if(ata.SCTCommandTransportSpecified) + identifyDevice.SCTCommandTransport = ata.SCTCommandTransport; + + if(ata.SectorsPerCardSpecified) + identifyDevice.SectorsPerCard = ata.SectorsPerCard; + + if(ata.SecurityEraseTimeSpecified) + identifyDevice.SecurityEraseTime = ata.SecurityEraseTime; + + if(ata.SecurityStatusSpecified) + identifyDevice.SecurityStatus = ata.SecurityStatus; + + if(ata.ServiceBusyClearSpecified) + identifyDevice.ServiceBusyClear = ata.ServiceBusyClear; + + if(ata.SpecificConfigurationSpecified) + identifyDevice.SpecificConfiguration = ata.SpecificConfiguration; + + if(ata.StreamAccessLatencySpecified) + identifyDevice.StreamAccessLatency = ata.StreamAccessLatency; + + if(ata.StreamMinReqSizeSpecified) + identifyDevice.StreamMinReqSize = ata.StreamMinReqSize; + + if(ata.StreamPerformanceGranularitySpecified) + identifyDevice.StreamPerformanceGranularity = ata.StreamPerformanceGranularity; + + if(ata.StreamTransferTimeDMASpecified) + identifyDevice.StreamTransferTimeDMA = ata.StreamTransferTimeDMA; + + if(ata.StreamTransferTimePIOSpecified) + identifyDevice.StreamTransferTimePIO = ata.StreamTransferTimePIO; + + if(ata.TransportMajorVersionSpecified) + identifyDevice.TransportMajorVersion = ata.TransportMajorVersion; + + if(ata.TransportMinorVersionSpecified) + identifyDevice.TransportMinorVersion = ata.TransportMinorVersion; + + if(ata.TrustedComputingSpecified) + identifyDevice.TrustedComputing = ata.TrustedComputing; + + if(ata.UDMAActiveSpecified) + identifyDevice.UDMAActive = ata.UDMAActive; + + if(ata.UDMASupportedSpecified) + identifyDevice.UDMASupported = ata.UDMASupported; + + if(ata.WRVModeSpecified) + identifyDevice.WRVMode = ata.WRVMode; + + if(ata.WRVSectorCountMode3Specified) + identifyDevice.WRVSectorCountMode3 = ata.WRVSectorCountMode3; + + if(ata.WRVSectorCountMode2Specified) + identifyDevice.WRVSectorCountMode2 = ata.WRVSectorCountMode2; + + Identify = Structs.Devices.ATA.Identify.Encode(identifyDevice); + } + + public Identify.IdentifyDevice? IdentifyDevice => Structs.Devices.ATA.Identify.Decode(Identify); + + [JsonIgnore] + public int Id { get; set; } + public byte[] Identify { get; set; } + public virtual TestedMedia ReadCapabilities { get; set; } + public virtual List RemovableMedias { get; set; } +} + +public class Chs +{ + public Chs() {} + + public Chs(chsType chs) + { + Cylinders = chs.Cylinders; + Heads = chs.Heads; + Sectors = chs.Sectors; + } + + [JsonIgnore] + public int Id { get; set; } + public ushort Cylinders { get; set; } + public ushort Heads { get; set; } + public ushort Sectors { get; set; } +} + +public class Scsi +{ + public Scsi() {} + + public Scsi(scsiType scsi) + { + InquiryData = scsi.Inquiry.Data; + SupportsModeSense6 = scsi.SupportsModeSense6; + SupportsModeSense10 = scsi.SupportsModeSense10; + SupportsModeSubpages = scsi.SupportsModeSubpages; + + if(scsi.ReadCapabilitiesSpecified && + scsi.ReadCapabilities != null) + ReadCapabilities = new TestedMedia(scsi.ReadCapabilities, false); + + if(scsi.RemovableMedias != null) + { + RemovableMedias = new List(); + + foreach(testedMediaType scsiRemovableMedia in scsi.RemovableMedias) + RemovableMedias.Add(new TestedMedia(scsiRemovableMedia, false)); + } + + ModeSense6Data = scsi.ModeSense6Data; + ModeSense10Data = scsi.ModeSense10Data; + + if(scsi.EVPDPages != null) + { + EVPDPages = new List(); + + foreach(pageType evpdPage in scsi.EVPDPages) + EVPDPages.Add(new ScsiPage(evpdPage)); + } + + if(scsi.ModeSense != null) + ModeSense = new ScsiMode(scsi.ModeSense); + + if(scsi.MultiMediaDevice != null) + MultiMediaDevice = new Mmc(scsi.MultiMediaDevice); + + if(scsi.SequentialDevice != null) + SequentialDevice = new Ssc(scsi.SequentialDevice); + + if(InquiryData != null) + return; + + var inq = new Inquiry(); + + if(scsi.Inquiry.ANSIVersionSpecified) + inq.ANSIVersion = scsi.Inquiry.ANSIVersion; + + if(scsi.Inquiry.ECMAVersionSpecified) + inq.ECMAVersion = scsi.Inquiry.ECMAVersion; + + if(scsi.Inquiry.DeviceTypeModifierSpecified) + inq.DeviceTypeModifier = scsi.Inquiry.DeviceTypeModifier; + + if(scsi.Inquiry.ISOVersionSpecified) + inq.ISOVersion = scsi.Inquiry.ISOVersion; + + if(scsi.Inquiry.ProductIdentificationSpecified) + { + byte[] tmp = Encoding.ASCII.GetBytes(scsi.Inquiry.ProductIdentification); + inq.ProductIdentification = new byte[tmp.Length + 1]; + Array.Copy(tmp, 0, inq.ProductIdentification, 0, tmp.Length); + } + + if(scsi.Inquiry.ProductRevisionLevelSpecified) + { + byte[] tmp = Encoding.ASCII.GetBytes(scsi.Inquiry.ProductRevisionLevel); + inq.ProductRevisionLevel = new byte[tmp.Length + 1]; + Array.Copy(tmp, 0, inq.ProductRevisionLevel, 0, tmp.Length); + } + + if(scsi.Inquiry.ResponseDataFormatSpecified) + inq.ResponseDataFormat = scsi.Inquiry.ResponseDataFormat; + + if(scsi.Inquiry.VendorIdentificationSpecified) + { + byte[] tmp = Encoding.ASCII.GetBytes(scsi.Inquiry.VendorIdentification); + inq.VendorIdentification = new byte[tmp.Length + 1]; + Array.Copy(tmp, 0, inq.VendorIdentification, 0, tmp.Length); + } + + inq.ACC = scsi.Inquiry.AccessControlCoordinator; + inq.ACKREQQ = scsi.Inquiry.ACKRequests; + inq.AERC = scsi.Inquiry.AERCSupported; + inq.Addr16 = scsi.Inquiry.Address16; + inq.Addr32 = scsi.Inquiry.Address32; + inq.TPGS = (byte)scsi.Inquiry.AsymmetricalLUNAccess; + inq.BQue = scsi.Inquiry.BasicQueueing; + inq.EncServ = scsi.Inquiry.EnclosureServices; + inq.HiSup = scsi.Inquiry.HierarchicalLUN; + inq.IUS = scsi.Inquiry.IUS; + inq.Linked = scsi.Inquiry.LinkedCommands; + inq.MChngr = scsi.Inquiry.MediumChanger; + inq.MultiP = scsi.Inquiry.MultiPortDevice; + inq.NormACA = scsi.Inquiry.NormalACA; + inq.PeripheralDeviceType = (byte)scsi.Inquiry.PeripheralDeviceType; + inq.PeripheralQualifier = (byte)scsi.Inquiry.PeripheralQualifier; + inq.Protect = scsi.Inquiry.Protection; + inq.QAS = scsi.Inquiry.QAS; + inq.RelAddr = scsi.Inquiry.RelativeAddressing; + inq.RMB = scsi.Inquiry.Removable; + inq.CmdQue = scsi.Inquiry.TaggedCommandQueue; + inq.TrmTsk = scsi.Inquiry.TerminateTaskSupported; + inq.ThreePC = scsi.Inquiry.ThirdPartyCopy; + inq.TranDis = scsi.Inquiry.TranferDisable; + inq.SftRe = scsi.Inquiry.SoftReset; + inq.Clocking = (byte)scsi.Inquiry.SPIClocking; + inq.SCCS = scsi.Inquiry.StorageArrayController; + inq.Sync = scsi.Inquiry.SyncTransfer; + inq.VersionDescriptors = scsi.Inquiry.VersionDescriptors; + inq.WBus16 = scsi.Inquiry.WideBus16; + inq.WBus32 = scsi.Inquiry.WideBus32; + + InquiryData = Structs.Devices.SCSI.Inquiry.Encode(inq); + } + + public Inquiry? Inquiry => Structs.Devices.SCSI.Inquiry.Decode(InquiryData); + + [JsonIgnore] + public int Id { get; set; } + [DisplayName("Data from INQUIRY command")] + public byte[] InquiryData { get; set; } + public virtual List EVPDPages { get; set; } + [DisplayName("Supports MODE SENSE(6)")] + public bool SupportsModeSense6 { get; set; } + [DisplayName("Supports MODE SENSE(10)")] + public bool SupportsModeSense10 { get; set; } + [DisplayName("Supports MODE SENSE with subpages")] + public bool SupportsModeSubpages { get; set; } + public virtual ScsiMode ModeSense { get; set; } + public virtual Mmc MultiMediaDevice { get; set; } + public virtual TestedMedia ReadCapabilities { get; set; } + public virtual List RemovableMedias { get; set; } + public virtual Ssc SequentialDevice { get; set; } + [DisplayName("Data from MODE SENSE(6) command")] + public byte[] ModeSense6Data { get; set; } + [DisplayName("Data from MODE SENSE(10) command")] + public byte[] ModeSense10Data { get; set; } + [DisplayName("Data from MODE SENSE(6) command (current)")] + public byte[] ModeSense6CurrentData { get; set; } + [DisplayName("Data from MODE SENSE(10) command (current)")] + public byte[] ModeSense10CurrentData { get; set; } + [DisplayName("Data from MODE SENSE(6) command (changeable)")] + public byte[] ModeSense6ChangeableData { get; set; } + [DisplayName("Data from MODE SENSE(10) command (changeable)")] + public byte[] ModeSense10ChangeableData { get; set; } + + [JsonIgnore] + public int? SequentialDeviceId { get; set; } +} + +public class ScsiMode +{ + public ScsiMode() {} + + public ScsiMode(modeType mode) + { + if(mode.MediumTypeSpecified) + MediumType = mode.MediumType; + + WriteProtected = mode.WriteProtected; + + if(mode.SpeedSpecified) + Speed = mode.Speed; + + if(mode.BufferedModeSpecified) + BufferedMode = mode.BufferedMode; + + BlankCheckEnabled = mode.BlankCheckEnabled; + DPOandFUA = mode.DPOandFUA; + + if(mode.ModePages != null) + { + ModePages = new List(); + + foreach(modePageType modePage in mode.ModePages) + ModePages.Add(new ScsiPage(modePage)); + } + + if(mode.BlockDescriptors == null) + return; + + BlockDescriptors = new List(); + + foreach(blockDescriptorType blockDescriptor in mode.BlockDescriptors) + BlockDescriptors.Add(new BlockDescriptor(blockDescriptor)); + } + + [JsonIgnore] + public int Id { get; set; } + [DisplayName("Medium type code")] + public byte? MediumType { get; set; } + [DisplayName("Write protected")] + public bool WriteProtected { get; set; } + public virtual List BlockDescriptors { get; set; } + public byte? Speed { get; set; } + [DisplayName("Buffered mode")] + public byte? BufferedMode { get; set; } + [DisplayName("Blank check enabled")] + public bool BlankCheckEnabled { get; set; } + [DisplayName("DPO and FUA")] + public bool DPOandFUA { get; set; } + public virtual List ModePages { get; set; } +} + +public class BlockDescriptor +{ + public BlockDescriptor() {} + + public BlockDescriptor(blockDescriptorType descriptor) + { + Density = descriptor.Density; + + if(descriptor.BlocksSpecified) + Blocks = descriptor.Blocks; + + if(descriptor.BlockLengthSpecified) + BlockLength = descriptor.BlockLength; + } + + [JsonIgnore] + public int Id { get; set; } + public byte Density { get; set; } + public ulong? Blocks { get; set; } + [DisplayName("Block length (bytes)")] + public uint? BlockLength { get; set; } +} + +public class ScsiPage +{ + public ScsiPage() {} + + public ScsiPage(pageType evpdPage) + { + page = evpdPage.page; + value = evpdPage.value; + } + + public ScsiPage(modePageType modePage) + { + page = modePage.page; + subpage = modePage.subpage; + value = modePage.value; + } + + [JsonIgnore] + public int Id { get; set; } + public byte page { get; set; } + public byte? subpage { get; set; } + public byte[] value { get; set; } +} + +public class Mmc +{ + public Mmc() {} + + public Mmc(mmcType mmc) + { + if(mmc.ModeSense2A != null) + ModeSense2AData = ModePage_2A.Encode(new ModePage_2A { - RemovableMedias = new List(); + AccurateCDDA = mmc.ModeSense2A.AccurateCDDA, + BCK = mmc.ModeSense2A.BCK, + BufferSize = mmc.ModeSense2A.BufferSize, + BUF = mmc.ModeSense2A.BufferUnderRunProtection, + Eject = mmc.ModeSense2A.CanEject, + Lock = mmc.ModeSense2A.CanLockMedia, + CDDACommand = mmc.ModeSense2A.CDDACommand, + Composite = mmc.ModeSense2A.CompositeAudioVideo, + CMRSupported = (ushort)(mmc.ModeSense2A.CSSandCPPMSupported ? 1 : 0), + CurrentSpeed = mmc.ModeSense2A.CurrentSpeed, + CurrentWriteSpeed = mmc.ModeSense2A.CurrentWriteSpeed, + CurrentWriteSpeedSelected = mmc.ModeSense2A.CurrentWriteSpeedSelected, + SDP = mmc.ModeSense2A.DeterministicSlotChanger, + DigitalPort1 = mmc.ModeSense2A.DigitalPort1, + DigitalPort2 = mmc.ModeSense2A.DigitalPort2, + LeadInPW = mmc.ModeSense2A.LeadInPW, + LoadingMechanism = mmc.ModeSense2A.LoadingMechanismType, + LockState = mmc.ModeSense2A.LockStatus, + LSBF = mmc.ModeSense2A.LSBF, + MaximumSpeed = mmc.ModeSense2A.MaximumSpeed, + MaxWriteSpeed = mmc.ModeSense2A.MaximumWriteSpeed, + AudioPlay = mmc.ModeSense2A.PlaysAudio, + PreventJumper = mmc.ModeSense2A.PreventJumperStatus, + RCK = mmc.ModeSense2A.RCK, + ReadBarcode = mmc.ModeSense2A.ReadsBarcode, + SCC = mmc.ModeSense2A.ReadsBothSides, + ReadCDR = mmc.ModeSense2A.ReadsCDR, + ReadCDRW = mmc.ModeSense2A.ReadsCDRW, + DeinterlaveSubchannel = mmc.ModeSense2A.ReadsDeinterlavedSubchannel, + ReadDVDR = mmc.ModeSense2A.ReadsDVDR, + ReadDVDRAM = mmc.ModeSense2A.ReadsDVDRAM, + ReadDVDROM = mmc.ModeSense2A.ReadsDVDROM, + ISRC = mmc.ModeSense2A.ReadsISRC, + Mode2Form2 = mmc.ModeSense2A.ReadsMode2Form2, + Mode2Form1 = mmc.ModeSense2A.ReadsMode2Form1, + Method2 = mmc.ModeSense2A.ReadsPacketCDR, + Subchannel = mmc.ModeSense2A.ReadsSubchannel, + UPC = mmc.ModeSense2A.ReadsUPC, + C2Pointer = mmc.ModeSense2A.ReturnsC2Pointers, + RotationControlSelected = mmc.ModeSense2A.RotationControlSelected, + SeparateChannelMute = mmc.ModeSense2A.SeparateChannelMute, + SeparateChannelVolume = mmc.ModeSense2A.SeparateChannelVolume, + SSS = mmc.ModeSense2A.SSS, + MultiSession = mmc.ModeSense2A.SupportsMultiSession, + SupportedVolumeLevels = mmc.ModeSense2A.SupportedVolumeLevels, + TestWrite = mmc.ModeSense2A.TestWrite, + WriteCDR = mmc.ModeSense2A.WritesCDR, + WriteCDRW = mmc.ModeSense2A.WritesCDRW, + WriteDVDR = mmc.ModeSense2A.WritesDVDR, + WriteDVDRAM = mmc.ModeSense2A.WritesDVDRAM, + WriteSpeedPerformanceDescriptors = mmc.ModeSense2A.WriteSpeedPerformanceDescriptors + }); - foreach(testedMediaType scsiRemovableMedia in scsi.RemovableMedias) - RemovableMedias.Add(new TestedMedia(scsiRemovableMedia, false)); - } + if(mmc.Features != null) + Features = new MmcFeatures(mmc.Features); - ModeSense6Data = scsi.ModeSense6Data; - ModeSense10Data = scsi.ModeSense10Data; + if(mmc.TestedMedia == null) + return; - if(scsi.EVPDPages != null) + TestedMedia = new List(); + + foreach(testedMediaType mediaType in mmc.TestedMedia) + TestedMedia.Add(new TestedMedia(mediaType, false)); + } + + [JsonIgnore] + public int Id { get; set; } + public virtual ModePage_2A ModeSense2A => ModePage_2A.Decode(ModeSense2AData); + public virtual MmcFeatures Features { get; set; } + public virtual List TestedMedia { get; set; } + public byte[] ModeSense2AData { get; set; } + [JsonIgnore] + public int? FeaturesId { get; set; } +} + +public class MmcFeatures +{ + public MmcFeatures() {} + + public MmcFeatures(mmcFeaturesType features) + { + if(features.PhysicalInterfaceStandardSpecified && + !features.PhysicalInterfaceStandardNumberSpecified) + PhysicalInterfaceStandardNumber = (uint?)features.PhysicalInterfaceStandard; + + if(features.PhysicalInterfaceStandardNumberSpecified) + PhysicalInterfaceStandardNumber = features.PhysicalInterfaceStandardNumber; + + if(features.AACSVersionSpecified) + AACSVersion = features.AACSVersion; + + if(features.AGIDsSpecified) + AGIDs = features.AGIDs; + + if(features.BindingNonceBlocksSpecified) + BindingNonceBlocks = features.BindingNonceBlocks; + + if(features.CPRMVersionSpecified) + CPRMVersion = features.CPRMVersion; + + if(features.CSSVersionSpecified) + CSSVersion = features.CSSVersion; + + if(features.LoadingMechanismTypeSpecified) + LoadingMechanismType = features.LoadingMechanismType; + + if(features.LogicalBlockSizeSpecified) + LogicalBlockSize = features.LogicalBlockSize; + + if(features.BlocksPerReadableUnitSpecified) + BlocksPerReadableUnit = features.BlocksPerReadableUnit; + + if(features.FirmwareDateSpecified) + FirmwareDate = features.FirmwareDate; + + if(features.VolumeLevelsSpecified) + VolumeLevels = features.VolumeLevels; + + BufferUnderrunFreeInDVD = features.BufferUnderrunFreeInDVD; + BufferUnderrunFreeInSAO = features.BufferUnderrunFreeInSAO; + BufferUnderrunFreeInTAO = features.BufferUnderrunFreeInTAO; + CanAudioScan = features.CanAudioScan; + CanEject = features.CanEject; + CanEraseSector = features.CanEraseSector; + CanExpandBDRESpareArea = features.CanExpandBDRESpareArea; + CanFormat = features.CanFormat; + CanFormatBDREWithoutSpare = features.CanFormatBDREWithoutSpare; + CanFormatCert = features.CanFormatCert; + CanFormatFRF = features.CanFormatFRF; + CanFormatQCert = features.CanFormatQCert; + CanFormatRRM = features.CanFormatRRM; + CanGenerateBindingNonce = features.CanGenerateBindingNonce; + CanLoad = features.CanLoad; + CanMuteSeparateChannels = features.CanMuteSeparateChannels; + CanOverwriteSAOTrack = features.CanOverwriteSAOTrack; + CanOverwriteTAOTrack = features.CanOverwriteTAOTrack; + CanPlayCDAudio = features.CanPlayCDAudio; + CanPseudoOverwriteBDR = features.CanPseudoOverwriteBDR; + CanReadAllDualR = features.CanReadAllDualR; + CanReadAllDualRW = features.CanReadAllDualRW; + CanReadBD = features.CanReadBD; + CanReadBDR = features.CanReadBDR; + CanReadBDRE1 = features.CanReadBDRE1; + CanReadBDRE2 = features.CanReadBDRE2; + CanReadBDROM = features.CanReadBDROM; + CanReadBluBCA = features.CanReadBluBCA; + CanReadCD = features.CanReadCD; + CanReadCDMRW = features.CanReadCDMRW; + CanReadCPRM_MKB = features.CanReadCPRM_MKB; + CanReadDDCD = features.CanReadDDCD; + CanReadDVD = features.CanReadDVD; + CanReadDVDPlusMRW = features.CanReadDVDPlusMRW; + CanReadDVDPlusR = features.CanReadDVDPlusR; + CanReadDVDPlusRDL = features.CanReadDVDPlusRDL; + CanReadDVDPlusRW = features.CanReadDVDPlusRW; + CanReadDVDPlusRWDL = features.CanReadDVDPlusRWDL; + CanReadDriveAACSCertificate = features.CanReadDriveAACSCertificate; + CanReadHDDVD = features.CanReadHDDVD; + CanReadHDDVDR = features.CanReadHDDVDR; + CanReadHDDVDRAM = features.CanReadHDDVDRAM; + CanReadLeadInCDText = features.CanReadLeadInCDText; + CanReadOldBDR = features.CanReadOldBDR; + CanReadOldBDRE = features.CanReadOldBDRE; + CanReadOldBDROM = features.CanReadOldBDROM; + CanReadSpareAreaInformation = features.CanReadSpareAreaInformation; + CanReportDriveSerial = features.CanReportDriveSerial; + CanReportMediaSerial = features.CanReportMediaSerial; + CanTestWriteDDCDR = features.CanTestWriteDDCDR; + CanTestWriteDVD = features.CanTestWriteDVD; + CanTestWriteInSAO = features.CanTestWriteInSAO; + CanTestWriteInTAO = features.CanTestWriteInTAO; + CanUpgradeFirmware = features.CanUpgradeFirmware; + CanWriteBD = features.CanWriteBD; + CanWriteBDR = features.CanWriteBDR; + CanWriteBDRE1 = features.CanWriteBDRE1; + CanWriteBDRE2 = features.CanWriteBDRE2; + CanWriteBusEncryptedBlocks = features.CanWriteBusEncryptedBlocks; + CanWriteCDMRW = features.CanWriteCDMRW; + CanWriteCDRW = features.CanWriteCDRW; + CanWriteCDRWCAV = features.CanWriteCDRWCAV; + CanWriteCDSAO = features.CanWriteCDSAO; + CanWriteCDTAO = features.CanWriteCDTAO; + CanWriteCSSManagedDVD = features.CanWriteCSSManagedDVD; + CanWriteDDCDR = features.CanWriteDDCDR; + CanWriteDDCDRW = features.CanWriteDDCDRW; + CanWriteDVDPlusMRW = features.CanWriteDVDPlusMRW; + CanWriteDVDPlusR = features.CanWriteDVDPlusR; + CanWriteDVDPlusRDL = features.CanWriteDVDPlusRDL; + CanWriteDVDPlusRW = features.CanWriteDVDPlusRW; + CanWriteDVDPlusRWDL = features.CanWriteDVDPlusRWDL; + CanWriteDVDR = features.CanWriteDVDR; + CanWriteDVDRDL = features.CanWriteDVDRDL; + CanWriteDVDRW = features.CanWriteDVDRW; + CanWriteHDDVDR = features.CanWriteHDDVDR; + CanWriteHDDVDRAM = features.CanWriteHDDVDRAM; + CanWriteOldBDR = features.CanWriteOldBDR; + CanWriteOldBDRE = features.CanWriteOldBDRE; + CanWritePackedSubchannelInTAO = features.CanWritePackedSubchannelInTAO; + CanWriteRWSubchannelInSAO = features.CanWriteRWSubchannelInSAO; + CanWriteRWSubchannelInTAO = features.CanWriteRWSubchannelInTAO; + CanWriteRaw = features.CanWriteRaw; + CanWriteRawMultiSession = features.CanWriteRawMultiSession; + CanWriteRawSubchannelInTAO = features.CanWriteRawSubchannelInTAO; + ChangerIsSideChangeCapable = features.ChangerIsSideChangeCapable; + ChangerSlots = features.ChangerSlots; + ChangerSupportsDiscPresent = features.ChangerSupportsDiscPresent; + DBML = features.DBML; + DVDMultiRead = features.DVDMultiRead; + EmbeddedChanger = features.EmbeddedChanger; + ErrorRecoveryPage = features.ErrorRecoveryPage; + Locked = features.Locked; + MultiRead = features.MultiRead; + PreventJumper = features.PreventJumper; + SupportsAACS = features.SupportsAACS; + SupportsBusEncryption = features.SupportsBusEncryption; + SupportsC2 = features.SupportsC2; + SupportsCPRM = features.SupportsCPRM; + SupportsCSS = features.SupportsCSS; + SupportsDAP = features.SupportsDAP; + SupportsDeviceBusyEvent = features.SupportsDeviceBusyEvent; + SupportsHybridDiscs = features.SupportsHybridDiscs; + SupportsModePage1Ch = features.SupportsModePage1Ch; + SupportsOSSC = features.SupportsOSSC; + SupportsPWP = features.SupportsPWP; + SupportsSWPP = features.SupportsSWPP; + SupportsSecurDisc = features.SupportsSecurDisc; + SupportsSeparateVolume = features.SupportsSeparateVolume; + SupportsVCPS = features.SupportsVCPS; + SupportsWriteInhibitDCB = features.SupportsWriteInhibitDCB; + SupportsWriteProtectPAC = features.SupportsWriteProtectPAC; + } + + [JsonIgnore] + public int Id { get; set; } + [DisplayName("AACS version")] + public byte? AACSVersion { get; set; } + [DisplayName("AGIDs")] + public byte? AGIDs { get; set; } + [DisplayName("Binding nonce blocks")] + public byte? BindingNonceBlocks { get; set; } + [DisplayName("Blocks per redable unit")] + public ushort? BlocksPerReadableUnit { get; set; } + [DisplayName("Buffer under-run free in DVD writing")] + public bool BufferUnderrunFreeInDVD { get; set; } + [DisplayName("Buffer under-run free in SAO writing")] + public bool BufferUnderrunFreeInSAO { get; set; } + [DisplayName("Buffer under-run free in TAO writing")] + public bool BufferUnderrunFreeInTAO { get; set; } + [DisplayName("Can audio scan")] + public bool CanAudioScan { get; set; } + [DisplayName("Can eject")] + public bool CanEject { get; set; } + [DisplayName("Can erase sectors")] + public bool CanEraseSector { get; set; } + [DisplayName("Can expand BD-RE spare area")] + public bool CanExpandBDRESpareArea { get; set; } + [DisplayName("Can format media")] + public bool CanFormat { get; set; } + [DisplayName("Can format BD-RE without spare area")] + public bool CanFormatBDREWithoutSpare { get; set; } + [DisplayName("Can do a fully certified format")] + public bool CanFormatCert { get; set; } + [DisplayName("Can do a FRF format")] + public bool CanFormatFRF { get; set; } + [DisplayName("Can do a quick certified format")] + public bool CanFormatQCert { get; set; } + [DisplayName("Can do a RRM format")] + public bool CanFormatRRM { get; set; } + [DisplayName("Can generate binding nonce")] + public bool CanGenerateBindingNonce { get; set; } + [DisplayName("Can load")] + public bool CanLoad { get; set; } + [DisplayName("Can mute separate channels")] + public bool CanMuteSeparateChannels { get; set; } + [DisplayName("Can overwrite track in SAO")] + public bool CanOverwriteSAOTrack { get; set; } + [DisplayName("Can overwrite track in TAO")] + public bool CanOverwriteTAOTrack { get; set; } + [DisplayName("Can play CD-DA")] + public bool CanPlayCDAudio { get; set; } + [DisplayName("Can pseudo-overwrite BD-R")] + public bool CanPseudoOverwriteBDR { get; set; } + [DisplayName("Can read all dual-layer recordables")] + public bool CanReadAllDualR { get; set; } + [DisplayName("Can read all dual-layer rewritables")] + public bool CanReadAllDualRW { get; set; } + [DisplayName("Can read Blu-ray")] + public bool CanReadBD { get; set; } + [DisplayName("Can read BD-R")] + public bool CanReadBDR { get; set; } + [DisplayName("Can read BD-RE v1")] + public bool CanReadBDRE1 { get; set; } + [DisplayName("Can read BD-RE v2")] + public bool CanReadBDRE2 { get; set; } + [DisplayName("Can read BD-ROM")] + public bool CanReadBDROM { get; set; } + [DisplayName("Can read BCA from Blu-ray")] + public bool CanReadBluBCA { get; set; } + [DisplayName("Can read CD")] + public bool CanReadCD { get; set; } + [DisplayName("Can read CD-MRW")] + public bool CanReadCDMRW { get; set; } + [DisplayName("Can read CPRM's MKB")] + public bool CanReadCPRM_MKB { get; set; } + [DisplayName("Can read DDCD")] + public bool CanReadDDCD { get; set; } + [DisplayName("Can read DVD")] + public bool CanReadDVD { get; set; } + [DisplayName("Can read DVD+MRW")] + public bool CanReadDVDPlusMRW { get; set; } + [DisplayName("Can read DVD+R")] + public bool CanReadDVDPlusR { get; set; } + [DisplayName("Can read DVD+R DL")] + public bool CanReadDVDPlusRDL { get; set; } + [DisplayName("Can read DVD+RW")] + public bool CanReadDVDPlusRW { get; set; } + [DisplayName("Can read DVD+RW DL")] + public bool CanReadDVDPlusRWDL { get; set; } + [DisplayName("Can read drive's AACS certificate")] + public bool CanReadDriveAACSCertificate { get; set; } + [DisplayName("Can read HD DVD")] + public bool CanReadHDDVD { get; set; } + [DisplayName("Can read HD DVD-R")] + public bool CanReadHDDVDR { get; set; } + [DisplayName("Can read HD DVD-RAM")] + public bool CanReadHDDVDRAM { get; set; } + [DisplayName("Can read Lead-In's CD-TEXT")] + public bool CanReadLeadInCDText { get; set; } + [DisplayName("Can read old generation BD-R")] + public bool CanReadOldBDR { get; set; } + [DisplayName("Can read old generation BD-RE")] + public bool CanReadOldBDRE { get; set; } + [DisplayName("Can read old generation BD-ROM")] + public bool CanReadOldBDROM { get; set; } + [DisplayName("Can read spare area information")] + public bool CanReadSpareAreaInformation { get; set; } + [DisplayName("Can report drive serial number")] + public bool CanReportDriveSerial { get; set; } + [DisplayName("Can report media serial number")] + public bool CanReportMediaSerial { get; set; } + [DisplayName("Can test write DDCD-R")] + public bool CanTestWriteDDCDR { get; set; } + [DisplayName("Can test write DVD")] + public bool CanTestWriteDVD { get; set; } + [DisplayName("Can test write in SAO mode")] + public bool CanTestWriteInSAO { get; set; } + [DisplayName("Can test write in TAO mode")] + public bool CanTestWriteInTAO { get; set; } + [DisplayName("Can upgrade firmware")] + public bool CanUpgradeFirmware { get; set; } + [DisplayName("Can write Blu-ray")] + public bool CanWriteBD { get; set; } + [DisplayName("Can write BD-R")] + public bool CanWriteBDR { get; set; } + [DisplayName("Can write BD-RE v1")] + public bool CanWriteBDRE1 { get; set; } + [DisplayName("Can write BD-RE v2")] + public bool CanWriteBDRE2 { get; set; } + [DisplayName("Can write bus encrypted blocks")] + public bool CanWriteBusEncryptedBlocks { get; set; } + [DisplayName("Can write CD-MRW")] + public bool CanWriteCDMRW { get; set; } + [DisplayName("Can write CD-RW")] + public bool CanWriteCDRW { get; set; } + [DisplayName("Can write CD-RW CAV")] + public bool CanWriteCDRWCAV { get; set; } + [DisplayName("Can write CD in SAO mode")] + public bool CanWriteCDSAO { get; set; } + [DisplayName("Can write CD in TAO mode")] + public bool CanWriteCDTAO { get; set; } + [DisplayName("Can write CSS managed DVD")] + public bool CanWriteCSSManagedDVD { get; set; } + [DisplayName("Can write DDCD-R")] + public bool CanWriteDDCDR { get; set; } + [DisplayName("Can write DDCD-RW")] + public bool CanWriteDDCDRW { get; set; } + [DisplayName("Can write DVD+MRW")] + public bool CanWriteDVDPlusMRW { get; set; } + [DisplayName("Can write DVD+R")] + public bool CanWriteDVDPlusR { get; set; } + [DisplayName("Can write DVD+R DL")] + public bool CanWriteDVDPlusRDL { get; set; } + [DisplayName("Can write DVD+RW")] + public bool CanWriteDVDPlusRW { get; set; } + [DisplayName("Can write DVD+RW DL")] + public bool CanWriteDVDPlusRWDL { get; set; } + [DisplayName("Can write DVD-R")] + public bool CanWriteDVDR { get; set; } + [DisplayName("Can write DVD-R DL")] + public bool CanWriteDVDRDL { get; set; } + [DisplayName("Can write DVD-RW")] + public bool CanWriteDVDRW { get; set; } + [DisplayName("Can write HD DVD-R")] + public bool CanWriteHDDVDR { get; set; } + [DisplayName("Can write HD DVD-RAM")] + public bool CanWriteHDDVDRAM { get; set; } + [DisplayName("Can write old generation BD-R")] + public bool CanWriteOldBDR { get; set; } + [DisplayName("Can write old generation BD-RE")] + public bool CanWriteOldBDRE { get; set; } + [DisplayName("Can write packet subchannel in TAO")] + public bool CanWritePackedSubchannelInTAO { get; set; } + [DisplayName("Can write RW subchannel in SAO")] + public bool CanWriteRWSubchannelInSAO { get; set; } + [DisplayName("Can write RW subchannel in TAO")] + public bool CanWriteRWSubchannelInTAO { get; set; } + [DisplayName("Can write RAW-96 sectors")] + public bool CanWriteRaw { get; set; } + [DisplayName("Can write RAW-96 sectors in multisession")] + public bool CanWriteRawMultiSession { get; set; } + [DisplayName("Can write RAW-96 sectors in TAO")] + public bool CanWriteRawSubchannelInTAO { get; set; } + [DisplayName("Changer is side change capable")] + public bool ChangerIsSideChangeCapable { get; set; } + [DisplayName("Changer slots")] + public byte ChangerSlots { get; set; } + [DisplayName("Changer supports disc present")] + public bool ChangerSupportsDiscPresent { get; set; } + [DisplayName("CPRM version")] + public byte? CPRMVersion { get; set; } + [DisplayName("CSS version")] + public byte? CSSVersion { get; set; } + [DisplayName("DBML")] + public bool DBML { get; set; } + [DisplayName("DVD Multi-Read Specification")] + public bool DVDMultiRead { get; set; } + [DisplayName("Has an embedded changer")] + public bool EmbeddedChanger { get; set; } + [DisplayName("Has error recovery page")] + public bool ErrorRecoveryPage { get; set; } + [DisplayName("Firmware date")] + public DateTime? FirmwareDate { get; set; } + [DisplayName("Loading mechanism type")] + public byte? LoadingMechanismType { get; set; } + [DisplayName("Locked")] + public bool Locked { get; set; } + [DisplayName("Logical block size")] + public uint? LogicalBlockSize { get; set; } + [DisplayName("Multi-Read Specification")] + public bool MultiRead { get; set; } + [DisplayName("Physical interface standard")] + public PhysicalInterfaces? PhysicalInterfaceStandard => (PhysicalInterfaces?)PhysicalInterfaceStandardNumber; + [DisplayName("Physical interface standard number")] + public uint? PhysicalInterfaceStandardNumber { get; set; } + [DisplayName("Prevent eject jumper")] + public bool PreventJumper { get; set; } + [DisplayName("Supports AACS")] + public bool SupportsAACS { get; set; } + [DisplayName("Supports bus encryption")] + public bool SupportsBusEncryption { get; set; } + [DisplayName("Supports C2 pointers")] + public bool SupportsC2 { get; set; } + [DisplayName("Supports CPRM")] + public bool SupportsCPRM { get; set; } + [DisplayName("Supports CSS")] + public bool SupportsCSS { get; set; } + [DisplayName("Supports DAP")] + public bool SupportsDAP { get; set; } + [DisplayName("Supports device busy event")] + public bool SupportsDeviceBusyEvent { get; set; } + [DisplayName("Supports hybrid discs")] + public bool SupportsHybridDiscs { get; set; } + [DisplayName("Supports MODE PAGE 1Ch")] + public bool SupportsModePage1Ch { get; set; } + [DisplayName("Supports OSSC")] + public bool SupportsOSSC { get; set; } + [DisplayName("Supports PWP")] + public bool SupportsPWP { get; set; } + [DisplayName("Supports SWPP")] + public bool SupportsSWPP { get; set; } + [DisplayName("Supports SecurDisc")] + public bool SupportsSecurDisc { get; set; } + [DisplayName("Support separate volume levels")] + public bool SupportsSeparateVolume { get; set; } + [DisplayName("Supports VCPS")] + public bool SupportsVCPS { get; set; } + [DisplayName("Supports write inhibit DCB")] + public bool SupportsWriteInhibitDCB { get; set; } + [DisplayName("Supports write protect PAC")] + public bool SupportsWriteProtectPAC { get; set; } + [DisplayName("Volume levels")] + public ushort? VolumeLevels { get; set; } + [DisplayName("MMC FEATURES binary data")] + public byte[] BinaryData { get; set; } +} + +public class TestedMedia +{ + public Identify.IdentifyDevice? IdentifyDevice; + + public TestedMedia() {} + + public TestedMedia(testedMediaType mediaType, bool ata) + { + if(mediaType.BlocksSpecified) + Blocks = mediaType.Blocks; + + if(mediaType.BlockSizeSpecified) + BlockSize = mediaType.BlockSize; + + if(mediaType.CanReadAACSSpecified) + CanReadAACS = mediaType.CanReadAACS; + + if(mediaType.CanReadADIPSpecified) + CanReadADIP = mediaType.CanReadADIP; + + if(mediaType.CanReadATIPSpecified) + CanReadATIP = mediaType.CanReadATIP; + + if(mediaType.CanReadBCASpecified) + CanReadBCA = mediaType.CanReadBCA; + + if(mediaType.CanReadC2PointersSpecified) + CanReadC2Pointers = mediaType.CanReadC2Pointers; + + if(mediaType.CanReadCMISpecified) + CanReadCMI = mediaType.CanReadCMI; + + if(mediaType.CanReadCorrectedSubchannelSpecified) + CanReadCorrectedSubchannel = mediaType.CanReadCorrectedSubchannel; + + if(mediaType.CanReadCorrectedSubchannelWithC2Specified) + CanReadCorrectedSubchannelWithC2 = mediaType.CanReadCorrectedSubchannelWithC2; + + if(mediaType.CanReadDCBSpecified) + CanReadDCB = mediaType.CanReadDCB; + + if(mediaType.CanReadDDSSpecified) + CanReadDDS = mediaType.CanReadDDS; + + if(mediaType.CanReadDMISpecified) + CanReadDMI = mediaType.CanReadDMI; + + if(mediaType.CanReadDiscInformationSpecified) + CanReadDiscInformation = mediaType.CanReadDiscInformation; + + if(mediaType.CanReadFullTOCSpecified) + CanReadFullTOC = mediaType.CanReadFullTOC; + + if(mediaType.CanReadHDCMISpecified) + CanReadHDCMI = mediaType.CanReadHDCMI; + + if(mediaType.CanReadLayerCapacitySpecified) + CanReadLayerCapacity = mediaType.CanReadLayerCapacity; + + if(mediaType.CanReadLeadInSpecified) + CanReadFirstTrackPreGap = mediaType.CanReadLeadIn; + + if(mediaType.CanReadLeadOutSpecified) + CanReadLeadOut = mediaType.CanReadLeadOut; + + if(mediaType.CanReadMediaIDSpecified) + CanReadMediaID = mediaType.CanReadMediaID; + + if(mediaType.CanReadMediaSerialSpecified) + CanReadMediaSerial = mediaType.CanReadMediaSerial; + + if(mediaType.CanReadPACSpecified) + CanReadPAC = mediaType.CanReadPAC; + + if(mediaType.CanReadPFISpecified) + CanReadPFI = mediaType.CanReadPFI; + + if(mediaType.CanReadPMASpecified) + CanReadPMA = mediaType.CanReadPMA; + + if(mediaType.CanReadPQSubchannelSpecified) + CanReadPQSubchannel = mediaType.CanReadPQSubchannel; + + if(mediaType.CanReadPQSubchannelWithC2Specified) + CanReadPQSubchannelWithC2 = mediaType.CanReadPQSubchannelWithC2; + + if(mediaType.CanReadPRISpecified) + CanReadPRI = mediaType.CanReadPRI; + + if(mediaType.CanReadRWSubchannelSpecified) + CanReadRWSubchannel = mediaType.CanReadRWSubchannel; + + if(mediaType.CanReadRWSubchannelWithC2Specified) + CanReadRWSubchannelWithC2 = mediaType.CanReadRWSubchannelWithC2; + + if(mediaType.CanReadRecordablePFISpecified) + CanReadRecordablePFI = mediaType.CanReadRecordablePFI; + + if(mediaType.CanReadSpareAreaInformationSpecified) + CanReadSpareAreaInformation = mediaType.CanReadSpareAreaInformation; + + if(mediaType.CanReadTOCSpecified) + CanReadTOC = mediaType.CanReadTOC; + + if(mediaType.DensitySpecified) + Density = mediaType.Density; + + if(mediaType.LongBlockSizeSpecified) + LongBlockSize = mediaType.LongBlockSize; + + if(mediaType.ManufacturerSpecified) + Manufacturer = mediaType.Manufacturer; + + if(mediaType.MediumTypeSpecified) + MediumType = mediaType.MediumType; + + if(mediaType.ModelSpecified) + Model = mediaType.Model; + + if(mediaType.SupportsHLDTSTReadRawDVDSpecified) + SupportsHLDTSTReadRawDVD = mediaType.SupportsHLDTSTReadRawDVD; + + if(mediaType.SupportsNECReadCDDASpecified) + SupportsNECReadCDDA = mediaType.SupportsNECReadCDDA; + + if(mediaType.SupportsPioneerReadCDDASpecified) + SupportsPioneerReadCDDA = mediaType.SupportsPioneerReadCDDA; + + if(mediaType.SupportsPioneerReadCDDAMSFSpecified) + SupportsPioneerReadCDDAMSF = mediaType.SupportsPioneerReadCDDAMSF; + + if(mediaType.SupportsPlextorReadCDDASpecified) + SupportsPlextorReadCDDA = mediaType.SupportsPlextorReadCDDA; + + if(mediaType.SupportsPlextorReadRawDVDSpecified) + SupportsPlextorReadRawDVD = mediaType.SupportsPlextorReadRawDVD; + + if(mediaType.SupportsRead10Specified) + SupportsRead10 = mediaType.SupportsRead10; + + if(mediaType.SupportsRead12Specified) + SupportsRead12 = mediaType.SupportsRead12; + + if(mediaType.SupportsRead16Specified) + SupportsRead16 = mediaType.SupportsRead16; + + if(mediaType.SupportsReadSpecified) + { + if(ata) + SupportsReadSectors = mediaType.SupportsRead; + else + SupportsRead6 = mediaType.SupportsRead; + } + + if(mediaType.SupportsReadCapacity16Specified) + SupportsReadCapacity16 = mediaType.SupportsReadCapacity16; + + if(mediaType.SupportsReadCapacitySpecified) + SupportsReadCapacity = mediaType.SupportsReadCapacity; + + if(mediaType.SupportsReadCdSpecified) + SupportsReadCd = mediaType.SupportsReadCd; + + if(mediaType.SupportsReadCdMsfSpecified) + SupportsReadCdMsf = mediaType.SupportsReadCdMsf; + + if(mediaType.SupportsReadCdRawSpecified) + SupportsReadCdRaw = mediaType.SupportsReadCdRaw; + + if(mediaType.SupportsReadCdMsfRawSpecified) + SupportsReadCdMsfRaw = mediaType.SupportsReadCdMsfRaw; + + if(mediaType.SupportsReadLong16Specified) + SupportsReadLong16 = mediaType.SupportsReadLong16; + + if(mediaType.SupportsReadLongSpecified) + SupportsReadLong = mediaType.SupportsReadLong; + + if(mediaType.LBASectorsSpecified) + LBASectors = mediaType.LBASectors; + + if(mediaType.LBA48SectorsSpecified) + LBA48Sectors = mediaType.LBA48Sectors; + + if(mediaType.LogicalAlignmentSpecified) + LogicalAlignment = mediaType.LogicalAlignment; + + if(mediaType.NominalRotationRateSpecified) + NominalRotationRate = mediaType.NominalRotationRate; + + if(mediaType.PhysicalBlockSizeSpecified) + PhysicalBlockSize = mediaType.PhysicalBlockSize; + + if(mediaType.SolidStateDeviceSpecified) + SolidStateDevice = mediaType.SolidStateDevice; + + if(mediaType.UnformattedBPTSpecified) + UnformattedBPT = mediaType.UnformattedBPT; + + if(mediaType.UnformattedBPSSpecified) + UnformattedBPS = mediaType.UnformattedBPS; + + if(mediaType.SupportsReadDmaLbaSpecified) + SupportsReadDmaLba = mediaType.SupportsReadDmaLba; + + if(mediaType.SupportsReadDmaRetryLbaSpecified) + SupportsReadDmaRetryLba = mediaType.SupportsReadDmaRetryLba; + + if(mediaType.SupportsReadLbaSpecified) + SupportsReadLba = mediaType.SupportsReadLba; + + if(mediaType.SupportsReadRetryLbaSpecified) + SupportsReadRetryLba = mediaType.SupportsReadRetryLba; + + if(mediaType.SupportsReadLongLbaSpecified) + SupportsReadLongLba = mediaType.SupportsReadLongLba; + + if(mediaType.SupportsReadLongRetryLbaSpecified) + SupportsReadLongRetryLba = mediaType.SupportsReadLongRetryLba; + + if(mediaType.SupportsSeekLbaSpecified) + SupportsSeekLba = mediaType.SupportsSeekLba; + + if(mediaType.SupportsReadDmaLba48Specified) + SupportsReadDmaLba48 = mediaType.SupportsReadDmaLba48; + + if(mediaType.SupportsReadLba48Specified) + SupportsReadLba48 = mediaType.SupportsReadLba48; + + if(mediaType.SupportsReadDmaSpecified) + SupportsReadDma = mediaType.SupportsReadDma; + + if(mediaType.SupportsReadDmaRetrySpecified) + SupportsReadDmaRetry = mediaType.SupportsReadDmaRetry; + + if(mediaType.SupportsReadRetrySpecified) + SupportsReadRetry = mediaType.SupportsReadRetry; + + if(mediaType.SupportsReadLongRetrySpecified) + SupportsReadLongRetry = mediaType.SupportsReadLongRetry; + + if(mediaType.SupportsSeekSpecified) + SupportsSeek = mediaType.SupportsSeek; + + if(mediaType.CHS != null) + CHS = new Chs(mediaType.CHS); + + if(mediaType.CurrentCHS != null) + CurrentCHS = new Chs(mediaType.CurrentCHS); + + MediaIsRecognized = mediaType.MediaIsRecognized; + MediumTypeName = mediaType.MediumTypeName; + ModeSense6Data = mediaType.ModeSense6Data; + ModeSense10Data = mediaType.ModeSense10Data; + } + + [JsonIgnore] + public int Id { get; set; } + [DisplayName("IDENTIFY DEVICE data")] + public byte[] IdentifyData { get; set; } + [DisplayName("Blocks")] + public ulong? Blocks { get; set; } + [DisplayName("Bytes per block")] + public uint? BlockSize { get; set; } + [DisplayName("Can read AACS")] + public bool? CanReadAACS { get; set; } + [DisplayName("Can read ADIP")] + public bool? CanReadADIP { get; set; } + [DisplayName("Can read ATIP")] + public bool? CanReadATIP { get; set; } + [DisplayName("Can read BCA")] + public bool? CanReadBCA { get; set; } + [DisplayName("Can read C2 pointers")] + public bool? CanReadC2Pointers { get; set; } + [DisplayName("Can read Copyright Management Information")] + public bool? CanReadCMI { get; set; } + [DisplayName("Can read corrected subchannel")] + public bool? CanReadCorrectedSubchannel { get; set; } + [DisplayName("Can read corrected subchannel with C2 pointers")] + public bool? CanReadCorrectedSubchannelWithC2 { get; set; } + [DisplayName("Can read DCBs")] + public bool? CanReadDCB { get; set; } + [DisplayName("Can read DDS")] + public bool? CanReadDDS { get; set; } + [DisplayName("Can read DMI")] + public bool? CanReadDMI { get; set; } + [DisplayName("Can read disc information")] + public bool? CanReadDiscInformation { get; set; } + [DisplayName("Can read full TOC")] + public bool? CanReadFullTOC { get; set; } + [DisplayName("Can read HD-DVD Copyright Management Information")] + public bool? CanReadHDCMI { get; set; } + [DisplayName("Can read layer capacity")] + public bool? CanReadLayerCapacity { get; set; } + [DisplayName("Can read into first track pregap")] + public bool? CanReadFirstTrackPreGap { get; set; } + [DisplayName("Can read into Lead-In")] + public bool? CanReadLeadIn { get; set; } + [DisplayName("Can read into Lead-Out")] + public bool? CanReadLeadOut { get; set; } + [DisplayName("Can read media ID")] + public bool? CanReadMediaID { get; set; } + [DisplayName("Can read media serial number")] + public bool? CanReadMediaSerial { get; set; } + [DisplayName("Can read PAC")] + public bool? CanReadPAC { get; set; } + [DisplayName("Can read PFI")] + public bool? CanReadPFI { get; set; } + [DisplayName("Can read PMA")] + public bool? CanReadPMA { get; set; } + [DisplayName("Can read PQ subchannel")] + public bool? CanReadPQSubchannel { get; set; } + [DisplayName("Can read PQ subchannel with C2 pointers")] + public bool? CanReadPQSubchannelWithC2 { get; set; } + [DisplayName("Can read pre-recorded information")] + public bool? CanReadPRI { get; set; } + [DisplayName("Can read RW subchannel")] + public bool? CanReadRWSubchannel { get; set; } + [DisplayName("Can read RW subchannel with C2 pointers")] + public bool? CanReadRWSubchannelWithC2 { get; set; } + [DisplayName("Can read recordable PFI")] + public bool? CanReadRecordablePFI { get; set; } + [DisplayName("Can read spare area information")] + public bool? CanReadSpareAreaInformation { get; set; } + [DisplayName("Can read TOC")] + public bool? CanReadTOC { get; set; } + [DisplayName("Density code")] + public byte? Density { get; set; } + [DisplayName("Bytes per block in READ LONG commands")] + public uint? LongBlockSize { get; set; } + [DisplayName("Media manufacturer")] + public string Manufacturer { get; set; } + [DisplayName("Media recognized by drive?")] + public bool MediaIsRecognized { get; set; } + [DisplayName("Medium type code")] + public byte? MediumType { get; set; } + [DisplayName("Media type")] + public string MediumTypeName { get; set; } + [DisplayName("Media model")] + public string Model { get; set; } + [DisplayName("Can read scrambled DVD sectors using HL-DT-ST cache trick")] + public bool? SupportsHLDTSTReadRawDVD { get; set; } + [DisplayName("Supports NEC READ CD-DA command")] + public bool? SupportsNECReadCDDA { get; set; } + [DisplayName("Supports Pioneer READ CD-DA command")] + public bool? SupportsPioneerReadCDDA { get; set; } + [DisplayName("Supports Pioneer READ CD-DA MSF command")] + public bool? SupportsPioneerReadCDDAMSF { get; set; } + [DisplayName("Supports Plextor READ CD-DA command")] + public bool? SupportsPlextorReadCDDA { get; set; } + [DisplayName("Can read scrambled DVD sectors using Plextor vendor command")] + public bool? SupportsPlextorReadRawDVD { get; set; } + [DisplayName("Supports READ(10) command")] + public bool? SupportsRead10 { get; set; } + [DisplayName("Supports READ(12) command")] + public bool? SupportsRead12 { get; set; } + [DisplayName("Supports READ(16) command")] + public bool? SupportsRead16 { get; set; } + [DisplayName("Supports READ(6) command")] + public bool? SupportsRead6 { get; set; } + [DisplayName("Supports READ CAPACITY(16) command")] + public bool? SupportsReadCapacity16 { get; set; } + [DisplayName("Supports READ CAPACITY command")] + public bool? SupportsReadCapacity { get; set; } + [DisplayName("Supports READ CD command")] + public bool? SupportsReadCd { get; set; } + [DisplayName("Supports READ CD MSF command")] + public bool? SupportsReadCdMsf { get; set; } + [DisplayName("Supports full sector in READ CD command")] + public bool? SupportsReadCdRaw { get; set; } + [DisplayName("Supports full sector in READ CD MSF command")] + public bool? SupportsReadCdMsfRaw { get; set; } + [DisplayName("Supports READ LONG(16) command")] + public bool? SupportsReadLong16 { get; set; } + [DisplayName("Supports READ LONG command")] + public bool? SupportsReadLong { get; set; } + + [DisplayName("Data from MODE SENSE(6) command")] + public byte[] ModeSense6Data { get; set; } + [DisplayName("Data from MODE SENSE(10) command")] + public byte[] ModeSense10Data { get; set; } + + public virtual Chs CHS { get; set; } + public virtual Chs CurrentCHS { get; set; } + [DisplayName("Sectors in 28-bit LBA mode")] + public uint? LBASectors { get; set; } + [DisplayName("Sectors in 48-bit LBA mode")] + public ulong? LBA48Sectors { get; set; } + [DisplayName("Logical alignment")] + public ushort? LogicalAlignment { get; set; } + [DisplayName("Nominal rotation rate")] + public ushort? NominalRotationRate { get; set; } + [DisplayName("Bytes per block, physical")] + public uint? PhysicalBlockSize { get; set; } + [DisplayName("Is it a SSD?")] + public bool? SolidStateDevice { get; set; } + [DisplayName("Bytes per unformatted track")] + public ushort? UnformattedBPT { get; set; } + [DisplayName("Bytes per unformatted sector")] + public ushort? UnformattedBPS { get; set; } + + [DisplayName("Supports READ DMA (LBA) command")] + public bool? SupportsReadDmaLba { get; set; } + [DisplayName("Supports READ DMA RETRY (LBA) command")] + public bool? SupportsReadDmaRetryLba { get; set; } + [DisplayName("Supports READ SECTORS (LBA) command")] + public bool? SupportsReadLba { get; set; } + [DisplayName("Supports READ SECTORS RETRY (LBA) command")] + public bool? SupportsReadRetryLba { get; set; } + [DisplayName("Supports READ SECTORS LONG (LBA) command")] + public bool? SupportsReadLongLba { get; set; } + [DisplayName("Supports READ SECTORS LONG RETRY (LBA) command")] + public bool? SupportsReadLongRetryLba { get; set; } + [DisplayName("Supports SEEK (LBA) command")] + public bool? SupportsSeekLba { get; set; } + + [DisplayName("Supports READ DMA EXT command")] + public bool? SupportsReadDmaLba48 { get; set; } + [DisplayName("Supports READ SECTORS EXT command")] + public bool? SupportsReadLba48 { get; set; } + + [DisplayName("Supports READ DMA command")] + public bool? SupportsReadDma { get; set; } + [DisplayName("Supports READ DMA RETRY command")] + public bool? SupportsReadDmaRetry { get; set; } + [DisplayName("Supports READ SECTORS RETRY command")] + public bool? SupportsReadRetry { get; set; } + [DisplayName("Supports READ SECTORS command")] + public bool? SupportsReadSectors { get; set; } + [DisplayName("Supports READ SECTORS LONG RETRY command")] + public bool? SupportsReadLongRetry { get; set; } + [DisplayName("Supports SEEK command")] + public bool? SupportsSeek { get; set; } + + [DisplayName("Can read into inter-session Lead-In")] + public bool? CanReadingIntersessionLeadIn { get; set; } + [DisplayName("Can read into inter-session Lead-Out")] + public bool? CanReadingIntersessionLeadOut { get; set; } + [DisplayName("Data from inter-session Lead-In")] + public byte[] IntersessionLeadInData { get; set; } + [DisplayName("Data from inter-session Lead-Out")] + public byte[] IntersessionLeadOutData { get; set; } + + [DisplayName("Can read scrambled data using READ CD command")] + public bool? CanReadCdScrambled { get; set; } + [DisplayName("Data from scrambled READ CD command")] + public byte[] ReadCdScrambledData { get; set; } + + [DisplayName("Can read from cache using F1h command subcommand 06h")] + public bool? CanReadF1_06 { get; set; } + [DisplayName("Can read from cache using F1h command subcommand 06h")] + public byte[] ReadF1_06Data { get; set; } + [DisplayName("Can read from cache using F1h command subcommand 06h targeting Lead-Out")] + public bool? CanReadF1_06LeadOut { get; set; } + [DisplayName("Can read from cache using F1h command subcommand 06h targeting Lead-Out")] + public byte[] ReadF1_06LeadOutData { get; set; } + + [JsonIgnore] + public int? AtaId { get; set; } + [JsonIgnore] + public int? ScsiId { get; set; } + [JsonIgnore] + public int? MmcId { get; set; } + + #region SCSI data + [DisplayName("Data from READ(6) command")] + public byte[] Read6Data { get; set; } + [DisplayName("Data from READ(10) command")] + public byte[] Read10Data { get; set; } + [DisplayName("Data from READ(12) command")] + public byte[] Read12Data { get; set; } + [DisplayName("Data from READ(16) command")] + public byte[] Read16Data { get; set; } + [DisplayName("Data from READ LONG(10) command")] + public byte[] ReadLong10Data { get; set; } + [DisplayName("Data from READ LONG(16) command")] + public byte[] ReadLong16Data { get; set; } + #endregion + + #region ATA data + [DisplayName("Data from READ SECTORS command")] + public byte[] ReadSectorsData { get; set; } + [DisplayName("Data from READ SECTORS RETRY command")] + public byte[] ReadSectorsRetryData { get; set; } + [DisplayName("Data from READ DMA command")] + public byte[] ReadDmaData { get; set; } + [DisplayName("Data from READ DMA RETRY command")] + public byte[] ReadDmaRetryData { get; set; } + [DisplayName("Data from READ SECTORS (LBA) command")] + public byte[] ReadLbaData { get; set; } + [DisplayName("Data from READ SECTORS RETRY (LBA) command")] + public byte[] ReadRetryLbaData { get; set; } + [DisplayName("Data from READ DMA (LBA) command")] + public byte[] ReadDmaLbaData { get; set; } + [DisplayName("Data from READ DMA RETRY (LBA) command")] + public byte[] ReadDmaRetryLbaData { get; set; } + [DisplayName("Data from READ SECTORS EXT command")] + public byte[] ReadLba48Data { get; set; } + [DisplayName("Data from READ DMA EXT command")] + public byte[] ReadDmaLba48Data { get; set; } + [DisplayName("Data from READ SECTORS LONG command")] + public byte[] ReadLongData { get; set; } + [DisplayName("Data from READ SECTORS LONG RETRY command")] + public byte[] ReadLongRetryData { get; set; } + [DisplayName("Data from READ SECTORS LONG (LBA) command")] + public byte[] ReadLongLbaData { get; set; } + [DisplayName("Data from READ SECTORS LONG RETRY (LBA) command")] + public byte[] ReadLongRetryLbaData { get; set; } + #endregion + + #region CompactDisc data + [DisplayName("Data from READ TOC command")] + public byte[] TocData { get; set; } + [DisplayName("Data from READ FULL TOC command")] + public byte[] FullTocData { get; set; } + [DisplayName("Data from READ ATIP command")] + public byte[] AtipData { get; set; } + [DisplayName("Data from READ PMA command")] + public byte[] PmaData { get; set; } + [DisplayName("Data from READ CD command")] + public byte[] ReadCdData { get; set; } + [DisplayName("Data from READ CD MSF command")] + public byte[] ReadCdMsfData { get; set; } + [DisplayName("Data from READ CD (full sector) command")] + public byte[] ReadCdFullData { get; set; } + [DisplayName("Data from READ CD MSF (full sector) command")] + public byte[] ReadCdMsfFullData { get; set; } + [DisplayName("Data from track 1 pregap")] + public byte[] Track1PregapData { get; set; } + [DisplayName("Data from Lead-In")] + public byte[] LeadInData { get; set; } + [DisplayName("Data from Lead-Out")] + public byte[] LeadOutData { get; set; } + [DisplayName("Data from reading C2 pointers")] + public byte[] C2PointersData { get; set; } + [DisplayName("Data from reading with PQ subchannels")] + public byte[] PQSubchannelData { get; set; } + [DisplayName("Data from reading with RW subchannels")] + public byte[] RWSubchannelData { get; set; } + [DisplayName("Data from reading with corrected subchannels")] + public byte[] CorrectedSubchannelData { get; set; } + [DisplayName("Data from reading with PQ subchannels and C2 pointers")] + public byte[] PQSubchannelWithC2Data { get; set; } + [DisplayName("Data from reading with RW subchannels and C2 pointers")] + public byte[] RWSubchannelWithC2Data { get; set; } + [DisplayName("Data from reading with corrected subchannels and C2 pointers")] + public byte[] CorrectedSubchannelWithC2Data { get; set; } + #endregion + + #region DVD data + [DisplayName("Data from PFI")] + public byte[] PfiData { get; set; } + [DisplayName("Data from DMI")] + public byte[] DmiData { get; set; } + [DisplayName("Data from DVD's Copyright Management Information")] + public byte[] CmiData { get; set; } + [DisplayName("Data from DVD's BCA")] + public byte[] DvdBcaData { get; set; } + [DisplayName("Data from DVD's AACS")] + public byte[] DvdAacsData { get; set; } + [DisplayName("Data from DVD's DDS")] + public byte[] DvdDdsData { get; set; } + [DisplayName("Data from DVD's Spare Area Information")] + public byte[] DvdSaiData { get; set; } + [DisplayName("Data from DVD's pre-recorded information")] + public byte[] PriData { get; set; } + [DisplayName("Data from embossed PFI")] + public byte[] EmbossedPfiData { get; set; } + [DisplayName("Data from ADIP")] + public byte[] AdipData { get; set; } + [DisplayName("Data from DCBs")] + public byte[] DcbData { get; set; } + [DisplayName("Data from HD-DVD's Copyright Management Information")] + public byte[] HdCmiData { get; set; } + [DisplayName("Data from DVD's layer information")] + public byte[] DvdLayerData { get; set; } + #endregion + + #region Blu-ray data + [DisplayName("Data from Blu-ray's BCA")] + public byte[] BluBcaData { get; set; } + [DisplayName("Data from Blu-ray's DDS")] + public byte[] BluDdsData { get; set; } + [DisplayName("Data from Blu-ray's Spare Area Information")] + public byte[] BluSaiData { get; set; } + [DisplayName("Data from Blu-ray's Disc Information")] + public byte[] BluDiData { get; set; } + [DisplayName("Data from Blu-ray's PAC")] + public byte[] BluPacData { get; set; } + #endregion + + #region Vendor data + [DisplayName("Data from Plextor's READ CD-DA command")] + public byte[] PlextorReadCddaData { get; set; } + [DisplayName("Data from Pioneer's READ CD-DA command")] + public byte[] PioneerReadCddaData { get; set; } + [DisplayName("Data from Pioneer's READ CD-DA MSF command")] + public byte[] PioneerReadCddaMsfData { get; set; } + [DisplayName("Data from NEC's READ CD-DA command")] + public byte[] NecReadCddaData { get; set; } + [DisplayName("Data from Plextor's scrambled DVD reading command")] + public byte[] PlextorReadRawDVDData { get; set; } + [DisplayName("Data from HL-DT-ST's scrambled DVD reading trick")] + public byte[] HLDTSTReadRawDVDData { get; set; } + #endregion +} + +public class Ssc +{ + public Ssc() {} + + public Ssc(sscType ssc) + { + if(ssc.BlockSizeGranularitySpecified) + BlockSizeGranularity = ssc.BlockSizeGranularity; + + if(ssc.MaxBlockLengthSpecified) + MaxBlockLength = ssc.MaxBlockLength; + + if(ssc.MinBlockLengthSpecified) + MinBlockLength = ssc.MinBlockLength; + + if(ssc.SupportedDensities != null) + SupportedDensities = new List(ssc.SupportedDensities); + + if(ssc.SupportedMediaTypes != null) + { + SupportedMediaTypes = new List(); + + foreach(SupportedMedia mediaType in ssc.SupportedMediaTypes) + SupportedMediaTypes.Add(new SscSupportedMedia(mediaType)); + } + + if(ssc.TestedMedia == null) + return; + + TestedMedia = new List(); + + foreach(SequentialMedia testedMedia in ssc.TestedMedia) + TestedMedia.Add(new TestedSequentialMedia(testedMedia)); + } + + [JsonIgnore] + public int Id { get; set; } + [DisplayName("Block size granularity")] + public byte? BlockSizeGranularity { get; set; } + [DisplayName("Maximum block length")] + public uint? MaxBlockLength { get; set; } + [DisplayName("Minimum block length")] + public uint? MinBlockLength { get; set; } + + public virtual List SupportedDensities { get; set; } + public virtual List SupportedMediaTypes { get; set; } + public virtual List TestedMedia { get; set; } +} + +public class TestedSequentialMedia +{ + public TestedSequentialMedia() {} + + public TestedSequentialMedia(SequentialMedia media) + { + if(media.CanReadMediaSerialSpecified) + CanReadMediaSerial = media.CanReadMediaSerial; + + if(media.DensitySpecified) + Density = media.Density; + + Manufacturer = media.Manufacturer; + MediaIsRecognized = media.MediaIsRecognized; + + if(media.MediumTypeSpecified) + MediumType = media.MediumType; + + MediumTypeName = media.MediumTypeName; + Model = media.Model; + + if(media.SupportedDensities != null) + SupportedDensities = new List(media.SupportedDensities); + + if(media.SupportedMediaTypes != null) + { + SupportedMediaTypes = new List(); + + foreach(SupportedMedia supportedMedia in media.SupportedMediaTypes) + SupportedMediaTypes.Add(new SscSupportedMedia(supportedMedia)); + } + + ModeSense6Data = media.ModeSense6Data; + ModeSense10Data = media.ModeSense10Data; + } + + [JsonIgnore] + public int Id { get; set; } + [DisplayName("Can read media serial?")] + public bool? CanReadMediaSerial { get; set; } + [DisplayName("Density code")] + public byte? Density { get; set; } + public string Manufacturer { get; set; } + [DisplayName("Media recognized by drive?")] + public bool MediaIsRecognized { get; set; } + [DisplayName("Medium type code")] + public byte? MediumType { get; set; } + [DisplayName("Medium type")] + public string MediumTypeName { get; set; } + public string Model { get; set; } + public virtual List SupportedDensities { get; set; } + public virtual List SupportedMediaTypes { get; set; } + + public byte[] ModeSense6Data { get; set; } + public byte[] ModeSense10Data { get; set; } + + [JsonIgnore] + public int? SscId { get; set; } +} + +public class Pcmcia +{ + public string[] AdditionalInformation; + + public Pcmcia() {} + + public Pcmcia(pcmciaType pcmcia) + { + AdditionalInformation = pcmcia.AdditionalInformation; + CIS = pcmcia.CIS; + Compliance = pcmcia.Compliance; + + if(pcmcia.ManufacturerCodeSpecified) + ManufacturerCode = pcmcia.ManufacturerCode; + + if(pcmcia.CardCodeSpecified) + CardCode = pcmcia.CardCode; + + Manufacturer = pcmcia.Manufacturer; + ProductName = pcmcia.ProductName; + } + + [JsonIgnore] + public int Id { get; set; } + public byte[] CIS { get; set; } + public string Compliance { get; set; } + [DisplayName("Manufacturer code")] + public ushort? ManufacturerCode { get; set; } + [DisplayName("Card code")] + public ushort? CardCode { get; set; } + public string Manufacturer { get; set; } + [DisplayName("Product name")] + public string ProductName { get; set; } +} + +public class MmcSd +{ + public MmcSd() {} + + public MmcSd(mmcsdType mmcSd) + { + CID = mmcSd.CID; + CSD = mmcSd.CSD; + OCR = mmcSd.OCR; + SCR = mmcSd.SCR; + ExtendedCSD = mmcSd.ExtendedCSD; + } + + [JsonIgnore] + public int Id { get; set; } + public byte[] CID { get; set; } + public byte[] CSD { get; set; } + public byte[] OCR { get; set; } + public byte[] SCR { get; set; } + public byte[] ExtendedCSD { get; set; } +} + +public class SscSupportedMedia +{ + public SscSupportedMedia() {} + + public SscSupportedMedia(SupportedMedia media) + { + MediumType = media.MediumType; + Width = media.Width; + Length = media.Length; + Organization = media.Organization; + Name = media.Name; + Description = media.Description; + + if(media.DensityCodes == null) + return; + + DensityCodes = new List(); + + foreach(int densityCode in media.DensityCodes) + DensityCodes.Add(new DensityCode { - EVPDPages = new List(); - - foreach(pageType evpdPage in scsi.EVPDPages) - EVPDPages.Add(new ScsiPage(evpdPage)); - } - - if(scsi.ModeSense != null) - ModeSense = new ScsiMode(scsi.ModeSense); - - if(scsi.MultiMediaDevice != null) - MultiMediaDevice = new Mmc(scsi.MultiMediaDevice); - - if(scsi.SequentialDevice != null) - SequentialDevice = new Ssc(scsi.SequentialDevice); - - if(InquiryData != null) - return; - - var inq = new Inquiry(); - - if(scsi.Inquiry.ANSIVersionSpecified) - inq.ANSIVersion = scsi.Inquiry.ANSIVersion; - - if(scsi.Inquiry.ECMAVersionSpecified) - inq.ECMAVersion = scsi.Inquiry.ECMAVersion; - - if(scsi.Inquiry.DeviceTypeModifierSpecified) - inq.DeviceTypeModifier = scsi.Inquiry.DeviceTypeModifier; - - if(scsi.Inquiry.ISOVersionSpecified) - inq.ISOVersion = scsi.Inquiry.ISOVersion; - - if(scsi.Inquiry.ProductIdentificationSpecified) - { - byte[] tmp = Encoding.ASCII.GetBytes(scsi.Inquiry.ProductIdentification); - inq.ProductIdentification = new byte[tmp.Length + 1]; - Array.Copy(tmp, 0, inq.ProductIdentification, 0, tmp.Length); - } - - if(scsi.Inquiry.ProductRevisionLevelSpecified) - { - byte[] tmp = Encoding.ASCII.GetBytes(scsi.Inquiry.ProductRevisionLevel); - inq.ProductRevisionLevel = new byte[tmp.Length + 1]; - Array.Copy(tmp, 0, inq.ProductRevisionLevel, 0, tmp.Length); - } - - if(scsi.Inquiry.ResponseDataFormatSpecified) - inq.ResponseDataFormat = scsi.Inquiry.ResponseDataFormat; - - if(scsi.Inquiry.VendorIdentificationSpecified) - { - byte[] tmp = Encoding.ASCII.GetBytes(scsi.Inquiry.VendorIdentification); - inq.VendorIdentification = new byte[tmp.Length + 1]; - Array.Copy(tmp, 0, inq.VendorIdentification, 0, tmp.Length); - } - - inq.ACC = scsi.Inquiry.AccessControlCoordinator; - inq.ACKREQQ = scsi.Inquiry.ACKRequests; - inq.AERC = scsi.Inquiry.AERCSupported; - inq.Addr16 = scsi.Inquiry.Address16; - inq.Addr32 = scsi.Inquiry.Address32; - inq.TPGS = (byte)scsi.Inquiry.AsymmetricalLUNAccess; - inq.BQue = scsi.Inquiry.BasicQueueing; - inq.EncServ = scsi.Inquiry.EnclosureServices; - inq.HiSup = scsi.Inquiry.HierarchicalLUN; - inq.IUS = scsi.Inquiry.IUS; - inq.Linked = scsi.Inquiry.LinkedCommands; - inq.MChngr = scsi.Inquiry.MediumChanger; - inq.MultiP = scsi.Inquiry.MultiPortDevice; - inq.NormACA = scsi.Inquiry.NormalACA; - inq.PeripheralDeviceType = (byte)scsi.Inquiry.PeripheralDeviceType; - inq.PeripheralQualifier = (byte)scsi.Inquiry.PeripheralQualifier; - inq.Protect = scsi.Inquiry.Protection; - inq.QAS = scsi.Inquiry.QAS; - inq.RelAddr = scsi.Inquiry.RelativeAddressing; - inq.RMB = scsi.Inquiry.Removable; - inq.CmdQue = scsi.Inquiry.TaggedCommandQueue; - inq.TrmTsk = scsi.Inquiry.TerminateTaskSupported; - inq.ThreePC = scsi.Inquiry.ThirdPartyCopy; - inq.TranDis = scsi.Inquiry.TranferDisable; - inq.SftRe = scsi.Inquiry.SoftReset; - inq.Clocking = (byte)scsi.Inquiry.SPIClocking; - inq.SCCS = scsi.Inquiry.StorageArrayController; - inq.Sync = scsi.Inquiry.SyncTransfer; - inq.VersionDescriptors = scsi.Inquiry.VersionDescriptors; - inq.WBus16 = scsi.Inquiry.WideBus16; - inq.WBus32 = scsi.Inquiry.WideBus32; - - InquiryData = Structs.Devices.SCSI.Inquiry.Encode(inq); - } - - public Inquiry? Inquiry => Structs.Devices.SCSI.Inquiry.Decode(InquiryData); - - [JsonIgnore] - public int Id { get; set; } - [DisplayName("Data from INQUIRY command")] - public byte[] InquiryData { get; set; } - public virtual List EVPDPages { get; set; } - [DisplayName("Supports MODE SENSE(6)")] - public bool SupportsModeSense6 { get; set; } - [DisplayName("Supports MODE SENSE(10)")] - public bool SupportsModeSense10 { get; set; } - [DisplayName("Supports MODE SENSE with subpages")] - public bool SupportsModeSubpages { get; set; } - public virtual ScsiMode ModeSense { get; set; } - public virtual Mmc MultiMediaDevice { get; set; } - public virtual TestedMedia ReadCapabilities { get; set; } - public virtual List RemovableMedias { get; set; } - public virtual Ssc SequentialDevice { get; set; } - [DisplayName("Data from MODE SENSE(6) command")] - public byte[] ModeSense6Data { get; set; } - [DisplayName("Data from MODE SENSE(10) command")] - public byte[] ModeSense10Data { get; set; } - [DisplayName("Data from MODE SENSE(6) command (current)")] - public byte[] ModeSense6CurrentData { get; set; } - [DisplayName("Data from MODE SENSE(10) command (current)")] - public byte[] ModeSense10CurrentData { get; set; } - [DisplayName("Data from MODE SENSE(6) command (changeable)")] - public byte[] ModeSense6ChangeableData { get; set; } - [DisplayName("Data from MODE SENSE(10) command (changeable)")] - public byte[] ModeSense10ChangeableData { get; set; } - - [JsonIgnore] - public int? SequentialDeviceId { get; set; } + Code = densityCode + }); } - public class ScsiMode + [JsonIgnore] + public int Id { get; set; } + public byte MediumType { get; set; } + public virtual List DensityCodes { get; set; } + public ushort Width { get; set; } + public ushort Length { get; set; } + public string Organization { get; set; } + public string Name { get; set; } + public string Description { get; set; } +} + +public class DensityCode : IEquatable +{ + [JsonIgnore, Key] + public int Id { get; set; } + + public int Code { get; set; } + + public bool Equals(DensityCode other) { - public ScsiMode() {} + if(ReferenceEquals(null, other)) + return false; - public ScsiMode(modeType mode) - { - if(mode.MediumTypeSpecified) - MediumType = mode.MediumType; + if(ReferenceEquals(this, other)) + return true; - WriteProtected = mode.WriteProtected; - - if(mode.SpeedSpecified) - Speed = mode.Speed; - - if(mode.BufferedModeSpecified) - BufferedMode = mode.BufferedMode; - - BlankCheckEnabled = mode.BlankCheckEnabled; - DPOandFUA = mode.DPOandFUA; - - if(mode.ModePages != null) - { - ModePages = new List(); - - foreach(modePageType modePage in mode.ModePages) - ModePages.Add(new ScsiPage(modePage)); - } - - if(mode.BlockDescriptors == null) - return; - - BlockDescriptors = new List(); - - foreach(blockDescriptorType blockDescriptor in mode.BlockDescriptors) - BlockDescriptors.Add(new BlockDescriptor(blockDescriptor)); - } - - [JsonIgnore] - public int Id { get; set; } - [DisplayName("Medium type code")] - public byte? MediumType { get; set; } - [DisplayName("Write protected")] - public bool WriteProtected { get; set; } - public virtual List BlockDescriptors { get; set; } - public byte? Speed { get; set; } - [DisplayName("Buffered mode")] - public byte? BufferedMode { get; set; } - [DisplayName("Blank check enabled")] - public bool BlankCheckEnabled { get; set; } - [DisplayName("DPO and FUA")] - public bool DPOandFUA { get; set; } - public virtual List ModePages { get; set; } + return Code == other.Code; } - public class BlockDescriptor + public override bool Equals(object obj) { - public BlockDescriptor() {} + if(ReferenceEquals(null, obj)) + return false; - public BlockDescriptor(blockDescriptorType descriptor) - { - Density = descriptor.Density; + if(ReferenceEquals(this, obj)) + return true; - if(descriptor.BlocksSpecified) - Blocks = descriptor.Blocks; - - if(descriptor.BlockLengthSpecified) - BlockLength = descriptor.BlockLength; - } - - [JsonIgnore] - public int Id { get; set; } - public byte Density { get; set; } - public ulong? Blocks { get; set; } - [DisplayName("Block length (bytes)")] - public uint? BlockLength { get; set; } + return obj.GetType() == GetType() && Equals((DensityCode)obj); } - public class ScsiPage - { - public ScsiPage() {} - - public ScsiPage(pageType evpdPage) - { - page = evpdPage.page; - value = evpdPage.value; - } - - public ScsiPage(modePageType modePage) - { - page = modePage.page; - subpage = modePage.subpage; - value = modePage.value; - } - - [JsonIgnore] - public int Id { get; set; } - public byte page { get; set; } - public byte? subpage { get; set; } - public byte[] value { get; set; } - } - - public class Mmc - { - public Mmc() {} - - public Mmc(mmcType mmc) - { - if(mmc.ModeSense2A != null) - ModeSense2AData = ModePage_2A.Encode(new ModePage_2A - { - AccurateCDDA = mmc.ModeSense2A.AccurateCDDA, - BCK = mmc.ModeSense2A.BCK, - BufferSize = mmc.ModeSense2A.BufferSize, - BUF = mmc.ModeSense2A.BufferUnderRunProtection, - Eject = mmc.ModeSense2A.CanEject, - Lock = mmc.ModeSense2A.CanLockMedia, - CDDACommand = mmc.ModeSense2A.CDDACommand, - Composite = mmc.ModeSense2A.CompositeAudioVideo, - CMRSupported = (ushort)(mmc.ModeSense2A.CSSandCPPMSupported ? 1 : 0), - CurrentSpeed = mmc.ModeSense2A.CurrentSpeed, - CurrentWriteSpeed = mmc.ModeSense2A.CurrentWriteSpeed, - CurrentWriteSpeedSelected = mmc.ModeSense2A.CurrentWriteSpeedSelected, - SDP = mmc.ModeSense2A.DeterministicSlotChanger, - DigitalPort1 = mmc.ModeSense2A.DigitalPort1, - DigitalPort2 = mmc.ModeSense2A.DigitalPort2, - LeadInPW = mmc.ModeSense2A.LeadInPW, - LoadingMechanism = mmc.ModeSense2A.LoadingMechanismType, - LockState = mmc.ModeSense2A.LockStatus, - LSBF = mmc.ModeSense2A.LSBF, - MaximumSpeed = mmc.ModeSense2A.MaximumSpeed, - MaxWriteSpeed = mmc.ModeSense2A.MaximumWriteSpeed, - AudioPlay = mmc.ModeSense2A.PlaysAudio, - PreventJumper = mmc.ModeSense2A.PreventJumperStatus, - RCK = mmc.ModeSense2A.RCK, - ReadBarcode = mmc.ModeSense2A.ReadsBarcode, - SCC = mmc.ModeSense2A.ReadsBothSides, - ReadCDR = mmc.ModeSense2A.ReadsCDR, - ReadCDRW = mmc.ModeSense2A.ReadsCDRW, - DeinterlaveSubchannel = mmc.ModeSense2A.ReadsDeinterlavedSubchannel, - ReadDVDR = mmc.ModeSense2A.ReadsDVDR, - ReadDVDRAM = mmc.ModeSense2A.ReadsDVDRAM, - ReadDVDROM = mmc.ModeSense2A.ReadsDVDROM, - ISRC = mmc.ModeSense2A.ReadsISRC, - Mode2Form2 = mmc.ModeSense2A.ReadsMode2Form2, - Mode2Form1 = mmc.ModeSense2A.ReadsMode2Form1, - Method2 = mmc.ModeSense2A.ReadsPacketCDR, - Subchannel = mmc.ModeSense2A.ReadsSubchannel, - UPC = mmc.ModeSense2A.ReadsUPC, - C2Pointer = mmc.ModeSense2A.ReturnsC2Pointers, - RotationControlSelected = mmc.ModeSense2A.RotationControlSelected, - SeparateChannelMute = mmc.ModeSense2A.SeparateChannelMute, - SeparateChannelVolume = mmc.ModeSense2A.SeparateChannelVolume, - SSS = mmc.ModeSense2A.SSS, - MultiSession = mmc.ModeSense2A.SupportsMultiSession, - SupportedVolumeLevels = mmc.ModeSense2A.SupportedVolumeLevels, - TestWrite = mmc.ModeSense2A.TestWrite, - WriteCDR = mmc.ModeSense2A.WritesCDR, - WriteCDRW = mmc.ModeSense2A.WritesCDRW, - WriteDVDR = mmc.ModeSense2A.WritesDVDR, - WriteDVDRAM = mmc.ModeSense2A.WritesDVDRAM, - WriteSpeedPerformanceDescriptors = mmc.ModeSense2A.WriteSpeedPerformanceDescriptors - }); - - if(mmc.Features != null) - Features = new MmcFeatures(mmc.Features); - - if(mmc.TestedMedia == null) - return; - - TestedMedia = new List(); - - foreach(testedMediaType mediaType in mmc.TestedMedia) - TestedMedia.Add(new TestedMedia(mediaType, false)); - } - - [JsonIgnore] - public int Id { get; set; } - public virtual ModePage_2A ModeSense2A => ModePage_2A.Decode(ModeSense2AData); - public virtual MmcFeatures Features { get; set; } - public virtual List TestedMedia { get; set; } - public byte[] ModeSense2AData { get; set; } - [JsonIgnore] - public int? FeaturesId { get; set; } - } - - public class MmcFeatures - { - public MmcFeatures() {} - - public MmcFeatures(mmcFeaturesType features) - { - if(features.PhysicalInterfaceStandardSpecified && - !features.PhysicalInterfaceStandardNumberSpecified) - PhysicalInterfaceStandardNumber = (uint?)features.PhysicalInterfaceStandard; - - if(features.PhysicalInterfaceStandardNumberSpecified) - PhysicalInterfaceStandardNumber = features.PhysicalInterfaceStandardNumber; - - if(features.AACSVersionSpecified) - AACSVersion = features.AACSVersion; - - if(features.AGIDsSpecified) - AGIDs = features.AGIDs; - - if(features.BindingNonceBlocksSpecified) - BindingNonceBlocks = features.BindingNonceBlocks; - - if(features.CPRMVersionSpecified) - CPRMVersion = features.CPRMVersion; - - if(features.CSSVersionSpecified) - CSSVersion = features.CSSVersion; - - if(features.LoadingMechanismTypeSpecified) - LoadingMechanismType = features.LoadingMechanismType; - - if(features.LogicalBlockSizeSpecified) - LogicalBlockSize = features.LogicalBlockSize; - - if(features.BlocksPerReadableUnitSpecified) - BlocksPerReadableUnit = features.BlocksPerReadableUnit; - - if(features.FirmwareDateSpecified) - FirmwareDate = features.FirmwareDate; - - if(features.VolumeLevelsSpecified) - VolumeLevels = features.VolumeLevels; - - BufferUnderrunFreeInDVD = features.BufferUnderrunFreeInDVD; - BufferUnderrunFreeInSAO = features.BufferUnderrunFreeInSAO; - BufferUnderrunFreeInTAO = features.BufferUnderrunFreeInTAO; - CanAudioScan = features.CanAudioScan; - CanEject = features.CanEject; - CanEraseSector = features.CanEraseSector; - CanExpandBDRESpareArea = features.CanExpandBDRESpareArea; - CanFormat = features.CanFormat; - CanFormatBDREWithoutSpare = features.CanFormatBDREWithoutSpare; - CanFormatCert = features.CanFormatCert; - CanFormatFRF = features.CanFormatFRF; - CanFormatQCert = features.CanFormatQCert; - CanFormatRRM = features.CanFormatRRM; - CanGenerateBindingNonce = features.CanGenerateBindingNonce; - CanLoad = features.CanLoad; - CanMuteSeparateChannels = features.CanMuteSeparateChannels; - CanOverwriteSAOTrack = features.CanOverwriteSAOTrack; - CanOverwriteTAOTrack = features.CanOverwriteTAOTrack; - CanPlayCDAudio = features.CanPlayCDAudio; - CanPseudoOverwriteBDR = features.CanPseudoOverwriteBDR; - CanReadAllDualR = features.CanReadAllDualR; - CanReadAllDualRW = features.CanReadAllDualRW; - CanReadBD = features.CanReadBD; - CanReadBDR = features.CanReadBDR; - CanReadBDRE1 = features.CanReadBDRE1; - CanReadBDRE2 = features.CanReadBDRE2; - CanReadBDROM = features.CanReadBDROM; - CanReadBluBCA = features.CanReadBluBCA; - CanReadCD = features.CanReadCD; - CanReadCDMRW = features.CanReadCDMRW; - CanReadCPRM_MKB = features.CanReadCPRM_MKB; - CanReadDDCD = features.CanReadDDCD; - CanReadDVD = features.CanReadDVD; - CanReadDVDPlusMRW = features.CanReadDVDPlusMRW; - CanReadDVDPlusR = features.CanReadDVDPlusR; - CanReadDVDPlusRDL = features.CanReadDVDPlusRDL; - CanReadDVDPlusRW = features.CanReadDVDPlusRW; - CanReadDVDPlusRWDL = features.CanReadDVDPlusRWDL; - CanReadDriveAACSCertificate = features.CanReadDriveAACSCertificate; - CanReadHDDVD = features.CanReadHDDVD; - CanReadHDDVDR = features.CanReadHDDVDR; - CanReadHDDVDRAM = features.CanReadHDDVDRAM; - CanReadLeadInCDText = features.CanReadLeadInCDText; - CanReadOldBDR = features.CanReadOldBDR; - CanReadOldBDRE = features.CanReadOldBDRE; - CanReadOldBDROM = features.CanReadOldBDROM; - CanReadSpareAreaInformation = features.CanReadSpareAreaInformation; - CanReportDriveSerial = features.CanReportDriveSerial; - CanReportMediaSerial = features.CanReportMediaSerial; - CanTestWriteDDCDR = features.CanTestWriteDDCDR; - CanTestWriteDVD = features.CanTestWriteDVD; - CanTestWriteInSAO = features.CanTestWriteInSAO; - CanTestWriteInTAO = features.CanTestWriteInTAO; - CanUpgradeFirmware = features.CanUpgradeFirmware; - CanWriteBD = features.CanWriteBD; - CanWriteBDR = features.CanWriteBDR; - CanWriteBDRE1 = features.CanWriteBDRE1; - CanWriteBDRE2 = features.CanWriteBDRE2; - CanWriteBusEncryptedBlocks = features.CanWriteBusEncryptedBlocks; - CanWriteCDMRW = features.CanWriteCDMRW; - CanWriteCDRW = features.CanWriteCDRW; - CanWriteCDRWCAV = features.CanWriteCDRWCAV; - CanWriteCDSAO = features.CanWriteCDSAO; - CanWriteCDTAO = features.CanWriteCDTAO; - CanWriteCSSManagedDVD = features.CanWriteCSSManagedDVD; - CanWriteDDCDR = features.CanWriteDDCDR; - CanWriteDDCDRW = features.CanWriteDDCDRW; - CanWriteDVDPlusMRW = features.CanWriteDVDPlusMRW; - CanWriteDVDPlusR = features.CanWriteDVDPlusR; - CanWriteDVDPlusRDL = features.CanWriteDVDPlusRDL; - CanWriteDVDPlusRW = features.CanWriteDVDPlusRW; - CanWriteDVDPlusRWDL = features.CanWriteDVDPlusRWDL; - CanWriteDVDR = features.CanWriteDVDR; - CanWriteDVDRDL = features.CanWriteDVDRDL; - CanWriteDVDRW = features.CanWriteDVDRW; - CanWriteHDDVDR = features.CanWriteHDDVDR; - CanWriteHDDVDRAM = features.CanWriteHDDVDRAM; - CanWriteOldBDR = features.CanWriteOldBDR; - CanWriteOldBDRE = features.CanWriteOldBDRE; - CanWritePackedSubchannelInTAO = features.CanWritePackedSubchannelInTAO; - CanWriteRWSubchannelInSAO = features.CanWriteRWSubchannelInSAO; - CanWriteRWSubchannelInTAO = features.CanWriteRWSubchannelInTAO; - CanWriteRaw = features.CanWriteRaw; - CanWriteRawMultiSession = features.CanWriteRawMultiSession; - CanWriteRawSubchannelInTAO = features.CanWriteRawSubchannelInTAO; - ChangerIsSideChangeCapable = features.ChangerIsSideChangeCapable; - ChangerSlots = features.ChangerSlots; - ChangerSupportsDiscPresent = features.ChangerSupportsDiscPresent; - DBML = features.DBML; - DVDMultiRead = features.DVDMultiRead; - EmbeddedChanger = features.EmbeddedChanger; - ErrorRecoveryPage = features.ErrorRecoveryPage; - Locked = features.Locked; - MultiRead = features.MultiRead; - PreventJumper = features.PreventJumper; - SupportsAACS = features.SupportsAACS; - SupportsBusEncryption = features.SupportsBusEncryption; - SupportsC2 = features.SupportsC2; - SupportsCPRM = features.SupportsCPRM; - SupportsCSS = features.SupportsCSS; - SupportsDAP = features.SupportsDAP; - SupportsDeviceBusyEvent = features.SupportsDeviceBusyEvent; - SupportsHybridDiscs = features.SupportsHybridDiscs; - SupportsModePage1Ch = features.SupportsModePage1Ch; - SupportsOSSC = features.SupportsOSSC; - SupportsPWP = features.SupportsPWP; - SupportsSWPP = features.SupportsSWPP; - SupportsSecurDisc = features.SupportsSecurDisc; - SupportsSeparateVolume = features.SupportsSeparateVolume; - SupportsVCPS = features.SupportsVCPS; - SupportsWriteInhibitDCB = features.SupportsWriteInhibitDCB; - SupportsWriteProtectPAC = features.SupportsWriteProtectPAC; - } - - [JsonIgnore] - public int Id { get; set; } - [DisplayName("AACS version")] - public byte? AACSVersion { get; set; } - [DisplayName("AGIDs")] - public byte? AGIDs { get; set; } - [DisplayName("Binding nonce blocks")] - public byte? BindingNonceBlocks { get; set; } - [DisplayName("Blocks per redable unit")] - public ushort? BlocksPerReadableUnit { get; set; } - [DisplayName("Buffer under-run free in DVD writing")] - public bool BufferUnderrunFreeInDVD { get; set; } - [DisplayName("Buffer under-run free in SAO writing")] - public bool BufferUnderrunFreeInSAO { get; set; } - [DisplayName("Buffer under-run free in TAO writing")] - public bool BufferUnderrunFreeInTAO { get; set; } - [DisplayName("Can audio scan")] - public bool CanAudioScan { get; set; } - [DisplayName("Can eject")] - public bool CanEject { get; set; } - [DisplayName("Can erase sectors")] - public bool CanEraseSector { get; set; } - [DisplayName("Can expand BD-RE spare area")] - public bool CanExpandBDRESpareArea { get; set; } - [DisplayName("Can format media")] - public bool CanFormat { get; set; } - [DisplayName("Can format BD-RE without spare area")] - public bool CanFormatBDREWithoutSpare { get; set; } - [DisplayName("Can do a fully certified format")] - public bool CanFormatCert { get; set; } - [DisplayName("Can do a FRF format")] - public bool CanFormatFRF { get; set; } - [DisplayName("Can do a quick certified format")] - public bool CanFormatQCert { get; set; } - [DisplayName("Can do a RRM format")] - public bool CanFormatRRM { get; set; } - [DisplayName("Can generate binding nonce")] - public bool CanGenerateBindingNonce { get; set; } - [DisplayName("Can load")] - public bool CanLoad { get; set; } - [DisplayName("Can mute separate channels")] - public bool CanMuteSeparateChannels { get; set; } - [DisplayName("Can overwrite track in SAO")] - public bool CanOverwriteSAOTrack { get; set; } - [DisplayName("Can overwrite track in TAO")] - public bool CanOverwriteTAOTrack { get; set; } - [DisplayName("Can play CD-DA")] - public bool CanPlayCDAudio { get; set; } - [DisplayName("Can pseudo-overwrite BD-R")] - public bool CanPseudoOverwriteBDR { get; set; } - [DisplayName("Can read all dual-layer recordables")] - public bool CanReadAllDualR { get; set; } - [DisplayName("Can read all dual-layer rewritables")] - public bool CanReadAllDualRW { get; set; } - [DisplayName("Can read Blu-ray")] - public bool CanReadBD { get; set; } - [DisplayName("Can read BD-R")] - public bool CanReadBDR { get; set; } - [DisplayName("Can read BD-RE v1")] - public bool CanReadBDRE1 { get; set; } - [DisplayName("Can read BD-RE v2")] - public bool CanReadBDRE2 { get; set; } - [DisplayName("Can read BD-ROM")] - public bool CanReadBDROM { get; set; } - [DisplayName("Can read BCA from Blu-ray")] - public bool CanReadBluBCA { get; set; } - [DisplayName("Can read CD")] - public bool CanReadCD { get; set; } - [DisplayName("Can read CD-MRW")] - public bool CanReadCDMRW { get; set; } - [DisplayName("Can read CPRM's MKB")] - public bool CanReadCPRM_MKB { get; set; } - [DisplayName("Can read DDCD")] - public bool CanReadDDCD { get; set; } - [DisplayName("Can read DVD")] - public bool CanReadDVD { get; set; } - [DisplayName("Can read DVD+MRW")] - public bool CanReadDVDPlusMRW { get; set; } - [DisplayName("Can read DVD+R")] - public bool CanReadDVDPlusR { get; set; } - [DisplayName("Can read DVD+R DL")] - public bool CanReadDVDPlusRDL { get; set; } - [DisplayName("Can read DVD+RW")] - public bool CanReadDVDPlusRW { get; set; } - [DisplayName("Can read DVD+RW DL")] - public bool CanReadDVDPlusRWDL { get; set; } - [DisplayName("Can read drive's AACS certificate")] - public bool CanReadDriveAACSCertificate { get; set; } - [DisplayName("Can read HD DVD")] - public bool CanReadHDDVD { get; set; } - [DisplayName("Can read HD DVD-R")] - public bool CanReadHDDVDR { get; set; } - [DisplayName("Can read HD DVD-RAM")] - public bool CanReadHDDVDRAM { get; set; } - [DisplayName("Can read Lead-In's CD-TEXT")] - public bool CanReadLeadInCDText { get; set; } - [DisplayName("Can read old generation BD-R")] - public bool CanReadOldBDR { get; set; } - [DisplayName("Can read old generation BD-RE")] - public bool CanReadOldBDRE { get; set; } - [DisplayName("Can read old generation BD-ROM")] - public bool CanReadOldBDROM { get; set; } - [DisplayName("Can read spare area information")] - public bool CanReadSpareAreaInformation { get; set; } - [DisplayName("Can report drive serial number")] - public bool CanReportDriveSerial { get; set; } - [DisplayName("Can report media serial number")] - public bool CanReportMediaSerial { get; set; } - [DisplayName("Can test write DDCD-R")] - public bool CanTestWriteDDCDR { get; set; } - [DisplayName("Can test write DVD")] - public bool CanTestWriteDVD { get; set; } - [DisplayName("Can test write in SAO mode")] - public bool CanTestWriteInSAO { get; set; } - [DisplayName("Can test write in TAO mode")] - public bool CanTestWriteInTAO { get; set; } - [DisplayName("Can upgrade firmware")] - public bool CanUpgradeFirmware { get; set; } - [DisplayName("Can write Blu-ray")] - public bool CanWriteBD { get; set; } - [DisplayName("Can write BD-R")] - public bool CanWriteBDR { get; set; } - [DisplayName("Can write BD-RE v1")] - public bool CanWriteBDRE1 { get; set; } - [DisplayName("Can write BD-RE v2")] - public bool CanWriteBDRE2 { get; set; } - [DisplayName("Can write bus encrypted blocks")] - public bool CanWriteBusEncryptedBlocks { get; set; } - [DisplayName("Can write CD-MRW")] - public bool CanWriteCDMRW { get; set; } - [DisplayName("Can write CD-RW")] - public bool CanWriteCDRW { get; set; } - [DisplayName("Can write CD-RW CAV")] - public bool CanWriteCDRWCAV { get; set; } - [DisplayName("Can write CD in SAO mode")] - public bool CanWriteCDSAO { get; set; } - [DisplayName("Can write CD in TAO mode")] - public bool CanWriteCDTAO { get; set; } - [DisplayName("Can write CSS managed DVD")] - public bool CanWriteCSSManagedDVD { get; set; } - [DisplayName("Can write DDCD-R")] - public bool CanWriteDDCDR { get; set; } - [DisplayName("Can write DDCD-RW")] - public bool CanWriteDDCDRW { get; set; } - [DisplayName("Can write DVD+MRW")] - public bool CanWriteDVDPlusMRW { get; set; } - [DisplayName("Can write DVD+R")] - public bool CanWriteDVDPlusR { get; set; } - [DisplayName("Can write DVD+R DL")] - public bool CanWriteDVDPlusRDL { get; set; } - [DisplayName("Can write DVD+RW")] - public bool CanWriteDVDPlusRW { get; set; } - [DisplayName("Can write DVD+RW DL")] - public bool CanWriteDVDPlusRWDL { get; set; } - [DisplayName("Can write DVD-R")] - public bool CanWriteDVDR { get; set; } - [DisplayName("Can write DVD-R DL")] - public bool CanWriteDVDRDL { get; set; } - [DisplayName("Can write DVD-RW")] - public bool CanWriteDVDRW { get; set; } - [DisplayName("Can write HD DVD-R")] - public bool CanWriteHDDVDR { get; set; } - [DisplayName("Can write HD DVD-RAM")] - public bool CanWriteHDDVDRAM { get; set; } - [DisplayName("Can write old generation BD-R")] - public bool CanWriteOldBDR { get; set; } - [DisplayName("Can write old generation BD-RE")] - public bool CanWriteOldBDRE { get; set; } - [DisplayName("Can write packet subchannel in TAO")] - public bool CanWritePackedSubchannelInTAO { get; set; } - [DisplayName("Can write RW subchannel in SAO")] - public bool CanWriteRWSubchannelInSAO { get; set; } - [DisplayName("Can write RW subchannel in TAO")] - public bool CanWriteRWSubchannelInTAO { get; set; } - [DisplayName("Can write RAW-96 sectors")] - public bool CanWriteRaw { get; set; } - [DisplayName("Can write RAW-96 sectors in multisession")] - public bool CanWriteRawMultiSession { get; set; } - [DisplayName("Can write RAW-96 sectors in TAO")] - public bool CanWriteRawSubchannelInTAO { get; set; } - [DisplayName("Changer is side change capable")] - public bool ChangerIsSideChangeCapable { get; set; } - [DisplayName("Changer slots")] - public byte ChangerSlots { get; set; } - [DisplayName("Changer supports disc present")] - public bool ChangerSupportsDiscPresent { get; set; } - [DisplayName("CPRM version")] - public byte? CPRMVersion { get; set; } - [DisplayName("CSS version")] - public byte? CSSVersion { get; set; } - [DisplayName("DBML")] - public bool DBML { get; set; } - [DisplayName("DVD Multi-Read Specification")] - public bool DVDMultiRead { get; set; } - [DisplayName("Has an embedded changer")] - public bool EmbeddedChanger { get; set; } - [DisplayName("Has error recovery page")] - public bool ErrorRecoveryPage { get; set; } - [DisplayName("Firmware date")] - public DateTime? FirmwareDate { get; set; } - [DisplayName("Loading mechanism type")] - public byte? LoadingMechanismType { get; set; } - [DisplayName("Locked")] - public bool Locked { get; set; } - [DisplayName("Logical block size")] - public uint? LogicalBlockSize { get; set; } - [DisplayName("Multi-Read Specification")] - public bool MultiRead { get; set; } - [DisplayName("Physical interface standard")] - public PhysicalInterfaces? PhysicalInterfaceStandard => (PhysicalInterfaces?)PhysicalInterfaceStandardNumber; - [DisplayName("Physical interface standard number")] - public uint? PhysicalInterfaceStandardNumber { get; set; } - [DisplayName("Prevent eject jumper")] - public bool PreventJumper { get; set; } - [DisplayName("Supports AACS")] - public bool SupportsAACS { get; set; } - [DisplayName("Supports bus encryption")] - public bool SupportsBusEncryption { get; set; } - [DisplayName("Supports C2 pointers")] - public bool SupportsC2 { get; set; } - [DisplayName("Supports CPRM")] - public bool SupportsCPRM { get; set; } - [DisplayName("Supports CSS")] - public bool SupportsCSS { get; set; } - [DisplayName("Supports DAP")] - public bool SupportsDAP { get; set; } - [DisplayName("Supports device busy event")] - public bool SupportsDeviceBusyEvent { get; set; } - [DisplayName("Supports hybrid discs")] - public bool SupportsHybridDiscs { get; set; } - [DisplayName("Supports MODE PAGE 1Ch")] - public bool SupportsModePage1Ch { get; set; } - [DisplayName("Supports OSSC")] - public bool SupportsOSSC { get; set; } - [DisplayName("Supports PWP")] - public bool SupportsPWP { get; set; } - [DisplayName("Supports SWPP")] - public bool SupportsSWPP { get; set; } - [DisplayName("Supports SecurDisc")] - public bool SupportsSecurDisc { get; set; } - [DisplayName("Support separate volume levels")] - public bool SupportsSeparateVolume { get; set; } - [DisplayName("Supports VCPS")] - public bool SupportsVCPS { get; set; } - [DisplayName("Supports write inhibit DCB")] - public bool SupportsWriteInhibitDCB { get; set; } - [DisplayName("Supports write protect PAC")] - public bool SupportsWriteProtectPAC { get; set; } - [DisplayName("Volume levels")] - public ushort? VolumeLevels { get; set; } - [DisplayName("MMC FEATURES binary data")] - public byte[] BinaryData { get; set; } - } - - public class TestedMedia - { - public Identify.IdentifyDevice? IdentifyDevice; - - public TestedMedia() {} - - public TestedMedia(testedMediaType mediaType, bool ata) - { - if(mediaType.BlocksSpecified) - Blocks = mediaType.Blocks; - - if(mediaType.BlockSizeSpecified) - BlockSize = mediaType.BlockSize; - - if(mediaType.CanReadAACSSpecified) - CanReadAACS = mediaType.CanReadAACS; - - if(mediaType.CanReadADIPSpecified) - CanReadADIP = mediaType.CanReadADIP; - - if(mediaType.CanReadATIPSpecified) - CanReadATIP = mediaType.CanReadATIP; - - if(mediaType.CanReadBCASpecified) - CanReadBCA = mediaType.CanReadBCA; - - if(mediaType.CanReadC2PointersSpecified) - CanReadC2Pointers = mediaType.CanReadC2Pointers; - - if(mediaType.CanReadCMISpecified) - CanReadCMI = mediaType.CanReadCMI; - - if(mediaType.CanReadCorrectedSubchannelSpecified) - CanReadCorrectedSubchannel = mediaType.CanReadCorrectedSubchannel; - - if(mediaType.CanReadCorrectedSubchannelWithC2Specified) - CanReadCorrectedSubchannelWithC2 = mediaType.CanReadCorrectedSubchannelWithC2; - - if(mediaType.CanReadDCBSpecified) - CanReadDCB = mediaType.CanReadDCB; - - if(mediaType.CanReadDDSSpecified) - CanReadDDS = mediaType.CanReadDDS; - - if(mediaType.CanReadDMISpecified) - CanReadDMI = mediaType.CanReadDMI; - - if(mediaType.CanReadDiscInformationSpecified) - CanReadDiscInformation = mediaType.CanReadDiscInformation; - - if(mediaType.CanReadFullTOCSpecified) - CanReadFullTOC = mediaType.CanReadFullTOC; - - if(mediaType.CanReadHDCMISpecified) - CanReadHDCMI = mediaType.CanReadHDCMI; - - if(mediaType.CanReadLayerCapacitySpecified) - CanReadLayerCapacity = mediaType.CanReadLayerCapacity; - - if(mediaType.CanReadLeadInSpecified) - CanReadFirstTrackPreGap = mediaType.CanReadLeadIn; - - if(mediaType.CanReadLeadOutSpecified) - CanReadLeadOut = mediaType.CanReadLeadOut; - - if(mediaType.CanReadMediaIDSpecified) - CanReadMediaID = mediaType.CanReadMediaID; - - if(mediaType.CanReadMediaSerialSpecified) - CanReadMediaSerial = mediaType.CanReadMediaSerial; - - if(mediaType.CanReadPACSpecified) - CanReadPAC = mediaType.CanReadPAC; - - if(mediaType.CanReadPFISpecified) - CanReadPFI = mediaType.CanReadPFI; - - if(mediaType.CanReadPMASpecified) - CanReadPMA = mediaType.CanReadPMA; - - if(mediaType.CanReadPQSubchannelSpecified) - CanReadPQSubchannel = mediaType.CanReadPQSubchannel; - - if(mediaType.CanReadPQSubchannelWithC2Specified) - CanReadPQSubchannelWithC2 = mediaType.CanReadPQSubchannelWithC2; - - if(mediaType.CanReadPRISpecified) - CanReadPRI = mediaType.CanReadPRI; - - if(mediaType.CanReadRWSubchannelSpecified) - CanReadRWSubchannel = mediaType.CanReadRWSubchannel; - - if(mediaType.CanReadRWSubchannelWithC2Specified) - CanReadRWSubchannelWithC2 = mediaType.CanReadRWSubchannelWithC2; - - if(mediaType.CanReadRecordablePFISpecified) - CanReadRecordablePFI = mediaType.CanReadRecordablePFI; - - if(mediaType.CanReadSpareAreaInformationSpecified) - CanReadSpareAreaInformation = mediaType.CanReadSpareAreaInformation; - - if(mediaType.CanReadTOCSpecified) - CanReadTOC = mediaType.CanReadTOC; - - if(mediaType.DensitySpecified) - Density = mediaType.Density; - - if(mediaType.LongBlockSizeSpecified) - LongBlockSize = mediaType.LongBlockSize; - - if(mediaType.ManufacturerSpecified) - Manufacturer = mediaType.Manufacturer; - - if(mediaType.MediumTypeSpecified) - MediumType = mediaType.MediumType; - - if(mediaType.ModelSpecified) - Model = mediaType.Model; - - if(mediaType.SupportsHLDTSTReadRawDVDSpecified) - SupportsHLDTSTReadRawDVD = mediaType.SupportsHLDTSTReadRawDVD; - - if(mediaType.SupportsNECReadCDDASpecified) - SupportsNECReadCDDA = mediaType.SupportsNECReadCDDA; - - if(mediaType.SupportsPioneerReadCDDASpecified) - SupportsPioneerReadCDDA = mediaType.SupportsPioneerReadCDDA; - - if(mediaType.SupportsPioneerReadCDDAMSFSpecified) - SupportsPioneerReadCDDAMSF = mediaType.SupportsPioneerReadCDDAMSF; - - if(mediaType.SupportsPlextorReadCDDASpecified) - SupportsPlextorReadCDDA = mediaType.SupportsPlextorReadCDDA; - - if(mediaType.SupportsPlextorReadRawDVDSpecified) - SupportsPlextorReadRawDVD = mediaType.SupportsPlextorReadRawDVD; - - if(mediaType.SupportsRead10Specified) - SupportsRead10 = mediaType.SupportsRead10; - - if(mediaType.SupportsRead12Specified) - SupportsRead12 = mediaType.SupportsRead12; - - if(mediaType.SupportsRead16Specified) - SupportsRead16 = mediaType.SupportsRead16; - - if(mediaType.SupportsReadSpecified) - { - if(ata) - SupportsReadSectors = mediaType.SupportsRead; - else - SupportsRead6 = mediaType.SupportsRead; - } - - if(mediaType.SupportsReadCapacity16Specified) - SupportsReadCapacity16 = mediaType.SupportsReadCapacity16; - - if(mediaType.SupportsReadCapacitySpecified) - SupportsReadCapacity = mediaType.SupportsReadCapacity; - - if(mediaType.SupportsReadCdSpecified) - SupportsReadCd = mediaType.SupportsReadCd; - - if(mediaType.SupportsReadCdMsfSpecified) - SupportsReadCdMsf = mediaType.SupportsReadCdMsf; - - if(mediaType.SupportsReadCdRawSpecified) - SupportsReadCdRaw = mediaType.SupportsReadCdRaw; - - if(mediaType.SupportsReadCdMsfRawSpecified) - SupportsReadCdMsfRaw = mediaType.SupportsReadCdMsfRaw; - - if(mediaType.SupportsReadLong16Specified) - SupportsReadLong16 = mediaType.SupportsReadLong16; - - if(mediaType.SupportsReadLongSpecified) - SupportsReadLong = mediaType.SupportsReadLong; - - if(mediaType.LBASectorsSpecified) - LBASectors = mediaType.LBASectors; - - if(mediaType.LBA48SectorsSpecified) - LBA48Sectors = mediaType.LBA48Sectors; - - if(mediaType.LogicalAlignmentSpecified) - LogicalAlignment = mediaType.LogicalAlignment; - - if(mediaType.NominalRotationRateSpecified) - NominalRotationRate = mediaType.NominalRotationRate; - - if(mediaType.PhysicalBlockSizeSpecified) - PhysicalBlockSize = mediaType.PhysicalBlockSize; - - if(mediaType.SolidStateDeviceSpecified) - SolidStateDevice = mediaType.SolidStateDevice; - - if(mediaType.UnformattedBPTSpecified) - UnformattedBPT = mediaType.UnformattedBPT; - - if(mediaType.UnformattedBPSSpecified) - UnformattedBPS = mediaType.UnformattedBPS; - - if(mediaType.SupportsReadDmaLbaSpecified) - SupportsReadDmaLba = mediaType.SupportsReadDmaLba; - - if(mediaType.SupportsReadDmaRetryLbaSpecified) - SupportsReadDmaRetryLba = mediaType.SupportsReadDmaRetryLba; - - if(mediaType.SupportsReadLbaSpecified) - SupportsReadLba = mediaType.SupportsReadLba; - - if(mediaType.SupportsReadRetryLbaSpecified) - SupportsReadRetryLba = mediaType.SupportsReadRetryLba; - - if(mediaType.SupportsReadLongLbaSpecified) - SupportsReadLongLba = mediaType.SupportsReadLongLba; - - if(mediaType.SupportsReadLongRetryLbaSpecified) - SupportsReadLongRetryLba = mediaType.SupportsReadLongRetryLba; - - if(mediaType.SupportsSeekLbaSpecified) - SupportsSeekLba = mediaType.SupportsSeekLba; - - if(mediaType.SupportsReadDmaLba48Specified) - SupportsReadDmaLba48 = mediaType.SupportsReadDmaLba48; - - if(mediaType.SupportsReadLba48Specified) - SupportsReadLba48 = mediaType.SupportsReadLba48; - - if(mediaType.SupportsReadDmaSpecified) - SupportsReadDma = mediaType.SupportsReadDma; - - if(mediaType.SupportsReadDmaRetrySpecified) - SupportsReadDmaRetry = mediaType.SupportsReadDmaRetry; - - if(mediaType.SupportsReadRetrySpecified) - SupportsReadRetry = mediaType.SupportsReadRetry; - - if(mediaType.SupportsReadLongRetrySpecified) - SupportsReadLongRetry = mediaType.SupportsReadLongRetry; - - if(mediaType.SupportsSeekSpecified) - SupportsSeek = mediaType.SupportsSeek; - - if(mediaType.CHS != null) - CHS = new Chs(mediaType.CHS); - - if(mediaType.CurrentCHS != null) - CurrentCHS = new Chs(mediaType.CurrentCHS); - - MediaIsRecognized = mediaType.MediaIsRecognized; - MediumTypeName = mediaType.MediumTypeName; - ModeSense6Data = mediaType.ModeSense6Data; - ModeSense10Data = mediaType.ModeSense10Data; - } - - [JsonIgnore] - public int Id { get; set; } - [DisplayName("IDENTIFY DEVICE data")] - public byte[] IdentifyData { get; set; } - [DisplayName("Blocks")] - public ulong? Blocks { get; set; } - [DisplayName("Bytes per block")] - public uint? BlockSize { get; set; } - [DisplayName("Can read AACS")] - public bool? CanReadAACS { get; set; } - [DisplayName("Can read ADIP")] - public bool? CanReadADIP { get; set; } - [DisplayName("Can read ATIP")] - public bool? CanReadATIP { get; set; } - [DisplayName("Can read BCA")] - public bool? CanReadBCA { get; set; } - [DisplayName("Can read C2 pointers")] - public bool? CanReadC2Pointers { get; set; } - [DisplayName("Can read Copyright Management Information")] - public bool? CanReadCMI { get; set; } - [DisplayName("Can read corrected subchannel")] - public bool? CanReadCorrectedSubchannel { get; set; } - [DisplayName("Can read corrected subchannel with C2 pointers")] - public bool? CanReadCorrectedSubchannelWithC2 { get; set; } - [DisplayName("Can read DCBs")] - public bool? CanReadDCB { get; set; } - [DisplayName("Can read DDS")] - public bool? CanReadDDS { get; set; } - [DisplayName("Can read DMI")] - public bool? CanReadDMI { get; set; } - [DisplayName("Can read disc information")] - public bool? CanReadDiscInformation { get; set; } - [DisplayName("Can read full TOC")] - public bool? CanReadFullTOC { get; set; } - [DisplayName("Can read HD-DVD Copyright Management Information")] - public bool? CanReadHDCMI { get; set; } - [DisplayName("Can read layer capacity")] - public bool? CanReadLayerCapacity { get; set; } - [DisplayName("Can read into first track pregap")] - public bool? CanReadFirstTrackPreGap { get; set; } - [DisplayName("Can read into Lead-In")] - public bool? CanReadLeadIn { get; set; } - [DisplayName("Can read into Lead-Out")] - public bool? CanReadLeadOut { get; set; } - [DisplayName("Can read media ID")] - public bool? CanReadMediaID { get; set; } - [DisplayName("Can read media serial number")] - public bool? CanReadMediaSerial { get; set; } - [DisplayName("Can read PAC")] - public bool? CanReadPAC { get; set; } - [DisplayName("Can read PFI")] - public bool? CanReadPFI { get; set; } - [DisplayName("Can read PMA")] - public bool? CanReadPMA { get; set; } - [DisplayName("Can read PQ subchannel")] - public bool? CanReadPQSubchannel { get; set; } - [DisplayName("Can read PQ subchannel with C2 pointers")] - public bool? CanReadPQSubchannelWithC2 { get; set; } - [DisplayName("Can read pre-recorded information")] - public bool? CanReadPRI { get; set; } - [DisplayName("Can read RW subchannel")] - public bool? CanReadRWSubchannel { get; set; } - [DisplayName("Can read RW subchannel with C2 pointers")] - public bool? CanReadRWSubchannelWithC2 { get; set; } - [DisplayName("Can read recordable PFI")] - public bool? CanReadRecordablePFI { get; set; } - [DisplayName("Can read spare area information")] - public bool? CanReadSpareAreaInformation { get; set; } - [DisplayName("Can read TOC")] - public bool? CanReadTOC { get; set; } - [DisplayName("Density code")] - public byte? Density { get; set; } - [DisplayName("Bytes per block in READ LONG commands")] - public uint? LongBlockSize { get; set; } - [DisplayName("Media manufacturer")] - public string Manufacturer { get; set; } - [DisplayName("Media recognized by drive?")] - public bool MediaIsRecognized { get; set; } - [DisplayName("Medium type code")] - public byte? MediumType { get; set; } - [DisplayName("Media type")] - public string MediumTypeName { get; set; } - [DisplayName("Media model")] - public string Model { get; set; } - [DisplayName("Can read scrambled DVD sectors using HL-DT-ST cache trick")] - public bool? SupportsHLDTSTReadRawDVD { get; set; } - [DisplayName("Supports NEC READ CD-DA command")] - public bool? SupportsNECReadCDDA { get; set; } - [DisplayName("Supports Pioneer READ CD-DA command")] - public bool? SupportsPioneerReadCDDA { get; set; } - [DisplayName("Supports Pioneer READ CD-DA MSF command")] - public bool? SupportsPioneerReadCDDAMSF { get; set; } - [DisplayName("Supports Plextor READ CD-DA command")] - public bool? SupportsPlextorReadCDDA { get; set; } - [DisplayName("Can read scrambled DVD sectors using Plextor vendor command")] - public bool? SupportsPlextorReadRawDVD { get; set; } - [DisplayName("Supports READ(10) command")] - public bool? SupportsRead10 { get; set; } - [DisplayName("Supports READ(12) command")] - public bool? SupportsRead12 { get; set; } - [DisplayName("Supports READ(16) command")] - public bool? SupportsRead16 { get; set; } - [DisplayName("Supports READ(6) command")] - public bool? SupportsRead6 { get; set; } - [DisplayName("Supports READ CAPACITY(16) command")] - public bool? SupportsReadCapacity16 { get; set; } - [DisplayName("Supports READ CAPACITY command")] - public bool? SupportsReadCapacity { get; set; } - [DisplayName("Supports READ CD command")] - public bool? SupportsReadCd { get; set; } - [DisplayName("Supports READ CD MSF command")] - public bool? SupportsReadCdMsf { get; set; } - [DisplayName("Supports full sector in READ CD command")] - public bool? SupportsReadCdRaw { get; set; } - [DisplayName("Supports full sector in READ CD MSF command")] - public bool? SupportsReadCdMsfRaw { get; set; } - [DisplayName("Supports READ LONG(16) command")] - public bool? SupportsReadLong16 { get; set; } - [DisplayName("Supports READ LONG command")] - public bool? SupportsReadLong { get; set; } - - [DisplayName("Data from MODE SENSE(6) command")] - public byte[] ModeSense6Data { get; set; } - [DisplayName("Data from MODE SENSE(10) command")] - public byte[] ModeSense10Data { get; set; } - - public virtual Chs CHS { get; set; } - public virtual Chs CurrentCHS { get; set; } - [DisplayName("Sectors in 28-bit LBA mode")] - public uint? LBASectors { get; set; } - [DisplayName("Sectors in 48-bit LBA mode")] - public ulong? LBA48Sectors { get; set; } - [DisplayName("Logical alignment")] - public ushort? LogicalAlignment { get; set; } - [DisplayName("Nominal rotation rate")] - public ushort? NominalRotationRate { get; set; } - [DisplayName("Bytes per block, physical")] - public uint? PhysicalBlockSize { get; set; } - [DisplayName("Is it a SSD?")] - public bool? SolidStateDevice { get; set; } - [DisplayName("Bytes per unformatted track")] - public ushort? UnformattedBPT { get; set; } - [DisplayName("Bytes per unformatted sector")] - public ushort? UnformattedBPS { get; set; } - - [DisplayName("Supports READ DMA (LBA) command")] - public bool? SupportsReadDmaLba { get; set; } - [DisplayName("Supports READ DMA RETRY (LBA) command")] - public bool? SupportsReadDmaRetryLba { get; set; } - [DisplayName("Supports READ SECTORS (LBA) command")] - public bool? SupportsReadLba { get; set; } - [DisplayName("Supports READ SECTORS RETRY (LBA) command")] - public bool? SupportsReadRetryLba { get; set; } - [DisplayName("Supports READ SECTORS LONG (LBA) command")] - public bool? SupportsReadLongLba { get; set; } - [DisplayName("Supports READ SECTORS LONG RETRY (LBA) command")] - public bool? SupportsReadLongRetryLba { get; set; } - [DisplayName("Supports SEEK (LBA) command")] - public bool? SupportsSeekLba { get; set; } - - [DisplayName("Supports READ DMA EXT command")] - public bool? SupportsReadDmaLba48 { get; set; } - [DisplayName("Supports READ SECTORS EXT command")] - public bool? SupportsReadLba48 { get; set; } - - [DisplayName("Supports READ DMA command")] - public bool? SupportsReadDma { get; set; } - [DisplayName("Supports READ DMA RETRY command")] - public bool? SupportsReadDmaRetry { get; set; } - [DisplayName("Supports READ SECTORS RETRY command")] - public bool? SupportsReadRetry { get; set; } - [DisplayName("Supports READ SECTORS command")] - public bool? SupportsReadSectors { get; set; } - [DisplayName("Supports READ SECTORS LONG RETRY command")] - public bool? SupportsReadLongRetry { get; set; } - [DisplayName("Supports SEEK command")] - public bool? SupportsSeek { get; set; } - - [DisplayName("Can read into inter-session Lead-In")] - public bool? CanReadingIntersessionLeadIn { get; set; } - [DisplayName("Can read into inter-session Lead-Out")] - public bool? CanReadingIntersessionLeadOut { get; set; } - [DisplayName("Data from inter-session Lead-In")] - public byte[] IntersessionLeadInData { get; set; } - [DisplayName("Data from inter-session Lead-Out")] - public byte[] IntersessionLeadOutData { get; set; } - - [DisplayName("Can read scrambled data using READ CD command")] - public bool? CanReadCdScrambled { get; set; } - [DisplayName("Data from scrambled READ CD command")] - public byte[] ReadCdScrambledData { get; set; } - - [DisplayName("Can read from cache using F1h command subcommand 06h")] - public bool? CanReadF1_06 { get; set; } - [DisplayName("Can read from cache using F1h command subcommand 06h")] - public byte[] ReadF1_06Data { get; set; } - [DisplayName("Can read from cache using F1h command subcommand 06h targeting Lead-Out")] - public bool? CanReadF1_06LeadOut { get; set; } - [DisplayName("Can read from cache using F1h command subcommand 06h targeting Lead-Out")] - public byte[] ReadF1_06LeadOutData { get; set; } - - [JsonIgnore] - public int? AtaId { get; set; } - [JsonIgnore] - public int? ScsiId { get; set; } - [JsonIgnore] - public int? MmcId { get; set; } - - #region SCSI data - [DisplayName("Data from READ(6) command")] - public byte[] Read6Data { get; set; } - [DisplayName("Data from READ(10) command")] - public byte[] Read10Data { get; set; } - [DisplayName("Data from READ(12) command")] - public byte[] Read12Data { get; set; } - [DisplayName("Data from READ(16) command")] - public byte[] Read16Data { get; set; } - [DisplayName("Data from READ LONG(10) command")] - public byte[] ReadLong10Data { get; set; } - [DisplayName("Data from READ LONG(16) command")] - public byte[] ReadLong16Data { get; set; } - #endregion - - #region ATA data - [DisplayName("Data from READ SECTORS command")] - public byte[] ReadSectorsData { get; set; } - [DisplayName("Data from READ SECTORS RETRY command")] - public byte[] ReadSectorsRetryData { get; set; } - [DisplayName("Data from READ DMA command")] - public byte[] ReadDmaData { get; set; } - [DisplayName("Data from READ DMA RETRY command")] - public byte[] ReadDmaRetryData { get; set; } - [DisplayName("Data from READ SECTORS (LBA) command")] - public byte[] ReadLbaData { get; set; } - [DisplayName("Data from READ SECTORS RETRY (LBA) command")] - public byte[] ReadRetryLbaData { get; set; } - [DisplayName("Data from READ DMA (LBA) command")] - public byte[] ReadDmaLbaData { get; set; } - [DisplayName("Data from READ DMA RETRY (LBA) command")] - public byte[] ReadDmaRetryLbaData { get; set; } - [DisplayName("Data from READ SECTORS EXT command")] - public byte[] ReadLba48Data { get; set; } - [DisplayName("Data from READ DMA EXT command")] - public byte[] ReadDmaLba48Data { get; set; } - [DisplayName("Data from READ SECTORS LONG command")] - public byte[] ReadLongData { get; set; } - [DisplayName("Data from READ SECTORS LONG RETRY command")] - public byte[] ReadLongRetryData { get; set; } - [DisplayName("Data from READ SECTORS LONG (LBA) command")] - public byte[] ReadLongLbaData { get; set; } - [DisplayName("Data from READ SECTORS LONG RETRY (LBA) command")] - public byte[] ReadLongRetryLbaData { get; set; } - #endregion - - #region CompactDisc data - [DisplayName("Data from READ TOC command")] - public byte[] TocData { get; set; } - [DisplayName("Data from READ FULL TOC command")] - public byte[] FullTocData { get; set; } - [DisplayName("Data from READ ATIP command")] - public byte[] AtipData { get; set; } - [DisplayName("Data from READ PMA command")] - public byte[] PmaData { get; set; } - [DisplayName("Data from READ CD command")] - public byte[] ReadCdData { get; set; } - [DisplayName("Data from READ CD MSF command")] - public byte[] ReadCdMsfData { get; set; } - [DisplayName("Data from READ CD (full sector) command")] - public byte[] ReadCdFullData { get; set; } - [DisplayName("Data from READ CD MSF (full sector) command")] - public byte[] ReadCdMsfFullData { get; set; } - [DisplayName("Data from track 1 pregap")] - public byte[] Track1PregapData { get; set; } - [DisplayName("Data from Lead-In")] - public byte[] LeadInData { get; set; } - [DisplayName("Data from Lead-Out")] - public byte[] LeadOutData { get; set; } - [DisplayName("Data from reading C2 pointers")] - public byte[] C2PointersData { get; set; } - [DisplayName("Data from reading with PQ subchannels")] - public byte[] PQSubchannelData { get; set; } - [DisplayName("Data from reading with RW subchannels")] - public byte[] RWSubchannelData { get; set; } - [DisplayName("Data from reading with corrected subchannels")] - public byte[] CorrectedSubchannelData { get; set; } - [DisplayName("Data from reading with PQ subchannels and C2 pointers")] - public byte[] PQSubchannelWithC2Data { get; set; } - [DisplayName("Data from reading with RW subchannels and C2 pointers")] - public byte[] RWSubchannelWithC2Data { get; set; } - [DisplayName("Data from reading with corrected subchannels and C2 pointers")] - public byte[] CorrectedSubchannelWithC2Data { get; set; } - #endregion - - #region DVD data - [DisplayName("Data from PFI")] - public byte[] PfiData { get; set; } - [DisplayName("Data from DMI")] - public byte[] DmiData { get; set; } - [DisplayName("Data from DVD's Copyright Management Information")] - public byte[] CmiData { get; set; } - [DisplayName("Data from DVD's BCA")] - public byte[] DvdBcaData { get; set; } - [DisplayName("Data from DVD's AACS")] - public byte[] DvdAacsData { get; set; } - [DisplayName("Data from DVD's DDS")] - public byte[] DvdDdsData { get; set; } - [DisplayName("Data from DVD's Spare Area Information")] - public byte[] DvdSaiData { get; set; } - [DisplayName("Data from DVD's pre-recorded information")] - public byte[] PriData { get; set; } - [DisplayName("Data from embossed PFI")] - public byte[] EmbossedPfiData { get; set; } - [DisplayName("Data from ADIP")] - public byte[] AdipData { get; set; } - [DisplayName("Data from DCBs")] - public byte[] DcbData { get; set; } - [DisplayName("Data from HD-DVD's Copyright Management Information")] - public byte[] HdCmiData { get; set; } - [DisplayName("Data from DVD's layer information")] - public byte[] DvdLayerData { get; set; } - #endregion - - #region Blu-ray data - [DisplayName("Data from Blu-ray's BCA")] - public byte[] BluBcaData { get; set; } - [DisplayName("Data from Blu-ray's DDS")] - public byte[] BluDdsData { get; set; } - [DisplayName("Data from Blu-ray's Spare Area Information")] - public byte[] BluSaiData { get; set; } - [DisplayName("Data from Blu-ray's Disc Information")] - public byte[] BluDiData { get; set; } - [DisplayName("Data from Blu-ray's PAC")] - public byte[] BluPacData { get; set; } - #endregion - - #region Vendor data - [DisplayName("Data from Plextor's READ CD-DA command")] - public byte[] PlextorReadCddaData { get; set; } - [DisplayName("Data from Pioneer's READ CD-DA command")] - public byte[] PioneerReadCddaData { get; set; } - [DisplayName("Data from Pioneer's READ CD-DA MSF command")] - public byte[] PioneerReadCddaMsfData { get; set; } - [DisplayName("Data from NEC's READ CD-DA command")] - public byte[] NecReadCddaData { get; set; } - [DisplayName("Data from Plextor's scrambled DVD reading command")] - public byte[] PlextorReadRawDVDData { get; set; } - [DisplayName("Data from HL-DT-ST's scrambled DVD reading trick")] - public byte[] HLDTSTReadRawDVDData { get; set; } - #endregion - } - - public class Ssc - { - public Ssc() {} - - public Ssc(sscType ssc) - { - if(ssc.BlockSizeGranularitySpecified) - BlockSizeGranularity = ssc.BlockSizeGranularity; - - if(ssc.MaxBlockLengthSpecified) - MaxBlockLength = ssc.MaxBlockLength; - - if(ssc.MinBlockLengthSpecified) - MinBlockLength = ssc.MinBlockLength; - - if(ssc.SupportedDensities != null) - SupportedDensities = new List(ssc.SupportedDensities); - - if(ssc.SupportedMediaTypes != null) - { - SupportedMediaTypes = new List(); - - foreach(SupportedMedia mediaType in ssc.SupportedMediaTypes) - SupportedMediaTypes.Add(new SscSupportedMedia(mediaType)); - } - - if(ssc.TestedMedia == null) - return; - - TestedMedia = new List(); - - foreach(SequentialMedia testedMedia in ssc.TestedMedia) - TestedMedia.Add(new TestedSequentialMedia(testedMedia)); - } - - [JsonIgnore] - public int Id { get; set; } - [DisplayName("Block size granularity")] - public byte? BlockSizeGranularity { get; set; } - [DisplayName("Maximum block length")] - public uint? MaxBlockLength { get; set; } - [DisplayName("Minimum block length")] - public uint? MinBlockLength { get; set; } - - public virtual List SupportedDensities { get; set; } - public virtual List SupportedMediaTypes { get; set; } - public virtual List TestedMedia { get; set; } - } - - public class TestedSequentialMedia - { - public TestedSequentialMedia() {} - - public TestedSequentialMedia(SequentialMedia media) - { - if(media.CanReadMediaSerialSpecified) - CanReadMediaSerial = media.CanReadMediaSerial; - - if(media.DensitySpecified) - Density = media.Density; - - Manufacturer = media.Manufacturer; - MediaIsRecognized = media.MediaIsRecognized; - - if(media.MediumTypeSpecified) - MediumType = media.MediumType; - - MediumTypeName = media.MediumTypeName; - Model = media.Model; - - if(media.SupportedDensities != null) - SupportedDensities = new List(media.SupportedDensities); - - if(media.SupportedMediaTypes != null) - { - SupportedMediaTypes = new List(); - - foreach(SupportedMedia supportedMedia in media.SupportedMediaTypes) - SupportedMediaTypes.Add(new SscSupportedMedia(supportedMedia)); - } - - ModeSense6Data = media.ModeSense6Data; - ModeSense10Data = media.ModeSense10Data; - } - - [JsonIgnore] - public int Id { get; set; } - [DisplayName("Can read media serial?")] - public bool? CanReadMediaSerial { get; set; } - [DisplayName("Density code")] - public byte? Density { get; set; } - public string Manufacturer { get; set; } - [DisplayName("Media recognized by drive?")] - public bool MediaIsRecognized { get; set; } - [DisplayName("Medium type code")] - public byte? MediumType { get; set; } - [DisplayName("Medium type")] - public string MediumTypeName { get; set; } - public string Model { get; set; } - public virtual List SupportedDensities { get; set; } - public virtual List SupportedMediaTypes { get; set; } - - public byte[] ModeSense6Data { get; set; } - public byte[] ModeSense10Data { get; set; } - - [JsonIgnore] - public int? SscId { get; set; } - } - - public class Pcmcia - { - public string[] AdditionalInformation; - - public Pcmcia() {} - - public Pcmcia(pcmciaType pcmcia) - { - AdditionalInformation = pcmcia.AdditionalInformation; - CIS = pcmcia.CIS; - Compliance = pcmcia.Compliance; - - if(pcmcia.ManufacturerCodeSpecified) - ManufacturerCode = pcmcia.ManufacturerCode; - - if(pcmcia.CardCodeSpecified) - CardCode = pcmcia.CardCode; - - Manufacturer = pcmcia.Manufacturer; - ProductName = pcmcia.ProductName; - } - - [JsonIgnore] - public int Id { get; set; } - public byte[] CIS { get; set; } - public string Compliance { get; set; } - [DisplayName("Manufacturer code")] - public ushort? ManufacturerCode { get; set; } - [DisplayName("Card code")] - public ushort? CardCode { get; set; } - public string Manufacturer { get; set; } - [DisplayName("Product name")] - public string ProductName { get; set; } - } - - public class MmcSd - { - public MmcSd() {} - - public MmcSd(mmcsdType mmcSd) - { - CID = mmcSd.CID; - CSD = mmcSd.CSD; - OCR = mmcSd.OCR; - SCR = mmcSd.SCR; - ExtendedCSD = mmcSd.ExtendedCSD; - } - - [JsonIgnore] - public int Id { get; set; } - public byte[] CID { get; set; } - public byte[] CSD { get; set; } - public byte[] OCR { get; set; } - public byte[] SCR { get; set; } - public byte[] ExtendedCSD { get; set; } - } - - public class SscSupportedMedia - { - public SscSupportedMedia() {} - - public SscSupportedMedia(SupportedMedia media) - { - MediumType = media.MediumType; - Width = media.Width; - Length = media.Length; - Organization = media.Organization; - Name = media.Name; - Description = media.Description; - - if(media.DensityCodes == null) - return; - - DensityCodes = new List(); - - foreach(int densityCode in media.DensityCodes) - DensityCodes.Add(new DensityCode - { - Code = densityCode - }); - } - - [JsonIgnore] - public int Id { get; set; } - public byte MediumType { get; set; } - public virtual List DensityCodes { get; set; } - public ushort Width { get; set; } - public ushort Length { get; set; } - public string Organization { get; set; } - public string Name { get; set; } - public string Description { get; set; } - } - - public class DensityCode : IEquatable - { - [JsonIgnore, Key] - public int Id { get; set; } - - public int Code { get; set; } - - public bool Equals(DensityCode other) - { - if(ReferenceEquals(null, other)) - return false; - - if(ReferenceEquals(this, other)) - return true; - - return Code == other.Code; - } - - public override bool Equals(object obj) - { - if(ReferenceEquals(null, obj)) - return false; - - if(ReferenceEquals(this, obj)) - return true; - - return obj.GetType() == GetType() && Equals((DensityCode)obj); - } - - // ReSharper disable once NonReadonlyMemberInGetHashCode - public override int GetHashCode() => Code; - } - - public class GdRomSwapDiscCapabilities - { - [JsonIgnore, Key] - public int Id { get; set; } - - public bool RecognizedSwapDisc { get; set; } - public bool TestCrashed { get; set; } - public byte SwapDiscLeadOutPMIN { get; set; } - public byte SwapDiscLeadOutPSEC { get; set; } - public byte SwapDiscLeadOutPFRAM { get; set; } - public int SwapDiscLeadOutStart { get; set; } - public bool Lba0Readable { get; set; } - public byte[] Lba0Data { get; set; } - public byte[] Lba0Sense { get; set; } - public string Lba0DecodedSense { get; set; } - public bool Lba0ScrambledReadable { get; set; } - public byte[] Lba0ScrambledData { get; set; } - public byte[] Lba0ScrambledSense { get; set; } - public string Lba0ScrambledDecodedSense { get; set; } - public bool Lba44990Readable { get; set; } - public byte[] Lba44990Data { get; set; } - public byte[] Lba44990Sense { get; set; } - public string Lba44990DecodedSense { get; set; } - public int Lba44990ReadableCluster { get; set; } - public bool Lba45000Readable { get; set; } - public byte[] Lba45000Data { get; set; } - public byte[] Lba45000Sense { get; set; } - public string Lba45000DecodedSense { get; set; } - public int Lba45000ReadableCluster { get; set; } - public bool Lba50000Readable { get; set; } - public byte[] Lba50000Data { get; set; } - public byte[] Lba50000Sense { get; set; } - public string Lba50000DecodedSense { get; set; } - public int Lba50000ReadableCluster { get; set; } - public bool Lba100000Readable { get; set; } - public byte[] Lba100000Data { get; set; } - public byte[] Lba100000Sense { get; set; } - public string Lba100000DecodedSense { get; set; } - public int Lba100000ReadableCluster { get; set; } - public bool Lba400000Readable { get; set; } - public byte[] Lba400000Data { get; set; } - public byte[] Lba400000Sense { get; set; } - public string Lba400000DecodedSense { get; set; } - public int Lba400000ReadableCluster { get; set; } - public bool Lba450000Readable { get; set; } - public byte[] Lba450000Data { get; set; } - public byte[] Lba450000Sense { get; set; } - public string Lba450000DecodedSense { get; set; } - public int Lba450000ReadableCluster { get; set; } - public bool Lba44990PqReadable { get; set; } - public byte[] Lba44990PqData { get; set; } - public byte[] Lba44990PqSense { get; set; } - public string Lba44990PqDecodedSense { get; set; } - public int Lba44990PqReadableCluster { get; set; } - public bool Lba45000PqReadable { get; set; } - public byte[] Lba45000PqData { get; set; } - public byte[] Lba45000PqSense { get; set; } - public string Lba45000PqDecodedSense { get; set; } - public int Lba45000PqReadableCluster { get; set; } - public bool Lba50000PqReadable { get; set; } - public byte[] Lba50000PqData { get; set; } - public byte[] Lba50000PqSense { get; set; } - public string Lba50000PqDecodedSense { get; set; } - public int Lba50000PqReadableCluster { get; set; } - public bool Lba100000PqReadable { get; set; } - public byte[] Lba100000PqData { get; set; } - public byte[] Lba100000PqSense { get; set; } - public string Lba100000PqDecodedSense { get; set; } - public int Lba100000PqReadableCluster { get; set; } - public bool Lba400000PqReadable { get; set; } - public byte[] Lba400000PqData { get; set; } - public byte[] Lba400000PqSense { get; set; } - public string Lba400000PqDecodedSense { get; set; } - public int Lba400000PqReadableCluster { get; set; } - public bool Lba450000PqReadable { get; set; } - public byte[] Lba450000PqData { get; set; } - public byte[] Lba450000PqSense { get; set; } - public string Lba450000PqDecodedSense { get; set; } - public int Lba450000PqReadableCluster { get; set; } - public bool Lba44990RwReadable { get; set; } - public byte[] Lba44990RwData { get; set; } - public byte[] Lba44990RwSense { get; set; } - public string Lba44990RwDecodedSense { get; set; } - public int Lba44990RwReadableCluster { get; set; } - public bool Lba45000RwReadable { get; set; } - public byte[] Lba45000RwData { get; set; } - public byte[] Lba45000RwSense { get; set; } - public string Lba45000RwDecodedSense { get; set; } - public int Lba45000RwReadableCluster { get; set; } - public bool Lba50000RwReadable { get; set; } - public byte[] Lba50000RwData { get; set; } - public byte[] Lba50000RwSense { get; set; } - public string Lba50000RwDecodedSense { get; set; } - public int Lba50000RwReadableCluster { get; set; } - public bool Lba100000RwReadable { get; set; } - public byte[] Lba100000RwData { get; set; } - public byte[] Lba100000RwSense { get; set; } - public string Lba100000RwDecodedSense { get; set; } - public int Lba100000RwReadableCluster { get; set; } - public bool Lba400000RwReadable { get; set; } - public byte[] Lba400000RwData { get; set; } - public byte[] Lba400000RwSense { get; set; } - public string Lba400000RwDecodedSense { get; set; } - public int Lba400000RwReadableCluster { get; set; } - public bool Lba450000RwReadable { get; set; } - public byte[] Lba450000RwData { get; set; } - public byte[] Lba450000RwSense { get; set; } - public string Lba450000RwDecodedSense { get; set; } - public int Lba450000RwReadableCluster { get; set; } - public bool Lba44990AudioReadable { get; set; } - public byte[] Lba44990AudioData { get; set; } - public byte[] Lba44990AudioSense { get; set; } - public string Lba44990AudioDecodedSense { get; set; } - public int Lba44990AudioReadableCluster { get; set; } - public bool Lba45000AudioReadable { get; set; } - public byte[] Lba45000AudioData { get; set; } - public byte[] Lba45000AudioSense { get; set; } - public string Lba45000AudioDecodedSense { get; set; } - public int Lba45000AudioReadableCluster { get; set; } - public bool Lba50000AudioReadable { get; set; } - public byte[] Lba50000AudioData { get; set; } - public byte[] Lba50000AudioSense { get; set; } - public string Lba50000AudioDecodedSense { get; set; } - public int Lba50000AudioReadableCluster { get; set; } - public bool Lba100000AudioReadable { get; set; } - public byte[] Lba100000AudioData { get; set; } - public byte[] Lba100000AudioSense { get; set; } - public string Lba100000AudioDecodedSense { get; set; } - public int Lba100000AudioReadableCluster { get; set; } - public bool Lba400000AudioReadable { get; set; } - public byte[] Lba400000AudioData { get; set; } - public byte[] Lba400000AudioSense { get; set; } - public string Lba400000AudioDecodedSense { get; set; } - public int Lba400000AudioReadableCluster { get; set; } - public bool Lba450000AudioReadable { get; set; } - public byte[] Lba450000AudioData { get; set; } - public byte[] Lba450000AudioSense { get; set; } - public string Lba450000AudioDecodedSense { get; set; } - public int Lba450000AudioReadableCluster { get; set; } - public bool Lba44990AudioPqReadable { get; set; } - public byte[] Lba44990AudioPqData { get; set; } - public byte[] Lba44990AudioPqSense { get; set; } - public string Lba44990AudioPqDecodedSense { get; set; } - public int Lba44990AudioPqReadableCluster { get; set; } - public bool Lba45000AudioPqReadable { get; set; } - public byte[] Lba45000AudioPqData { get; set; } - public byte[] Lba45000AudioPqSense { get; set; } - public string Lba45000AudioPqDecodedSense { get; set; } - public int Lba45000AudioPqReadableCluster { get; set; } - public bool Lba50000AudioPqReadable { get; set; } - public byte[] Lba50000AudioPqData { get; set; } - public byte[] Lba50000AudioPqSense { get; set; } - public string Lba50000AudioPqDecodedSense { get; set; } - public int Lba50000AudioPqReadableCluster { get; set; } - public bool Lba100000AudioPqReadable { get; set; } - public byte[] Lba100000AudioPqData { get; set; } - public byte[] Lba100000AudioPqSense { get; set; } - public string Lba100000AudioPqDecodedSense { get; set; } - public int Lba100000AudioPqReadableCluster { get; set; } - public bool Lba400000AudioPqReadable { get; set; } - public byte[] Lba400000AudioPqData { get; set; } - public byte[] Lba400000AudioPqSense { get; set; } - public string Lba400000AudioPqDecodedSense { get; set; } - public int Lba400000AudioPqReadableCluster { get; set; } - public bool Lba450000AudioPqReadable { get; set; } - public byte[] Lba450000AudioPqData { get; set; } - public byte[] Lba450000AudioPqSense { get; set; } - public string Lba450000AudioPqDecodedSense { get; set; } - public int Lba450000AudioPqReadableCluster { get; set; } - public bool Lba44990AudioRwReadable { get; set; } - public byte[] Lba44990AudioRwData { get; set; } - public byte[] Lba44990AudioRwSense { get; set; } - public string Lba44990AudioRwDecodedSense { get; set; } - public int Lba44990AudioRwReadableCluster { get; set; } - public bool Lba45000AudioRwReadable { get; set; } - public byte[] Lba45000AudioRwData { get; set; } - public byte[] Lba45000AudioRwSense { get; set; } - public string Lba45000AudioRwDecodedSense { get; set; } - public int Lba45000AudioRwReadableCluster { get; set; } - public bool Lba50000AudioRwReadable { get; set; } - public byte[] Lba50000AudioRwData { get; set; } - public byte[] Lba50000AudioRwSense { get; set; } - public string Lba50000AudioRwDecodedSense { get; set; } - public int Lba50000AudioRwReadableCluster { get; set; } - public bool Lba100000AudioRwReadable { get; set; } - public byte[] Lba100000AudioRwData { get; set; } - public byte[] Lba100000AudioRwSense { get; set; } - public string Lba100000AudioRwDecodedSense { get; set; } - public int Lba100000AudioRwReadableCluster { get; set; } - public bool Lba400000AudioRwReadable { get; set; } - public byte[] Lba400000AudioRwData { get; set; } - public byte[] Lba400000AudioRwSense { get; set; } - public string Lba400000AudioRwDecodedSense { get; set; } - public int Lba400000AudioRwReadableCluster { get; set; } - public bool Lba450000AudioRwReadable { get; set; } - public byte[] Lba450000AudioRwData { get; set; } - public byte[] Lba450000AudioRwSense { get; set; } - public string Lba450000AudioRwDecodedSense { get; set; } - public int Lba450000AudioRwReadableCluster { get; set; } - public uint MinimumReadableSectorInHdArea { get; set; } - public uint MaximumReadableSectorInHdArea { get; set; } - public byte[] MaximumReadablePqInHdArea { get; set; } - public byte[] MaximumReadableRwInHdArea { get; set; } - } + // ReSharper disable once NonReadonlyMemberInGetHashCode + public override int GetHashCode() => Code; +} + +public class GdRomSwapDiscCapabilities +{ + [JsonIgnore, Key] + public int Id { get; set; } + + public bool RecognizedSwapDisc { get; set; } + public bool TestCrashed { get; set; } + public byte SwapDiscLeadOutPMIN { get; set; } + public byte SwapDiscLeadOutPSEC { get; set; } + public byte SwapDiscLeadOutPFRAM { get; set; } + public int SwapDiscLeadOutStart { get; set; } + public bool Lba0Readable { get; set; } + public byte[] Lba0Data { get; set; } + public byte[] Lba0Sense { get; set; } + public string Lba0DecodedSense { get; set; } + public bool Lba0ScrambledReadable { get; set; } + public byte[] Lba0ScrambledData { get; set; } + public byte[] Lba0ScrambledSense { get; set; } + public string Lba0ScrambledDecodedSense { get; set; } + public bool Lba44990Readable { get; set; } + public byte[] Lba44990Data { get; set; } + public byte[] Lba44990Sense { get; set; } + public string Lba44990DecodedSense { get; set; } + public int Lba44990ReadableCluster { get; set; } + public bool Lba45000Readable { get; set; } + public byte[] Lba45000Data { get; set; } + public byte[] Lba45000Sense { get; set; } + public string Lba45000DecodedSense { get; set; } + public int Lba45000ReadableCluster { get; set; } + public bool Lba50000Readable { get; set; } + public byte[] Lba50000Data { get; set; } + public byte[] Lba50000Sense { get; set; } + public string Lba50000DecodedSense { get; set; } + public int Lba50000ReadableCluster { get; set; } + public bool Lba100000Readable { get; set; } + public byte[] Lba100000Data { get; set; } + public byte[] Lba100000Sense { get; set; } + public string Lba100000DecodedSense { get; set; } + public int Lba100000ReadableCluster { get; set; } + public bool Lba400000Readable { get; set; } + public byte[] Lba400000Data { get; set; } + public byte[] Lba400000Sense { get; set; } + public string Lba400000DecodedSense { get; set; } + public int Lba400000ReadableCluster { get; set; } + public bool Lba450000Readable { get; set; } + public byte[] Lba450000Data { get; set; } + public byte[] Lba450000Sense { get; set; } + public string Lba450000DecodedSense { get; set; } + public int Lba450000ReadableCluster { get; set; } + public bool Lba44990PqReadable { get; set; } + public byte[] Lba44990PqData { get; set; } + public byte[] Lba44990PqSense { get; set; } + public string Lba44990PqDecodedSense { get; set; } + public int Lba44990PqReadableCluster { get; set; } + public bool Lba45000PqReadable { get; set; } + public byte[] Lba45000PqData { get; set; } + public byte[] Lba45000PqSense { get; set; } + public string Lba45000PqDecodedSense { get; set; } + public int Lba45000PqReadableCluster { get; set; } + public bool Lba50000PqReadable { get; set; } + public byte[] Lba50000PqData { get; set; } + public byte[] Lba50000PqSense { get; set; } + public string Lba50000PqDecodedSense { get; set; } + public int Lba50000PqReadableCluster { get; set; } + public bool Lba100000PqReadable { get; set; } + public byte[] Lba100000PqData { get; set; } + public byte[] Lba100000PqSense { get; set; } + public string Lba100000PqDecodedSense { get; set; } + public int Lba100000PqReadableCluster { get; set; } + public bool Lba400000PqReadable { get; set; } + public byte[] Lba400000PqData { get; set; } + public byte[] Lba400000PqSense { get; set; } + public string Lba400000PqDecodedSense { get; set; } + public int Lba400000PqReadableCluster { get; set; } + public bool Lba450000PqReadable { get; set; } + public byte[] Lba450000PqData { get; set; } + public byte[] Lba450000PqSense { get; set; } + public string Lba450000PqDecodedSense { get; set; } + public int Lba450000PqReadableCluster { get; set; } + public bool Lba44990RwReadable { get; set; } + public byte[] Lba44990RwData { get; set; } + public byte[] Lba44990RwSense { get; set; } + public string Lba44990RwDecodedSense { get; set; } + public int Lba44990RwReadableCluster { get; set; } + public bool Lba45000RwReadable { get; set; } + public byte[] Lba45000RwData { get; set; } + public byte[] Lba45000RwSense { get; set; } + public string Lba45000RwDecodedSense { get; set; } + public int Lba45000RwReadableCluster { get; set; } + public bool Lba50000RwReadable { get; set; } + public byte[] Lba50000RwData { get; set; } + public byte[] Lba50000RwSense { get; set; } + public string Lba50000RwDecodedSense { get; set; } + public int Lba50000RwReadableCluster { get; set; } + public bool Lba100000RwReadable { get; set; } + public byte[] Lba100000RwData { get; set; } + public byte[] Lba100000RwSense { get; set; } + public string Lba100000RwDecodedSense { get; set; } + public int Lba100000RwReadableCluster { get; set; } + public bool Lba400000RwReadable { get; set; } + public byte[] Lba400000RwData { get; set; } + public byte[] Lba400000RwSense { get; set; } + public string Lba400000RwDecodedSense { get; set; } + public int Lba400000RwReadableCluster { get; set; } + public bool Lba450000RwReadable { get; set; } + public byte[] Lba450000RwData { get; set; } + public byte[] Lba450000RwSense { get; set; } + public string Lba450000RwDecodedSense { get; set; } + public int Lba450000RwReadableCluster { get; set; } + public bool Lba44990AudioReadable { get; set; } + public byte[] Lba44990AudioData { get; set; } + public byte[] Lba44990AudioSense { get; set; } + public string Lba44990AudioDecodedSense { get; set; } + public int Lba44990AudioReadableCluster { get; set; } + public bool Lba45000AudioReadable { get; set; } + public byte[] Lba45000AudioData { get; set; } + public byte[] Lba45000AudioSense { get; set; } + public string Lba45000AudioDecodedSense { get; set; } + public int Lba45000AudioReadableCluster { get; set; } + public bool Lba50000AudioReadable { get; set; } + public byte[] Lba50000AudioData { get; set; } + public byte[] Lba50000AudioSense { get; set; } + public string Lba50000AudioDecodedSense { get; set; } + public int Lba50000AudioReadableCluster { get; set; } + public bool Lba100000AudioReadable { get; set; } + public byte[] Lba100000AudioData { get; set; } + public byte[] Lba100000AudioSense { get; set; } + public string Lba100000AudioDecodedSense { get; set; } + public int Lba100000AudioReadableCluster { get; set; } + public bool Lba400000AudioReadable { get; set; } + public byte[] Lba400000AudioData { get; set; } + public byte[] Lba400000AudioSense { get; set; } + public string Lba400000AudioDecodedSense { get; set; } + public int Lba400000AudioReadableCluster { get; set; } + public bool Lba450000AudioReadable { get; set; } + public byte[] Lba450000AudioData { get; set; } + public byte[] Lba450000AudioSense { get; set; } + public string Lba450000AudioDecodedSense { get; set; } + public int Lba450000AudioReadableCluster { get; set; } + public bool Lba44990AudioPqReadable { get; set; } + public byte[] Lba44990AudioPqData { get; set; } + public byte[] Lba44990AudioPqSense { get; set; } + public string Lba44990AudioPqDecodedSense { get; set; } + public int Lba44990AudioPqReadableCluster { get; set; } + public bool Lba45000AudioPqReadable { get; set; } + public byte[] Lba45000AudioPqData { get; set; } + public byte[] Lba45000AudioPqSense { get; set; } + public string Lba45000AudioPqDecodedSense { get; set; } + public int Lba45000AudioPqReadableCluster { get; set; } + public bool Lba50000AudioPqReadable { get; set; } + public byte[] Lba50000AudioPqData { get; set; } + public byte[] Lba50000AudioPqSense { get; set; } + public string Lba50000AudioPqDecodedSense { get; set; } + public int Lba50000AudioPqReadableCluster { get; set; } + public bool Lba100000AudioPqReadable { get; set; } + public byte[] Lba100000AudioPqData { get; set; } + public byte[] Lba100000AudioPqSense { get; set; } + public string Lba100000AudioPqDecodedSense { get; set; } + public int Lba100000AudioPqReadableCluster { get; set; } + public bool Lba400000AudioPqReadable { get; set; } + public byte[] Lba400000AudioPqData { get; set; } + public byte[] Lba400000AudioPqSense { get; set; } + public string Lba400000AudioPqDecodedSense { get; set; } + public int Lba400000AudioPqReadableCluster { get; set; } + public bool Lba450000AudioPqReadable { get; set; } + public byte[] Lba450000AudioPqData { get; set; } + public byte[] Lba450000AudioPqSense { get; set; } + public string Lba450000AudioPqDecodedSense { get; set; } + public int Lba450000AudioPqReadableCluster { get; set; } + public bool Lba44990AudioRwReadable { get; set; } + public byte[] Lba44990AudioRwData { get; set; } + public byte[] Lba44990AudioRwSense { get; set; } + public string Lba44990AudioRwDecodedSense { get; set; } + public int Lba44990AudioRwReadableCluster { get; set; } + public bool Lba45000AudioRwReadable { get; set; } + public byte[] Lba45000AudioRwData { get; set; } + public byte[] Lba45000AudioRwSense { get; set; } + public string Lba45000AudioRwDecodedSense { get; set; } + public int Lba45000AudioRwReadableCluster { get; set; } + public bool Lba50000AudioRwReadable { get; set; } + public byte[] Lba50000AudioRwData { get; set; } + public byte[] Lba50000AudioRwSense { get; set; } + public string Lba50000AudioRwDecodedSense { get; set; } + public int Lba50000AudioRwReadableCluster { get; set; } + public bool Lba100000AudioRwReadable { get; set; } + public byte[] Lba100000AudioRwData { get; set; } + public byte[] Lba100000AudioRwSense { get; set; } + public string Lba100000AudioRwDecodedSense { get; set; } + public int Lba100000AudioRwReadableCluster { get; set; } + public bool Lba400000AudioRwReadable { get; set; } + public byte[] Lba400000AudioRwData { get; set; } + public byte[] Lba400000AudioRwSense { get; set; } + public string Lba400000AudioRwDecodedSense { get; set; } + public int Lba400000AudioRwReadableCluster { get; set; } + public bool Lba450000AudioRwReadable { get; set; } + public byte[] Lba450000AudioRwData { get; set; } + public byte[] Lba450000AudioRwSense { get; set; } + public string Lba450000AudioRwDecodedSense { get; set; } + public int Lba450000AudioRwReadableCluster { get; set; } + public uint MinimumReadableSectorInHdArea { get; set; } + public uint MaximumReadableSectorInHdArea { get; set; } + public byte[] MaximumReadablePqInHdArea { get; set; } + public byte[] MaximumReadableRwInHdArea { get; set; } } \ No newline at end of file diff --git a/Metadata/Dimensions.cs b/Metadata/Dimensions.cs index 433af18f7..b3423bfaf 100644 --- a/Metadata/Dimensions.cs +++ b/Metadata/Dimensions.cs @@ -40,1066 +40,1065 @@ using Schemas; #pragma warning disable 612 -namespace Aaru.CommonTypes.Metadata +namespace Aaru.CommonTypes.Metadata; + +/// Physical dimensions for media types +public static class Dimensions { - /// Physical dimensions for media types - public static class Dimensions + /// Gets the physical dimensions, in metadata expected format, for a given media type + /// Media type + /// Dimensions metadata + public static DimensionsType DimensionsFromMediaType(CommonTypes.MediaType dskType) { - /// Gets the physical dimensions, in metadata expected format, for a given media type - /// Media type - /// Dimensions metadata - public static DimensionsType DimensionsFromMediaType(CommonTypes.MediaType dskType) + var dmns = new DimensionsType(); + + switch(dskType) { - var dmns = new DimensionsType(); - - switch(dskType) - { - #region 5.25" floppy disk - case CommonTypes.MediaType.Apple32SS: - case CommonTypes.MediaType.Apple32DS: - case CommonTypes.MediaType.Apple33SS: - case CommonTypes.MediaType.Apple33DS: - case CommonTypes.MediaType.AppleFileWare: - case CommonTypes.MediaType.DOS_525_SS_DD_8: - case CommonTypes.MediaType.DOS_525_SS_DD_9: - case CommonTypes.MediaType.DOS_525_DS_DD_8: - case CommonTypes.MediaType.DOS_525_DS_DD_9: - case CommonTypes.MediaType.DOS_525_HD: - case CommonTypes.MediaType.XDF_525: - case CommonTypes.MediaType.ACORN_525_SS_SD_40: - case CommonTypes.MediaType.ACORN_525_SS_SD_80: - case CommonTypes.MediaType.ACORN_525_SS_DD_40: - case CommonTypes.MediaType.ACORN_525_SS_DD_80: - case CommonTypes.MediaType.ACORN_525_DS_DD: - case CommonTypes.MediaType.ATARI_525_SD: - case CommonTypes.MediaType.ATARI_525_ED: - case CommonTypes.MediaType.ATARI_525_DD: - case CommonTypes.MediaType.CBM_1540: - case CommonTypes.MediaType.CBM_1540_Ext: - case CommonTypes.MediaType.CBM_1571: - case CommonTypes.MediaType.ECMA_66: - case CommonTypes.MediaType.ECMA_70: - case CommonTypes.MediaType.NEC_525_HD: - case CommonTypes.MediaType.ECMA_78: - case CommonTypes.MediaType.ECMA_78_2: - case CommonTypes.MediaType.ECMA_99_8: - case CommonTypes.MediaType.ECMA_99_15: - case CommonTypes.MediaType.ECMA_99_26: - case CommonTypes.MediaType.FDFORMAT_525_DD: - case CommonTypes.MediaType.FDFORMAT_525_HD: - case CommonTypes.MediaType.MetaFloppy_Mod_I: - case CommonTypes.MediaType.MetaFloppy_Mod_II: - // According to ECMA-99 et al - dmns.Height = 133.3; - dmns.HeightSpecified = true; - dmns.Width = 133.3; - dmns.WidthSpecified = true; - dmns.Thickness = 1.65; - - return dmns; - #endregion 5.25" floppy disk - - #region 3.5" floppy disk - case CommonTypes.MediaType.AppleSonySS: - case CommonTypes.MediaType.AppleSonyDS: - case CommonTypes.MediaType.DOS_35_SS_DD_8: - case CommonTypes.MediaType.DOS_35_SS_DD_9: - case CommonTypes.MediaType.DOS_35_DS_DD_8: - case CommonTypes.MediaType.DOS_35_DS_DD_9: - case CommonTypes.MediaType.DOS_35_HD: - case CommonTypes.MediaType.DOS_35_ED: - case CommonTypes.MediaType.DMF: - case CommonTypes.MediaType.DMF_82: - case CommonTypes.MediaType.XDF_35: - case CommonTypes.MediaType.ACORN_35_DS_DD: - case CommonTypes.MediaType.CBM_35_DD: - case CommonTypes.MediaType.CBM_AMIGA_35_DD: - case CommonTypes.MediaType.CBM_AMIGA_35_HD: - case CommonTypes.MediaType.FDFORMAT_35_DD: - case CommonTypes.MediaType.FDFORMAT_35_HD: - case CommonTypes.MediaType.NEC_35_HD_8: - case CommonTypes.MediaType.NEC_35_HD_15: - case CommonTypes.MediaType.Floptical: - case CommonTypes.MediaType.HiFD: - case CommonTypes.MediaType.UHD144: - case CommonTypes.MediaType.Apricot_35: - case CommonTypes.MediaType.FD32MB: - // According to ECMA-100 et al - dmns.Height = 94; - dmns.HeightSpecified = true; - dmns.Width = 90; - dmns.WidthSpecified = true; - dmns.Thickness = 3.3; - - return dmns; - #endregion 3.5" floppy disk - - #region 8" floppy disk - case CommonTypes.MediaType.IBM23FD: - case CommonTypes.MediaType.IBM33FD_128: - case CommonTypes.MediaType.IBM33FD_256: - case CommonTypes.MediaType.IBM33FD_512: - case CommonTypes.MediaType.IBM43FD_128: - case CommonTypes.MediaType.IBM43FD_256: - case CommonTypes.MediaType.IBM53FD_256: - case CommonTypes.MediaType.IBM53FD_512: - case CommonTypes.MediaType.IBM53FD_1024: - case CommonTypes.MediaType.RX01: - case CommonTypes.MediaType.RX02: - case CommonTypes.MediaType.NEC_8_SD: - case CommonTypes.MediaType.NEC_8_DD: - case CommonTypes.MediaType.ECMA_54: - case CommonTypes.MediaType.ECMA_59: - case CommonTypes.MediaType.ECMA_69_8: - case CommonTypes.MediaType.ECMA_69_15: - case CommonTypes.MediaType.ECMA_69_26: - // According to ECMA-59 et al - dmns.Height = 203.2; - dmns.HeightSpecified = true; - dmns.Width = 203.2; - dmns.WidthSpecified = true; - dmns.Thickness = 1.65; - - return dmns; - #endregion 8" floppy disk - - #region 356mm magneto optical - case CommonTypes.MediaType.ECMA_260: - case CommonTypes.MediaType.ECMA_260_Double: - // According to ECMA-260 et al - dmns.Height = 421.84; - dmns.HeightSpecified = true; - dmns.Width = 443.76; - dmns.WidthSpecified = true; - dmns.Thickness = 25.4; - - return dmns; - #endregion 356mm magneto optical - - #region 300mm magneto optical - case CommonTypes.MediaType.ECMA_189: - case CommonTypes.MediaType.ECMA_190: - case CommonTypes.MediaType.ECMA_317: - // According to ECMA-317 et al - dmns.Height = 340; - dmns.HeightSpecified = true; - dmns.Width = 320; - dmns.WidthSpecified = true; - dmns.Thickness = 17; - - return dmns; - #endregion 300mm magneto optical - - #region 5.25" magneto optical - case CommonTypes.MediaType.ECMA_153: - case CommonTypes.MediaType.ECMA_153_512: - case CommonTypes.MediaType.ECMA_183_512: - case CommonTypes.MediaType.ECMA_183: - case CommonTypes.MediaType.ECMA_184_512: - case CommonTypes.MediaType.ECMA_184: - case CommonTypes.MediaType.ECMA_195: - case CommonTypes.MediaType.ECMA_195_512: - case CommonTypes.MediaType.ECMA_238: - case CommonTypes.MediaType.ECMA_280: - case CommonTypes.MediaType.ECMA_322: - case CommonTypes.MediaType.ECMA_322_2k: - case CommonTypes.MediaType.UDO: - case CommonTypes.MediaType.UDO2: - case CommonTypes.MediaType.UDO2_WORM: - case CommonTypes.MediaType.ISO_15286: - case CommonTypes.MediaType.ISO_15286_1024: - case CommonTypes.MediaType.ISO_15286_512: - case CommonTypes.MediaType.ISO_10089: - case CommonTypes.MediaType.ISO_10089_512: - case CommonTypes.MediaType.ECMA_322_1k: - case CommonTypes.MediaType.ECMA_322_512: - case CommonTypes.MediaType.ISO_14517: - case CommonTypes.MediaType.ISO_14517_512: - // According to ECMA-183 et al - dmns.Height = 153; - dmns.HeightSpecified = true; - dmns.Width = 135; - dmns.WidthSpecified = true; - dmns.Thickness = 11; - - return dmns; - #endregion 5.25" magneto optical - - #region 3.5" magneto optical - case CommonTypes.MediaType.ECMA_154: - case CommonTypes.MediaType.ECMA_201: - case CommonTypes.MediaType.ECMA_201_ROM: - case CommonTypes.MediaType.ECMA_223: - case CommonTypes.MediaType.ECMA_223_512: - case CommonTypes.MediaType.GigaMo: - case CommonTypes.MediaType.GigaMo2: - case CommonTypes.MediaType.ISO_15041_512: - // According to ECMA-154 et al - dmns.Height = 94; - dmns.HeightSpecified = true; - dmns.Width = 90; - dmns.WidthSpecified = true; - dmns.Thickness = 6; - - return dmns; - #endregion 3.5" magneto optical - - case CommonTypes.MediaType.PD650: - case CommonTypes.MediaType.PD650_WORM: - dmns.Height = 135; - dmns.HeightSpecified = true; - dmns.Width = 124; - dmns.WidthSpecified = true; - dmns.Thickness = 7.8; - - return dmns; - case CommonTypes.MediaType.ECMA_239: - dmns.Height = 97; - dmns.HeightSpecified = true; - dmns.Width = 92; - dmns.WidthSpecified = true; - dmns.Thickness = 5; - - return dmns; - case CommonTypes.MediaType.MMCmicro: - dmns.Height = 14; - dmns.HeightSpecified = true; - dmns.Width = 12; - dmns.WidthSpecified = true; - dmns.Thickness = 1.1; - - return dmns; - case CommonTypes.MediaType.MemoryStickMicro: - dmns.Height = 15; - dmns.HeightSpecified = true; - dmns.Width = 12.5; - dmns.WidthSpecified = true; - dmns.Thickness = 1.2; - - return dmns; - case CommonTypes.MediaType.microSD: - dmns.Height = 11; - dmns.HeightSpecified = true; - dmns.Width = 15; - dmns.WidthSpecified = true; - dmns.Thickness = 1; - - return dmns; - case CommonTypes.MediaType.miniSD: - dmns.Height = 21.5; - dmns.HeightSpecified = true; - dmns.Width = 20; - dmns.WidthSpecified = true; - dmns.Thickness = 1.4; - - return dmns; - case CommonTypes.MediaType.QIC3010: - case CommonTypes.MediaType.QIC3020: - case CommonTypes.MediaType.QIC3080: - case CommonTypes.MediaType.QIC3095: - case CommonTypes.MediaType.QIC320: - case CommonTypes.MediaType.QIC40: - case CommonTypes.MediaType.QIC80: - dmns.Height = 20; - dmns.HeightSpecified = true; - dmns.Width = 21.5; - dmns.WidthSpecified = true; - dmns.Thickness = 1.6; - - return dmns; - case CommonTypes.MediaType.RSMMC: - dmns.Height = 18; - dmns.HeightSpecified = true; - dmns.Width = 24; - dmns.WidthSpecified = true; - dmns.Thickness = 1.4; - - return dmns; - case CommonTypes.MediaType.MMC: - dmns.Height = 32; - dmns.HeightSpecified = true; - dmns.Width = 24; - dmns.WidthSpecified = true; - dmns.Thickness = 1.4; - - return dmns; - case CommonTypes.MediaType.SecureDigital: - dmns.Height = 32; - dmns.HeightSpecified = true; - dmns.Width = 24; - dmns.WidthSpecified = true; - dmns.Thickness = 2.1; - - return dmns; - case CommonTypes.MediaType.xD: - dmns.Height = 20; - dmns.HeightSpecified = true; - dmns.Width = 25; - dmns.WidthSpecified = true; - dmns.Thickness = 1.78; - - return dmns; - case CommonTypes.MediaType.XQD: - dmns.Height = 38.5; - dmns.HeightSpecified = true; - dmns.Width = 29.8; - dmns.WidthSpecified = true; - dmns.Thickness = 3.8; - - return dmns; - case CommonTypes.MediaType.MemoryStickDuo: - case CommonTypes.MediaType.MemoryStickProDuo: - dmns.Height = 20; - dmns.HeightSpecified = true; - dmns.Width = 31; - dmns.WidthSpecified = true; - dmns.Thickness = 1.6; - - return dmns; - case CommonTypes.MediaType.Nintendo3DSGameCard: - case CommonTypes.MediaType.NintendoDSGameCard: - case CommonTypes.MediaType.NintendoDSiGameCard: - dmns.Height = 35; - dmns.HeightSpecified = true; - dmns.Width = 33; - dmns.WidthSpecified = true; - dmns.Thickness = 3.8; - - return dmns; - case CommonTypes.MediaType.DataPlay: - dmns.Height = 42; - dmns.HeightSpecified = true; - dmns.Width = 33.5; - dmns.WidthSpecified = true; - dmns.Thickness = 3; - - return dmns; - case CommonTypes.MediaType.Microdrive: - dmns.Height = 44; - dmns.HeightSpecified = true; - dmns.Width = 34; - dmns.WidthSpecified = true; - dmns.Thickness = 8; - - return dmns; - case CommonTypes.MediaType.ExpressCard34: - dmns.Height = 75; - dmns.HeightSpecified = true; - dmns.Width = 34; - dmns.WidthSpecified = true; - dmns.Thickness = 5; - - return dmns; - case CommonTypes.MediaType.SmartMedia: - dmns.Height = 45; - dmns.HeightSpecified = true; - dmns.Width = 37; - dmns.WidthSpecified = true; - dmns.Thickness = 0.76; - - return dmns; - case CommonTypes.MediaType.MiniCard: - dmns.Height = 45; - dmns.HeightSpecified = true; - dmns.Width = 37; - dmns.WidthSpecified = true; - dmns.Thickness = 3.5; - - return dmns; - case CommonTypes.MediaType.PlayStationMemoryCard: - case CommonTypes.MediaType.PlayStationMemoryCard2: - dmns.Height = 55.7; - dmns.HeightSpecified = true; - dmns.Width = 41.5; - dmns.WidthSpecified = true; - dmns.Thickness = 7; - - return dmns; - case CommonTypes.MediaType.CFast: - case CommonTypes.MediaType.CompactFlash: - dmns.Height = 36; - dmns.HeightSpecified = true; - dmns.Width = 43; - dmns.WidthSpecified = true; - dmns.Thickness = 3.3; - - return dmns; - case CommonTypes.MediaType.CompactFlashType2: - dmns.Height = 36; - dmns.HeightSpecified = true; - dmns.Width = 43; - dmns.WidthSpecified = true; - dmns.Thickness = 5; - - return dmns; - case CommonTypes.MediaType.ZXMicrodrive: - dmns.Height = 36; - dmns.HeightSpecified = true; - dmns.Width = 43; - dmns.WidthSpecified = true; - dmns.Thickness = 5; - - return dmns; - case CommonTypes.MediaType.MemoryStick: - case CommonTypes.MediaType.MemoryStickPro: - dmns.Height = 21; - dmns.HeightSpecified = true; - dmns.Width = 50; - dmns.WidthSpecified = true; - dmns.Thickness = 2.6; - - return dmns; - case CommonTypes.MediaType.PocketZip: - dmns.Height = 54.5; - dmns.HeightSpecified = true; - dmns.Width = 50; - dmns.WidthSpecified = true; - dmns.Thickness = 2; - - return dmns; - case CommonTypes.MediaType.ExpressCard54: - dmns.Height = 75; - dmns.HeightSpecified = true; - dmns.Width = 54; - dmns.WidthSpecified = true; - dmns.Thickness = 5; - - return dmns; - case CommonTypes.MediaType.PCCardTypeI: - dmns.Height = 85.6; - dmns.HeightSpecified = true; - dmns.Width = 54; - dmns.WidthSpecified = true; - dmns.Thickness = 3.3; - - return dmns; - case CommonTypes.MediaType.PCCardTypeII: - dmns.Height = 85.6; - dmns.HeightSpecified = true; - dmns.Width = 54; - dmns.WidthSpecified = true; - dmns.Thickness = 5; - - return dmns; - case CommonTypes.MediaType.PCCardTypeIII: - dmns.Height = 85.6; - dmns.HeightSpecified = true; - dmns.Width = 54; - dmns.WidthSpecified = true; - dmns.Thickness = 10.5; - - return dmns; - case CommonTypes.MediaType.PCCardTypeIV: - dmns.Height = 85.6; - dmns.HeightSpecified = true; - dmns.Width = 54; - dmns.WidthSpecified = true; - dmns.Thickness = 16; - - return dmns; - case CommonTypes.MediaType.DataStore: - dmns.Height = 86.5; - dmns.HeightSpecified = true; - dmns.Width = 54; - dmns.WidthSpecified = true; - dmns.Thickness = 2.5; - - return dmns; - case CommonTypes.MediaType.VideoFloppy: - dmns.Height = 54; - dmns.HeightSpecified = true; - dmns.Width = 60; - dmns.WidthSpecified = true; - dmns.Thickness = 3.5; - - return dmns; - case CommonTypes.MediaType.VXA1: - case CommonTypes.MediaType.VXA2: - case CommonTypes.MediaType.VXA3: - dmns.Height = 95; - dmns.HeightSpecified = true; - dmns.Width = 62.5; - dmns.WidthSpecified = true; - dmns.Thickness = 15; - - return dmns; - case CommonTypes.MediaType.MiniDV: - dmns.Height = 47.5; - dmns.HeightSpecified = true; - dmns.Width = 66; - dmns.WidthSpecified = true; - dmns.Thickness = 12; - - return dmns; - case CommonTypes.MediaType.Wafer: - dmns.Height = 46.8; - dmns.HeightSpecified = true; - dmns.Width = 67.1; - dmns.WidthSpecified = true; - dmns.Thickness = 7.9; - - return dmns; - case CommonTypes.MediaType.NintendoDiskCard: - dmns.Height = 76.2; - dmns.HeightSpecified = true; - dmns.Width = 71.12; - dmns.WidthSpecified = true; - dmns.Thickness = 0; - - return dmns; - case CommonTypes.MediaType.HiMD: - case CommonTypes.MediaType.MD: - case CommonTypes.MediaType.MDData: - case CommonTypes.MediaType.MDData2: - case CommonTypes.MediaType.MD60: - case CommonTypes.MediaType.MD74: - case CommonTypes.MediaType.MD80: - dmns.Height = 68; - dmns.HeightSpecified = true; - dmns.Width = 71.5; - dmns.WidthSpecified = true; - dmns.Thickness = 4.8; - - return dmns; - case CommonTypes.MediaType.DAT160: - case CommonTypes.MediaType.DAT320: - case CommonTypes.MediaType.DAT72: - case CommonTypes.MediaType.DDS1: - case CommonTypes.MediaType.DDS2: - case CommonTypes.MediaType.DDS3: - case CommonTypes.MediaType.DDS4: - case CommonTypes.MediaType.DigitalAudioTape: - dmns.Height = 54; - dmns.HeightSpecified = true; - dmns.Width = 73; - dmns.WidthSpecified = true; - dmns.Thickness = 10.5; - - return dmns; - case CommonTypes.MediaType.CompactFloppy: - dmns.Height = 100; - dmns.HeightSpecified = true; - dmns.Width = 80; - dmns.WidthSpecified = true; - dmns.Thickness = 5; - - return dmns; - case CommonTypes.MediaType.DECtapeII: - dmns.Height = 60; - dmns.HeightSpecified = true; - dmns.Width = 81; - dmns.WidthSpecified = true; - dmns.Thickness = 13; - - return dmns; - case CommonTypes.MediaType.Ditto: - dmns.Height = 60; - dmns.HeightSpecified = true; - dmns.Width = 81; - dmns.WidthSpecified = true; - dmns.Thickness = 14; - - return dmns; - case CommonTypes.MediaType.DittoMax: - dmns.Height = 126; - dmns.HeightSpecified = true; - dmns.Width = 81; - dmns.WidthSpecified = true; - dmns.Thickness = 14; - - return dmns; - case CommonTypes.MediaType.RDX: - case CommonTypes.MediaType.RDX320: - dmns.Height = 119; - dmns.HeightSpecified = true; - dmns.Width = 87; - dmns.WidthSpecified = true; - dmns.Thickness = 23; - - return dmns; - case CommonTypes.MediaType.LS120: - case CommonTypes.MediaType.LS240: - dmns.Height = 94; - dmns.HeightSpecified = true; - dmns.Width = 90; - dmns.WidthSpecified = true; - dmns.Thickness = 3.5; - - return dmns; - case CommonTypes.MediaType.Travan: - case CommonTypes.MediaType.Travan3: - case CommonTypes.MediaType.Travan4: - case CommonTypes.MediaType.Travan5: - case CommonTypes.MediaType.Travan7: - dmns.Height = 72; - dmns.HeightSpecified = true; - dmns.Width = 92; - dmns.WidthSpecified = true; - dmns.Thickness = 15; - - return dmns; - case CommonTypes.MediaType.Travan1Ex: - dmns.Height = 0; - dmns.HeightSpecified = true; - dmns.Width = 92; - dmns.WidthSpecified = true; - dmns.Thickness = 15; - - return dmns; - case CommonTypes.MediaType.Travan3Ex: - dmns.Height = 0; - dmns.HeightSpecified = true; - dmns.Width = 92; - dmns.WidthSpecified = true; - dmns.Thickness = 15; - - return dmns; - case CommonTypes.MediaType.ADR2120: - case CommonTypes.MediaType.ADR260: - case CommonTypes.MediaType.ADR30: - case CommonTypes.MediaType.ADR50: - dmns.Height = 129; - dmns.HeightSpecified = true; - dmns.Width = 93; - dmns.WidthSpecified = true; - dmns.Thickness = 14.5; - - return dmns; - case CommonTypes.MediaType.Data8: - case CommonTypes.MediaType.AIT1: - case CommonTypes.MediaType.AIT1Turbo: - case CommonTypes.MediaType.AIT2: - case CommonTypes.MediaType.AIT2Turbo: - case CommonTypes.MediaType.AIT3: - case CommonTypes.MediaType.AIT3Ex: - case CommonTypes.MediaType.AIT3Turbo: - case CommonTypes.MediaType.AIT4: - case CommonTypes.MediaType.AIT5: - case CommonTypes.MediaType.AITETurbo: - case CommonTypes.MediaType.Exatape106m: - case CommonTypes.MediaType.Exatape160mXL: - case CommonTypes.MediaType.Exatape112m: - case CommonTypes.MediaType.Exatape125m: - case CommonTypes.MediaType.Exatape150m: - case CommonTypes.MediaType.Exatape15m: - case CommonTypes.MediaType.Exatape170m: - case CommonTypes.MediaType.Exatape225m: - case CommonTypes.MediaType.Exatape22m: - case CommonTypes.MediaType.Exatape22mAME: - case CommonTypes.MediaType.Exatape28m: - case CommonTypes.MediaType.Exatape40m: - case CommonTypes.MediaType.Exatape45m: - case CommonTypes.MediaType.Exatape54m: - case CommonTypes.MediaType.Exatape75m: - case CommonTypes.MediaType.Exatape76m: - case CommonTypes.MediaType.Exatape80m: - dmns.Height = 62.5; - dmns.HeightSpecified = true; - dmns.Width = 95; - dmns.WidthSpecified = true; - dmns.Thickness = 15; - - return dmns; - case CommonTypes.MediaType.EZ135: - case CommonTypes.MediaType.EZ230: - case CommonTypes.MediaType.SQ327: - dmns.Height = 97; - dmns.HeightSpecified = true; - dmns.Width = 98; - dmns.WidthSpecified = true; - dmns.Thickness = 9.5; - - return dmns; - case CommonTypes.MediaType.SQ400: - case CommonTypes.MediaType.SQ800: - case CommonTypes.MediaType.SQ2000: - dmns.Height = 137; - dmns.HeightSpecified = true; - dmns.Width = 137; - dmns.WidthSpecified = true; - dmns.Thickness = 12; - - return dmns; - case CommonTypes.MediaType.ZIP100: - case CommonTypes.MediaType.ZIP250: - case CommonTypes.MediaType.ZIP750: - dmns.Height = 98.5; - dmns.HeightSpecified = true; - dmns.Width = 98; - dmns.WidthSpecified = true; - dmns.Thickness = 6.5; - - return dmns; - case CommonTypes.MediaType.Jaz: - case CommonTypes.MediaType.Jaz2: - dmns.Height = 102; - dmns.HeightSpecified = true; - dmns.Width = 98; - dmns.WidthSpecified = true; - dmns.Thickness = 12; - - return dmns; - case CommonTypes.MediaType.Orb: - case CommonTypes.MediaType.Orb5: - dmns.Height = 104; - dmns.HeightSpecified = true; - dmns.Width = 98; - dmns.WidthSpecified = true; - dmns.Thickness = 8; - - return dmns; - case CommonTypes.MediaType.SparQ: - dmns.Height = 98; - dmns.HeightSpecified = true; - dmns.Width = 100; - dmns.WidthSpecified = true; - dmns.Thickness = 9.7; - - return dmns; - case CommonTypes.MediaType.ProfessionalDisc: - case CommonTypes.MediaType.ProfessionalDiscDual: - case CommonTypes.MediaType.ProfessionalDiscTriple: - case CommonTypes.MediaType.ProfessionalDiscQuad: - case CommonTypes.MediaType.PDD: - case CommonTypes.MediaType.PDD_WORM: - dmns.Height = 130; - dmns.HeightSpecified = true; - dmns.Width = 128.5; - dmns.WidthSpecified = true; - dmns.Thickness = 9; - - return dmns; - case CommonTypes.MediaType.SLR1: - case CommonTypes.MediaType.SLR2: - case CommonTypes.MediaType.SLR3: - case CommonTypes.MediaType.SLR32: - case CommonTypes.MediaType.SLR32SL: - case CommonTypes.MediaType.SLR4: - case CommonTypes.MediaType.SLR5: - case CommonTypes.MediaType.SLR5SL: - case CommonTypes.MediaType.SLR6: - case CommonTypes.MediaType.SLRtape100: - case CommonTypes.MediaType.SLRtape140: - case CommonTypes.MediaType.SLRtape24: - case CommonTypes.MediaType.SLRtape24SL: - case CommonTypes.MediaType.SLRtape40: - case CommonTypes.MediaType.SLRtape50: - case CommonTypes.MediaType.SLRtape60: - case CommonTypes.MediaType.SLRtape7: - case CommonTypes.MediaType.SLRtape75: - case CommonTypes.MediaType.SLRtape7SL: - dmns.Height = 150; - dmns.HeightSpecified = true; - dmns.Width = 100; - dmns.WidthSpecified = true; - dmns.Thickness = 18; - - return dmns; - case CommonTypes.MediaType.N64DD: - dmns.Height = 103.124; - dmns.HeightSpecified = true; - dmns.Width = 101.092; - dmns.WidthSpecified = true; - dmns.Thickness = 10.16; - - return dmns; - case CommonTypes.MediaType.CompactTapeI: - case CommonTypes.MediaType.CompactTapeII: - case CommonTypes.MediaType.DLTtapeIII: - case CommonTypes.MediaType.DLTtapeIIIxt: - case CommonTypes.MediaType.DLTtapeIV: - case CommonTypes.MediaType.DLTtapeS4: - case CommonTypes.MediaType.SDLT1: - case CommonTypes.MediaType.SDLT2: - case CommonTypes.MediaType.VStapeI: - dmns.Height = 105; - dmns.HeightSpecified = true; - dmns.Width = 105; - dmns.WidthSpecified = true; - dmns.Thickness = 25; - - return dmns; - case CommonTypes.MediaType.LTO: - case CommonTypes.MediaType.LTO2: - case CommonTypes.MediaType.LTO3: - case CommonTypes.MediaType.LTO3WORM: - case CommonTypes.MediaType.LTO4: - case CommonTypes.MediaType.LTO4WORM: - case CommonTypes.MediaType.LTO5: - case CommonTypes.MediaType.LTO5WORM: - case CommonTypes.MediaType.LTO6: - case CommonTypes.MediaType.LTO6WORM: - case CommonTypes.MediaType.LTO7: - case CommonTypes.MediaType.LTO7WORM: - dmns.Height = 101.6; - dmns.HeightSpecified = true; - dmns.Width = 105.41; - dmns.WidthSpecified = true; - dmns.Thickness = 21.59; - - return dmns; - case CommonTypes.MediaType.IBM3480: - case CommonTypes.MediaType.IBM3490: - case CommonTypes.MediaType.IBM3490E: - case CommonTypes.MediaType.IBM3592: - dmns.Height = 125.73; - dmns.HeightSpecified = true; - dmns.Width = 107.95; - dmns.WidthSpecified = true; - dmns.Thickness = 25.4; - - return dmns; - case CommonTypes.MediaType.T9840A: - case CommonTypes.MediaType.T9840B: - case CommonTypes.MediaType.T9840C: - case CommonTypes.MediaType.T9840D: - case CommonTypes.MediaType.T9940A: - case CommonTypes.MediaType.T9940B: - dmns.Height = 124.46; - dmns.HeightSpecified = true; - dmns.Width = 109.22; - dmns.WidthSpecified = true; - dmns.Thickness = 25.4; - - return dmns; - case CommonTypes.MediaType.CompactCassette: - case CommonTypes.MediaType.Dcas25: - case CommonTypes.MediaType.Dcas85: - case CommonTypes.MediaType.Dcas103: - dmns.Height = 63.5; - dmns.HeightSpecified = true; - dmns.Width = 128; - dmns.WidthSpecified = true; - dmns.Thickness = 12; - - return dmns; - case CommonTypes.MediaType.IBM3470: - dmns.Height = 58.42; - dmns.HeightSpecified = true; - dmns.Width = 137.16; - dmns.WidthSpecified = true; - dmns.Thickness = 16.51; - - return dmns; - case CommonTypes.MediaType.MLR1: - case CommonTypes.MediaType.MLR3: - case CommonTypes.MediaType.MLR1SL: - dmns.Height = 101.6; - dmns.HeightSpecified = true; - dmns.Width = 152.4; - dmns.WidthSpecified = true; - dmns.Thickness = 15.24; - - return dmns; - case CommonTypes.MediaType.QIC11: - case CommonTypes.MediaType.QIC120: - case CommonTypes.MediaType.QIC1350: - case CommonTypes.MediaType.QIC150: - case CommonTypes.MediaType.QIC24: - case CommonTypes.MediaType.QIC525: - dmns.Height = 101.6; - dmns.HeightSpecified = true; - dmns.Width = 154.2; - dmns.WidthSpecified = true; - dmns.Thickness = 16.6; - - return dmns; - case CommonTypes.MediaType.Bernoulli: - case CommonTypes.MediaType.Bernoulli10: - case CommonTypes.MediaType.Bernoulli20: - dmns.Height = 280; - dmns.HeightSpecified = true; - dmns.Width = 209; - dmns.WidthSpecified = true; - dmns.Thickness = 18; - - return dmns; - case CommonTypes.MediaType.Bernoulli2: - case CommonTypes.MediaType.BernoulliBox2_20: - case CommonTypes.MediaType.Bernoulli35: - case CommonTypes.MediaType.Bernoulli44: - case CommonTypes.MediaType.Bernoulli65: - case CommonTypes.MediaType.Bernoulli90: - case CommonTypes.MediaType.Bernoulli105: - case CommonTypes.MediaType.Bernoulli150: - case CommonTypes.MediaType.Bernoulli230: - dmns.Height = 138; - dmns.HeightSpecified = true; - dmns.Width = 136; - dmns.WidthSpecified = true; - dmns.Thickness = 9; - - return dmns; - case CommonTypes.MediaType.DTF: - case CommonTypes.MediaType.DTF2: - dmns.Height = 144.78; - dmns.HeightSpecified = true; - dmns.Width = 254; - dmns.WidthSpecified = true; - dmns.Thickness = 25.4; - - return dmns; - case CommonTypes.MediaType.LD: - case CommonTypes.MediaType.LDROM: - case CommonTypes.MediaType.LDROM2: - case CommonTypes.MediaType.MegaLD: - case CommonTypes.MediaType.LVROM: - dmns.Diameter = 300; - dmns.DiameterSpecified = true; - dmns.Thickness = 2.5; - - return dmns; - case CommonTypes.MediaType.CRVdisc: - dmns.Height = 344; - dmns.HeightSpecified = true; - dmns.Width = 325; - dmns.WidthSpecified = true; - dmns.Thickness = 15.6; - - return dmns; - case CommonTypes.MediaType.REV35: - case CommonTypes.MediaType.REV70: - case CommonTypes.MediaType.REV120: - dmns.Height = 74.8; - dmns.HeightSpecified = true; - dmns.Width = 76.8; - dmns.WidthSpecified = true; - dmns.Thickness = 10; - - return dmns; - - #region CD/DVD/BD - case CommonTypes.MediaType.CDDA: - case CommonTypes.MediaType.CDG: - case CommonTypes.MediaType.CDEG: - case CommonTypes.MediaType.CDI: - case CommonTypes.MediaType.CDROM: - case CommonTypes.MediaType.CDROMXA: - case CommonTypes.MediaType.CDPLUS: - case CommonTypes.MediaType.CDMO: - case CommonTypes.MediaType.CDR: - case CommonTypes.MediaType.CDRW: - case CommonTypes.MediaType.CDMRW: - case CommonTypes.MediaType.VCD: - case CommonTypes.MediaType.SVCD: - case CommonTypes.MediaType.PCD: - case CommonTypes.MediaType.SACD: - case CommonTypes.MediaType.DDCD: - case CommonTypes.MediaType.DDCDR: - case CommonTypes.MediaType.DDCDRW: - case CommonTypes.MediaType.DTSCD: - case CommonTypes.MediaType.CDMIDI: - case CommonTypes.MediaType.CDV: - case CommonTypes.MediaType.CD: - case CommonTypes.MediaType.DVDROM: - case CommonTypes.MediaType.DVDR: - case CommonTypes.MediaType.DVDRW: - case CommonTypes.MediaType.DVDPR: - case CommonTypes.MediaType.DVDPRW: - case CommonTypes.MediaType.DVDPRWDL: - case CommonTypes.MediaType.DVDRDL: - case CommonTypes.MediaType.DVDPRDL: - case CommonTypes.MediaType.DVDRAM: - case CommonTypes.MediaType.DVDRWDL: - case CommonTypes.MediaType.DVDDownload: - case CommonTypes.MediaType.HDDVDROM: - case CommonTypes.MediaType.HDDVDRAM: - case CommonTypes.MediaType.HDDVDR: - case CommonTypes.MediaType.HDDVDRW: - case CommonTypes.MediaType.HDDVDRDL: - case CommonTypes.MediaType.HDDVDRWDL: - case CommonTypes.MediaType.BDROM: - case CommonTypes.MediaType.BDR: - case CommonTypes.MediaType.BDRE: - case CommonTypes.MediaType.BDRXL: - case CommonTypes.MediaType.BDREXL: - case CommonTypes.MediaType.PS1CD: - case CommonTypes.MediaType.PS2CD: - case CommonTypes.MediaType.PS2DVD: - case CommonTypes.MediaType.PS3DVD: - case CommonTypes.MediaType.PS3BD: - case CommonTypes.MediaType.PS4BD: - case CommonTypes.MediaType.PS5BD: - case CommonTypes.MediaType.XGD: - case CommonTypes.MediaType.XGD2: - case CommonTypes.MediaType.XGD3: - case CommonTypes.MediaType.XGD4: - case CommonTypes.MediaType.MEGACD: - case CommonTypes.MediaType.SATURNCD: - case CommonTypes.MediaType.GDROM: - case CommonTypes.MediaType.GDR: - case CommonTypes.MediaType.SuperCDROM2: - case CommonTypes.MediaType.JaguarCD: - case CommonTypes.MediaType.ThreeDO: - case CommonTypes.MediaType.WOD: - case CommonTypes.MediaType.WUOD: - case CommonTypes.MediaType.PCFX: - case CommonTypes.MediaType.CDIREADY: - case CommonTypes.MediaType.FMTOWNS: - case CommonTypes.MediaType.CDTV: - case CommonTypes.MediaType.CD32: - case CommonTypes.MediaType.Nuon: - case CommonTypes.MediaType.Playdia: - case CommonTypes.MediaType.Pippin: - case CommonTypes.MediaType.MilCD: - case CommonTypes.MediaType.CVD: - case CommonTypes.MediaType.UHDBD: - dmns.Diameter = 120; - dmns.DiameterSpecified = true; - dmns.Thickness = 1.2; - - return dmns; - case CommonTypes.MediaType.GOD: - dmns.Diameter = 80; - dmns.DiameterSpecified = true; - dmns.Thickness = 1.2; - - return dmns; - case CommonTypes.MediaType.VideoNow: - dmns.Diameter = 85; - dmns.DiameterSpecified = true; - dmns.Thickness = 1.2; - - return dmns; - case CommonTypes.MediaType.VideoNowColor: - case CommonTypes.MediaType.VideoNowXp: - dmns.Diameter = 108; - dmns.DiameterSpecified = true; - dmns.Thickness = 1.2; - - return dmns; - #endregion CD/DVD/BD - - #region Apple Hard Disks - // TODO: Find Apple Widget size - case CommonTypes.MediaType.AppleProfile: - dmns.Height = 223.8; - dmns.HeightSpecified = true; - dmns.Width = 438.9; - dmns.WidthSpecified = true; - dmns.Thickness = 111.5; - - return dmns; - case CommonTypes.MediaType.AppleHD20: - dmns.Height = 246.4; - dmns.HeightSpecified = true; - dmns.Width = 266.7; - dmns.WidthSpecified = true; - dmns.Thickness = 78.7; - - return dmns; - #endregion Apple Hard Disks - - case CommonTypes.MediaType.UMD: - dmns.Height = 64; - dmns.HeightSpecified = true; - dmns.Width = 63; - dmns.WidthSpecified = true; - dmns.Thickness = 4; - - return dmns; - default: return null; - } + #region 5.25" floppy disk + case CommonTypes.MediaType.Apple32SS: + case CommonTypes.MediaType.Apple32DS: + case CommonTypes.MediaType.Apple33SS: + case CommonTypes.MediaType.Apple33DS: + case CommonTypes.MediaType.AppleFileWare: + case CommonTypes.MediaType.DOS_525_SS_DD_8: + case CommonTypes.MediaType.DOS_525_SS_DD_9: + case CommonTypes.MediaType.DOS_525_DS_DD_8: + case CommonTypes.MediaType.DOS_525_DS_DD_9: + case CommonTypes.MediaType.DOS_525_HD: + case CommonTypes.MediaType.XDF_525: + case CommonTypes.MediaType.ACORN_525_SS_SD_40: + case CommonTypes.MediaType.ACORN_525_SS_SD_80: + case CommonTypes.MediaType.ACORN_525_SS_DD_40: + case CommonTypes.MediaType.ACORN_525_SS_DD_80: + case CommonTypes.MediaType.ACORN_525_DS_DD: + case CommonTypes.MediaType.ATARI_525_SD: + case CommonTypes.MediaType.ATARI_525_ED: + case CommonTypes.MediaType.ATARI_525_DD: + case CommonTypes.MediaType.CBM_1540: + case CommonTypes.MediaType.CBM_1540_Ext: + case CommonTypes.MediaType.CBM_1571: + case CommonTypes.MediaType.ECMA_66: + case CommonTypes.MediaType.ECMA_70: + case CommonTypes.MediaType.NEC_525_HD: + case CommonTypes.MediaType.ECMA_78: + case CommonTypes.MediaType.ECMA_78_2: + case CommonTypes.MediaType.ECMA_99_8: + case CommonTypes.MediaType.ECMA_99_15: + case CommonTypes.MediaType.ECMA_99_26: + case CommonTypes.MediaType.FDFORMAT_525_DD: + case CommonTypes.MediaType.FDFORMAT_525_HD: + case CommonTypes.MediaType.MetaFloppy_Mod_I: + case CommonTypes.MediaType.MetaFloppy_Mod_II: + // According to ECMA-99 et al + dmns.Height = 133.3; + dmns.HeightSpecified = true; + dmns.Width = 133.3; + dmns.WidthSpecified = true; + dmns.Thickness = 1.65; + + return dmns; + #endregion 5.25" floppy disk + + #region 3.5" floppy disk + case CommonTypes.MediaType.AppleSonySS: + case CommonTypes.MediaType.AppleSonyDS: + case CommonTypes.MediaType.DOS_35_SS_DD_8: + case CommonTypes.MediaType.DOS_35_SS_DD_9: + case CommonTypes.MediaType.DOS_35_DS_DD_8: + case CommonTypes.MediaType.DOS_35_DS_DD_9: + case CommonTypes.MediaType.DOS_35_HD: + case CommonTypes.MediaType.DOS_35_ED: + case CommonTypes.MediaType.DMF: + case CommonTypes.MediaType.DMF_82: + case CommonTypes.MediaType.XDF_35: + case CommonTypes.MediaType.ACORN_35_DS_DD: + case CommonTypes.MediaType.CBM_35_DD: + case CommonTypes.MediaType.CBM_AMIGA_35_DD: + case CommonTypes.MediaType.CBM_AMIGA_35_HD: + case CommonTypes.MediaType.FDFORMAT_35_DD: + case CommonTypes.MediaType.FDFORMAT_35_HD: + case CommonTypes.MediaType.NEC_35_HD_8: + case CommonTypes.MediaType.NEC_35_HD_15: + case CommonTypes.MediaType.Floptical: + case CommonTypes.MediaType.HiFD: + case CommonTypes.MediaType.UHD144: + case CommonTypes.MediaType.Apricot_35: + case CommonTypes.MediaType.FD32MB: + // According to ECMA-100 et al + dmns.Height = 94; + dmns.HeightSpecified = true; + dmns.Width = 90; + dmns.WidthSpecified = true; + dmns.Thickness = 3.3; + + return dmns; + #endregion 3.5" floppy disk + + #region 8" floppy disk + case CommonTypes.MediaType.IBM23FD: + case CommonTypes.MediaType.IBM33FD_128: + case CommonTypes.MediaType.IBM33FD_256: + case CommonTypes.MediaType.IBM33FD_512: + case CommonTypes.MediaType.IBM43FD_128: + case CommonTypes.MediaType.IBM43FD_256: + case CommonTypes.MediaType.IBM53FD_256: + case CommonTypes.MediaType.IBM53FD_512: + case CommonTypes.MediaType.IBM53FD_1024: + case CommonTypes.MediaType.RX01: + case CommonTypes.MediaType.RX02: + case CommonTypes.MediaType.NEC_8_SD: + case CommonTypes.MediaType.NEC_8_DD: + case CommonTypes.MediaType.ECMA_54: + case CommonTypes.MediaType.ECMA_59: + case CommonTypes.MediaType.ECMA_69_8: + case CommonTypes.MediaType.ECMA_69_15: + case CommonTypes.MediaType.ECMA_69_26: + // According to ECMA-59 et al + dmns.Height = 203.2; + dmns.HeightSpecified = true; + dmns.Width = 203.2; + dmns.WidthSpecified = true; + dmns.Thickness = 1.65; + + return dmns; + #endregion 8" floppy disk + + #region 356mm magneto optical + case CommonTypes.MediaType.ECMA_260: + case CommonTypes.MediaType.ECMA_260_Double: + // According to ECMA-260 et al + dmns.Height = 421.84; + dmns.HeightSpecified = true; + dmns.Width = 443.76; + dmns.WidthSpecified = true; + dmns.Thickness = 25.4; + + return dmns; + #endregion 356mm magneto optical + + #region 300mm magneto optical + case CommonTypes.MediaType.ECMA_189: + case CommonTypes.MediaType.ECMA_190: + case CommonTypes.MediaType.ECMA_317: + // According to ECMA-317 et al + dmns.Height = 340; + dmns.HeightSpecified = true; + dmns.Width = 320; + dmns.WidthSpecified = true; + dmns.Thickness = 17; + + return dmns; + #endregion 300mm magneto optical + + #region 5.25" magneto optical + case CommonTypes.MediaType.ECMA_153: + case CommonTypes.MediaType.ECMA_153_512: + case CommonTypes.MediaType.ECMA_183_512: + case CommonTypes.MediaType.ECMA_183: + case CommonTypes.MediaType.ECMA_184_512: + case CommonTypes.MediaType.ECMA_184: + case CommonTypes.MediaType.ECMA_195: + case CommonTypes.MediaType.ECMA_195_512: + case CommonTypes.MediaType.ECMA_238: + case CommonTypes.MediaType.ECMA_280: + case CommonTypes.MediaType.ECMA_322: + case CommonTypes.MediaType.ECMA_322_2k: + case CommonTypes.MediaType.UDO: + case CommonTypes.MediaType.UDO2: + case CommonTypes.MediaType.UDO2_WORM: + case CommonTypes.MediaType.ISO_15286: + case CommonTypes.MediaType.ISO_15286_1024: + case CommonTypes.MediaType.ISO_15286_512: + case CommonTypes.MediaType.ISO_10089: + case CommonTypes.MediaType.ISO_10089_512: + case CommonTypes.MediaType.ECMA_322_1k: + case CommonTypes.MediaType.ECMA_322_512: + case CommonTypes.MediaType.ISO_14517: + case CommonTypes.MediaType.ISO_14517_512: + // According to ECMA-183 et al + dmns.Height = 153; + dmns.HeightSpecified = true; + dmns.Width = 135; + dmns.WidthSpecified = true; + dmns.Thickness = 11; + + return dmns; + #endregion 5.25" magneto optical + + #region 3.5" magneto optical + case CommonTypes.MediaType.ECMA_154: + case CommonTypes.MediaType.ECMA_201: + case CommonTypes.MediaType.ECMA_201_ROM: + case CommonTypes.MediaType.ECMA_223: + case CommonTypes.MediaType.ECMA_223_512: + case CommonTypes.MediaType.GigaMo: + case CommonTypes.MediaType.GigaMo2: + case CommonTypes.MediaType.ISO_15041_512: + // According to ECMA-154 et al + dmns.Height = 94; + dmns.HeightSpecified = true; + dmns.Width = 90; + dmns.WidthSpecified = true; + dmns.Thickness = 6; + + return dmns; + #endregion 3.5" magneto optical + + case CommonTypes.MediaType.PD650: + case CommonTypes.MediaType.PD650_WORM: + dmns.Height = 135; + dmns.HeightSpecified = true; + dmns.Width = 124; + dmns.WidthSpecified = true; + dmns.Thickness = 7.8; + + return dmns; + case CommonTypes.MediaType.ECMA_239: + dmns.Height = 97; + dmns.HeightSpecified = true; + dmns.Width = 92; + dmns.WidthSpecified = true; + dmns.Thickness = 5; + + return dmns; + case CommonTypes.MediaType.MMCmicro: + dmns.Height = 14; + dmns.HeightSpecified = true; + dmns.Width = 12; + dmns.WidthSpecified = true; + dmns.Thickness = 1.1; + + return dmns; + case CommonTypes.MediaType.MemoryStickMicro: + dmns.Height = 15; + dmns.HeightSpecified = true; + dmns.Width = 12.5; + dmns.WidthSpecified = true; + dmns.Thickness = 1.2; + + return dmns; + case CommonTypes.MediaType.microSD: + dmns.Height = 11; + dmns.HeightSpecified = true; + dmns.Width = 15; + dmns.WidthSpecified = true; + dmns.Thickness = 1; + + return dmns; + case CommonTypes.MediaType.miniSD: + dmns.Height = 21.5; + dmns.HeightSpecified = true; + dmns.Width = 20; + dmns.WidthSpecified = true; + dmns.Thickness = 1.4; + + return dmns; + case CommonTypes.MediaType.QIC3010: + case CommonTypes.MediaType.QIC3020: + case CommonTypes.MediaType.QIC3080: + case CommonTypes.MediaType.QIC3095: + case CommonTypes.MediaType.QIC320: + case CommonTypes.MediaType.QIC40: + case CommonTypes.MediaType.QIC80: + dmns.Height = 20; + dmns.HeightSpecified = true; + dmns.Width = 21.5; + dmns.WidthSpecified = true; + dmns.Thickness = 1.6; + + return dmns; + case CommonTypes.MediaType.RSMMC: + dmns.Height = 18; + dmns.HeightSpecified = true; + dmns.Width = 24; + dmns.WidthSpecified = true; + dmns.Thickness = 1.4; + + return dmns; + case CommonTypes.MediaType.MMC: + dmns.Height = 32; + dmns.HeightSpecified = true; + dmns.Width = 24; + dmns.WidthSpecified = true; + dmns.Thickness = 1.4; + + return dmns; + case CommonTypes.MediaType.SecureDigital: + dmns.Height = 32; + dmns.HeightSpecified = true; + dmns.Width = 24; + dmns.WidthSpecified = true; + dmns.Thickness = 2.1; + + return dmns; + case CommonTypes.MediaType.xD: + dmns.Height = 20; + dmns.HeightSpecified = true; + dmns.Width = 25; + dmns.WidthSpecified = true; + dmns.Thickness = 1.78; + + return dmns; + case CommonTypes.MediaType.XQD: + dmns.Height = 38.5; + dmns.HeightSpecified = true; + dmns.Width = 29.8; + dmns.WidthSpecified = true; + dmns.Thickness = 3.8; + + return dmns; + case CommonTypes.MediaType.MemoryStickDuo: + case CommonTypes.MediaType.MemoryStickProDuo: + dmns.Height = 20; + dmns.HeightSpecified = true; + dmns.Width = 31; + dmns.WidthSpecified = true; + dmns.Thickness = 1.6; + + return dmns; + case CommonTypes.MediaType.Nintendo3DSGameCard: + case CommonTypes.MediaType.NintendoDSGameCard: + case CommonTypes.MediaType.NintendoDSiGameCard: + dmns.Height = 35; + dmns.HeightSpecified = true; + dmns.Width = 33; + dmns.WidthSpecified = true; + dmns.Thickness = 3.8; + + return dmns; + case CommonTypes.MediaType.DataPlay: + dmns.Height = 42; + dmns.HeightSpecified = true; + dmns.Width = 33.5; + dmns.WidthSpecified = true; + dmns.Thickness = 3; + + return dmns; + case CommonTypes.MediaType.Microdrive: + dmns.Height = 44; + dmns.HeightSpecified = true; + dmns.Width = 34; + dmns.WidthSpecified = true; + dmns.Thickness = 8; + + return dmns; + case CommonTypes.MediaType.ExpressCard34: + dmns.Height = 75; + dmns.HeightSpecified = true; + dmns.Width = 34; + dmns.WidthSpecified = true; + dmns.Thickness = 5; + + return dmns; + case CommonTypes.MediaType.SmartMedia: + dmns.Height = 45; + dmns.HeightSpecified = true; + dmns.Width = 37; + dmns.WidthSpecified = true; + dmns.Thickness = 0.76; + + return dmns; + case CommonTypes.MediaType.MiniCard: + dmns.Height = 45; + dmns.HeightSpecified = true; + dmns.Width = 37; + dmns.WidthSpecified = true; + dmns.Thickness = 3.5; + + return dmns; + case CommonTypes.MediaType.PlayStationMemoryCard: + case CommonTypes.MediaType.PlayStationMemoryCard2: + dmns.Height = 55.7; + dmns.HeightSpecified = true; + dmns.Width = 41.5; + dmns.WidthSpecified = true; + dmns.Thickness = 7; + + return dmns; + case CommonTypes.MediaType.CFast: + case CommonTypes.MediaType.CompactFlash: + dmns.Height = 36; + dmns.HeightSpecified = true; + dmns.Width = 43; + dmns.WidthSpecified = true; + dmns.Thickness = 3.3; + + return dmns; + case CommonTypes.MediaType.CompactFlashType2: + dmns.Height = 36; + dmns.HeightSpecified = true; + dmns.Width = 43; + dmns.WidthSpecified = true; + dmns.Thickness = 5; + + return dmns; + case CommonTypes.MediaType.ZXMicrodrive: + dmns.Height = 36; + dmns.HeightSpecified = true; + dmns.Width = 43; + dmns.WidthSpecified = true; + dmns.Thickness = 5; + + return dmns; + case CommonTypes.MediaType.MemoryStick: + case CommonTypes.MediaType.MemoryStickPro: + dmns.Height = 21; + dmns.HeightSpecified = true; + dmns.Width = 50; + dmns.WidthSpecified = true; + dmns.Thickness = 2.6; + + return dmns; + case CommonTypes.MediaType.PocketZip: + dmns.Height = 54.5; + dmns.HeightSpecified = true; + dmns.Width = 50; + dmns.WidthSpecified = true; + dmns.Thickness = 2; + + return dmns; + case CommonTypes.MediaType.ExpressCard54: + dmns.Height = 75; + dmns.HeightSpecified = true; + dmns.Width = 54; + dmns.WidthSpecified = true; + dmns.Thickness = 5; + + return dmns; + case CommonTypes.MediaType.PCCardTypeI: + dmns.Height = 85.6; + dmns.HeightSpecified = true; + dmns.Width = 54; + dmns.WidthSpecified = true; + dmns.Thickness = 3.3; + + return dmns; + case CommonTypes.MediaType.PCCardTypeII: + dmns.Height = 85.6; + dmns.HeightSpecified = true; + dmns.Width = 54; + dmns.WidthSpecified = true; + dmns.Thickness = 5; + + return dmns; + case CommonTypes.MediaType.PCCardTypeIII: + dmns.Height = 85.6; + dmns.HeightSpecified = true; + dmns.Width = 54; + dmns.WidthSpecified = true; + dmns.Thickness = 10.5; + + return dmns; + case CommonTypes.MediaType.PCCardTypeIV: + dmns.Height = 85.6; + dmns.HeightSpecified = true; + dmns.Width = 54; + dmns.WidthSpecified = true; + dmns.Thickness = 16; + + return dmns; + case CommonTypes.MediaType.DataStore: + dmns.Height = 86.5; + dmns.HeightSpecified = true; + dmns.Width = 54; + dmns.WidthSpecified = true; + dmns.Thickness = 2.5; + + return dmns; + case CommonTypes.MediaType.VideoFloppy: + dmns.Height = 54; + dmns.HeightSpecified = true; + dmns.Width = 60; + dmns.WidthSpecified = true; + dmns.Thickness = 3.5; + + return dmns; + case CommonTypes.MediaType.VXA1: + case CommonTypes.MediaType.VXA2: + case CommonTypes.MediaType.VXA3: + dmns.Height = 95; + dmns.HeightSpecified = true; + dmns.Width = 62.5; + dmns.WidthSpecified = true; + dmns.Thickness = 15; + + return dmns; + case CommonTypes.MediaType.MiniDV: + dmns.Height = 47.5; + dmns.HeightSpecified = true; + dmns.Width = 66; + dmns.WidthSpecified = true; + dmns.Thickness = 12; + + return dmns; + case CommonTypes.MediaType.Wafer: + dmns.Height = 46.8; + dmns.HeightSpecified = true; + dmns.Width = 67.1; + dmns.WidthSpecified = true; + dmns.Thickness = 7.9; + + return dmns; + case CommonTypes.MediaType.NintendoDiskCard: + dmns.Height = 76.2; + dmns.HeightSpecified = true; + dmns.Width = 71.12; + dmns.WidthSpecified = true; + dmns.Thickness = 0; + + return dmns; + case CommonTypes.MediaType.HiMD: + case CommonTypes.MediaType.MD: + case CommonTypes.MediaType.MDData: + case CommonTypes.MediaType.MDData2: + case CommonTypes.MediaType.MD60: + case CommonTypes.MediaType.MD74: + case CommonTypes.MediaType.MD80: + dmns.Height = 68; + dmns.HeightSpecified = true; + dmns.Width = 71.5; + dmns.WidthSpecified = true; + dmns.Thickness = 4.8; + + return dmns; + case CommonTypes.MediaType.DAT160: + case CommonTypes.MediaType.DAT320: + case CommonTypes.MediaType.DAT72: + case CommonTypes.MediaType.DDS1: + case CommonTypes.MediaType.DDS2: + case CommonTypes.MediaType.DDS3: + case CommonTypes.MediaType.DDS4: + case CommonTypes.MediaType.DigitalAudioTape: + dmns.Height = 54; + dmns.HeightSpecified = true; + dmns.Width = 73; + dmns.WidthSpecified = true; + dmns.Thickness = 10.5; + + return dmns; + case CommonTypes.MediaType.CompactFloppy: + dmns.Height = 100; + dmns.HeightSpecified = true; + dmns.Width = 80; + dmns.WidthSpecified = true; + dmns.Thickness = 5; + + return dmns; + case CommonTypes.MediaType.DECtapeII: + dmns.Height = 60; + dmns.HeightSpecified = true; + dmns.Width = 81; + dmns.WidthSpecified = true; + dmns.Thickness = 13; + + return dmns; + case CommonTypes.MediaType.Ditto: + dmns.Height = 60; + dmns.HeightSpecified = true; + dmns.Width = 81; + dmns.WidthSpecified = true; + dmns.Thickness = 14; + + return dmns; + case CommonTypes.MediaType.DittoMax: + dmns.Height = 126; + dmns.HeightSpecified = true; + dmns.Width = 81; + dmns.WidthSpecified = true; + dmns.Thickness = 14; + + return dmns; + case CommonTypes.MediaType.RDX: + case CommonTypes.MediaType.RDX320: + dmns.Height = 119; + dmns.HeightSpecified = true; + dmns.Width = 87; + dmns.WidthSpecified = true; + dmns.Thickness = 23; + + return dmns; + case CommonTypes.MediaType.LS120: + case CommonTypes.MediaType.LS240: + dmns.Height = 94; + dmns.HeightSpecified = true; + dmns.Width = 90; + dmns.WidthSpecified = true; + dmns.Thickness = 3.5; + + return dmns; + case CommonTypes.MediaType.Travan: + case CommonTypes.MediaType.Travan3: + case CommonTypes.MediaType.Travan4: + case CommonTypes.MediaType.Travan5: + case CommonTypes.MediaType.Travan7: + dmns.Height = 72; + dmns.HeightSpecified = true; + dmns.Width = 92; + dmns.WidthSpecified = true; + dmns.Thickness = 15; + + return dmns; + case CommonTypes.MediaType.Travan1Ex: + dmns.Height = 0; + dmns.HeightSpecified = true; + dmns.Width = 92; + dmns.WidthSpecified = true; + dmns.Thickness = 15; + + return dmns; + case CommonTypes.MediaType.Travan3Ex: + dmns.Height = 0; + dmns.HeightSpecified = true; + dmns.Width = 92; + dmns.WidthSpecified = true; + dmns.Thickness = 15; + + return dmns; + case CommonTypes.MediaType.ADR2120: + case CommonTypes.MediaType.ADR260: + case CommonTypes.MediaType.ADR30: + case CommonTypes.MediaType.ADR50: + dmns.Height = 129; + dmns.HeightSpecified = true; + dmns.Width = 93; + dmns.WidthSpecified = true; + dmns.Thickness = 14.5; + + return dmns; + case CommonTypes.MediaType.Data8: + case CommonTypes.MediaType.AIT1: + case CommonTypes.MediaType.AIT1Turbo: + case CommonTypes.MediaType.AIT2: + case CommonTypes.MediaType.AIT2Turbo: + case CommonTypes.MediaType.AIT3: + case CommonTypes.MediaType.AIT3Ex: + case CommonTypes.MediaType.AIT3Turbo: + case CommonTypes.MediaType.AIT4: + case CommonTypes.MediaType.AIT5: + case CommonTypes.MediaType.AITETurbo: + case CommonTypes.MediaType.Exatape106m: + case CommonTypes.MediaType.Exatape160mXL: + case CommonTypes.MediaType.Exatape112m: + case CommonTypes.MediaType.Exatape125m: + case CommonTypes.MediaType.Exatape150m: + case CommonTypes.MediaType.Exatape15m: + case CommonTypes.MediaType.Exatape170m: + case CommonTypes.MediaType.Exatape225m: + case CommonTypes.MediaType.Exatape22m: + case CommonTypes.MediaType.Exatape22mAME: + case CommonTypes.MediaType.Exatape28m: + case CommonTypes.MediaType.Exatape40m: + case CommonTypes.MediaType.Exatape45m: + case CommonTypes.MediaType.Exatape54m: + case CommonTypes.MediaType.Exatape75m: + case CommonTypes.MediaType.Exatape76m: + case CommonTypes.MediaType.Exatape80m: + dmns.Height = 62.5; + dmns.HeightSpecified = true; + dmns.Width = 95; + dmns.WidthSpecified = true; + dmns.Thickness = 15; + + return dmns; + case CommonTypes.MediaType.EZ135: + case CommonTypes.MediaType.EZ230: + case CommonTypes.MediaType.SQ327: + dmns.Height = 97; + dmns.HeightSpecified = true; + dmns.Width = 98; + dmns.WidthSpecified = true; + dmns.Thickness = 9.5; + + return dmns; + case CommonTypes.MediaType.SQ400: + case CommonTypes.MediaType.SQ800: + case CommonTypes.MediaType.SQ2000: + dmns.Height = 137; + dmns.HeightSpecified = true; + dmns.Width = 137; + dmns.WidthSpecified = true; + dmns.Thickness = 12; + + return dmns; + case CommonTypes.MediaType.ZIP100: + case CommonTypes.MediaType.ZIP250: + case CommonTypes.MediaType.ZIP750: + dmns.Height = 98.5; + dmns.HeightSpecified = true; + dmns.Width = 98; + dmns.WidthSpecified = true; + dmns.Thickness = 6.5; + + return dmns; + case CommonTypes.MediaType.Jaz: + case CommonTypes.MediaType.Jaz2: + dmns.Height = 102; + dmns.HeightSpecified = true; + dmns.Width = 98; + dmns.WidthSpecified = true; + dmns.Thickness = 12; + + return dmns; + case CommonTypes.MediaType.Orb: + case CommonTypes.MediaType.Orb5: + dmns.Height = 104; + dmns.HeightSpecified = true; + dmns.Width = 98; + dmns.WidthSpecified = true; + dmns.Thickness = 8; + + return dmns; + case CommonTypes.MediaType.SparQ: + dmns.Height = 98; + dmns.HeightSpecified = true; + dmns.Width = 100; + dmns.WidthSpecified = true; + dmns.Thickness = 9.7; + + return dmns; + case CommonTypes.MediaType.ProfessionalDisc: + case CommonTypes.MediaType.ProfessionalDiscDual: + case CommonTypes.MediaType.ProfessionalDiscTriple: + case CommonTypes.MediaType.ProfessionalDiscQuad: + case CommonTypes.MediaType.PDD: + case CommonTypes.MediaType.PDD_WORM: + dmns.Height = 130; + dmns.HeightSpecified = true; + dmns.Width = 128.5; + dmns.WidthSpecified = true; + dmns.Thickness = 9; + + return dmns; + case CommonTypes.MediaType.SLR1: + case CommonTypes.MediaType.SLR2: + case CommonTypes.MediaType.SLR3: + case CommonTypes.MediaType.SLR32: + case CommonTypes.MediaType.SLR32SL: + case CommonTypes.MediaType.SLR4: + case CommonTypes.MediaType.SLR5: + case CommonTypes.MediaType.SLR5SL: + case CommonTypes.MediaType.SLR6: + case CommonTypes.MediaType.SLRtape100: + case CommonTypes.MediaType.SLRtape140: + case CommonTypes.MediaType.SLRtape24: + case CommonTypes.MediaType.SLRtape24SL: + case CommonTypes.MediaType.SLRtape40: + case CommonTypes.MediaType.SLRtape50: + case CommonTypes.MediaType.SLRtape60: + case CommonTypes.MediaType.SLRtape7: + case CommonTypes.MediaType.SLRtape75: + case CommonTypes.MediaType.SLRtape7SL: + dmns.Height = 150; + dmns.HeightSpecified = true; + dmns.Width = 100; + dmns.WidthSpecified = true; + dmns.Thickness = 18; + + return dmns; + case CommonTypes.MediaType.N64DD: + dmns.Height = 103.124; + dmns.HeightSpecified = true; + dmns.Width = 101.092; + dmns.WidthSpecified = true; + dmns.Thickness = 10.16; + + return dmns; + case CommonTypes.MediaType.CompactTapeI: + case CommonTypes.MediaType.CompactTapeII: + case CommonTypes.MediaType.DLTtapeIII: + case CommonTypes.MediaType.DLTtapeIIIxt: + case CommonTypes.MediaType.DLTtapeIV: + case CommonTypes.MediaType.DLTtapeS4: + case CommonTypes.MediaType.SDLT1: + case CommonTypes.MediaType.SDLT2: + case CommonTypes.MediaType.VStapeI: + dmns.Height = 105; + dmns.HeightSpecified = true; + dmns.Width = 105; + dmns.WidthSpecified = true; + dmns.Thickness = 25; + + return dmns; + case CommonTypes.MediaType.LTO: + case CommonTypes.MediaType.LTO2: + case CommonTypes.MediaType.LTO3: + case CommonTypes.MediaType.LTO3WORM: + case CommonTypes.MediaType.LTO4: + case CommonTypes.MediaType.LTO4WORM: + case CommonTypes.MediaType.LTO5: + case CommonTypes.MediaType.LTO5WORM: + case CommonTypes.MediaType.LTO6: + case CommonTypes.MediaType.LTO6WORM: + case CommonTypes.MediaType.LTO7: + case CommonTypes.MediaType.LTO7WORM: + dmns.Height = 101.6; + dmns.HeightSpecified = true; + dmns.Width = 105.41; + dmns.WidthSpecified = true; + dmns.Thickness = 21.59; + + return dmns; + case CommonTypes.MediaType.IBM3480: + case CommonTypes.MediaType.IBM3490: + case CommonTypes.MediaType.IBM3490E: + case CommonTypes.MediaType.IBM3592: + dmns.Height = 125.73; + dmns.HeightSpecified = true; + dmns.Width = 107.95; + dmns.WidthSpecified = true; + dmns.Thickness = 25.4; + + return dmns; + case CommonTypes.MediaType.T9840A: + case CommonTypes.MediaType.T9840B: + case CommonTypes.MediaType.T9840C: + case CommonTypes.MediaType.T9840D: + case CommonTypes.MediaType.T9940A: + case CommonTypes.MediaType.T9940B: + dmns.Height = 124.46; + dmns.HeightSpecified = true; + dmns.Width = 109.22; + dmns.WidthSpecified = true; + dmns.Thickness = 25.4; + + return dmns; + case CommonTypes.MediaType.CompactCassette: + case CommonTypes.MediaType.Dcas25: + case CommonTypes.MediaType.Dcas85: + case CommonTypes.MediaType.Dcas103: + dmns.Height = 63.5; + dmns.HeightSpecified = true; + dmns.Width = 128; + dmns.WidthSpecified = true; + dmns.Thickness = 12; + + return dmns; + case CommonTypes.MediaType.IBM3470: + dmns.Height = 58.42; + dmns.HeightSpecified = true; + dmns.Width = 137.16; + dmns.WidthSpecified = true; + dmns.Thickness = 16.51; + + return dmns; + case CommonTypes.MediaType.MLR1: + case CommonTypes.MediaType.MLR3: + case CommonTypes.MediaType.MLR1SL: + dmns.Height = 101.6; + dmns.HeightSpecified = true; + dmns.Width = 152.4; + dmns.WidthSpecified = true; + dmns.Thickness = 15.24; + + return dmns; + case CommonTypes.MediaType.QIC11: + case CommonTypes.MediaType.QIC120: + case CommonTypes.MediaType.QIC1350: + case CommonTypes.MediaType.QIC150: + case CommonTypes.MediaType.QIC24: + case CommonTypes.MediaType.QIC525: + dmns.Height = 101.6; + dmns.HeightSpecified = true; + dmns.Width = 154.2; + dmns.WidthSpecified = true; + dmns.Thickness = 16.6; + + return dmns; + case CommonTypes.MediaType.Bernoulli: + case CommonTypes.MediaType.Bernoulli10: + case CommonTypes.MediaType.Bernoulli20: + dmns.Height = 280; + dmns.HeightSpecified = true; + dmns.Width = 209; + dmns.WidthSpecified = true; + dmns.Thickness = 18; + + return dmns; + case CommonTypes.MediaType.Bernoulli2: + case CommonTypes.MediaType.BernoulliBox2_20: + case CommonTypes.MediaType.Bernoulli35: + case CommonTypes.MediaType.Bernoulli44: + case CommonTypes.MediaType.Bernoulli65: + case CommonTypes.MediaType.Bernoulli90: + case CommonTypes.MediaType.Bernoulli105: + case CommonTypes.MediaType.Bernoulli150: + case CommonTypes.MediaType.Bernoulli230: + dmns.Height = 138; + dmns.HeightSpecified = true; + dmns.Width = 136; + dmns.WidthSpecified = true; + dmns.Thickness = 9; + + return dmns; + case CommonTypes.MediaType.DTF: + case CommonTypes.MediaType.DTF2: + dmns.Height = 144.78; + dmns.HeightSpecified = true; + dmns.Width = 254; + dmns.WidthSpecified = true; + dmns.Thickness = 25.4; + + return dmns; + case CommonTypes.MediaType.LD: + case CommonTypes.MediaType.LDROM: + case CommonTypes.MediaType.LDROM2: + case CommonTypes.MediaType.MegaLD: + case CommonTypes.MediaType.LVROM: + dmns.Diameter = 300; + dmns.DiameterSpecified = true; + dmns.Thickness = 2.5; + + return dmns; + case CommonTypes.MediaType.CRVdisc: + dmns.Height = 344; + dmns.HeightSpecified = true; + dmns.Width = 325; + dmns.WidthSpecified = true; + dmns.Thickness = 15.6; + + return dmns; + case CommonTypes.MediaType.REV35: + case CommonTypes.MediaType.REV70: + case CommonTypes.MediaType.REV120: + dmns.Height = 74.8; + dmns.HeightSpecified = true; + dmns.Width = 76.8; + dmns.WidthSpecified = true; + dmns.Thickness = 10; + + return dmns; + + #region CD/DVD/BD + case CommonTypes.MediaType.CDDA: + case CommonTypes.MediaType.CDG: + case CommonTypes.MediaType.CDEG: + case CommonTypes.MediaType.CDI: + case CommonTypes.MediaType.CDROM: + case CommonTypes.MediaType.CDROMXA: + case CommonTypes.MediaType.CDPLUS: + case CommonTypes.MediaType.CDMO: + case CommonTypes.MediaType.CDR: + case CommonTypes.MediaType.CDRW: + case CommonTypes.MediaType.CDMRW: + case CommonTypes.MediaType.VCD: + case CommonTypes.MediaType.SVCD: + case CommonTypes.MediaType.PCD: + case CommonTypes.MediaType.SACD: + case CommonTypes.MediaType.DDCD: + case CommonTypes.MediaType.DDCDR: + case CommonTypes.MediaType.DDCDRW: + case CommonTypes.MediaType.DTSCD: + case CommonTypes.MediaType.CDMIDI: + case CommonTypes.MediaType.CDV: + case CommonTypes.MediaType.CD: + case CommonTypes.MediaType.DVDROM: + case CommonTypes.MediaType.DVDR: + case CommonTypes.MediaType.DVDRW: + case CommonTypes.MediaType.DVDPR: + case CommonTypes.MediaType.DVDPRW: + case CommonTypes.MediaType.DVDPRWDL: + case CommonTypes.MediaType.DVDRDL: + case CommonTypes.MediaType.DVDPRDL: + case CommonTypes.MediaType.DVDRAM: + case CommonTypes.MediaType.DVDRWDL: + case CommonTypes.MediaType.DVDDownload: + case CommonTypes.MediaType.HDDVDROM: + case CommonTypes.MediaType.HDDVDRAM: + case CommonTypes.MediaType.HDDVDR: + case CommonTypes.MediaType.HDDVDRW: + case CommonTypes.MediaType.HDDVDRDL: + case CommonTypes.MediaType.HDDVDRWDL: + case CommonTypes.MediaType.BDROM: + case CommonTypes.MediaType.BDR: + case CommonTypes.MediaType.BDRE: + case CommonTypes.MediaType.BDRXL: + case CommonTypes.MediaType.BDREXL: + case CommonTypes.MediaType.PS1CD: + case CommonTypes.MediaType.PS2CD: + case CommonTypes.MediaType.PS2DVD: + case CommonTypes.MediaType.PS3DVD: + case CommonTypes.MediaType.PS3BD: + case CommonTypes.MediaType.PS4BD: + case CommonTypes.MediaType.PS5BD: + case CommonTypes.MediaType.XGD: + case CommonTypes.MediaType.XGD2: + case CommonTypes.MediaType.XGD3: + case CommonTypes.MediaType.XGD4: + case CommonTypes.MediaType.MEGACD: + case CommonTypes.MediaType.SATURNCD: + case CommonTypes.MediaType.GDROM: + case CommonTypes.MediaType.GDR: + case CommonTypes.MediaType.SuperCDROM2: + case CommonTypes.MediaType.JaguarCD: + case CommonTypes.MediaType.ThreeDO: + case CommonTypes.MediaType.WOD: + case CommonTypes.MediaType.WUOD: + case CommonTypes.MediaType.PCFX: + case CommonTypes.MediaType.CDIREADY: + case CommonTypes.MediaType.FMTOWNS: + case CommonTypes.MediaType.CDTV: + case CommonTypes.MediaType.CD32: + case CommonTypes.MediaType.Nuon: + case CommonTypes.MediaType.Playdia: + case CommonTypes.MediaType.Pippin: + case CommonTypes.MediaType.MilCD: + case CommonTypes.MediaType.CVD: + case CommonTypes.MediaType.UHDBD: + dmns.Diameter = 120; + dmns.DiameterSpecified = true; + dmns.Thickness = 1.2; + + return dmns; + case CommonTypes.MediaType.GOD: + dmns.Diameter = 80; + dmns.DiameterSpecified = true; + dmns.Thickness = 1.2; + + return dmns; + case CommonTypes.MediaType.VideoNow: + dmns.Diameter = 85; + dmns.DiameterSpecified = true; + dmns.Thickness = 1.2; + + return dmns; + case CommonTypes.MediaType.VideoNowColor: + case CommonTypes.MediaType.VideoNowXp: + dmns.Diameter = 108; + dmns.DiameterSpecified = true; + dmns.Thickness = 1.2; + + return dmns; + #endregion CD/DVD/BD + + #region Apple Hard Disks + // TODO: Find Apple Widget size + case CommonTypes.MediaType.AppleProfile: + dmns.Height = 223.8; + dmns.HeightSpecified = true; + dmns.Width = 438.9; + dmns.WidthSpecified = true; + dmns.Thickness = 111.5; + + return dmns; + case CommonTypes.MediaType.AppleHD20: + dmns.Height = 246.4; + dmns.HeightSpecified = true; + dmns.Width = 266.7; + dmns.WidthSpecified = true; + dmns.Thickness = 78.7; + + return dmns; + #endregion Apple Hard Disks + + case CommonTypes.MediaType.UMD: + dmns.Height = 64; + dmns.HeightSpecified = true; + dmns.Width = 63; + dmns.WidthSpecified = true; + dmns.Thickness = 4; + + return dmns; + default: return null; } } } \ No newline at end of file diff --git a/Metadata/MediaType.cs b/Metadata/MediaType.cs index a19f985fe..6f1d5068e 100644 --- a/Metadata/MediaType.cs +++ b/Metadata/MediaType.cs @@ -37,2523 +37,2522 @@ // ****************************************************************************/ #pragma warning disable 612 -namespace Aaru.CommonTypes.Metadata +namespace Aaru.CommonTypes.Metadata; + +/// Handles media type for metadata +public static class MediaType { - /// Handles media type for metadata - public static class MediaType + /// Converts a media type of a pair of type and subtype strings to use in metadata + /// Media type + /// Media type and subtype for metadata + public static (string type, string subType) MediaTypeToString(CommonTypes.MediaType dskType) { - /// Converts a media type of a pair of type and subtype strings to use in metadata - /// Media type - /// Media type and subtype for metadata - public static (string type, string subType) MediaTypeToString(CommonTypes.MediaType dskType) + string discType; + string discSubType; + + switch(dskType) { - string discType; - string discSubType; - - switch(dskType) - { - case CommonTypes.MediaType.BDR: - discType = "Blu-ray"; - discSubType = "BD-R"; - - break; - case CommonTypes.MediaType.BDRE: - discType = "Blu-ray"; - discSubType = "BD-RE"; - - break; - case CommonTypes.MediaType.BDREXL: - discType = "Blu-ray"; - discSubType = "BD-RE XL"; - - break; - case CommonTypes.MediaType.BDROM: - discType = "Blu-ray"; - discSubType = "BD-ROM"; - - break; - case CommonTypes.MediaType.BDRXL: - discType = "Blu-ray"; - discSubType = "BD-R XL"; - - break; - case CommonTypes.MediaType.UHDBD: - discType = "Blu-ray"; - discSubType = "Ultra HD Blu-ray"; - - break; - case CommonTypes.MediaType.CBHD: - discType = "Blu-ray"; - discSubType = "CBHD"; - - break; - case CommonTypes.MediaType.CD: - discType = "Compact Disc"; - discSubType = "CD"; - - break; - case CommonTypes.MediaType.CDDA: - discType = "Compact Disc"; - discSubType = "CD Digital Audio"; - - break; - case CommonTypes.MediaType.CDEG: - discType = "Compact Disc"; - discSubType = "CD+EG"; - - break; - case CommonTypes.MediaType.CDG: - discType = "Compact Disc"; - discSubType = "CD+G"; - - break; - case CommonTypes.MediaType.CDI: - discType = "Compact Disc"; - discSubType = "CD-i"; - - break; - case CommonTypes.MediaType.CDIREADY: - discType = "Compact Disc"; - discSubType = "CD-i Ready"; - - break; - case CommonTypes.MediaType.CDMIDI: - discType = "Compact Disc"; - discSubType = "CD+MIDI"; - - break; - case CommonTypes.MediaType.CDMO: - discType = "Compact Disc"; - discSubType = "CD-MO"; - - break; - case CommonTypes.MediaType.CDMRW: - discType = "Compact Disc"; - discSubType = "CD-MRW"; - - break; - case CommonTypes.MediaType.CDPLUS: - discType = "Compact Disc"; - discSubType = "CD+"; - - break; - case CommonTypes.MediaType.CDR: - discType = "Compact Disc"; - discSubType = "CD-R"; - - break; - case CommonTypes.MediaType.CDROM: - discType = "Compact Disc"; - discSubType = "CD-ROM"; - - break; - case CommonTypes.MediaType.CDROMXA: - discType = "Compact Disc"; - discSubType = "CD-ROM XA"; - - break; - case CommonTypes.MediaType.CDRW: - discType = "Compact Disc"; - discSubType = "CD-RW"; - - break; - case CommonTypes.MediaType.CDV: - discType = "Compact Disc"; - discSubType = "CD-Video"; - - break; - case CommonTypes.MediaType.DDCD: - discType = "DDCD"; - discSubType = "DDCD"; - - break; - case CommonTypes.MediaType.DDCDR: - discType = "DDCD"; - discSubType = "DDCD-R"; - - break; - case CommonTypes.MediaType.DDCDRW: - discType = "DDCD"; - discSubType = "DDCD-RW"; - - break; - case CommonTypes.MediaType.DTSCD: - discType = "Compact Disc"; - discSubType = "DTS CD"; - - break; - case CommonTypes.MediaType.DVDDownload: - discType = "DVD"; - discSubType = "DVD-Download"; - - break; - case CommonTypes.MediaType.DVDPR: - discType = "DVD"; - discSubType = "DVD+R"; - - break; - case CommonTypes.MediaType.DVDPRDL: - discType = "DVD"; - discSubType = "DVD+R DL"; - - break; - case CommonTypes.MediaType.DVDPRW: - discType = "DVD"; - discSubType = "DVD+RW"; - - break; - case CommonTypes.MediaType.DVDPRWDL: - discType = "DVD"; - discSubType = "DVD+RW DL"; - - break; - case CommonTypes.MediaType.DVDR: - discType = "DVD"; - discSubType = "DVD-R"; - - break; - case CommonTypes.MediaType.DVDRAM: - discType = "DVD"; - discSubType = "DVD-RAM"; - - break; - case CommonTypes.MediaType.DVDRDL: - discType = "DVD"; - discSubType = "DVD-R DL"; - - break; - case CommonTypes.MediaType.DVDROM: - discType = "DVD"; - discSubType = "DVD-ROM"; - - break; - case CommonTypes.MediaType.DVDRW: - discType = "DVD"; - discSubType = "DVD-RW"; - - break; - case CommonTypes.MediaType.DVDRWDL: - discType = "DVD"; - discSubType = "DVD-RW DL"; - - break; - case CommonTypes.MediaType.EVD: - discType = "EVD"; - discSubType = "EVD"; - - break; - case CommonTypes.MediaType.FDDVD: - discType = "FDDVD"; - discSubType = "FDDVD"; - - break; - case CommonTypes.MediaType.FVD: - discType = "FVD"; - discSubType = "FVD"; - - break; - case CommonTypes.MediaType.GDR: - discType = "GD"; - discSubType = "GD-R"; - - break; - case CommonTypes.MediaType.GDROM: - discType = "GD"; - discSubType = "GD-ROM"; - - break; - case CommonTypes.MediaType.GOD: - discType = "DVD"; - discSubType = "GameCube Game Disc"; - - break; - case CommonTypes.MediaType.WOD: - discType = "DVD"; - discSubType = "Wii Optical Disc"; - - break; - case CommonTypes.MediaType.WUOD: - discType = "Blu-ray"; - discSubType = "Wii U Optical Disc"; - - break; - case CommonTypes.MediaType.HDDVDR: - discType = "HD DVD"; - discSubType = "HD DVD-R"; - - break; - case CommonTypes.MediaType.HDDVDRAM: - discType = "HD DVD"; - discSubType = "HD DVD-RAM"; - - break; - case CommonTypes.MediaType.HDDVDRDL: - discType = "HD DVD"; - discSubType = "HD DVD-R DL"; - - break; - case CommonTypes.MediaType.HDDVDROM: - discType = "HD DVD"; - discSubType = "HD DVD-ROM"; - - break; - case CommonTypes.MediaType.HDDVDRW: - discType = "HD DVD"; - discSubType = "HD DVD-RW"; - - break; - case CommonTypes.MediaType.HDDVDRWDL: - discType = "HD DVD"; - discSubType = "HD DVD-RW DL"; - - break; - case CommonTypes.MediaType.HDVMD: - discType = "HD VMD"; - discSubType = "HD VMD"; - - break; - case CommonTypes.MediaType.HiMD: - discType = "MiniDisc"; - discSubType = "Hi-MD"; - - break; - case CommonTypes.MediaType.HVD: - discType = "HVD"; - discSubType = "HVD"; - - break; - case CommonTypes.MediaType.LD: - discType = "LaserDisc"; - discSubType = "LaserDisc"; - - break; - case CommonTypes.MediaType.CRVdisc: - discType = "CRVdisc"; - discSubType = "CRVdisc"; - - break; - case CommonTypes.MediaType.LDROM: - discType = "LaserDisc"; - discSubType = "LD-ROM"; - - break; - case CommonTypes.MediaType.LVROM: - discType = "LaserDisc"; - discSubType = "LV-ROM"; - - break; - case CommonTypes.MediaType.MegaLD: - discType = "LaserDisc"; - discSubType = "MegaLD"; - - break; - case CommonTypes.MediaType.MD: - discType = "MiniDisc"; - discSubType = "MiniDisc"; - - break; - case CommonTypes.MediaType.MD60: - discType = "MiniDisc"; - discSubType = "MiniDisc (60 minute)"; - - break; - case CommonTypes.MediaType.MD74: - discType = "MiniDisc"; - discSubType = "MiniDisc (74 minute)"; - - break; - case CommonTypes.MediaType.MD80: - discType = "MiniDisc"; - discSubType = "MiniDisc (80 minute)"; - - break; - case CommonTypes.MediaType.MEGACD: - discType = "Compact Disc"; - discSubType = "Sega Mega CD"; - - break; - case CommonTypes.MediaType.PCD: - discType = "Compact Disc"; - discSubType = "Photo CD"; - - break; - case CommonTypes.MediaType.PlayStationMemoryCard: - discType = "PlayStation Memory Card"; - discSubType = "PlayStation Memory Card"; - - break; - case CommonTypes.MediaType.PlayStationMemoryCard2: - discType = "PlayStation Memory Card"; - discSubType = "PlayStation 2 Memory Card"; - - break; - case CommonTypes.MediaType.PS1CD: - discType = "Compact Disc"; - discSubType = "PlayStation Game Disc"; - - break; - case CommonTypes.MediaType.PS2CD: - discType = "Compact Disc"; - discSubType = "PlayStation 2 Game Disc"; - - break; - case CommonTypes.MediaType.PS2DVD: - discType = "DVD"; - discSubType = "PlayStation 2 Game Disc"; - - break; - case CommonTypes.MediaType.PS3BD: - discType = "Blu-ray"; - discSubType = "PlayStation 3 Game Disc"; - - break; - case CommonTypes.MediaType.PS3DVD: - discType = "DVD"; - discSubType = "PlayStation 3 Game Disc"; - - break; - case CommonTypes.MediaType.PS4BD: - discType = "Blu-ray"; - discSubType = "PlayStation 4 Game Disc"; - - break; - case CommonTypes.MediaType.PS5BD: - discType = "Blu-ray"; - discSubType = "PlayStation 5 Game Disc"; - - break; - case CommonTypes.MediaType.SACD: - discType = "SACD"; - discSubType = "Super Audio CD"; - - break; - case CommonTypes.MediaType.SegaCard: - discType = "Sega Card"; - discSubType = "Sega Card"; - - break; - case CommonTypes.MediaType.SATURNCD: - discType = "Compact Disc"; - discSubType = "Sega Saturn CD"; - - break; - case CommonTypes.MediaType.SVCD: - discType = "Compact Disc"; - discSubType = "Super Video CD"; - - break; - case CommonTypes.MediaType.CVD: - discType = "Compact Disc"; - discSubType = "China Video Disc"; - - break; - case CommonTypes.MediaType.SVOD: - discType = "SVOD"; - discSubType = "SVOD"; - - break; - case CommonTypes.MediaType.UDO: - discType = "UDO"; - discSubType = "UDO"; - - break; - case CommonTypes.MediaType.UMD: - discType = "UMD"; - discSubType = "Universal Media Disc"; - - break; - case CommonTypes.MediaType.VCD: - discType = "Compact Disc"; - discSubType = "Video CD"; - - break; - case CommonTypes.MediaType.Nuon: - discType = "DVD"; - discSubType = "Nuon"; - - break; - case CommonTypes.MediaType.XGD: - discType = "DVD"; - discSubType = "Xbox Game Disc (XGD)"; - - break; - case CommonTypes.MediaType.XGD2: - discType = "DVD"; - discSubType = "Xbox 360 Game Disc (XGD2)"; - - break; - case CommonTypes.MediaType.XGD3: - discType = "DVD"; - discSubType = "Xbox 360 Game Disc (XGD3)"; - - break; - case CommonTypes.MediaType.XGD4: - discType = "Blu-ray"; - discSubType = "Xbox One Game Disc (XGD4)"; - - break; - case CommonTypes.MediaType.FMTOWNS: - discType = "Compact Disc"; - discSubType = "FM-Towns"; - - break; - case CommonTypes.MediaType.Apple32SS: - discType = "5.25\" floppy"; - discSubType = "Apple DOS 3.2"; - - break; - case CommonTypes.MediaType.Apple32DS: - discType = "5.25\" floppy"; - discSubType = "Apple DOS 3.2 (double-sided)"; - - break; - case CommonTypes.MediaType.Apple33SS: - discType = "5.25\" floppy"; - discSubType = "Apple DOS 3.3"; - - break; - case CommonTypes.MediaType.Apple33DS: - discType = "5.25\" floppy"; - discSubType = "Apple DOS 3.3 (double-sided)"; - - break; - case CommonTypes.MediaType.AppleSonySS: - discType = "3.5\" floppy"; - discSubType = "Apple 400K"; - - break; - case CommonTypes.MediaType.AppleSonyDS: - discType = "3.5\" floppy"; - discSubType = "Apple 800K"; - - break; - case CommonTypes.MediaType.AppleFileWare: - discType = "5.25\" floppy"; - discSubType = "Apple FileWare"; - - break; - case CommonTypes.MediaType.RX50: - discType = "5.25\" floppy"; - discSubType = "DEC RX50"; - - break; - case CommonTypes.MediaType.DOS_525_SS_DD_8: - discType = "5.25\" floppy"; - discSubType = "IBM double-density, single-sided, 8 sectors"; - - break; - case CommonTypes.MediaType.DOS_525_SS_DD_9: - discType = "5.25\" floppy"; - discSubType = "IBM double-density, single-sided, 9 sectors"; - - break; - case CommonTypes.MediaType.DOS_525_DS_DD_8: - discType = "5.25\" floppy"; - discSubType = "IBM double-density, double-sided, 8 sectors"; - - break; - case CommonTypes.MediaType.DOS_525_DS_DD_9: - discType = "5.25\" floppy"; - discSubType = "IBM double-density, double-sided, 9 sectors"; - - break; - case CommonTypes.MediaType.DOS_525_HD: - discType = "5.25\" floppy"; - discSubType = "IBM high-density"; - - break; - case CommonTypes.MediaType.DOS_35_SS_DD_8: - discType = "3.5\" floppy"; - discSubType = "IBM double-density, single-sided, 8 sectors"; - - break; - case CommonTypes.MediaType.DOS_35_SS_DD_9: - discType = "3.5\" floppy"; - discSubType = "IBM double-density, single-sided, 9 sectors"; - - break; - case CommonTypes.MediaType.DOS_35_DS_DD_8: - discType = "3.5\" floppy"; - discSubType = "IBM double-density, double-sided, 8 sectors"; - - break; - case CommonTypes.MediaType.DOS_35_DS_DD_9: - discType = "3.5\" floppy"; - discSubType = "IBM double-density, double-sided, 9 sectors"; - - break; - case CommonTypes.MediaType.DOS_35_HD: - discType = "3.5\" floppy"; - discSubType = "IBM high-density"; - - break; - case CommonTypes.MediaType.DOS_35_ED: - discType = "3.5\" floppy"; - discSubType = "IBM extra-density"; - - break; - case CommonTypes.MediaType.Apricot_35: - discType = "3.5\" floppy"; - discSubType = "Apricot double-density, single-sided, 70 tracks"; - - break; - case CommonTypes.MediaType.DMF: - discType = "3.5\" floppy"; - discSubType = "Microsoft DMF"; - - break; - case CommonTypes.MediaType.DMF_82: - discType = "3.5\" floppy"; - discSubType = "Microsoft DMF (82-track)"; - - break; - case CommonTypes.MediaType.XDF_35: - discType = "3.5\" floppy"; - discSubType = "IBM XDF"; - - break; - case CommonTypes.MediaType.XDF_525: - discType = "5.25\" floppy"; - discSubType = "IBM XDF"; - - break; - case CommonTypes.MediaType.IBM23FD: - discType = "8\" floppy"; - discSubType = "IBM 23FD"; - - break; - case CommonTypes.MediaType.IBM33FD_128: - discType = "8\" floppy"; - discSubType = "IBM 33FD (128 bytes/sector)"; - - break; - case CommonTypes.MediaType.IBM33FD_256: - discType = "8\" floppy"; - discSubType = "IBM 33FD (256 bytes/sector)"; - - break; - case CommonTypes.MediaType.IBM33FD_512: - discType = "8\" floppy"; - discSubType = "IBM 33FD (512 bytes/sector)"; - - break; - case CommonTypes.MediaType.IBM43FD_128: - discType = "8\" floppy"; - discSubType = "IBM 43FD (128 bytes/sector)"; - - break; - case CommonTypes.MediaType.IBM43FD_256: - discType = "8\" floppy"; - discSubType = "IBM 43FD (256 bytes/sector)"; - - break; - case CommonTypes.MediaType.IBM53FD_256: - discType = "8\" floppy"; - discSubType = "IBM 53FD (256 bytes/sector)"; - - break; - case CommonTypes.MediaType.IBM53FD_512: - discType = "8\" floppy"; - discSubType = "IBM 53FD (512 bytes/sector)"; - - break; - case CommonTypes.MediaType.IBM53FD_1024: - discType = "8\" floppy"; - discSubType = "IBM 53FD (1024 bytes/sector)"; - - break; - case CommonTypes.MediaType.RX01: - discType = "8\" floppy"; - discSubType = "DEC RX-01"; - - break; - case CommonTypes.MediaType.RX02: - discType = "8\" floppy"; - discSubType = "DEC RX-02"; - - break; - case CommonTypes.MediaType.RX03: - discType = "8\" floppy"; - discSubType = "DEC RX-03"; - - break; - case CommonTypes.MediaType.ACORN_525_SS_SD_40: - discType = "5.25\" floppy"; - discSubType = "BBC Micro 100K"; - - break; - case CommonTypes.MediaType.ACORN_525_SS_SD_80: - discType = "5.25\" floppy"; - discSubType = "BBC Micro 200K"; - - break; - case CommonTypes.MediaType.ACORN_525_SS_DD_40: - discType = "5.25\" floppy"; - discSubType = "Acorn S"; - - break; - case CommonTypes.MediaType.ACORN_525_SS_DD_80: - discType = "5.25\" floppy"; - discSubType = "Acorn M"; - - break; - case CommonTypes.MediaType.ACORN_525_DS_DD: - discType = "5.25\" floppy"; - discSubType = "Acorn L"; - - break; - case CommonTypes.MediaType.ACORN_35_DS_DD: - discType = "3.5\" floppy"; - discSubType = "Acorn Archimedes"; - - break; - case CommonTypes.MediaType.ACORN_35_DS_HD: - discType = "3.5\" floppy"; - discSubType = "Acorn Archimedes high-density"; - - break; - case CommonTypes.MediaType.ATARI_525_SD: - discType = "5.25\" floppy"; - discSubType = "Atari single-density"; - - break; - case CommonTypes.MediaType.ATARI_525_ED: - discType = "5.25\" floppy"; - discSubType = "Atari enhanced-density"; - - break; - case CommonTypes.MediaType.ATARI_525_DD: - discType = "5.25\" floppy"; - discSubType = "Atari double-density"; - - break; - case CommonTypes.MediaType.ATARI_35_SS_DD: - discType = "3.5\" floppy"; - discSubType = "Atari ST double-density, single-sided, 10 sectors"; - - break; - case CommonTypes.MediaType.ATARI_35_DS_DD: - discType = "3.5\" floppy"; - discSubType = "Atari ST double-density, double-sided, 10 sectors"; - - break; - case CommonTypes.MediaType.ATARI_35_SS_DD_11: - discType = "3.5\" floppy"; - discSubType = "Atari ST double-density, single-sided, 11 sectors"; - - break; - case CommonTypes.MediaType.ATARI_35_DS_DD_11: - discType = "3.5\" floppy"; - discSubType = "Atari ST double-density, double-sided, 11 sectors"; - - break; - case CommonTypes.MediaType.CBM_1540: - case CommonTypes.MediaType.CBM_1540_Ext: - discType = "5.25\" floppy"; - discSubType = "Commodore 1540/1541"; - - break; - case CommonTypes.MediaType.CBM_1571: - discType = "5.25\" floppy"; - discSubType = "Commodore 1571"; - - break; - case CommonTypes.MediaType.CBM_35_DD: - discType = "3.5\" floppy"; - discSubType = "Commodore 1581"; - - break; - case CommonTypes.MediaType.CBM_AMIGA_35_DD: - discType = "3.5\" floppy"; - discSubType = "Amiga double-density"; - - break; - case CommonTypes.MediaType.CBM_AMIGA_35_HD: - discType = "3.5\" floppy"; - discSubType = "Amiga high-density"; - - break; - case CommonTypes.MediaType.NEC_8_SD: - discType = "8\" floppy"; - discSubType = "NEC single-sided"; - - break; - case CommonTypes.MediaType.NEC_8_DD: - discType = "8\" floppy"; - discSubType = "NEC double-sided"; - - break; - case CommonTypes.MediaType.NEC_525_SS: - discType = "5.25\" floppy"; - discSubType = "NEC single-sided"; - - break; - case CommonTypes.MediaType.NEC_525_HD: - discType = "5.25\" floppy"; - discSubType = "NEC high-density"; - - break; - case CommonTypes.MediaType.NEC_35_HD_8: - discType = "3.5\" floppy"; - discSubType = "NEC high-density"; - - break; - case CommonTypes.MediaType.NEC_35_HD_15: - discType = "3.5\" floppy"; - discSubType = "NEC high-density"; - - break; - case CommonTypes.MediaType.NEC_35_TD: - discType = "3.5\" floppy"; - discSubType = "NEC triple-density"; - - break; - case CommonTypes.MediaType.SHARP_525_9: - discType = "5.25\" floppy"; - discSubType = "Sharp (9 sectors per track)"; - - break; - case CommonTypes.MediaType.SHARP_35_9: - discType = "3.5\" floppy"; - discSubType = "Sharp (9 sectors per track)"; - - break; - case CommonTypes.MediaType.ECMA_54: - discType = "8\" floppy"; - discSubType = "ECMA-54"; - - break; - case CommonTypes.MediaType.ECMA_59: - discType = "8\" floppy"; - discSubType = "ECMA-59"; - - break; - case CommonTypes.MediaType.ECMA_69_8: - case CommonTypes.MediaType.ECMA_69_15: - case CommonTypes.MediaType.ECMA_69_26: - discType = "8\" floppy"; - discSubType = "ECMA-69"; - - break; - case CommonTypes.MediaType.ECMA_66: - discType = "5.25\" floppy"; - discSubType = "ECMA-66"; - - break; - case CommonTypes.MediaType.ECMA_70: - discType = "5.25\" floppy"; - discSubType = "ECMA-70"; - - break; - case CommonTypes.MediaType.ECMA_78: - case CommonTypes.MediaType.ECMA_78_2: - discType = "5.25\" floppy"; - discSubType = "ECMA-78"; - - break; - case CommonTypes.MediaType.ECMA_99_8: - case CommonTypes.MediaType.ECMA_99_15: - case CommonTypes.MediaType.ECMA_99_26: - discType = "5.25\" floppy"; - discSubType = "ECMA-99"; - - break; - case CommonTypes.MediaType.FDFORMAT_525_DD: - discType = "5.25\" floppy"; - discSubType = "FDFORMAT double-density"; - - break; - case CommonTypes.MediaType.FDFORMAT_525_HD: - discType = "5.25\" floppy"; - discSubType = "FDFORMAT high-density"; - - break; - case CommonTypes.MediaType.FDFORMAT_35_DD: - discType = "3.5\" floppy"; - discSubType = "FDFORMAT double-density"; - - break; - case CommonTypes.MediaType.FDFORMAT_35_HD: - discType = "3.5\" floppy"; - discSubType = "FDFORMAT high-density"; - - break; - case CommonTypes.MediaType.ECMA_260: - case CommonTypes.MediaType.ECMA_260_Double: - discType = "356mm magneto-optical"; - discSubType = "ECMA-260 / ISO 15898"; - - break; - case CommonTypes.MediaType.ECMA_183_512: - case CommonTypes.MediaType.ECMA_183: - discType = "5.25\" magneto-optical"; - discSubType = "ECMA-183"; - - break; - case CommonTypes.MediaType.ISO_10089: - case CommonTypes.MediaType.ISO_10089_512: - discType = "5.25\" magneto-optical"; - discSubType = "ISO 10089"; - - break; - case CommonTypes.MediaType.ECMA_184_512: - case CommonTypes.MediaType.ECMA_184: - discType = "5.25\" magneto-optical"; - discSubType = "ECMA-184"; - - break; - case CommonTypes.MediaType.ECMA_154: - discType = "3.5\" magneto-optical"; - discSubType = "ECMA-154"; - - break; - case CommonTypes.MediaType.ECMA_201: - case CommonTypes.MediaType.ECMA_201_ROM: - discType = "3.5\" magneto-optical"; - discSubType = "ECMA-201"; - - break; - case CommonTypes.MediaType.ISO_15041_512: - discType = "3.5\" magneto-optical"; - discSubType = "ISO 15041"; - - break; - case CommonTypes.MediaType.FlashDrive: - discType = "USB flash drive"; - discSubType = "USB flash drive"; - - break; - case CommonTypes.MediaType.SuperCDROM2: - discType = "Compact Disc"; - discSubType = "Super CD-ROM²"; - - break; - case CommonTypes.MediaType.LDROM2: - discType = "LaserDisc"; - discSubType = "LD-ROM²"; - - break; - case CommonTypes.MediaType.JaguarCD: - discType = "Compact Disc"; - discSubType = "Atari Jaguar CD"; - - break; - case CommonTypes.MediaType.MilCD: - discType = "Compact Disc"; - discSubType = "Sega MilCD"; - - break; - case CommonTypes.MediaType.ThreeDO: - discType = "Compact Disc"; - discSubType = "3DO"; - - break; - case CommonTypes.MediaType.PCFX: - discType = "Compact Disc"; - discSubType = "PC-FX"; - - break; - case CommonTypes.MediaType.NeoGeoCD: - discType = "Compact Disc"; - discSubType = "NEO-GEO CD"; - - break; - case CommonTypes.MediaType.CDTV: - discType = "Compact Disc"; - discSubType = "Commodore CDTV"; - - break; - case CommonTypes.MediaType.CD32: - discType = "Compact Disc"; - discSubType = "Amiga CD32"; - - break; - case CommonTypes.MediaType.Playdia: - discType = "Compact Disc"; - discSubType = "Bandai Playdia"; - - break; - case CommonTypes.MediaType.Pippin: - discType = "Compact Disc"; - discSubType = "Apple Pippin"; - - break; - case CommonTypes.MediaType.ZIP100: - discType = "Iomega ZIP"; - discSubType = "Iomega ZIP100"; - - break; - case CommonTypes.MediaType.ZIP250: - discType = "Iomega ZIP"; - discSubType = "Iomega ZIP250"; - - break; - case CommonTypes.MediaType.ZIP750: - discType = "Iomega ZIP"; - discSubType = "Iomega ZIP750"; - - break; - case CommonTypes.MediaType.AppleProfile: - discType = "Hard Disk Drive"; - discSubType = "Apple Profile"; - - break; - case CommonTypes.MediaType.AppleWidget: - discType = "Hard Disk Drive"; - discSubType = "Apple Widget"; - - break; - case CommonTypes.MediaType.AppleHD20: - discType = "Hard Disk Drive"; - discSubType = "Apple HD20"; - - break; - case CommonTypes.MediaType.PriamDataTower: - discType = "Hard Disk Drive"; - discSubType = "Priam DataTower"; - - break; - case CommonTypes.MediaType.DDS1: - discType = "Digital Data Storage"; - discSubType = "DDS"; - - break; - case CommonTypes.MediaType.DDS2: - discType = "Digital Data Storage"; - discSubType = "DDS-2"; - - break; - case CommonTypes.MediaType.DDS3: - discType = "Digital Data Storage"; - discSubType = "DDS-3"; - - break; - case CommonTypes.MediaType.DDS4: - discType = "Digital Data Storage"; - discSubType = "DDS-4"; - - break; - case CommonTypes.MediaType.PocketZip: - discType = "Iomega PocketZip"; - discSubType = "Iomega PocketZip"; - - break; - case CommonTypes.MediaType.CompactFloppy: - discType = "3\" floppy"; - discSubType = "Compact Floppy"; - - break; - case CommonTypes.MediaType.GENERIC_HDD: - discType = "Hard Disk Drive"; - discSubType = "Unknown"; - - break; - case CommonTypes.MediaType.MDData: - discType = "MiniDisc"; - discSubType = "MD-DATA"; - - break; - case CommonTypes.MediaType.MDData2: - discType = "MiniDisc"; - discSubType = "MD-DATA2"; - - break; - case CommonTypes.MediaType.UDO2: - discType = "UDO"; - discSubType = "UDO2"; - - break; - case CommonTypes.MediaType.UDO2_WORM: - discType = "UDO"; - discSubType = "UDO2 (WORM)"; - - break; - case CommonTypes.MediaType.ADR30: - discType = "Advanced Digital Recording"; - discSubType = "ADR 30"; - - break; - case CommonTypes.MediaType.ADR50: - discType = "Advanced Digital Recording"; - discSubType = "ADR 50"; - - break; - case CommonTypes.MediaType.ADR260: - discType = "Advanced Digital Recording"; - discSubType = "ADR 2.60"; - - break; - case CommonTypes.MediaType.ADR2120: - discType = "Advanced Digital Recording"; - discSubType = "ADR 2.120"; - - break; - case CommonTypes.MediaType.AIT1: - discType = "Advanced Intelligent Tape"; - discSubType = "AIT-1"; - - break; - case CommonTypes.MediaType.AIT1Turbo: - discType = "Advanced Intelligent Tape"; - discSubType = "AIT-1 Turbo"; - - break; - case CommonTypes.MediaType.AIT2: - discType = "Advanced Intelligent Tape"; - discSubType = "AIT-2"; - - break; - case CommonTypes.MediaType.AIT2Turbo: - discType = "Advanced Intelligent Tape"; - discSubType = "AIT-2 Turbo"; - - break; - case CommonTypes.MediaType.AIT3: - discType = "Advanced Intelligent Tape"; - discSubType = "AIT-3"; - - break; - case CommonTypes.MediaType.AIT3Ex: - discType = "Advanced Intelligent Tape"; - discSubType = "AIT-3Ex"; - - break; - case CommonTypes.MediaType.AIT3Turbo: - discType = "Advanced Intelligent Tape"; - discSubType = "AIT-3 Turbo"; - - break; - case CommonTypes.MediaType.AIT4: - discType = "Advanced Intelligent Tape"; - discSubType = "AIT-4"; - - break; - case CommonTypes.MediaType.AIT5: - discType = "Advanced Intelligent Tape"; - discSubType = "AIT-5"; - - break; - case CommonTypes.MediaType.AITETurbo: - discType = "Advanced Intelligent Tape"; - discSubType = "AIT-E Turbo"; - - break; - case CommonTypes.MediaType.SAIT1: - discType = "Super Advanced Intelligent Tape"; - discSubType = "SAIT-1"; - - break; - case CommonTypes.MediaType.SAIT2: - discType = "Super Advanced Intelligent Tape"; - discSubType = "SAIT-2"; - - break; - case CommonTypes.MediaType.Bernoulli: - case CommonTypes.MediaType.Bernoulli10: - discType = "Iomega Bernoulli Box"; - discSubType = "Iomega Bernoulli Box 10Mb"; - - break; - case CommonTypes.MediaType.Bernoulli20: - discType = "Iomega Bernoulli Box"; - discSubType = "Iomega Bernoulli Box 20Mb"; - - break; - case CommonTypes.MediaType.BernoulliBox2_20: - case CommonTypes.MediaType.Bernoulli2: - discType = "Iomega Bernoulli Box II"; - discSubType = "Iomega Bernoulli Box II 20Mb"; - - break; - case CommonTypes.MediaType.Bernoulli35: - discType = "Iomega Bernoulli Box II"; - discSubType = "Iomega Bernoulli Box II 35Mb"; - - break; - case CommonTypes.MediaType.Bernoulli44: - discType = "Iomega Bernoulli Box II"; - discSubType = "Iomega Bernoulli Box II 44Mb"; - - break; - case CommonTypes.MediaType.Bernoulli65: - discType = "Iomega Bernoulli Box II"; - discSubType = "Iomega Bernoulli Box II 65Mb"; - - break; - case CommonTypes.MediaType.Bernoulli90: - discType = "Iomega Bernoulli Box II"; - discSubType = "Iomega Bernoulli Box II 90Mb"; - - break; - case CommonTypes.MediaType.Bernoulli105: - discType = "Iomega Bernoulli Box II"; - discSubType = "Iomega Bernoulli Box II 105Mb"; - - break; - case CommonTypes.MediaType.Bernoulli150: - discType = "Iomega Bernoulli Box II"; - discSubType = "Iomega Bernoulli Box II 150Mb"; - - break; - case CommonTypes.MediaType.Bernoulli230: - discType = "Iomega Bernoulli Box II"; - discSubType = "Iomega Bernoulli Box II 230Mb"; - - break; - case CommonTypes.MediaType.Ditto: - discType = "Iomega Ditto"; - discSubType = "Iomega Ditto"; - - break; - case CommonTypes.MediaType.DittoMax: - discType = "Iomega Ditto"; - discSubType = "Iomega Ditto Max"; - - break; - case CommonTypes.MediaType.Jaz: - discType = "Iomega Jaz"; - discSubType = "Iomega Jaz 1GB"; - - break; - case CommonTypes.MediaType.Jaz2: - discType = "Iomega Jaz"; - discSubType = "Iomega Jaz 2GB"; - - break; - case CommonTypes.MediaType.REV35: - discType = "Iomega REV"; - discSubType = "Iomega REV-35"; - - break; - case CommonTypes.MediaType.REV70: - discType = "Iomega REV"; - discSubType = "Iomega REV-70"; - - break; - case CommonTypes.MediaType.REV120: - discType = "Iomega REV"; - discSubType = "Iomega REV-120"; - - break; - case CommonTypes.MediaType.CompactFlash: - discType = "Compact Flash"; - discSubType = "Compact Flash"; - - break; - case CommonTypes.MediaType.CompactFlashType2: - discType = "Compact Flash"; - discSubType = "Compact Flash Type 2"; - - break; - case CommonTypes.MediaType.CFast: - discType = "Compact Flash"; - discSubType = "CFast"; - - break; - case CommonTypes.MediaType.DigitalAudioTape: - discType = "Digital Audio Tape"; - discSubType = "Digital Audio Tape"; - - break; - case CommonTypes.MediaType.DAT72: - discType = "Digital Data Storage"; - discSubType = "DAT-72"; - - break; - case CommonTypes.MediaType.DAT160: - discType = "Digital Data Storage"; - discSubType = "DAT-160"; - - break; - case CommonTypes.MediaType.DAT320: - discType = "Digital Data Storage"; - discSubType = "DAT-320"; - - break; - case CommonTypes.MediaType.DECtapeII: - discType = "DECtape"; - discSubType = "DECtape II"; - - break; - case CommonTypes.MediaType.CompactTapeI: - discType = "CompacTape"; - discSubType = "CompacTape"; - - break; - case CommonTypes.MediaType.CompactTapeII: - discType = "CompacTape"; - discSubType = "CompacTape II"; - - break; - case CommonTypes.MediaType.DLTtapeIII: - discType = "Digital Linear Tape"; - discSubType = "DLTtape III"; - - break; - case CommonTypes.MediaType.DLTtapeIIIxt: - discType = "Digital Linear Tape"; - discSubType = "DLTtape IIIXT"; - - break; - case CommonTypes.MediaType.DLTtapeIV: - discType = "Digital Linear Tape"; - discSubType = "DLTtape IV"; - - break; - case CommonTypes.MediaType.DLTtapeS4: - discType = "Digital Linear Tape"; - discSubType = "DLTtape S4"; - - break; - case CommonTypes.MediaType.SDLT1: - discType = "Super Digital Linear Tape"; - discSubType = "SDLTtape I"; - - break; - case CommonTypes.MediaType.SDLT2: - discType = "Super Digital Linear Tape"; - discSubType = "SDLTtape II"; - - break; - case CommonTypes.MediaType.VStapeI: - discType = "Digital Linear Tape"; - discSubType = "DLTtape VS1"; - - break; - case CommonTypes.MediaType.Data8: - discType = "Data8"; - discSubType = "Data8"; - - break; - case CommonTypes.MediaType.MiniDV: - discType = "DV tape"; - discSubType = "MiniDV"; - - break; - case CommonTypes.MediaType.Exatape15m: - discType = "Exatape"; - discSubType = "Exatape (15m)"; - - break; - case CommonTypes.MediaType.Exatape22m: - discType = "Exatape"; - discSubType = "Exatape (22m)"; - - break; - case CommonTypes.MediaType.Exatape22mAME: - discType = "Exatape"; - discSubType = "Exatape (22m AME)"; - - break; - case CommonTypes.MediaType.Exatape28m: - discType = "Exatape"; - discSubType = "Exatape (28m)"; - - break; - case CommonTypes.MediaType.Exatape40m: - discType = "Exatape"; - discSubType = "Exatape (40m)"; - - break; - case CommonTypes.MediaType.Exatape45m: - discType = "Exatape"; - discSubType = "Exatape (45m)"; - - break; - case CommonTypes.MediaType.Exatape54m: - discType = "Exatape"; - discSubType = "Exatape (54m)"; - - break; - case CommonTypes.MediaType.Exatape75m: - discType = "Exatape"; - discSubType = "Exatape (75m)"; - - break; - case CommonTypes.MediaType.Exatape76m: - discType = "Exatape"; - discSubType = "Exatape (76m)"; - - break; - case CommonTypes.MediaType.Exatape80m: - discType = "Exatape"; - discSubType = "Exatape (80m)"; - - break; - case CommonTypes.MediaType.Exatape106m: - discType = "Exatape"; - discSubType = "Exatape (106m)"; - - break; - case CommonTypes.MediaType.Exatape112m: - discType = "Exatape"; - discSubType = "Exatape (112m)"; - - break; - case CommonTypes.MediaType.Exatape125m: - discType = "Exatape"; - discSubType = "Exatape (125m)"; - - break; - case CommonTypes.MediaType.Exatape150m: - discType = "Exatape"; - discSubType = "Exatape (150m)"; - - break; - case CommonTypes.MediaType.Exatape160mXL: - discType = "Exatape"; - discSubType = "Exatape XL (160m)"; - - break; - case CommonTypes.MediaType.Exatape170m: - discType = "Exatape"; - discSubType = "Exatape (170m)"; - - break; - case CommonTypes.MediaType.Exatape225m: - discType = "Exatape"; - discSubType = "Exatape (225m)"; - - break; - case CommonTypes.MediaType.EZ135: - discType = "3.5\" SyQuest cartridge"; - discSubType = "EZ135"; - - break; - case CommonTypes.MediaType.EZ230: - discType = "3.5\" SyQuest cartridge"; - discSubType = "EZ230"; - - break; - case CommonTypes.MediaType.Quest: - discType = "3.5\" SyQuest cartridge"; - discSubType = "Quest"; - - break; - case CommonTypes.MediaType.SparQ: - discType = "3.5\" SyQuest cartridge"; - discSubType = "SparQ"; - - break; - case CommonTypes.MediaType.SQ100: - discType = "3.9\" SyQuest cartridge"; - discSubType = "SQ100"; - - break; - case CommonTypes.MediaType.SQ200: - discType = "3.9\" SyQuest cartridge"; - discSubType = "SQ200"; - - break; - case CommonTypes.MediaType.SQ300: - discType = "3.9\" SyQuest cartridge"; - discSubType = "SQ300"; - - break; - case CommonTypes.MediaType.SQ310: - discType = "3.5\" SyQuest cartridge"; - discSubType = "SQ310"; - - break; - case CommonTypes.MediaType.SQ327: - discType = "3.5\" SyQuest cartridge"; - discSubType = "SQ327"; - - break; - case CommonTypes.MediaType.SQ400: - discType = "5.25\" SyQuest cartridge"; - discSubType = "SQ400"; - - break; - case CommonTypes.MediaType.SQ800: - discType = "5.25\" SyQuest cartridge"; - discSubType = "SQ800"; - - break; - case CommonTypes.MediaType.SQ1500: - discType = "3.5\" SyQuest cartridge"; - discSubType = "SQ1500"; - - break; - case CommonTypes.MediaType.SQ2000: - discType = "5.25\" SyQuest cartridge"; - discSubType = "SQ2000"; - - break; - case CommonTypes.MediaType.SyJet: - discType = "3.5\" SyQuest cartridge"; - discSubType = "SyJet"; - - break; - case CommonTypes.MediaType.LTO: - discType = "Linear Tape-Open"; - discSubType = "LTO"; - - break; - case CommonTypes.MediaType.LTO2: - discType = "Linear Tape-Open"; - discSubType = "LTO-2"; - - break; - case CommonTypes.MediaType.LTO3: - discType = "Linear Tape-Open"; - discSubType = "LTO-3"; - - break; - case CommonTypes.MediaType.LTO3WORM: - discType = "Linear Tape-Open"; - discSubType = "LTO-3 (WORM)"; - - break; - case CommonTypes.MediaType.LTO4: - discType = "Linear Tape-Open"; - discSubType = "LTO-4"; - - break; - case CommonTypes.MediaType.LTO4WORM: - discType = "Linear Tape-Open"; - discSubType = "LTO-4 (WORM)"; - - break; - case CommonTypes.MediaType.LTO5: - discType = "Linear Tape-Open"; - discSubType = "LTO-5"; - - break; - case CommonTypes.MediaType.LTO5WORM: - discType = "Linear Tape-Open"; - discSubType = "LTO-5 (WORM)"; - - break; - case CommonTypes.MediaType.LTO6: - discType = "Linear Tape-Open"; - discSubType = "LTO-6"; - - break; - case CommonTypes.MediaType.LTO6WORM: - discType = "Linear Tape-Open"; - discSubType = "LTO-6 (WORM)"; - - break; - case CommonTypes.MediaType.LTO7: - discType = "Linear Tape-Open"; - discSubType = "LTO-7"; - - break; - case CommonTypes.MediaType.LTO7WORM: - discType = "Linear Tape-Open"; - discSubType = "LTO-7 (WORM)"; - - break; - case CommonTypes.MediaType.MemoryStick: - discType = "Memory Stick"; - discSubType = "Memory Stick"; - - break; - case CommonTypes.MediaType.MemoryStickDuo: - discType = "Memory Stick"; - discSubType = "Memory Stick Duo"; - - break; - case CommonTypes.MediaType.MemoryStickMicro: - discType = "Memory Stick"; - discSubType = "Memory Stick Micro"; - - break; - case CommonTypes.MediaType.MemoryStickPro: - discType = "Memory Stick"; - discSubType = "Memory Stick Pro"; - - break; - case CommonTypes.MediaType.MemoryStickProDuo: - discType = "Memory Stick"; - discSubType = "Memory Stick PRO Duo"; - - break; - case CommonTypes.MediaType.SecureDigital: - discType = "Secure Digital"; - discSubType = "Secure Digital"; - - break; - case CommonTypes.MediaType.miniSD: - discType = "Secure Digital"; - discSubType = "miniSD"; - - break; - case CommonTypes.MediaType.microSD: - discType = "Secure Digital"; - discSubType = "microSD"; - - break; - case CommonTypes.MediaType.MMC: - discType = "MultiMediaCard"; - discSubType = "MultiMediaCard"; - - break; - case CommonTypes.MediaType.MMCmicro: - discType = "MultiMediaCard"; - discSubType = "MMCmicro"; - - break; - case CommonTypes.MediaType.RSMMC: - discType = "MultiMediaCard"; - discSubType = "Reduced-Size MultiMediaCard"; - - break; - case CommonTypes.MediaType.MMCplus: - discType = "MultiMediaCard"; - discSubType = "MMCplus"; - - break; - case CommonTypes.MediaType.MMCmobile: - discType = "MultiMediaCard"; - discSubType = "MMCmobile"; - - break; - case CommonTypes.MediaType.MLR1: - discType = "Scalable Linear Recording"; - discSubType = "MLR1"; - - break; - case CommonTypes.MediaType.MLR1SL: - discType = "Scalable Linear Recording"; - discSubType = "MLR1 SL"; - - break; - case CommonTypes.MediaType.MLR3: - discType = "Scalable Linear Recording"; - discSubType = "MLR3"; - - break; - case CommonTypes.MediaType.SLR1: - discType = "Scalable Linear Recording"; - discSubType = "SLR1"; - - break; - case CommonTypes.MediaType.SLR2: - discType = "Scalable Linear Recording"; - discSubType = "SLR2"; - - break; - case CommonTypes.MediaType.SLR3: - discType = "Scalable Linear Recording"; - discSubType = "SLR3"; - - break; - case CommonTypes.MediaType.SLR32: - discType = "Scalable Linear Recording"; - discSubType = "SLR32"; - - break; - case CommonTypes.MediaType.SLR32SL: - discType = "Scalable Linear Recording"; - discSubType = "SLR32 SL"; - - break; - case CommonTypes.MediaType.SLR4: - discType = "Scalable Linear Recording"; - discSubType = "SLR4"; - - break; - case CommonTypes.MediaType.SLR5: - discType = "Scalable Linear Recording"; - discSubType = "SLR5"; - - break; - case CommonTypes.MediaType.SLR5SL: - discType = "Scalable Linear Recording"; - discSubType = "SLR5 SL"; - - break; - case CommonTypes.MediaType.SLR6: - discType = "Scalable Linear Recording"; - discSubType = "SLR6"; - - break; - case CommonTypes.MediaType.SLRtape7: - discType = "Scalable Linear Recording"; - discSubType = "SLRtape7"; - - break; - case CommonTypes.MediaType.SLRtape7SL: - discType = "Scalable Linear Recording"; - discSubType = "SLRtape7 SL"; - - break; - case CommonTypes.MediaType.SLRtape24: - discType = "Scalable Linear Recording"; - discSubType = "SLRtape24"; - - break; - case CommonTypes.MediaType.SLRtape24SL: - discType = "Scalable Linear Recording"; - discSubType = "SLRtape24 SL"; - - break; - case CommonTypes.MediaType.SLRtape40: - discType = "Scalable Linear Recording"; - discSubType = "SLRtape40"; - - break; - case CommonTypes.MediaType.SLRtape50: - discType = "Scalable Linear Recording"; - discSubType = "SLRtape50"; - - break; - case CommonTypes.MediaType.SLRtape60: - discType = "Scalable Linear Recording"; - discSubType = "SLRtape60"; - - break; - case CommonTypes.MediaType.SLRtape75: - discType = "Scalable Linear Recording"; - discSubType = "SLRtape75"; - - break; - case CommonTypes.MediaType.SLRtape100: - discType = "Scalable Linear Recording"; - discSubType = "SLRtape100"; - - break; - case CommonTypes.MediaType.SLRtape140: - discType = "Scalable Linear Recording"; - discSubType = "SLRtape140"; - - break; - case CommonTypes.MediaType.QIC11: - discType = "Quarter-inch cartridge"; - discSubType = "QIC-11"; - - break; - case CommonTypes.MediaType.QIC24: - discType = "Quarter-inch cartridge"; - discSubType = "QIC-24"; - - break; - case CommonTypes.MediaType.QIC40: - discType = "Quarter-inch mini cartridge"; - discSubType = "QIC-40"; - - break; - case CommonTypes.MediaType.QIC80: - discType = "Quarter-inch mini cartridge"; - discSubType = "QIC-80"; - - break; - case CommonTypes.MediaType.QIC120: - discType = "Quarter-inch cartridge"; - discSubType = "QIC-120"; - - break; - case CommonTypes.MediaType.QIC150: - discType = "Quarter-inch cartridge"; - discSubType = "QIC-150"; - - break; - case CommonTypes.MediaType.QIC320: - discType = "Quarter-inch cartridge"; - discSubType = "QIC-320"; - - break; - case CommonTypes.MediaType.QIC525: - discType = "Quarter-inch cartridge"; - discSubType = "QIC-525"; - - break; - case CommonTypes.MediaType.QIC1350: - discType = "Quarter-inch cartridge"; - discSubType = "QIC-1350"; - - break; - case CommonTypes.MediaType.QIC3010: - discType = "Quarter-inch cartridge"; - discSubType = "QIC-3010"; - - break; - case CommonTypes.MediaType.QIC3020: - discType = "Quarter-inch cartridge"; - discSubType = "QIC-3020"; - - break; - case CommonTypes.MediaType.QIC3080: - discType = "Quarter-inch cartridge"; - discSubType = "QIC-3080"; - - break; - case CommonTypes.MediaType.QIC3095: - discType = "Quarter-inch cartridge"; - discSubType = "QIC-3095"; - - break; - case CommonTypes.MediaType.Travan: - discType = "Travan"; - discSubType = "TR-1"; - - break; - case CommonTypes.MediaType.Travan1Ex: - discType = "Travan"; - discSubType = "TR-1 Ex"; - - break; - case CommonTypes.MediaType.Travan3: - discType = "Travan"; - discSubType = "TR-3"; - - break; - case CommonTypes.MediaType.Travan3Ex: - discType = "Travan"; - discSubType = "TR-3 Ex"; - - break; - case CommonTypes.MediaType.Travan4: - discType = "Travan"; - discSubType = "TR-4"; - - break; - case CommonTypes.MediaType.Travan5: - discType = "Travan"; - discSubType = "TR-5"; - - break; - case CommonTypes.MediaType.Travan7: - discType = "Travan"; - discSubType = "TR-7"; - - break; - case CommonTypes.MediaType.VXA1: - discType = "VXA"; - discSubType = "VXA-1"; - - break; - case CommonTypes.MediaType.VXA2: - discType = "VXA"; - discSubType = "VXA-2"; - - break; - case CommonTypes.MediaType.VXA3: - discType = "VXA"; - discSubType = "VXA-3"; - - break; - case CommonTypes.MediaType.ECMA_153: - case CommonTypes.MediaType.ECMA_153_512: - discType = "5.25\" magneto-optical"; - discSubType = "ECMA-153"; - - break; - case CommonTypes.MediaType.ECMA_189: - discType = "300mm magneto optical"; - discSubType = "ECMA-189"; - - break; - case CommonTypes.MediaType.ECMA_190: - discType = "300mm magneto optical"; - discSubType = "ECMA-190"; - - break; - case CommonTypes.MediaType.ECMA_195: - case CommonTypes.MediaType.ECMA_195_512: - discType = "5.25\" magneto-optical"; - discSubType = "ECMA-195"; - - break; - case CommonTypes.MediaType.ECMA_223: - case CommonTypes.MediaType.ECMA_223_512: - discType = "3.5\" magneto-optical"; - discSubType = "ECMA-223"; - - break; - case CommonTypes.MediaType.ECMA_238: - discType = "5.25\" magneto-optical"; - discSubType = "ECMA-238"; - - break; - case CommonTypes.MediaType.ECMA_239: - discType = "3.5\" magneto-optical"; - discSubType = "ECMA-239"; - - break; - case CommonTypes.MediaType.ECMA_280: - discType = "5.25\" magneto-optical"; - discSubType = "ECMA-280"; - - break; - case CommonTypes.MediaType.ECMA_317: - discType = "300mm magneto optical"; - discSubType = "ECMA-317"; - - break; - case CommonTypes.MediaType.ECMA_322: - case CommonTypes.MediaType.ECMA_322_512: - case CommonTypes.MediaType.ECMA_322_1k: - case CommonTypes.MediaType.ECMA_322_2k: - discType = "5.25\" magneto-optical"; - discSubType = "ECMA-322 / ISO 22092"; - - break; - case CommonTypes.MediaType.ISO_15286: - case CommonTypes.MediaType.ISO_15286_1024: - case CommonTypes.MediaType.ISO_15286_512: - discType = "5.25\" magneto-optical"; - discSubType = "ISO-15286"; - - break; - case CommonTypes.MediaType.ISO_14517: - case CommonTypes.MediaType.ISO_14517_512: - discType = "5.25\" magneto-optical"; - discSubType = "ISO-14517"; - - break; - case CommonTypes.MediaType.GigaMo: - discType = "3.5\" magneto-optical"; - discSubType = "GIGAMO"; - - break; - case CommonTypes.MediaType.GigaMo2: - discType = "3.5\" magneto-optical"; - discSubType = "2.3GB GIGAMO"; - - break; - case CommonTypes.MediaType.UnknownMO: - discType = "Magneto-optical"; - discSubType = "Unknown"; - - break; - case CommonTypes.MediaType.Floptical: - discType = "Floptical"; - discSubType = "Floptical"; - - break; - case CommonTypes.MediaType.HiFD: - discType = "HiFD"; - discSubType = "HiFD"; - - break; - case CommonTypes.MediaType.LS120: - discType = "SuperDisk"; - discSubType = "LS-120"; - - break; - case CommonTypes.MediaType.LS240: - discType = "SuperDisk"; - discSubType = "LS-240"; - - break; - case CommonTypes.MediaType.FD32MB: - discType = "3.5\" floppy"; - discSubType = "FD32MB"; - - break; - case CommonTypes.MediaType.UHD144: - discType = "UHD144"; - discSubType = "UHD144"; - - break; - case CommonTypes.MediaType.VCDHD: - discType = "VCDHD"; - discSubType = "VCDHD"; - - break; - case CommonTypes.MediaType.HuCard: - discType = "HuCard"; - discSubType = "HuCard"; - - break; - case CommonTypes.MediaType.CompactCassette: - discType = "Compact Cassette"; - discSubType = "Compact Cassette"; - - break; - case CommonTypes.MediaType.Dcas25: - discType = "Compact Cassette"; - discSubType = "D/CAS-25"; - - break; - case CommonTypes.MediaType.Dcas85: - discType = "Compact Cassette"; - discSubType = "D/CAS-85"; - - break; - case CommonTypes.MediaType.Dcas103: - discType = "Compact Cassette"; - discSubType = "D/CAS-103"; - - break; - case CommonTypes.MediaType.PCCardTypeI: - discType = "PCMCIA Card"; - discSubType = "PC-Card Type I"; - - break; - case CommonTypes.MediaType.PCCardTypeII: - discType = "PCMCIA Card"; - discSubType = "PC-Card Type II"; - - break; - case CommonTypes.MediaType.PCCardTypeIII: - discType = "PCMCIA Card"; - discSubType = "PC-Card Type III"; - - break; - case CommonTypes.MediaType.PCCardTypeIV: - discType = "PCMCIA Card"; - discSubType = "PC-Card Type IV"; - - break; - case CommonTypes.MediaType.ExpressCard34: - discType = "Express Card"; - discSubType = "Express Card (34mm)"; - - break; - case CommonTypes.MediaType.ExpressCard54: - discType = "Express Card"; - discSubType = "Express Card (54mm)"; - - break; - case CommonTypes.MediaType.FamicomGamePak: - discType = "Nintendo Famicom Game Pak"; - discSubType = "Nintendo Famicom Game Pak"; - - break; - case CommonTypes.MediaType.GameBoyAdvanceGamePak: - discType = "Nintendo Game Boy Advance Game Pak"; - discSubType = "Nintendo Game Boy Advance Game Pak"; - - break; - case CommonTypes.MediaType.GameBoyGamePak: - discType = "Nintendo Game Boy Game Pak"; - discSubType = "Nintendo Game Boy Game Pak"; - - break; - case CommonTypes.MediaType.N64DD: - discType = "Nintendo 64 Disk"; - discSubType = "Nintendo 64 Disk"; - - break; - case CommonTypes.MediaType.N64GamePak: - discType = "Nintendo 64 Game Pak"; - discSubType = "Nintendo 64 Game Pak"; - - break; - case CommonTypes.MediaType.NESGamePak: - discType = "Nintendo Entertainment System Game Pak"; - discSubType = "Nintendo Entertainment System Game Pak"; - - break; - case CommonTypes.MediaType.Nintendo3DSGameCard: - discType = "Nintendo 3DS Game Card"; - discSubType = "Nintendo 3DS Game Card"; - - break; - case CommonTypes.MediaType.NintendoDiskCard: - discType = "Nintendo Disk Card"; - discSubType = "Nintendo Disk Card"; - - break; - case CommonTypes.MediaType.NintendoDSGameCard: - discType = "Nintendo DS Game Card"; - discSubType = "Nintendo DS Game Card"; - - break; - case CommonTypes.MediaType.NintendoDSiGameCard: - discType = "Nintendo DSi Game Card"; - discSubType = "Nintendo DSi Game Card"; - - break; - case CommonTypes.MediaType.SNESGamePak: - discType = "Super Nintendo Game Pak"; - discSubType = "Super Nintendo Game Pak"; - - break; - case CommonTypes.MediaType.SNESGamePakUS: - discType = "Super Nintendo Game Pak (US)"; - discSubType = "Super Nintendo Game Pak (US)"; - - break; - case CommonTypes.MediaType.SwitchGameCard: - discType = "Nintendo Switch Game Card"; - discSubType = "Nintendo Switch Game Card"; - - break; - case CommonTypes.MediaType.IBM3470: - discType = "IBM 3470"; - discSubType = "IBM 3470"; - - break; - case CommonTypes.MediaType.IBM3480: - discType = "IBM 3480"; - discSubType = "IBM 3480"; - - break; - case CommonTypes.MediaType.IBM3490: - discType = "IBM 3490"; - discSubType = "IBM 3490"; - - break; - case CommonTypes.MediaType.IBM3490E: - discType = "IBM 3490E"; - discSubType = "IBM 3490E"; - - break; - case CommonTypes.MediaType.IBM3592: - discType = "IBM 3592"; - discSubType = "IBM 3592"; - - break; - case CommonTypes.MediaType.STK4480: - discType = "STK 4480"; - discSubType = "STK 4480"; - - break; - case CommonTypes.MediaType.STK4490: - discType = "STK 4490"; - discSubType = "STK 4490"; - - break; - case CommonTypes.MediaType.STK9490: - discType = "STK 9490"; - discSubType = "STK 9490"; - - break; - case CommonTypes.MediaType.T9840A: - discType = "STK T-9840"; - discSubType = "STK T-9840A"; - - break; - case CommonTypes.MediaType.T9840B: - discType = "STK T-9840"; - discSubType = "STK T-9840B"; - - break; - case CommonTypes.MediaType.T9840C: - discType = "STK T-9840"; - discSubType = "STK T-9840C"; - - break; - case CommonTypes.MediaType.T9840D: - discType = "STK T-9840"; - discSubType = "STK T-9840D"; - - break; - case CommonTypes.MediaType.T9940A: - discType = "STK T-9940"; - discSubType = "STK T-9940A"; - - break; - case CommonTypes.MediaType.T9940B: - discType = "STK T-9840"; - discSubType = "STK T-9840B"; - - break; - case CommonTypes.MediaType.T10000A: - discType = "STK T-10000"; - discSubType = "STK T-10000A"; - - break; - case CommonTypes.MediaType.T10000B: - discType = "STK T-10000"; - discSubType = "STK T-10000B"; - - break; - case CommonTypes.MediaType.T10000C: - discType = "STK T-10000"; - discSubType = "STK T-10000C"; - - break; - case CommonTypes.MediaType.T10000D: - discType = "STK T-10000"; - discSubType = "STK T-10000D"; - - break; - case CommonTypes.MediaType.DemiDiskette: - discType = "DemiDiskette"; - discSubType = "DemiDiskette"; - - break; - case CommonTypes.MediaType.QuickDisk: - discType = "QuickDisk"; - discSubType = "QuickDisk"; - - break; - case CommonTypes.MediaType.VideoFloppy: - discType = "VideoFloppy"; - discSubType = "VideoFloppy"; - - break; - case CommonTypes.MediaType.Wafer: - discType = "Wafer"; - discSubType = "Wafer"; - - break; - case CommonTypes.MediaType.ZXMicrodrive: - discType = "ZX Microdrive"; - discSubType = "ZX Microdrive"; - - break; - case CommonTypes.MediaType.BeeCard: - discType = "BeeCard"; - discSubType = "BeeCard"; - - break; - case CommonTypes.MediaType.Borsu: - discType = "Borsu"; - discSubType = "Borsu"; - - break; - case CommonTypes.MediaType.DataStore: - discType = "DataStore"; - discSubType = "DataStore"; - - break; - case CommonTypes.MediaType.DIR: - discType = "DIR"; - discSubType = "DIR"; - - break; - case CommonTypes.MediaType.DST: - discType = "DST"; - discSubType = "DST"; - - break; - case CommonTypes.MediaType.DTF: - discType = "DTF"; - discSubType = "DTF"; - - break; - case CommonTypes.MediaType.DTF2: - discType = "DTF2"; - discSubType = "DTF2"; - - break; - case CommonTypes.MediaType.Flextra3020: - discType = "Flextra"; - discSubType = "Flextra 3020"; - - break; - case CommonTypes.MediaType.Flextra3225: - discType = "Flextra"; - discSubType = "Flextra 3225"; - - break; - case CommonTypes.MediaType.HiTC1: - discType = "HiTC"; - discSubType = "HiTC1"; - - break; - case CommonTypes.MediaType.HiTC2: - discType = "HiTC"; - discSubType = "HiTC2"; - - break; - case CommonTypes.MediaType.LT1: - discType = "LT1"; - discSubType = "LT1"; - - break; - case CommonTypes.MediaType.MiniCard: - discType = "MiniCard"; - discSubType = "MiniCard"; - - break; - case CommonTypes.MediaType.Orb: - discType = "Orb"; - discSubType = "Orb"; - - break; - case CommonTypes.MediaType.Orb5: - discType = "Orb"; - discSubType = "Orb5"; - - break; - case CommonTypes.MediaType.SmartMedia: - discType = "SmartMedia"; - discSubType = "SmartMedia"; - - break; - case CommonTypes.MediaType.xD: - discType = "xD"; - discSubType = "xD"; - - break; - case CommonTypes.MediaType.XQD: - discType = "XQD"; - discSubType = "XQD"; - - break; - case CommonTypes.MediaType.DataPlay: - discType = "DataPlay"; - discSubType = "DataPlay"; - - break; - case CommonTypes.MediaType.PD650: - discType = "PD650"; - discSubType = "PD650"; - - break; - case CommonTypes.MediaType.PD650_WORM: - discType = "PD650"; - discSubType = "PD650 (WORM)"; - - break; - case CommonTypes.MediaType.RA60: - discType = "Hard Disk Drive"; - discSubType = "DEC RA-60"; - - break; - case CommonTypes.MediaType.RA80: - discType = "Hard Disk Drive"; - discSubType = "DEC RA-80"; - - break; - case CommonTypes.MediaType.RA81: - discType = "Hard Disk Drive"; - discSubType = "DEC RA-81"; - - break; - case CommonTypes.MediaType.RC25: - discType = "Hard Disk Drive"; - discSubType = "DEC RC-25"; - - break; - case CommonTypes.MediaType.RD31: - discType = "Hard Disk Drive"; - discSubType = "DEC RD-31"; - - break; - case CommonTypes.MediaType.RD32: - discType = "Hard Disk Drive"; - discSubType = "DEC RD-32"; - - break; - case CommonTypes.MediaType.RD51: - discType = "Hard Disk Drive"; - discSubType = "DEC RD-51"; - - break; - case CommonTypes.MediaType.RD52: - discType = "Hard Disk Drive"; - discSubType = "DEC RD-52"; - - break; - case CommonTypes.MediaType.RD53: - discType = "Hard Disk Drive"; - discSubType = "DEC RD-53"; - - break; - case CommonTypes.MediaType.RD54: - discType = "Hard Disk Drive"; - discSubType = "DEC RD-54"; - - break; - case CommonTypes.MediaType.RK06: - case CommonTypes.MediaType.RK06_18: - discType = "Hard Disk Drive"; - discSubType = "DEC RK-06"; - - break; - case CommonTypes.MediaType.RK07: - case CommonTypes.MediaType.RK07_18: - discType = "Hard Disk Drive"; - discSubType = "DEC RK-07"; - - break; - case CommonTypes.MediaType.RM02: - discType = "Hard Disk Drive"; - discSubType = "DEC RM-02"; - - break; - case CommonTypes.MediaType.RM03: - discType = "Hard Disk Drive"; - discSubType = "DEC RM-03"; - - break; - case CommonTypes.MediaType.RM05: - discType = "Hard Disk Drive"; - discSubType = "DEC RM-05"; - - break; - case CommonTypes.MediaType.RP02: - case CommonTypes.MediaType.RP02_18: - discType = "Hard Disk Drive"; - discSubType = "DEC RP-02"; - - break; - case CommonTypes.MediaType.RP03: - case CommonTypes.MediaType.RP03_18: - discType = "Hard Disk Drive"; - discSubType = "DEC RP-03"; - - break; - case CommonTypes.MediaType.RP04: - case CommonTypes.MediaType.RP04_18: - discType = "Hard Disk Drive"; - discSubType = "DEC RP-04"; - - break; - case CommonTypes.MediaType.RP05: - case CommonTypes.MediaType.RP05_18: - discType = "Hard Disk Drive"; - discSubType = "DEC RP-05"; - - break; - case CommonTypes.MediaType.RP06: - case CommonTypes.MediaType.RP06_18: - discType = "Hard Disk Drive"; - discSubType = "DEC RP-06"; - - break; - case CommonTypes.MediaType.RDX: - discType = "RDX"; - discSubType = "RDX"; - - break; - case CommonTypes.MediaType.RDX320: - discType = "RDX"; - discSubType = "RDX 320"; - - break; - case CommonTypes.MediaType.Zone_HDD: - discType = "Zoned Hard Disk Drive"; - discSubType = "Unknown"; - - break; - case CommonTypes.MediaType.Microdrive: - discType = "Hard Disk Drive"; - discSubType = "Microdrive"; - - break; - case CommonTypes.MediaType.VideoNow: - discType = "VideoNow"; - discSubType = "VideoNow"; - - break; - case CommonTypes.MediaType.VideoNowColor: - discType = "VideoNow"; - discSubType = "VideoNow Color"; - - break; - case CommonTypes.MediaType.VideoNowXp: - discType = "VideoNow"; - discSubType = "VideoNow XP"; - - break; - case CommonTypes.MediaType.KodakVerbatim3: - discType = "Kodak Verbatim"; - discSubType = "Kodak Verbatim (3 Mb)"; - - break; - case CommonTypes.MediaType.KodakVerbatim6: - discType = "Kodak Verbatim"; - discSubType = "Kodak Verbatim (6 Mb)"; - - break; - case CommonTypes.MediaType.KodakVerbatim12: - discType = "Kodak Verbatim"; - discSubType = "Kodak Verbatim (12 Mb)"; - - break; - case CommonTypes.MediaType.ProfessionalDisc: - discType = "Sony Professional Disc"; - discSubType = "Sony Professional Disc (single layer)"; - - break; - case CommonTypes.MediaType.ProfessionalDiscDual: - discType = "Sony Professional Disc"; - discSubType = "Sony Professional Disc (double layer)"; - - break; - case CommonTypes.MediaType.ProfessionalDiscTriple: - discType = "Sony Professional Disc"; - discSubType = "Sony Professional Disc (triple layer)"; - - break; - case CommonTypes.MediaType.ProfessionalDiscQuad: - discType = "Sony Professional Disc"; - discSubType = "Sony Professional Disc (quad layer)"; - - break; - case CommonTypes.MediaType.PDD: - discType = "Sony Professional Disc for DATA"; - discSubType = "Sony Professional Disc for DATA"; - - break; - case CommonTypes.MediaType.PDD_WORM: - discType = "Sony Professional Disc for DATA"; - discSubType = "Sony Professional Disc for DATA (write-once)"; - - break; - case CommonTypes.MediaType.ArchivalDisc: - discType = "Archival Disc"; - discSubType = "Archival Disc"; - - break; - case CommonTypes.MediaType.ArchivalDisc2: - discType = "Archival Disc"; - discSubType = "Archival Disc (2nd generation)"; - - break; - case CommonTypes.MediaType.ArchivalDisc3: - discType = "Archival Disc"; - discSubType = "Archival Disc (3rd generation)"; - - break; - case CommonTypes.MediaType.ODC300R: - discType = "Optical Disc Archive"; - discSubType = "ODC300R"; - - break; - case CommonTypes.MediaType.ODC300RE: - discType = "Optical Disc Archive"; - discSubType = "ODC300RE"; - - break; - case CommonTypes.MediaType.ODC600R: - discType = "Optical Disc Archive"; - discSubType = "ODC600R"; - - break; - case CommonTypes.MediaType.ODC600RE: - discType = "Optical Disc Archive"; - discSubType = "ODC600RE"; - - break; - case CommonTypes.MediaType.ODC1200RE: - discType = "Optical Disc Archive"; - discSubType = "ODC1200RE"; - - break; - case CommonTypes.MediaType.ODC1500R: - discType = "Optical Disc Archive"; - discSubType = "ODC1500R"; - - break; - case CommonTypes.MediaType.ODC3300R: - discType = "Optical Disc Archive"; - discSubType = "ODC3300R"; - - break; - case CommonTypes.MediaType.ODC5500R: - discType = "Optical Disc Archive"; - discSubType = "ODC5500R"; - - break; - case CommonTypes.MediaType.MetaFloppy_Mod_I: - discType = "5.25\" floppy"; - discSubType = "Micropolis MetaFloppy Mod I"; - - break; - case CommonTypes.MediaType.MetaFloppy_Mod_II: - discType = "5.25\" floppy"; - discSubType = "Micropolis MetaFloppy Mod II"; - - break; - default: - discType = "Unknown"; - discSubType = "Unknown"; - - break; - } - - return (discType, discSubType); + case CommonTypes.MediaType.BDR: + discType = "Blu-ray"; + discSubType = "BD-R"; + + break; + case CommonTypes.MediaType.BDRE: + discType = "Blu-ray"; + discSubType = "BD-RE"; + + break; + case CommonTypes.MediaType.BDREXL: + discType = "Blu-ray"; + discSubType = "BD-RE XL"; + + break; + case CommonTypes.MediaType.BDROM: + discType = "Blu-ray"; + discSubType = "BD-ROM"; + + break; + case CommonTypes.MediaType.BDRXL: + discType = "Blu-ray"; + discSubType = "BD-R XL"; + + break; + case CommonTypes.MediaType.UHDBD: + discType = "Blu-ray"; + discSubType = "Ultra HD Blu-ray"; + + break; + case CommonTypes.MediaType.CBHD: + discType = "Blu-ray"; + discSubType = "CBHD"; + + break; + case CommonTypes.MediaType.CD: + discType = "Compact Disc"; + discSubType = "CD"; + + break; + case CommonTypes.MediaType.CDDA: + discType = "Compact Disc"; + discSubType = "CD Digital Audio"; + + break; + case CommonTypes.MediaType.CDEG: + discType = "Compact Disc"; + discSubType = "CD+EG"; + + break; + case CommonTypes.MediaType.CDG: + discType = "Compact Disc"; + discSubType = "CD+G"; + + break; + case CommonTypes.MediaType.CDI: + discType = "Compact Disc"; + discSubType = "CD-i"; + + break; + case CommonTypes.MediaType.CDIREADY: + discType = "Compact Disc"; + discSubType = "CD-i Ready"; + + break; + case CommonTypes.MediaType.CDMIDI: + discType = "Compact Disc"; + discSubType = "CD+MIDI"; + + break; + case CommonTypes.MediaType.CDMO: + discType = "Compact Disc"; + discSubType = "CD-MO"; + + break; + case CommonTypes.MediaType.CDMRW: + discType = "Compact Disc"; + discSubType = "CD-MRW"; + + break; + case CommonTypes.MediaType.CDPLUS: + discType = "Compact Disc"; + discSubType = "CD+"; + + break; + case CommonTypes.MediaType.CDR: + discType = "Compact Disc"; + discSubType = "CD-R"; + + break; + case CommonTypes.MediaType.CDROM: + discType = "Compact Disc"; + discSubType = "CD-ROM"; + + break; + case CommonTypes.MediaType.CDROMXA: + discType = "Compact Disc"; + discSubType = "CD-ROM XA"; + + break; + case CommonTypes.MediaType.CDRW: + discType = "Compact Disc"; + discSubType = "CD-RW"; + + break; + case CommonTypes.MediaType.CDV: + discType = "Compact Disc"; + discSubType = "CD-Video"; + + break; + case CommonTypes.MediaType.DDCD: + discType = "DDCD"; + discSubType = "DDCD"; + + break; + case CommonTypes.MediaType.DDCDR: + discType = "DDCD"; + discSubType = "DDCD-R"; + + break; + case CommonTypes.MediaType.DDCDRW: + discType = "DDCD"; + discSubType = "DDCD-RW"; + + break; + case CommonTypes.MediaType.DTSCD: + discType = "Compact Disc"; + discSubType = "DTS CD"; + + break; + case CommonTypes.MediaType.DVDDownload: + discType = "DVD"; + discSubType = "DVD-Download"; + + break; + case CommonTypes.MediaType.DVDPR: + discType = "DVD"; + discSubType = "DVD+R"; + + break; + case CommonTypes.MediaType.DVDPRDL: + discType = "DVD"; + discSubType = "DVD+R DL"; + + break; + case CommonTypes.MediaType.DVDPRW: + discType = "DVD"; + discSubType = "DVD+RW"; + + break; + case CommonTypes.MediaType.DVDPRWDL: + discType = "DVD"; + discSubType = "DVD+RW DL"; + + break; + case CommonTypes.MediaType.DVDR: + discType = "DVD"; + discSubType = "DVD-R"; + + break; + case CommonTypes.MediaType.DVDRAM: + discType = "DVD"; + discSubType = "DVD-RAM"; + + break; + case CommonTypes.MediaType.DVDRDL: + discType = "DVD"; + discSubType = "DVD-R DL"; + + break; + case CommonTypes.MediaType.DVDROM: + discType = "DVD"; + discSubType = "DVD-ROM"; + + break; + case CommonTypes.MediaType.DVDRW: + discType = "DVD"; + discSubType = "DVD-RW"; + + break; + case CommonTypes.MediaType.DVDRWDL: + discType = "DVD"; + discSubType = "DVD-RW DL"; + + break; + case CommonTypes.MediaType.EVD: + discType = "EVD"; + discSubType = "EVD"; + + break; + case CommonTypes.MediaType.FDDVD: + discType = "FDDVD"; + discSubType = "FDDVD"; + + break; + case CommonTypes.MediaType.FVD: + discType = "FVD"; + discSubType = "FVD"; + + break; + case CommonTypes.MediaType.GDR: + discType = "GD"; + discSubType = "GD-R"; + + break; + case CommonTypes.MediaType.GDROM: + discType = "GD"; + discSubType = "GD-ROM"; + + break; + case CommonTypes.MediaType.GOD: + discType = "DVD"; + discSubType = "GameCube Game Disc"; + + break; + case CommonTypes.MediaType.WOD: + discType = "DVD"; + discSubType = "Wii Optical Disc"; + + break; + case CommonTypes.MediaType.WUOD: + discType = "Blu-ray"; + discSubType = "Wii U Optical Disc"; + + break; + case CommonTypes.MediaType.HDDVDR: + discType = "HD DVD"; + discSubType = "HD DVD-R"; + + break; + case CommonTypes.MediaType.HDDVDRAM: + discType = "HD DVD"; + discSubType = "HD DVD-RAM"; + + break; + case CommonTypes.MediaType.HDDVDRDL: + discType = "HD DVD"; + discSubType = "HD DVD-R DL"; + + break; + case CommonTypes.MediaType.HDDVDROM: + discType = "HD DVD"; + discSubType = "HD DVD-ROM"; + + break; + case CommonTypes.MediaType.HDDVDRW: + discType = "HD DVD"; + discSubType = "HD DVD-RW"; + + break; + case CommonTypes.MediaType.HDDVDRWDL: + discType = "HD DVD"; + discSubType = "HD DVD-RW DL"; + + break; + case CommonTypes.MediaType.HDVMD: + discType = "HD VMD"; + discSubType = "HD VMD"; + + break; + case CommonTypes.MediaType.HiMD: + discType = "MiniDisc"; + discSubType = "Hi-MD"; + + break; + case CommonTypes.MediaType.HVD: + discType = "HVD"; + discSubType = "HVD"; + + break; + case CommonTypes.MediaType.LD: + discType = "LaserDisc"; + discSubType = "LaserDisc"; + + break; + case CommonTypes.MediaType.CRVdisc: + discType = "CRVdisc"; + discSubType = "CRVdisc"; + + break; + case CommonTypes.MediaType.LDROM: + discType = "LaserDisc"; + discSubType = "LD-ROM"; + + break; + case CommonTypes.MediaType.LVROM: + discType = "LaserDisc"; + discSubType = "LV-ROM"; + + break; + case CommonTypes.MediaType.MegaLD: + discType = "LaserDisc"; + discSubType = "MegaLD"; + + break; + case CommonTypes.MediaType.MD: + discType = "MiniDisc"; + discSubType = "MiniDisc"; + + break; + case CommonTypes.MediaType.MD60: + discType = "MiniDisc"; + discSubType = "MiniDisc (60 minute)"; + + break; + case CommonTypes.MediaType.MD74: + discType = "MiniDisc"; + discSubType = "MiniDisc (74 minute)"; + + break; + case CommonTypes.MediaType.MD80: + discType = "MiniDisc"; + discSubType = "MiniDisc (80 minute)"; + + break; + case CommonTypes.MediaType.MEGACD: + discType = "Compact Disc"; + discSubType = "Sega Mega CD"; + + break; + case CommonTypes.MediaType.PCD: + discType = "Compact Disc"; + discSubType = "Photo CD"; + + break; + case CommonTypes.MediaType.PlayStationMemoryCard: + discType = "PlayStation Memory Card"; + discSubType = "PlayStation Memory Card"; + + break; + case CommonTypes.MediaType.PlayStationMemoryCard2: + discType = "PlayStation Memory Card"; + discSubType = "PlayStation 2 Memory Card"; + + break; + case CommonTypes.MediaType.PS1CD: + discType = "Compact Disc"; + discSubType = "PlayStation Game Disc"; + + break; + case CommonTypes.MediaType.PS2CD: + discType = "Compact Disc"; + discSubType = "PlayStation 2 Game Disc"; + + break; + case CommonTypes.MediaType.PS2DVD: + discType = "DVD"; + discSubType = "PlayStation 2 Game Disc"; + + break; + case CommonTypes.MediaType.PS3BD: + discType = "Blu-ray"; + discSubType = "PlayStation 3 Game Disc"; + + break; + case CommonTypes.MediaType.PS3DVD: + discType = "DVD"; + discSubType = "PlayStation 3 Game Disc"; + + break; + case CommonTypes.MediaType.PS4BD: + discType = "Blu-ray"; + discSubType = "PlayStation 4 Game Disc"; + + break; + case CommonTypes.MediaType.PS5BD: + discType = "Blu-ray"; + discSubType = "PlayStation 5 Game Disc"; + + break; + case CommonTypes.MediaType.SACD: + discType = "SACD"; + discSubType = "Super Audio CD"; + + break; + case CommonTypes.MediaType.SegaCard: + discType = "Sega Card"; + discSubType = "Sega Card"; + + break; + case CommonTypes.MediaType.SATURNCD: + discType = "Compact Disc"; + discSubType = "Sega Saturn CD"; + + break; + case CommonTypes.MediaType.SVCD: + discType = "Compact Disc"; + discSubType = "Super Video CD"; + + break; + case CommonTypes.MediaType.CVD: + discType = "Compact Disc"; + discSubType = "China Video Disc"; + + break; + case CommonTypes.MediaType.SVOD: + discType = "SVOD"; + discSubType = "SVOD"; + + break; + case CommonTypes.MediaType.UDO: + discType = "UDO"; + discSubType = "UDO"; + + break; + case CommonTypes.MediaType.UMD: + discType = "UMD"; + discSubType = "Universal Media Disc"; + + break; + case CommonTypes.MediaType.VCD: + discType = "Compact Disc"; + discSubType = "Video CD"; + + break; + case CommonTypes.MediaType.Nuon: + discType = "DVD"; + discSubType = "Nuon"; + + break; + case CommonTypes.MediaType.XGD: + discType = "DVD"; + discSubType = "Xbox Game Disc (XGD)"; + + break; + case CommonTypes.MediaType.XGD2: + discType = "DVD"; + discSubType = "Xbox 360 Game Disc (XGD2)"; + + break; + case CommonTypes.MediaType.XGD3: + discType = "DVD"; + discSubType = "Xbox 360 Game Disc (XGD3)"; + + break; + case CommonTypes.MediaType.XGD4: + discType = "Blu-ray"; + discSubType = "Xbox One Game Disc (XGD4)"; + + break; + case CommonTypes.MediaType.FMTOWNS: + discType = "Compact Disc"; + discSubType = "FM-Towns"; + + break; + case CommonTypes.MediaType.Apple32SS: + discType = "5.25\" floppy"; + discSubType = "Apple DOS 3.2"; + + break; + case CommonTypes.MediaType.Apple32DS: + discType = "5.25\" floppy"; + discSubType = "Apple DOS 3.2 (double-sided)"; + + break; + case CommonTypes.MediaType.Apple33SS: + discType = "5.25\" floppy"; + discSubType = "Apple DOS 3.3"; + + break; + case CommonTypes.MediaType.Apple33DS: + discType = "5.25\" floppy"; + discSubType = "Apple DOS 3.3 (double-sided)"; + + break; + case CommonTypes.MediaType.AppleSonySS: + discType = "3.5\" floppy"; + discSubType = "Apple 400K"; + + break; + case CommonTypes.MediaType.AppleSonyDS: + discType = "3.5\" floppy"; + discSubType = "Apple 800K"; + + break; + case CommonTypes.MediaType.AppleFileWare: + discType = "5.25\" floppy"; + discSubType = "Apple FileWare"; + + break; + case CommonTypes.MediaType.RX50: + discType = "5.25\" floppy"; + discSubType = "DEC RX50"; + + break; + case CommonTypes.MediaType.DOS_525_SS_DD_8: + discType = "5.25\" floppy"; + discSubType = "IBM double-density, single-sided, 8 sectors"; + + break; + case CommonTypes.MediaType.DOS_525_SS_DD_9: + discType = "5.25\" floppy"; + discSubType = "IBM double-density, single-sided, 9 sectors"; + + break; + case CommonTypes.MediaType.DOS_525_DS_DD_8: + discType = "5.25\" floppy"; + discSubType = "IBM double-density, double-sided, 8 sectors"; + + break; + case CommonTypes.MediaType.DOS_525_DS_DD_9: + discType = "5.25\" floppy"; + discSubType = "IBM double-density, double-sided, 9 sectors"; + + break; + case CommonTypes.MediaType.DOS_525_HD: + discType = "5.25\" floppy"; + discSubType = "IBM high-density"; + + break; + case CommonTypes.MediaType.DOS_35_SS_DD_8: + discType = "3.5\" floppy"; + discSubType = "IBM double-density, single-sided, 8 sectors"; + + break; + case CommonTypes.MediaType.DOS_35_SS_DD_9: + discType = "3.5\" floppy"; + discSubType = "IBM double-density, single-sided, 9 sectors"; + + break; + case CommonTypes.MediaType.DOS_35_DS_DD_8: + discType = "3.5\" floppy"; + discSubType = "IBM double-density, double-sided, 8 sectors"; + + break; + case CommonTypes.MediaType.DOS_35_DS_DD_9: + discType = "3.5\" floppy"; + discSubType = "IBM double-density, double-sided, 9 sectors"; + + break; + case CommonTypes.MediaType.DOS_35_HD: + discType = "3.5\" floppy"; + discSubType = "IBM high-density"; + + break; + case CommonTypes.MediaType.DOS_35_ED: + discType = "3.5\" floppy"; + discSubType = "IBM extra-density"; + + break; + case CommonTypes.MediaType.Apricot_35: + discType = "3.5\" floppy"; + discSubType = "Apricot double-density, single-sided, 70 tracks"; + + break; + case CommonTypes.MediaType.DMF: + discType = "3.5\" floppy"; + discSubType = "Microsoft DMF"; + + break; + case CommonTypes.MediaType.DMF_82: + discType = "3.5\" floppy"; + discSubType = "Microsoft DMF (82-track)"; + + break; + case CommonTypes.MediaType.XDF_35: + discType = "3.5\" floppy"; + discSubType = "IBM XDF"; + + break; + case CommonTypes.MediaType.XDF_525: + discType = "5.25\" floppy"; + discSubType = "IBM XDF"; + + break; + case CommonTypes.MediaType.IBM23FD: + discType = "8\" floppy"; + discSubType = "IBM 23FD"; + + break; + case CommonTypes.MediaType.IBM33FD_128: + discType = "8\" floppy"; + discSubType = "IBM 33FD (128 bytes/sector)"; + + break; + case CommonTypes.MediaType.IBM33FD_256: + discType = "8\" floppy"; + discSubType = "IBM 33FD (256 bytes/sector)"; + + break; + case CommonTypes.MediaType.IBM33FD_512: + discType = "8\" floppy"; + discSubType = "IBM 33FD (512 bytes/sector)"; + + break; + case CommonTypes.MediaType.IBM43FD_128: + discType = "8\" floppy"; + discSubType = "IBM 43FD (128 bytes/sector)"; + + break; + case CommonTypes.MediaType.IBM43FD_256: + discType = "8\" floppy"; + discSubType = "IBM 43FD (256 bytes/sector)"; + + break; + case CommonTypes.MediaType.IBM53FD_256: + discType = "8\" floppy"; + discSubType = "IBM 53FD (256 bytes/sector)"; + + break; + case CommonTypes.MediaType.IBM53FD_512: + discType = "8\" floppy"; + discSubType = "IBM 53FD (512 bytes/sector)"; + + break; + case CommonTypes.MediaType.IBM53FD_1024: + discType = "8\" floppy"; + discSubType = "IBM 53FD (1024 bytes/sector)"; + + break; + case CommonTypes.MediaType.RX01: + discType = "8\" floppy"; + discSubType = "DEC RX-01"; + + break; + case CommonTypes.MediaType.RX02: + discType = "8\" floppy"; + discSubType = "DEC RX-02"; + + break; + case CommonTypes.MediaType.RX03: + discType = "8\" floppy"; + discSubType = "DEC RX-03"; + + break; + case CommonTypes.MediaType.ACORN_525_SS_SD_40: + discType = "5.25\" floppy"; + discSubType = "BBC Micro 100K"; + + break; + case CommonTypes.MediaType.ACORN_525_SS_SD_80: + discType = "5.25\" floppy"; + discSubType = "BBC Micro 200K"; + + break; + case CommonTypes.MediaType.ACORN_525_SS_DD_40: + discType = "5.25\" floppy"; + discSubType = "Acorn S"; + + break; + case CommonTypes.MediaType.ACORN_525_SS_DD_80: + discType = "5.25\" floppy"; + discSubType = "Acorn M"; + + break; + case CommonTypes.MediaType.ACORN_525_DS_DD: + discType = "5.25\" floppy"; + discSubType = "Acorn L"; + + break; + case CommonTypes.MediaType.ACORN_35_DS_DD: + discType = "3.5\" floppy"; + discSubType = "Acorn Archimedes"; + + break; + case CommonTypes.MediaType.ACORN_35_DS_HD: + discType = "3.5\" floppy"; + discSubType = "Acorn Archimedes high-density"; + + break; + case CommonTypes.MediaType.ATARI_525_SD: + discType = "5.25\" floppy"; + discSubType = "Atari single-density"; + + break; + case CommonTypes.MediaType.ATARI_525_ED: + discType = "5.25\" floppy"; + discSubType = "Atari enhanced-density"; + + break; + case CommonTypes.MediaType.ATARI_525_DD: + discType = "5.25\" floppy"; + discSubType = "Atari double-density"; + + break; + case CommonTypes.MediaType.ATARI_35_SS_DD: + discType = "3.5\" floppy"; + discSubType = "Atari ST double-density, single-sided, 10 sectors"; + + break; + case CommonTypes.MediaType.ATARI_35_DS_DD: + discType = "3.5\" floppy"; + discSubType = "Atari ST double-density, double-sided, 10 sectors"; + + break; + case CommonTypes.MediaType.ATARI_35_SS_DD_11: + discType = "3.5\" floppy"; + discSubType = "Atari ST double-density, single-sided, 11 sectors"; + + break; + case CommonTypes.MediaType.ATARI_35_DS_DD_11: + discType = "3.5\" floppy"; + discSubType = "Atari ST double-density, double-sided, 11 sectors"; + + break; + case CommonTypes.MediaType.CBM_1540: + case CommonTypes.MediaType.CBM_1540_Ext: + discType = "5.25\" floppy"; + discSubType = "Commodore 1540/1541"; + + break; + case CommonTypes.MediaType.CBM_1571: + discType = "5.25\" floppy"; + discSubType = "Commodore 1571"; + + break; + case CommonTypes.MediaType.CBM_35_DD: + discType = "3.5\" floppy"; + discSubType = "Commodore 1581"; + + break; + case CommonTypes.MediaType.CBM_AMIGA_35_DD: + discType = "3.5\" floppy"; + discSubType = "Amiga double-density"; + + break; + case CommonTypes.MediaType.CBM_AMIGA_35_HD: + discType = "3.5\" floppy"; + discSubType = "Amiga high-density"; + + break; + case CommonTypes.MediaType.NEC_8_SD: + discType = "8\" floppy"; + discSubType = "NEC single-sided"; + + break; + case CommonTypes.MediaType.NEC_8_DD: + discType = "8\" floppy"; + discSubType = "NEC double-sided"; + + break; + case CommonTypes.MediaType.NEC_525_SS: + discType = "5.25\" floppy"; + discSubType = "NEC single-sided"; + + break; + case CommonTypes.MediaType.NEC_525_HD: + discType = "5.25\" floppy"; + discSubType = "NEC high-density"; + + break; + case CommonTypes.MediaType.NEC_35_HD_8: + discType = "3.5\" floppy"; + discSubType = "NEC high-density"; + + break; + case CommonTypes.MediaType.NEC_35_HD_15: + discType = "3.5\" floppy"; + discSubType = "NEC high-density"; + + break; + case CommonTypes.MediaType.NEC_35_TD: + discType = "3.5\" floppy"; + discSubType = "NEC triple-density"; + + break; + case CommonTypes.MediaType.SHARP_525_9: + discType = "5.25\" floppy"; + discSubType = "Sharp (9 sectors per track)"; + + break; + case CommonTypes.MediaType.SHARP_35_9: + discType = "3.5\" floppy"; + discSubType = "Sharp (9 sectors per track)"; + + break; + case CommonTypes.MediaType.ECMA_54: + discType = "8\" floppy"; + discSubType = "ECMA-54"; + + break; + case CommonTypes.MediaType.ECMA_59: + discType = "8\" floppy"; + discSubType = "ECMA-59"; + + break; + case CommonTypes.MediaType.ECMA_69_8: + case CommonTypes.MediaType.ECMA_69_15: + case CommonTypes.MediaType.ECMA_69_26: + discType = "8\" floppy"; + discSubType = "ECMA-69"; + + break; + case CommonTypes.MediaType.ECMA_66: + discType = "5.25\" floppy"; + discSubType = "ECMA-66"; + + break; + case CommonTypes.MediaType.ECMA_70: + discType = "5.25\" floppy"; + discSubType = "ECMA-70"; + + break; + case CommonTypes.MediaType.ECMA_78: + case CommonTypes.MediaType.ECMA_78_2: + discType = "5.25\" floppy"; + discSubType = "ECMA-78"; + + break; + case CommonTypes.MediaType.ECMA_99_8: + case CommonTypes.MediaType.ECMA_99_15: + case CommonTypes.MediaType.ECMA_99_26: + discType = "5.25\" floppy"; + discSubType = "ECMA-99"; + + break; + case CommonTypes.MediaType.FDFORMAT_525_DD: + discType = "5.25\" floppy"; + discSubType = "FDFORMAT double-density"; + + break; + case CommonTypes.MediaType.FDFORMAT_525_HD: + discType = "5.25\" floppy"; + discSubType = "FDFORMAT high-density"; + + break; + case CommonTypes.MediaType.FDFORMAT_35_DD: + discType = "3.5\" floppy"; + discSubType = "FDFORMAT double-density"; + + break; + case CommonTypes.MediaType.FDFORMAT_35_HD: + discType = "3.5\" floppy"; + discSubType = "FDFORMAT high-density"; + + break; + case CommonTypes.MediaType.ECMA_260: + case CommonTypes.MediaType.ECMA_260_Double: + discType = "356mm magneto-optical"; + discSubType = "ECMA-260 / ISO 15898"; + + break; + case CommonTypes.MediaType.ECMA_183_512: + case CommonTypes.MediaType.ECMA_183: + discType = "5.25\" magneto-optical"; + discSubType = "ECMA-183"; + + break; + case CommonTypes.MediaType.ISO_10089: + case CommonTypes.MediaType.ISO_10089_512: + discType = "5.25\" magneto-optical"; + discSubType = "ISO 10089"; + + break; + case CommonTypes.MediaType.ECMA_184_512: + case CommonTypes.MediaType.ECMA_184: + discType = "5.25\" magneto-optical"; + discSubType = "ECMA-184"; + + break; + case CommonTypes.MediaType.ECMA_154: + discType = "3.5\" magneto-optical"; + discSubType = "ECMA-154"; + + break; + case CommonTypes.MediaType.ECMA_201: + case CommonTypes.MediaType.ECMA_201_ROM: + discType = "3.5\" magneto-optical"; + discSubType = "ECMA-201"; + + break; + case CommonTypes.MediaType.ISO_15041_512: + discType = "3.5\" magneto-optical"; + discSubType = "ISO 15041"; + + break; + case CommonTypes.MediaType.FlashDrive: + discType = "USB flash drive"; + discSubType = "USB flash drive"; + + break; + case CommonTypes.MediaType.SuperCDROM2: + discType = "Compact Disc"; + discSubType = "Super CD-ROM²"; + + break; + case CommonTypes.MediaType.LDROM2: + discType = "LaserDisc"; + discSubType = "LD-ROM²"; + + break; + case CommonTypes.MediaType.JaguarCD: + discType = "Compact Disc"; + discSubType = "Atari Jaguar CD"; + + break; + case CommonTypes.MediaType.MilCD: + discType = "Compact Disc"; + discSubType = "Sega MilCD"; + + break; + case CommonTypes.MediaType.ThreeDO: + discType = "Compact Disc"; + discSubType = "3DO"; + + break; + case CommonTypes.MediaType.PCFX: + discType = "Compact Disc"; + discSubType = "PC-FX"; + + break; + case CommonTypes.MediaType.NeoGeoCD: + discType = "Compact Disc"; + discSubType = "NEO-GEO CD"; + + break; + case CommonTypes.MediaType.CDTV: + discType = "Compact Disc"; + discSubType = "Commodore CDTV"; + + break; + case CommonTypes.MediaType.CD32: + discType = "Compact Disc"; + discSubType = "Amiga CD32"; + + break; + case CommonTypes.MediaType.Playdia: + discType = "Compact Disc"; + discSubType = "Bandai Playdia"; + + break; + case CommonTypes.MediaType.Pippin: + discType = "Compact Disc"; + discSubType = "Apple Pippin"; + + break; + case CommonTypes.MediaType.ZIP100: + discType = "Iomega ZIP"; + discSubType = "Iomega ZIP100"; + + break; + case CommonTypes.MediaType.ZIP250: + discType = "Iomega ZIP"; + discSubType = "Iomega ZIP250"; + + break; + case CommonTypes.MediaType.ZIP750: + discType = "Iomega ZIP"; + discSubType = "Iomega ZIP750"; + + break; + case CommonTypes.MediaType.AppleProfile: + discType = "Hard Disk Drive"; + discSubType = "Apple Profile"; + + break; + case CommonTypes.MediaType.AppleWidget: + discType = "Hard Disk Drive"; + discSubType = "Apple Widget"; + + break; + case CommonTypes.MediaType.AppleHD20: + discType = "Hard Disk Drive"; + discSubType = "Apple HD20"; + + break; + case CommonTypes.MediaType.PriamDataTower: + discType = "Hard Disk Drive"; + discSubType = "Priam DataTower"; + + break; + case CommonTypes.MediaType.DDS1: + discType = "Digital Data Storage"; + discSubType = "DDS"; + + break; + case CommonTypes.MediaType.DDS2: + discType = "Digital Data Storage"; + discSubType = "DDS-2"; + + break; + case CommonTypes.MediaType.DDS3: + discType = "Digital Data Storage"; + discSubType = "DDS-3"; + + break; + case CommonTypes.MediaType.DDS4: + discType = "Digital Data Storage"; + discSubType = "DDS-4"; + + break; + case CommonTypes.MediaType.PocketZip: + discType = "Iomega PocketZip"; + discSubType = "Iomega PocketZip"; + + break; + case CommonTypes.MediaType.CompactFloppy: + discType = "3\" floppy"; + discSubType = "Compact Floppy"; + + break; + case CommonTypes.MediaType.GENERIC_HDD: + discType = "Hard Disk Drive"; + discSubType = "Unknown"; + + break; + case CommonTypes.MediaType.MDData: + discType = "MiniDisc"; + discSubType = "MD-DATA"; + + break; + case CommonTypes.MediaType.MDData2: + discType = "MiniDisc"; + discSubType = "MD-DATA2"; + + break; + case CommonTypes.MediaType.UDO2: + discType = "UDO"; + discSubType = "UDO2"; + + break; + case CommonTypes.MediaType.UDO2_WORM: + discType = "UDO"; + discSubType = "UDO2 (WORM)"; + + break; + case CommonTypes.MediaType.ADR30: + discType = "Advanced Digital Recording"; + discSubType = "ADR 30"; + + break; + case CommonTypes.MediaType.ADR50: + discType = "Advanced Digital Recording"; + discSubType = "ADR 50"; + + break; + case CommonTypes.MediaType.ADR260: + discType = "Advanced Digital Recording"; + discSubType = "ADR 2.60"; + + break; + case CommonTypes.MediaType.ADR2120: + discType = "Advanced Digital Recording"; + discSubType = "ADR 2.120"; + + break; + case CommonTypes.MediaType.AIT1: + discType = "Advanced Intelligent Tape"; + discSubType = "AIT-1"; + + break; + case CommonTypes.MediaType.AIT1Turbo: + discType = "Advanced Intelligent Tape"; + discSubType = "AIT-1 Turbo"; + + break; + case CommonTypes.MediaType.AIT2: + discType = "Advanced Intelligent Tape"; + discSubType = "AIT-2"; + + break; + case CommonTypes.MediaType.AIT2Turbo: + discType = "Advanced Intelligent Tape"; + discSubType = "AIT-2 Turbo"; + + break; + case CommonTypes.MediaType.AIT3: + discType = "Advanced Intelligent Tape"; + discSubType = "AIT-3"; + + break; + case CommonTypes.MediaType.AIT3Ex: + discType = "Advanced Intelligent Tape"; + discSubType = "AIT-3Ex"; + + break; + case CommonTypes.MediaType.AIT3Turbo: + discType = "Advanced Intelligent Tape"; + discSubType = "AIT-3 Turbo"; + + break; + case CommonTypes.MediaType.AIT4: + discType = "Advanced Intelligent Tape"; + discSubType = "AIT-4"; + + break; + case CommonTypes.MediaType.AIT5: + discType = "Advanced Intelligent Tape"; + discSubType = "AIT-5"; + + break; + case CommonTypes.MediaType.AITETurbo: + discType = "Advanced Intelligent Tape"; + discSubType = "AIT-E Turbo"; + + break; + case CommonTypes.MediaType.SAIT1: + discType = "Super Advanced Intelligent Tape"; + discSubType = "SAIT-1"; + + break; + case CommonTypes.MediaType.SAIT2: + discType = "Super Advanced Intelligent Tape"; + discSubType = "SAIT-2"; + + break; + case CommonTypes.MediaType.Bernoulli: + case CommonTypes.MediaType.Bernoulli10: + discType = "Iomega Bernoulli Box"; + discSubType = "Iomega Bernoulli Box 10Mb"; + + break; + case CommonTypes.MediaType.Bernoulli20: + discType = "Iomega Bernoulli Box"; + discSubType = "Iomega Bernoulli Box 20Mb"; + + break; + case CommonTypes.MediaType.BernoulliBox2_20: + case CommonTypes.MediaType.Bernoulli2: + discType = "Iomega Bernoulli Box II"; + discSubType = "Iomega Bernoulli Box II 20Mb"; + + break; + case CommonTypes.MediaType.Bernoulli35: + discType = "Iomega Bernoulli Box II"; + discSubType = "Iomega Bernoulli Box II 35Mb"; + + break; + case CommonTypes.MediaType.Bernoulli44: + discType = "Iomega Bernoulli Box II"; + discSubType = "Iomega Bernoulli Box II 44Mb"; + + break; + case CommonTypes.MediaType.Bernoulli65: + discType = "Iomega Bernoulli Box II"; + discSubType = "Iomega Bernoulli Box II 65Mb"; + + break; + case CommonTypes.MediaType.Bernoulli90: + discType = "Iomega Bernoulli Box II"; + discSubType = "Iomega Bernoulli Box II 90Mb"; + + break; + case CommonTypes.MediaType.Bernoulli105: + discType = "Iomega Bernoulli Box II"; + discSubType = "Iomega Bernoulli Box II 105Mb"; + + break; + case CommonTypes.MediaType.Bernoulli150: + discType = "Iomega Bernoulli Box II"; + discSubType = "Iomega Bernoulli Box II 150Mb"; + + break; + case CommonTypes.MediaType.Bernoulli230: + discType = "Iomega Bernoulli Box II"; + discSubType = "Iomega Bernoulli Box II 230Mb"; + + break; + case CommonTypes.MediaType.Ditto: + discType = "Iomega Ditto"; + discSubType = "Iomega Ditto"; + + break; + case CommonTypes.MediaType.DittoMax: + discType = "Iomega Ditto"; + discSubType = "Iomega Ditto Max"; + + break; + case CommonTypes.MediaType.Jaz: + discType = "Iomega Jaz"; + discSubType = "Iomega Jaz 1GB"; + + break; + case CommonTypes.MediaType.Jaz2: + discType = "Iomega Jaz"; + discSubType = "Iomega Jaz 2GB"; + + break; + case CommonTypes.MediaType.REV35: + discType = "Iomega REV"; + discSubType = "Iomega REV-35"; + + break; + case CommonTypes.MediaType.REV70: + discType = "Iomega REV"; + discSubType = "Iomega REV-70"; + + break; + case CommonTypes.MediaType.REV120: + discType = "Iomega REV"; + discSubType = "Iomega REV-120"; + + break; + case CommonTypes.MediaType.CompactFlash: + discType = "Compact Flash"; + discSubType = "Compact Flash"; + + break; + case CommonTypes.MediaType.CompactFlashType2: + discType = "Compact Flash"; + discSubType = "Compact Flash Type 2"; + + break; + case CommonTypes.MediaType.CFast: + discType = "Compact Flash"; + discSubType = "CFast"; + + break; + case CommonTypes.MediaType.DigitalAudioTape: + discType = "Digital Audio Tape"; + discSubType = "Digital Audio Tape"; + + break; + case CommonTypes.MediaType.DAT72: + discType = "Digital Data Storage"; + discSubType = "DAT-72"; + + break; + case CommonTypes.MediaType.DAT160: + discType = "Digital Data Storage"; + discSubType = "DAT-160"; + + break; + case CommonTypes.MediaType.DAT320: + discType = "Digital Data Storage"; + discSubType = "DAT-320"; + + break; + case CommonTypes.MediaType.DECtapeII: + discType = "DECtape"; + discSubType = "DECtape II"; + + break; + case CommonTypes.MediaType.CompactTapeI: + discType = "CompacTape"; + discSubType = "CompacTape"; + + break; + case CommonTypes.MediaType.CompactTapeII: + discType = "CompacTape"; + discSubType = "CompacTape II"; + + break; + case CommonTypes.MediaType.DLTtapeIII: + discType = "Digital Linear Tape"; + discSubType = "DLTtape III"; + + break; + case CommonTypes.MediaType.DLTtapeIIIxt: + discType = "Digital Linear Tape"; + discSubType = "DLTtape IIIXT"; + + break; + case CommonTypes.MediaType.DLTtapeIV: + discType = "Digital Linear Tape"; + discSubType = "DLTtape IV"; + + break; + case CommonTypes.MediaType.DLTtapeS4: + discType = "Digital Linear Tape"; + discSubType = "DLTtape S4"; + + break; + case CommonTypes.MediaType.SDLT1: + discType = "Super Digital Linear Tape"; + discSubType = "SDLTtape I"; + + break; + case CommonTypes.MediaType.SDLT2: + discType = "Super Digital Linear Tape"; + discSubType = "SDLTtape II"; + + break; + case CommonTypes.MediaType.VStapeI: + discType = "Digital Linear Tape"; + discSubType = "DLTtape VS1"; + + break; + case CommonTypes.MediaType.Data8: + discType = "Data8"; + discSubType = "Data8"; + + break; + case CommonTypes.MediaType.MiniDV: + discType = "DV tape"; + discSubType = "MiniDV"; + + break; + case CommonTypes.MediaType.Exatape15m: + discType = "Exatape"; + discSubType = "Exatape (15m)"; + + break; + case CommonTypes.MediaType.Exatape22m: + discType = "Exatape"; + discSubType = "Exatape (22m)"; + + break; + case CommonTypes.MediaType.Exatape22mAME: + discType = "Exatape"; + discSubType = "Exatape (22m AME)"; + + break; + case CommonTypes.MediaType.Exatape28m: + discType = "Exatape"; + discSubType = "Exatape (28m)"; + + break; + case CommonTypes.MediaType.Exatape40m: + discType = "Exatape"; + discSubType = "Exatape (40m)"; + + break; + case CommonTypes.MediaType.Exatape45m: + discType = "Exatape"; + discSubType = "Exatape (45m)"; + + break; + case CommonTypes.MediaType.Exatape54m: + discType = "Exatape"; + discSubType = "Exatape (54m)"; + + break; + case CommonTypes.MediaType.Exatape75m: + discType = "Exatape"; + discSubType = "Exatape (75m)"; + + break; + case CommonTypes.MediaType.Exatape76m: + discType = "Exatape"; + discSubType = "Exatape (76m)"; + + break; + case CommonTypes.MediaType.Exatape80m: + discType = "Exatape"; + discSubType = "Exatape (80m)"; + + break; + case CommonTypes.MediaType.Exatape106m: + discType = "Exatape"; + discSubType = "Exatape (106m)"; + + break; + case CommonTypes.MediaType.Exatape112m: + discType = "Exatape"; + discSubType = "Exatape (112m)"; + + break; + case CommonTypes.MediaType.Exatape125m: + discType = "Exatape"; + discSubType = "Exatape (125m)"; + + break; + case CommonTypes.MediaType.Exatape150m: + discType = "Exatape"; + discSubType = "Exatape (150m)"; + + break; + case CommonTypes.MediaType.Exatape160mXL: + discType = "Exatape"; + discSubType = "Exatape XL (160m)"; + + break; + case CommonTypes.MediaType.Exatape170m: + discType = "Exatape"; + discSubType = "Exatape (170m)"; + + break; + case CommonTypes.MediaType.Exatape225m: + discType = "Exatape"; + discSubType = "Exatape (225m)"; + + break; + case CommonTypes.MediaType.EZ135: + discType = "3.5\" SyQuest cartridge"; + discSubType = "EZ135"; + + break; + case CommonTypes.MediaType.EZ230: + discType = "3.5\" SyQuest cartridge"; + discSubType = "EZ230"; + + break; + case CommonTypes.MediaType.Quest: + discType = "3.5\" SyQuest cartridge"; + discSubType = "Quest"; + + break; + case CommonTypes.MediaType.SparQ: + discType = "3.5\" SyQuest cartridge"; + discSubType = "SparQ"; + + break; + case CommonTypes.MediaType.SQ100: + discType = "3.9\" SyQuest cartridge"; + discSubType = "SQ100"; + + break; + case CommonTypes.MediaType.SQ200: + discType = "3.9\" SyQuest cartridge"; + discSubType = "SQ200"; + + break; + case CommonTypes.MediaType.SQ300: + discType = "3.9\" SyQuest cartridge"; + discSubType = "SQ300"; + + break; + case CommonTypes.MediaType.SQ310: + discType = "3.5\" SyQuest cartridge"; + discSubType = "SQ310"; + + break; + case CommonTypes.MediaType.SQ327: + discType = "3.5\" SyQuest cartridge"; + discSubType = "SQ327"; + + break; + case CommonTypes.MediaType.SQ400: + discType = "5.25\" SyQuest cartridge"; + discSubType = "SQ400"; + + break; + case CommonTypes.MediaType.SQ800: + discType = "5.25\" SyQuest cartridge"; + discSubType = "SQ800"; + + break; + case CommonTypes.MediaType.SQ1500: + discType = "3.5\" SyQuest cartridge"; + discSubType = "SQ1500"; + + break; + case CommonTypes.MediaType.SQ2000: + discType = "5.25\" SyQuest cartridge"; + discSubType = "SQ2000"; + + break; + case CommonTypes.MediaType.SyJet: + discType = "3.5\" SyQuest cartridge"; + discSubType = "SyJet"; + + break; + case CommonTypes.MediaType.LTO: + discType = "Linear Tape-Open"; + discSubType = "LTO"; + + break; + case CommonTypes.MediaType.LTO2: + discType = "Linear Tape-Open"; + discSubType = "LTO-2"; + + break; + case CommonTypes.MediaType.LTO3: + discType = "Linear Tape-Open"; + discSubType = "LTO-3"; + + break; + case CommonTypes.MediaType.LTO3WORM: + discType = "Linear Tape-Open"; + discSubType = "LTO-3 (WORM)"; + + break; + case CommonTypes.MediaType.LTO4: + discType = "Linear Tape-Open"; + discSubType = "LTO-4"; + + break; + case CommonTypes.MediaType.LTO4WORM: + discType = "Linear Tape-Open"; + discSubType = "LTO-4 (WORM)"; + + break; + case CommonTypes.MediaType.LTO5: + discType = "Linear Tape-Open"; + discSubType = "LTO-5"; + + break; + case CommonTypes.MediaType.LTO5WORM: + discType = "Linear Tape-Open"; + discSubType = "LTO-5 (WORM)"; + + break; + case CommonTypes.MediaType.LTO6: + discType = "Linear Tape-Open"; + discSubType = "LTO-6"; + + break; + case CommonTypes.MediaType.LTO6WORM: + discType = "Linear Tape-Open"; + discSubType = "LTO-6 (WORM)"; + + break; + case CommonTypes.MediaType.LTO7: + discType = "Linear Tape-Open"; + discSubType = "LTO-7"; + + break; + case CommonTypes.MediaType.LTO7WORM: + discType = "Linear Tape-Open"; + discSubType = "LTO-7 (WORM)"; + + break; + case CommonTypes.MediaType.MemoryStick: + discType = "Memory Stick"; + discSubType = "Memory Stick"; + + break; + case CommonTypes.MediaType.MemoryStickDuo: + discType = "Memory Stick"; + discSubType = "Memory Stick Duo"; + + break; + case CommonTypes.MediaType.MemoryStickMicro: + discType = "Memory Stick"; + discSubType = "Memory Stick Micro"; + + break; + case CommonTypes.MediaType.MemoryStickPro: + discType = "Memory Stick"; + discSubType = "Memory Stick Pro"; + + break; + case CommonTypes.MediaType.MemoryStickProDuo: + discType = "Memory Stick"; + discSubType = "Memory Stick PRO Duo"; + + break; + case CommonTypes.MediaType.SecureDigital: + discType = "Secure Digital"; + discSubType = "Secure Digital"; + + break; + case CommonTypes.MediaType.miniSD: + discType = "Secure Digital"; + discSubType = "miniSD"; + + break; + case CommonTypes.MediaType.microSD: + discType = "Secure Digital"; + discSubType = "microSD"; + + break; + case CommonTypes.MediaType.MMC: + discType = "MultiMediaCard"; + discSubType = "MultiMediaCard"; + + break; + case CommonTypes.MediaType.MMCmicro: + discType = "MultiMediaCard"; + discSubType = "MMCmicro"; + + break; + case CommonTypes.MediaType.RSMMC: + discType = "MultiMediaCard"; + discSubType = "Reduced-Size MultiMediaCard"; + + break; + case CommonTypes.MediaType.MMCplus: + discType = "MultiMediaCard"; + discSubType = "MMCplus"; + + break; + case CommonTypes.MediaType.MMCmobile: + discType = "MultiMediaCard"; + discSubType = "MMCmobile"; + + break; + case CommonTypes.MediaType.MLR1: + discType = "Scalable Linear Recording"; + discSubType = "MLR1"; + + break; + case CommonTypes.MediaType.MLR1SL: + discType = "Scalable Linear Recording"; + discSubType = "MLR1 SL"; + + break; + case CommonTypes.MediaType.MLR3: + discType = "Scalable Linear Recording"; + discSubType = "MLR3"; + + break; + case CommonTypes.MediaType.SLR1: + discType = "Scalable Linear Recording"; + discSubType = "SLR1"; + + break; + case CommonTypes.MediaType.SLR2: + discType = "Scalable Linear Recording"; + discSubType = "SLR2"; + + break; + case CommonTypes.MediaType.SLR3: + discType = "Scalable Linear Recording"; + discSubType = "SLR3"; + + break; + case CommonTypes.MediaType.SLR32: + discType = "Scalable Linear Recording"; + discSubType = "SLR32"; + + break; + case CommonTypes.MediaType.SLR32SL: + discType = "Scalable Linear Recording"; + discSubType = "SLR32 SL"; + + break; + case CommonTypes.MediaType.SLR4: + discType = "Scalable Linear Recording"; + discSubType = "SLR4"; + + break; + case CommonTypes.MediaType.SLR5: + discType = "Scalable Linear Recording"; + discSubType = "SLR5"; + + break; + case CommonTypes.MediaType.SLR5SL: + discType = "Scalable Linear Recording"; + discSubType = "SLR5 SL"; + + break; + case CommonTypes.MediaType.SLR6: + discType = "Scalable Linear Recording"; + discSubType = "SLR6"; + + break; + case CommonTypes.MediaType.SLRtape7: + discType = "Scalable Linear Recording"; + discSubType = "SLRtape7"; + + break; + case CommonTypes.MediaType.SLRtape7SL: + discType = "Scalable Linear Recording"; + discSubType = "SLRtape7 SL"; + + break; + case CommonTypes.MediaType.SLRtape24: + discType = "Scalable Linear Recording"; + discSubType = "SLRtape24"; + + break; + case CommonTypes.MediaType.SLRtape24SL: + discType = "Scalable Linear Recording"; + discSubType = "SLRtape24 SL"; + + break; + case CommonTypes.MediaType.SLRtape40: + discType = "Scalable Linear Recording"; + discSubType = "SLRtape40"; + + break; + case CommonTypes.MediaType.SLRtape50: + discType = "Scalable Linear Recording"; + discSubType = "SLRtape50"; + + break; + case CommonTypes.MediaType.SLRtape60: + discType = "Scalable Linear Recording"; + discSubType = "SLRtape60"; + + break; + case CommonTypes.MediaType.SLRtape75: + discType = "Scalable Linear Recording"; + discSubType = "SLRtape75"; + + break; + case CommonTypes.MediaType.SLRtape100: + discType = "Scalable Linear Recording"; + discSubType = "SLRtape100"; + + break; + case CommonTypes.MediaType.SLRtape140: + discType = "Scalable Linear Recording"; + discSubType = "SLRtape140"; + + break; + case CommonTypes.MediaType.QIC11: + discType = "Quarter-inch cartridge"; + discSubType = "QIC-11"; + + break; + case CommonTypes.MediaType.QIC24: + discType = "Quarter-inch cartridge"; + discSubType = "QIC-24"; + + break; + case CommonTypes.MediaType.QIC40: + discType = "Quarter-inch mini cartridge"; + discSubType = "QIC-40"; + + break; + case CommonTypes.MediaType.QIC80: + discType = "Quarter-inch mini cartridge"; + discSubType = "QIC-80"; + + break; + case CommonTypes.MediaType.QIC120: + discType = "Quarter-inch cartridge"; + discSubType = "QIC-120"; + + break; + case CommonTypes.MediaType.QIC150: + discType = "Quarter-inch cartridge"; + discSubType = "QIC-150"; + + break; + case CommonTypes.MediaType.QIC320: + discType = "Quarter-inch cartridge"; + discSubType = "QIC-320"; + + break; + case CommonTypes.MediaType.QIC525: + discType = "Quarter-inch cartridge"; + discSubType = "QIC-525"; + + break; + case CommonTypes.MediaType.QIC1350: + discType = "Quarter-inch cartridge"; + discSubType = "QIC-1350"; + + break; + case CommonTypes.MediaType.QIC3010: + discType = "Quarter-inch cartridge"; + discSubType = "QIC-3010"; + + break; + case CommonTypes.MediaType.QIC3020: + discType = "Quarter-inch cartridge"; + discSubType = "QIC-3020"; + + break; + case CommonTypes.MediaType.QIC3080: + discType = "Quarter-inch cartridge"; + discSubType = "QIC-3080"; + + break; + case CommonTypes.MediaType.QIC3095: + discType = "Quarter-inch cartridge"; + discSubType = "QIC-3095"; + + break; + case CommonTypes.MediaType.Travan: + discType = "Travan"; + discSubType = "TR-1"; + + break; + case CommonTypes.MediaType.Travan1Ex: + discType = "Travan"; + discSubType = "TR-1 Ex"; + + break; + case CommonTypes.MediaType.Travan3: + discType = "Travan"; + discSubType = "TR-3"; + + break; + case CommonTypes.MediaType.Travan3Ex: + discType = "Travan"; + discSubType = "TR-3 Ex"; + + break; + case CommonTypes.MediaType.Travan4: + discType = "Travan"; + discSubType = "TR-4"; + + break; + case CommonTypes.MediaType.Travan5: + discType = "Travan"; + discSubType = "TR-5"; + + break; + case CommonTypes.MediaType.Travan7: + discType = "Travan"; + discSubType = "TR-7"; + + break; + case CommonTypes.MediaType.VXA1: + discType = "VXA"; + discSubType = "VXA-1"; + + break; + case CommonTypes.MediaType.VXA2: + discType = "VXA"; + discSubType = "VXA-2"; + + break; + case CommonTypes.MediaType.VXA3: + discType = "VXA"; + discSubType = "VXA-3"; + + break; + case CommonTypes.MediaType.ECMA_153: + case CommonTypes.MediaType.ECMA_153_512: + discType = "5.25\" magneto-optical"; + discSubType = "ECMA-153"; + + break; + case CommonTypes.MediaType.ECMA_189: + discType = "300mm magneto optical"; + discSubType = "ECMA-189"; + + break; + case CommonTypes.MediaType.ECMA_190: + discType = "300mm magneto optical"; + discSubType = "ECMA-190"; + + break; + case CommonTypes.MediaType.ECMA_195: + case CommonTypes.MediaType.ECMA_195_512: + discType = "5.25\" magneto-optical"; + discSubType = "ECMA-195"; + + break; + case CommonTypes.MediaType.ECMA_223: + case CommonTypes.MediaType.ECMA_223_512: + discType = "3.5\" magneto-optical"; + discSubType = "ECMA-223"; + + break; + case CommonTypes.MediaType.ECMA_238: + discType = "5.25\" magneto-optical"; + discSubType = "ECMA-238"; + + break; + case CommonTypes.MediaType.ECMA_239: + discType = "3.5\" magneto-optical"; + discSubType = "ECMA-239"; + + break; + case CommonTypes.MediaType.ECMA_280: + discType = "5.25\" magneto-optical"; + discSubType = "ECMA-280"; + + break; + case CommonTypes.MediaType.ECMA_317: + discType = "300mm magneto optical"; + discSubType = "ECMA-317"; + + break; + case CommonTypes.MediaType.ECMA_322: + case CommonTypes.MediaType.ECMA_322_512: + case CommonTypes.MediaType.ECMA_322_1k: + case CommonTypes.MediaType.ECMA_322_2k: + discType = "5.25\" magneto-optical"; + discSubType = "ECMA-322 / ISO 22092"; + + break; + case CommonTypes.MediaType.ISO_15286: + case CommonTypes.MediaType.ISO_15286_1024: + case CommonTypes.MediaType.ISO_15286_512: + discType = "5.25\" magneto-optical"; + discSubType = "ISO-15286"; + + break; + case CommonTypes.MediaType.ISO_14517: + case CommonTypes.MediaType.ISO_14517_512: + discType = "5.25\" magneto-optical"; + discSubType = "ISO-14517"; + + break; + case CommonTypes.MediaType.GigaMo: + discType = "3.5\" magneto-optical"; + discSubType = "GIGAMO"; + + break; + case CommonTypes.MediaType.GigaMo2: + discType = "3.5\" magneto-optical"; + discSubType = "2.3GB GIGAMO"; + + break; + case CommonTypes.MediaType.UnknownMO: + discType = "Magneto-optical"; + discSubType = "Unknown"; + + break; + case CommonTypes.MediaType.Floptical: + discType = "Floptical"; + discSubType = "Floptical"; + + break; + case CommonTypes.MediaType.HiFD: + discType = "HiFD"; + discSubType = "HiFD"; + + break; + case CommonTypes.MediaType.LS120: + discType = "SuperDisk"; + discSubType = "LS-120"; + + break; + case CommonTypes.MediaType.LS240: + discType = "SuperDisk"; + discSubType = "LS-240"; + + break; + case CommonTypes.MediaType.FD32MB: + discType = "3.5\" floppy"; + discSubType = "FD32MB"; + + break; + case CommonTypes.MediaType.UHD144: + discType = "UHD144"; + discSubType = "UHD144"; + + break; + case CommonTypes.MediaType.VCDHD: + discType = "VCDHD"; + discSubType = "VCDHD"; + + break; + case CommonTypes.MediaType.HuCard: + discType = "HuCard"; + discSubType = "HuCard"; + + break; + case CommonTypes.MediaType.CompactCassette: + discType = "Compact Cassette"; + discSubType = "Compact Cassette"; + + break; + case CommonTypes.MediaType.Dcas25: + discType = "Compact Cassette"; + discSubType = "D/CAS-25"; + + break; + case CommonTypes.MediaType.Dcas85: + discType = "Compact Cassette"; + discSubType = "D/CAS-85"; + + break; + case CommonTypes.MediaType.Dcas103: + discType = "Compact Cassette"; + discSubType = "D/CAS-103"; + + break; + case CommonTypes.MediaType.PCCardTypeI: + discType = "PCMCIA Card"; + discSubType = "PC-Card Type I"; + + break; + case CommonTypes.MediaType.PCCardTypeII: + discType = "PCMCIA Card"; + discSubType = "PC-Card Type II"; + + break; + case CommonTypes.MediaType.PCCardTypeIII: + discType = "PCMCIA Card"; + discSubType = "PC-Card Type III"; + + break; + case CommonTypes.MediaType.PCCardTypeIV: + discType = "PCMCIA Card"; + discSubType = "PC-Card Type IV"; + + break; + case CommonTypes.MediaType.ExpressCard34: + discType = "Express Card"; + discSubType = "Express Card (34mm)"; + + break; + case CommonTypes.MediaType.ExpressCard54: + discType = "Express Card"; + discSubType = "Express Card (54mm)"; + + break; + case CommonTypes.MediaType.FamicomGamePak: + discType = "Nintendo Famicom Game Pak"; + discSubType = "Nintendo Famicom Game Pak"; + + break; + case CommonTypes.MediaType.GameBoyAdvanceGamePak: + discType = "Nintendo Game Boy Advance Game Pak"; + discSubType = "Nintendo Game Boy Advance Game Pak"; + + break; + case CommonTypes.MediaType.GameBoyGamePak: + discType = "Nintendo Game Boy Game Pak"; + discSubType = "Nintendo Game Boy Game Pak"; + + break; + case CommonTypes.MediaType.N64DD: + discType = "Nintendo 64 Disk"; + discSubType = "Nintendo 64 Disk"; + + break; + case CommonTypes.MediaType.N64GamePak: + discType = "Nintendo 64 Game Pak"; + discSubType = "Nintendo 64 Game Pak"; + + break; + case CommonTypes.MediaType.NESGamePak: + discType = "Nintendo Entertainment System Game Pak"; + discSubType = "Nintendo Entertainment System Game Pak"; + + break; + case CommonTypes.MediaType.Nintendo3DSGameCard: + discType = "Nintendo 3DS Game Card"; + discSubType = "Nintendo 3DS Game Card"; + + break; + case CommonTypes.MediaType.NintendoDiskCard: + discType = "Nintendo Disk Card"; + discSubType = "Nintendo Disk Card"; + + break; + case CommonTypes.MediaType.NintendoDSGameCard: + discType = "Nintendo DS Game Card"; + discSubType = "Nintendo DS Game Card"; + + break; + case CommonTypes.MediaType.NintendoDSiGameCard: + discType = "Nintendo DSi Game Card"; + discSubType = "Nintendo DSi Game Card"; + + break; + case CommonTypes.MediaType.SNESGamePak: + discType = "Super Nintendo Game Pak"; + discSubType = "Super Nintendo Game Pak"; + + break; + case CommonTypes.MediaType.SNESGamePakUS: + discType = "Super Nintendo Game Pak (US)"; + discSubType = "Super Nintendo Game Pak (US)"; + + break; + case CommonTypes.MediaType.SwitchGameCard: + discType = "Nintendo Switch Game Card"; + discSubType = "Nintendo Switch Game Card"; + + break; + case CommonTypes.MediaType.IBM3470: + discType = "IBM 3470"; + discSubType = "IBM 3470"; + + break; + case CommonTypes.MediaType.IBM3480: + discType = "IBM 3480"; + discSubType = "IBM 3480"; + + break; + case CommonTypes.MediaType.IBM3490: + discType = "IBM 3490"; + discSubType = "IBM 3490"; + + break; + case CommonTypes.MediaType.IBM3490E: + discType = "IBM 3490E"; + discSubType = "IBM 3490E"; + + break; + case CommonTypes.MediaType.IBM3592: + discType = "IBM 3592"; + discSubType = "IBM 3592"; + + break; + case CommonTypes.MediaType.STK4480: + discType = "STK 4480"; + discSubType = "STK 4480"; + + break; + case CommonTypes.MediaType.STK4490: + discType = "STK 4490"; + discSubType = "STK 4490"; + + break; + case CommonTypes.MediaType.STK9490: + discType = "STK 9490"; + discSubType = "STK 9490"; + + break; + case CommonTypes.MediaType.T9840A: + discType = "STK T-9840"; + discSubType = "STK T-9840A"; + + break; + case CommonTypes.MediaType.T9840B: + discType = "STK T-9840"; + discSubType = "STK T-9840B"; + + break; + case CommonTypes.MediaType.T9840C: + discType = "STK T-9840"; + discSubType = "STK T-9840C"; + + break; + case CommonTypes.MediaType.T9840D: + discType = "STK T-9840"; + discSubType = "STK T-9840D"; + + break; + case CommonTypes.MediaType.T9940A: + discType = "STK T-9940"; + discSubType = "STK T-9940A"; + + break; + case CommonTypes.MediaType.T9940B: + discType = "STK T-9840"; + discSubType = "STK T-9840B"; + + break; + case CommonTypes.MediaType.T10000A: + discType = "STK T-10000"; + discSubType = "STK T-10000A"; + + break; + case CommonTypes.MediaType.T10000B: + discType = "STK T-10000"; + discSubType = "STK T-10000B"; + + break; + case CommonTypes.MediaType.T10000C: + discType = "STK T-10000"; + discSubType = "STK T-10000C"; + + break; + case CommonTypes.MediaType.T10000D: + discType = "STK T-10000"; + discSubType = "STK T-10000D"; + + break; + case CommonTypes.MediaType.DemiDiskette: + discType = "DemiDiskette"; + discSubType = "DemiDiskette"; + + break; + case CommonTypes.MediaType.QuickDisk: + discType = "QuickDisk"; + discSubType = "QuickDisk"; + + break; + case CommonTypes.MediaType.VideoFloppy: + discType = "VideoFloppy"; + discSubType = "VideoFloppy"; + + break; + case CommonTypes.MediaType.Wafer: + discType = "Wafer"; + discSubType = "Wafer"; + + break; + case CommonTypes.MediaType.ZXMicrodrive: + discType = "ZX Microdrive"; + discSubType = "ZX Microdrive"; + + break; + case CommonTypes.MediaType.BeeCard: + discType = "BeeCard"; + discSubType = "BeeCard"; + + break; + case CommonTypes.MediaType.Borsu: + discType = "Borsu"; + discSubType = "Borsu"; + + break; + case CommonTypes.MediaType.DataStore: + discType = "DataStore"; + discSubType = "DataStore"; + + break; + case CommonTypes.MediaType.DIR: + discType = "DIR"; + discSubType = "DIR"; + + break; + case CommonTypes.MediaType.DST: + discType = "DST"; + discSubType = "DST"; + + break; + case CommonTypes.MediaType.DTF: + discType = "DTF"; + discSubType = "DTF"; + + break; + case CommonTypes.MediaType.DTF2: + discType = "DTF2"; + discSubType = "DTF2"; + + break; + case CommonTypes.MediaType.Flextra3020: + discType = "Flextra"; + discSubType = "Flextra 3020"; + + break; + case CommonTypes.MediaType.Flextra3225: + discType = "Flextra"; + discSubType = "Flextra 3225"; + + break; + case CommonTypes.MediaType.HiTC1: + discType = "HiTC"; + discSubType = "HiTC1"; + + break; + case CommonTypes.MediaType.HiTC2: + discType = "HiTC"; + discSubType = "HiTC2"; + + break; + case CommonTypes.MediaType.LT1: + discType = "LT1"; + discSubType = "LT1"; + + break; + case CommonTypes.MediaType.MiniCard: + discType = "MiniCard"; + discSubType = "MiniCard"; + + break; + case CommonTypes.MediaType.Orb: + discType = "Orb"; + discSubType = "Orb"; + + break; + case CommonTypes.MediaType.Orb5: + discType = "Orb"; + discSubType = "Orb5"; + + break; + case CommonTypes.MediaType.SmartMedia: + discType = "SmartMedia"; + discSubType = "SmartMedia"; + + break; + case CommonTypes.MediaType.xD: + discType = "xD"; + discSubType = "xD"; + + break; + case CommonTypes.MediaType.XQD: + discType = "XQD"; + discSubType = "XQD"; + + break; + case CommonTypes.MediaType.DataPlay: + discType = "DataPlay"; + discSubType = "DataPlay"; + + break; + case CommonTypes.MediaType.PD650: + discType = "PD650"; + discSubType = "PD650"; + + break; + case CommonTypes.MediaType.PD650_WORM: + discType = "PD650"; + discSubType = "PD650 (WORM)"; + + break; + case CommonTypes.MediaType.RA60: + discType = "Hard Disk Drive"; + discSubType = "DEC RA-60"; + + break; + case CommonTypes.MediaType.RA80: + discType = "Hard Disk Drive"; + discSubType = "DEC RA-80"; + + break; + case CommonTypes.MediaType.RA81: + discType = "Hard Disk Drive"; + discSubType = "DEC RA-81"; + + break; + case CommonTypes.MediaType.RC25: + discType = "Hard Disk Drive"; + discSubType = "DEC RC-25"; + + break; + case CommonTypes.MediaType.RD31: + discType = "Hard Disk Drive"; + discSubType = "DEC RD-31"; + + break; + case CommonTypes.MediaType.RD32: + discType = "Hard Disk Drive"; + discSubType = "DEC RD-32"; + + break; + case CommonTypes.MediaType.RD51: + discType = "Hard Disk Drive"; + discSubType = "DEC RD-51"; + + break; + case CommonTypes.MediaType.RD52: + discType = "Hard Disk Drive"; + discSubType = "DEC RD-52"; + + break; + case CommonTypes.MediaType.RD53: + discType = "Hard Disk Drive"; + discSubType = "DEC RD-53"; + + break; + case CommonTypes.MediaType.RD54: + discType = "Hard Disk Drive"; + discSubType = "DEC RD-54"; + + break; + case CommonTypes.MediaType.RK06: + case CommonTypes.MediaType.RK06_18: + discType = "Hard Disk Drive"; + discSubType = "DEC RK-06"; + + break; + case CommonTypes.MediaType.RK07: + case CommonTypes.MediaType.RK07_18: + discType = "Hard Disk Drive"; + discSubType = "DEC RK-07"; + + break; + case CommonTypes.MediaType.RM02: + discType = "Hard Disk Drive"; + discSubType = "DEC RM-02"; + + break; + case CommonTypes.MediaType.RM03: + discType = "Hard Disk Drive"; + discSubType = "DEC RM-03"; + + break; + case CommonTypes.MediaType.RM05: + discType = "Hard Disk Drive"; + discSubType = "DEC RM-05"; + + break; + case CommonTypes.MediaType.RP02: + case CommonTypes.MediaType.RP02_18: + discType = "Hard Disk Drive"; + discSubType = "DEC RP-02"; + + break; + case CommonTypes.MediaType.RP03: + case CommonTypes.MediaType.RP03_18: + discType = "Hard Disk Drive"; + discSubType = "DEC RP-03"; + + break; + case CommonTypes.MediaType.RP04: + case CommonTypes.MediaType.RP04_18: + discType = "Hard Disk Drive"; + discSubType = "DEC RP-04"; + + break; + case CommonTypes.MediaType.RP05: + case CommonTypes.MediaType.RP05_18: + discType = "Hard Disk Drive"; + discSubType = "DEC RP-05"; + + break; + case CommonTypes.MediaType.RP06: + case CommonTypes.MediaType.RP06_18: + discType = "Hard Disk Drive"; + discSubType = "DEC RP-06"; + + break; + case CommonTypes.MediaType.RDX: + discType = "RDX"; + discSubType = "RDX"; + + break; + case CommonTypes.MediaType.RDX320: + discType = "RDX"; + discSubType = "RDX 320"; + + break; + case CommonTypes.MediaType.Zone_HDD: + discType = "Zoned Hard Disk Drive"; + discSubType = "Unknown"; + + break; + case CommonTypes.MediaType.Microdrive: + discType = "Hard Disk Drive"; + discSubType = "Microdrive"; + + break; + case CommonTypes.MediaType.VideoNow: + discType = "VideoNow"; + discSubType = "VideoNow"; + + break; + case CommonTypes.MediaType.VideoNowColor: + discType = "VideoNow"; + discSubType = "VideoNow Color"; + + break; + case CommonTypes.MediaType.VideoNowXp: + discType = "VideoNow"; + discSubType = "VideoNow XP"; + + break; + case CommonTypes.MediaType.KodakVerbatim3: + discType = "Kodak Verbatim"; + discSubType = "Kodak Verbatim (3 Mb)"; + + break; + case CommonTypes.MediaType.KodakVerbatim6: + discType = "Kodak Verbatim"; + discSubType = "Kodak Verbatim (6 Mb)"; + + break; + case CommonTypes.MediaType.KodakVerbatim12: + discType = "Kodak Verbatim"; + discSubType = "Kodak Verbatim (12 Mb)"; + + break; + case CommonTypes.MediaType.ProfessionalDisc: + discType = "Sony Professional Disc"; + discSubType = "Sony Professional Disc (single layer)"; + + break; + case CommonTypes.MediaType.ProfessionalDiscDual: + discType = "Sony Professional Disc"; + discSubType = "Sony Professional Disc (double layer)"; + + break; + case CommonTypes.MediaType.ProfessionalDiscTriple: + discType = "Sony Professional Disc"; + discSubType = "Sony Professional Disc (triple layer)"; + + break; + case CommonTypes.MediaType.ProfessionalDiscQuad: + discType = "Sony Professional Disc"; + discSubType = "Sony Professional Disc (quad layer)"; + + break; + case CommonTypes.MediaType.PDD: + discType = "Sony Professional Disc for DATA"; + discSubType = "Sony Professional Disc for DATA"; + + break; + case CommonTypes.MediaType.PDD_WORM: + discType = "Sony Professional Disc for DATA"; + discSubType = "Sony Professional Disc for DATA (write-once)"; + + break; + case CommonTypes.MediaType.ArchivalDisc: + discType = "Archival Disc"; + discSubType = "Archival Disc"; + + break; + case CommonTypes.MediaType.ArchivalDisc2: + discType = "Archival Disc"; + discSubType = "Archival Disc (2nd generation)"; + + break; + case CommonTypes.MediaType.ArchivalDisc3: + discType = "Archival Disc"; + discSubType = "Archival Disc (3rd generation)"; + + break; + case CommonTypes.MediaType.ODC300R: + discType = "Optical Disc Archive"; + discSubType = "ODC300R"; + + break; + case CommonTypes.MediaType.ODC300RE: + discType = "Optical Disc Archive"; + discSubType = "ODC300RE"; + + break; + case CommonTypes.MediaType.ODC600R: + discType = "Optical Disc Archive"; + discSubType = "ODC600R"; + + break; + case CommonTypes.MediaType.ODC600RE: + discType = "Optical Disc Archive"; + discSubType = "ODC600RE"; + + break; + case CommonTypes.MediaType.ODC1200RE: + discType = "Optical Disc Archive"; + discSubType = "ODC1200RE"; + + break; + case CommonTypes.MediaType.ODC1500R: + discType = "Optical Disc Archive"; + discSubType = "ODC1500R"; + + break; + case CommonTypes.MediaType.ODC3300R: + discType = "Optical Disc Archive"; + discSubType = "ODC3300R"; + + break; + case CommonTypes.MediaType.ODC5500R: + discType = "Optical Disc Archive"; + discSubType = "ODC5500R"; + + break; + case CommonTypes.MediaType.MetaFloppy_Mod_I: + discType = "5.25\" floppy"; + discSubType = "Micropolis MetaFloppy Mod I"; + + break; + case CommonTypes.MediaType.MetaFloppy_Mod_II: + discType = "5.25\" floppy"; + discSubType = "Micropolis MetaFloppy Mod II"; + + break; + default: + discType = "Unknown"; + discSubType = "Unknown"; + + break; } + + return (discType, discSubType); } } \ No newline at end of file diff --git a/Metadata/Resume.cs b/Metadata/Resume.cs index 06f8ed629..382b65b4f 100644 --- a/Metadata/Resume.cs +++ b/Metadata/Resume.cs @@ -41,40 +41,39 @@ using System.Collections.Generic; using System.Xml.Serialization; using Schemas; -namespace Aaru.CommonTypes.Metadata +namespace Aaru.CommonTypes.Metadata; + +/// Information that allows to resume a dump +[Serializable, XmlRoot("DicResume", Namespace = "", IsNullable = false)] +public class Resume { - /// Information that allows to resume a dump - [Serializable, XmlRoot("DicResume", Namespace = "", IsNullable = false)] - public class Resume - { - /// List of blocks that returned an error on reading - [XmlArrayItem("Block")] - public List BadBlocks; - /// Date/time this resume file was created - [XmlElement(DataType = "dateTime")] - public DateTime CreationDate; - /// Last block on media - public ulong LastBlock; - /// Date/time this resume file was last written to - [XmlElement(DataType = "dateTime")] - public DateTime LastWriteDate; - /// Next block to read - public ulong NextBlock; - /// Is media removable? - public bool Removable; - /// Is media a tape? - public bool Tape; - /// List of CD subchannels that did not read correctly - [XmlArrayItem("Block")] - public List BadSubchannels; - /// Extents of BLANK sectors for magneto-opticals - [XmlArrayItem("Extent")] - public ExtentType[] BlankExtents; - /// Title keys that has not been read - [XmlArrayItem("Block")] - public List MissingTitleKeys; - /// List of dump tries - [XmlArrayItem("DumpTry")] - public List Tries; - } + /// List of blocks that returned an error on reading + [XmlArrayItem("Block")] + public List BadBlocks; + /// Date/time this resume file was created + [XmlElement(DataType = "dateTime")] + public DateTime CreationDate; + /// Last block on media + public ulong LastBlock; + /// Date/time this resume file was last written to + [XmlElement(DataType = "dateTime")] + public DateTime LastWriteDate; + /// Next block to read + public ulong NextBlock; + /// Is media removable? + public bool Removable; + /// Is media a tape? + public bool Tape; + /// List of CD subchannels that did not read correctly + [XmlArrayItem("Block")] + public List BadSubchannels; + /// Extents of BLANK sectors for magneto-opticals + [XmlArrayItem("Extent")] + public ExtentType[] BlankExtents; + /// Title keys that has not been read + [XmlArrayItem("Block")] + public List MissingTitleKeys; + /// List of dump tries + [XmlArrayItem("DumpTry")] + public List Tries; } \ No newline at end of file diff --git a/Metadata/Statistics.cs b/Metadata/Statistics.cs index 4533b0a5a..011b07036 100644 --- a/Metadata/Statistics.cs +++ b/Metadata/Statistics.cs @@ -43,267 +43,266 @@ using System.Xml.Serialization; // ReSharper disable ClassNeverInstantiated.Global // ReSharper disable UnusedMember.Global -namespace Aaru.CommonTypes.Metadata +namespace Aaru.CommonTypes.Metadata; + +/// Statistics +[XmlRoot("DicStats", Namespace = "", IsNullable = false)] +public class Stats { - /// Statistics - [XmlRoot("DicStats", Namespace = "", IsNullable = false)] - public class Stats - { - /// Executed commands - public CommandsStats Commands; - /// Operating systems Aaru has run from - [XmlArrayItem("OperatingSystem")] - public List OperatingSystems { get; set; } - /// Aaru versions - [XmlArrayItem("Version")] - public List Versions { get; set; } - /// Detected filesystems - [XmlArrayItem("Filesystem")] - public List Filesystems { get; set; } - /// Detected partitioning schemes - [XmlArrayItem("Scheme")] - public List Partitions { get; set; } - /// Media image formats - [XmlArrayItem("Format")] - public List MediaImages { get; set; } - /// Used filters - [XmlArrayItem("Filter", IsNullable = true)] - public List Filters { get; set; } - /// Found devices - [XmlArrayItem("Device", IsNullable = true)] - public List Devices { get; set; } - /// Found media types, real, and in image - [XmlArrayItem("Media")] - public List Medias { get; set; } - /// Benchmark statistics - public BenchmarkStats Benchmark { get; set; } - /// Media scanning statistics - public MediaScanStats MediaScan { get; set; } - /// Image verification statistics - public VerifyStats Verify { get; set; } - } - - /// DTO for statistics - [SuppressMessage("ReSharper", "CollectionNeverQueried.Global")] - public class StatsDto - { - /// Executed commands - public List Commands { get; set; } - /// Operating systems Aaru has run from - public List OperatingSystems { get; set; } - /// Aaru versions - public List Versions { get; set; } - /// Detected filesystems - public List Filesystems { get; set; } - /// Detected partitioning schemes - public List Partitions { get; set; } - /// Media image formats - public List MediaFormats { get; set; } - /// Used filters - public List Filters { get; set; } - /// Found devices - public List Devices { get; set; } - /// Found media types, real, and in image - public List Medias { get; set; } - /// Remote applications - public List RemoteApplications { get; set; } - /// Remote application architectures - public List RemoteArchitectures { get; set; } - /// Operating systems where a remote application has been running - public List RemoteOperatingSystems { get; set; } - } - - /// Command execution statistics - [SuppressMessage("ReSharper", "UnassignedField.Global")] - public class CommandsStats - { - /// Number of times the filesystem info command has been used - public long Analyze; - /// Number of times the benchmark command has been used - public long Benchmark; - /// Number of times the image checksum command has been used - public long Checksum; - /// Number of times the image compare command has been used - public long Compare; - /// Number of times the image convert command has been used - public long ConvertImage; - /// Number of times the image create-sidecar command has been used - public long CreateSidecar; - /// Number of times the image decode command has been used - public long Decode; - /// Number of times the device info command has been used - public long DeviceInfo; - /// Number of times the device report command has been used - public long DeviceReport; - /// Number of times the media dump command has been used - public long DumpMedia; - /// Number of times the image entropy command has been used - public long Entropy; - /// Number of times the filesystem extract command has been used - public long ExtractFiles; - /// Number of times the list formats command has been used - public long Formats; - /// Number of times the image info command has been used - public long ImageInfo; - /// Number of times the device list command has been used - public long ListDevices; - /// Number of times the list encodings command has been used - public long ListEncodings; - /// Number of times the filesystem ls command has been used - public long Ls; - /// Number of times the media info command has been used - public long MediaInfo; - /// Number of times the media scan command has been used - public long MediaScan; - /// Number of times the image printhex command has been used - public long PrintHex; - /// Number of times the image verify command has been used - public long Verify; - } - - /// Statistics of verified media - public class VerifiedItems - { - /// Number of correct images - public long Correct; - /// Number of failed images - public long Failed; - } - - /// Verification statistics - public class VerifyStats - { - /// Image verification statistics - public VerifiedItems MediaImages; - /// Image contents verification statistics - public ScannedSectors Sectors; - } - - /// Image contents verification statistics - public class ScannedSectors - { - /// Sectors found to be correct - public long Correct; - /// Sectors found to be incorrect - public long Error; - /// Total number of verified sectors - public long Total; - /// Total number of sectors that could not be verified - public long Unverifiable; - } - - /// Media scanning time statistics - [SuppressMessage("ReSharper", "InconsistentNaming")] - public class TimeStats - { - /// Number of sectors that took more than 3ms but less than 100ms to read - public long LessThan10ms; - /// Number of sectors that took more than 50ms but less than 150ms to read - public long LessThan150ms; - /// Number of sectors that took less than 3ms to read - public long LessThan3ms; - /// Number of sectors that took more than 150ms but less than 500ms to read - public long LessThan500ms; - /// Number of sectors that took more than 10ms but less than 50ms to read - public long LessThan50ms; - /// Number of sectors that took more than 500ms to read - public long MoreThan500ms; - } - - /// Media scanning statistics - public class MediaScanStats - { - /// Statistics of scanned sectors - public ScannedSectors Sectors; - /// Scan time statistics - public TimeStats Times; - } - - /// Checksum type statistics - [SuppressMessage("ReSharper", "InconsistentNaming")] - public class ChecksumStats - { - /// Checksum algorithm - [XmlAttribute] - public string algorithm; - /// Time taken to execute algorithm - [XmlText] - public double Value; - } - + /// Executed commands + public CommandsStats Commands; + /// Operating systems Aaru has run from + [XmlArrayItem("OperatingSystem")] + public List OperatingSystems { get; set; } + /// Aaru versions + [XmlArrayItem("Version")] + public List Versions { get; set; } + /// Detected filesystems + [XmlArrayItem("Filesystem")] + public List Filesystems { get; set; } + /// Detected partitioning schemes + [XmlArrayItem("Scheme")] + public List Partitions { get; set; } + /// Media image formats + [XmlArrayItem("Format")] + public List MediaImages { get; set; } + /// Used filters + [XmlArrayItem("Filter", IsNullable = true)] + public List Filters { get; set; } + /// Found devices + [XmlArrayItem("Device", IsNullable = true)] + public List Devices { get; set; } + /// Found media types, real, and in image + [XmlArrayItem("Media")] + public List Medias { get; set; } /// Benchmark statistics - public class BenchmarkStats - { - /// Total time taken to run the checksum algorithms in parallel - public double All; - /// List of time taken by each checksum algorithm - [XmlElement("Checksum")] - public List Checksum; - /// Time taken to benchmark entropy calculation - public double Entropy; - /// Maximum amount of memory used while running the benchmark - public long MaxMemory; - /// Minimum amount of memory used while running the benchmark - public long MinMemory; - /// Total time taken to run the checksum algorithms sequentially - public double Sequential; - } + public BenchmarkStats Benchmark { get; set; } + /// Media scanning statistics + public MediaScanStats MediaScan { get; set; } + /// Image verification statistics + public VerifyStats Verify { get; set; } +} - /// Media statistics - [SuppressMessage("ReSharper", "InconsistentNaming")] - public class MediaStats - { - /// Found in a real device? - [XmlAttribute] - public bool real; - /// Media type - [XmlAttribute] - public string type; - /// Number of times it has been found - [XmlText] - public long Value; - } +/// DTO for statistics +[SuppressMessage("ReSharper", "CollectionNeverQueried.Global")] +public class StatsDto +{ + /// Executed commands + public List Commands { get; set; } + /// Operating systems Aaru has run from + public List OperatingSystems { get; set; } + /// Aaru versions + public List Versions { get; set; } + /// Detected filesystems + public List Filesystems { get; set; } + /// Detected partitioning schemes + public List Partitions { get; set; } + /// Media image formats + public List MediaFormats { get; set; } + /// Used filters + public List Filters { get; set; } + /// Found devices + public List Devices { get; set; } + /// Found media types, real, and in image + public List Medias { get; set; } + /// Remote applications + public List RemoteApplications { get; set; } + /// Remote application architectures + public List RemoteArchitectures { get; set; } + /// Operating systems where a remote application has been running + public List RemoteOperatingSystems { get; set; } +} - /// Device statistics - public class DeviceStats - { - /// Is manufacturer null? - [XmlIgnore] - public bool ManufacturerSpecified; - /// Manufacturer string - public string Manufacturer { get; set; } - /// Model string - public string Model { get; set; } - /// Revision or firmware version - public string Revision { get; set; } - /// Bus the device was attached to - public string Bus { get; set; } - } +/// Command execution statistics +[SuppressMessage("ReSharper", "UnassignedField.Global")] +public class CommandsStats +{ + /// Number of times the filesystem info command has been used + public long Analyze; + /// Number of times the benchmark command has been used + public long Benchmark; + /// Number of times the image checksum command has been used + public long Checksum; + /// Number of times the image compare command has been used + public long Compare; + /// Number of times the image convert command has been used + public long ConvertImage; + /// Number of times the image create-sidecar command has been used + public long CreateSidecar; + /// Number of times the image decode command has been used + public long Decode; + /// Number of times the device info command has been used + public long DeviceInfo; + /// Number of times the device report command has been used + public long DeviceReport; + /// Number of times the media dump command has been used + public long DumpMedia; + /// Number of times the image entropy command has been used + public long Entropy; + /// Number of times the filesystem extract command has been used + public long ExtractFiles; + /// Number of times the list formats command has been used + public long Formats; + /// Number of times the image info command has been used + public long ImageInfo; + /// Number of times the device list command has been used + public long ListDevices; + /// Number of times the list encodings command has been used + public long ListEncodings; + /// Number of times the filesystem ls command has been used + public long Ls; + /// Number of times the media info command has been used + public long MediaInfo; + /// Number of times the media scan command has been used + public long MediaScan; + /// Number of times the image printhex command has been used + public long PrintHex; + /// Number of times the image verify command has been used + public long Verify; +} - /// Name=value pair statistics - [SuppressMessage("ReSharper", "InconsistentNaming")] - public class NameValueStats - { - /// Name - [XmlAttribute] - public string name { get; set; } - /// Number of times it has been used/found - [XmlText] - public long Value { get; set; } - } +/// Statistics of verified media +public class VerifiedItems +{ + /// Number of correct images + public long Correct; + /// Number of failed images + public long Failed; +} - /// Operating system statistics - [SuppressMessage("ReSharper", "InconsistentNaming")] - public class OsStats - { - /// Operating system name - [XmlAttribute] - public string name { get; set; } - /// Operating system version - [XmlAttribute] - public string version { get; set; } - /// Number of times Aaru run on it - [XmlText] - public long Value { get; set; } - } +/// Verification statistics +public class VerifyStats +{ + /// Image verification statistics + public VerifiedItems MediaImages; + /// Image contents verification statistics + public ScannedSectors Sectors; +} + +/// Image contents verification statistics +public class ScannedSectors +{ + /// Sectors found to be correct + public long Correct; + /// Sectors found to be incorrect + public long Error; + /// Total number of verified sectors + public long Total; + /// Total number of sectors that could not be verified + public long Unverifiable; +} + +/// Media scanning time statistics +[SuppressMessage("ReSharper", "InconsistentNaming")] +public class TimeStats +{ + /// Number of sectors that took more than 3ms but less than 100ms to read + public long LessThan10ms; + /// Number of sectors that took more than 50ms but less than 150ms to read + public long LessThan150ms; + /// Number of sectors that took less than 3ms to read + public long LessThan3ms; + /// Number of sectors that took more than 150ms but less than 500ms to read + public long LessThan500ms; + /// Number of sectors that took more than 10ms but less than 50ms to read + public long LessThan50ms; + /// Number of sectors that took more than 500ms to read + public long MoreThan500ms; +} + +/// Media scanning statistics +public class MediaScanStats +{ + /// Statistics of scanned sectors + public ScannedSectors Sectors; + /// Scan time statistics + public TimeStats Times; +} + +/// Checksum type statistics +[SuppressMessage("ReSharper", "InconsistentNaming")] +public class ChecksumStats +{ + /// Checksum algorithm + [XmlAttribute] + public string algorithm; + /// Time taken to execute algorithm + [XmlText] + public double Value; +} + +/// Benchmark statistics +public class BenchmarkStats +{ + /// Total time taken to run the checksum algorithms in parallel + public double All; + /// List of time taken by each checksum algorithm + [XmlElement("Checksum")] + public List Checksum; + /// Time taken to benchmark entropy calculation + public double Entropy; + /// Maximum amount of memory used while running the benchmark + public long MaxMemory; + /// Minimum amount of memory used while running the benchmark + public long MinMemory; + /// Total time taken to run the checksum algorithms sequentially + public double Sequential; +} + +/// Media statistics +[SuppressMessage("ReSharper", "InconsistentNaming")] +public class MediaStats +{ + /// Found in a real device? + [XmlAttribute] + public bool real; + /// Media type + [XmlAttribute] + public string type; + /// Number of times it has been found + [XmlText] + public long Value; +} + +/// Device statistics +public class DeviceStats +{ + /// Is manufacturer null? + [XmlIgnore] + public bool ManufacturerSpecified; + /// Manufacturer string + public string Manufacturer { get; set; } + /// Model string + public string Model { get; set; } + /// Revision or firmware version + public string Revision { get; set; } + /// Bus the device was attached to + public string Bus { get; set; } +} + +/// Name=value pair statistics +[SuppressMessage("ReSharper", "InconsistentNaming")] +public class NameValueStats +{ + /// Name + [XmlAttribute] + public string name { get; set; } + /// Number of times it has been used/found + [XmlText] + public long Value { get; set; } +} + +/// Operating system statistics +[SuppressMessage("ReSharper", "InconsistentNaming")] +public class OsStats +{ + /// Operating system name + [XmlAttribute] + public string name { get; set; } + /// Operating system version + [XmlAttribute] + public string version { get; set; } + /// Number of times Aaru run on it + [XmlText] + public long Value { get; set; } } \ No newline at end of file diff --git a/Metadata/Version.cs b/Metadata/Version.cs index 457db4cd5..1266f5f4e 100644 --- a/Metadata/Version.cs +++ b/Metadata/Version.cs @@ -39,18 +39,17 @@ using Aaru.CommonTypes.Interop; using Schemas; -namespace Aaru.CommonTypes.Metadata +namespace Aaru.CommonTypes.Metadata; + +/// Manages Aaru's version for metadata +public static class Version { - /// Manages Aaru's version for metadata - public static class Version + /// Gets XML software type for the running version + /// XML software type + public static SoftwareType GetSoftwareType() => new SoftwareType { - /// Gets XML software type for the running version - /// XML software type - public static SoftwareType GetSoftwareType() => new SoftwareType - { - Name = "Aaru", - OperatingSystem = DetectOS.GetRealPlatformID().ToString(), - Version = typeof(Version).Assembly.GetName().Version?.ToString() - }; - } + Name = "Aaru", + OperatingSystem = DetectOS.GetRealPlatformID().ToString(), + Version = typeof(Version).Assembly.GetName().Version?.ToString() + }; } \ No newline at end of file diff --git a/Partition.cs b/Partition.cs index 679a3a749..83ffdf799 100644 --- a/Partition.cs +++ b/Partition.cs @@ -38,82 +38,81 @@ using System; -namespace Aaru.CommonTypes +namespace Aaru.CommonTypes; + +/// Partition structure. +public struct Partition : IEquatable, IComparable { - /// Partition structure. - public struct Partition : IEquatable, IComparable + /// Partition number, 0-started + public ulong Sequence; + /// Partition type + public string Type; + /// Partition name (if the scheme supports it) + public string Name; + /// Start of the partition, in bytes + public ulong Offset; + /// LBA of partition start + public ulong Start; + /// Length in bytes of the partition + public ulong Size; + /// Length in sectors of the partition + public ulong Length; + /// Information that does not find space in this struct + public string Description; + /// LBA of last partition sector + public readonly ulong End => Start + Length - 1; + /// Name of partition scheme that contains this partition + public string Scheme; + + /// + /// Compares two partitions + /// Partition to compare with + /// 0 if both partitions start and end at the same sector + public bool Equals(Partition other) => Start == other.Start && Length == other.Length; + + /// + public override bool Equals(object obj) => obj is Partition partition && Equals(partition); + + /// + + // ReSharper disable once NonReadonlyMemberInGetHashCode + public override int GetHashCode() => Start.GetHashCode() + End.GetHashCode(); + + /// + /// Compares this partition with another and returns an integer that indicates whether the current partition + /// precedes, follows, or is in the same place as the other partition. + /// + /// Partition to compare with + /// A value that indicates the relative equality of the partitions being compared. + /// + public int CompareTo(Partition other) { - /// Partition number, 0-started - public ulong Sequence; - /// Partition type - public string Type; - /// Partition name (if the scheme supports it) - public string Name; - /// Start of the partition, in bytes - public ulong Offset; - /// LBA of partition start - public ulong Start; - /// Length in bytes of the partition - public ulong Size; - /// Length in sectors of the partition - public ulong Length; - /// Information that does not find space in this struct - public string Description; - /// LBA of last partition sector - public readonly ulong End => Start + Length - 1; - /// Name of partition scheme that contains this partition - public string Scheme; + if(Start == other.Start && + End == other.End) + return 0; - /// - /// Compares two partitions - /// Partition to compare with - /// 0 if both partitions start and end at the same sector - public bool Equals(Partition other) => Start == other.Start && Length == other.Length; + if(Start > other.Start || + End > other.End) + return 1; - /// - public override bool Equals(object obj) => obj is Partition partition && Equals(partition); - - /// - - // ReSharper disable once NonReadonlyMemberInGetHashCode - public override int GetHashCode() => Start.GetHashCode() + End.GetHashCode(); - - /// - /// Compares this partition with another and returns an integer that indicates whether the current partition - /// precedes, follows, or is in the same place as the other partition. - /// - /// Partition to compare with - /// A value that indicates the relative equality of the partitions being compared. - /// - public int CompareTo(Partition other) - { - if(Start == other.Start && - End == other.End) - return 0; - - if(Start > other.Start || - End > other.End) - return 1; - - return -1; - } - - // Define the equality operator. - public static bool operator ==(Partition operand1, Partition operand2) => operand1.Equals(operand2); - - // Define the inequality operator. - public static bool operator !=(Partition operand1, Partition operand2) => !operand1.Equals(operand2); - - // Define the is greater than operator. - public static bool operator >(Partition operand1, Partition operand2) => operand1.CompareTo(operand2) == 1; - - // Define the is less than operator. - public static bool operator <(Partition operand1, Partition operand2) => operand1.CompareTo(operand2) == -1; - - // Define the is greater than or equal to operator. - public static bool operator >=(Partition operand1, Partition operand2) => operand1.CompareTo(operand2) >= 0; - - // Define the is less than or equal to operator. - public static bool operator <=(Partition operand1, Partition operand2) => operand1.CompareTo(operand2) <= 0; + return -1; } + + // Define the equality operator. + public static bool operator ==(Partition operand1, Partition operand2) => operand1.Equals(operand2); + + // Define the inequality operator. + public static bool operator !=(Partition operand1, Partition operand2) => !operand1.Equals(operand2); + + // Define the is greater than operator. + public static bool operator >(Partition operand1, Partition operand2) => operand1.CompareTo(operand2) == 1; + + // Define the is less than operator. + public static bool operator <(Partition operand1, Partition operand2) => operand1.CompareTo(operand2) == -1; + + // Define the is greater than or equal to operator. + public static bool operator >=(Partition operand1, Partition operand2) => operand1.CompareTo(operand2) >= 0; + + // Define the is less than or equal to operator. + public static bool operator <=(Partition operand1, Partition operand2) => operand1.CompareTo(operand2) <= 0; } \ No newline at end of file diff --git a/Structs/Devices/ATA/Identify.cs b/Structs/Devices/ATA/Identify.cs index e51de9f73..94dbb1859 100644 --- a/Structs/Devices/ATA/Identify.cs +++ b/Structs/Devices/ATA/Identify.cs @@ -47,1081 +47,1080 @@ using Marshal = Aaru.Helpers.Marshal; // ReSharper disable UnusedMember.Global -namespace Aaru.CommonTypes.Structs.Devices.ATA +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) +/// T13-1699D rev. 3f (ATA8-ACS) T13-1699D rev. 4a (ATA8-ACS) T13-2015D rev. 2 (ACS-2) T13-2161D rev. 5 (ACS-3) CF+ +/// & CF Specification rev. 1.4 (CFA) +/// +[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"), + SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +public static class Identify { - /// - /// 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) - /// T13-1699D rev. 3f (ATA8-ACS) T13-1699D rev. 4a (ATA8-ACS) T13-2015D rev. 2 (ACS-2) T13-2161D rev. 5 (ACS-3) CF+ - /// & CF Specification rev. 1.4 (CFA) - /// - [SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"), - SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] - public static class Identify + /// Capabilities flag bits. + [Flags] + public enum CapabilitiesBit : ushort { - /// Capabilities flag bits. - [Flags] - public enum CapabilitiesBit : ushort + /// ATAPI: Interleaved DMA supported + InterleavedDMA = 0x8000, + /// ATAPI: Command queueing supported + CommandQueue = 0x4000, + /// Standby timer values are standard + StandardStandbyTimer = 0x2000, + /// ATAPI: Overlap operation supported + OverlapOperation = 0x2000, + /// ATAPI: ATA software reset required Obsoleted in ATA/ATAPI-4 + RequiresATASoftReset = 0x1000, + /// IORDY is supported + IORDY = 0x0800, + /// IORDY can be disabled + CanDisableIORDY = 0x0400, + /// LBA is supported + LBASupport = 0x0200, + /// DMA is supported + DMASupport = 0x0100, + /// Vendor unique Obsoleted in ATA/ATAPI-4 + VendorBit7 = 0x0080, + /// Vendor unique Obsoleted in ATA/ATAPI-4 + VendorBit6 = 0x0040, + /// Vendor unique Obsoleted in ATA/ATAPI-4 + VendorBit5 = 0x0020, + /// Vendor unique Obsoleted in ATA/ATAPI-4 + VendorBit4 = 0x0010, + /// Vendor unique Obsoleted in ATA/ATAPI-4 + VendorBit3 = 0x0008, + /// Vendor unique Obsoleted in ATA/ATAPI-4 + VendorBit2 = 0x0004, + /// Long Physical Alignment setting bit 1 + PhysicalAlignment1 = 0x0002, + /// Long Physical Alignment setting bit 0 + PhysicalAlignment0 = 0x0001 + } + + /// More capabilities flag bits. + [Flags] + public enum CapabilitiesBit2 : ushort + { + /// MUST NOT be set + MustBeClear = 0x8000, + /// 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, + Reserved01 = 0x0002, + #pragma warning restore 1591 + /// Indicates a device specific minimum standby timer value + SpecificStandbyTimer = 0x0001 + } + + /// Even more capabilities flag bits. + [Flags] + public enum CapabilitiesBit3 : byte + { + /// BLOCK ERASE EXT supported + BlockErase = 0x0080, + /// OVERWRITE EXT supported + Overwrite = 0x0040, + /// CRYPTO SCRAMBLE EXT supported + CryptoScramble = 0x0020, + /// Sanitize feature set is supported + Sanitize = 0x0010, + /// If unset, sanitize commands are specified by ACS-2 + SanitizeCommands = 0x0008, + /// SANITIZE ANTIFREEZE LOCK EXT is supported + SanitizeAntifreeze = 0x0004, + #pragma warning disable 1591 + Reserved01 = 0x0002, + #pragma warning restore 1591 + /// Multiple logical sector setting is valid + MultipleValid = 0x0001 + } + + /// Command set flag bits. + [Flags] + public enum CommandSetBit : ushort + { + /// Already obsolete in ATA/ATAPI-4, reserved in ATA3 + Obsolete15 = 0x8000, + /// NOP is supported + Nop = 0x4000, + /// READ BUFFER is supported + ReadBuffer = 0x2000, + /// WRITE BUFFER is supported + WriteBuffer = 0x1000, + /// Already obsolete in ATA/ATAPI-4, reserved in ATA3 + Obsolete11 = 0x0800, + /// Host Protected Area is supported + HPA = 0x0400, + /// DEVICE RESET is supported + DeviceReset = 0x0200, + /// SERVICE interrupt is supported + Service = 0x0100, + /// Release is supported + Release = 0x0080, + /// Look-ahead is supported + LookAhead = 0x0040, + /// Write cache is supported + WriteCache = 0x0020, + /// PACKET command set is supported + Packet = 0x0010, + /// Power Management feature set is supported + PowerManagement = 0x0008, + /// Removable Media feature set is supported + RemovableMedia = 0x0004, + /// Security Mode feature set is supported + SecurityMode = 0x0002, + /// SMART feature set is supported + SMART = 0x0001 + } + + /// More command set flag bits. + [Flags] + public enum CommandSetBit2 : ushort + { + /// MUST NOT be set + MustBeClear = 0x8000, + /// MUST BE SET + MustBeSet = 0x4000, + /// FLUSH CACHE EXT supported + FlushCacheExt = 0x2000, + /// FLUSH CACHE supported + FlushCache = 0x1000, + /// Device Configuration Overlay feature set supported + DCO = 0x0800, + /// 48-bit LBA supported + LBA48 = 0x0400, + /// Automatic Acoustic Management supported + AAM = 0x0200, + /// SET MAX security extension supported + SetMax = 0x0100, + /// Address Offset Reserved Area Boot NCITS TR27:2001 + AddressOffsetReservedAreaBoot = 0x0080, + /// SET FEATURES required to spin-up + SetFeaturesRequired = 0x0040, + /// Power-Up in standby feature set supported + PowerUpInStandby = 0x0020, + /// Removable Media Status Notification feature set is supported + RemovableNotification = 0x0010, + /// Advanced Power Management feature set is supported + APM = 0x0008, + /// Compact Flash feature set is supported + CompactFlash = 0x0004, + /// READ DMA QUEUED and WRITE DMA QUEUED are supported + RWQueuedDMA = 0x0002, + /// DOWNLOAD MICROCODE is supported + DownloadMicrocode = 0x0001 + } + + /// Even more command set flag bits. + [Flags] + public enum CommandSetBit3 : ushort + { + /// MUST NOT be set + MustBeClear = 0x8000, + /// MUST BE SET + MustBeSet = 0x4000, + /// IDLE IMMEDIATE with UNLOAD FEATURE is supported + IdleImmediate = 0x2000, + /// Reserved for INCITS TR-37/2004 + Reserved12 = 0x1000, + /// Reserved for INCITS TR-37/2004 + Reserved11 = 0x0800, + /// URG bit is supported in WRITE STREAM DMA EXT and WRITE STREAM EXT + WriteURG = 0x0400, + /// URG bit is supported in READ STREAM DMA EXT and READ STREAM EXT + ReadURG = 0x0200, + /// 64-bit World Wide Name is supported + WWN = 0x0100, + /// WRITE DMA QUEUED FUA EXT is supported + FUAWriteQ = 0x0080, + /// WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported + FUAWrite = 0x0040, + /// General Purpose Logging feature supported + GPL = 0x0020, + /// Streaming feature set is supported + Streaming = 0x0010, + /// Media Card Pass Through command set supported + MCPT = 0x0008, + /// Media serial number supported + MediaSerial = 0x0004, + /// SMART self-test supported + SMARTSelfTest = 0x0002, + /// SMART error logging supported + SMARTLog = 0x0001 + } + + /// Yet more command set flag bits. + [Flags] + public enum CommandSetBit4 : ushort + { + /// MUST NOT be set + MustBeClear = 0x8000, + /// MUST be set + MustBeSet = 0x4000, + #pragma warning disable 1591 + Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800, + Reserved10 = 0x0400, + #pragma warning restore 1591 + /// DSN feature set is supported + DSN = 0x0200, + /// Accessible Max Address Configuration is supported + AMAC = 0x0100, + /// Extended Power Conditions is supported + ExtPowerCond = 0x0080, + /// Extended Status Reporting is supported + ExtStatusReport = 0x0040, + /// Free-fall Control feature set is supported + FreeFallControl = 0x0020, + /// Supports segmented feature in DOWNLOAD MICROCODE + SegmentedDownloadMicrocode = 0x0010, + /// READ/WRITE DMA EXT GPL are supported + RWDMAExtGpl = 0x0008, + /// WRITE UNCORRECTABLE is supported + WriteUnc = 0x0004, + /// Write/Read/Verify is supported + WRV = 0x0002, + /// Reserved for DT1825 + DT1825 = 0x0001 + } + + /// Yet again more command set flag bits. + [Flags] + public enum CommandSetBit5 : ushort + { + /// Supports CFast Specification + CFast = 0x8000, + /// Deterministic read after TRIM is supported + DeterministicTrim = 0x4000, + /// Long physical sector alignment error reporting control is supported + LongPhysSectorAligError = 0x2000, + /// DEVICE CONFIGURATION IDENTIFY DMA and DEVICE CONFIGURATION SET DMA are supported + DeviceConfDMA = 0x1000, + /// READ BUFFER DMA is supported + ReadBufferDMA = 0x0800, + /// WRITE BUFFER DMA is supported + WriteBufferDMA = 0x0400, + /// SET PASSWORD DMA and SET UNLOCK DMA are supported + SetMaxDMA = 0x0200, + /// DOWNLOAD MICROCODE DMA is supported + DownloadMicroCodeDMA = 0x0100, + /// Reserved for IEEE-1667 + IEEE1667 = 0x0080, + /// Optional ATA 28-bit commands are supported + Ata28 = 0x0040, + /// Read zero after TRIM is supported + ReadZeroTrim = 0x0020, + /// Device encrypts all user data + Encrypted = 0x0010, + /// Extended number of user addressable sectors is supported + ExtSectors = 0x0008, + /// All write cache is non-volatile + AllCacheNV = 0x0004, + /// Zoned capabilities bit 1 + ZonedBit1 = 0x0002, + /// Zoned capabilities bit 0 + ZonedBit0 = 0x0001 + } + + /// Data set management flag bits. + [Flags] + 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, + #pragma warning restore 1591 + /// TRIM is supported + Trim = 0x0001 + } + + /// Device form factor + public enum DeviceFormFactorEnum : ushort + { + /// Size not reported + NotReported = 0, + /// 5.25" + FiveAndQuarter = 1, + /// 3.5" + ThreeAndHalf = 2, + /// 2.5" + TwoAndHalf = 3, + /// 1.8" + OnePointEight = 4, + /// Less than 1.8" + LessThanOnePointEight = 5 + } + + /// Extended identify flag bits. + [Flags] + public enum ExtendedIdentifyBit : byte + { + /// Reserved + Reserved07 = 0x80, + /// Reserved + Reserved06 = 0x40, + /// Reserved + Reserved05 = 0x20, + /// Reserved + Reserved04 = 0x10, + /// Reserved + Reserved03 = 0x08, + /// Identify word 88 is valid + Word88Valid = 0x04, + /// Identify words 64 to 70 are valid + Words64to70Valid = 0x02, + /// Identify words 54 to 58 are valid + Words54to58Valid = 0x01 + } + + /// General configuration flag bits. + [Flags] + public enum GeneralConfigurationBit : ushort + { + /// Set on ATAPI + NonMagnetic = 0x8000, + /// Format speed tolerance gap is required Obsoleted in ATA-2 + FormatGapReq = 0x4000, + /// Track offset option is available Obsoleted in ATA-2 + TrackOffset = 0x2000, + /// Data strobe offset option is available Obsoleted in ATA-2 + DataStrobeOffset = 0x1000, + /// Rotational speed tolerance is higher than 0,5% Obsoleted in ATA-2 + RotationalSpeedTolerance = 0x0800, + /// Disk transfer rate is > 10 Mb/s Obsoleted in ATA-2 + UltraFastIDE = 0x0400, + /// Disk transfer rate is > 5 Mb/s but <= 10 Mb/s Obsoleted in ATA-2 + FastIDE = 0x0200, + /// Disk transfer rate is <= 5 Mb/s Obsoleted in ATA-2 + SlowIDE = 0x0100, + /// Drive uses removable media + Removable = 0x0080, + /// Drive is fixed Obsoleted in ATA/ATAPI-6 + Fixed = 0x0040, + /// Spindle motor control is implemented Obsoleted in ATA-2 + SpindleControl = 0x0020, + /// Head switch time is bigger than 15 µsec. Obsoleted in ATA-2 + HighHeadSwitch = 0x0010, + /// Drive is not MFM encoded Obsoleted in ATA-2 + NotMFM = 0x0008, + /// Drive is soft sectored Obsoleted in ATA-2 + SoftSector = 0x0004, + /// Response incomplete Since ATA/ATAPI-5 + IncompleteResponse = 0x0004, + /// Drive is hard sectored Obsoleted in ATA-2 + HardSector = 0x0002, + /// Reserved + Reserved = 0x0001 + } + + /// Word 80 Major version + [Flags] + public enum MajorVersionBit : ushort + { + #pragma warning disable 1591 + Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000, + Reserved12 = 0x1000, + #pragma warning restore 1591 + /// ACS-4 + ACS4 = 0x0800, + /// ACS-3 + ACS3 = 0x0400, + /// ACS-2 + ACS2 = 0x0200, + /// ATA8-ACS + Ata8ACS = 0x0100, + /// ATA/ATAPI-7 + AtaAtapi7 = 0x0080, + /// ATA/ATAPI-6 + AtaAtapi6 = 0x0040, + /// ATA/ATAPI-5 + AtaAtapi5 = 0x0020, + /// ATA/ATAPI-4 + AtaAtapi4 = 0x0010, + /// ATA-3 + Ata3 = 0x0008, + /// ATA-2 + Ata2 = 0x0004, + /// ATA-1 + Ata1 = 0x0002, + #pragma warning disable 1591 + Reserved00 = 0x0001 + #pragma warning restore 1591 + } + + /// SATA capabilities flags + [Flags] + public enum SATACapabilitiesBit : ushort + { + /// Supports READ LOG DMA EXT + ReadLogDMAExt = 0x8000, + /// Supports device automatic partial to slumber transitions + DevSlumbTrans = 0x4000, + /// Supports host automatic partial to slumber transitions + HostSlumbTrans = 0x2000, + /// Supports NCQ priority + NCQPriority = 0x1000, + /// Supports unload while NCQ commands are outstanding + UnloadNCQ = 0x0800, + /// Supports PHY Event Counters + PHYEventCounter = 0x0400, + /// Supports receipt of host initiated power management requests + PowerReceipt = 0x0200, + /// Supports NCQ + NCQ = 0x0100, + #pragma warning disable 1591 + Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020, + Reserved04 = 0x0010, + #pragma warning restore 1591 + /// Supports SATA Gen. 3 Signaling Speed (6.0Gb/s) + Gen3Speed = 0x0008, + /// Supports SATA Gen. 2 Signaling Speed (3.0Gb/s) + Gen2Speed = 0x0004, + /// Supports SATA Gen. 1 Signaling Speed (1.5Gb/s) + Gen1Speed = 0x0002, + /// MUST NOT be set + Clear = 0x0001 + } + + /// More SATA capabilities flags + [Flags] + 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, + #pragma warning restore 1591 + /// Supports RECEIVE FPDMA QUEUED and SEND FPDMA QUEUED + FPDMAQ = 0x0040, + /// Supports NCQ Queue Management + NCQMgmt = 0x0020, + /// ATAPI: Supports host environment detect + HostEnvDetect = 0x0020, + /// Supports NCQ streaming + NCQStream = 0x0010, + /// ATAPI: Supports device attention on slimline connected devices + DevAttSlimline = 0x0010, + /// Coded value indicating current negotiated Serial ATA signal speed + CurrentSpeedBit2 = 0x0008, + /// Coded value indicating current negotiated Serial ATA signal speed + CurrentSpeedBit1 = 0x0004, + /// Coded value indicating current negotiated Serial ATA signal speed + CurrentSpeedBit0 = 0x0002, + /// MUST NOT be set + Clear = 0x0001 + } + + /// SATA features flags + [Flags] + public enum SATAFeaturesBit : ushort + { + #pragma warning disable 1591 + 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, + /// Automatic Partial to Slumber transitions are enabled + EnabledSlumber = 0x0080, + /// Supports Software Settings Preservation + SettingsPreserve = 0x0040, + /// Supports hardware feature control + HardwareFeatureControl = 0x0020, + /// ATAPI: Asynchronous notification + AsyncNotification = 0x0020, + /// Supports in-order data delivery + InOrderData = 0x0010, + /// Supports initiating power management + InitPowerMgmt = 0x0008, + /// Supports DMA Setup auto-activation + DMASetup = 0x0004, + /// Supports non-zero buffer offsets + NonZeroBufferOffset = 0x0002, + /// MUST NOT be set + Clear = 0x0001 + } + + /// SCT Command Transport flags + [Flags] + 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, + Reserved06 = 0x0040, + #pragma warning restore 1591 + /// SCT Command Transport Data Tables supported + DataTables = 0x0020, + /// SCT Command Transport Features Control supported + FeaturesControl = 0x0010, + /// SCT Command Transport Error Recovery Control supported + ErrorRecoveryControl = 0x0008, + /// SCT Command Transport Write Same supported + WriteSame = 0x0004, + /// SCT Command Transport Long Sector Address supported + LongSectorAccess = 0x0002, + /// SCT Command Transport supported + Supported = 0x0001 + } + + /// Security status flag bits. + [Flags] + public enum SecurityStatusBit : ushort + { + #pragma warning disable 1591 + 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, + #pragma warning restore 1591 + /// Supports enhanced security erase + Enhanced = 0x0020, + /// Security count expired + Expired = 0x0010, + /// Security frozen + Frozen = 0x0008, + /// Security locked + Locked = 0x0004, + /// Security enabled + Enabled = 0x0002, + /// Security supported + Supported = 0x0001 + } + + /// Specific configuration flags + public enum SpecificConfigurationEnum : ushort + { + /// Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete + RequiresSetIncompleteResponse = 0x37C8, + /// Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is complete + RequiresSetCompleteResponse = 0x738C, + /// Device does not requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete + NotRequiresSetIncompleteResponse = 0x8C73, + /// Device does not requires SET FEATURES to spin up and IDENTIFY DEVICE response is complete + NotRequiresSetCompleteResponse = 0xC837 + } + + /// Transfer mode flags + [Flags] + public enum TransferMode : byte + { + #pragma warning disable 1591 + Mode7 = 0x80, Mode6 = 0x40, Mode5 = 0x20, + Mode4 = 0x10, Mode3 = 0x08, Mode2 = 0x04, + Mode1 = 0x02, Mode0 = 0x01 + #pragma warning restore 1591 + } + + /// Trusted Computing flags + [Flags] + public enum TrustedComputingBit : ushort + { + /// MUST NOT be set + Clear = 0x8000, + /// 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, + Reserved01 = 0x0002, + #pragma warning restore 1591 + /// Trusted Computing feature set is supported + TrustedComputing = 0x0001 + } + + /// IDENTIFY DEVICE decoded response + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 2)] + public struct IdentifyDevice + { + /// + /// Word 0 General device configuration On ATAPI devices: Bits 12 to 8 indicate device type as SCSI defined Bits 6 + /// to 5: 0 = Device shall set DRQ within 3 ms of receiving PACKET 1 = Device shall assert INTRQ when DRQ is set to one + /// 2 = Device shall set DRQ within 50 µs of receiving PACKET Bits 1 to 0: 0 = 12 byte command packet 1 = 16 byte + /// command packet CompactFlash is 0x848A (non magnetic, removable, not MFM, hardsector, and UltraFAST) + /// + public GeneralConfigurationBit GeneralConfiguration; + /// Word 1 Cylinders in default translation mode Obsoleted in ATA/ATAPI-6 + public ushort Cylinders; + /// Word 2 Specific configuration + public SpecificConfigurationEnum SpecificConfiguration; + /// Word 3 Heads in default translation mode Obsoleted in ATA/ATAPI-6 + public ushort Heads; + /// Word 4 Unformatted bytes per track in default translation mode Obsoleted in ATA-2 + public ushort UnformattedBPT; + /// Word 5 Unformatted bytes per sector in default translation mode Obsoleted in ATA-2 + public ushort UnformattedBPS; + /// Word 6 Sectors per track in default translation mode Obsoleted in ATA/ATAPI-6 + public ushort SectorsPerTrack; + /// Words 7 to 8 CFA: Number of sectors per card + public uint SectorsPerCard; + /// Word 9 Vendor unique Obsoleted in ATA/ATAPI-4 + public ushort VendorWord9; + /// Words 10 to 19 Device serial number, right justified, padded with spaces + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] + public string SerialNumber; + /// + /// Word 20 Manufacturer defined Obsoleted in ATA-2 0x0001 = single ported single sector buffer 0x0002 = dual + /// ported multi sector buffer 0x0003 = dual ported multi sector buffer with reading + /// + public ushort BufferType; + /// Word 21 Size of buffer in 512 byte increments Obsoleted in ATA-2 + public ushort BufferSize; + /// Word 22 Bytes of ECC available in READ/WRITE LONG commands Obsoleted in ATA/ATAPI-4 + public ushort EccBytes; + /// Words 23 to 26 Firmware revision, left justified, padded with spaces + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] + public string FirmwareRevision; + /// Words 27 to 46 Model number, left justified, padded with spaces + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] + public string Model; + /// + /// Word 47 bits 7 to 0 Maximum number of sectors that can be transferred per interrupt on read and write multiple + /// commands + /// + public byte MultipleMaxSectors; + /// Word 47 bits 15 to 8 Vendor unique ATA/ATAPI-4 says it must be 0x80 + public byte VendorWord47; + /// + /// Word 48 ATA-1: Set to 1 if it can perform doubleword I/O ATA-2 to ATA/ATAPI-7: Reserved ATA8-ACS: Trusted + /// Computing feature set + /// + public TrustedComputingBit TrustedComputing; + /// Word 49 Capabilities + public CapabilitiesBit Capabilities; + /// Word 50 Capabilities + public CapabilitiesBit2 Capabilities2; + /// Word 51 bits 7 to 0 Vendor unique Obsoleted in ATA/ATAPI-4 + public byte VendorWord51; + /// Word 51 bits 15 to 8 Transfer timing mode in PIO Obsoleted in ATA/ATAPI-4 + public byte PIOTransferTimingMode; + /// Word 52 bits 7 to 0 Vendor unique Obsoleted in ATA/ATAPI-4 + public byte VendorWord52; + /// Word 52 bits 15 to 8 Transfer timing mode in DMA Obsoleted in ATA/ATAPI-4 + public byte DMATransferTimingMode; + /// Word 53 bits 7 to 0 Reports if words 54 to 58 are valid + public ExtendedIdentifyBit ExtendedIdentify; + /// Word 53 bits 15 to 8 Free-fall Control Sensitivity + public byte FreeFallSensitivity; + /// Word 54 Cylinders in current translation mode Obsoleted in ATA/ATAPI-6 + public ushort CurrentCylinders; + /// Word 55 Heads in current translation mode Obsoleted in ATA/ATAPI-6 + public ushort CurrentHeads; + /// Word 56 Sectors per track in current translation mode Obsoleted in ATA/ATAPI-6 + public ushort CurrentSectorsPerTrack; + /// Words 57 to 58 Total sectors currently user-addressable Obsoleted in ATA/ATAPI-6 + public uint CurrentSectors; + /// Word 59 bits 7 to 0 Number of sectors currently set to transfer on a READ/WRITE MULTIPLE command + public byte MultipleSectorNumber; + /// Word 59 bits 15 to 8 Indicates if is valid + public CapabilitiesBit3 Capabilities3; + /// Words 60 to 61 If drive supports LBA, how many sectors are addressable using LBA + public uint LBASectors; + /// + /// Word 62 bits 7 to 0 Single word DMA modes available Obsoleted in ATA/ATAPI-4 In ATAPI it's not obsolete, + /// indicates UDMA mode (UDMA7 is instead MDMA0) + /// + public TransferMode DMASupported; + /// + /// Word 62 bits 15 to 8 Single word DMA mode currently active Obsoleted in ATA/ATAPI-4 In ATAPI it's not + /// obsolete, bits 0 and 1 indicate MDMA mode+1, bit 10 indicates DMA is supported and bit 15 indicates DMADIR bit in + /// PACKET is required for DMA transfers + /// + public TransferMode DMAActive; + /// Word 63 bits 7 to 0 Multiword DMA modes available + public TransferMode MDMASupported; + /// Word 63 bits 15 to 8 Multiword DMA mode currently active + public TransferMode MDMAActive; + + /// Word 64 bits 7 to 0 Supported Advanced PIO transfer modes + public TransferMode APIOSupported; + /// Word 64 bits 15 to 8 Reserved + public byte ReservedWord64; + /// Word 65 Minimum MDMA transfer cycle time per word in nanoseconds + public ushort MinMDMACycleTime; + /// Word 66 Recommended MDMA transfer cycle time per word in nanoseconds + public ushort RecMDMACycleTime; + /// Word 67 Minimum PIO transfer cycle time without flow control in nanoseconds + public ushort MinPIOCycleTimeNoFlow; + /// Word 68 Minimum PIO transfer cycle time with IORDY flow control in nanoseconds + public ushort MinPIOCycleTimeFlow; + + /// Word 69 Additional supported + public CommandSetBit5 CommandSet5; + /// Word 70 Reserved + public ushort ReservedWord70; + /// Word 71 ATAPI: Typical time in ns from receipt of PACKET to release bus + public ushort PacketBusRelease; + /// Word 72 ATAPI: Typical time in ns from receipt of SERVICE to clear BSY + public ushort ServiceBusyClear; + /// Word 73 Reserved + public ushort ReservedWord73; + /// Word 74 Reserved + public ushort ReservedWord74; + + /// Word 75 Maximum Queue depth + public ushort MaxQueueDepth; + + /// Word 76 Serial ATA Capabilities + public SATACapabilitiesBit SATACapabilities; + /// Word 77 Serial ATA Additional Capabilities + public SATACapabilitiesBit2 SATACapabilities2; + + /// Word 78 Supported Serial ATA features + public SATAFeaturesBit SATAFeatures; + /// Word 79 Enabled Serial ATA features + public SATAFeaturesBit EnabledSATAFeatures; + + /// Word 80 Major version of ATA/ATAPI standard supported + public MajorVersionBit MajorVersion; + /// Word 81 Minimum version of ATA/ATAPI standard supported + public ushort MinorVersion; + + /// Word 82 Supported command/feature sets + public CommandSetBit CommandSet; + /// Word 83 Supported command/feature sets + public CommandSetBit2 CommandSet2; + /// Word 84 Supported command/feature sets + public CommandSetBit3 CommandSet3; + + /// Word 85 Enabled command/feature sets + public CommandSetBit EnabledCommandSet; + /// Word 86 Enabled command/feature sets + public CommandSetBit2 EnabledCommandSet2; + /// Word 87 Enabled command/feature sets + public CommandSetBit3 EnabledCommandSet3; + + /// Word 88 bits 7 to 0 Supported Ultra DMA transfer modes + public TransferMode UDMASupported; + /// Word 88 bits 15 to 8 Selected Ultra DMA transfer modes + public TransferMode UDMAActive; + + /// Word 89 Time required for security erase completion + public ushort SecurityEraseTime; + /// Word 90 Time required for enhanced security erase completion + public ushort EnhancedSecurityEraseTime; + /// Word 91 Current advanced power management value + public ushort CurrentAPM; + + /// Word 92 Master password revision code + public ushort MasterPasswordRevisionCode; + /// Word 93 Hardware reset result + public ushort HardwareResetResult; + + /// Word 94 bits 7 to 0 Current AAM value + public byte CurrentAAM; + /// Word 94 bits 15 to 8 Vendor's recommended AAM value + public byte RecommendedAAM; + + /// Word 95 Stream minimum request size + public ushort StreamMinReqSize; + /// Word 96 Streaming transfer time in DMA + public ushort StreamTransferTimeDMA; + /// Word 97 Streaming access latency in DMA and PIO + public ushort StreamAccessLatency; + /// Words 98 to 99 Streaming performance granularity + public uint StreamPerformanceGranularity; + + /// Words 100 to 103 48-bit LBA addressable sectors + public ulong LBA48Sectors; + + /// Word 104 Streaming transfer time in PIO + public ushort StreamTransferTimePIO; + + /// Word 105 Maximum number of 512-byte block per DATA SET MANAGEMENT command + public ushort DataSetMgmtSize; + + /// + /// Word 106 Bit 15 should be zero Bit 14 should be one Bit 13 set indicates device has multiple logical sectors + /// per physical sector Bit 12 set indicates logical sector has more than 256 words (512 bytes) Bits 11 to 4 are + /// reserved Bits 3 to 0 indicate power of two of logical sectors per physical sector + /// + public ushort PhysLogSectorSize; + + /// Word 107 Interseek delay for ISO-7779 acoustic testing, in microseconds + public ushort InterseekDelay; + + /// Words 108 to 111 World Wide Name + public ulong WWN; + + /// Words 112 to 115 Reserved for WWN extension to 128 bit + public ulong WWNExtension; + + /// Word 116 Reserved for technical report + public ushort ReservedWord116; + + /// Words 117 to 118 Words per logical sector + public uint LogicalSectorWords; + + /// Word 119 Supported command/feature sets + public CommandSetBit4 CommandSet4; + /// Word 120 Supported command/feature sets + public CommandSetBit4 EnabledCommandSet4; + + /// Words 121 to 125 Reserved + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] + public ushort[] ReservedWords121; + + /// Word 126 ATAPI byte count limit + public ushort ATAPIByteCount; + + /// + /// Word 127 Removable Media Status Notification feature set support Bits 15 to 2 are reserved Bits 1 to 0 must be + /// 0 for not supported or 1 for supported. 2 and 3 are reserved. Obsoleted in ATA8-ACS + /// + public ushort RemovableStatusSet; + + /// Word 128 Security status + public SecurityStatusBit SecurityStatus; + + /// Words 129 to 159 + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] + public ushort[] ReservedWords129; + + /// + /// Word 160 CFA power mode Bit 15 must be set Bit 13 indicates mode 1 is required for one or more commands Bit 12 + /// indicates mode 1 is disabled Bits 11 to 0 indicates maximum current in mA + /// + public ushort CFAPowerMode; + + /// Words 161 to 167 Reserved for CFA + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] + public ushort[] ReservedCFA; + + /// Word 168 Bits 15 to 4, reserved Bits 3 to 0, device nominal form factor + public DeviceFormFactorEnum DeviceFormFactor; + /// Word 169 DATA SET MANAGEMENT support + public DataSetMgmtBit DataSetMgmt; + /// Words 170 to 173 Additional product identifier + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] + public string AdditionalPID; + + /// Word 174 Reserved + public ushort ReservedWord174; + /// Word 175 Reserved + public ushort ReservedWord175; + + /// Words 176 to 195 Current media serial number + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] + public string MediaSerial; + /// Words 196 to 205 Current media manufacturer + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] + public string MediaManufacturer; + + /// Word 206 SCT Command Transport features + public SCTCommandTransportBit SCTCommandTransport; + + /// Word 207 Reserved for CE-ATA + public ushort ReservedCEATAWord207; + /// Word 208 Reserved for CE-ATA + public ushort ReservedCEATAWord208; + + /// + /// Word 209 Alignment of logical block within a larger physical block Bit 15 shall be cleared to zero Bit 14 + /// shall be set to one Bits 13 to 0 indicate logical sector offset within the first physical sector + /// + public ushort LogicalAlignment; + + /// Words 210 to 211 Write/Read/Verify sector count mode 3 only + public uint WRVSectorCountMode3; + /// Words 212 to 213 Write/Read/Verify sector count mode 2 only + public uint WRVSectorCountMode2; + + /// + /// Word 214 NV Cache capabilities Bits 15 to 12 feature set version Bits 11 to 18 power mode feature set version + /// Bits 7 to 5 reserved Bit 4 feature set enabled Bits 3 to 2 reserved Bit 1 power mode feature set enabled Bit 0 + /// power mode feature set supported + /// + public ushort NVCacheCaps; + /// Words 215 to 216 NV Cache Size in Logical BLocks + public uint NVCacheSize; + /// Word 217 Nominal media rotation rate In ACS-1 meant NV Cache read speed in MB/s + public ushort NominalRotationRate; + /// Word 218 NV Cache write speed in MB/s Reserved since ACS-2 + public ushort NVCacheWriteSpeed; + /// Word 219 bits 7 to 0 Estimated device spin up in seconds + public byte NVEstimatedSpinUp; + /// Word 219 bits 15 to 8 NV Cache reserved + public byte NVReserved; + + /// Word 220 bits 7 to 0 Write/Read/Verify feature set current mode + public byte WRVMode; + /// Word 220 bits 15 to 8 Reserved + public byte WRVReserved; + + /// Word 221 Reserved + public ushort ReservedWord221; + + /// + /// Word 222 Transport major revision number Bits 15 to 12 indicate transport type. 0 parallel, 1 serial, 0xE + /// PCIe. Bits 11 to 0 indicate revision + /// + public ushort TransportMajorVersion; + /// Word 223 Transport minor revision number + public ushort TransportMinorVersion; + + /// Words 224 to 229 Reserved for CE-ATA + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] + public ushort[] ReservedCEATA224; + + /// Words 230 to 233 48-bit LBA if Word 69 bit 3 is set + public ulong ExtendedUserSectors; + + /// Word 234 Minimum number of 512 byte units per DOWNLOAD MICROCODE mode 3 + public ushort MinDownloadMicroMode3; + /// Word 235 Maximum number of 512 byte units per DOWNLOAD MICROCODE mode 3 + public ushort MaxDownloadMicroMode3; + + /// Words 236 to 254 + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] + public ushort[] ReservedWords; + + /// Word 255 bits 7 to 0 Should be 0xA5 + public byte Signature; + /// Word 255 bits 15 to 8 Checksum + public byte Checksum; + } + + /// Decodes a raw IDENTIFY DEVICE response + /// Raw IDENTIFY DEVICE response + /// Decoded IDENTIFY DEVICE + public static IdentifyDevice? Decode(byte[] IdentifyDeviceResponse) + { + if(IdentifyDeviceResponse == null) + return null; + + if(IdentifyDeviceResponse.Length != 512) { - /// ATAPI: Interleaved DMA supported - InterleavedDMA = 0x8000, - /// ATAPI: Command queueing supported - CommandQueue = 0x4000, - /// Standby timer values are standard - StandardStandbyTimer = 0x2000, - /// ATAPI: Overlap operation supported - OverlapOperation = 0x2000, - /// ATAPI: ATA software reset required Obsoleted in ATA/ATAPI-4 - RequiresATASoftReset = 0x1000, - /// IORDY is supported - IORDY = 0x0800, - /// IORDY can be disabled - CanDisableIORDY = 0x0400, - /// LBA is supported - LBASupport = 0x0200, - /// DMA is supported - DMASupport = 0x0100, - /// Vendor unique Obsoleted in ATA/ATAPI-4 - VendorBit7 = 0x0080, - /// Vendor unique Obsoleted in ATA/ATAPI-4 - VendorBit6 = 0x0040, - /// Vendor unique Obsoleted in ATA/ATAPI-4 - VendorBit5 = 0x0020, - /// Vendor unique Obsoleted in ATA/ATAPI-4 - VendorBit4 = 0x0010, - /// Vendor unique Obsoleted in ATA/ATAPI-4 - VendorBit3 = 0x0008, - /// Vendor unique Obsoleted in ATA/ATAPI-4 - VendorBit2 = 0x0004, - /// Long Physical Alignment setting bit 1 - PhysicalAlignment1 = 0x0002, - /// Long Physical Alignment setting bit 0 - PhysicalAlignment0 = 0x0001 + AaruConsole.DebugWriteLine("ATA/ATAPI IDENTIFY decoder", + "IDENTIFY response is different than 512 bytes, not decoding."); + + return null; } - /// More capabilities flag bits. - [Flags] - public enum CapabilitiesBit2 : ushort + IdentifyDevice ATAID = Marshal.ByteArrayToStructureLittleEndian(IdentifyDeviceResponse); + + ATAID.WWN = DescrambleWWN(ATAID.WWN); + ATAID.WWNExtension = DescrambleWWN(ATAID.WWNExtension); + + ATAID.SerialNumber = DescrambleATAString(IdentifyDeviceResponse, 10 * 2, 20); + ATAID.FirmwareRevision = DescrambleATAString(IdentifyDeviceResponse, 23 * 2, 8); + ATAID.Model = DescrambleATAString(IdentifyDeviceResponse, 27 * 2, 40); + ATAID.AdditionalPID = DescrambleATAString(IdentifyDeviceResponse, 170 * 2, 8); + ATAID.MediaSerial = DescrambleATAString(IdentifyDeviceResponse, 176 * 2, 40); + ATAID.MediaManufacturer = DescrambleATAString(IdentifyDeviceResponse, 196 * 2, 20); + + return ATAID; + } + + /// Encodes a raw IDENTIFY DEVICE response + /// Decoded IDENTIFY DEVICE + /// Raw IDENTIFY DEVICE response + public static byte[] Encode(IdentifyDevice? identify) + { + if(identify is null) + return null; + + IdentifyDevice ataId = identify.Value; + + ataId.WWN = DescrambleWWN(ataId.WWN); + ataId.WWNExtension = DescrambleWWN(ataId.WWNExtension); + + byte[] buf = new byte[512]; + IntPtr 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); + + byte[] str = ScrambleATAString(ataId.SerialNumber, 20); + Array.Copy(str, 0, buf, 10 * 2, 20); + str = ScrambleATAString(ataId.FirmwareRevision, 8); + Array.Copy(str, 0, buf, 23 * 2, 8); + str = ScrambleATAString(ataId.Model, 40); + Array.Copy(str, 0, buf, 27 * 2, 40); + str = ScrambleATAString(ataId.AdditionalPID, 8); + Array.Copy(str, 0, buf, 170 * 2, 8); + str = ScrambleATAString(ataId.MediaSerial, 40); + Array.Copy(str, 0, buf, 176 * 2, 40); + str = ScrambleATAString(ataId.MediaManufacturer, 20); + Array.Copy(str, 0, buf, 196 * 2, 20); + + return buf; + } + + static ulong DescrambleWWN(ulong WWN) + { + byte[] qwb = BitConverter.GetBytes(WWN); + byte[] qword = new byte[8]; + + qword[7] = qwb[1]; + qword[6] = qwb[0]; + qword[5] = qwb[3]; + qword[4] = qwb[2]; + qword[3] = qwb[5]; + qword[2] = qwb[4]; + qword[1] = qwb[7]; + qword[0] = qwb[6]; + + return BitConverter.ToUInt64(qword, 0); + } + + static string DescrambleATAString(IList buffer, int offset, int length) + { + byte[] outbuf = buffer[offset + length - 1] != 0x00 ? new byte[length + 1] : new byte[length]; + + for(int i = 0; i < length; i += 2) { - /// MUST NOT be set - MustBeClear = 0x8000, - /// 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, - Reserved01 = 0x0002, - #pragma warning restore 1591 - /// Indicates a device specific minimum standby timer value - SpecificStandbyTimer = 0x0001 + outbuf[i] = buffer[offset + i + 1]; + outbuf[i + 1] = buffer[offset + i]; } - /// Even more capabilities flag bits. - [Flags] - public enum CapabilitiesBit3 : byte - { - /// BLOCK ERASE EXT supported - BlockErase = 0x0080, - /// OVERWRITE EXT supported - Overwrite = 0x0040, - /// CRYPTO SCRAMBLE EXT supported - CryptoScramble = 0x0020, - /// Sanitize feature set is supported - Sanitize = 0x0010, - /// If unset, sanitize commands are specified by ACS-2 - SanitizeCommands = 0x0008, - /// SANITIZE ANTIFREEZE LOCK EXT is supported - SanitizeAntifreeze = 0x0004, - #pragma warning disable 1591 - Reserved01 = 0x0002, - #pragma warning restore 1591 - /// Multiple logical sector setting is valid - MultipleValid = 0x0001 - } + string outStr = StringHandlers.CToString(outbuf); - /// Command set flag bits. - [Flags] - public enum CommandSetBit : ushort - { - /// Already obsolete in ATA/ATAPI-4, reserved in ATA3 - Obsolete15 = 0x8000, - /// NOP is supported - Nop = 0x4000, - /// READ BUFFER is supported - ReadBuffer = 0x2000, - /// WRITE BUFFER is supported - WriteBuffer = 0x1000, - /// Already obsolete in ATA/ATAPI-4, reserved in ATA3 - Obsolete11 = 0x0800, - /// Host Protected Area is supported - HPA = 0x0400, - /// DEVICE RESET is supported - DeviceReset = 0x0200, - /// SERVICE interrupt is supported - Service = 0x0100, - /// Release is supported - Release = 0x0080, - /// Look-ahead is supported - LookAhead = 0x0040, - /// Write cache is supported - WriteCache = 0x0020, - /// PACKET command set is supported - Packet = 0x0010, - /// Power Management feature set is supported - PowerManagement = 0x0008, - /// Removable Media feature set is supported - RemovableMedia = 0x0004, - /// Security Mode feature set is supported - SecurityMode = 0x0002, - /// SMART feature set is supported - SMART = 0x0001 - } + return outStr.Trim(); + } - /// More command set flag bits. - [Flags] - public enum CommandSetBit2 : ushort - { - /// MUST NOT be set - MustBeClear = 0x8000, - /// MUST BE SET - MustBeSet = 0x4000, - /// FLUSH CACHE EXT supported - FlushCacheExt = 0x2000, - /// FLUSH CACHE supported - FlushCache = 0x1000, - /// Device Configuration Overlay feature set supported - DCO = 0x0800, - /// 48-bit LBA supported - LBA48 = 0x0400, - /// Automatic Acoustic Management supported - AAM = 0x0200, - /// SET MAX security extension supported - SetMax = 0x0100, - /// Address Offset Reserved Area Boot NCITS TR27:2001 - AddressOffsetReservedAreaBoot = 0x0080, - /// SET FEATURES required to spin-up - SetFeaturesRequired = 0x0040, - /// Power-Up in standby feature set supported - PowerUpInStandby = 0x0020, - /// Removable Media Status Notification feature set is supported - RemovableNotification = 0x0010, - /// Advanced Power Management feature set is supported - APM = 0x0008, - /// Compact Flash feature set is supported - CompactFlash = 0x0004, - /// READ DMA QUEUED and WRITE DMA QUEUED are supported - RWQueuedDMA = 0x0002, - /// DOWNLOAD MICROCODE is supported - DownloadMicrocode = 0x0001 - } + static byte[] ScrambleATAString(string str, int length) + { + byte[] buf = new byte[length]; - /// Even more command set flag bits. - [Flags] - public enum CommandSetBit3 : ushort - { - /// MUST NOT be set - MustBeClear = 0x8000, - /// MUST BE SET - MustBeSet = 0x4000, - /// IDLE IMMEDIATE with UNLOAD FEATURE is supported - IdleImmediate = 0x2000, - /// Reserved for INCITS TR-37/2004 - Reserved12 = 0x1000, - /// Reserved for INCITS TR-37/2004 - Reserved11 = 0x0800, - /// URG bit is supported in WRITE STREAM DMA EXT and WRITE STREAM EXT - WriteURG = 0x0400, - /// URG bit is supported in READ STREAM DMA EXT and READ STREAM EXT - ReadURG = 0x0200, - /// 64-bit World Wide Name is supported - WWN = 0x0100, - /// WRITE DMA QUEUED FUA EXT is supported - FUAWriteQ = 0x0080, - /// WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported - FUAWrite = 0x0040, - /// General Purpose Logging feature supported - GPL = 0x0020, - /// Streaming feature set is supported - Streaming = 0x0010, - /// Media Card Pass Through command set supported - MCPT = 0x0008, - /// Media serial number supported - MediaSerial = 0x0004, - /// SMART self-test supported - SMARTSelfTest = 0x0002, - /// SMART error logging supported - SMARTLog = 0x0001 - } - - /// Yet more command set flag bits. - [Flags] - public enum CommandSetBit4 : ushort - { - /// MUST NOT be set - MustBeClear = 0x8000, - /// MUST be set - MustBeSet = 0x4000, - #pragma warning disable 1591 - Reserved13 = 0x2000, Reserved12 = 0x1000, Reserved11 = 0x0800, - Reserved10 = 0x0400, - #pragma warning restore 1591 - /// DSN feature set is supported - DSN = 0x0200, - /// Accessible Max Address Configuration is supported - AMAC = 0x0100, - /// Extended Power Conditions is supported - ExtPowerCond = 0x0080, - /// Extended Status Reporting is supported - ExtStatusReport = 0x0040, - /// Free-fall Control feature set is supported - FreeFallControl = 0x0020, - /// Supports segmented feature in DOWNLOAD MICROCODE - SegmentedDownloadMicrocode = 0x0010, - /// READ/WRITE DMA EXT GPL are supported - RWDMAExtGpl = 0x0008, - /// WRITE UNCORRECTABLE is supported - WriteUnc = 0x0004, - /// Write/Read/Verify is supported - WRV = 0x0002, - /// Reserved for DT1825 - DT1825 = 0x0001 - } - - /// Yet again more command set flag bits. - [Flags] - public enum CommandSetBit5 : ushort - { - /// Supports CFast Specification - CFast = 0x8000, - /// Deterministic read after TRIM is supported - DeterministicTrim = 0x4000, - /// Long physical sector alignment error reporting control is supported - LongPhysSectorAligError = 0x2000, - /// DEVICE CONFIGURATION IDENTIFY DMA and DEVICE CONFIGURATION SET DMA are supported - DeviceConfDMA = 0x1000, - /// READ BUFFER DMA is supported - ReadBufferDMA = 0x0800, - /// WRITE BUFFER DMA is supported - WriteBufferDMA = 0x0400, - /// SET PASSWORD DMA and SET UNLOCK DMA are supported - SetMaxDMA = 0x0200, - /// DOWNLOAD MICROCODE DMA is supported - DownloadMicroCodeDMA = 0x0100, - /// Reserved for IEEE-1667 - IEEE1667 = 0x0080, - /// Optional ATA 28-bit commands are supported - Ata28 = 0x0040, - /// Read zero after TRIM is supported - ReadZeroTrim = 0x0020, - /// Device encrypts all user data - Encrypted = 0x0010, - /// Extended number of user addressable sectors is supported - ExtSectors = 0x0008, - /// All write cache is non-volatile - AllCacheNV = 0x0004, - /// Zoned capabilities bit 1 - ZonedBit1 = 0x0002, - /// Zoned capabilities bit 0 - ZonedBit0 = 0x0001 - } - - /// Data set management flag bits. - [Flags] - 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, - #pragma warning restore 1591 - /// TRIM is supported - Trim = 0x0001 - } - - /// Device form factor - public enum DeviceFormFactorEnum : ushort - { - /// Size not reported - NotReported = 0, - /// 5.25" - FiveAndQuarter = 1, - /// 3.5" - ThreeAndHalf = 2, - /// 2.5" - TwoAndHalf = 3, - /// 1.8" - OnePointEight = 4, - /// Less than 1.8" - LessThanOnePointEight = 5 - } - - /// Extended identify flag bits. - [Flags] - public enum ExtendedIdentifyBit : byte - { - /// Reserved - Reserved07 = 0x80, - /// Reserved - Reserved06 = 0x40, - /// Reserved - Reserved05 = 0x20, - /// Reserved - Reserved04 = 0x10, - /// Reserved - Reserved03 = 0x08, - /// Identify word 88 is valid - Word88Valid = 0x04, - /// Identify words 64 to 70 are valid - Words64to70Valid = 0x02, - /// Identify words 54 to 58 are valid - Words54to58Valid = 0x01 - } - - /// General configuration flag bits. - [Flags] - public enum GeneralConfigurationBit : ushort - { - /// Set on ATAPI - NonMagnetic = 0x8000, - /// Format speed tolerance gap is required Obsoleted in ATA-2 - FormatGapReq = 0x4000, - /// Track offset option is available Obsoleted in ATA-2 - TrackOffset = 0x2000, - /// Data strobe offset option is available Obsoleted in ATA-2 - DataStrobeOffset = 0x1000, - /// Rotational speed tolerance is higher than 0,5% Obsoleted in ATA-2 - RotationalSpeedTolerance = 0x0800, - /// Disk transfer rate is > 10 Mb/s Obsoleted in ATA-2 - UltraFastIDE = 0x0400, - /// Disk transfer rate is > 5 Mb/s but <= 10 Mb/s Obsoleted in ATA-2 - FastIDE = 0x0200, - /// Disk transfer rate is <= 5 Mb/s Obsoleted in ATA-2 - SlowIDE = 0x0100, - /// Drive uses removable media - Removable = 0x0080, - /// Drive is fixed Obsoleted in ATA/ATAPI-6 - Fixed = 0x0040, - /// Spindle motor control is implemented Obsoleted in ATA-2 - SpindleControl = 0x0020, - /// Head switch time is bigger than 15 µsec. Obsoleted in ATA-2 - HighHeadSwitch = 0x0010, - /// Drive is not MFM encoded Obsoleted in ATA-2 - NotMFM = 0x0008, - /// Drive is soft sectored Obsoleted in ATA-2 - SoftSector = 0x0004, - /// Response incomplete Since ATA/ATAPI-5 - IncompleteResponse = 0x0004, - /// Drive is hard sectored Obsoleted in ATA-2 - HardSector = 0x0002, - /// Reserved - Reserved = 0x0001 - } - - /// Word 80 Major version - [Flags] - public enum MajorVersionBit : ushort - { - #pragma warning disable 1591 - Reserved15 = 0x8000, Reserved14 = 0x4000, Reserved13 = 0x2000, - Reserved12 = 0x1000, - #pragma warning restore 1591 - /// ACS-4 - ACS4 = 0x0800, - /// ACS-3 - ACS3 = 0x0400, - /// ACS-2 - ACS2 = 0x0200, - /// ATA8-ACS - Ata8ACS = 0x0100, - /// ATA/ATAPI-7 - AtaAtapi7 = 0x0080, - /// ATA/ATAPI-6 - AtaAtapi6 = 0x0040, - /// ATA/ATAPI-5 - AtaAtapi5 = 0x0020, - /// ATA/ATAPI-4 - AtaAtapi4 = 0x0010, - /// ATA-3 - Ata3 = 0x0008, - /// ATA-2 - Ata2 = 0x0004, - /// ATA-1 - Ata1 = 0x0002, - #pragma warning disable 1591 - Reserved00 = 0x0001 - #pragma warning restore 1591 - } - - /// SATA capabilities flags - [Flags] - public enum SATACapabilitiesBit : ushort - { - /// Supports READ LOG DMA EXT - ReadLogDMAExt = 0x8000, - /// Supports device automatic partial to slumber transitions - DevSlumbTrans = 0x4000, - /// Supports host automatic partial to slumber transitions - HostSlumbTrans = 0x2000, - /// Supports NCQ priority - NCQPriority = 0x1000, - /// Supports unload while NCQ commands are outstanding - UnloadNCQ = 0x0800, - /// Supports PHY Event Counters - PHYEventCounter = 0x0400, - /// Supports receipt of host initiated power management requests - PowerReceipt = 0x0200, - /// Supports NCQ - NCQ = 0x0100, - #pragma warning disable 1591 - Reserved07 = 0x0080, Reserved06 = 0x0040, Reserved05 = 0x0020, - Reserved04 = 0x0010, - #pragma warning restore 1591 - /// Supports SATA Gen. 3 Signaling Speed (6.0Gb/s) - Gen3Speed = 0x0008, - /// Supports SATA Gen. 2 Signaling Speed (3.0Gb/s) - Gen2Speed = 0x0004, - /// Supports SATA Gen. 1 Signaling Speed (1.5Gb/s) - Gen1Speed = 0x0002, - /// MUST NOT be set - Clear = 0x0001 - } - - /// More SATA capabilities flags - [Flags] - 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, - #pragma warning restore 1591 - /// Supports RECEIVE FPDMA QUEUED and SEND FPDMA QUEUED - FPDMAQ = 0x0040, - /// Supports NCQ Queue Management - NCQMgmt = 0x0020, - /// ATAPI: Supports host environment detect - HostEnvDetect = 0x0020, - /// Supports NCQ streaming - NCQStream = 0x0010, - /// ATAPI: Supports device attention on slimline connected devices - DevAttSlimline = 0x0010, - /// Coded value indicating current negotiated Serial ATA signal speed - CurrentSpeedBit2 = 0x0008, - /// Coded value indicating current negotiated Serial ATA signal speed - CurrentSpeedBit1 = 0x0004, - /// Coded value indicating current negotiated Serial ATA signal speed - CurrentSpeedBit0 = 0x0002, - /// MUST NOT be set - Clear = 0x0001 - } - - /// SATA features flags - [Flags] - public enum SATAFeaturesBit : ushort - { - #pragma warning disable 1591 - 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, - /// Automatic Partial to Slumber transitions are enabled - EnabledSlumber = 0x0080, - /// Supports Software Settings Preservation - SettingsPreserve = 0x0040, - /// Supports hardware feature control - HardwareFeatureControl = 0x0020, - /// ATAPI: Asynchronous notification - AsyncNotification = 0x0020, - /// Supports in-order data delivery - InOrderData = 0x0010, - /// Supports initiating power management - InitPowerMgmt = 0x0008, - /// Supports DMA Setup auto-activation - DMASetup = 0x0004, - /// Supports non-zero buffer offsets - NonZeroBufferOffset = 0x0002, - /// MUST NOT be set - Clear = 0x0001 - } - - /// SCT Command Transport flags - [Flags] - 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, - Reserved06 = 0x0040, - #pragma warning restore 1591 - /// SCT Command Transport Data Tables supported - DataTables = 0x0020, - /// SCT Command Transport Features Control supported - FeaturesControl = 0x0010, - /// SCT Command Transport Error Recovery Control supported - ErrorRecoveryControl = 0x0008, - /// SCT Command Transport Write Same supported - WriteSame = 0x0004, - /// SCT Command Transport Long Sector Address supported - LongSectorAccess = 0x0002, - /// SCT Command Transport supported - Supported = 0x0001 - } - - /// Security status flag bits. - [Flags] - public enum SecurityStatusBit : ushort - { - #pragma warning disable 1591 - 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, - #pragma warning restore 1591 - /// Supports enhanced security erase - Enhanced = 0x0020, - /// Security count expired - Expired = 0x0010, - /// Security frozen - Frozen = 0x0008, - /// Security locked - Locked = 0x0004, - /// Security enabled - Enabled = 0x0002, - /// Security supported - Supported = 0x0001 - } - - /// Specific configuration flags - public enum SpecificConfigurationEnum : ushort - { - /// Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete - RequiresSetIncompleteResponse = 0x37C8, - /// Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is complete - RequiresSetCompleteResponse = 0x738C, - /// Device does not requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete - NotRequiresSetIncompleteResponse = 0x8C73, - /// Device does not requires SET FEATURES to spin up and IDENTIFY DEVICE response is complete - NotRequiresSetCompleteResponse = 0xC837 - } - - /// Transfer mode flags - [Flags] - public enum TransferMode : byte - { - #pragma warning disable 1591 - Mode7 = 0x80, Mode6 = 0x40, Mode5 = 0x20, - Mode4 = 0x10, Mode3 = 0x08, Mode2 = 0x04, - Mode1 = 0x02, Mode0 = 0x01 - #pragma warning restore 1591 - } - - /// Trusted Computing flags - [Flags] - public enum TrustedComputingBit : ushort - { - /// MUST NOT be set - Clear = 0x8000, - /// 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, - Reserved01 = 0x0002, - #pragma warning restore 1591 - /// Trusted Computing feature set is supported - TrustedComputing = 0x0001 - } - - /// IDENTIFY DEVICE decoded response - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 2)] - public struct IdentifyDevice - { - /// - /// Word 0 General device configuration On ATAPI devices: Bits 12 to 8 indicate device type as SCSI defined Bits 6 - /// to 5: 0 = Device shall set DRQ within 3 ms of receiving PACKET 1 = Device shall assert INTRQ when DRQ is set to one - /// 2 = Device shall set DRQ within 50 µs of receiving PACKET Bits 1 to 0: 0 = 12 byte command packet 1 = 16 byte - /// command packet CompactFlash is 0x848A (non magnetic, removable, not MFM, hardsector, and UltraFAST) - /// - public GeneralConfigurationBit GeneralConfiguration; - /// Word 1 Cylinders in default translation mode Obsoleted in ATA/ATAPI-6 - public ushort Cylinders; - /// Word 2 Specific configuration - public SpecificConfigurationEnum SpecificConfiguration; - /// Word 3 Heads in default translation mode Obsoleted in ATA/ATAPI-6 - public ushort Heads; - /// Word 4 Unformatted bytes per track in default translation mode Obsoleted in ATA-2 - public ushort UnformattedBPT; - /// Word 5 Unformatted bytes per sector in default translation mode Obsoleted in ATA-2 - public ushort UnformattedBPS; - /// Word 6 Sectors per track in default translation mode Obsoleted in ATA/ATAPI-6 - public ushort SectorsPerTrack; - /// Words 7 to 8 CFA: Number of sectors per card - public uint SectorsPerCard; - /// Word 9 Vendor unique Obsoleted in ATA/ATAPI-4 - public ushort VendorWord9; - /// Words 10 to 19 Device serial number, right justified, padded with spaces - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string SerialNumber; - /// - /// Word 20 Manufacturer defined Obsoleted in ATA-2 0x0001 = single ported single sector buffer 0x0002 = dual - /// ported multi sector buffer 0x0003 = dual ported multi sector buffer with reading - /// - public ushort BufferType; - /// Word 21 Size of buffer in 512 byte increments Obsoleted in ATA-2 - public ushort BufferSize; - /// Word 22 Bytes of ECC available in READ/WRITE LONG commands Obsoleted in ATA/ATAPI-4 - public ushort EccBytes; - /// Words 23 to 26 Firmware revision, left justified, padded with spaces - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] - public string FirmwareRevision; - /// Words 27 to 46 Model number, left justified, padded with spaces - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] - public string Model; - /// - /// Word 47 bits 7 to 0 Maximum number of sectors that can be transferred per interrupt on read and write multiple - /// commands - /// - public byte MultipleMaxSectors; - /// Word 47 bits 15 to 8 Vendor unique ATA/ATAPI-4 says it must be 0x80 - public byte VendorWord47; - /// - /// Word 48 ATA-1: Set to 1 if it can perform doubleword I/O ATA-2 to ATA/ATAPI-7: Reserved ATA8-ACS: Trusted - /// Computing feature set - /// - public TrustedComputingBit TrustedComputing; - /// Word 49 Capabilities - public CapabilitiesBit Capabilities; - /// Word 50 Capabilities - public CapabilitiesBit2 Capabilities2; - /// Word 51 bits 7 to 0 Vendor unique Obsoleted in ATA/ATAPI-4 - public byte VendorWord51; - /// Word 51 bits 15 to 8 Transfer timing mode in PIO Obsoleted in ATA/ATAPI-4 - public byte PIOTransferTimingMode; - /// Word 52 bits 7 to 0 Vendor unique Obsoleted in ATA/ATAPI-4 - public byte VendorWord52; - /// Word 52 bits 15 to 8 Transfer timing mode in DMA Obsoleted in ATA/ATAPI-4 - public byte DMATransferTimingMode; - /// Word 53 bits 7 to 0 Reports if words 54 to 58 are valid - public ExtendedIdentifyBit ExtendedIdentify; - /// Word 53 bits 15 to 8 Free-fall Control Sensitivity - public byte FreeFallSensitivity; - /// Word 54 Cylinders in current translation mode Obsoleted in ATA/ATAPI-6 - public ushort CurrentCylinders; - /// Word 55 Heads in current translation mode Obsoleted in ATA/ATAPI-6 - public ushort CurrentHeads; - /// Word 56 Sectors per track in current translation mode Obsoleted in ATA/ATAPI-6 - public ushort CurrentSectorsPerTrack; - /// Words 57 to 58 Total sectors currently user-addressable Obsoleted in ATA/ATAPI-6 - public uint CurrentSectors; - /// Word 59 bits 7 to 0 Number of sectors currently set to transfer on a READ/WRITE MULTIPLE command - public byte MultipleSectorNumber; - /// Word 59 bits 15 to 8 Indicates if is valid - public CapabilitiesBit3 Capabilities3; - /// Words 60 to 61 If drive supports LBA, how many sectors are addressable using LBA - public uint LBASectors; - /// - /// Word 62 bits 7 to 0 Single word DMA modes available Obsoleted in ATA/ATAPI-4 In ATAPI it's not obsolete, - /// indicates UDMA mode (UDMA7 is instead MDMA0) - /// - public TransferMode DMASupported; - /// - /// Word 62 bits 15 to 8 Single word DMA mode currently active Obsoleted in ATA/ATAPI-4 In ATAPI it's not - /// obsolete, bits 0 and 1 indicate MDMA mode+1, bit 10 indicates DMA is supported and bit 15 indicates DMADIR bit in - /// PACKET is required for DMA transfers - /// - public TransferMode DMAActive; - /// Word 63 bits 7 to 0 Multiword DMA modes available - public TransferMode MDMASupported; - /// Word 63 bits 15 to 8 Multiword DMA mode currently active - public TransferMode MDMAActive; - - /// Word 64 bits 7 to 0 Supported Advanced PIO transfer modes - public TransferMode APIOSupported; - /// Word 64 bits 15 to 8 Reserved - public byte ReservedWord64; - /// Word 65 Minimum MDMA transfer cycle time per word in nanoseconds - public ushort MinMDMACycleTime; - /// Word 66 Recommended MDMA transfer cycle time per word in nanoseconds - public ushort RecMDMACycleTime; - /// Word 67 Minimum PIO transfer cycle time without flow control in nanoseconds - public ushort MinPIOCycleTimeNoFlow; - /// Word 68 Minimum PIO transfer cycle time with IORDY flow control in nanoseconds - public ushort MinPIOCycleTimeFlow; - - /// Word 69 Additional supported - public CommandSetBit5 CommandSet5; - /// Word 70 Reserved - public ushort ReservedWord70; - /// Word 71 ATAPI: Typical time in ns from receipt of PACKET to release bus - public ushort PacketBusRelease; - /// Word 72 ATAPI: Typical time in ns from receipt of SERVICE to clear BSY - public ushort ServiceBusyClear; - /// Word 73 Reserved - public ushort ReservedWord73; - /// Word 74 Reserved - public ushort ReservedWord74; - - /// Word 75 Maximum Queue depth - public ushort MaxQueueDepth; - - /// Word 76 Serial ATA Capabilities - public SATACapabilitiesBit SATACapabilities; - /// Word 77 Serial ATA Additional Capabilities - public SATACapabilitiesBit2 SATACapabilities2; - - /// Word 78 Supported Serial ATA features - public SATAFeaturesBit SATAFeatures; - /// Word 79 Enabled Serial ATA features - public SATAFeaturesBit EnabledSATAFeatures; - - /// Word 80 Major version of ATA/ATAPI standard supported - public MajorVersionBit MajorVersion; - /// Word 81 Minimum version of ATA/ATAPI standard supported - public ushort MinorVersion; - - /// Word 82 Supported command/feature sets - public CommandSetBit CommandSet; - /// Word 83 Supported command/feature sets - public CommandSetBit2 CommandSet2; - /// Word 84 Supported command/feature sets - public CommandSetBit3 CommandSet3; - - /// Word 85 Enabled command/feature sets - public CommandSetBit EnabledCommandSet; - /// Word 86 Enabled command/feature sets - public CommandSetBit2 EnabledCommandSet2; - /// Word 87 Enabled command/feature sets - public CommandSetBit3 EnabledCommandSet3; - - /// Word 88 bits 7 to 0 Supported Ultra DMA transfer modes - public TransferMode UDMASupported; - /// Word 88 bits 15 to 8 Selected Ultra DMA transfer modes - public TransferMode UDMAActive; - - /// Word 89 Time required for security erase completion - public ushort SecurityEraseTime; - /// Word 90 Time required for enhanced security erase completion - public ushort EnhancedSecurityEraseTime; - /// Word 91 Current advanced power management value - public ushort CurrentAPM; - - /// Word 92 Master password revision code - public ushort MasterPasswordRevisionCode; - /// Word 93 Hardware reset result - public ushort HardwareResetResult; - - /// Word 94 bits 7 to 0 Current AAM value - public byte CurrentAAM; - /// Word 94 bits 15 to 8 Vendor's recommended AAM value - public byte RecommendedAAM; - - /// Word 95 Stream minimum request size - public ushort StreamMinReqSize; - /// Word 96 Streaming transfer time in DMA - public ushort StreamTransferTimeDMA; - /// Word 97 Streaming access latency in DMA and PIO - public ushort StreamAccessLatency; - /// Words 98 to 99 Streaming performance granularity - public uint StreamPerformanceGranularity; - - /// Words 100 to 103 48-bit LBA addressable sectors - public ulong LBA48Sectors; - - /// Word 104 Streaming transfer time in PIO - public ushort StreamTransferTimePIO; - - /// Word 105 Maximum number of 512-byte block per DATA SET MANAGEMENT command - public ushort DataSetMgmtSize; - - /// - /// Word 106 Bit 15 should be zero Bit 14 should be one Bit 13 set indicates device has multiple logical sectors - /// per physical sector Bit 12 set indicates logical sector has more than 256 words (512 bytes) Bits 11 to 4 are - /// reserved Bits 3 to 0 indicate power of two of logical sectors per physical sector - /// - public ushort PhysLogSectorSize; - - /// Word 107 Interseek delay for ISO-7779 acoustic testing, in microseconds - public ushort InterseekDelay; - - /// Words 108 to 111 World Wide Name - public ulong WWN; - - /// Words 112 to 115 Reserved for WWN extension to 128 bit - public ulong WWNExtension; - - /// Word 116 Reserved for technical report - public ushort ReservedWord116; - - /// Words 117 to 118 Words per logical sector - public uint LogicalSectorWords; - - /// Word 119 Supported command/feature sets - public CommandSetBit4 CommandSet4; - /// Word 120 Supported command/feature sets - public CommandSetBit4 EnabledCommandSet4; - - /// Words 121 to 125 Reserved - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public ushort[] ReservedWords121; - - /// Word 126 ATAPI byte count limit - public ushort ATAPIByteCount; - - /// - /// Word 127 Removable Media Status Notification feature set support Bits 15 to 2 are reserved Bits 1 to 0 must be - /// 0 for not supported or 1 for supported. 2 and 3 are reserved. Obsoleted in ATA8-ACS - /// - public ushort RemovableStatusSet; - - /// Word 128 Security status - public SecurityStatusBit SecurityStatus; - - /// Words 129 to 159 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] - public ushort[] ReservedWords129; - - /// - /// Word 160 CFA power mode Bit 15 must be set Bit 13 indicates mode 1 is required for one or more commands Bit 12 - /// indicates mode 1 is disabled Bits 11 to 0 indicates maximum current in mA - /// - public ushort CFAPowerMode; - - /// Words 161 to 167 Reserved for CFA - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] - public ushort[] ReservedCFA; - - /// Word 168 Bits 15 to 4, reserved Bits 3 to 0, device nominal form factor - public DeviceFormFactorEnum DeviceFormFactor; - /// Word 169 DATA SET MANAGEMENT support - public DataSetMgmtBit DataSetMgmt; - /// Words 170 to 173 Additional product identifier - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] - public string AdditionalPID; - - /// Word 174 Reserved - public ushort ReservedWord174; - /// Word 175 Reserved - public ushort ReservedWord175; - - /// Words 176 to 195 Current media serial number - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] - public string MediaSerial; - /// Words 196 to 205 Current media manufacturer - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] - public string MediaManufacturer; - - /// Word 206 SCT Command Transport features - public SCTCommandTransportBit SCTCommandTransport; - - /// Word 207 Reserved for CE-ATA - public ushort ReservedCEATAWord207; - /// Word 208 Reserved for CE-ATA - public ushort ReservedCEATAWord208; - - /// - /// Word 209 Alignment of logical block within a larger physical block Bit 15 shall be cleared to zero Bit 14 - /// shall be set to one Bits 13 to 0 indicate logical sector offset within the first physical sector - /// - public ushort LogicalAlignment; - - /// Words 210 to 211 Write/Read/Verify sector count mode 3 only - public uint WRVSectorCountMode3; - /// Words 212 to 213 Write/Read/Verify sector count mode 2 only - public uint WRVSectorCountMode2; - - /// - /// Word 214 NV Cache capabilities Bits 15 to 12 feature set version Bits 11 to 18 power mode feature set version - /// Bits 7 to 5 reserved Bit 4 feature set enabled Bits 3 to 2 reserved Bit 1 power mode feature set enabled Bit 0 - /// power mode feature set supported - /// - public ushort NVCacheCaps; - /// Words 215 to 216 NV Cache Size in Logical BLocks - public uint NVCacheSize; - /// Word 217 Nominal media rotation rate In ACS-1 meant NV Cache read speed in MB/s - public ushort NominalRotationRate; - /// Word 218 NV Cache write speed in MB/s Reserved since ACS-2 - public ushort NVCacheWriteSpeed; - /// Word 219 bits 7 to 0 Estimated device spin up in seconds - public byte NVEstimatedSpinUp; - /// Word 219 bits 15 to 8 NV Cache reserved - public byte NVReserved; - - /// Word 220 bits 7 to 0 Write/Read/Verify feature set current mode - public byte WRVMode; - /// Word 220 bits 15 to 8 Reserved - public byte WRVReserved; - - /// Word 221 Reserved - public ushort ReservedWord221; - - /// - /// Word 222 Transport major revision number Bits 15 to 12 indicate transport type. 0 parallel, 1 serial, 0xE - /// PCIe. Bits 11 to 0 indicate revision - /// - public ushort TransportMajorVersion; - /// Word 223 Transport minor revision number - public ushort TransportMinorVersion; - - /// Words 224 to 229 Reserved for CE-ATA - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public ushort[] ReservedCEATA224; - - /// Words 230 to 233 48-bit LBA if Word 69 bit 3 is set - public ulong ExtendedUserSectors; - - /// Word 234 Minimum number of 512 byte units per DOWNLOAD MICROCODE mode 3 - public ushort MinDownloadMicroMode3; - /// Word 235 Maximum number of 512 byte units per DOWNLOAD MICROCODE mode 3 - public ushort MaxDownloadMicroMode3; - - /// Words 236 to 254 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] - public ushort[] ReservedWords; - - /// Word 255 bits 7 to 0 Should be 0xA5 - public byte Signature; - /// Word 255 bits 15 to 8 Checksum - public byte Checksum; - } - - /// Decodes a raw IDENTIFY DEVICE response - /// Raw IDENTIFY DEVICE response - /// Decoded IDENTIFY DEVICE - public static IdentifyDevice? Decode(byte[] IdentifyDeviceResponse) - { - if(IdentifyDeviceResponse == null) - return null; - - if(IdentifyDeviceResponse.Length != 512) - { - AaruConsole.DebugWriteLine("ATA/ATAPI IDENTIFY decoder", - "IDENTIFY response is different than 512 bytes, not decoding."); - - return null; - } - - IdentifyDevice ATAID = Marshal.ByteArrayToStructureLittleEndian(IdentifyDeviceResponse); - - ATAID.WWN = DescrambleWWN(ATAID.WWN); - ATAID.WWNExtension = DescrambleWWN(ATAID.WWNExtension); - - ATAID.SerialNumber = DescrambleATAString(IdentifyDeviceResponse, 10 * 2, 20); - ATAID.FirmwareRevision = DescrambleATAString(IdentifyDeviceResponse, 23 * 2, 8); - ATAID.Model = DescrambleATAString(IdentifyDeviceResponse, 27 * 2, 40); - ATAID.AdditionalPID = DescrambleATAString(IdentifyDeviceResponse, 170 * 2, 8); - ATAID.MediaSerial = DescrambleATAString(IdentifyDeviceResponse, 176 * 2, 40); - ATAID.MediaManufacturer = DescrambleATAString(IdentifyDeviceResponse, 196 * 2, 20); - - return ATAID; - } - - /// Encodes a raw IDENTIFY DEVICE response - /// Decoded IDENTIFY DEVICE - /// Raw IDENTIFY DEVICE response - public static byte[] Encode(IdentifyDevice? identify) - { - if(identify is null) - return null; - - IdentifyDevice ataId = identify.Value; - - ataId.WWN = DescrambleWWN(ataId.WWN); - ataId.WWNExtension = DescrambleWWN(ataId.WWNExtension); - - byte[] buf = new byte[512]; - IntPtr 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); - - byte[] str = ScrambleATAString(ataId.SerialNumber, 20); - Array.Copy(str, 0, buf, 10 * 2, 20); - str = ScrambleATAString(ataId.FirmwareRevision, 8); - Array.Copy(str, 0, buf, 23 * 2, 8); - str = ScrambleATAString(ataId.Model, 40); - Array.Copy(str, 0, buf, 27 * 2, 40); - str = ScrambleATAString(ataId.AdditionalPID, 8); - Array.Copy(str, 0, buf, 170 * 2, 8); - str = ScrambleATAString(ataId.MediaSerial, 40); - Array.Copy(str, 0, buf, 176 * 2, 40); - str = ScrambleATAString(ataId.MediaManufacturer, 20); - Array.Copy(str, 0, buf, 196 * 2, 20); + for(int i = 0; i < length; i++) + buf[i] = 0x20; + if(str is null) return buf; - } - static ulong DescrambleWWN(ulong WWN) + byte[] bytes = Encoding.ASCII.GetBytes(str); + + if(bytes.Length % 2 != 0) { - byte[] qwb = BitConverter.GetBytes(WWN); - byte[] qword = new byte[8]; - - qword[7] = qwb[1]; - qword[6] = qwb[0]; - qword[5] = qwb[3]; - qword[4] = qwb[2]; - qword[3] = qwb[5]; - qword[2] = qwb[4]; - qword[1] = qwb[7]; - qword[0] = qwb[6]; - - return BitConverter.ToUInt64(qword, 0); + byte[] tmp = new byte[bytes.Length + 1]; + tmp[^1] = 0x20; + Array.Copy(bytes, 0, tmp, 0, bytes.Length); + bytes = tmp; } - static string DescrambleATAString(IList buffer, int offset, int length) + for(int i = 0; i < bytes.Length; i += 2) { - byte[] outbuf = buffer[offset + length - 1] != 0x00 ? new byte[length + 1] : new byte[length]; - - for(int i = 0; i < length; i += 2) - { - outbuf[i] = buffer[offset + i + 1]; - outbuf[i + 1] = buffer[offset + i]; - } - - string outStr = StringHandlers.CToString(outbuf); - - return outStr.Trim(); + buf[i] = bytes[i + 1]; + buf[i + 1] = bytes[i]; } - static byte[] ScrambleATAString(string str, int length) - { - byte[] buf = new byte[length]; - - for(int i = 0; i < length; i++) - buf[i] = 0x20; - - if(str is null) - return buf; - - byte[] bytes = Encoding.ASCII.GetBytes(str); - - if(bytes.Length % 2 != 0) - { - byte[] tmp = new byte[bytes.Length + 1]; - tmp[^1] = 0x20; - Array.Copy(bytes, 0, tmp, 0, bytes.Length); - bytes = tmp; - } - - for(int i = 0; i < bytes.Length; i += 2) - { - buf[i] = bytes[i + 1]; - buf[i + 1] = bytes[i]; - } - - return buf; - } + return buf; } } \ No newline at end of file diff --git a/Structs/Devices/SCSI/Enums.cs b/Structs/Devices/SCSI/Enums.cs index 40dae7f65..55ab2e1a5 100644 --- a/Structs/Devices/SCSI/Enums.cs +++ b/Structs/Devices/SCSI/Enums.cs @@ -32,214 +32,213 @@ using System.Diagnostics.CodeAnalysis; -namespace Aaru.CommonTypes.Structs.Devices.SCSI +namespace Aaru.CommonTypes.Structs.Devices.SCSI; + +/// List of known SCSI peripheral qualifiers +public enum PeripheralQualifiers : byte { - /// List of known SCSI peripheral qualifiers - public enum PeripheralQualifiers : byte - { - /// Peripheral qualifier: Device is connected and supported - Supported = 0x00, - /// Peripheral qualifier: Device is supported but not connected - Unconnected = 0x01, - /// Peripheral qualifier: Reserved value - Reserved = 0x02, - /// Peripheral qualifier: Device is connected but unsupported - Unsupported = 0x03, - /// Peripheral qualifier: Vendor values: 0x04, 0x05, 0x06 and 0x07 - VendorMask = 0x04 - } + /// Peripheral qualifier: Device is connected and supported + Supported = 0x00, + /// Peripheral qualifier: Device is supported but not connected + Unconnected = 0x01, + /// Peripheral qualifier: Reserved value + Reserved = 0x02, + /// Peripheral qualifier: Device is connected but unsupported + Unsupported = 0x03, + /// Peripheral qualifier: Vendor values: 0x04, 0x05, 0x06 and 0x07 + VendorMask = 0x04 +} - /// List of known peripheral device types - [SuppressMessage("ReSharper", "InconsistentNaming")] - public enum PeripheralDeviceTypes : byte - { - /// Direct-access device - DirectAccess = 0x00, - /// Sequential-access device - SequentialAccess = 0x01, - /// Printer device - PrinterDevice = 0x02, - /// Processor device - ProcessorDevice = 0x03, - /// Write-once device - WriteOnceDevice = 0x04, - /// CD-ROM/DVD/etc device - MultiMediaDevice = 0x05, - /// Scanner device - ScannerDevice = 0x06, - /// Optical memory device - OpticalDevice = 0x07, - /// Medium change device - MediumChangerDevice = 0x08, - /// Communications device - CommsDevice = 0x09, - /// Graphics arts pre-press device (defined in ASC IT8) - PrePressDevice1 = 0x0A, - /// Graphics arts pre-press device (defined in ASC IT8) - PrePressDevice2 = 0x0B, - /// Array controller device - ArrayControllerDevice = 0x0C, - /// Enclosure services device - EnclosureServiceDevice = 0x0D, - /// Simplified direct-access device - SimplifiedDevice = 0x0E, - /// Optical card reader/writer device - OCRWDevice = 0x0F, - /// Bridging Expanders - BridgingExpander = 0x10, - /// Object-based Storage Device - ObjectDevice = 0x11, - /// Automation/Drive Interface - ADCDevice = 0x12, - /// Security Manager Device - SCSISecurityManagerDevice = 0x13, - /// Host managed zoned block device - SCSIZonedBlockDevice = 0x14, - /// Well known logical unit - WellKnownDevice = 0x1E, - /// Unknown or no device type - UnknownDevice = 0x1F - } +/// List of known peripheral device types +[SuppressMessage("ReSharper", "InconsistentNaming")] +public enum PeripheralDeviceTypes : byte +{ + /// Direct-access device + DirectAccess = 0x00, + /// Sequential-access device + SequentialAccess = 0x01, + /// Printer device + PrinterDevice = 0x02, + /// Processor device + ProcessorDevice = 0x03, + /// Write-once device + WriteOnceDevice = 0x04, + /// CD-ROM/DVD/etc device + MultiMediaDevice = 0x05, + /// Scanner device + ScannerDevice = 0x06, + /// Optical memory device + OpticalDevice = 0x07, + /// Medium change device + MediumChangerDevice = 0x08, + /// Communications device + CommsDevice = 0x09, + /// Graphics arts pre-press device (defined in ASC IT8) + PrePressDevice1 = 0x0A, + /// Graphics arts pre-press device (defined in ASC IT8) + PrePressDevice2 = 0x0B, + /// Array controller device + ArrayControllerDevice = 0x0C, + /// Enclosure services device + EnclosureServiceDevice = 0x0D, + /// Simplified direct-access device + SimplifiedDevice = 0x0E, + /// Optical card reader/writer device + OCRWDevice = 0x0F, + /// Bridging Expanders + BridgingExpander = 0x10, + /// Object-based Storage Device + ObjectDevice = 0x11, + /// Automation/Drive Interface + ADCDevice = 0x12, + /// Security Manager Device + SCSISecurityManagerDevice = 0x13, + /// Host managed zoned block device + SCSIZonedBlockDevice = 0x14, + /// Well known logical unit + WellKnownDevice = 0x1E, + /// Unknown or no device type + UnknownDevice = 0x1F +} - /// List of known ANSI SCSI standards - [SuppressMessage("ReSharper", "InconsistentNaming")] - public enum ANSIVersions : byte - { - /// Device does not claim conformance to any ANSI version - ANSINoVersion = 0x00, - /// Device complies with ANSI X3.131:1986 - ANSI1986Version = 0x01, - /// Device complies with ANSI X3.131:1994 - ANSI1994Version = 0x02, - /// Device complies with ANSI X3.301:1997 - ANSI1997Version = 0x03, - /// Device complies with ANSI X3.351:2001 - ANSI2001Version = 0x04, - /// Device complies with ANSI X3.408:2005. - ANSI2005Version = 0x05, - /// Device complies with SPC-4 - ANSI2008Version = 0x06 - } +/// List of known ANSI SCSI standards +[SuppressMessage("ReSharper", "InconsistentNaming")] +public enum ANSIVersions : byte +{ + /// Device does not claim conformance to any ANSI version + ANSINoVersion = 0x00, + /// Device complies with ANSI X3.131:1986 + ANSI1986Version = 0x01, + /// Device complies with ANSI X3.131:1994 + ANSI1994Version = 0x02, + /// Device complies with ANSI X3.301:1997 + ANSI1997Version = 0x03, + /// Device complies with ANSI X3.351:2001 + ANSI2001Version = 0x04, + /// Device complies with ANSI X3.408:2005. + ANSI2005Version = 0x05, + /// Device complies with SPC-4 + ANSI2008Version = 0x06 +} - /// List of known ECMA SCSI standards - [SuppressMessage("ReSharper", "InconsistentNaming")] - public enum ECMAVersions : byte - { - /// Device does not claim conformance to any ECMA version - ECMANoVersion = 0x00, - /// Device complies with a ECMA-111 standard - ECMA111 = 0x01 - } +/// List of known ECMA SCSI standards +[SuppressMessage("ReSharper", "InconsistentNaming")] +public enum ECMAVersions : byte +{ + /// Device does not claim conformance to any ECMA version + ECMANoVersion = 0x00, + /// Device complies with a ECMA-111 standard + ECMA111 = 0x01 +} - /// List of known ISO SCSI standards - [SuppressMessage("ReSharper", "InconsistentNaming")] - public enum ISOVersions : byte - { - /// Device does not claim conformance to any ISO/IEC version - ISONoVersion = 0x00, - /// Device complies with ISO/IEC 9316:1995 - ISO1995Version = 0x02 - } +/// List of known ISO SCSI standards +[SuppressMessage("ReSharper", "InconsistentNaming")] +public enum ISOVersions : byte +{ + /// Device does not claim conformance to any ISO/IEC version + ISONoVersion = 0x00, + /// Device complies with ISO/IEC 9316:1995 + ISO1995Version = 0x02 +} - /// List of known SCSI Parallel Interface clocking types - [SuppressMessage("ReSharper", "InconsistentNaming")] - public enum SPIClocking : byte - { - /// Supports only ST - ST = 0x00, - /// Supports only DT - DT = 0x01, - /// Reserved value - Reserved = 0x02, - /// Supports ST and DT - STandDT = 0x03 - } +/// List of known SCSI Parallel Interface clocking types +[SuppressMessage("ReSharper", "InconsistentNaming")] +public enum SPIClocking : byte +{ + /// Supports only ST + ST = 0x00, + /// Supports only DT + DT = 0x01, + /// Reserved value + Reserved = 0x02, + /// Supports ST and DT + STandDT = 0x03 +} - /// List of known TGPS values - [SuppressMessage("ReSharper", "InconsistentNaming")] - public enum TGPSValues : byte - { - /// Asymmetrical access not supported - NotSupported = 0x00, - /// Only implicit asymmetrical access is supported - OnlyImplicit = 0x01, - /// Only explicit asymmetrical access is supported - OnlyExplicit = 0x02, - /// Both implicit and explicit asymmetrical access are supported - Both = 0x03 - } +/// List of known TGPS values +[SuppressMessage("ReSharper", "InconsistentNaming")] +public enum TGPSValues : byte +{ + /// Asymmetrical access not supported + NotSupported = 0x00, + /// Only implicit asymmetrical access is supported + OnlyImplicit = 0x01, + /// Only explicit asymmetrical access is supported + OnlyExplicit = 0x02, + /// Both implicit and explicit asymmetrical access are supported + Both = 0x03 +} - /// List of known SCSI protocols - [SuppressMessage("ReSharper", "InconsistentNaming")] - public enum ProtocolIdentifiers : byte - { - /// Fibre Channel - FibreChannel = 0, - /// Parallel SCSI - SCSI = 1, - /// SSA - SSA = 2, - /// IEEE-1394 - Firewire = 3, - /// SCSI Remote Direct Memory Access Protocol - RDMAP = 4, - /// Internet SCSI - iSCSI = 5, - /// Serial SCSI - SAS = 6, - /// Automation/Drive Interface Transport Protocol - ADT = 7, - /// AT Attachment Interface (ATA/ATAPI) - ATA = 8, - /// USB Attached SCSI - UAS = 9, - /// SCSI over PCI Express - SCSIe = 10, - /// PCI Express - PCIe = 11, - /// No specific protocol - NoProtocol = 15 - } +/// List of known SCSI protocols +[SuppressMessage("ReSharper", "InconsistentNaming")] +public enum ProtocolIdentifiers : byte +{ + /// Fibre Channel + FibreChannel = 0, + /// Parallel SCSI + SCSI = 1, + /// SSA + SSA = 2, + /// IEEE-1394 + Firewire = 3, + /// SCSI Remote Direct Memory Access Protocol + RDMAP = 4, + /// Internet SCSI + iSCSI = 5, + /// Serial SCSI + SAS = 6, + /// Automation/Drive Interface Transport Protocol + ADT = 7, + /// AT Attachment Interface (ATA/ATAPI) + ATA = 8, + /// USB Attached SCSI + UAS = 9, + /// SCSI over PCI Express + SCSIe = 10, + /// PCI Express + PCIe = 11, + /// No specific protocol + NoProtocol = 15 +} - /// List of known SCSI definitions - [SuppressMessage("ReSharper", "InconsistentNaming")] - public enum ScsiDefinitions : byte - { - /// Unknown - Current = 0, - /// SCSI-1 - SCSI1 = 1, - /// Unknown - CCS = 2, - /// SCSI-2 - SCSI2 = 3, - /// SCSI-3 - SCSI3 = 4 - } +/// List of known SCSI definitions +[SuppressMessage("ReSharper", "InconsistentNaming")] +public enum ScsiDefinitions : byte +{ + /// Unknown + Current = 0, + /// SCSI-1 + SCSI1 = 1, + /// Unknown + CCS = 2, + /// SCSI-2 + SCSI2 = 3, + /// SCSI-3 + SCSI3 = 4 +} - /// List of known SCSI physical interfaces - [SuppressMessage("ReSharper", "InconsistentNaming")] - public enum PhysicalInterfaces : uint - { - /// Unspecified physical interface - Unspecified = 0, - /// SCSI - SCSI = 1, - /// ATAPI - ATAPI = 2, - /// IEEE-1394/1995 - IEEE1394 = 3, - /// IEEE-1394A - IEEE1394A = 4, - /// Fibre Channel - FC = 5, - /// IEEE-1394B - IEEE1394B = 6, - /// Serial ATAPI - SerialATAPI = 7, - /// USB - USB = 8, - /// Vendor unique - Vendor = 0xFFFF - } +/// List of known SCSI physical interfaces +[SuppressMessage("ReSharper", "InconsistentNaming")] +public enum PhysicalInterfaces : uint +{ + /// Unspecified physical interface + Unspecified = 0, + /// SCSI + SCSI = 1, + /// ATAPI + ATAPI = 2, + /// IEEE-1394/1995 + IEEE1394 = 3, + /// IEEE-1394A + IEEE1394A = 4, + /// Fibre Channel + FC = 5, + /// IEEE-1394B + IEEE1394B = 6, + /// Serial ATAPI + SerialATAPI = 7, + /// USB + USB = 8, + /// Vendor unique + Vendor = 0xFFFF } \ No newline at end of file diff --git a/Structs/Devices/SCSI/Inquiry.cs b/Structs/Devices/SCSI/Inquiry.cs index 27387c304..2d6199c0e 100644 --- a/Structs/Devices/SCSI/Inquiry.cs +++ b/Structs/Devices/SCSI/Inquiry.cs @@ -41,748 +41,747 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using Aaru.Console; -namespace Aaru.CommonTypes.Structs.Devices.SCSI +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 +/// +[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"), + SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] +public struct Inquiry { - /// - /// 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 - /// - [SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"), - SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] - public struct Inquiry + /// Peripheral qualifier Byte 0, bits 7 to 5 + public byte PeripheralQualifier; + /// Peripheral device type Byte 0, bits 4 to 0 + public byte PeripheralDeviceType; + /// Removable device Byte 1, bit 7 + public bool RMB; + /// SCSI-1 vendor-specific qualification codes Byte 1, bits 6 to 0 + public byte DeviceTypeModifier; + /// ISO/IEC SCSI Standard Version Byte 2, bits 7 to 6, mask = 0xC0, >> 6 + public byte ISOVersion; + /// ECMA SCSI Standard Version Byte 2, bits 5 to 3, mask = 0x38, >> 3 + public byte ECMAVersion; + /// ANSI SCSI Standard Version Byte 2, bits 2 to 0, mask = 0x07 + public byte ANSIVersion; + /// Asynchronous Event Reporting Capability supported Byte 3, bit 7 + public bool AERC; + /// Device supports TERMINATE TASK command Byte 3, bit 6 + public bool TrmTsk; + /// Supports setting Normal ACA Byte 3, bit 5 + public bool NormACA; + /// Supports LUN hierarchical addressing Byte 3, bit 4 + public bool HiSup; + /// Responde data format Byte 3, bit 3 to 0 + public byte ResponseDataFormat; + /// Lenght of total INQUIRY response minus 4 Byte 4 + public byte AdditionalLength; + /// Device contains an embedded storage array controller Byte 5, bit 7 + public bool SCCS; + /// Device contains an Access Control Coordinator Byte 5, bit 6 + public bool ACC; + /// Supports asymetrical logical unit access Byte 5, bits 5 to 4 + public byte TPGS; + /// Supports third-party copy commands Byte 5, bit 3 + public bool ThreePC; + /// Reserved Byte 5, bits 2 to 1 + public byte Reserved2; + /// Supports protection information Byte 5, bit 0 + public bool Protect; + /// Supports basic queueing Byte 6, bit 7 + public bool BQue; + /// Device contains an embedded enclosure services component Byte 6, bit 6 + public bool EncServ; + /// Vendor-specific Byte 6, bit 5 + public bool VS1; + /// Multi-port device Byte 6, bit 4 + public bool MultiP; + /// Device contains or is attached to a medium changer Byte 6, bit 3 + public bool MChngr; + /// Device supports request and acknowledge handshakes Byte 6, bit 2 + public bool ACKREQQ; + /// Supports 32-bit wide SCSI addresses Byte 6, bit 1 + public bool Addr32; + /// Supports 16-bit wide SCSI addresses Byte 6, bit 0 + public bool Addr16; + /// Device supports relative addressing Byte 7, bit 7 + public bool RelAddr; + /// Supports 32-bit wide data transfers Byte 7, bit 6 + public bool WBus32; + /// Supports 16-bit wide data transfers Byte 7, bit 5 + public bool WBus16; + /// Supports synchronous data transfer Byte 7, bit 4 + public bool Sync; + /// Supports linked commands Byte 7, bit 3 + public bool Linked; + /// Supports CONTINUE TASK and TARGET TRANSFER DISABLE commands Byte 7, bit 2 + public bool TranDis; + /// Supports TCQ queue Byte 7, bit 1 + public bool CmdQue; + /// Indicates that the devices responds to RESET with soft reset Byte 7, bit 0 + public bool SftRe; + /// Vendor identification Bytes 8 to 15 + public byte[] VendorIdentification; + /// Product identification Bytes 16 to 31 + public byte[] ProductIdentification; + /// Product revision level Bytes 32 to 35 + public byte[] ProductRevisionLevel; + /// Vendor-specific data Bytes 36 to 55 + public byte[] VendorSpecific; + /// Byte 56, bits 7 to 4 + public byte Reserved3; + /// Supported SPI clocking Byte 56, bits 3 to 2 + public byte Clocking; + /// Device supports Quick Arbitration and Selection Byte 56, bit 1 + public bool QAS; + /// Supports information unit transfers Byte 56, bit 0 + public bool IUS; + /// Reserved Byte 57 + public byte Reserved4; + /// Array of version descriptors Bytes 58 to 73 + public ushort[] VersionDescriptors; + /// Reserved Bytes 74 to 95 + public byte[] Reserved5; + /// Reserved Bytes 96 to end + public byte[] VendorSpecific2; + + // Per DLT4000/DLT4500/DLT4700 Cartridge Tape Subsystem Product Manual + + #region Quantum vendor unique inquiry data structure + /// Means that the INQUIRY response contains 56 bytes or more, so this data has been filled + public bool QuantumPresent; + /// The product family. Byte 36, bits 7 to 5 + public byte Qt_ProductFamily; + /// The released firmware. Byte 36, bits 4 to 0 + public byte Qt_ReleasedFirmware; + /// The firmware major version. Byte 37 + public byte Qt_FirmwareMajorVersion; + /// The firmware minor version. Byte 38 + public byte Qt_FirmwareMinorVersion; + /// The EEPROM format major version. Byte 39 + public byte Qt_EEPROMFormatMajorVersion; + /// The EEPROM format minor version. Byte 40 + public byte Qt_EEPROMFormatMinorVersion; + /// The firmware personality. Byte 41 + public byte Qt_FirmwarePersonality; + /// The firmware sub personality. Byte 42 + public byte Qt_FirmwareSubPersonality; + /// The tape directory format version. Byte 43 + public byte Qt_TapeDirectoryFormatVersion; + /// The controller hardware version. Byte 44 + public byte Qt_ControllerHardwareVersion; + /// The drive EEPROM version. Byte 45 + public byte Qt_DriveEEPROMVersion; + /// The drive hardware version. Byte 46 + public byte Qt_DriveHardwareVersion; + /// The media loader firmware version. Byte 47 + public byte Qt_MediaLoaderFirmwareVersion; + /// The media loader hardware version. Byte 48 + public byte Qt_MediaLoaderHardwareVersion; + /// The media loader mechanical version. Byte 49 + public byte Qt_MediaLoaderMechanicalVersion; + /// Is a media loader present? Byte 50 + public bool Qt_MediaLoaderPresent; + /// Is a library present? Byte 51 + public bool Qt_LibraryPresent; + /// The module revision. Bytes 52 to 55 + public byte[] Qt_ModuleRevision; + #endregion Quantum vendor unique inquiry data structure + + #region IBM vendor unique inquiry data structure + /// Means that the INQUIRY response contains 56 bytes or more, so this data has been filled + public bool IBMPresent; + /// Drive is not capable of automation Byte 36 bit 0 + public bool IBM_AutDis; + /// If not zero, limit in MB/s = Max * (this / 256) Byte 37 + public byte IBM_PerformanceLimit; + /// Byte 41 + public byte IBM_OEMSpecific; + #endregion IBM vendor unique inquiry data structure + + #region HP vendor unique inquiry data structure + /// Means that the INQUIRY response contains 49 bytes or more, so this data has been filled + public bool HPPresent; + /// WORM version Byte 40 bits 7 to 1 + public byte HP_WORMVersion; + /// WORM supported Byte 40 bit 0 + public bool HP_WORM; + /// Bytes 43 to 48 + public byte[] HP_OBDR; + #endregion HP vendor unique inquiry data structure + + #region Seagate vendor unique inquiry data structure + /// Means that bytes 36 to 43 are filled + public bool SeagatePresent; + /// Drive Serial Number Bytes 36 to 43 + public byte[] Seagate_DriveSerialNumber; + /// Means that bytes 96 to 143 are filled + public bool Seagate2Present; + /// Contains Seagate copyright notice Bytes 96 to 143 + public byte[] Seagate_Copyright; + /// Means that bytes 144 to 147 are filled + public bool Seagate3Present; + /// Reserved Seagate field Bytes 144 to 147 + public byte[] Seagate_ServoPROMPartNo; + #endregion Seagate vendor unique inquiry data structure + + #region Kreon vendor unique inquiry data structure + /// Means that firmware is Kreon + public bool KreonPresent; + /// Kreon identifier Bytes 36 to 40 + public byte[] KreonIdentifier; + /// Kreon just a 0x20 Bytes 41 + public byte KreonSpace; + /// Kreon version string Bytes 42 to 46 + public byte[] KreonVersion; + #endregion Kreon vendor unique inquiry data structure + + #region Sony Hi-MD data + /// Set if Hi-MD signature is present + public bool IsHiMD; + /// Hi-MD signature, bytes 36 to 44 + public byte[] HiMDSignature; + /// Unknown data, bytes 44 to 55 + public byte[] HiMDSpecific; + #endregion Sony Hi-MD data + + static readonly byte[] HiMDSignatureContents = { - /// Peripheral qualifier Byte 0, bits 7 to 5 - public byte PeripheralQualifier; - /// Peripheral device type Byte 0, bits 4 to 0 - public byte PeripheralDeviceType; - /// Removable device Byte 1, bit 7 - public bool RMB; - /// SCSI-1 vendor-specific qualification codes Byte 1, bits 6 to 0 - public byte DeviceTypeModifier; - /// ISO/IEC SCSI Standard Version Byte 2, bits 7 to 6, mask = 0xC0, >> 6 - public byte ISOVersion; - /// ECMA SCSI Standard Version Byte 2, bits 5 to 3, mask = 0x38, >> 3 - public byte ECMAVersion; - /// ANSI SCSI Standard Version Byte 2, bits 2 to 0, mask = 0x07 - public byte ANSIVersion; - /// Asynchronous Event Reporting Capability supported Byte 3, bit 7 - public bool AERC; - /// Device supports TERMINATE TASK command Byte 3, bit 6 - public bool TrmTsk; - /// Supports setting Normal ACA Byte 3, bit 5 - public bool NormACA; - /// Supports LUN hierarchical addressing Byte 3, bit 4 - public bool HiSup; - /// Responde data format Byte 3, bit 3 to 0 - public byte ResponseDataFormat; - /// Lenght of total INQUIRY response minus 4 Byte 4 - public byte AdditionalLength; - /// Device contains an embedded storage array controller Byte 5, bit 7 - public bool SCCS; - /// Device contains an Access Control Coordinator Byte 5, bit 6 - public bool ACC; - /// Supports asymetrical logical unit access Byte 5, bits 5 to 4 - public byte TPGS; - /// Supports third-party copy commands Byte 5, bit 3 - public bool ThreePC; - /// Reserved Byte 5, bits 2 to 1 - public byte Reserved2; - /// Supports protection information Byte 5, bit 0 - public bool Protect; - /// Supports basic queueing Byte 6, bit 7 - public bool BQue; - /// Device contains an embedded enclosure services component Byte 6, bit 6 - public bool EncServ; - /// Vendor-specific Byte 6, bit 5 - public bool VS1; - /// Multi-port device Byte 6, bit 4 - public bool MultiP; - /// Device contains or is attached to a medium changer Byte 6, bit 3 - public bool MChngr; - /// Device supports request and acknowledge handshakes Byte 6, bit 2 - public bool ACKREQQ; - /// Supports 32-bit wide SCSI addresses Byte 6, bit 1 - public bool Addr32; - /// Supports 16-bit wide SCSI addresses Byte 6, bit 0 - public bool Addr16; - /// Device supports relative addressing Byte 7, bit 7 - public bool RelAddr; - /// Supports 32-bit wide data transfers Byte 7, bit 6 - public bool WBus32; - /// Supports 16-bit wide data transfers Byte 7, bit 5 - public bool WBus16; - /// Supports synchronous data transfer Byte 7, bit 4 - public bool Sync; - /// Supports linked commands Byte 7, bit 3 - public bool Linked; - /// Supports CONTINUE TASK and TARGET TRANSFER DISABLE commands Byte 7, bit 2 - public bool TranDis; - /// Supports TCQ queue Byte 7, bit 1 - public bool CmdQue; - /// Indicates that the devices responds to RESET with soft reset Byte 7, bit 0 - public bool SftRe; - /// Vendor identification Bytes 8 to 15 - public byte[] VendorIdentification; - /// Product identification Bytes 16 to 31 - public byte[] ProductIdentification; - /// Product revision level Bytes 32 to 35 - public byte[] ProductRevisionLevel; - /// Vendor-specific data Bytes 36 to 55 - public byte[] VendorSpecific; - /// Byte 56, bits 7 to 4 - public byte Reserved3; - /// Supported SPI clocking Byte 56, bits 3 to 2 - public byte Clocking; - /// Device supports Quick Arbitration and Selection Byte 56, bit 1 - public bool QAS; - /// Supports information unit transfers Byte 56, bit 0 - public bool IUS; - /// Reserved Byte 57 - public byte Reserved4; - /// Array of version descriptors Bytes 58 to 73 - public ushort[] VersionDescriptors; - /// Reserved Bytes 74 to 95 - public byte[] Reserved5; - /// Reserved Bytes 96 to end - public byte[] VendorSpecific2; + 0x48, 0x69, 0x2D, 0x4D, 0x44, 0x20, 0x20, 0x20 + }; - // Per DLT4000/DLT4500/DLT4700 Cartridge Tape Subsystem Product Manual + /// Decodes a SCSI INQUIRY response + /// INQUIRY raw response data + /// Decoded SCSI INQUIRY + #region Public methods + public static Inquiry? Decode(byte[] SCSIInquiryResponse) + { + if(SCSIInquiryResponse == null) + return null; - #region Quantum vendor unique inquiry data structure - /// Means that the INQUIRY response contains 56 bytes or more, so this data has been filled - public bool QuantumPresent; - /// The product family. Byte 36, bits 7 to 5 - public byte Qt_ProductFamily; - /// The released firmware. Byte 36, bits 4 to 0 - public byte Qt_ReleasedFirmware; - /// The firmware major version. Byte 37 - public byte Qt_FirmwareMajorVersion; - /// The firmware minor version. Byte 38 - public byte Qt_FirmwareMinorVersion; - /// The EEPROM format major version. Byte 39 - public byte Qt_EEPROMFormatMajorVersion; - /// The EEPROM format minor version. Byte 40 - public byte Qt_EEPROMFormatMinorVersion; - /// The firmware personality. Byte 41 - public byte Qt_FirmwarePersonality; - /// The firmware sub personality. Byte 42 - public byte Qt_FirmwareSubPersonality; - /// The tape directory format version. Byte 43 - public byte Qt_TapeDirectoryFormatVersion; - /// The controller hardware version. Byte 44 - public byte Qt_ControllerHardwareVersion; - /// The drive EEPROM version. Byte 45 - public byte Qt_DriveEEPROMVersion; - /// The drive hardware version. Byte 46 - public byte Qt_DriveHardwareVersion; - /// The media loader firmware version. Byte 47 - public byte Qt_MediaLoaderFirmwareVersion; - /// The media loader hardware version. Byte 48 - public byte Qt_MediaLoaderHardwareVersion; - /// The media loader mechanical version. Byte 49 - public byte Qt_MediaLoaderMechanicalVersion; - /// Is a media loader present? Byte 50 - public bool Qt_MediaLoaderPresent; - /// Is a library present? Byte 51 - public bool Qt_LibraryPresent; - /// The module revision. Bytes 52 to 55 - public byte[] Qt_ModuleRevision; - #endregion Quantum vendor unique inquiry data structure - - #region IBM vendor unique inquiry data structure - /// Means that the INQUIRY response contains 56 bytes or more, so this data has been filled - public bool IBMPresent; - /// Drive is not capable of automation Byte 36 bit 0 - public bool IBM_AutDis; - /// If not zero, limit in MB/s = Max * (this / 256) Byte 37 - public byte IBM_PerformanceLimit; - /// Byte 41 - public byte IBM_OEMSpecific; - #endregion IBM vendor unique inquiry data structure - - #region HP vendor unique inquiry data structure - /// Means that the INQUIRY response contains 49 bytes or more, so this data has been filled - public bool HPPresent; - /// WORM version Byte 40 bits 7 to 1 - public byte HP_WORMVersion; - /// WORM supported Byte 40 bit 0 - public bool HP_WORM; - /// Bytes 43 to 48 - public byte[] HP_OBDR; - #endregion HP vendor unique inquiry data structure - - #region Seagate vendor unique inquiry data structure - /// Means that bytes 36 to 43 are filled - public bool SeagatePresent; - /// Drive Serial Number Bytes 36 to 43 - public byte[] Seagate_DriveSerialNumber; - /// Means that bytes 96 to 143 are filled - public bool Seagate2Present; - /// Contains Seagate copyright notice Bytes 96 to 143 - public byte[] Seagate_Copyright; - /// Means that bytes 144 to 147 are filled - public bool Seagate3Present; - /// Reserved Seagate field Bytes 144 to 147 - public byte[] Seagate_ServoPROMPartNo; - #endregion Seagate vendor unique inquiry data structure - - #region Kreon vendor unique inquiry data structure - /// Means that firmware is Kreon - public bool KreonPresent; - /// Kreon identifier Bytes 36 to 40 - public byte[] KreonIdentifier; - /// Kreon just a 0x20 Bytes 41 - public byte KreonSpace; - /// Kreon version string Bytes 42 to 46 - public byte[] KreonVersion; - #endregion Kreon vendor unique inquiry data structure - - #region Sony Hi-MD data - /// Set if Hi-MD signature is present - public bool IsHiMD; - /// Hi-MD signature, bytes 36 to 44 - public byte[] HiMDSignature; - /// Unknown data, bytes 44 to 55 - public byte[] HiMDSpecific; - #endregion Sony Hi-MD data - - static readonly byte[] HiMDSignatureContents = + if(SCSIInquiryResponse.Length < 36 && + SCSIInquiryResponse.Length != 5) { - 0x48, 0x69, 0x2D, 0x4D, 0x44, 0x20, 0x20, 0x20 - }; + 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); - /// Decodes a SCSI INQUIRY response - /// INQUIRY raw response data - /// Decoded SCSI INQUIRY - #region Public methods - public static Inquiry? Decode(byte[] SCSIInquiryResponse) - { - if(SCSIInquiryResponse == null) - return null; - - if(SCSIInquiryResponse.Length < 36 && - 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); - - return null; - } - - if(SCSIInquiryResponse.Length < SCSIInquiryResponse[4] + 4 && - 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); - - return null; - } - - var decoded = new Inquiry(); - - if(SCSIInquiryResponse.Length >= 1) - { - decoded.PeripheralQualifier = (byte)((SCSIInquiryResponse[0] & 0xE0) >> 5); - decoded.PeripheralDeviceType = (byte)(SCSIInquiryResponse[0] & 0x1F); - } - - if(SCSIInquiryResponse.Length >= 2) - { - decoded.RMB = Convert.ToBoolean(SCSIInquiryResponse[1] & 0x80); - decoded.DeviceTypeModifier = (byte)(SCSIInquiryResponse[1] & 0x7F); - } - - if(SCSIInquiryResponse.Length >= 3) - { - decoded.ISOVersion = (byte)((SCSIInquiryResponse[2] & 0xC0) >> 6); - decoded.ECMAVersion = (byte)((SCSIInquiryResponse[2] & 0x38) >> 3); - decoded.ANSIVersion = (byte)(SCSIInquiryResponse[2] & 0x07); - } - - if(SCSIInquiryResponse.Length >= 4) - { - decoded.AERC = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x80); - decoded.TrmTsk = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x40); - decoded.NormACA = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x20); - decoded.HiSup = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x10); - decoded.ResponseDataFormat = (byte)(SCSIInquiryResponse[3] & 0x07); - } - - if(SCSIInquiryResponse.Length >= 5) - decoded.AdditionalLength = SCSIInquiryResponse[4]; - - if(SCSIInquiryResponse.Length >= 6) - { - decoded.SCCS = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x80); - decoded.ACC = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x40); - decoded.TPGS = (byte)((SCSIInquiryResponse[5] & 0x30) >> 4); - decoded.ThreePC = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x08); - decoded.Reserved2 = (byte)((SCSIInquiryResponse[5] & 0x06) >> 1); - decoded.Protect = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x01); - } - - if(SCSIInquiryResponse.Length >= 7) - { - decoded.BQue = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x80); - decoded.EncServ = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x40); - decoded.VS1 = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x20); - decoded.MultiP = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x10); - decoded.MChngr = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x08); - decoded.ACKREQQ = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x04); - decoded.Addr32 = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x02); - decoded.Addr16 = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x01); - } - - if(SCSIInquiryResponse.Length >= 8) - { - decoded.RelAddr = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x80); - decoded.WBus32 = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x40); - decoded.WBus16 = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x20); - decoded.Sync = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x10); - decoded.Linked = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x08); - decoded.TranDis = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x04); - decoded.CmdQue = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x02); - decoded.SftRe = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x01); - } - - if(SCSIInquiryResponse.Length >= 16) - { - decoded.VendorIdentification = new byte[8]; - Array.Copy(SCSIInquiryResponse, 8, decoded.VendorIdentification, 0, 8); - } - - if(SCSIInquiryResponse.Length >= 32) - { - decoded.ProductIdentification = new byte[16]; - Array.Copy(SCSIInquiryResponse, 16, decoded.ProductIdentification, 0, 16); - } - - if(SCSIInquiryResponse.Length >= 36) - { - decoded.ProductRevisionLevel = new byte[4]; - Array.Copy(SCSIInquiryResponse, 32, decoded.ProductRevisionLevel, 0, 4); - } - - if(SCSIInquiryResponse.Length >= 44) - { - // Seagate 1 - decoded.SeagatePresent = true; - decoded.Seagate_DriveSerialNumber = new byte[8]; - Array.Copy(SCSIInquiryResponse, 36, decoded.Seagate_DriveSerialNumber, 0, 8); - - // Hi-MD - decoded.HiMDSignature = new byte[8]; - Array.Copy(SCSIInquiryResponse, 36, decoded.HiMDSignature, 0, 8); - decoded.IsHiMD = HiMDSignatureContents.SequenceEqual(decoded.HiMDSignature); - } - - if(SCSIInquiryResponse.Length >= 46) - { - // Kreon - decoded.KreonIdentifier = new byte[5]; - Array.Copy(SCSIInquiryResponse, 36, decoded.KreonIdentifier, 0, 5); - decoded.KreonSpace = SCSIInquiryResponse[41]; - decoded.KreonVersion = new byte[5]; - Array.Copy(SCSIInquiryResponse, 42, decoded.KreonVersion, 0, 5); - - if(decoded.KreonSpace == 0x20 && - decoded.KreonIdentifier.SequenceEqual(new byte[] - { - 0x4B, 0x52, 0x45, 0x4F, 0x4E - })) - decoded.KreonPresent = true; - } - - if(SCSIInquiryResponse.Length >= 49) - { - // HP - decoded.HPPresent = true; - decoded.HP_WORM |= (SCSIInquiryResponse[40] & 0x01) == 0x01; - decoded.HP_WORMVersion = (byte)((SCSIInquiryResponse[40] & 0x7F) >> 1); - decoded.HP_OBDR = new byte[6]; - Array.Copy(SCSIInquiryResponse, 43, decoded.HP_OBDR, 0, 6); - } - - if(SCSIInquiryResponse.Length >= 56) - { - if(decoded.IsHiMD) - { - decoded.HiMDSpecific = new byte[12]; - Array.Copy(SCSIInquiryResponse, 44, decoded.HiMDSpecific, 0, 12); - } - else - { - decoded.VendorSpecific = new byte[20]; - Array.Copy(SCSIInquiryResponse, 36, decoded.VendorSpecific, 0, 20); - } - - // Quantum - decoded.QuantumPresent = true; - decoded.Qt_ProductFamily = (byte)((SCSIInquiryResponse[36] & 0xF0) >> 4); - decoded.Qt_ReleasedFirmware = (byte)(SCSIInquiryResponse[36] & 0x0F); - decoded.Qt_FirmwareMajorVersion = SCSIInquiryResponse[37]; - decoded.Qt_FirmwareMinorVersion = SCSIInquiryResponse[38]; - decoded.Qt_EEPROMFormatMajorVersion = SCSIInquiryResponse[39]; - decoded.Qt_EEPROMFormatMinorVersion = SCSIInquiryResponse[40]; - decoded.Qt_FirmwarePersonality = SCSIInquiryResponse[41]; - decoded.Qt_FirmwareSubPersonality = SCSIInquiryResponse[42]; - decoded.Qt_TapeDirectoryFormatVersion = SCSIInquiryResponse[43]; - decoded.Qt_ControllerHardwareVersion = SCSIInquiryResponse[44]; - decoded.Qt_DriveEEPROMVersion = SCSIInquiryResponse[45]; - decoded.Qt_DriveHardwareVersion = SCSIInquiryResponse[46]; - decoded.Qt_MediaLoaderFirmwareVersion = SCSIInquiryResponse[47]; - decoded.Qt_MediaLoaderHardwareVersion = SCSIInquiryResponse[48]; - decoded.Qt_MediaLoaderMechanicalVersion = SCSIInquiryResponse[49]; - decoded.Qt_MediaLoaderPresent = SCSIInquiryResponse[50] > 0; - decoded.Qt_LibraryPresent = SCSIInquiryResponse[51] > 0; - decoded.Qt_ModuleRevision = new byte[4]; - Array.Copy(SCSIInquiryResponse, 52, decoded.Qt_ModuleRevision, 0, 4); - - // IBM - decoded.IBMPresent = true; - decoded.IBM_AutDis |= (SCSIInquiryResponse[36] & 0x01) == 0x01; - decoded.IBM_PerformanceLimit = SCSIInquiryResponse[37]; - decoded.IBM_OEMSpecific = SCSIInquiryResponse[41]; - } - - if(SCSIInquiryResponse.Length >= 57) - { - decoded.Reserved3 = (byte)((SCSIInquiryResponse[56] & 0xF0) >> 4); - decoded.Clocking = (byte)((SCSIInquiryResponse[56] & 0x0C) >> 2); - decoded.QAS = Convert.ToBoolean(SCSIInquiryResponse[56] & 0x02); - decoded.IUS = Convert.ToBoolean(SCSIInquiryResponse[56] & 0x01); - } - - if(SCSIInquiryResponse.Length >= 58) - decoded.Reserved4 = SCSIInquiryResponse[57]; - - if(SCSIInquiryResponse.Length >= 60) - { - int descriptorsNo; - - if(SCSIInquiryResponse.Length >= 74) - descriptorsNo = 8; - else - descriptorsNo = (SCSIInquiryResponse.Length - 58) / 2; - - decoded.VersionDescriptors = new ushort[descriptorsNo]; - - for(int i = 0; i < descriptorsNo; i++) - decoded.VersionDescriptors[i] = BitConverter.ToUInt16(SCSIInquiryResponse, 58 + (i * 2)); - } - - if(SCSIInquiryResponse.Length >= 75 && - SCSIInquiryResponse.Length < 96) - { - decoded.Reserved5 = new byte[SCSIInquiryResponse.Length - 74]; - Array.Copy(SCSIInquiryResponse, 74, decoded.Reserved5, 0, SCSIInquiryResponse.Length - 74); - } - - if(SCSIInquiryResponse.Length >= 96) - { - decoded.Reserved5 = new byte[22]; - Array.Copy(SCSIInquiryResponse, 74, decoded.Reserved5, 0, 22); - } - - if(SCSIInquiryResponse.Length > 96) - { - decoded.VendorSpecific2 = new byte[SCSIInquiryResponse.Length - 96]; - Array.Copy(SCSIInquiryResponse, 96, decoded.VendorSpecific2, 0, SCSIInquiryResponse.Length - 96); - } - - if(SCSIInquiryResponse.Length >= 144) - { - // Seagate 2 - decoded.Seagate2Present = true; - decoded.Seagate_Copyright = new byte[48]; - Array.Copy(SCSIInquiryResponse, 96, decoded.Seagate_Copyright, 0, 48); - } - - if(SCSIInquiryResponse.Length < 148) - return decoded; - - // Seagate 2 - decoded.Seagate3Present = true; - decoded.Seagate_ServoPROMPartNo = new byte[4]; - Array.Copy(SCSIInquiryResponse, 144, decoded.Seagate_ServoPROMPartNo, 0, 4); - - return decoded; + return null; } - /// Encodes a SCSI INQUIRY response - /// Decoded SCSI INQUIRY - /// Raw SCSI INQUIRY response - public static byte[] Encode(Inquiry? inq) + if(SCSIInquiryResponse.Length < SCSIInquiryResponse[4] + 4 && + SCSIInquiryResponse.Length != SCSIInquiryResponse[4]) { - if(inq is null) - return null; + 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 decoded = inq.Value; + return null; + } - byte[] buffer = new byte[512]; - byte length = 0; + var decoded = new Inquiry(); - buffer[0] = (byte)(decoded.PeripheralQualifier << 5); - buffer[0] += decoded.PeripheralDeviceType; + if(SCSIInquiryResponse.Length >= 1) + { + decoded.PeripheralQualifier = (byte)((SCSIInquiryResponse[0] & 0xE0) >> 5); + decoded.PeripheralDeviceType = (byte)(SCSIInquiryResponse[0] & 0x1F); + } - if(decoded.RMB) - buffer[1] = 0x80; + if(SCSIInquiryResponse.Length >= 2) + { + decoded.RMB = Convert.ToBoolean(SCSIInquiryResponse[1] & 0x80); + decoded.DeviceTypeModifier = (byte)(SCSIInquiryResponse[1] & 0x7F); + } - buffer[1] += decoded.DeviceTypeModifier; + if(SCSIInquiryResponse.Length >= 3) + { + decoded.ISOVersion = (byte)((SCSIInquiryResponse[2] & 0xC0) >> 6); + decoded.ECMAVersion = (byte)((SCSIInquiryResponse[2] & 0x38) >> 3); + decoded.ANSIVersion = (byte)(SCSIInquiryResponse[2] & 0x07); + } - buffer[2] = (byte)(decoded.ISOVersion << 6); - buffer[2] += (byte)(decoded.ECMAVersion << 3); - buffer[2] += decoded.ANSIVersion; + if(SCSIInquiryResponse.Length >= 4) + { + decoded.AERC = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x80); + decoded.TrmTsk = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x40); + decoded.NormACA = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x20); + decoded.HiSup = Convert.ToBoolean(SCSIInquiryResponse[3] & 0x10); + decoded.ResponseDataFormat = (byte)(SCSIInquiryResponse[3] & 0x07); + } - if(decoded.AERC) - buffer[3] = 0x80; + if(SCSIInquiryResponse.Length >= 5) + decoded.AdditionalLength = SCSIInquiryResponse[4]; - if(decoded.TrmTsk) - buffer[3] += 0x40; + if(SCSIInquiryResponse.Length >= 6) + { + decoded.SCCS = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x80); + decoded.ACC = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x40); + decoded.TPGS = (byte)((SCSIInquiryResponse[5] & 0x30) >> 4); + decoded.ThreePC = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x08); + decoded.Reserved2 = (byte)((SCSIInquiryResponse[5] & 0x06) >> 1); + decoded.Protect = Convert.ToBoolean(SCSIInquiryResponse[5] & 0x01); + } - if(decoded.NormACA) - buffer[3] += 0x20; + if(SCSIInquiryResponse.Length >= 7) + { + decoded.BQue = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x80); + decoded.EncServ = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x40); + decoded.VS1 = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x20); + decoded.MultiP = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x10); + decoded.MChngr = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x08); + decoded.ACKREQQ = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x04); + decoded.Addr32 = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x02); + decoded.Addr16 = Convert.ToBoolean(SCSIInquiryResponse[6] & 0x01); + } - if(decoded.HiSup) - buffer[3] += 0x10; + if(SCSIInquiryResponse.Length >= 8) + { + decoded.RelAddr = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x80); + decoded.WBus32 = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x40); + decoded.WBus16 = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x20); + decoded.Sync = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x10); + decoded.Linked = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x08); + decoded.TranDis = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x04); + decoded.CmdQue = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x02); + decoded.SftRe = Convert.ToBoolean(SCSIInquiryResponse[7] & 0x01); + } - buffer[3] += decoded.ResponseDataFormat; + if(SCSIInquiryResponse.Length >= 16) + { + decoded.VendorIdentification = new byte[8]; + Array.Copy(SCSIInquiryResponse, 8, decoded.VendorIdentification, 0, 8); + } - if(decoded.AdditionalLength > 0) - { - length = 5; - buffer[4] = decoded.AdditionalLength; - } + if(SCSIInquiryResponse.Length >= 32) + { + decoded.ProductIdentification = new byte[16]; + Array.Copy(SCSIInquiryResponse, 16, decoded.ProductIdentification, 0, 16); + } - if(decoded.SCCS || - decoded.ACC || - decoded.TPGS > 0 || - decoded.ThreePC || - decoded.Reserved2 > 0 || - decoded.Protect) - { - length = 6; + if(SCSIInquiryResponse.Length >= 36) + { + decoded.ProductRevisionLevel = new byte[4]; + Array.Copy(SCSIInquiryResponse, 32, decoded.ProductRevisionLevel, 0, 4); + } - if(decoded.SCCS) - buffer[5] = 0x80; + if(SCSIInquiryResponse.Length >= 44) + { + // Seagate 1 + decoded.SeagatePresent = true; + decoded.Seagate_DriveSerialNumber = new byte[8]; + Array.Copy(SCSIInquiryResponse, 36, decoded.Seagate_DriveSerialNumber, 0, 8); - if(decoded.ACC) - buffer[5] += 0x40; + // Hi-MD + decoded.HiMDSignature = new byte[8]; + Array.Copy(SCSIInquiryResponse, 36, decoded.HiMDSignature, 0, 8); + decoded.IsHiMD = HiMDSignatureContents.SequenceEqual(decoded.HiMDSignature); + } - buffer[5] += (byte)(decoded.TPGS << 4); + if(SCSIInquiryResponse.Length >= 46) + { + // Kreon + decoded.KreonIdentifier = new byte[5]; + Array.Copy(SCSIInquiryResponse, 36, decoded.KreonIdentifier, 0, 5); + decoded.KreonSpace = SCSIInquiryResponse[41]; + decoded.KreonVersion = new byte[5]; + Array.Copy(SCSIInquiryResponse, 42, decoded.KreonVersion, 0, 5); - if(decoded.ThreePC) - buffer[5] += 0x08; + if(decoded.KreonSpace == 0x20 && + decoded.KreonIdentifier.SequenceEqual(new byte[] + { + 0x4B, 0x52, 0x45, 0x4F, 0x4E + })) + decoded.KreonPresent = true; + } - buffer[5] += (byte)(decoded.Reserved2 << 1); - - if(decoded.Protect) - buffer[5] += 0x01; - } - - if(decoded.BQue || - decoded.EncServ || - decoded.VS1 || - decoded.MultiP || - decoded.MChngr || - decoded.ACKREQQ || - decoded.Addr32 || - decoded.Addr16) - { - length = 7; - - if(decoded.BQue) - buffer[6] = 0x80; - - if(decoded.EncServ) - buffer[6] += 0x40; - - if(decoded.VS1) - buffer[6] += 0x20; - - if(decoded.MultiP) - buffer[6] += 0x10; - - if(decoded.MChngr) - buffer[6] += 0x08; - - if(decoded.ACKREQQ) - buffer[6] += 0x04; - - if(decoded.Addr32) - buffer[6] += 0x02; - - if(decoded.Addr16) - buffer[6] += 0x01; - } - - if(decoded.RelAddr || - decoded.WBus32 || - decoded.WBus16 || - decoded.Sync || - decoded.Linked || - decoded.TranDis || - decoded.CmdQue || - decoded.SftRe) - - { - length = 8; - - if(decoded.RelAddr) - buffer[7] = 0x80; - - if(decoded.WBus32) - buffer[7] += 0x40; - - if(decoded.WBus16) - buffer[7] += 0x20; - - if(decoded.Sync) - buffer[7] += 0x10; - - if(decoded.Linked) - buffer[7] += 0x08; - - if(decoded.TranDis) - buffer[7] += 0x04; - - if(decoded.CmdQue) - buffer[7] += 0x02; - - if(decoded.SftRe) - buffer[7] += 0x01; - } - - if(decoded.VendorIdentification != null) - { - length = 16; - - Array.Copy(decoded.VendorIdentification, 0, buffer, 8, - decoded.VendorIdentification.Length >= 8 ? 8 : decoded.VendorIdentification.Length); - } - - if(decoded.ProductIdentification != null) - { - length = 32; - - Array.Copy(decoded.ProductIdentification, 0, buffer, 16, - decoded.ProductIdentification.Length >= 16 ? 16 : decoded.ProductIdentification.Length); - } - - if(decoded.ProductRevisionLevel != null) - { - length = 36; - - Array.Copy(decoded.ProductRevisionLevel, 0, buffer, 32, - decoded.ProductRevisionLevel.Length >= 4 ? 4 : decoded.ProductRevisionLevel.Length); - } - - if(decoded.Seagate_DriveSerialNumber != null) - { - length = 44; - Array.Copy(decoded.Seagate_DriveSerialNumber, 0, buffer, 36, 8); - } - - if(decoded.KreonIdentifier != null && - decoded.KreonVersion != null) - { - length = 46; - Array.Copy(decoded.KreonIdentifier, 0, buffer, 36, 5); - buffer[41] = decoded.KreonSpace; - Array.Copy(decoded.KreonVersion, 0, buffer, 42, 5); - } - - if(decoded.HP_WORM || - decoded.HP_WORMVersion > 0 || - decoded.HP_OBDR != null) - { - length = 49; - - if(decoded.HP_WORM) - buffer[40] = 0x01; - - buffer[40] += (byte)(decoded.HP_WORMVersion << 1); - Array.Copy(decoded.HP_OBDR, 0, buffer, 43, 6); - } + if(SCSIInquiryResponse.Length >= 49) + { + // HP + decoded.HPPresent = true; + decoded.HP_WORM |= (SCSIInquiryResponse[40] & 0x01) == 0x01; + decoded.HP_WORMVersion = (byte)((SCSIInquiryResponse[40] & 0x7F) >> 1); + decoded.HP_OBDR = new byte[6]; + Array.Copy(SCSIInquiryResponse, 43, decoded.HP_OBDR, 0, 6); + } + if(SCSIInquiryResponse.Length >= 56) + { if(decoded.IsHiMD) { - length = 56; - Array.Copy(HiMDSignatureContents, 0, buffer, 36, 8); - - if(decoded.HiMDSpecific != null) - Array.Copy(decoded.HiMDSpecific, 0, buffer, 44, 12); + decoded.HiMDSpecific = new byte[12]; + Array.Copy(SCSIInquiryResponse, 44, decoded.HiMDSpecific, 0, 12); } - - if(decoded.VendorSpecific != null && - !decoded.IsHiMD) + else { - length = 56; - Array.Copy(decoded.VendorSpecific, 0, buffer, 36, 20); + decoded.VendorSpecific = new byte[20]; + Array.Copy(SCSIInquiryResponse, 36, decoded.VendorSpecific, 0, 20); } - if(decoded.Reserved3 > 0 || - decoded.Clocking > 0 || - decoded.QAS || - decoded.IUS) - { - length = 57; - buffer[56] = (byte)(decoded.Reserved3 << 4); - buffer[56] += (byte)(decoded.Clocking << 2); + // Quantum + decoded.QuantumPresent = true; + decoded.Qt_ProductFamily = (byte)((SCSIInquiryResponse[36] & 0xF0) >> 4); + decoded.Qt_ReleasedFirmware = (byte)(SCSIInquiryResponse[36] & 0x0F); + decoded.Qt_FirmwareMajorVersion = SCSIInquiryResponse[37]; + decoded.Qt_FirmwareMinorVersion = SCSIInquiryResponse[38]; + decoded.Qt_EEPROMFormatMajorVersion = SCSIInquiryResponse[39]; + decoded.Qt_EEPROMFormatMinorVersion = SCSIInquiryResponse[40]; + decoded.Qt_FirmwarePersonality = SCSIInquiryResponse[41]; + decoded.Qt_FirmwareSubPersonality = SCSIInquiryResponse[42]; + decoded.Qt_TapeDirectoryFormatVersion = SCSIInquiryResponse[43]; + decoded.Qt_ControllerHardwareVersion = SCSIInquiryResponse[44]; + decoded.Qt_DriveEEPROMVersion = SCSIInquiryResponse[45]; + decoded.Qt_DriveHardwareVersion = SCSIInquiryResponse[46]; + decoded.Qt_MediaLoaderFirmwareVersion = SCSIInquiryResponse[47]; + decoded.Qt_MediaLoaderHardwareVersion = SCSIInquiryResponse[48]; + decoded.Qt_MediaLoaderMechanicalVersion = SCSIInquiryResponse[49]; + decoded.Qt_MediaLoaderPresent = SCSIInquiryResponse[50] > 0; + decoded.Qt_LibraryPresent = SCSIInquiryResponse[51] > 0; + decoded.Qt_ModuleRevision = new byte[4]; + Array.Copy(SCSIInquiryResponse, 52, decoded.Qt_ModuleRevision, 0, 4); - if(decoded.QAS) - buffer[56] += 0x02; - - if(decoded.IUS) - buffer[56] += 0x01; - } - - if(decoded.Reserved4 != 0) - { - length = 58; - buffer[57] = decoded.Reserved4; - } - - if(decoded.VersionDescriptors != null) - { - length = (byte)(58 + (decoded.VersionDescriptors.Length * 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) - { - length = (byte)(74 + decoded.Reserved5.Length); - Array.Copy(decoded.Reserved5, 0, buffer, 74, decoded.Reserved5.Length); - } - - if(decoded.VendorSpecific2 != null) - { - length = (byte)(96 + decoded.VendorSpecific2.Length); - Array.Copy(decoded.VendorSpecific2, 0, buffer, 96, decoded.VendorSpecific2.Length); - } - - if(decoded.Seagate_Copyright != null) - { - length = 144; - Array.Copy(decoded.Seagate_Copyright, 0, buffer, 96, 48); - } - - if(decoded.Seagate_ServoPROMPartNo != null) - { - length = 148; - Array.Copy(decoded.Seagate_ServoPROMPartNo, 0, buffer, 144, 4); - } - - buffer[4] = length; - byte[] dest = new byte[length]; - Array.Copy(buffer, 0, dest, 0, length); - - return dest; + // IBM + decoded.IBMPresent = true; + decoded.IBM_AutDis |= (SCSIInquiryResponse[36] & 0x01) == 0x01; + decoded.IBM_PerformanceLimit = SCSIInquiryResponse[37]; + decoded.IBM_OEMSpecific = SCSIInquiryResponse[41]; } - #endregion Public methods + + if(SCSIInquiryResponse.Length >= 57) + { + decoded.Reserved3 = (byte)((SCSIInquiryResponse[56] & 0xF0) >> 4); + decoded.Clocking = (byte)((SCSIInquiryResponse[56] & 0x0C) >> 2); + decoded.QAS = Convert.ToBoolean(SCSIInquiryResponse[56] & 0x02); + decoded.IUS = Convert.ToBoolean(SCSIInquiryResponse[56] & 0x01); + } + + if(SCSIInquiryResponse.Length >= 58) + decoded.Reserved4 = SCSIInquiryResponse[57]; + + if(SCSIInquiryResponse.Length >= 60) + { + int descriptorsNo; + + if(SCSIInquiryResponse.Length >= 74) + descriptorsNo = 8; + else + descriptorsNo = (SCSIInquiryResponse.Length - 58) / 2; + + decoded.VersionDescriptors = new ushort[descriptorsNo]; + + for(int i = 0; i < descriptorsNo; i++) + decoded.VersionDescriptors[i] = BitConverter.ToUInt16(SCSIInquiryResponse, 58 + (i * 2)); + } + + if(SCSIInquiryResponse.Length >= 75 && + SCSIInquiryResponse.Length < 96) + { + decoded.Reserved5 = new byte[SCSIInquiryResponse.Length - 74]; + Array.Copy(SCSIInquiryResponse, 74, decoded.Reserved5, 0, SCSIInquiryResponse.Length - 74); + } + + if(SCSIInquiryResponse.Length >= 96) + { + decoded.Reserved5 = new byte[22]; + Array.Copy(SCSIInquiryResponse, 74, decoded.Reserved5, 0, 22); + } + + if(SCSIInquiryResponse.Length > 96) + { + decoded.VendorSpecific2 = new byte[SCSIInquiryResponse.Length - 96]; + Array.Copy(SCSIInquiryResponse, 96, decoded.VendorSpecific2, 0, SCSIInquiryResponse.Length - 96); + } + + if(SCSIInquiryResponse.Length >= 144) + { + // Seagate 2 + decoded.Seagate2Present = true; + decoded.Seagate_Copyright = new byte[48]; + Array.Copy(SCSIInquiryResponse, 96, decoded.Seagate_Copyright, 0, 48); + } + + if(SCSIInquiryResponse.Length < 148) + return decoded; + + // Seagate 2 + decoded.Seagate3Present = true; + decoded.Seagate_ServoPROMPartNo = new byte[4]; + Array.Copy(SCSIInquiryResponse, 144, decoded.Seagate_ServoPROMPartNo, 0, 4); + + return decoded; } + + /// Encodes a SCSI INQUIRY response + /// Decoded SCSI INQUIRY + /// Raw SCSI INQUIRY response + public static byte[] Encode(Inquiry? inq) + { + if(inq is null) + return null; + + Inquiry decoded = inq.Value; + + byte[] buffer = new byte[512]; + byte length = 0; + + buffer[0] = (byte)(decoded.PeripheralQualifier << 5); + buffer[0] += decoded.PeripheralDeviceType; + + if(decoded.RMB) + buffer[1] = 0x80; + + buffer[1] += decoded.DeviceTypeModifier; + + buffer[2] = (byte)(decoded.ISOVersion << 6); + buffer[2] += (byte)(decoded.ECMAVersion << 3); + buffer[2] += decoded.ANSIVersion; + + if(decoded.AERC) + buffer[3] = 0x80; + + if(decoded.TrmTsk) + buffer[3] += 0x40; + + if(decoded.NormACA) + buffer[3] += 0x20; + + if(decoded.HiSup) + buffer[3] += 0x10; + + buffer[3] += decoded.ResponseDataFormat; + + if(decoded.AdditionalLength > 0) + { + length = 5; + buffer[4] = decoded.AdditionalLength; + } + + if(decoded.SCCS || + decoded.ACC || + decoded.TPGS > 0 || + decoded.ThreePC || + decoded.Reserved2 > 0 || + decoded.Protect) + { + length = 6; + + if(decoded.SCCS) + buffer[5] = 0x80; + + if(decoded.ACC) + buffer[5] += 0x40; + + buffer[5] += (byte)(decoded.TPGS << 4); + + if(decoded.ThreePC) + buffer[5] += 0x08; + + buffer[5] += (byte)(decoded.Reserved2 << 1); + + if(decoded.Protect) + buffer[5] += 0x01; + } + + if(decoded.BQue || + decoded.EncServ || + decoded.VS1 || + decoded.MultiP || + decoded.MChngr || + decoded.ACKREQQ || + decoded.Addr32 || + decoded.Addr16) + { + length = 7; + + if(decoded.BQue) + buffer[6] = 0x80; + + if(decoded.EncServ) + buffer[6] += 0x40; + + if(decoded.VS1) + buffer[6] += 0x20; + + if(decoded.MultiP) + buffer[6] += 0x10; + + if(decoded.MChngr) + buffer[6] += 0x08; + + if(decoded.ACKREQQ) + buffer[6] += 0x04; + + if(decoded.Addr32) + buffer[6] += 0x02; + + if(decoded.Addr16) + buffer[6] += 0x01; + } + + if(decoded.RelAddr || + decoded.WBus32 || + decoded.WBus16 || + decoded.Sync || + decoded.Linked || + decoded.TranDis || + decoded.CmdQue || + decoded.SftRe) + + { + length = 8; + + if(decoded.RelAddr) + buffer[7] = 0x80; + + if(decoded.WBus32) + buffer[7] += 0x40; + + if(decoded.WBus16) + buffer[7] += 0x20; + + if(decoded.Sync) + buffer[7] += 0x10; + + if(decoded.Linked) + buffer[7] += 0x08; + + if(decoded.TranDis) + buffer[7] += 0x04; + + if(decoded.CmdQue) + buffer[7] += 0x02; + + if(decoded.SftRe) + buffer[7] += 0x01; + } + + if(decoded.VendorIdentification != null) + { + length = 16; + + Array.Copy(decoded.VendorIdentification, 0, buffer, 8, + decoded.VendorIdentification.Length >= 8 ? 8 : decoded.VendorIdentification.Length); + } + + if(decoded.ProductIdentification != null) + { + length = 32; + + Array.Copy(decoded.ProductIdentification, 0, buffer, 16, + decoded.ProductIdentification.Length >= 16 ? 16 : decoded.ProductIdentification.Length); + } + + if(decoded.ProductRevisionLevel != null) + { + length = 36; + + Array.Copy(decoded.ProductRevisionLevel, 0, buffer, 32, + decoded.ProductRevisionLevel.Length >= 4 ? 4 : decoded.ProductRevisionLevel.Length); + } + + if(decoded.Seagate_DriveSerialNumber != null) + { + length = 44; + Array.Copy(decoded.Seagate_DriveSerialNumber, 0, buffer, 36, 8); + } + + if(decoded.KreonIdentifier != null && + decoded.KreonVersion != null) + { + length = 46; + Array.Copy(decoded.KreonIdentifier, 0, buffer, 36, 5); + buffer[41] = decoded.KreonSpace; + Array.Copy(decoded.KreonVersion, 0, buffer, 42, 5); + } + + if(decoded.HP_WORM || + decoded.HP_WORMVersion > 0 || + decoded.HP_OBDR != null) + { + length = 49; + + if(decoded.HP_WORM) + buffer[40] = 0x01; + + buffer[40] += (byte)(decoded.HP_WORMVersion << 1); + Array.Copy(decoded.HP_OBDR, 0, buffer, 43, 6); + } + + if(decoded.IsHiMD) + { + length = 56; + Array.Copy(HiMDSignatureContents, 0, buffer, 36, 8); + + if(decoded.HiMDSpecific != null) + Array.Copy(decoded.HiMDSpecific, 0, buffer, 44, 12); + } + + if(decoded.VendorSpecific != null && + !decoded.IsHiMD) + { + length = 56; + Array.Copy(decoded.VendorSpecific, 0, buffer, 36, 20); + } + + if(decoded.Reserved3 > 0 || + decoded.Clocking > 0 || + decoded.QAS || + decoded.IUS) + { + length = 57; + buffer[56] = (byte)(decoded.Reserved3 << 4); + buffer[56] += (byte)(decoded.Clocking << 2); + + if(decoded.QAS) + buffer[56] += 0x02; + + if(decoded.IUS) + buffer[56] += 0x01; + } + + if(decoded.Reserved4 != 0) + { + length = 58; + buffer[57] = decoded.Reserved4; + } + + if(decoded.VersionDescriptors != null) + { + length = (byte)(58 + (decoded.VersionDescriptors.Length * 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) + { + length = (byte)(74 + decoded.Reserved5.Length); + Array.Copy(decoded.Reserved5, 0, buffer, 74, decoded.Reserved5.Length); + } + + if(decoded.VendorSpecific2 != null) + { + length = (byte)(96 + decoded.VendorSpecific2.Length); + Array.Copy(decoded.VendorSpecific2, 0, buffer, 96, decoded.VendorSpecific2.Length); + } + + if(decoded.Seagate_Copyright != null) + { + length = 144; + Array.Copy(decoded.Seagate_Copyright, 0, buffer, 96, 48); + } + + if(decoded.Seagate_ServoPROMPartNo != null) + { + length = 148; + Array.Copy(decoded.Seagate_ServoPROMPartNo, 0, buffer, 144, 4); + } + + buffer[4] = length; + byte[] dest = new byte[length]; + Array.Copy(buffer, 0, dest, 0, length); + + return dest; + } + #endregion Public methods } \ No newline at end of file diff --git a/Structs/Devices/SCSI/Modes/2A.cs b/Structs/Devices/SCSI/Modes/2A.cs index 77bf151bd..6d5d2feac 100644 --- a/Structs/Devices/SCSI/Modes/2A.cs +++ b/Structs/Devices/SCSI/Modes/2A.cs @@ -35,480 +35,479 @@ using System.ComponentModel.DataAnnotations; using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; -namespace Aaru.CommonTypes.Structs.Devices.SCSI.Modes +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 +/// in MMC-2 Variable bytes in MMC-3 +/// +[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"), + SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")] +public class ModePage_2A { - #region Mode Page 0x2A: CD-ROM capabilities page + /// Write speed performance descriptors + public ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors; + /// Parameters can be saved + public bool PS { get; set; } + /// Drive supports multi-session and/or Photo-CD + public bool MultiSession { get; set; } + /// Drive is capable of reading sectors in Mode 2 Form 2 format + public bool Mode2Form2 { get; set; } + /// Drive is capable of reading sectors in Mode 2 Form 1 format + public bool Mode2Form1 { get; set; } + /// Drive is capable of playing audio + public bool AudioPlay { get; set; } + /// Drive can return the ISRC + public bool ISRC { get; set; } + /// Drive can return the media catalogue number + public bool UPC { get; set; } + /// Drive can return C2 pointers + public bool C2Pointer { get; set; } + /// Drive can read, deinterlave and correct R-W subchannels + public bool DeinterlaveSubchannel { get; set; } + /// Drive can read interleaved and uncorrected R-W subchannels + public bool Subchannel { get; set; } + /// Drive can continue from a loss of streaming on audio reading + public bool AccurateCDDA { get; set; } + /// Audio can be read as digital data + public bool CDDACommand { get; set; } + /// Loading Mechanism Type + public byte LoadingMechanism { get; set; } + /// Drive can eject discs + public bool Eject { get; set; } + /// Drive's optional prevent jumper status + public bool PreventJumper { get; set; } + /// Current lock status + public bool LockState { get; set; } + /// Drive can lock media + public bool Lock { get; set; } + /// Each channel can be muted independently + public bool SeparateChannelMute { get; set; } + /// Each channel's volume can be controlled independently + public bool SeparateChannelVolume { get; set; } + /// Maximum drive speed in Kbytes/second + public ushort MaximumSpeed { get; set; } + /// Supported volume levels + public ushort SupportedVolumeLevels { get; set; } + /// Buffer size in Kbytes + public ushort BufferSize { get; set; } + /// Current drive speed in Kbytes/second + public ushort CurrentSpeed { get; set; } + + /// Can read packet media + public bool Method2 { get; set; } + /// Can read CD-RW + public bool ReadCDRW { get; set; } + /// Can read CD-R + public bool ReadCDR { get; set; } + /// Can write CD-RW + public bool WriteCDRW { get; set; } + /// Can write CD-R + public bool WriteCDR { get; set; } + /// Supports IEC-958 digital output on port 2 + public bool DigitalPort2 { get; set; } + /// Supports IEC-958 digital output on port 1 + public bool DigitalPort1 { get; set; } + /// Can deliver a composite audio and video data stream + public bool Composite { get; set; } + /// This bit controls the behavior of the LOAD/UNLOAD command when trying to load a Slot with no Disc present + public bool SSS { get; set; } + /// Contains a changer that can report the exact contents of the slots + public bool SDP { get; set; } + /// Page length + public byte Length { get; set; } + /// Set if LSB comes first + public bool LSBF { get; set; } + /// Set if HIGH on LRCK indicates left channel. Clear if HIGH on LRCK indicates right channel. + public bool RCK { get; set; } /// - /// CD-ROM capabilities page Page code 0x2A 16 bytes in OB-U0077C 20 bytes in SFF-8020i 22 bytes in MMC-1 26 bytes - /// in MMC-2 Variable bytes in MMC-3 + /// Set if data valid on the falling edge of the BCK signal. Clear if data valid on the rising edge of the BCK + /// signal /// - [SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"), - SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")] - public class ModePage_2A + public bool BCK { get; set; } + + /// Can do a test write + public bool TestWrite { get; set; } + /// Maximum write speed + public ushort MaxWriteSpeed { get; set; } + /// Current write speed + public ushort CurrentWriteSpeed { get; set; } + /// Can read disc's barcode + public bool ReadBarcode { get; set; } + /// Can read DVD-RAM + public bool ReadDVDRAM { get; set; } + /// Can read DVD-R + public bool ReadDVDR { get; set; } + /// Can read DVD-ROM + public bool ReadDVDROM { get; set; } + /// Can write DVD-RAM + public bool WriteDVDRAM { get; set; } + /// Can write DVD-R + public bool WriteDVDR { get; set; } + /// Can read raw R-W subchannel from the Lead-In + public bool LeadInPW { get; set; } + /// Can read both sides of a disc + public bool SCC { get; set; } + /// Support copyright management + public ushort CMRSupported { get; set; } + /// Supports buffer under-run free recording + public bool BUF { get; set; } + /// Selected rotational control + public byte RotationControlSelected { get; set; } + /// Current write speed selected + public ushort CurrentWriteSpeedSelected { get; set; } + + /// Database ID + [JsonIgnore, Key] + public int Id { get; set; } + + /// Decodes the page 2Ah of a MODE SENSE response + /// Raw page 2Ah + /// Decoded page 2Ah + public static ModePage_2A Decode(byte[] pageResponse) { - /// Write speed performance descriptors - public ModePage_2A_WriteDescriptor[] WriteSpeedPerformanceDescriptors; - /// Parameters can be saved - public bool PS { get; set; } - /// Drive supports multi-session and/or Photo-CD - public bool MultiSession { get; set; } - /// Drive is capable of reading sectors in Mode 2 Form 2 format - public bool Mode2Form2 { get; set; } - /// Drive is capable of reading sectors in Mode 2 Form 1 format - public bool Mode2Form1 { get; set; } - /// Drive is capable of playing audio - public bool AudioPlay { get; set; } - /// Drive can return the ISRC - public bool ISRC { get; set; } - /// Drive can return the media catalogue number - public bool UPC { get; set; } - /// Drive can return C2 pointers - public bool C2Pointer { get; set; } - /// Drive can read, deinterlave and correct R-W subchannels - public bool DeinterlaveSubchannel { get; set; } - /// Drive can read interleaved and uncorrected R-W subchannels - public bool Subchannel { get; set; } - /// Drive can continue from a loss of streaming on audio reading - public bool AccurateCDDA { get; set; } - /// Audio can be read as digital data - public bool CDDACommand { get; set; } - /// Loading Mechanism Type - public byte LoadingMechanism { get; set; } - /// Drive can eject discs - public bool Eject { get; set; } - /// Drive's optional prevent jumper status - public bool PreventJumper { get; set; } - /// Current lock status - public bool LockState { get; set; } - /// Drive can lock media - public bool Lock { get; set; } - /// Each channel can be muted independently - public bool SeparateChannelMute { get; set; } - /// Each channel's volume can be controlled independently - public bool SeparateChannelVolume { get; set; } - /// Maximum drive speed in Kbytes/second - public ushort MaximumSpeed { get; set; } - /// Supported volume levels - public ushort SupportedVolumeLevels { get; set; } - /// Buffer size in Kbytes - public ushort BufferSize { get; set; } - /// Current drive speed in Kbytes/second - public ushort CurrentSpeed { get; set; } + if((pageResponse?[0] & 0x40) == 0x40) + return null; - /// Can read packet media - public bool Method2 { get; set; } - /// Can read CD-RW - public bool ReadCDRW { get; set; } - /// Can read CD-R - public bool ReadCDR { get; set; } - /// Can write CD-RW - public bool WriteCDRW { get; set; } - /// Can write CD-R - public bool WriteCDR { get; set; } - /// Supports IEC-958 digital output on port 2 - public bool DigitalPort2 { get; set; } - /// Supports IEC-958 digital output on port 1 - public bool DigitalPort1 { get; set; } - /// Can deliver a composite audio and video data stream - public bool Composite { get; set; } - /// This bit controls the behavior of the LOAD/UNLOAD command when trying to load a Slot with no Disc present - public bool SSS { get; set; } - /// Contains a changer that can report the exact contents of the slots - public bool SDP { get; set; } - /// Page length - public byte Length { get; set; } - /// Set if LSB comes first - public bool LSBF { get; set; } - /// Set if HIGH on LRCK indicates left channel. Clear if HIGH on LRCK indicates right channel. - public bool RCK { get; set; } - /// - /// Set if data valid on the falling edge of the BCK signal. Clear if data valid on the rising edge of the BCK - /// signal - /// - public bool BCK { get; set; } + if((pageResponse?[0] & 0x3F) != 0x2A) + return null; - /// Can do a test write - public bool TestWrite { get; set; } - /// Maximum write speed - public ushort MaxWriteSpeed { get; set; } - /// Current write speed - public ushort CurrentWriteSpeed { get; set; } - /// Can read disc's barcode - public bool ReadBarcode { get; set; } - /// Can read DVD-RAM - public bool ReadDVDRAM { get; set; } - /// Can read DVD-R - public bool ReadDVDR { get; set; } - /// Can read DVD-ROM - public bool ReadDVDROM { get; set; } - /// Can write DVD-RAM - public bool WriteDVDRAM { get; set; } - /// Can write DVD-R - public bool WriteDVDR { get; set; } - /// Can read raw R-W subchannel from the Lead-In - public bool LeadInPW { get; set; } - /// Can read both sides of a disc - public bool SCC { get; set; } - /// Support copyright management - public ushort CMRSupported { get; set; } - /// Supports buffer under-run free recording - public bool BUF { get; set; } - /// Selected rotational control - public byte RotationControlSelected { get; set; } - /// Current write speed selected - public ushort CurrentWriteSpeedSelected { get; set; } + if(pageResponse[1] + 2 != pageResponse.Length) + return null; - /// Database ID - [JsonIgnore, Key] - public int Id { get; set; } + if(pageResponse.Length < 16) + return null; - /// Decodes the page 2Ah of a MODE SENSE response - /// Raw page 2Ah - /// Decoded page 2Ah - public static ModePage_2A Decode(byte[] pageResponse) - { - if((pageResponse?[0] & 0x40) == 0x40) - return null; + var decoded = new ModePage_2A(); - if((pageResponse?[0] & 0x3F) != 0x2A) - return null; + decoded.PS |= (pageResponse[0] & 0x80) == 0x80; - if(pageResponse[1] + 2 != pageResponse.Length) - return null; + decoded.AudioPlay |= (pageResponse[4] & 0x01) == 0x01; + decoded.Mode2Form1 |= (pageResponse[4] & 0x10) == 0x10; + decoded.Mode2Form2 |= (pageResponse[4] & 0x20) == 0x20; + decoded.MultiSession |= (pageResponse[4] & 0x40) == 0x40; - if(pageResponse.Length < 16) - return null; + decoded.CDDACommand |= (pageResponse[5] & 0x01) == 0x01; + decoded.AccurateCDDA |= (pageResponse[5] & 0x02) == 0x02; + decoded.Subchannel |= (pageResponse[5] & 0x04) == 0x04; + decoded.DeinterlaveSubchannel |= (pageResponse[5] & 0x08) == 0x08; + decoded.C2Pointer |= (pageResponse[5] & 0x10) == 0x10; + decoded.UPC |= (pageResponse[5] & 0x20) == 0x20; + decoded.ISRC |= (pageResponse[5] & 0x40) == 0x40; - var decoded = new ModePage_2A(); + decoded.LoadingMechanism = (byte)((pageResponse[6] & 0xE0) >> 5); + decoded.Lock |= (pageResponse[6] & 0x01) == 0x01; + decoded.LockState |= (pageResponse[6] & 0x02) == 0x02; + decoded.PreventJumper |= (pageResponse[6] & 0x04) == 0x04; + decoded.Eject |= (pageResponse[6] & 0x08) == 0x08; - decoded.PS |= (pageResponse[0] & 0x80) == 0x80; + decoded.SeparateChannelVolume |= (pageResponse[7] & 0x01) == 0x01; + decoded.SeparateChannelMute |= (pageResponse[7] & 0x02) == 0x02; - decoded.AudioPlay |= (pageResponse[4] & 0x01) == 0x01; - decoded.Mode2Form1 |= (pageResponse[4] & 0x10) == 0x10; - decoded.Mode2Form2 |= (pageResponse[4] & 0x20) == 0x20; - decoded.MultiSession |= (pageResponse[4] & 0x40) == 0x40; - - decoded.CDDACommand |= (pageResponse[5] & 0x01) == 0x01; - decoded.AccurateCDDA |= (pageResponse[5] & 0x02) == 0x02; - decoded.Subchannel |= (pageResponse[5] & 0x04) == 0x04; - decoded.DeinterlaveSubchannel |= (pageResponse[5] & 0x08) == 0x08; - decoded.C2Pointer |= (pageResponse[5] & 0x10) == 0x10; - decoded.UPC |= (pageResponse[5] & 0x20) == 0x20; - decoded.ISRC |= (pageResponse[5] & 0x40) == 0x40; - - decoded.LoadingMechanism = (byte)((pageResponse[6] & 0xE0) >> 5); - decoded.Lock |= (pageResponse[6] & 0x01) == 0x01; - decoded.LockState |= (pageResponse[6] & 0x02) == 0x02; - decoded.PreventJumper |= (pageResponse[6] & 0x04) == 0x04; - decoded.Eject |= (pageResponse[6] & 0x08) == 0x08; - - decoded.SeparateChannelVolume |= (pageResponse[7] & 0x01) == 0x01; - decoded.SeparateChannelMute |= (pageResponse[7] & 0x02) == 0x02; - - decoded.MaximumSpeed = (ushort)((pageResponse[8] << 8) + pageResponse[9]); - decoded.SupportedVolumeLevels = (ushort)((pageResponse[10] << 8) + pageResponse[11]); - decoded.BufferSize = (ushort)((pageResponse[12] << 8) + pageResponse[13]); - decoded.CurrentSpeed = (ushort)((pageResponse[14] << 8) + pageResponse[15]); - - if(pageResponse.Length < 20) - return decoded; - - decoded.Method2 |= (pageResponse[2] & 0x04) == 0x04; - decoded.ReadCDRW |= (pageResponse[2] & 0x02) == 0x02; - decoded.ReadCDR |= (pageResponse[2] & 0x01) == 0x01; - - decoded.WriteCDRW |= (pageResponse[3] & 0x02) == 0x02; - decoded.WriteCDR |= (pageResponse[3] & 0x01) == 0x01; - - decoded.Composite |= (pageResponse[4] & 0x02) == 0x02; - decoded.DigitalPort1 |= (pageResponse[4] & 0x04) == 0x04; - decoded.DigitalPort2 |= (pageResponse[4] & 0x08) == 0x08; - - decoded.SDP |= (pageResponse[7] & 0x04) == 0x04; - decoded.SSS |= (pageResponse[7] & 0x08) == 0x08; - - decoded.Length = (byte)((pageResponse[17] & 0x30) >> 4); - decoded.LSBF |= (pageResponse[17] & 0x08) == 0x08; - decoded.RCK |= (pageResponse[17] & 0x04) == 0x04; - decoded.BCK |= (pageResponse[17] & 0x02) == 0x02; - - if(pageResponse.Length < 22) - return decoded; - - decoded.TestWrite |= (pageResponse[3] & 0x04) == 0x04; - decoded.MaxWriteSpeed = (ushort)((pageResponse[18] << 8) + pageResponse[19]); - decoded.CurrentWriteSpeed = (ushort)((pageResponse[20] << 8) + pageResponse[21]); - - decoded.ReadBarcode |= (pageResponse[5] & 0x80) == 0x80; - - if(pageResponse.Length < 26) - return decoded; - - decoded.ReadDVDRAM |= (pageResponse[2] & 0x20) == 0x20; - decoded.ReadDVDR |= (pageResponse[2] & 0x10) == 0x10; - decoded.ReadDVDROM |= (pageResponse[2] & 0x08) == 0x08; - - decoded.WriteDVDRAM |= (pageResponse[3] & 0x20) == 0x20; - decoded.WriteDVDR |= (pageResponse[3] & 0x10) == 0x10; - - decoded.LeadInPW |= (pageResponse[3] & 0x20) == 0x20; - decoded.SCC |= (pageResponse[3] & 0x10) == 0x10; - - decoded.CMRSupported = (ushort)((pageResponse[22] << 8) + pageResponse[23]); - - if(pageResponse.Length < 32) - return decoded; - - decoded.BUF |= (pageResponse[4] & 0x80) == 0x80; - decoded.RotationControlSelected = (byte)(pageResponse[27] & 0x03); - decoded.CurrentWriteSpeedSelected = (ushort)((pageResponse[28] << 8) + pageResponse[29]); - - ushort descriptors = (ushort)((pageResponse.Length - 32) / 4); - decoded.WriteSpeedPerformanceDescriptors = new ModePage_2A_WriteDescriptor[descriptors]; - - 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)]) - }; + decoded.MaximumSpeed = (ushort)((pageResponse[8] << 8) + pageResponse[9]); + decoded.SupportedVolumeLevels = (ushort)((pageResponse[10] << 8) + pageResponse[11]); + decoded.BufferSize = (ushort)((pageResponse[12] << 8) + pageResponse[13]); + decoded.CurrentSpeed = (ushort)((pageResponse[14] << 8) + pageResponse[15]); + if(pageResponse.Length < 20) return decoded; - } - /// Encodes a page 2Ah of a MODE SENSE response - /// Decoded page 2Ah - /// Raw page 2Ah - public static byte[] Encode(ModePage_2A decoded) - { - byte[] pageResponse = new byte[512]; - byte length = 16; + decoded.Method2 |= (pageResponse[2] & 0x04) == 0x04; + decoded.ReadCDRW |= (pageResponse[2] & 0x02) == 0x02; + decoded.ReadCDR |= (pageResponse[2] & 0x01) == 0x01; - pageResponse[0] = 0x2A; + decoded.WriteCDRW |= (pageResponse[3] & 0x02) == 0x02; + decoded.WriteCDR |= (pageResponse[3] & 0x01) == 0x01; - if(decoded.PS) - pageResponse[0] += 0x80; + decoded.Composite |= (pageResponse[4] & 0x02) == 0x02; + decoded.DigitalPort1 |= (pageResponse[4] & 0x04) == 0x04; + decoded.DigitalPort2 |= (pageResponse[4] & 0x08) == 0x08; - if(decoded.AudioPlay) - pageResponse[4] += 0x01; + decoded.SDP |= (pageResponse[7] & 0x04) == 0x04; + decoded.SSS |= (pageResponse[7] & 0x08) == 0x08; - if(decoded.Mode2Form1) - pageResponse[4] += 0x10; + decoded.Length = (byte)((pageResponse[17] & 0x30) >> 4); + decoded.LSBF |= (pageResponse[17] & 0x08) == 0x08; + decoded.RCK |= (pageResponse[17] & 0x04) == 0x04; + decoded.BCK |= (pageResponse[17] & 0x02) == 0x02; - if(decoded.Mode2Form2) - pageResponse[4] += 0x20; + if(pageResponse.Length < 22) + return decoded; - if(decoded.MultiSession) - pageResponse[4] += 0x40; + decoded.TestWrite |= (pageResponse[3] & 0x04) == 0x04; + decoded.MaxWriteSpeed = (ushort)((pageResponse[18] << 8) + pageResponse[19]); + decoded.CurrentWriteSpeed = (ushort)((pageResponse[20] << 8) + pageResponse[21]); - if(decoded.CDDACommand) - pageResponse[5] += 0x01; + decoded.ReadBarcode |= (pageResponse[5] & 0x80) == 0x80; - if(decoded.AccurateCDDA) - pageResponse[5] += 0x02; + if(pageResponse.Length < 26) + return decoded; - if(decoded.Subchannel) - pageResponse[5] += 0x04; + decoded.ReadDVDRAM |= (pageResponse[2] & 0x20) == 0x20; + decoded.ReadDVDR |= (pageResponse[2] & 0x10) == 0x10; + decoded.ReadDVDROM |= (pageResponse[2] & 0x08) == 0x08; - if(decoded.DeinterlaveSubchannel) - pageResponse[5] += 0x08; + decoded.WriteDVDRAM |= (pageResponse[3] & 0x20) == 0x20; + decoded.WriteDVDR |= (pageResponse[3] & 0x10) == 0x10; - if(decoded.C2Pointer) - pageResponse[5] += 0x10; + decoded.LeadInPW |= (pageResponse[3] & 0x20) == 0x20; + decoded.SCC |= (pageResponse[3] & 0x10) == 0x10; - if(decoded.UPC) - pageResponse[5] += 0x20; + decoded.CMRSupported = (ushort)((pageResponse[22] << 8) + pageResponse[23]); - if(decoded.ISRC) - pageResponse[5] += 0x40; + if(pageResponse.Length < 32) + return decoded; - decoded.LoadingMechanism = (byte)((pageResponse[6] & 0xE0) >> 5); + decoded.BUF |= (pageResponse[4] & 0x80) == 0x80; + decoded.RotationControlSelected = (byte)(pageResponse[27] & 0x03); + decoded.CurrentWriteSpeedSelected = (ushort)((pageResponse[28] << 8) + pageResponse[29]); - if(decoded.Lock) - pageResponse[6] += 0x01; + ushort descriptors = (ushort)((pageResponse.Length - 32) / 4); + decoded.WriteSpeedPerformanceDescriptors = new ModePage_2A_WriteDescriptor[descriptors]; - if(decoded.LockState) - pageResponse[6] += 0x02; - - if(decoded.PreventJumper) - pageResponse[6] += 0x04; - - if(decoded.Eject) - pageResponse[6] += 0x08; - - if(decoded.SeparateChannelVolume) - pageResponse[7] += 0x01; - - if(decoded.SeparateChannelMute) - pageResponse[7] += 0x02; - - decoded.MaximumSpeed = (ushort)((pageResponse[8] << 8) + pageResponse[9]); - decoded.SupportedVolumeLevels = (ushort)((pageResponse[10] << 8) + pageResponse[11]); - decoded.BufferSize = (ushort)((pageResponse[12] << 8) + pageResponse[13]); - decoded.CurrentSpeed = (ushort)((pageResponse[14] << 8) + pageResponse[15]); - - if(decoded.Method2 || - decoded.ReadCDRW || - decoded.ReadCDR || - decoded.WriteCDRW || - decoded.WriteCDR || - decoded.Composite || - decoded.DigitalPort1 || - decoded.DigitalPort2 || - decoded.SDP || - decoded.SSS || - decoded.Length > 0 || - decoded.LSBF || - decoded.RCK || - decoded.BCK) + for(int i = 0; i < descriptors; i++) + decoded.WriteSpeedPerformanceDescriptors[i] = new ModePage_2A_WriteDescriptor { - length = 20; + RotationControl = (byte)(pageResponse[1 + 32 + (i * 4)] & 0x07), + WriteSpeed = (ushort)((pageResponse[2 + 32 + (i * 4)] << 8) + pageResponse[3 + 32 + (i * 4)]) + }; - if(decoded.Method2) - pageResponse[2] += 0x04; - - if(decoded.ReadCDRW) - pageResponse[2] += 0x02; - - if(decoded.ReadCDR) - pageResponse[2] += 0x01; - - if(decoded.WriteCDRW) - pageResponse[3] += 0x02; - - if(decoded.WriteCDR) - pageResponse[3] += 0x01; - - if(decoded.Composite) - pageResponse[4] += 0x02; - - if(decoded.DigitalPort1) - pageResponse[4] += 0x04; - - if(decoded.DigitalPort2) - pageResponse[4] += 0x08; - - if(decoded.SDP) - pageResponse[7] += 0x04; - - if(decoded.SSS) - pageResponse[7] += 0x08; - - pageResponse[17] = (byte)(decoded.Length << 4); - - if(decoded.LSBF) - pageResponse[17] += 0x08; - - if(decoded.RCK) - pageResponse[17] += 0x04; - - if(decoded.BCK) - pageResponse[17] += 0x02; - } - - if(decoded.TestWrite || - decoded.MaxWriteSpeed > 0 || - decoded.CurrentWriteSpeed > 0 || - decoded.ReadBarcode) - { - length = 22; - - if(decoded.TestWrite) - pageResponse[3] += 0x04; - - pageResponse[18] = (byte)((decoded.MaxWriteSpeed & 0xFF00) >> 8); - pageResponse[19] = (byte)(decoded.MaxWriteSpeed & 0xFF); - pageResponse[20] = (byte)((decoded.CurrentWriteSpeed & 0xFF00) >> 8); - pageResponse[21] = (byte)(decoded.CurrentWriteSpeed & 0xFF); - - if(decoded.ReadBarcode) - pageResponse[5] += 0x80; - } - - if(decoded.ReadDVDRAM || - decoded.ReadDVDR || - decoded.ReadDVDROM || - decoded.WriteDVDRAM || - decoded.WriteDVDR || - decoded.LeadInPW || - decoded.SCC || - decoded.CMRSupported > 0) - - { - length = 26; - - if(decoded.ReadDVDRAM) - pageResponse[2] += 0x20; - - if(decoded.ReadDVDR) - pageResponse[2] += 0x10; - - if(decoded.ReadDVDROM) - pageResponse[2] += 0x08; - - if(decoded.WriteDVDRAM) - pageResponse[3] += 0x20; - - if(decoded.WriteDVDR) - pageResponse[3] += 0x10; - - if(decoded.LeadInPW) - pageResponse[3] += 0x20; - - if(decoded.SCC) - pageResponse[3] += 0x10; - - pageResponse[22] = (byte)((decoded.CMRSupported & 0xFF00) >> 8); - pageResponse[23] = (byte)(decoded.CMRSupported & 0xFF); - } - - if(decoded.BUF || - decoded.RotationControlSelected > 0 || - decoded.CurrentWriteSpeedSelected > 0) - { - length = 32; - - if(decoded.BUF) - pageResponse[4] += 0x80; - - pageResponse[27] += decoded.RotationControlSelected; - pageResponse[28] = (byte)((decoded.CurrentWriteSpeedSelected & 0xFF00) >> 8); - pageResponse[29] = (byte)(decoded.CurrentWriteSpeedSelected & 0xFF); - } - - if(decoded.WriteSpeedPerformanceDescriptors != null) - { - length = 32; - - for(int i = 0; i < decoded.WriteSpeedPerformanceDescriptors.Length; i++) - { - length += 4; - pageResponse[1 + 32 + (i * 4)] = decoded.WriteSpeedPerformanceDescriptors[i].RotationControl; - - pageResponse[2 + 32 + (i * 4)] = - (byte)((decoded.WriteSpeedPerformanceDescriptors[i].WriteSpeed & 0xFF00) >> 8); - - pageResponse[3 + 32 + (i * 4)] = - (byte)(decoded.WriteSpeedPerformanceDescriptors[i].WriteSpeed & 0xFF); - } - } - - pageResponse[1] = (byte)(length - 2); - byte[] buf = new byte[length]; - Array.Copy(pageResponse, 0, buf, 0, length); - - return buf; - } + return decoded; } - /// Page 2Ah write descriptor - [SuppressMessage("ReSharper", "InconsistentNaming")] - public struct ModePage_2A_WriteDescriptor + /// Encodes a page 2Ah of a MODE SENSE response + /// Decoded page 2Ah + /// Raw page 2Ah + public static byte[] Encode(ModePage_2A decoded) { - /// Rotational control - public byte RotationControl; - /// Write speed - public ushort WriteSpeed; + byte[] pageResponse = new byte[512]; + byte length = 16; + + pageResponse[0] = 0x2A; + + if(decoded.PS) + pageResponse[0] += 0x80; + + if(decoded.AudioPlay) + pageResponse[4] += 0x01; + + if(decoded.Mode2Form1) + pageResponse[4] += 0x10; + + if(decoded.Mode2Form2) + pageResponse[4] += 0x20; + + if(decoded.MultiSession) + pageResponse[4] += 0x40; + + if(decoded.CDDACommand) + pageResponse[5] += 0x01; + + if(decoded.AccurateCDDA) + pageResponse[5] += 0x02; + + if(decoded.Subchannel) + pageResponse[5] += 0x04; + + if(decoded.DeinterlaveSubchannel) + pageResponse[5] += 0x08; + + if(decoded.C2Pointer) + pageResponse[5] += 0x10; + + if(decoded.UPC) + pageResponse[5] += 0x20; + + if(decoded.ISRC) + pageResponse[5] += 0x40; + + decoded.LoadingMechanism = (byte)((pageResponse[6] & 0xE0) >> 5); + + if(decoded.Lock) + pageResponse[6] += 0x01; + + if(decoded.LockState) + pageResponse[6] += 0x02; + + if(decoded.PreventJumper) + pageResponse[6] += 0x04; + + if(decoded.Eject) + pageResponse[6] += 0x08; + + if(decoded.SeparateChannelVolume) + pageResponse[7] += 0x01; + + if(decoded.SeparateChannelMute) + pageResponse[7] += 0x02; + + decoded.MaximumSpeed = (ushort)((pageResponse[8] << 8) + pageResponse[9]); + decoded.SupportedVolumeLevels = (ushort)((pageResponse[10] << 8) + pageResponse[11]); + decoded.BufferSize = (ushort)((pageResponse[12] << 8) + pageResponse[13]); + decoded.CurrentSpeed = (ushort)((pageResponse[14] << 8) + pageResponse[15]); + + if(decoded.Method2 || + decoded.ReadCDRW || + decoded.ReadCDR || + decoded.WriteCDRW || + decoded.WriteCDR || + decoded.Composite || + decoded.DigitalPort1 || + decoded.DigitalPort2 || + decoded.SDP || + decoded.SSS || + decoded.Length > 0 || + decoded.LSBF || + decoded.RCK || + decoded.BCK) + { + length = 20; + + if(decoded.Method2) + pageResponse[2] += 0x04; + + if(decoded.ReadCDRW) + pageResponse[2] += 0x02; + + if(decoded.ReadCDR) + pageResponse[2] += 0x01; + + if(decoded.WriteCDRW) + pageResponse[3] += 0x02; + + if(decoded.WriteCDR) + pageResponse[3] += 0x01; + + if(decoded.Composite) + pageResponse[4] += 0x02; + + if(decoded.DigitalPort1) + pageResponse[4] += 0x04; + + if(decoded.DigitalPort2) + pageResponse[4] += 0x08; + + if(decoded.SDP) + pageResponse[7] += 0x04; + + if(decoded.SSS) + pageResponse[7] += 0x08; + + pageResponse[17] = (byte)(decoded.Length << 4); + + if(decoded.LSBF) + pageResponse[17] += 0x08; + + if(decoded.RCK) + pageResponse[17] += 0x04; + + if(decoded.BCK) + pageResponse[17] += 0x02; + } + + if(decoded.TestWrite || + decoded.MaxWriteSpeed > 0 || + decoded.CurrentWriteSpeed > 0 || + decoded.ReadBarcode) + { + length = 22; + + if(decoded.TestWrite) + pageResponse[3] += 0x04; + + pageResponse[18] = (byte)((decoded.MaxWriteSpeed & 0xFF00) >> 8); + pageResponse[19] = (byte)(decoded.MaxWriteSpeed & 0xFF); + pageResponse[20] = (byte)((decoded.CurrentWriteSpeed & 0xFF00) >> 8); + pageResponse[21] = (byte)(decoded.CurrentWriteSpeed & 0xFF); + + if(decoded.ReadBarcode) + pageResponse[5] += 0x80; + } + + if(decoded.ReadDVDRAM || + decoded.ReadDVDR || + decoded.ReadDVDROM || + decoded.WriteDVDRAM || + decoded.WriteDVDR || + decoded.LeadInPW || + decoded.SCC || + decoded.CMRSupported > 0) + + { + length = 26; + + if(decoded.ReadDVDRAM) + pageResponse[2] += 0x20; + + if(decoded.ReadDVDR) + pageResponse[2] += 0x10; + + if(decoded.ReadDVDROM) + pageResponse[2] += 0x08; + + if(decoded.WriteDVDRAM) + pageResponse[3] += 0x20; + + if(decoded.WriteDVDR) + pageResponse[3] += 0x10; + + if(decoded.LeadInPW) + pageResponse[3] += 0x20; + + if(decoded.SCC) + pageResponse[3] += 0x10; + + pageResponse[22] = (byte)((decoded.CMRSupported & 0xFF00) >> 8); + pageResponse[23] = (byte)(decoded.CMRSupported & 0xFF); + } + + if(decoded.BUF || + decoded.RotationControlSelected > 0 || + decoded.CurrentWriteSpeedSelected > 0) + { + length = 32; + + if(decoded.BUF) + pageResponse[4] += 0x80; + + pageResponse[27] += decoded.RotationControlSelected; + pageResponse[28] = (byte)((decoded.CurrentWriteSpeedSelected & 0xFF00) >> 8); + pageResponse[29] = (byte)(decoded.CurrentWriteSpeedSelected & 0xFF); + } + + if(decoded.WriteSpeedPerformanceDescriptors != null) + { + length = 32; + + for(int i = 0; i < decoded.WriteSpeedPerformanceDescriptors.Length; i++) + { + length += 4; + pageResponse[1 + 32 + (i * 4)] = decoded.WriteSpeedPerformanceDescriptors[i].RotationControl; + + pageResponse[2 + 32 + (i * 4)] = + (byte)((decoded.WriteSpeedPerformanceDescriptors[i].WriteSpeed & 0xFF00) >> 8); + + pageResponse[3 + 32 + (i * 4)] = + (byte)(decoded.WriteSpeedPerformanceDescriptors[i].WriteSpeed & 0xFF); + } + } + + pageResponse[1] = (byte)(length - 2); + byte[] buf = new byte[length]; + Array.Copy(pageResponse, 0, buf, 0, length); + + return buf; } - #endregion Mode Page 0x2A: CD-ROM capabilities page -} \ No newline at end of file +} + +/// Page 2Ah write descriptor +[SuppressMessage("ReSharper", "InconsistentNaming")] +public struct ModePage_2A_WriteDescriptor +{ + /// Rotational control + public byte RotationControl; + /// Write speed + public ushort WriteSpeed; +} +#endregion Mode Page 0x2A: CD-ROM capabilities page \ No newline at end of file diff --git a/Structs/Filesystems.cs b/Structs/Filesystems.cs index 10cb73804..ac4273cf5 100644 --- a/Structs/Filesystems.cs +++ b/Structs/Filesystems.cs @@ -41,241 +41,240 @@ using System; using System.Runtime.InteropServices; using Newtonsoft.Json; -namespace Aaru.CommonTypes.Structs +namespace Aaru.CommonTypes.Structs; + +/// File attributes. +[Flags] +public enum FileAttributes : ulong { - /// File attributes. - [Flags] - 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 + 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 + 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 + 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 + 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 + System = 0x80000000000, + /// If file end is a partial block its content will be merged with other files + 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 + Socket = 0x2000000000000 +} + +/// Information about a file entry +public class FileEntryInfo +{ + /// File attributes + public FileAttributes Attributes { get; set; } + /// File length in blocks + public long Blocks { get; set; } + /// File block size in bytes + public long BlockSize { get; set; } + /// If file points to a device, device number. Null if the underlying filesystem does not support them. + public ulong? DeviceNo { get; set; } + /// POSIX group ID. Null if the underlying filesystem does not support them. + public ulong? GID { get; set; } + /// inode number for this file (or other unique identifier for the volume) + public ulong Inode { get; set; } + /// File length in bytes + public long Length { get; set; } + /// Number of hard links pointing to this file (. and .. entries count as hard links) + public ulong Links { get; set; } + /// POSIX permissions/mode for this file. Null if the underlying filesystem does not support them. + public uint? Mode { get; set; } + /// POSIX owner ID. Null if the underlying filesystem does not support them. + public ulong? UID { get; set; } + /// File creation date in UTC. Null if the underlying filesystem does not support them. + public DateTime? CreationTimeUtc { get; set; } + /// File last access date in UTC. Null if the underlying filesystem does not support them. + public DateTime? AccessTimeUtc { get; set; } + /// File attributes change date in UTC. Null if the underlying filesystem does not support them. + public DateTime? StatusChangeTimeUtc { get; set; } + /// File last backup date in UTC. Null if the underlying filesystem does not support them. + public DateTime? BackupTimeUtc { get; set; } + /// File last modification date in UTC. Null if the underlying filesystem does not support them. + public DateTime? LastWriteTimeUtc { get; set; } + + /// File creation date. Null if the underlying filesystem does not support them. + [JsonIgnore] + public DateTime? CreationTime { - /// 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 - 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 - 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 - 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 - 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 - System = 0x80000000000, - /// If file end is a partial block its content will be merged with other files - 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 - Socket = 0x2000000000000 + get => CreationTimeUtc?.ToLocalTime(); + set => CreationTimeUtc = value?.ToUniversalTime(); } - /// Information about a file entry - public class FileEntryInfo + /// File last access date. Null if the underlying filesystem does not support them. + [JsonIgnore] + public DateTime? AccessTime { - /// File attributes - public FileAttributes Attributes { get; set; } - /// File length in blocks - public long Blocks { get; set; } - /// File block size in bytes - public long BlockSize { get; set; } - /// If file points to a device, device number. Null if the underlying filesystem does not support them. - public ulong? DeviceNo { get; set; } - /// POSIX group ID. Null if the underlying filesystem does not support them. - public ulong? GID { get; set; } - /// inode number for this file (or other unique identifier for the volume) - public ulong Inode { get; set; } - /// File length in bytes - public long Length { get; set; } - /// Number of hard links pointing to this file (. and .. entries count as hard links) - public ulong Links { get; set; } - /// POSIX permissions/mode for this file. Null if the underlying filesystem does not support them. - public uint? Mode { get; set; } - /// POSIX owner ID. Null if the underlying filesystem does not support them. - public ulong? UID { get; set; } - /// File creation date in UTC. Null if the underlying filesystem does not support them. - public DateTime? CreationTimeUtc { get; set; } - /// File last access date in UTC. Null if the underlying filesystem does not support them. - public DateTime? AccessTimeUtc { get; set; } - /// File attributes change date in UTC. Null if the underlying filesystem does not support them. - public DateTime? StatusChangeTimeUtc { get; set; } - /// File last backup date in UTC. Null if the underlying filesystem does not support them. - public DateTime? BackupTimeUtc { get; set; } - /// File last modification date in UTC. Null if the underlying filesystem does not support them. - public DateTime? LastWriteTimeUtc { get; set; } - - /// File creation date. Null if the underlying filesystem does not support them. - [JsonIgnore] - public DateTime? CreationTime - { - get => CreationTimeUtc?.ToLocalTime(); - set => CreationTimeUtc = value?.ToUniversalTime(); - } - - /// File last access date. Null if the underlying filesystem does not support them. - [JsonIgnore] - public DateTime? AccessTime - { - get => AccessTimeUtc?.ToLocalTime(); - set => AccessTimeUtc = value?.ToUniversalTime(); - } - - /// File attributes change date. Null if the underlying filesystem does not support them. - [JsonIgnore] - public DateTime? StatusChangeTime - { - get => StatusChangeTimeUtc?.ToLocalTime(); - set => StatusChangeTimeUtc = value?.ToUniversalTime(); - } - - /// File last backup date. Null if the underlying filesystem does not support them. - [JsonIgnore] - public DateTime? BackupTime - { - get => BackupTimeUtc?.ToLocalTime(); - set => BackupTimeUtc = value?.ToUniversalTime(); - } - - /// File last modification date. Null if the underlying filesystem does not support them. - [JsonIgnore] - public DateTime? LastWriteTime - { - get => LastWriteTimeUtc?.ToLocalTime(); - set => LastWriteTimeUtc = value?.ToUniversalTime(); - } + get => AccessTimeUtc?.ToLocalTime(); + set => AccessTimeUtc = value?.ToUniversalTime(); } - /// Information about a volume - public class FileSystemInfo + /// File attributes change date. Null if the underlying filesystem does not support them. + [JsonIgnore] + public DateTime? StatusChangeTime { - /// Blocks for this filesystem - public ulong Blocks; - /// Maximum length of filenames on this filesystem - public ushort FilenameLength; - /// Files on this filesystem - public ulong Files; - /// Blocks free on this filesystem - public ulong FreeBlocks; - /// Free inodes on this filesystem - public ulong FreeFiles; - /// Filesystem ID - public FileSystemId Id; - /// ID of plugin for this file - public Guid PluginId; - /// Filesystem type - public string Type; - - /// Initializes an empty instance of this structure - public FileSystemInfo() => Id = new FileSystemId(); - - /// Gets a clone of this structure - /// Clone of this structure - public FileSystemInfo ShallowCopy() => (FileSystemInfo)MemberwiseClone(); + get => StatusChangeTimeUtc?.ToLocalTime(); + set => StatusChangeTimeUtc = value?.ToUniversalTime(); } - /// Stores a filesystem volume unique identifier or serial number - [StructLayout(LayoutKind.Explicit)] - public struct FileSystemId + /// File last backup date. Null if the underlying filesystem does not support them. + [JsonIgnore] + public DateTime? BackupTime { - /// Set to true if the identifier is a 32-bit integer - [FieldOffset(0)] - public bool IsInt; - /// Set to true if the identifier is a 64-bit integer - [FieldOffset(1)] - public bool IsLong; - /// Set to true if the identifier is a GUID - [FieldOffset(2)] - public bool IsGuid; - - /// Identifier as a 32-bit integer - [FieldOffset(3)] - public uint Serial32; - /// Identifier as a 64-bit integer - [FieldOffset(3)] - public ulong Serial64; - /// Identifier as a GUID - [FieldOffset(3)] - public Guid uuid; + get => BackupTimeUtc?.ToLocalTime(); + set => BackupTimeUtc = value?.ToUniversalTime(); } + + /// File last modification date. Null if the underlying filesystem does not support them. + [JsonIgnore] + public DateTime? LastWriteTime + { + get => LastWriteTimeUtc?.ToLocalTime(); + set => LastWriteTimeUtc = value?.ToUniversalTime(); + } +} + +/// Information about a volume +public class FileSystemInfo +{ + /// Blocks for this filesystem + public ulong Blocks; + /// Maximum length of filenames on this filesystem + public ushort FilenameLength; + /// Files on this filesystem + public ulong Files; + /// Blocks free on this filesystem + public ulong FreeBlocks; + /// Free inodes on this filesystem + public ulong FreeFiles; + /// Filesystem ID + public FileSystemId Id; + /// ID of plugin for this file + public Guid PluginId; + /// Filesystem type + public string Type; + + /// Initializes an empty instance of this structure + public FileSystemInfo() => Id = new FileSystemId(); + + /// Gets a clone of this structure + /// Clone of this structure + public FileSystemInfo ShallowCopy() => (FileSystemInfo)MemberwiseClone(); +} + +/// Stores a filesystem volume unique identifier or serial number +[StructLayout(LayoutKind.Explicit)] +public struct FileSystemId +{ + /// Set to true if the identifier is a 32-bit integer + [FieldOffset(0)] + public bool IsInt; + /// Set to true if the identifier is a 64-bit integer + [FieldOffset(1)] + public bool IsLong; + /// Set to true if the identifier is a GUID + [FieldOffset(2)] + public bool IsGuid; + + /// Identifier as a 32-bit integer + [FieldOffset(3)] + public uint Serial32; + /// Identifier as a 64-bit integer + [FieldOffset(3)] + public ulong Serial64; + /// Identifier as a GUID + [FieldOffset(3)] + public Guid uuid; } \ No newline at end of file diff --git a/Structs/TapeFile.cs b/Structs/TapeFile.cs index 67cb1fe31..f243a0533 100644 --- a/Structs/TapeFile.cs +++ b/Structs/TapeFile.cs @@ -36,18 +36,17 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Structs +namespace Aaru.CommonTypes.Structs; + +/// Describes a tape file +public struct TapeFile { - /// Describes a tape file - public struct TapeFile - { - /// File number - public uint File; - /// Partition number - public byte Partition; - /// First block, inclusive, of the file - public ulong FirstBlock; - /// Last block, inclusive, of the file - public ulong LastBlock; - } + /// File number + public uint File; + /// Partition number + public byte Partition; + /// First block, inclusive, of the file + public ulong FirstBlock; + /// Last block, inclusive, of the file + public ulong LastBlock; } \ No newline at end of file diff --git a/Structs/TapePartition.cs b/Structs/TapePartition.cs index f6d2f153e..a73be4a5d 100644 --- a/Structs/TapePartition.cs +++ b/Structs/TapePartition.cs @@ -36,16 +36,15 @@ // Copyright © 2011-2022 Natalia Portillo // ****************************************************************************/ -namespace Aaru.CommonTypes.Structs +namespace Aaru.CommonTypes.Structs; + +/// Describes a tape partition +public struct TapePartition { - /// Describes a tape partition - public struct TapePartition - { - /// Partition number - public byte Number; - /// First block, inclusive, of the partition - public ulong FirstBlock; - /// Last block, inclusive, of the partition - public ulong LastBlock; - } + /// Partition number + public byte Number; + /// First block, inclusive, of the partition + public ulong FirstBlock; + /// Last block, inclusive, of the partition + public ulong LastBlock; } \ No newline at end of file