mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Enable flat writing using header value
This commit is contained in:
@@ -2369,9 +2369,12 @@ namespace SabreTools.Library.DatFiles
|
||||
outputFormat = OutputFormat.TorrentZip;
|
||||
break;
|
||||
case PackingFlag.Unzip:
|
||||
case PackingFlag.Partial:
|
||||
outputFormat = OutputFormat.Folder;
|
||||
break;
|
||||
// TODO: Check what output format would be for Partial and Flat
|
||||
case PackingFlag.Flat:
|
||||
outputFormat = OutputFormat.ParentFolder;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2388,6 +2391,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (outputFormat)
|
||||
{
|
||||
case OutputFormat.Folder:
|
||||
case OutputFormat.ParentFolder:
|
||||
format = "directory";
|
||||
break;
|
||||
case OutputFormat.TapeArchive:
|
||||
@@ -2559,9 +2563,12 @@ namespace SabreTools.Library.DatFiles
|
||||
outputFormat = OutputFormat.TorrentZip;
|
||||
break;
|
||||
case PackingFlag.Unzip:
|
||||
case PackingFlag.Partial:
|
||||
outputFormat = OutputFormat.Folder;
|
||||
break;
|
||||
// TODO: Check what output format would be for Partial and Flat
|
||||
case PackingFlag.Flat:
|
||||
outputFormat = OutputFormat.ParentFolder;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2578,6 +2585,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (outputFormat)
|
||||
{
|
||||
case OutputFormat.Folder:
|
||||
case OutputFormat.ParentFolder:
|
||||
format = "directory";
|
||||
break;
|
||||
case OutputFormat.TapeArchive:
|
||||
@@ -2855,7 +2863,7 @@ namespace SabreTools.Library.DatFiles
|
||||
}
|
||||
|
||||
// Get a generic stream for the file
|
||||
Stream fileStream = new MemoryStream();
|
||||
Stream fileStream = null;
|
||||
|
||||
// If we have a zipfile, extract the stream to memory
|
||||
if (isZip != null)
|
||||
|
||||
@@ -1283,6 +1283,7 @@ namespace SabreTools.Library.FileTypes
|
||||
{
|
||||
// Currently implemented
|
||||
Folder,
|
||||
ParentFolder,
|
||||
TorrentZip,
|
||||
TorrentGzip,
|
||||
TorrentGzipRomba,
|
||||
|
||||
@@ -20,6 +20,11 @@ namespace SabreTools.Library.FileTypes
|
||||
|
||||
protected List<BaseFile> _children;
|
||||
|
||||
/// <summary>
|
||||
/// Flag specific to Folder to omit Machine name from output path
|
||||
/// </summary>
|
||||
private bool writeToParent = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@@ -27,10 +32,12 @@ namespace SabreTools.Library.FileTypes
|
||||
/// <summary>
|
||||
/// Create a new folder with no base file
|
||||
/// </summary>
|
||||
public Folder()
|
||||
/// <param name="writeToParent">True to write directly to parent, false otherwise</param>
|
||||
public Folder(bool writeToParent = false)
|
||||
: base()
|
||||
{
|
||||
this.Type = FileType.Folder;
|
||||
this.writeToParent = writeToParent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -55,7 +62,10 @@ namespace SabreTools.Library.FileTypes
|
||||
switch (outputFormat)
|
||||
{
|
||||
case OutputFormat.Folder:
|
||||
return new Folder();
|
||||
return new Folder(false);
|
||||
|
||||
case OutputFormat.ParentFolder:
|
||||
return new Folder(true);
|
||||
|
||||
case OutputFormat.TapeArchive:
|
||||
return new TapeArchive();
|
||||
@@ -332,7 +342,11 @@ namespace SabreTools.Library.FileTypes
|
||||
FileStream outputStream = null;
|
||||
|
||||
// Get the output folder name from the first rebuild rom
|
||||
string fileName = Path.Combine(outDir, Sanitizer.RemovePathUnsafeCharacters(rom.Machine.Name), Sanitizer.RemovePathUnsafeCharacters(rom.Name));
|
||||
string fileName;
|
||||
if (writeToParent)
|
||||
fileName = Path.Combine(outDir, Sanitizer.RemovePathUnsafeCharacters(rom.Name));
|
||||
else
|
||||
fileName = Path.Combine(outDir, Sanitizer.RemovePathUnsafeCharacters(rom.Machine.Name), Sanitizer.RemovePathUnsafeCharacters(rom.Name));
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user