mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Handle more IDDB-specific places that use Machine information
This commit is contained in:
@@ -61,5 +61,31 @@ namespace SabreTools.DatFiles
|
||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override bool WriteToFileDB(string outfile, bool ignoreblanks = false, bool throwOnError = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.User($"Writing to '{outfile}'...");
|
||||
|
||||
// Serialize the input file in two steps
|
||||
var internalFormat = ConvertMetadata(ignoreblanks);
|
||||
var specificFormat = Activator.CreateInstance<V>().Deserialize(internalFormat);
|
||||
if (!Activator.CreateInstance<U>().Serialize(specificFormat, outfile))
|
||||
{
|
||||
logger.Warning($"File '{outfile}' could not be written! See the log for more details.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (!throwOnError)
|
||||
{
|
||||
logger.Error(ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.User($"'{outfile}' written!{Environment.NewLine}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user