mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Add interface to pass dump hardware list and CICM XML metadata to/from images.
This commit is contained in:
@@ -38,6 +38,7 @@ using DiscImageChef.Console;
|
||||
using DiscImageChef.Core;
|
||||
using DiscImageChef.DiscImages;
|
||||
using DiscImageChef.Filters;
|
||||
using Schemas;
|
||||
using Version = DiscImageChef.Interop.Version;
|
||||
|
||||
namespace DiscImageChef.Commands
|
||||
@@ -249,6 +250,9 @@ namespace DiscImageChef.Commands
|
||||
try { tracks = inputFormat.Tracks; }
|
||||
catch(Exception) { tracks = null; }
|
||||
|
||||
CICMMetadataType cicmMetadata = inputFormat.CicmMetadata;
|
||||
List<DumpHardwareType> dumpHardware = inputFormat.DumpHardware;
|
||||
|
||||
if(tracks != null)
|
||||
if(!outputFormat.SetTracks(tracks))
|
||||
{
|
||||
@@ -510,6 +514,17 @@ namespace DiscImageChef.Commands
|
||||
track.TrackSequence, track.TrackSequence / (double)tracks.Count);
|
||||
sector = inputFormat.ReadSectorTag(track.TrackStartSector, tag);
|
||||
result = outputFormat.WriteSectorTag(sector, track.TrackStartSector, tag);
|
||||
if(!result)
|
||||
if(options.Force)
|
||||
DicConsole.ErrorWriteLine("Error {0} writing tag, continuing...",
|
||||
outputFormat.ErrorMessage);
|
||||
else
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Error {0} writing tag, not continuing...",
|
||||
outputFormat.ErrorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -542,11 +557,11 @@ namespace DiscImageChef.Commands
|
||||
|
||||
if(!result)
|
||||
if(options.Force)
|
||||
DicConsole.ErrorWriteLine("Error {0} writing sector {1}, continuing...",
|
||||
DicConsole.ErrorWriteLine("Error {0} writing tag for sector {1}, continuing...",
|
||||
outputFormat.ErrorMessage, doneSectors);
|
||||
else
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Error {0} writing sector {1}, not continuing...",
|
||||
DicConsole.ErrorWriteLine("Error {0} writing tag for sector {1}, not continuing...",
|
||||
outputFormat.ErrorMessage, doneSectors);
|
||||
return;
|
||||
}
|
||||
@@ -573,6 +588,11 @@ namespace DiscImageChef.Commands
|
||||
}
|
||||
}
|
||||
|
||||
if(dumpHardware != null && outputFormat.SetDumpHardware(dumpHardware))
|
||||
DicConsole.WriteLine("Written dump hardware list to output image.");
|
||||
if(cicmMetadata != null && outputFormat.SetCicmMetadata(cicmMetadata))
|
||||
DicConsole.WriteLine("Written CICM XML metadata to output image.");
|
||||
|
||||
DicConsole.WriteLine("Closing output image.");
|
||||
|
||||
if(!outputFormat.Close())
|
||||
|
||||
@@ -48,13 +48,13 @@ namespace DiscImageChef.Commands
|
||||
{
|
||||
internal static void DoSidecar(CreateSidecarOptions options)
|
||||
{
|
||||
Sidecar.InitProgressEvent += Progress.InitProgress;
|
||||
Sidecar.UpdateProgressEvent += Progress.UpdateProgress;
|
||||
Sidecar.EndProgressEvent += Progress.EndProgress;
|
||||
Sidecar.InitProgressEvent2 += Progress.InitProgress2;
|
||||
Sidecar.InitProgressEvent += Progress.InitProgress;
|
||||
Sidecar.UpdateProgressEvent += Progress.UpdateProgress;
|
||||
Sidecar.EndProgressEvent += Progress.EndProgress;
|
||||
Sidecar.InitProgressEvent2 += Progress.InitProgress2;
|
||||
Sidecar.UpdateProgressEvent2 += Progress.UpdateProgress2;
|
||||
Sidecar.EndProgressEvent2 += Progress.EndProgress2;
|
||||
Sidecar.UpdateStatusEvent += Progress.UpdateStatus;
|
||||
Sidecar.EndProgressEvent2 += Progress.EndProgress2;
|
||||
Sidecar.UpdateStatusEvent += Progress.UpdateStatus;
|
||||
|
||||
Encoding encoding = null;
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace DiscImageChef.Commands
|
||||
}
|
||||
|
||||
FiltersList filtersList = new FiltersList();
|
||||
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
|
||||
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
|
||||
|
||||
if(inputFilter == null)
|
||||
{
|
||||
@@ -123,8 +123,7 @@ namespace DiscImageChef.Commands
|
||||
Core.Statistics.AddMediaFormat(imageFormat.Format);
|
||||
Core.Statistics.AddFilter(inputFilter.Name);
|
||||
|
||||
CICMMetadataType sidecar =
|
||||
Sidecar.Create(imageFormat, options.InputFile, inputFilter.Id, encoding);
|
||||
CICMMetadataType sidecar = Sidecar.Create(imageFormat, options.InputFile, inputFilter.Id, encoding);
|
||||
|
||||
DicConsole.WriteLine("Writing metadata sidecar");
|
||||
|
||||
@@ -153,9 +152,9 @@ namespace DiscImageChef.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
string[] contents = Directory.GetFiles(options.InputFile, "*", SearchOption.TopDirectoryOnly);
|
||||
List<string> files = contents.Where(file => new FileInfo(file).Length % options.BlockSize == 0)
|
||||
.ToList();
|
||||
string[] contents = Directory.GetFiles(options.InputFile, "*", SearchOption.TopDirectoryOnly);
|
||||
List<string> files = contents.Where(file => new FileInfo(file).Length % options.BlockSize == 0)
|
||||
.ToList();
|
||||
|
||||
files.Sort(StringComparer.CurrentCultureIgnoreCase);
|
||||
|
||||
@@ -175,7 +174,8 @@ namespace DiscImageChef.Commands
|
||||
|
||||
Core.Statistics.AddCommand("create-sidecar");
|
||||
}
|
||||
else DicConsole.ErrorWriteLine("The specified input file cannot be found.");
|
||||
else
|
||||
DicConsole.ErrorWriteLine("The specified input file cannot be found.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user