mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: All refactor in DiscImageChef.Core.
This commit is contained in:
@@ -313,7 +313,7 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
if(!plugin.Identify(image, partitions[i])) continue;
|
||||
|
||||
plugin.GetInformation(image, partitions[i], out string foo);
|
||||
plugin.GetInformation(image, partitions[i], out _);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
}
|
||||
@@ -346,7 +346,7 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
if(!plugin.Identify(image, wholePart)) continue;
|
||||
|
||||
plugin.GetInformation(image, wholePart, out string foo);
|
||||
plugin.GetInformation(image, wholePart, out _);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
}
|
||||
@@ -541,13 +541,17 @@ namespace DiscImageChef.Core
|
||||
|
||||
for(byte t = scpImage.Header.start; t <= scpImage.Header.end; t++)
|
||||
{
|
||||
BlockTrackType scpBlockTrackType = new BlockTrackType();
|
||||
scpBlockTrackType.Cylinder = t / image.ImageInfo.Heads;
|
||||
scpBlockTrackType.Head = t % image.ImageInfo.Heads;
|
||||
scpBlockTrackType.Image = new ImageType();
|
||||
scpBlockTrackType.Image.format = scpImage.GetImageFormat();
|
||||
scpBlockTrackType.Image.Value = Path.GetFileName(scpFilePath);
|
||||
scpBlockTrackType.Image.offset = scpImage.Header.offsets[t];
|
||||
BlockTrackType scpBlockTrackType = new BlockTrackType
|
||||
{
|
||||
Cylinder = t / image.ImageInfo.Heads,
|
||||
Head = t % image.ImageInfo.Heads,
|
||||
Image = new ImageType
|
||||
{
|
||||
format = scpImage.GetImageFormat(),
|
||||
Value = Path.GetFileName(scpFilePath),
|
||||
offset = scpImage.Header.offsets[t]
|
||||
}
|
||||
};
|
||||
|
||||
if(scpBlockTrackType.Cylinder < image.ImageInfo.Cylinders)
|
||||
{
|
||||
@@ -626,17 +630,21 @@ namespace DiscImageChef.Core
|
||||
|
||||
foreach(KeyValuePair<byte, Filter> kvp in kfImage.tracks)
|
||||
{
|
||||
BlockTrackType kfBlockTrackType = new BlockTrackType();
|
||||
kfBlockTrackType.Cylinder = kvp.Key / image.ImageInfo.Heads;
|
||||
kfBlockTrackType.Head = kvp.Key % image.ImageInfo.Heads;
|
||||
kfBlockTrackType.Image = new ImageType();
|
||||
kfBlockTrackType.Image.format = kfImage.GetImageFormat();
|
||||
kfBlockTrackType.Image.Value =
|
||||
kfDir
|
||||
? Path.Combine(Path.GetFileName(Path.GetDirectoryName(kvp.Value.GetBasePath())),
|
||||
kvp.Value.GetFilename())
|
||||
: kvp.Value.GetFilename();
|
||||
kfBlockTrackType.Image.offset = 0;
|
||||
BlockTrackType kfBlockTrackType = new BlockTrackType
|
||||
{
|
||||
Cylinder = kvp.Key / image.ImageInfo.Heads,
|
||||
Head = kvp.Key % image.ImageInfo.Heads,
|
||||
Image = new ImageType
|
||||
{
|
||||
format = kfImage.GetImageFormat(),
|
||||
Value = kfDir
|
||||
? Path
|
||||
.Combine(Path.GetFileName(Path.GetDirectoryName(kvp.Value.GetBasePath())),
|
||||
kvp.Value.GetFilename())
|
||||
: kvp.Value.GetFilename(),
|
||||
offset = 0
|
||||
}
|
||||
};
|
||||
|
||||
if(kfBlockTrackType.Cylinder < image.ImageInfo.Cylinders)
|
||||
{
|
||||
@@ -697,12 +705,16 @@ namespace DiscImageChef.Core
|
||||
|
||||
foreach(int t in dfiImage.TrackOffsets.Keys)
|
||||
{
|
||||
BlockTrackType dfiBlockTrackType = new BlockTrackType();
|
||||
dfiBlockTrackType.Cylinder = t / image.ImageInfo.Heads;
|
||||
dfiBlockTrackType.Head = t % image.ImageInfo.Heads;
|
||||
dfiBlockTrackType.Image = new ImageType();
|
||||
dfiBlockTrackType.Image.format = dfiImage.GetImageFormat();
|
||||
dfiBlockTrackType.Image.Value = Path.GetFileName(dfiFilePath);
|
||||
BlockTrackType dfiBlockTrackType = new BlockTrackType
|
||||
{
|
||||
Cylinder = t / image.ImageInfo.Heads,
|
||||
Head = t % image.ImageInfo.Heads,
|
||||
Image = new ImageType
|
||||
{
|
||||
format = dfiImage.GetImageFormat(),
|
||||
Value = Path.GetFileName(dfiFilePath)
|
||||
}
|
||||
};
|
||||
|
||||
if(dfiBlockTrackType.Cylinder < image.ImageInfo.Cylinders)
|
||||
{
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace DiscImageChef.Core
|
||||
Sequence = i
|
||||
};
|
||||
|
||||
uint sectorsToRead = 512;
|
||||
const uint SECTORS_TO_READ = 512;
|
||||
long sectors = fs.Length / blockSize;
|
||||
long doneSectors = 0;
|
||||
|
||||
@@ -98,13 +98,13 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
byte[] sector;
|
||||
|
||||
if(sectors - doneSectors >= sectorsToRead)
|
||||
if(sectors - doneSectors >= SECTORS_TO_READ)
|
||||
{
|
||||
sector = new byte[sectorsToRead * blockSize];
|
||||
sector = new byte[SECTORS_TO_READ * blockSize];
|
||||
fs.Read(sector, 0, sector.Length);
|
||||
UpdateProgress2($"Hashing block {doneSectors} of {sectors} on file {i + 1} of {files.Count}",
|
||||
doneSectors, sectors);
|
||||
doneSectors += sectorsToRead;
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -44,39 +44,37 @@ namespace DiscImageChef.Core
|
||||
|
||||
public static void InitProgress()
|
||||
{
|
||||
if(InitProgressEvent != null) InitProgressEvent();
|
||||
InitProgressEvent?.Invoke();
|
||||
}
|
||||
|
||||
public static void UpdateProgress(string text, long current, long maximum)
|
||||
{
|
||||
if(UpdateProgressEvent != null)
|
||||
UpdateProgressEvent(string.Format(text, current, maximum), current, maximum);
|
||||
UpdateProgressEvent?.Invoke(string.Format(text, current, maximum), current, maximum);
|
||||
}
|
||||
|
||||
public static void EndProgress()
|
||||
{
|
||||
if(EndProgressEvent != null) EndProgressEvent();
|
||||
EndProgressEvent?.Invoke();
|
||||
}
|
||||
|
||||
public static void InitProgress2()
|
||||
{
|
||||
if(InitProgressEvent2 != null) InitProgressEvent2();
|
||||
InitProgressEvent2?.Invoke();
|
||||
}
|
||||
|
||||
public static void UpdateProgress2(string text, long current, long maximum)
|
||||
{
|
||||
if(UpdateProgressEvent2 != null)
|
||||
UpdateProgressEvent2(string.Format(text, current, maximum), current, maximum);
|
||||
UpdateProgressEvent2?.Invoke(string.Format(text, current, maximum), current, maximum);
|
||||
}
|
||||
|
||||
public static void EndProgress2()
|
||||
{
|
||||
if(EndProgressEvent2 != null) EndProgressEvent2();
|
||||
EndProgressEvent2?.Invoke();
|
||||
}
|
||||
|
||||
public static void UpdateStatus(string text, params object[] args)
|
||||
{
|
||||
if(UpdateStatusEvent != null) UpdateStatusEvent(string.Format(text, args));
|
||||
UpdateStatusEvent?.Invoke(string.Format(text, args));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,7 +235,7 @@ namespace DiscImageChef.Core
|
||||
try
|
||||
{
|
||||
List<Session> sessions = image.GetSessions();
|
||||
sidecar.OpticalDisc[0].Sessions = sessions != null ? sessions.Count : 1;
|
||||
sidecar.OpticalDisc[0].Sessions = sessions?.Count ?? 1;
|
||||
}
|
||||
catch { sidecar.OpticalDisc[0].Sessions = 1; }
|
||||
|
||||
@@ -473,7 +473,7 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
if(!plugin.Identify(image, partitions[i])) continue;
|
||||
|
||||
plugin.GetInformation(image, partitions[i], out string foo);
|
||||
plugin.GetInformation(image, partitions[i], out _);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
|
||||
@@ -520,7 +520,7 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
if(!plugin.Identify(image, xmlPart)) continue;
|
||||
|
||||
plugin.GetInformation(image, xmlPart, out string foo);
|
||||
plugin.GetInformation(image, xmlPart, out _);
|
||||
lstFs.Add(plugin.XmlFSType);
|
||||
Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user