mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-08 18:06:41 +00:00
Fix flaw in writable interface
This commit is contained in:
@@ -8,14 +8,17 @@ namespace SabreTools.Wrappers
|
||||
public partial class Atari7800Cart : IWritable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public bool Write(string outputDirectory, bool includeDebug)
|
||||
public bool Write(string outputPath, bool includeDebug)
|
||||
{
|
||||
// Get the base path
|
||||
string outputFilename = Filename is null
|
||||
? Guid.NewGuid().ToString()
|
||||
: Path.GetFileName(Filename);
|
||||
outputFilename += ".a78";
|
||||
string outputPath = Path.Combine(outputDirectory, outputFilename);
|
||||
// Ensure an output path
|
||||
if (string.IsNullOrEmpty(outputPath))
|
||||
{
|
||||
string outputFilename = Filename is null
|
||||
? Guid.NewGuid().ToString()
|
||||
: Path.GetFileName(Filename);
|
||||
outputFilename += ".a78";
|
||||
outputPath = Path.Combine(outputPath, outputFilename);
|
||||
}
|
||||
|
||||
// Check for invalid data
|
||||
if (Header is null || Model.Data is null || Model.Data.Length == 0)
|
||||
|
||||
@@ -8,14 +8,17 @@ namespace SabreTools.Wrappers
|
||||
public partial class AtariLynxCart : IWritable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public bool Write(string outputDirectory, bool includeDebug)
|
||||
public bool Write(string outputPath, bool includeDebug)
|
||||
{
|
||||
// Get the base path
|
||||
string outputFilename = Filename is null
|
||||
? Guid.NewGuid().ToString()
|
||||
: Path.GetFileName(Filename);
|
||||
outputFilename += ".lnx";
|
||||
string outputPath = Path.Combine(outputDirectory, outputFilename);
|
||||
// Ensure an output path
|
||||
if (string.IsNullOrEmpty(outputPath))
|
||||
{
|
||||
string outputFilename = Filename is null
|
||||
? Guid.NewGuid().ToString()
|
||||
: Path.GetFileName(Filename);
|
||||
outputFilename += "lnx";
|
||||
outputPath = Path.Combine(outputPath, outputFilename);
|
||||
}
|
||||
|
||||
// Check for invalid data
|
||||
if (Header is null || Model.Data is null || Model.Data.Length == 0)
|
||||
|
||||
@@ -8,9 +8,9 @@ namespace SabreTools.Wrappers
|
||||
/// <summary>
|
||||
/// Write to an output directory
|
||||
/// </summary>
|
||||
/// <param name="outputDirectory">Output directory to write to</param>
|
||||
/// <param name="outputPath">Output path to write to</param>
|
||||
/// <param name="includeDebug">True to include debug data, false otherwise</param>
|
||||
/// <returns>True if writing succeeded, false otherwise</returns>
|
||||
public bool Write(string outputDirectory, bool includeDebug);
|
||||
public bool Write(string outputPath, bool includeDebug);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user