diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs
index f094a868..7eb1f3bb 100644
--- a/SabreTools.Library/DatFiles/DatFile.cs
+++ b/SabreTools.Library/DatFiles/DatFile.cs
@@ -4389,7 +4389,7 @@ namespace SabreTools.Library.DatFiles
rebuilt = true;
// Now loop through the list and rebuild accordingly
- foreach (Rom item in dupes)
+ foreach (DatItem item in dupes)
{
switch (outputFormat)
{
@@ -4397,10 +4397,10 @@ namespace SabreTools.Library.DatFiles
rebuilt &= ArchiveTools.WriteFile(fileStream, outDir, item, date: date, overwrite: true);
break;
case OutputFormat.TapeArchive:
- rebuilt &= ArchiveTools.WriteTAR(fileStream, outDir, item, date: date);
+ rebuilt &= ArchiveTools.WriteTAR(fileStream, outDir, (Rom)item, date: date);
break;
case OutputFormat.Torrent7Zip:
- rebuilt &= ArchiveTools.WriteTorrent7Zip(fileStream, outDir, item, date: date);
+ rebuilt &= ArchiveTools.WriteTorrent7Zip(fileStream, outDir, (Rom)item, date: date);
break;
case OutputFormat.TorrentGzip:
rebuilt &= ArchiveTools.WriteTorrentGZ(fileStream, outDir, romba);
@@ -4410,10 +4410,10 @@ namespace SabreTools.Library.DatFiles
case OutputFormat.TorrentRar:
break;
case OutputFormat.TorrentXZ:
- rebuilt &= ArchiveTools.WriteTorrentXZ(fileStream, outDir, item, date: date);
+ rebuilt &= ArchiveTools.WriteTorrentXZ(fileStream, outDir, (Rom)item, date: date);
break;
case OutputFormat.TorrentZip:
- rebuilt &= ArchiveTools.WriteTorrentZip(fileStream, outDir, item, date: date);
+ rebuilt &= ArchiveTools.WriteTorrentZip(fileStream, outDir, (Rom)item, date: date);
break;
}
}
@@ -4611,7 +4611,7 @@ namespace SabreTools.Library.DatFiles
rebuilt = true;
// Now loop through the list and rebuild accordingly
- foreach (Rom item in dupes)
+ foreach (DatItem item in dupes)
{
// Create a headered item to use as well
datItem.CopyMachineInformation(item);
@@ -4623,14 +4623,14 @@ namespace SabreTools.Library.DatFiles
{
case OutputFormat.Folder:
eitherSuccess |= ArchiveTools.WriteFile(transformStream, outDir, item, date: date, overwrite: true);
- eitherSuccess |= ArchiveTools.WriteFile(fileStream, outDir, (Rom)datItem, date: date, overwrite: true);
+ eitherSuccess |= ArchiveTools.WriteFile(fileStream, outDir, datItem, date: date, overwrite: true);
break;
case OutputFormat.TapeArchive:
- eitherSuccess |= ArchiveTools.WriteTAR(transformStream, outDir, item, date: date);
+ eitherSuccess |= ArchiveTools.WriteTAR(transformStream, outDir, (Rom)item, date: date);
eitherSuccess |= ArchiveTools.WriteTAR(fileStream, outDir, (Rom)datItem, date: date);
break;
case OutputFormat.Torrent7Zip:
- eitherSuccess |= ArchiveTools.WriteTorrent7Zip(transformStream, outDir, item, date: date);
+ eitherSuccess |= ArchiveTools.WriteTorrent7Zip(transformStream, outDir, (Rom)item, date: date);
eitherSuccess |= ArchiveTools.WriteTorrent7Zip(fileStream, outDir, (Rom)datItem, date: date);
break;
case OutputFormat.TorrentGzip:
@@ -4642,11 +4642,11 @@ namespace SabreTools.Library.DatFiles
case OutputFormat.TorrentRar:
break;
case OutputFormat.TorrentXZ:
- eitherSuccess |= ArchiveTools.WriteTorrentXZ(transformStream, outDir, item, date: date);
+ eitherSuccess |= ArchiveTools.WriteTorrentXZ(transformStream, outDir, (Rom)item, date: date);
eitherSuccess |= ArchiveTools.WriteTorrentXZ(fileStream, outDir, (Rom)datItem, date: date);
break;
case OutputFormat.TorrentZip:
- eitherSuccess |= ArchiveTools.WriteTorrentZip(transformStream, outDir, item, date: date);
+ eitherSuccess |= ArchiveTools.WriteTorrentZip(transformStream, outDir, (Rom)item, date: date);
eitherSuccess |= ArchiveTools.WriteTorrentZip(fileStream, outDir, (Rom)datItem, date: date);
break;
}
diff --git a/SabreTools.Library/Tools/ArchiveTools.cs b/SabreTools.Library/Tools/ArchiveTools.cs
index c267ee48..d3af5567 100644
--- a/SabreTools.Library/Tools/ArchiveTools.cs
+++ b/SabreTools.Library/Tools/ArchiveTools.cs
@@ -1369,16 +1369,16 @@ namespace SabreTools.Library.Tools
///
/// Input filename to be moved
/// Output directory to build to
- /// DatItem representing the new information
+ /// DatItem representing the new information
/// True if the date from the DAT should be used if available, false otherwise (default)
/// True if we should overwrite the file if it exists, false otherwise
/// True if the file was written properly, false otherwise
- public static bool WriteFile(Stream inputStream, string outDir, Rom rom, bool date = false, bool overwrite = false)
+ public static bool WriteFile(Stream inputStream, string outDir, DatItem datItem, bool date = false, bool overwrite = false)
{
bool success = false;
// If either input is null or empty, return
- if (inputStream == null || rom == null || rom.Name == null)
+ if (inputStream == null || datItem == null || datItem.Name == null)
{
return success;
}
@@ -1393,7 +1393,7 @@ namespace SabreTools.Library.Tools
FileStream outputStream = null;
// Get the output folder name from the first rebuild rom
- string fileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.MachineName), Style.RemovePathUnsafeCharacters(rom.Name));
+ string fileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(datItem.MachineName), Style.RemovePathUnsafeCharacters(datItem.Name));
try
{
@@ -1424,9 +1424,12 @@ namespace SabreTools.Library.Tools
}
outputStream.Dispose();
- if (date && !String.IsNullOrEmpty(rom.Date))
+ if (datItem.Type == ItemType.Rom)
{
- File.SetCreationTime(fileName, DateTime.Parse(rom.Date));
+ if (date && !String.IsNullOrEmpty(((Rom)datItem).Date))
+ {
+ File.SetCreationTime(fileName, DateTime.Parse(((Rom)datItem).Date));
+ }
}
success = true;