Skip to content

Commit

Permalink
Fix naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
claunia committed Oct 5, 2023
1 parent 9618e2c commit 29343d4
Show file tree
Hide file tree
Showing 81 changed files with 591 additions and 594 deletions.
2 changes: 1 addition & 1 deletion Aaru.CommonTypes
6 changes: 3 additions & 3 deletions Aaru.Core/Graphics/Spiral.cs
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,9 @@ public void PaintLeadInSector(ulong sector, SKColor color, int leadInSize)
/// <param name="center">Center of the spiral start</param>
/// <param name="minRadius">Minimum radius before which the spiral must have no points</param>
/// <param name="maxRadius">Radius at which the spiral will end</param>
/// <param name="A">TODO: Something trigonometry something something...</param>
/// <param name="a">TODO: Something trigonometry something something...</param>
/// <returns>List of points to draw the specified spiral</returns>
static List<SKPoint> GetSpiralPoints(SKPoint center, float minRadius, float maxRadius, float A)
static List<SKPoint> GetSpiralPoints(SKPoint center, float minRadius, float maxRadius, float a)
{
// Get the points.
List<SKPoint> points = new();
Expand All @@ -631,7 +631,7 @@ static List<SKPoint> GetSpiralPoints(SKPoint center, float minRadius, float maxR
for(float theta = 0;; theta += dtheta)
{
// Calculate r.
float r = A * theta;
float r = a * theta;

if(r < minRadius)
continue;
Expand Down
2 changes: 1 addition & 1 deletion Aaru.Decryption
Submodule Aaru.Decryption updated 2 files
+4 −4 DVD/CSS.cs
+7 −7 DVD/MPEG.cs
2 changes: 1 addition & 1 deletion Aaru.Devices/Device/Constructor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public static Device Create(string devicePath, out ErrorNumber errno)
dev.Model = dev.FireWireModelName;

if(string.IsNullOrEmpty(dev.Serial))
dev.Serial = $"{dev._firewireGuid:X16}";
dev.Serial = $"{dev.FirewireGuid:X16}";
else
{
foreach(char c in dev.Serial.Where(c => !char.IsControl(c)))
Expand Down
40 changes: 20 additions & 20 deletions Aaru.Devices/Device/Variables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,24 @@ namespace Aaru.Devices;

public partial class Device
{
const string ATA_MODULE_NAME = "ATA Device";
const string SCSI_MODULE_NAME = "SCSI Device";
const string SD_MODULE_NAME = "SecureDigital Device";
const string MMC_MODULE_NAME = "MultiMediaCard Device";
private protected byte[] _cachedCid;
const string ATA_MODULE_NAME = "ATA Device";
const string SCSI_MODULE_NAME = "SCSI Device";
const string SD_MODULE_NAME = "SecureDigital Device";
const string MMC_MODULE_NAME = "MultiMediaCard Device";

// 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.
private protected byte[] _cachedCsd;
private protected byte[] _cachedOcr;
private protected byte[] _cachedScr;

private protected string _devicePath;
private protected ulong _firewireGuid;
private protected uint _firewireModel;
private protected uint _firewireVendor;
private protected ushort _usbProduct;
private protected ushort _usbVendor;
private protected byte[] CachedCid;
private protected byte[] CachedCsd;
private protected byte[] CachedOcr;
private protected byte[] CachedScr;

private protected string DevicePath;
private protected ulong FirewireGuid;
private protected uint FirewireModel;
private protected uint FirewireVendor;
private protected ushort UsbProduct;
private protected ushort UsbVendor;

/// <summary>Gets the Platform ID for this device</summary>
/// <value>The Platform ID</value>
Expand Down Expand Up @@ -107,11 +107,11 @@ public partial class Device

/// <summary>Gets the USB vendor ID.</summary>
/// <value>The USB vendor ID.</value>
public ushort UsbVendorId => _usbVendor;
public ushort UsbVendorId => UsbVendor;

/// <summary>Gets the USB product ID.</summary>
/// <value>The USB product ID.</value>
public ushort UsbProductId => _usbProduct;
public ushort UsbProductId => UsbProduct;

/// <summary>Gets the USB descriptors.</summary>
/// <value>The USB descriptors.</value>
Expand All @@ -135,19 +135,19 @@ public partial class Device

/// <summary>Gets the FireWire GUID</summary>
/// <value>The FireWire GUID.</value>
public ulong FireWireGuid => _firewireGuid;
public ulong FireWireGuid => FirewireGuid;

/// <summary>Gets the FireWire model number</summary>
/// <value>The FireWire model.</value>
public uint FireWireModel => _firewireModel;
public uint FireWireModel => FirewireModel;

/// <summary>Gets the FireWire model name.</summary>
/// <value>The FireWire model name.</value>
public string FireWireModelName { get; private protected set; }

/// <summary>Gets the FireWire vendor number.</summary>
/// <value>The FireWire vendor number.</value>
public uint FireWireVendor => _firewireVendor;
public uint FireWireVendor => FirewireVendor;

/// <summary>Gets the FireWire vendor name.</summary>
/// <value>The FireWire vendor name.</value>
Expand Down
30 changes: 15 additions & 15 deletions Aaru.Devices/Linux/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,48 +370,48 @@ public override int SendMmcCommand(MmcCommands command, bool write, b

switch(command)
{
case MmcCommands.SendCid when _cachedCid != null:
case MmcCommands.SendCid when CachedCid != null:
{
cmdStopwatch.Restart();
buffer = new byte[_cachedCid.Length];
Array.Copy(_cachedCid, buffer, buffer.Length);
buffer = new byte[CachedCid.Length];
Array.Copy(CachedCid, buffer, buffer.Length);
response = new uint[4];
sense = false;
cmdStopwatch.Stop();
duration = cmdStopwatch.Elapsed.TotalMilliseconds;

return 0;
}
case MmcCommands.SendCsd when _cachedCid != null:
case MmcCommands.SendCsd when CachedCid != null:
{
cmdStopwatch.Restart();
buffer = new byte[_cachedCsd.Length];
Array.Copy(_cachedCsd, buffer, buffer.Length);
buffer = new byte[CachedCsd.Length];
Array.Copy(CachedCsd, buffer, buffer.Length);
response = new uint[4];
sense = false;
cmdStopwatch.Stop();
duration = cmdStopwatch.Elapsed.TotalMilliseconds;

return 0;
}
case (MmcCommands)SecureDigitalCommands.SendScr when _cachedScr != null:
case (MmcCommands)SecureDigitalCommands.SendScr when CachedScr != null:
{
cmdStopwatch.Restart();
buffer = new byte[_cachedScr.Length];
Array.Copy(_cachedScr, buffer, buffer.Length);
buffer = new byte[CachedScr.Length];
Array.Copy(CachedScr, buffer, buffer.Length);
response = new uint[4];
sense = false;
cmdStopwatch.Stop();
duration = cmdStopwatch.Elapsed.TotalMilliseconds;

return 0;
}
case (MmcCommands)SecureDigitalCommands.SendOperatingCondition when _cachedOcr != null:
case MmcCommands.SendOpCond when _cachedOcr != null:
case (MmcCommands)SecureDigitalCommands.SendOperatingCondition when CachedOcr != null:
case MmcCommands.SendOpCond when CachedOcr != null:
{
cmdStopwatch.Restart();
buffer = new byte[_cachedOcr.Length];
Array.Copy(_cachedOcr, buffer, buffer.Length);
buffer = new byte[CachedOcr.Length];
Array.Copy(CachedOcr, buffer, buffer.Length);
response = new uint[4];
sense = false;
cmdStopwatch.Stop();
Expand Down Expand Up @@ -594,7 +594,7 @@ public override bool ReOpen()
return true;
}

int newFd = Extern.open(_devicePath, FileFlags.ReadWrite | FileFlags.NonBlocking | FileFlags.CreateNew);
int newFd = Extern.open(DevicePath, FileFlags.ReadWrite | FileFlags.NonBlocking | FileFlags.CreateNew);

if(newFd >= 0)
{
Expand All @@ -614,7 +614,7 @@ public override bool ReOpen()
return true;
}

newFd = Extern.open(_devicePath, FileFlags.Readonly | FileFlags.NonBlocking);
newFd = Extern.open(DevicePath, FileFlags.Readonly | FileFlags.NonBlocking);

if(newFd < 0)
{
Expand Down
34 changes: 17 additions & 17 deletions Aaru.Devices/Linux/Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,49 +126,49 @@ partial class Device : Devices.Device

if(File.Exists("/sys/block/" + devPath + "/device/csd"))
{
int len = ConvertFromFileHexAscii("/sys/block/" + devPath + "/device/csd", out dev._cachedCsd);
int len = ConvertFromFileHexAscii("/sys/block/" + devPath + "/device/csd", out dev.CachedCsd);

if(len == 0)
dev._cachedCsd = null;
dev.CachedCsd = null;
}

if(File.Exists("/sys/block/" + devPath + "/device/cid"))
{
int len = ConvertFromFileHexAscii("/sys/block/" + devPath + "/device/cid", out dev._cachedCid);
int len = ConvertFromFileHexAscii("/sys/block/" + devPath + "/device/cid", out dev.CachedCid);

if(len == 0)
dev._cachedCid = null;
dev.CachedCid = null;
}

if(File.Exists("/sys/block/" + devPath + "/device/scr"))
{
int len = ConvertFromFileHexAscii("/sys/block/" + devPath + "/device/scr", out dev._cachedScr);
int len = ConvertFromFileHexAscii("/sys/block/" + devPath + "/device/scr", out dev.CachedScr);

if(len == 0)
dev._cachedScr = null;
dev.CachedScr = null;
}

if(File.Exists("/sys/block/" + devPath + "/device/ocr"))
{
int len = ConvertFromFileHexAscii("/sys/block/" + devPath + "/device/ocr", out dev._cachedOcr);
int len = ConvertFromFileHexAscii("/sys/block/" + devPath + "/device/ocr", out dev.CachedOcr);

if(len == 0)
dev._cachedOcr = null;
dev.CachedOcr = null;
}
}
}

#region SecureDigital / MultiMediaCard

if(dev._cachedCid != null)
if(dev.CachedCid != null)
{
dev.ScsiType = PeripheralDeviceTypes.DirectAccess;
dev.IsRemovable = false;

if(dev._cachedScr != null)
if(dev.CachedScr != null)
{
dev.Type = DeviceType.SecureDigital;
CID decoded = Decoders.SecureDigital.Decoders.DecodeCID(dev._cachedCid);
CID decoded = Decoders.SecureDigital.Decoders.DecodeCID(dev.CachedCid);
dev.Manufacturer = VendorString.Prettify(decoded.Manufacturer);
dev.Model = decoded.ProductName;

Expand All @@ -180,7 +180,7 @@ partial class Device : Devices.Device
else
{
dev.Type = DeviceType.MMC;
Decoders.MMC.CID decoded = Decoders.MMC.Decoders.DecodeCID(dev._cachedCid);
Decoders.MMC.CID decoded = Decoders.MMC.Decoders.DecodeCID(dev.CachedCid);
dev.Manufacturer = VendorString.Prettify(decoded.Manufacturer);
dev.Model = decoded.ProductName;

Expand Down Expand Up @@ -234,15 +234,15 @@ partial class Device : Devices.Device
string usbTemp = usbSr.ReadToEnd();

ushort.TryParse(usbTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
out dev._usbProduct);
out dev.UsbProduct);

usbSr.Close();

usbSr = new StreamReader(resolvedLink + "/idVendor");
usbTemp = usbSr.ReadToEnd();

ushort.TryParse(usbTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
out dev._usbVendor);
out dev.UsbVendor);

usbSr.Close();

Expand Down Expand Up @@ -305,23 +305,23 @@ partial class Device : Devices.Device
string fwTemp = fwSr.ReadToEnd();

uint.TryParse(fwTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
out dev._firewireModel);
out dev.FirewireModel);

fwSr.Close();

fwSr = new StreamReader(resolvedLink + "/vendor");
fwTemp = fwSr.ReadToEnd();

uint.TryParse(fwTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
out dev._firewireVendor);
out dev.FirewireVendor);

fwSr.Close();

fwSr = new StreamReader(resolvedLink + "/guid");
fwTemp = fwSr.ReadToEnd();

ulong.TryParse(fwTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
out dev._firewireGuid);
out dev.FirewireGuid);

fwSr.Close();

Expand Down
26 changes: 13 additions & 13 deletions Aaru.Devices/Remote/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,48 +103,48 @@ public override int SendMmcCommand(MmcCommands command, bool write, b

switch(command)
{
case MmcCommands.SendCid when _cachedCid != null:
case MmcCommands.SendCid when CachedCid != null:
{
cmdStopwatch.Restart();
buffer = new byte[_cachedCid.Length];
Array.Copy(_cachedCid, buffer, buffer.Length);
buffer = new byte[CachedCid.Length];
Array.Copy(CachedCid, buffer, buffer.Length);
response = new uint[4];
sense = false;
cmdStopwatch.Stop();
duration = cmdStopwatch.Elapsed.TotalMilliseconds;

return 0;
}
case MmcCommands.SendCsd when _cachedCid != null:
case MmcCommands.SendCsd when CachedCid != null:
{
cmdStopwatch.Restart();
buffer = new byte[_cachedCsd.Length];
Array.Copy(_cachedCsd, buffer, buffer.Length);
buffer = new byte[CachedCsd.Length];
Array.Copy(CachedCsd, buffer, buffer.Length);
response = new uint[4];
sense = false;
cmdStopwatch.Stop();
duration = cmdStopwatch.Elapsed.TotalMilliseconds;

return 0;
}
case (MmcCommands)SecureDigitalCommands.SendScr when _cachedScr != null:
case (MmcCommands)SecureDigitalCommands.SendScr when CachedScr != null:
{
cmdStopwatch.Restart();
buffer = new byte[_cachedScr.Length];
Array.Copy(_cachedScr, buffer, buffer.Length);
buffer = new byte[CachedScr.Length];
Array.Copy(CachedScr, buffer, buffer.Length);
response = new uint[4];
sense = false;
cmdStopwatch.Stop();
duration = cmdStopwatch.Elapsed.TotalMilliseconds;

return 0;
}
case (MmcCommands)SecureDigitalCommands.SendOperatingCondition when _cachedOcr != null:
case MmcCommands.SendOpCond when _cachedOcr != null:
case (MmcCommands)SecureDigitalCommands.SendOperatingCondition when CachedOcr != null:
case MmcCommands.SendOpCond when CachedOcr != null:
{
cmdStopwatch.Restart();
buffer = new byte[_cachedOcr.Length];
Array.Copy(_cachedOcr, buffer, buffer.Length);
buffer = new byte[CachedOcr.Length];
Array.Copy(CachedOcr, buffer, buffer.Length);
response = new uint[4];
sense = false;
cmdStopwatch.Stop();
Expand Down
Loading

0 comments on commit 29343d4

Please sign in to comment.