mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] General reformat and clean-up.
This commit is contained in:
@@ -36,9 +36,9 @@
|
||||
<PackageReference Include="Claunia.RsrcFork"/>
|
||||
<PackageReference Include="DotNetZip"/>
|
||||
<PackageReference Include="Humanizer"/>
|
||||
<PackageReference Include="libaaruformat" />
|
||||
<PackageReference Include="libaaruformat"/>
|
||||
<PackageReference Include="plist-cil"/>
|
||||
<PackageReference Include="Sentry" />
|
||||
<PackageReference Include="Sentry"/>
|
||||
<PackageReference Include="SharpCompress"/>
|
||||
<PackageReference Include="System.ValueTuple"/>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml:space="preserve">
|
||||
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xml:space="preserve">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=a2r/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=aaruformat/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=aaruformatold/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=aaruformatold/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=alcohol120/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=anex86/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=apple2mg/@EntryIndexedValue">True</s:Boolean>
|
||||
|
||||
@@ -64,8 +64,9 @@ public sealed partial class AaruFormat
|
||||
|
||||
// Convert array of booleans to List of enums
|
||||
for(nuint i = 0; i < sizet_length; i++)
|
||||
if(sectorTagsBuffer[i] != 0)
|
||||
_imageInfo.ReadableSectorTags.Add((SectorTagType)i);
|
||||
{
|
||||
if(sectorTagsBuffer[i] != 0) _imageInfo.ReadableSectorTags.Add((SectorTagType)i);
|
||||
}
|
||||
|
||||
sizet_length = 0;
|
||||
ret = aaruf_get_readable_media_tags(_context, null, ref sizet_length);
|
||||
@@ -79,8 +80,9 @@ public sealed partial class AaruFormat
|
||||
|
||||
// Convert array of booleans to List of enums
|
||||
for(nuint i = 0; i < sizet_length; i++)
|
||||
if(mediaTagsBuffer[i] != 0)
|
||||
_imageInfo.ReadableMediaTags.Add((MediaTagType)i);
|
||||
{
|
||||
if(mediaTagsBuffer[i] != 0) _imageInfo.ReadableMediaTags.Add((MediaTagType)i);
|
||||
}
|
||||
|
||||
ret = aaruf_get_media_sequence(_context, out int sequence, out int lastSequence);
|
||||
|
||||
|
||||
@@ -8,6 +8,30 @@ namespace Aaru.Images;
|
||||
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
// AARU_EXPORT int32_t AARU_CALL aaruf_set_tape_file(void *context, const uint8_t partition, const uint32_t file,
|
||||
// const uint64_t starting_block, const uint64_t ending_block)
|
||||
[LibraryImport("libaaruformat", EntryPoint = "aaruf_set_tape_file", SetLastError = true)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||
private static partial Status aaruf_set_tape_file(IntPtr context, byte partition, uint file, ulong startingBlock,
|
||||
ulong endingBlock);
|
||||
|
||||
// AARU_EXPORT int32_t AARU_CALL aaruf_set_tape_partition(void *context, const uint8_t partition,
|
||||
// const uint64_t starting_block, const uint64_t ending_block)
|
||||
[LibraryImport("libaaruformat", EntryPoint = "aaruf_set_tape_partition", SetLastError = true)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||
private static partial Status aaruf_set_tape_partition(IntPtr context, byte partition, ulong startingBlock,
|
||||
ulong endingBlock);
|
||||
|
||||
// AARU_EXPORT int32_t AARU_CALL aaruf_get_all_tape_files(const void *context, uint8_t *buffer, size_t *length)
|
||||
[LibraryImport("libaaruformat", EntryPoint = "aaruf_get_all_tape_files", SetLastError = true)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||
private static partial Status aaruf_get_all_tape_files(IntPtr context, IntPtr buffer, ref nuint length);
|
||||
|
||||
// AARU_EXPORT int32_t AARU_CALL aaruf_get_all_tape_partitions(const void *context, uint8_t *buffer, size_t *length)
|
||||
[LibraryImport("libaaruformat", EntryPoint = "aaruf_get_all_tape_partitions", SetLastError = true)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||
private static partial Status aaruf_get_all_tape_partitions(IntPtr context, IntPtr buffer, ref nuint length);
|
||||
|
||||
#region IWritableTapeImage Members
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -181,28 +205,4 @@ public sealed partial class AaruFormat
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// AARU_EXPORT int32_t AARU_CALL aaruf_set_tape_file(void *context, const uint8_t partition, const uint32_t file,
|
||||
// const uint64_t starting_block, const uint64_t ending_block)
|
||||
[LibraryImport("libaaruformat", EntryPoint = "aaruf_set_tape_file", SetLastError = true)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||
private static partial Status aaruf_set_tape_file(IntPtr context, byte partition, uint file, ulong startingBlock,
|
||||
ulong endingBlock);
|
||||
|
||||
// AARU_EXPORT int32_t AARU_CALL aaruf_set_tape_partition(void *context, const uint8_t partition,
|
||||
// const uint64_t starting_block, const uint64_t ending_block)
|
||||
[LibraryImport("libaaruformat", EntryPoint = "aaruf_set_tape_partition", SetLastError = true)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||
private static partial Status aaruf_set_tape_partition(IntPtr context, byte partition, ulong startingBlock,
|
||||
ulong endingBlock);
|
||||
|
||||
// AARU_EXPORT int32_t AARU_CALL aaruf_get_all_tape_files(const void *context, uint8_t *buffer, size_t *length)
|
||||
[LibraryImport("libaaruformat", EntryPoint = "aaruf_get_all_tape_files", SetLastError = true)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||
private static partial Status aaruf_get_all_tape_files(IntPtr context, IntPtr buffer, ref nuint length);
|
||||
|
||||
// AARU_EXPORT int32_t AARU_CALL aaruf_get_all_tape_partitions(const void *context, uint8_t *buffer, size_t *length)
|
||||
[LibraryImport("libaaruformat", EntryPoint = "aaruf_get_all_tape_partitions", SetLastError = true)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||
private static partial Status aaruf_get_all_tape_partitions(IntPtr context, IntPtr buffer, ref nuint length);
|
||||
}
|
||||
@@ -288,9 +288,8 @@ public sealed partial class AaruFormat
|
||||
|
||||
// Convert array of booleans to List of enums
|
||||
for(nuint i = 0; i < sizet_length; i++)
|
||||
{
|
||||
if(sectorTagsBuffer[i] != 0) _imageInfo.ReadableSectorTags.Add((SectorTagType)i);
|
||||
}
|
||||
if(sectorTagsBuffer[i] != 0)
|
||||
_imageInfo.ReadableSectorTags.Add((SectorTagType)i);
|
||||
|
||||
sizet_length = 0;
|
||||
ret = aaruf_get_readable_media_tags(_context, null, ref sizet_length);
|
||||
@@ -314,9 +313,8 @@ public sealed partial class AaruFormat
|
||||
|
||||
// Convert array of booleans to List of enums
|
||||
for(nuint i = 0; i < sizet_length; i++)
|
||||
{
|
||||
if(mediaTagsBuffer[i] != 0) _imageInfo.ReadableMediaTags.Add((MediaTagType)i);
|
||||
}
|
||||
if(mediaTagsBuffer[i] != 0)
|
||||
_imageInfo.ReadableMediaTags.Add((MediaTagType)i);
|
||||
|
||||
ret = aaruf_get_media_sequence(_context, out int sequence, out int lastSequence);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public sealed partial class Anex86
|
||||
|
||||
if(stream.Length < Marshal.SizeOf<Header>()) return false;
|
||||
|
||||
byte[] hdrB = new byte[Marshal.SizeOf<Header>()];
|
||||
var hdrB = new byte[Marshal.SizeOf<Header>()];
|
||||
stream.EnsureRead(hdrB, 0, hdrB.Length);
|
||||
|
||||
_header = Marshal.SpanToStructureLittleEndian<Header>(hdrB);
|
||||
|
||||
@@ -205,9 +205,8 @@ public sealed partial class Apridisk
|
||||
for(ushort cyl = 0; cyl < _imageInfo.Cylinders; cyl++)
|
||||
{
|
||||
for(ushort head = 0; head < _imageInfo.Heads; head++)
|
||||
{
|
||||
if(spts[cyl][head] < spt) spt = spts[cyl][head];
|
||||
}
|
||||
if(spts[cyl][head] < spt)
|
||||
spt = spts[cyl][head];
|
||||
}
|
||||
|
||||
_imageInfo.SectorsPerTrack = spt;
|
||||
|
||||
@@ -65,8 +65,9 @@ public sealed partial class Blu
|
||||
tmpHdr.BytesPerBlock = BigEndianBitConverter.ToUInt16(header, 0x15);
|
||||
|
||||
for(var i = 0; i < 0xD; i++)
|
||||
if(tmpHdr.DeviceName[i] < 0x20)
|
||||
return false;
|
||||
{
|
||||
if(tmpHdr.DeviceName[i] < 0x20) return false;
|
||||
}
|
||||
|
||||
return (tmpHdr.BytesPerBlock & 0xFE00) == 0x200;
|
||||
}
|
||||
|
||||
@@ -73,8 +73,9 @@ public sealed partial class Blu
|
||||
AaruLogging.Debug(MODULE_NAME, "ImageHeader.bytesPerBlock = {0}", _imageHeader.BytesPerBlock);
|
||||
|
||||
for(var i = 0; i < 0xD; i++)
|
||||
if(_imageHeader.DeviceName[i] < 0x20)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
{
|
||||
if(_imageHeader.DeviceName[i] < 0x20) return ErrorNumber.InvalidArgument;
|
||||
}
|
||||
|
||||
if((_imageHeader.BytesPerBlock & 0xFE00) != 0x200) return ErrorNumber.InvalidArgument;
|
||||
|
||||
|
||||
@@ -728,8 +728,9 @@ public sealed partial class BlindWrite4
|
||||
|
||||
// As long as subchannel is written for any track, it is present for all tracks
|
||||
if(Tracks.Any(static t => t.SubchannelType == TrackSubchannelType.Packed))
|
||||
foreach(Track track in Tracks)
|
||||
track.SubchannelType = TrackSubchannelType.Packed;
|
||||
{
|
||||
foreach(Track track in Tracks) track.SubchannelType = TrackSubchannelType.Packed;
|
||||
}
|
||||
|
||||
_imageInfo.MediaType = MediaType.CD;
|
||||
|
||||
|
||||
@@ -501,8 +501,9 @@ public sealed partial class Cdrdao
|
||||
}
|
||||
|
||||
if(_writingTracks != null && _writingStreams != null)
|
||||
foreach(FileStream oldTrack in _writingStreams.Select(static t => t.Value).Distinct())
|
||||
oldTrack.Close();
|
||||
{
|
||||
foreach(FileStream oldTrack in _writingStreams.Select(static t => t.Value).Distinct()) oldTrack.Close();
|
||||
}
|
||||
|
||||
ulong currentOffset = 0;
|
||||
_writingTracks = [];
|
||||
|
||||
@@ -436,9 +436,8 @@ public sealed partial class CdrWin
|
||||
}
|
||||
|
||||
if(_writingTracks != null && _writingStreams != null)
|
||||
{
|
||||
foreach(FileStream oldTrack in _writingStreams.Select(static t => t.Value).Distinct()) oldTrack.Close();
|
||||
}
|
||||
foreach(FileStream oldTrack in _writingStreams.Select(static t => t.Value).Distinct())
|
||||
oldTrack.Close();
|
||||
|
||||
_writingTracks = [];
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
|
||||
|
||||
@@ -51,15 +51,14 @@ public sealed partial class Cpcdsk
|
||||
|
||||
if(stream.Length < 512) return false;
|
||||
|
||||
byte[] headerB = new byte[256];
|
||||
var headerB = new byte[256];
|
||||
stream.EnsureRead(headerB, 0, 256);
|
||||
|
||||
int pos;
|
||||
|
||||
for(pos = 0; pos < 254; pos++)
|
||||
{
|
||||
if(headerB[pos] == 0x0D && headerB[pos + 1] == 0x0A) break;
|
||||
}
|
||||
if(headerB[pos] == 0x0D && headerB[pos + 1] == 0x0A)
|
||||
break;
|
||||
|
||||
if(pos >= 254) return false;
|
||||
|
||||
|
||||
@@ -63,8 +63,9 @@ public sealed partial class Cpcdsk
|
||||
int pos;
|
||||
|
||||
for(pos = 0; pos < 254; pos++)
|
||||
if(headerB[pos] == 0x0D && headerB[pos + 1] == 0x0A)
|
||||
break;
|
||||
{
|
||||
if(headerB[pos] == 0x0D && headerB[pos + 1] == 0x0A) break;
|
||||
}
|
||||
|
||||
if(pos >= 254) return ErrorNumber.InvalidArgument;
|
||||
|
||||
|
||||
@@ -48,15 +48,15 @@ public sealed partial class DiscJuggler
|
||||
_imageStream = imageFilter.GetDataForkStream();
|
||||
|
||||
_imageStream.Seek(-4, SeekOrigin.End);
|
||||
byte[] dscLenB = new byte[4];
|
||||
var dscLenB = new byte[4];
|
||||
_imageStream.EnsureRead(dscLenB, 0, 4);
|
||||
int dscLen = BitConverter.ToInt32(dscLenB, 0);
|
||||
var dscLen = BitConverter.ToInt32(dscLenB, 0);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, "dscLen = {0}", dscLen);
|
||||
|
||||
if(dscLen >= _imageStream.Length) return false;
|
||||
|
||||
byte[] descriptor = new byte[dscLen];
|
||||
var descriptor = new byte[dscLen];
|
||||
_imageStream.Seek(-dscLen, SeekOrigin.End);
|
||||
_imageStream.EnsureRead(descriptor, 0, dscLen);
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ public sealed partial class DiskCopy42
|
||||
/// <inheritdoc />
|
||||
public bool? VerifyMediaImage()
|
||||
{
|
||||
byte[] data = new byte[header.DataSize];
|
||||
byte[] tags = new byte[header.TagSize];
|
||||
uint tagsChk = 0;
|
||||
var data = new byte[header.DataSize];
|
||||
var tags = new byte[header.TagSize];
|
||||
uint tagsChk = 0;
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, Localization.Reading_data);
|
||||
Stream dataStream = dc42ImageFilter.GetDataForkStream();
|
||||
|
||||
@@ -41,31 +41,31 @@ public sealed partial class DiskDupe
|
||||
{
|
||||
readonly DiskType[] _diskTypes =
|
||||
[
|
||||
new DiskType
|
||||
new()
|
||||
{
|
||||
cyl = 0,
|
||||
hd = 0,
|
||||
spt = 0
|
||||
}, // Type 0 - invalid
|
||||
new DiskType
|
||||
new()
|
||||
{
|
||||
cyl = 40,
|
||||
hd = 2,
|
||||
spt = 9
|
||||
}, // Type 1 - 360k
|
||||
new DiskType
|
||||
new()
|
||||
{
|
||||
cyl = 80,
|
||||
hd = 2,
|
||||
spt = 15
|
||||
}, // Type 2 - 1.2m
|
||||
new DiskType
|
||||
new()
|
||||
{
|
||||
cyl = 80,
|
||||
hd = 2,
|
||||
spt = 9
|
||||
}, // Type 3 - 720k
|
||||
new DiskType
|
||||
new()
|
||||
{
|
||||
cyl = 80,
|
||||
hd = 2,
|
||||
|
||||
@@ -43,7 +43,7 @@ public sealed partial class HdCopy
|
||||
{
|
||||
static bool TryReadHeader(Stream stream, ref FileHeader fhdr, ref long dataStartOffset)
|
||||
{
|
||||
int numTracks = 82;
|
||||
var numTracks = 82;
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
@@ -81,7 +81,7 @@ public sealed partial class HdCopy
|
||||
if(fheader.trackMap[0] != 1 || fheader.trackMap[1] != 1) return false;
|
||||
|
||||
// all other tracks must be either present (=1) or absent (=0)
|
||||
for(int i = 0; i < 2 * numTracks; i++)
|
||||
for(var i = 0; i < 2 * numTracks; i++)
|
||||
{
|
||||
if(fheader.trackMap[i] > 1) return false;
|
||||
}
|
||||
@@ -94,8 +94,8 @@ public sealed partial class HdCopy
|
||||
|
||||
ErrorNumber ReadTrackIntoCache(Stream stream, int trackNum)
|
||||
{
|
||||
byte[] trackData = new byte[_imageInfo.SectorSize * _imageInfo.SectorsPerTrack];
|
||||
byte[] blkHeader = new byte[3];
|
||||
var trackData = new byte[_imageInfo.SectorSize * _imageInfo.SectorsPerTrack];
|
||||
var blkHeader = new byte[3];
|
||||
|
||||
// check that track is present
|
||||
if(_trackOffset[trackNum] == -1)
|
||||
@@ -109,15 +109,15 @@ public sealed partial class HdCopy
|
||||
|
||||
// read the compressed track data
|
||||
stream.EnsureRead(blkHeader, 0, 3);
|
||||
short compressedLength = (short)(BitConverter.ToInt16(blkHeader, 0) - 1);
|
||||
byte escapeByte = blkHeader[2];
|
||||
var compressedLength = (short)(BitConverter.ToInt16(blkHeader, 0) - 1);
|
||||
byte escapeByte = blkHeader[2];
|
||||
|
||||
byte[] cBuffer = new byte[compressedLength];
|
||||
var cBuffer = new byte[compressedLength];
|
||||
stream.EnsureRead(cBuffer, 0, compressedLength);
|
||||
|
||||
// decompress the data
|
||||
int sIndex = 0; // source buffer position
|
||||
int dIndex = 0; // destination buffer position
|
||||
var sIndex = 0; // source buffer position
|
||||
var dIndex = 0; // destination buffer position
|
||||
|
||||
while(sIndex < compressedLength)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ public sealed partial class HdCopy
|
||||
byte fillCount = cBuffer[sIndex++];
|
||||
|
||||
// fill destination buffer
|
||||
for(int i = 0; i < fillCount; i++) trackData[dIndex++] = fillByte;
|
||||
for(var i = 0; i < fillCount; i++) trackData[dIndex++] = fillByte;
|
||||
}
|
||||
else
|
||||
trackData[dIndex++] = cBuffer[sIndex++];
|
||||
|
||||
@@ -109,9 +109,8 @@ public sealed partial class Imd
|
||||
for(var i = 0; i < spt; i++) bps[i] = BitConverter.ToUInt16(bpsbytes, i * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(var i = 0; i < spt; i++) bps[i] = (ushort)(128 << n);
|
||||
}
|
||||
for(var i = 0; i < spt; i++)
|
||||
bps[i] = (ushort)(128 << n);
|
||||
|
||||
if(spt > _imageInfo.SectorsPerTrack) _imageInfo.SectorsPerTrack = spt;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public sealed partial class MaxiDisk
|
||||
|
||||
if(stream.Length < 8) return false;
|
||||
|
||||
byte[] buffer = new byte[8];
|
||||
var buffer = new byte[8];
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
stream.EnsureRead(buffer, 0, buffer.Length);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public sealed partial class Nero
|
||||
var footerV2 = new FooterV2();
|
||||
|
||||
_imageStream.Seek(-8, SeekOrigin.End);
|
||||
byte[] buffer = new byte[8];
|
||||
var buffer = new byte[8];
|
||||
_imageStream.EnsureRead(buffer, 0, 8);
|
||||
footerV1.ChunkId = BigEndianBitConverter.ToUInt32(buffer, 0);
|
||||
footerV1.FirstChunkOffset = BigEndianBitConverter.ToUInt32(buffer, 4);
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
@@ -52,15 +52,14 @@ public sealed partial class T98
|
||||
|
||||
if(stream.Length % 256 != 0) return false;
|
||||
|
||||
byte[] hdrB = new byte[256];
|
||||
var hdrB = new byte[256];
|
||||
stream.EnsureRead(hdrB, 0, hdrB.Length);
|
||||
|
||||
for(int i = 4; i < 256; i++)
|
||||
{
|
||||
if(hdrB[i] != 0) return false;
|
||||
}
|
||||
for(var i = 4; i < 256; i++)
|
||||
if(hdrB[i] != 0)
|
||||
return false;
|
||||
|
||||
int cylinders = BitConverter.ToInt32(hdrB, 0);
|
||||
var cylinders = BitConverter.ToInt32(hdrB, 0);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME, Localization.cylinders_equal_0, cylinders);
|
||||
|
||||
|
||||
@@ -58,8 +58,9 @@ public sealed partial class T98
|
||||
stream.EnsureRead(hdrB, 0, hdrB.Length);
|
||||
|
||||
for(var i = 4; i < 256; i++)
|
||||
if(hdrB[i] != 0)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
{
|
||||
if(hdrB[i] != 0) return ErrorNumber.InvalidArgument;
|
||||
}
|
||||
|
||||
var cylinders = BitConverter.ToInt32(hdrB, 0);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public sealed partial class TeleDisk
|
||||
public bool Identify(IFilter imageFilter)
|
||||
{
|
||||
_header = new Header();
|
||||
byte[] headerBytes = new byte[12];
|
||||
var headerBytes = new byte[12];
|
||||
Stream stream = imageFilter.GetDataForkStream();
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
@@ -66,7 +66,7 @@ public sealed partial class TeleDisk
|
||||
_header.Sides = headerBytes[9];
|
||||
_header.Crc = BitConverter.ToUInt16(headerBytes, 10);
|
||||
|
||||
byte[] headerBytesForCrc = new byte[10];
|
||||
var headerBytesForCrc = new byte[10];
|
||||
Array.Copy(headerBytes, headerBytesForCrc, 10);
|
||||
ushort calculatedHeaderCrc = TeleDiskCrc(0x0000, headerBytesForCrc);
|
||||
|
||||
|
||||
@@ -188,9 +188,8 @@ public sealed partial class TeleDisk
|
||||
for(var i = 0; i < _commentBlock.Length; i++)
|
||||
|
||||
// Replace NULLs, used by TeleDisk as newline markers, with UNIX newline marker
|
||||
{
|
||||
if(_commentBlock[i] == 0x00) _commentBlock[i] = 0x0A;
|
||||
}
|
||||
if(_commentBlock[i] == 0x00)
|
||||
_commentBlock[i] = 0x0A;
|
||||
|
||||
_imageInfo.Comments = Encoding.ASCII.GetString(_commentBlock);
|
||||
|
||||
|
||||
@@ -56,8 +56,9 @@ public sealed partial class TeleDisk
|
||||
unknownLbas = [];
|
||||
|
||||
for(ulong i = sectorAddress; i < sectorAddress + length; i++)
|
||||
if(_sectorsWhereCrcHasFailed.Contains(sectorAddress))
|
||||
failingLbas.Add(sectorAddress);
|
||||
{
|
||||
if(_sectorsWhereCrcHasFailed.Contains(sectorAddress)) failingLbas.Add(sectorAddress);
|
||||
}
|
||||
|
||||
return failingLbas.Count <= 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user