mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: All refactor in DiscImageChef.Decoders.
This commit is contained in:
@@ -31,10 +31,16 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
||||
namespace DiscImageChef.Decoders.SecureDigital
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
[SuppressMessage("ReSharper", "UnassignedField.Global")]
|
||||
[SuppressMessage("ReSharper", "NotAccessedField.Global")]
|
||||
public class OCR
|
||||
{
|
||||
public bool PowerUp;
|
||||
@@ -53,37 +59,34 @@ namespace DiscImageChef.Decoders.SecureDigital
|
||||
public bool LowPower;
|
||||
}
|
||||
|
||||
public partial class Decoders
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
public static partial class Decoders
|
||||
{
|
||||
public static OCR DecodeOCR(uint response)
|
||||
{
|
||||
OCR ocr = new OCR();
|
||||
|
||||
ocr.PowerUp = (response & 0x80000000) == 0x80000000;
|
||||
ocr.CCS = (response & 0x40000000) == 0x40000000;
|
||||
ocr.PowerUp = (response & 0x20000000) == 0x20000000;
|
||||
ocr.OneEight = (response & 0x01000000) == 0x01000000;
|
||||
ocr.ThreeFive = (response & 0x00800000) == 0x00800000;
|
||||
ocr.ThreeFour = (response & 0x00400000) == 0x00400000;
|
||||
ocr.ThreeThree = (response & 0x00200000) == 0x00200000;
|
||||
ocr.ThreeTwo = (response & 0x00100000) == 0x00100000;
|
||||
ocr.ThreeOne = (response & 0x00080000) == 0x00080000;
|
||||
ocr.ThreeZero = (response & 0x00040000) == 0x00040000;
|
||||
ocr.TwoNine = (response & 0x00020000) == 0x00020000;
|
||||
ocr.TwoEight = (response & 0x00010000) == 0x00010000;
|
||||
ocr.TwoSeven = (response & 0x00008000) == 0x00008000;
|
||||
ocr.LowPower = (response & 0x00000080) == 0x00000080;
|
||||
|
||||
return ocr;
|
||||
return new OCR
|
||||
{
|
||||
PowerUp = (response & 0x80000000) == 0x80000000,
|
||||
CCS = (response & 0x40000000) == 0x40000000,
|
||||
UHS = (response & 0x20000000) == 0x20000000,
|
||||
OneEight = (response & 0x01000000) == 0x01000000,
|
||||
ThreeFive = (response & 0x00800000) == 0x00800000,
|
||||
ThreeFour = (response & 0x00400000) == 0x00400000,
|
||||
ThreeThree = (response & 0x00200000) == 0x00200000,
|
||||
ThreeTwo = (response & 0x00100000) == 0x00100000,
|
||||
ThreeOne = (response & 0x00080000) == 0x00080000,
|
||||
ThreeZero = (response & 0x00040000) == 0x00040000,
|
||||
TwoNine = (response & 0x00020000) == 0x00020000,
|
||||
TwoEight = (response & 0x00010000) == 0x00010000,
|
||||
TwoSeven = (response & 0x00008000) == 0x00008000,
|
||||
LowPower = (response & 0x00000080) == 0x00000080
|
||||
};
|
||||
}
|
||||
|
||||
public static OCR DecodeOCR(byte[] response)
|
||||
{
|
||||
if(response == null) return null;
|
||||
|
||||
if(response.Length != 4) return null;
|
||||
|
||||
return DecodeOCR(BitConverter.ToUInt32(response, 0));
|
||||
return response?.Length != 4 ? null : DecodeOCR(BitConverter.ToUInt32(response, 0));
|
||||
}
|
||||
|
||||
public static string PrettifyOCR(OCR ocr)
|
||||
|
||||
Reference in New Issue
Block a user