mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Reformatted.
This commit is contained in:
@@ -52,7 +52,7 @@ namespace DiscImageChef.Commands
|
||||
DicConsole.DebugWriteLine("Verify command", "--verify-disc={0}", options.VerifyDisc);
|
||||
DicConsole.DebugWriteLine("Verify command", "--verify-sectors={0}", options.VerifySectors);
|
||||
|
||||
if (!System.IO.File.Exists(options.InputFile))
|
||||
if(!System.IO.File.Exists(options.InputFile))
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Specified file does not exist.");
|
||||
return;
|
||||
@@ -60,7 +60,7 @@ namespace DiscImageChef.Commands
|
||||
|
||||
ImagePlugin inputFormat = ImageFormat.Detect(options.InputFile);
|
||||
|
||||
if (inputFormat == null)
|
||||
if(inputFormat == null)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Unable to recognize image format, not verifying");
|
||||
return;
|
||||
@@ -76,7 +76,7 @@ namespace DiscImageChef.Commands
|
||||
long correctSectors = 0;
|
||||
long unknownSectors = 0;
|
||||
|
||||
if (options.VerifyDisc)
|
||||
if(options.VerifyDisc)
|
||||
{
|
||||
DateTime StartCheck = DateTime.UtcNow;
|
||||
bool? discCheckStatus = inputFormat.VerifyMediaImage();
|
||||
@@ -84,7 +84,7 @@ namespace DiscImageChef.Commands
|
||||
|
||||
TimeSpan CheckTime = EndCheck - StartCheck;
|
||||
|
||||
switch (discCheckStatus)
|
||||
switch(discCheckStatus)
|
||||
{
|
||||
case true:
|
||||
DicConsole.WriteLine("Disc image checksums are correct");
|
||||
@@ -101,13 +101,13 @@ namespace DiscImageChef.Commands
|
||||
DicConsole.VerboseWriteLine("Checking disc image checksums took {0} seconds", CheckTime.TotalSeconds);
|
||||
}
|
||||
|
||||
if (options.VerifySectors)
|
||||
if(options.VerifySectors)
|
||||
{
|
||||
bool formatHasTracks;
|
||||
try
|
||||
{
|
||||
List<Track> inputTracks = inputFormat.GetTracks();
|
||||
if (inputTracks.Count > 0)
|
||||
if(inputTracks.Count > 0)
|
||||
formatHasTracks = true;
|
||||
else
|
||||
formatHasTracks = false;
|
||||
@@ -123,18 +123,18 @@ namespace DiscImageChef.Commands
|
||||
List<UInt64> UnknownLBAs = new List<UInt64>();
|
||||
bool? checkStatus = null;
|
||||
|
||||
if (formatHasTracks)
|
||||
if(formatHasTracks)
|
||||
{
|
||||
List<Track> inputTracks = inputFormat.GetTracks();
|
||||
UInt64 currentSectorAll = 0;
|
||||
|
||||
StartCheck = DateTime.UtcNow;
|
||||
foreach (Track currentTrack in inputTracks)
|
||||
foreach(Track currentTrack in inputTracks)
|
||||
{
|
||||
UInt64 remainingSectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector;
|
||||
UInt64 currentSector = 0;
|
||||
|
||||
while (remainingSectors > 0)
|
||||
while(remainingSectors > 0)
|
||||
{
|
||||
DicConsole.Write("\rChecking sector {0} of {1}, on track {2}", currentSectorAll, inputFormat.GetSectors(), currentTrack.TrackSequence);
|
||||
|
||||
@@ -142,27 +142,27 @@ namespace DiscImageChef.Commands
|
||||
List<UInt64> tempUnknownLBAs;
|
||||
bool? tempStatus;
|
||||
|
||||
if (remainingSectors < 512)
|
||||
if(remainingSectors < 512)
|
||||
tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors, currentTrack.TrackSequence, out tempFailingLBAs, out tempUnknownLBAs);
|
||||
else
|
||||
tempStatus = inputFormat.VerifySectors(currentSector, 512, currentTrack.TrackSequence, out tempFailingLBAs, out tempUnknownLBAs);
|
||||
|
||||
if (checkStatus == null || tempStatus == null)
|
||||
if(checkStatus == null || tempStatus == null)
|
||||
checkStatus = null;
|
||||
else if (checkStatus == false || tempStatus == false)
|
||||
else if(checkStatus == false || tempStatus == false)
|
||||
checkStatus = false;
|
||||
else if (checkStatus == true && tempStatus == true)
|
||||
else if(checkStatus == true && tempStatus == true)
|
||||
checkStatus = true;
|
||||
else
|
||||
checkStatus = null;
|
||||
|
||||
foreach (UInt64 failLBA in tempFailingLBAs)
|
||||
foreach(UInt64 failLBA in tempFailingLBAs)
|
||||
FailingLBAs.Add(failLBA);
|
||||
|
||||
foreach (UInt64 unknownLBA in tempUnknownLBAs)
|
||||
foreach(UInt64 unknownLBA in tempUnknownLBAs)
|
||||
UnknownLBAs.Add(unknownLBA);
|
||||
|
||||
if (remainingSectors < 512)
|
||||
if(remainingSectors < 512)
|
||||
{
|
||||
currentSector += remainingSectors;
|
||||
currentSectorAll += remainingSectors;
|
||||
@@ -185,7 +185,7 @@ namespace DiscImageChef.Commands
|
||||
UInt64 currentSector = 0;
|
||||
|
||||
StartCheck = DateTime.UtcNow;
|
||||
while (remainingSectors > 0)
|
||||
while(remainingSectors > 0)
|
||||
{
|
||||
DicConsole.Write("\rChecking sector {0} of {1}", currentSector, inputFormat.GetSectors());
|
||||
|
||||
@@ -193,27 +193,27 @@ namespace DiscImageChef.Commands
|
||||
List<UInt64> tempUnknownLBAs;
|
||||
bool? tempStatus;
|
||||
|
||||
if (remainingSectors < 512)
|
||||
if(remainingSectors < 512)
|
||||
tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors, out tempFailingLBAs, out tempUnknownLBAs);
|
||||
else
|
||||
tempStatus = inputFormat.VerifySectors(currentSector, 512, out tempFailingLBAs, out tempUnknownLBAs);
|
||||
|
||||
if (checkStatus == null || tempStatus == null)
|
||||
if(checkStatus == null || tempStatus == null)
|
||||
checkStatus = null;
|
||||
else if (checkStatus == false || tempStatus == false)
|
||||
else if(checkStatus == false || tempStatus == false)
|
||||
checkStatus = false;
|
||||
else if (checkStatus == true && tempStatus == true)
|
||||
else if(checkStatus == true && tempStatus == true)
|
||||
checkStatus = true;
|
||||
else
|
||||
checkStatus = null;
|
||||
|
||||
foreach (UInt64 failLBA in tempFailingLBAs)
|
||||
foreach(UInt64 failLBA in tempFailingLBAs)
|
||||
FailingLBAs.Add(failLBA);
|
||||
|
||||
foreach (UInt64 unknownLBA in tempUnknownLBAs)
|
||||
foreach(UInt64 unknownLBA in tempUnknownLBAs)
|
||||
UnknownLBAs.Add(unknownLBA);
|
||||
|
||||
if (remainingSectors < 512)
|
||||
if(remainingSectors < 512)
|
||||
{
|
||||
currentSector += remainingSectors;
|
||||
remainingSectors = 0;
|
||||
@@ -232,7 +232,7 @@ namespace DiscImageChef.Commands
|
||||
|
||||
DicConsole.Write("\r");
|
||||
|
||||
switch (checkStatus)
|
||||
switch(checkStatus)
|
||||
{
|
||||
case true:
|
||||
DicConsole.WriteLine("All sector checksums are correct");
|
||||
@@ -247,20 +247,20 @@ namespace DiscImageChef.Commands
|
||||
|
||||
DicConsole.VerboseWriteLine("Checking sector checksums took {0} seconds", CheckTime.TotalSeconds);
|
||||
|
||||
if (options.Verbose)
|
||||
if(options.Verbose)
|
||||
{
|
||||
DicConsole.VerboseWriteLine("LBAs with error:");
|
||||
if (FailingLBAs.Count == (int)inputFormat.GetSectors())
|
||||
if(FailingLBAs.Count == (int)inputFormat.GetSectors())
|
||||
DicConsole.VerboseWriteLine("\tall sectors.");
|
||||
else
|
||||
for (int i = 0; i < FailingLBAs.Count; i++)
|
||||
for(int i = 0; i < FailingLBAs.Count; i++)
|
||||
DicConsole.VerboseWriteLine("\t{0}", FailingLBAs[i]);
|
||||
|
||||
DicConsole.WriteLine("LBAs without checksum:");
|
||||
if (UnknownLBAs.Count == (int)inputFormat.GetSectors())
|
||||
if(UnknownLBAs.Count == (int)inputFormat.GetSectors())
|
||||
DicConsole.VerboseWriteLine("\tall sectors.");
|
||||
else
|
||||
for (int i = 0; i < UnknownLBAs.Count; i++)
|
||||
for(int i = 0; i < UnknownLBAs.Count; i++)
|
||||
DicConsole.VerboseWriteLine("\t{0}", UnknownLBAs[i]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user