[DatFile, ArchiveTools, FileTools] Seeking

This commit is contained in:
Matt Nadareski
2017-04-14 21:51:41 -07:00
parent 118d7b58da
commit c3a4c91dc1
3 changed files with 16 additions and 2 deletions

View File

@@ -537,6 +537,9 @@ namespace SabreTools.Helper.Dats
return rebuilt;
}
// Seek to the beginning of the stream
fileStream.Seek(0, SeekOrigin.Begin);
Globals.Logger.User("Matches found for '" + Style.GetFileName(rom.Name) + "', rebuilding accordingly...");
rebuilt = true;

View File

@@ -1576,6 +1576,7 @@ namespace SabreTools.Helper.Tools
if (!File.Exists(archiveFileName))
{
// Copy the input stream to the output
inputStream.Seek(0, SeekOrigin.Begin);
tarFile.AddEntry(rom.Name, inputStream);
}
@@ -1624,6 +1625,7 @@ namespace SabreTools.Helper.Tools
if (index < 0)
{
// Copy the input file to the output
inputStream.Seek(0, SeekOrigin.Begin);
tarFile.AddEntry(rom.Name, inputStream);
}
@@ -1871,6 +1873,9 @@ namespace SabreTools.Helper.Tools
return success;
}
// Seek to the beginning of the stream
inputStream.Seek(0, SeekOrigin.Begin);
// Get the output archive name from the first rebuild rom
string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.Machine.Name) + (rom.Machine.Name.EndsWith(".7z") ? "" : ".7z"));
@@ -2442,6 +2447,9 @@ namespace SabreTools.Helper.Tools
return success;
}
// Seek to the beginning of the stream
inputStream.Seek(0, SeekOrigin.Begin);
// Get the output archive name from the first rebuild rom
string archiveFileName = Path.Combine(outDir, Style.RemovePathUnsafeCharacters(rom.Machine.Name) + (rom.Machine.Name.EndsWith(".xz") ? "" : ".xz"));
@@ -2845,7 +2853,7 @@ namespace SabreTools.Helper.Tools
return success;
}
// Set the stream position
// Seek to the beginning of the stream
inputStream.Seek(0, SeekOrigin.Begin);
// Get the output archive name from the first rebuild rom

View File

@@ -839,6 +839,9 @@ namespace SabreTools.Helper.Tools
}
finally
{
// Seek to the beginning of the stream
input.Seek(0, SeekOrigin.Begin);
if (!keepReadOpen)
{
input.Dispose();