mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
General refactor and cleanup.
This commit is contained in:
@@ -47,8 +47,7 @@ public sealed partial class DriDiskCopy
|
||||
{
|
||||
Stream stream = imageFilter.GetDataForkStream();
|
||||
|
||||
if((stream.Length - Marshal.SizeOf<Footer>()) % 512 != 0)
|
||||
return false;
|
||||
if((stream.Length - Marshal.SizeOf<Footer>()) % 512 != 0) return false;
|
||||
|
||||
var buffer = new byte[Marshal.SizeOf<Footer>()];
|
||||
stream.Seek(-buffer.Length, SeekOrigin.End);
|
||||
@@ -74,7 +73,8 @@ public sealed partial class DriDiskCopy
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "tmp_footer.bpb.fats_no = {0}", tmpFooter.bpb.fats_no);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "tmp_footer.bpb.sectors = {0}", tmpFooter.bpb.sectors);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "tmp_footer.bpb.media_descriptor = {0}",
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME,
|
||||
"tmp_footer.bpb.media_descriptor = {0}",
|
||||
tmpFooter.bpb.media_descriptor);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "tmp_footer.bpb.spfat = {0}", tmpFooter.bpb.spfat);
|
||||
@@ -86,7 +86,8 @@ public sealed partial class DriDiskCopy
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "tmp_footer.bpb.unknown4 = {0}", tmpFooter.bpb.unknown4);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "tmp_footer.bpb.sptrack2 = {0}", tmpFooter.bpb.sptrack2);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "ArrayHelpers.ArrayIsNullOrEmpty(tmp_footer.bpb.unknown5) = {0}",
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME,
|
||||
"ArrayHelpers.ArrayIsNullOrEmpty(tmp_footer.bpb.unknown5) = {0}",
|
||||
ArrayHelpers.ArrayIsNullOrEmpty(tmpFooter.bpb.unknown5));
|
||||
|
||||
var regexSignature = new Regex(REGEX_DRI);
|
||||
@@ -94,11 +95,9 @@ public sealed partial class DriDiskCopy
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, "MatchSignature.Success? = {0}", matchSignature.Success);
|
||||
|
||||
if(!matchSignature.Success)
|
||||
return false;
|
||||
if(!matchSignature.Success) return false;
|
||||
|
||||
if(tmpFooter.bpb.sptrack * tmpFooter.bpb.cylinders * tmpFooter.bpb.heads != tmpFooter.bpb.sectors)
|
||||
return false;
|
||||
if(tmpFooter.bpb.sptrack * tmpFooter.bpb.cylinders * tmpFooter.bpb.heads != tmpFooter.bpb.sectors) return false;
|
||||
|
||||
return tmpFooter.bpb.sectors * tmpFooter.bpb.bps + Marshal.SizeOf<Footer>() == stream.Length;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ public sealed partial class DriDiskCopy
|
||||
#region IWritableImage Members
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
// ReSharper disable once ConvertToAutoProperty
|
||||
public ImageInfo Info => _imageInfo;
|
||||
|
||||
|
||||
@@ -49,8 +49,7 @@ public sealed partial class DriDiskCopy
|
||||
{
|
||||
Stream stream = imageFilter.GetDataForkStream();
|
||||
|
||||
if((stream.Length - Marshal.SizeOf<Footer>()) % 512 != 0)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
if((stream.Length - Marshal.SizeOf<Footer>()) % 512 != 0) return ErrorNumber.InvalidArgument;
|
||||
|
||||
var buffer = new byte[Marshal.SizeOf<Footer>()];
|
||||
stream.Seek(-buffer.Length, SeekOrigin.End);
|
||||
@@ -63,8 +62,7 @@ public sealed partial class DriDiskCopy
|
||||
var regexSignature = new Regex(REGEX_DRI);
|
||||
Match matchSignature = regexSignature.Match(sig);
|
||||
|
||||
if(!matchSignature.Success)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
if(!matchSignature.Success) return ErrorNumber.InvalidArgument;
|
||||
|
||||
if(_footer.bpb.sptrack * _footer.bpb.cylinders * _footer.bpb.heads != _footer.bpb.sectors)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
@@ -85,7 +83,9 @@ public sealed partial class DriDiskCopy
|
||||
_imageInfo.CreationTime = imageFilter.CreationTime;
|
||||
_imageInfo.LastModificationTime = imageFilter.LastWriteTime;
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Image_application_0_version_1, _imageInfo.Application,
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME,
|
||||
Localization.Image_application_0_version_1,
|
||||
_imageInfo.Application,
|
||||
_imageInfo.ApplicationVersion);
|
||||
|
||||
// Correct some incorrect data in images of NEC 2HD disks
|
||||
@@ -132,11 +132,9 @@ public sealed partial class DriDiskCopy
|
||||
{
|
||||
buffer = null;
|
||||
|
||||
if(sectorAddress > _imageInfo.Sectors - 1)
|
||||
return ErrorNumber.OutOfRange;
|
||||
if(sectorAddress > _imageInfo.Sectors - 1) return ErrorNumber.OutOfRange;
|
||||
|
||||
if(sectorAddress + length > _imageInfo.Sectors)
|
||||
return ErrorNumber.OutOfRange;
|
||||
if(sectorAddress + length > _imageInfo.Sectors) return ErrorNumber.OutOfRange;
|
||||
|
||||
buffer = new byte[length * _imageInfo.SectorSize];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user