Code restyling.

This commit is contained in:
2020-02-29 18:03:33 +00:00
parent ad4bfdc0b5
commit 0bc3b5c1fe
7 changed files with 37 additions and 36 deletions

View File

@@ -42,7 +42,8 @@ namespace Aaru.Helpers
public enum BitEndian public enum BitEndian
{ {
/// <summary>Little-endian, or least significant bit</summary> /// <summary>Little-endian, or least significant bit</summary>
Little, /// <summary>Big-endian, or most significant bit</summary> Little,
/// <summary>Big-endian, or most significant bit</summary>
Big, Big,
/// <summary>PDP-11 endian, little endian except for 32-bit integers where the 16 halves are swapped between them</summary> /// <summary>PDP-11 endian, little endian except for 32-bit integers where the 16 halves are swapped between them</summary>
Pdp Pdp

4
CHS.cs
View File

@@ -42,7 +42,7 @@ namespace Aaru.Helpers
/// <param name="maxSector">Number of sectors per track</param> /// <param name="maxSector">Number of sectors per track</param>
/// <returns></returns> /// <returns></returns>
public static uint ToLBA(uint cyl, uint head, uint sector, uint maxHead, uint maxSector) => public static uint ToLBA(uint cyl, uint head, uint sector, uint maxHead, uint maxSector) =>
maxHead == 0 || maxSector == 0 ? (cyl * 16 + head) * 63 + sector - 1 maxHead == 0 || maxSector == 0 ? ((((cyl * 16) + head) * 63) + sector) - 1
: (cyl * maxHead + head) * maxSector + sector - 1; : ((((cyl * maxHead) + head) * maxSector) + sector) - 1;
} }
} }

View File

@@ -285,8 +285,8 @@ namespace Aaru
{ {
byte specification = (byte)((typeAndTimeZone & 0xF000) >> 12); byte specification = (byte)((typeAndTimeZone & 0xF000) >> 12);
long ticks = (long)centiseconds * 100000 + (long)hundredsOfMicroseconds * 1000 + long ticks = ((long)centiseconds * 100000) + ((long)hundredsOfMicroseconds * 1000) +
(long)microseconds * 10; ((long)microseconds * 10);
if(specification == 0) if(specification == 0)
return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc).AddTicks(ticks); return new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc).AddTicks(ticks);
@@ -321,7 +321,7 @@ namespace Aaru
public static DateTime Os9ToDateTime(byte[] date) public static DateTime Os9ToDateTime(byte[] date)
{ {
if(date == null || if(date == null ||
date.Length != 3 && date.Length != 5) (date.Length != 3 && date.Length != 5))
return DateTime.MinValue; return DateTime.MinValue;
DateTime os9Date; DateTime os9Date;
@@ -363,12 +363,12 @@ namespace Aaru
{ {
try try
{ {
int iyear = (year >> 4) * 10 + (year & 0xF); int iyear = ((year >> 4) * 10) + (year & 0xF);
int imonth = (month >> 4) * 10 + (month & 0xF); int imonth = ((month >> 4) * 10) + (month & 0xF);
int iday = (day >> 4) * 10 + (day & 0xF); int iday = ((day >> 4) * 10) + (day & 0xF);
int iminute = (minute >> 4) * 10 + (minute & 0xF); int iminute = ((minute >> 4) * 10) + (minute & 0xF);
int ihour = (hour >> 4) * 10 + (hour & 0xF); int ihour = ((hour >> 4) * 10) + (hour & 0xF);
int isecond = (second >> 4) * 10 + (second & 0xF); int isecond = ((second >> 4) * 10) + (second & 0xF);
if(iyear >= 70) if(iyear >= 70)
iyear += 1900; iyear += 1900;