REFACTOR: Convert variables to auto setters.

This commit is contained in:
2017-12-21 07:19:46 +00:00
parent 5592f147ac
commit e1d0544c3c
36 changed files with 625 additions and 790 deletions

View File

@@ -34,33 +34,11 @@ namespace DiscImageChef.Devices
{
public partial class Device
{
Interop.PlatformID platformId;
object fd;
bool error;
int lastError;
readonly DeviceType type;
readonly string manufacturer;
readonly string model;
readonly string revision;
readonly string serial;
readonly Decoders.SCSI.PeripheralDeviceTypes scsiType;
readonly bool removable;
readonly bool usb;
readonly ushort usbVendor;
readonly ushort usbProduct;
readonly byte[] usbDescriptors;
readonly string usbManufacturerString;
readonly string usbProductString;
readonly string usbSerialString;
readonly bool firewire;
readonly ulong firewireGuid;
readonly uint firewireModel;
readonly string firewireModelName;
readonly uint firewireVendor;
readonly string firewireVendorName;
readonly bool compactFlash;
readonly bool pcmcia;
readonly byte[] cis;
// MMC and SecureDigital, values that need to be get with card idle, something that may
// not be possible to do but usually is already done by the SDHCI driver.
@@ -73,115 +51,79 @@ namespace DiscImageChef.Devices
/// Gets the Platform ID for this device
/// </summary>
/// <value>The Platform ID</value>
public Interop.PlatformID PlatformId
{
get { return platformId; }
}
public Interop.PlatformID PlatformId { get; }
/// <summary>
/// Gets the file handle representing this device
/// </summary>
/// <value>The file handle</value>
public object FileHandle
{
get { return fd; }
}
public object FileHandle { get; }
/// <summary>
/// Gets or sets the standard timeout for commands sent to this device
/// </summary>
/// <value>The timeout in seconds</value>
public uint Timeout { get; set; }
public uint Timeout { get; }
/// <summary>
/// Gets a value indicating whether this <see cref="Device"/> is in error.
/// </summary>
/// <value><c>true</c> if error; otherwise, <c>false</c>.</value>
public bool Error
{
get { return error; }
}
public bool Error { get; }
/// <summary>
/// Gets the last error number.
/// </summary>
/// <value>The last error.</value>
public int LastError
{
get { return lastError; }
}
public int LastError { get; }
/// <summary>
/// Gets the device type.
/// </summary>
/// <value>The device type.</value>
public DeviceType Type
{
get { return type; }
}
public DeviceType Type { get; }
/// <summary>
/// Gets the device's manufacturer
/// </summary>
/// <value>The manufacturer.</value>
public string Manufacturer
{
get { return manufacturer; }
}
public string Manufacturer { get; }
/// <summary>
/// Gets the device model
/// </summary>
/// <value>The model.</value>
public string Model
{
get { return model; }
}
public string Model { get; }
/// <summary>
/// Gets the device's revision.
/// </summary>
/// <value>The revision.</value>
public string Revision
{
get { return revision; }
}
public string Revision { get; }
/// <summary>
/// Gets the device's serial number.
/// </summary>
/// <value>The serial number.</value>
public string Serial
{
get { return serial; }
}
public string Serial { get; }
/// <summary>
/// Gets the device's SCSI peripheral device type
/// </summary>
/// <value>The SCSI peripheral device type.</value>
public Decoders.SCSI.PeripheralDeviceTypes ScsiType
{
get { return scsiType; }
}
public Decoders.SCSI.PeripheralDeviceTypes ScsiType { get; }
/// <summary>
/// Gets a value indicating whether this device's media is removable.
/// </summary>
/// <value><c>true</c> if this device's media is removable; otherwise, <c>false</c>.</value>
public bool IsRemovable
{
get { return removable; }
}
public bool IsRemovable { get; }
/// <summary>
/// Gets a value indicating whether this device is attached via USB.
/// </summary>
/// <value><c>true</c> if this device is attached via USB; otherwise, <c>false</c>.</value>
public bool IsUsb
{
get { return usb; }
}
public bool IsUsb { get; }
/// <summary>
/// Gets the USB vendor ID.
@@ -189,7 +131,7 @@ namespace DiscImageChef.Devices
/// <value>The USB vendor ID.</value>
public ushort UsbVendorId
{
get { return usbVendor; }
get => usbVendor;
}
/// <summary>
@@ -198,53 +140,38 @@ namespace DiscImageChef.Devices
/// <value>The USB product ID.</value>
public ushort UsbProductId
{
get { return usbProduct; }
get => usbProduct;
}
/// <summary>
/// Gets the USB descriptors.
/// </summary>
/// <value>The USB descriptors.</value>
public byte[] UsbDescriptors
{
get { return usbDescriptors; }
}
public byte[] UsbDescriptors { get; }
/// <summary>
/// Gets the USB manufacturer string.
/// </summary>
/// <value>The USB manufacturer string.</value>
public string UsbManufacturerString
{
get { return usbManufacturerString; }
}
public string UsbManufacturerString { get; }
/// <summary>
/// Gets the USB product string.
/// </summary>
/// <value>The USB product string.</value>
public string UsbProductString
{
get { return usbProductString; }
}
public string UsbProductString { get; }
/// <summary>
/// Gets the USB serial string.
/// </summary>
/// <value>The USB serial string.</value>
public string UsbSerialString
{
get { return usbSerialString; }
}
public string UsbSerialString { get; }
/// <summary>
/// Gets a value indicating whether this device is attached via FireWire.
/// </summary>
/// <value><c>true</c> if this device is attached via FireWire; otherwise, <c>false</c>.</value>
public bool IsFireWire
{
get { return firewire; }
}
public bool IsFireWire { get; }
/// <summary>
/// Gets the FireWire GUID
@@ -252,7 +179,7 @@ namespace DiscImageChef.Devices
/// <value>The FireWire GUID.</value>
public ulong FireWireGuid
{
get { return firewireGuid; }
get => firewireGuid;
}
/// <summary>
@@ -261,17 +188,14 @@ namespace DiscImageChef.Devices
/// <value>The FireWire model.</value>
public uint FireWireModel
{
get { return firewireModel; }
get => firewireModel;
}
/// <summary>
/// Gets the FireWire model name.
/// </summary>
/// <value>The FireWire model name.</value>
public string FireWireModelName
{
get { return firewireModelName; }
}
public string FireWireModelName { get; }
/// <summary>
/// Gets the FireWire vendor number.
@@ -279,42 +203,30 @@ namespace DiscImageChef.Devices
/// <value>The FireWire vendor number.</value>
public uint FireWireVendor
{
get { return firewireVendor; }
get => firewireVendor;
}
/// <summary>
/// Gets the FireWire vendor name.
/// </summary>
/// <value>The FireWire vendor name.</value>
public string FireWireVendorName
{
get { return firewireVendorName; }
}
public string FireWireVendorName { get; }
/// <summary>
/// Gets a value indicating whether this device is a CompactFlash device.
/// </summary>
/// <value><c>true</c> if this device is a CompactFlash device; otherwise, <c>false</c>.</value>
public bool IsCompactFlash
{
get { return compactFlash; }
}
public bool IsCompactFlash { get; }
/// <summary>
/// Gets a value indicating whether this device is a PCMCIA device.
/// </summary>
/// <value><c>true</c> if this device is a PCMCIA device; otherwise, <c>false</c>.</value>
public bool IsPcmcia
{
get { return pcmcia; }
}
public bool IsPcmcia { get; }
/// <summary>
/// Contains the PCMCIA CIS if applicable
/// </summary>
public byte[] Cis
{
get { return cis; }
}
public byte[] Cis { get; }
}
}