mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Allow to use an existing metadata sidecar and resume file when converting images.
This commit is contained in:
@@ -34,10 +34,12 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Xml.Serialization;
|
||||||
using DiscImageChef.Console;
|
using DiscImageChef.Console;
|
||||||
using DiscImageChef.Core;
|
using DiscImageChef.Core;
|
||||||
using DiscImageChef.DiscImages;
|
using DiscImageChef.DiscImages;
|
||||||
using DiscImageChef.Filters;
|
using DiscImageChef.Filters;
|
||||||
|
using DiscImageChef.Metadata;
|
||||||
using Schemas;
|
using Schemas;
|
||||||
using Version = DiscImageChef.Interop.Version;
|
using Version = DiscImageChef.Interop.Version;
|
||||||
|
|
||||||
@@ -68,6 +70,8 @@ namespace DiscImageChef.Commands
|
|||||||
DicConsole.DebugWriteLine("Analyze command", "--drive-model={0}", options.DriveModel);
|
DicConsole.DebugWriteLine("Analyze command", "--drive-model={0}", options.DriveModel);
|
||||||
DicConsole.DebugWriteLine("Analyze command", "--drive-serial={0}", options.DriveSerialNumber);
|
DicConsole.DebugWriteLine("Analyze command", "--drive-serial={0}", options.DriveSerialNumber);
|
||||||
DicConsole.DebugWriteLine("Analyze command", "--drive-revision={0}", options.DriveFirmwareRevision);
|
DicConsole.DebugWriteLine("Analyze command", "--drive-revision={0}", options.DriveFirmwareRevision);
|
||||||
|
DicConsole.DebugWriteLine("Analyze command", "--cicm-xml={0}", options.CicmXml);
|
||||||
|
DicConsole.DebugWriteLine("Analyze command", "--resume-file={0}", options.ResumeFile);
|
||||||
DicConsole.DebugWriteLine("Analyze command", "--options={0}", options.Options);
|
DicConsole.DebugWriteLine("Analyze command", "--options={0}", options.Options);
|
||||||
|
|
||||||
Dictionary<string, string> parsedOptions = Options.Parse(options.Options);
|
Dictionary<string, string> parsedOptions = Options.Parse(options.Options);
|
||||||
@@ -81,6 +85,49 @@ namespace DiscImageChef.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Resume resume = null;
|
||||||
|
CICMMetadataType sidecar = null;
|
||||||
|
|
||||||
|
XmlSerializer xs = new XmlSerializer(typeof(CICMMetadataType));
|
||||||
|
if(options.CicmXml != null)
|
||||||
|
if(File.Exists(options.CicmXml))
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StreamReader sr = new StreamReader(options.CicmXml);
|
||||||
|
sidecar = (CICMMetadataType)xs.Deserialize(sr);
|
||||||
|
sr.Close();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
DicConsole.ErrorWriteLine("Incorrect metadata sidecar file, not continuing...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DicConsole.ErrorWriteLine("Could not find metadata sidecar, not continuing...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
xs = new XmlSerializer(typeof(Resume));
|
||||||
|
if(options.ResumeFile != null)
|
||||||
|
if(File.Exists(options.ResumeFile))
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StreamReader sr = new StreamReader(options.ResumeFile);
|
||||||
|
resume = (Resume)xs.Deserialize(sr);
|
||||||
|
sr.Close();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
DicConsole.ErrorWriteLine("Incorrect resume file, not continuing...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DicConsole.ErrorWriteLine("Could not find resume file, not continuing...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FiltersList filtersList = new FiltersList();
|
FiltersList filtersList = new FiltersList();
|
||||||
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
|
IFilter inputFilter = filtersList.GetFilter(options.InputFile);
|
||||||
|
|
||||||
@@ -588,10 +635,17 @@ namespace DiscImageChef.Commands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dumpHardware != null && outputFormat.SetDumpHardware(dumpHardware))
|
bool ret;
|
||||||
DicConsole.WriteLine("Written dump hardware list to output image.");
|
|
||||||
if(cicmMetadata != null && outputFormat.SetCicmMetadata(cicmMetadata))
|
if(resume != null) ret = outputFormat.SetDumpHardware(resume.Tries);
|
||||||
DicConsole.WriteLine("Written CICM XML metadata to output image.");
|
else if(dumpHardware != null)
|
||||||
|
ret = outputFormat.SetDumpHardware(dumpHardware);
|
||||||
|
if(ret) DicConsole.WriteLine("Written dump hardware list to output image.");
|
||||||
|
|
||||||
|
if(sidecar != null) ret = outputFormat.SetCicmMetadata(sidecar);
|
||||||
|
else if(cicmMetadata != null)
|
||||||
|
ret = outputFormat.SetCicmMetadata(cicmMetadata);
|
||||||
|
if(ret) DicConsole.WriteLine("Written CICM XML metadata to output image.");
|
||||||
|
|
||||||
DicConsole.WriteLine("Closing output image.");
|
DicConsole.WriteLine("Closing output image.");
|
||||||
|
|
||||||
|
|||||||
@@ -432,6 +432,12 @@ namespace DiscImageChef
|
|||||||
[Option('O', "options", Default = null,
|
[Option('O', "options", Default = null,
|
||||||
HelpText = "Comma separated name=value pairs of options to pass to output image plugin")]
|
HelpText = "Comma separated name=value pairs of options to pass to output image plugin")]
|
||||||
public string Options { get; set; }
|
public string Options { get; set; }
|
||||||
|
|
||||||
|
[Option('x', "cicm-xml", Default = null, HelpText = "Take metadata from existing CICM XML sidecar.")]
|
||||||
|
public string CicmXml { get; set; }
|
||||||
|
|
||||||
|
[Option('r', "resume-file", Default = null, HelpText = "Take list of dump hardware from existing resume file.")]
|
||||||
|
public string ResumeFile { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Verb("image-info", HelpText =
|
[Verb("image-info", HelpText =
|
||||||
|
|||||||
Reference in New Issue
Block a user