mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Reformat code.
This commit is contained in:
@@ -98,12 +98,10 @@ namespace DiscImageChef.Commands
|
||||
{
|
||||
byte[] garbage;
|
||||
string sectorHash = sha1ctxTrack.Data(sector, out garbage);
|
||||
if(!uniqueSectorsPerTrack.Contains(sectorHash))
|
||||
uniqueSectorsPerTrack.Add(sectorHash);
|
||||
if(!uniqueSectorsPerTrack.Contains(sectorHash)) uniqueSectorsPerTrack.Add(sectorHash);
|
||||
}
|
||||
|
||||
foreach(byte b in sector)
|
||||
entTable[b]++;
|
||||
foreach(byte b in sector) entTable[b]++;
|
||||
|
||||
trackSize += (ulong)sector.LongLength;
|
||||
}
|
||||
@@ -121,7 +119,9 @@ namespace DiscImageChef.Commands
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
|
||||
if(options.DuplicatedSectors)
|
||||
DicConsole.WriteLine("Track {0} has {1} unique sectors ({1:P3})", currentTrack.TrackSequence, uniqueSectorsPerTrack.Count, (double)uniqueSectorsPerTrack.Count / (double)sectors);
|
||||
DicConsole.WriteLine("Track {0} has {1} unique sectors ({1:P3})",
|
||||
currentTrack.TrackSequence, uniqueSectorsPerTrack.Count,
|
||||
(double)uniqueSectorsPerTrack.Count / (double)sectors);
|
||||
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
|
||||
|
||||
DicConsole.WriteLine();
|
||||
@@ -129,14 +129,11 @@ namespace DiscImageChef.Commands
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
if(options.Debug)
|
||||
DicConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message);
|
||||
else
|
||||
DicConsole.ErrorWriteLine("Unable to get separate tracks, not calculating their entropy");
|
||||
if(options.Debug) DicConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message);
|
||||
else DicConsole.ErrorWriteLine("Unable to get separate tracks, not calculating their entropy");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(options.WholeDisc)
|
||||
{
|
||||
SHA1Context sha1Ctx = new SHA1Context();
|
||||
@@ -158,15 +155,12 @@ namespace DiscImageChef.Commands
|
||||
{
|
||||
byte[] garbage;
|
||||
string sectorHash = sha1Ctx.Data(sector, out garbage);
|
||||
if(!uniqueSectors.Contains(sectorHash))
|
||||
uniqueSectors.Add(sectorHash);
|
||||
if(!uniqueSectors.Contains(sectorHash)) uniqueSectors.Add(sectorHash);
|
||||
}
|
||||
|
||||
foreach(byte b in sector)
|
||||
entTable[b]++;
|
||||
foreach(byte b in sector) entTable[b]++;
|
||||
|
||||
diskSize += (ulong)sector.LongLength;
|
||||
|
||||
}
|
||||
|
||||
double entropy = 0;
|
||||
@@ -184,12 +178,12 @@ namespace DiscImageChef.Commands
|
||||
|
||||
if(options.DuplicatedSectors)
|
||||
#pragma warning disable IDE0004 // Cast is necessary, otherwise incorrect value is created
|
||||
DicConsole.WriteLine("Disk has {0} unique sectors ({1:P3})", uniqueSectors.Count, (double)uniqueSectors.Count / (double)sectors);
|
||||
DicConsole.WriteLine("Disk has {0} unique sectors ({1:P3})", uniqueSectors.Count,
|
||||
(double)uniqueSectors.Count / (double)sectors);
|
||||
#pragma warning restore IDE0004 // Cast is necessary, otherwise incorrect value is created
|
||||
|
||||
Core.Statistics.AddCommand("entropy");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user