diff --git a/SabreTools.FileTypes/Archives/GZipArchive.cs b/SabreTools.FileTypes/Archives/GZipArchive.cs index 99b9814b..b9989b4d 100644 --- a/SabreTools.FileTypes/Archives/GZipArchive.cs +++ b/SabreTools.FileTypes/Archives/GZipArchive.cs @@ -406,29 +406,29 @@ namespace SabreTools.FileTypes.Archives #region Writing /// - public override bool Write(string inputFile, string outDir, BaseFile? baseFile = null) + public override bool Write(string file, string outDir, BaseFile? baseFile = null) { // Check that the input file exists - if (!File.Exists(inputFile)) + if (!File.Exists(file)) { - _logger.Warning($"File '{inputFile}' does not exist!"); + _logger.Warning($"File '{file}' does not exist!"); return false; } - inputFile = Path.GetFullPath(inputFile); + file = Path.GetFullPath(file); // Get the file stream for the file and write out - using Stream inputStream = File.Open(inputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + using Stream inputStream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); return Write(inputStream, outDir, baseFile); } /// - public override bool Write(Stream? inputStream, string outDir, BaseFile? baseFile = null) + public override bool Write(Stream? stream, string outDir, BaseFile? baseFile = null) { bool success = false; // If the stream is not readable, return - if (inputStream == null || !inputStream.CanRead) + if (stream == null || !stream.CanRead) return success; // Make sure the output directory exists @@ -438,7 +438,7 @@ namespace SabreTools.FileTypes.Archives outDir = Path.GetFullPath(outDir); // Now get the Rom info for the file so we have hashes and size - baseFile = FileTypeTool.GetInfo(inputStream, _hashTypes, keepReadOpen: true); + baseFile = FileTypeTool.GetInfo(stream, _hashTypes, keepReadOpen: true); // Get the output file name string outfile = Path.Combine(outDir, Utilities.GetDepotPath(baseFile.SHA1, Depth) ?? string.Empty); @@ -467,7 +467,7 @@ namespace SabreTools.FileTypes.Archives // Copy the input stream to the output byte[] ibuffer = new byte[_bufferSize]; int ilen; - while ((ilen = inputStream.Read(ibuffer, 0, _bufferSize)) > 0) + while ((ilen = stream.Read(ibuffer, 0, _bufferSize)) > 0) { ds.Write(ibuffer, 0, ilen); ds.Flush(); @@ -490,7 +490,7 @@ namespace SabreTools.FileTypes.Archives } /// - public override bool Write(List inputFiles, string outDir, List? baseFile) + public override bool Write(List files, string outDir, List? baseFile) { throw new NotImplementedException(); } diff --git a/SabreTools.FileTypes/Archives/RarArchive.cs b/SabreTools.FileTypes/Archives/RarArchive.cs index 0dcae30c..4bfed996 100644 --- a/SabreTools.FileTypes/Archives/RarArchive.cs +++ b/SabreTools.FileTypes/Archives/RarArchive.cs @@ -292,30 +292,30 @@ namespace SabreTools.FileTypes.Archives #region Writing /// - public override bool Write(string inputFile, string outDir, BaseFile? baseFile) + public override bool Write(string file, string outDir, BaseFile? baseFile) { // Check that the input file exists - if (!File.Exists(inputFile)) + if (!File.Exists(file)) { - _logger.Warning($"File '{inputFile}' does not exist!"); + _logger.Warning($"File '{file}' does not exist!"); return false; } - inputFile = Path.GetFullPath(inputFile); + file = Path.GetFullPath(file); // Get the file stream for the file and write out - using Stream inputStream = File.Open(inputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + using Stream inputStream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); return Write(inputStream, outDir, baseFile); } /// - public override bool Write(Stream? inputStream, string outDir, BaseFile? baseFile) + public override bool Write(Stream? stream, string outDir, BaseFile? baseFile) { throw new NotImplementedException(); } /// - public override bool Write(List inputFiles, string outDir, List? roms) + public override bool Write(List files, string outDir, List? roms) { throw new NotImplementedException(); } diff --git a/SabreTools.FileTypes/Archives/SevenZipArchive.cs b/SabreTools.FileTypes/Archives/SevenZipArchive.cs index 08c5c3af..447372c5 100644 --- a/SabreTools.FileTypes/Archives/SevenZipArchive.cs +++ b/SabreTools.FileTypes/Archives/SevenZipArchive.cs @@ -376,39 +376,39 @@ namespace SabreTools.FileTypes.Archives #region Writing /// - public override bool Write(string inputFile, string outDir, BaseFile? baseFile) + public override bool Write(string file, string outDir, BaseFile? baseFile) { // Check that the input file exists - if (!File.Exists(inputFile)) + if (!File.Exists(file)) { - _logger.Warning($"File '{inputFile}' does not exist!"); + _logger.Warning($"File '{file}' does not exist!"); return false; } - inputFile = Path.GetFullPath(inputFile); + file = Path.GetFullPath(file); // Get the file stream for the file and write out - using Stream inputStream = File.Open(inputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + using Stream inputStream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); return Write(inputStream, outDir, baseFile); } /// - public override bool Write(Stream? inputStream, string outDir, BaseFile? baseFile) + public override bool Write(Stream? stream, string outDir, BaseFile? baseFile) { bool success = false; string tempFile = Path.Combine(outDir, $"tmp{Guid.NewGuid()}"); // If either input is null or empty, return - if (inputStream == null || baseFile == null || baseFile.Filename == null) + if (stream == null || baseFile == null || baseFile.Filename == null) return success; // If the stream is not readable, return - if (!inputStream.CanRead) + if (!stream.CanRead) return success; // Seek to the beginning of the stream - if (inputStream.CanSeek) - inputStream.Seek(0, SeekOrigin.Begin); + if (stream.CanSeek) + stream.Seek(0, SeekOrigin.Begin); // Get the output archive name from the first rebuild rom string archiveFileName = Path.Combine(outDir, TextHelper.RemovePathUnsafeCharacters(baseFile.Parent) + (baseFile.Parent?.EndsWith(".7z") ?? false ? string.Empty : ".7z")); @@ -428,13 +428,13 @@ namespace SabreTools.FileTypes.Archives // If the archive doesn't exist, create it and put the single file if (!File.Exists(archiveFileName)) { - if (inputStream.CanSeek) - inputStream.Seek(0, SeekOrigin.Begin); + if (stream.CanSeek) + stream.Seek(0, SeekOrigin.Begin); zipReturn = zipFile.ZipFileCreate(tempFile); // Open the input file for reading - ulong istreamSize = (ulong)(inputStream.Length); + ulong istreamSize = (ulong)(stream.Length); DateTime dt = DateTime.Now; if (_realDates && !string.IsNullOrEmpty(baseFile.Date) && DateTime.TryParse(baseFile.Date!.Replace('\\', '/'), out dt)) @@ -453,7 +453,7 @@ namespace SabreTools.FileTypes.Archives { byte[] ibuffer = new byte[_bufferSize]; int ilen; - while ((ilen = inputStream.Read(ibuffer, 0, _bufferSize)) > 0) + while ((ilen = stream.Read(ibuffer, 0, _bufferSize)) > 0) { writeStream.Write(ibuffer, 0, ilen); writeStream.Flush(); @@ -511,7 +511,7 @@ namespace SabreTools.FileTypes.Archives if (index < 0) { // Open the input file for reading - ulong istreamSize = (ulong)(inputStream.Length); + ulong istreamSize = (ulong)(stream.Length); DateTime dt = DateTime.Now; if (_realDates && !string.IsNullOrEmpty(baseFile.Date) && DateTime.TryParse(baseFile.Date!.Replace('\\', '/'), out dt)) @@ -530,7 +530,7 @@ namespace SabreTools.FileTypes.Archives { byte[] ibuffer = new byte[_bufferSize]; int ilen; - while ((ilen = inputStream.Read(ibuffer, 0, _bufferSize)) > 0) + while ((ilen = stream.Read(ibuffer, 0, _bufferSize)) > 0) { writeStream.Write(ibuffer, 0, ilen); writeStream.Flush(); @@ -590,21 +590,21 @@ namespace SabreTools.FileTypes.Archives } /// - public override bool Write(List inputFiles, string outDir, List? baseFiles) + public override bool Write(List files, string outDir, List? baseFiles) { bool success = false; string tempFile = Path.Combine(outDir, $"tmp{Guid.NewGuid()}"); // If either list of roms is null or empty, return - if (inputFiles == null || baseFiles == null || inputFiles.Count == 0 || baseFiles.Count == 0) + if (files == null || baseFiles == null || files.Count == 0 || baseFiles.Count == 0) return false; // If the number of inputs is less than the number of available roms, return - if (inputFiles.Count < baseFiles.Count) + if (files.Count < baseFiles.Count) return false; // If one of the files doesn't exist, return - foreach (string file in inputFiles) + foreach (string file in files) { if (!File.Exists(file)) return false; @@ -632,7 +632,7 @@ namespace SabreTools.FileTypes.Archives // Map all inputs to index Dictionary inputIndexMap = []; - for (int i = 0; i < inputFiles.Count; i++) + for (int i = 0; i < files.Count; i++) { inputIndexMap.Add(baseFiles[i]?.Filename?.Replace('\\', '/') ?? string.Empty, i); } @@ -648,8 +648,8 @@ namespace SabreTools.FileTypes.Archives int index = inputIndexMap[key]; // Open the input file for reading - Stream freadStream = File.Open(inputFiles[index], FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - ulong istreamSize = (ulong)new FileInfo(inputFiles[index]).Length; + Stream freadStream = File.Open(files[index], FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + ulong istreamSize = (ulong)new FileInfo(files[index]).Length; DateTime dt = DateTime.Now; if (_realDates && !string.IsNullOrEmpty(baseFiles[index].Date) && DateTime.TryParse(baseFiles[index].Date?.Replace('\\', '/'), out dt)) @@ -685,7 +685,7 @@ namespace SabreTools.FileTypes.Archives // Map all inputs to index Dictionary inputIndexMap = new(); - for (int i = 0; i < inputFiles.Count; i++) + for (int i = 0; i < files.Count; i++) { List oldZipFileContents = []; for (int j = 0; j < oldZipFile.LocalFilesCount(); j++) @@ -730,8 +730,8 @@ namespace SabreTools.FileTypes.Archives if (index < 0) { // Open the input file for reading - Stream freadStream = File.Open(inputFiles[-index - 1], FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - ulong istreamSize = (ulong)(new FileInfo(inputFiles[-index - 1]).Length); + Stream freadStream = File.Open(files[-index - 1], FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + ulong istreamSize = (ulong)(new FileInfo(files[-index - 1]).Length); DateTime dt = DateTime.Now; if (_realDates && !string.IsNullOrEmpty(baseFiles[-index - 1].Date) && DateTime.TryParse(baseFiles[-index - 1].Date?.Replace('\\', '/'), out dt)) diff --git a/SabreTools.FileTypes/Archives/TapeArchive.cs b/SabreTools.FileTypes/Archives/TapeArchive.cs index 6fc69583..c20b0cc6 100644 --- a/SabreTools.FileTypes/Archives/TapeArchive.cs +++ b/SabreTools.FileTypes/Archives/TapeArchive.cs @@ -281,35 +281,35 @@ namespace SabreTools.FileTypes.Archives #region Writing /// - public override bool Write(string inputFile, string outDir, BaseFile? baseFile) + public override bool Write(string file, string outDir, BaseFile? baseFile) { // Check that the input file exists - if (!File.Exists(inputFile)) + if (!File.Exists(file)) { - _logger.Warning($"File '{inputFile}' does not exist!"); + _logger.Warning($"File '{file}' does not exist!"); return false; } - inputFile = Path.GetFullPath(inputFile); + file = Path.GetFullPath(file); // Get the file stream for the file and write out - using Stream inputStream = File.Open(inputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + using Stream inputStream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); return Write(inputStream, outDir, baseFile); } /// - public override bool Write(Stream? inputStream, string outDir, BaseFile? baseFile) + public override bool Write(Stream? stream, string outDir, BaseFile? baseFile) { #if NET462_OR_GREATER || NETCOREAPP bool success = false; string tempFile = Path.Combine(outDir, $"tmp{Guid.NewGuid()}"); // If either input is null or empty, return - if (inputStream == null || baseFile == null || baseFile.Filename == null) + if (stream == null || baseFile == null || baseFile.Filename == null) return success; // If the stream is not readable, return - if (!inputStream.CanRead) + if (!stream.CanRead) return success; // Get the output archive name from the first rebuild rom @@ -334,10 +334,10 @@ namespace SabreTools.FileTypes.Archives usableDate = dt; // Copy the input stream to the output - if (inputStream.CanSeek) - inputStream.Seek(0, SeekOrigin.Begin); + if (stream.CanSeek) + stream.Seek(0, SeekOrigin.Begin); - tarFile.AddEntry(baseFile.Filename, inputStream, size: baseFile.Size ?? 0, modified: usableDate); + tarFile.AddEntry(baseFile.Filename, stream, size: baseFile.Size ?? 0, modified: usableDate); } // Otherwise, sort the input files and write out in the correct order @@ -392,10 +392,10 @@ namespace SabreTools.FileTypes.Archives if (index < 0) { // Copy the input file to the output - if (inputStream.CanSeek) - inputStream.Seek(0, SeekOrigin.Begin); + if (stream.CanSeek) + stream.Seek(0, SeekOrigin.Begin); - tarFile.AddEntry(baseFile.Filename, inputStream, size: baseFile.Size ?? 0, modified: usableDate); + tarFile.AddEntry(baseFile.Filename, stream, size: baseFile.Size ?? 0, modified: usableDate); } // Otherwise, copy the file from the old archive @@ -442,22 +442,22 @@ namespace SabreTools.FileTypes.Archives } /// - public override bool Write(List inputFiles, string outDir, List? baseFiles) + public override bool Write(List files, string outDir, List? baseFiles) { #if NET462_OR_GREATER || NETCOREAPP bool success = false; string tempFile = Path.Combine(outDir, $"tmp{Guid.NewGuid()}"); // If either list of roms is null or empty, return - if (inputFiles == null || baseFiles == null || inputFiles.Count == 0 || baseFiles.Count == 0) + if (files == null || baseFiles == null || files.Count == 0 || baseFiles.Count == 0) return false; // If the number of inputs is less than the number of available roms, return - if (inputFiles.Count < baseFiles.Count) + if (files.Count < baseFiles.Count) return false; // If one of the files doesn't exist, return - foreach (string file in inputFiles) + foreach (string file in files) { if (!File.Exists(file)) return false; @@ -481,7 +481,7 @@ namespace SabreTools.FileTypes.Archives { // Map all inputs to index Dictionary inputIndexMap = new(); - for (int i = 0; i < inputFiles.Count; i++) + for (int i = 0; i < files.Count; i++) { inputIndexMap.Add(baseFiles[i].Filename!.Replace('\\', '/'), i); } @@ -503,7 +503,7 @@ namespace SabreTools.FileTypes.Archives // Copy the input stream to the output tarFile.AddEntry(baseFiles[index].Filename!, - File.Open(inputFiles[index], FileMode.Open, FileAccess.Read, FileShare.ReadWrite), + File.Open(files[index], FileMode.Open, FileAccess.Read, FileShare.ReadWrite), size: baseFiles[index].Size ?? 0, modified: usableDate); } @@ -520,7 +520,7 @@ namespace SabreTools.FileTypes.Archives // Map all inputs to index var inputIndexMap = new Dictionary(); - for (int i = 0; i < inputFiles.Count; i++) + for (int i = 0; i < files.Count; i++) { // If the old one contains the new file, then just skip out if (entries.Contains(baseFiles[i].Filename!.Replace('\\', '/'))) @@ -568,7 +568,7 @@ namespace SabreTools.FileTypes.Archives // Copy the input file to the output tarFile.AddEntry(baseFiles[-index - 1].Filename!, - File.Open(inputFiles[-index - 1], FileMode.Open, FileAccess.Read, FileShare.ReadWrite), + File.Open(files[-index - 1], FileMode.Open, FileAccess.Read, FileShare.ReadWrite), size: baseFiles[-index - 1].Size ?? 0, modified: usableDate); } diff --git a/SabreTools.FileTypes/Archives/XZArchive.cs b/SabreTools.FileTypes/Archives/XZArchive.cs index 7ff7e0c9..0f1a77bf 100644 --- a/SabreTools.FileTypes/Archives/XZArchive.cs +++ b/SabreTools.FileTypes/Archives/XZArchive.cs @@ -299,30 +299,30 @@ namespace SabreTools.FileTypes.Archives #region Writing /// - public override bool Write(string inputFile, string outDir, BaseFile? baseFile) + public override bool Write(string file, string outDir, BaseFile? baseFile) { // Check that the input file exists - if (!File.Exists(inputFile)) + if (!File.Exists(file)) { - _logger.Warning($"File '{inputFile}' does not exist!"); + _logger.Warning($"File '{file}' does not exist!"); return false; } - inputFile = Path.GetFullPath(inputFile); + file = Path.GetFullPath(file); // Get the file stream for the file and write out - using Stream inputStream = File.Open(inputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + using Stream inputStream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); return Write(inputStream, outDir, baseFile); } /// - public override bool Write(Stream? inputStream, string outDir, BaseFile? baseFile) + public override bool Write(Stream? stream, string outDir, BaseFile? baseFile) { #if NET462_OR_GREATER || NETCOREAPP bool success = false; // If the stream is not readable, return - if (inputStream == null || !inputStream.CanRead) + if (stream == null || !stream.CanRead) return success; // Make sure the output directory exists @@ -332,7 +332,7 @@ namespace SabreTools.FileTypes.Archives outDir = Path.GetFullPath(outDir); // Now get the Rom info for the file so we have hashes and size - baseFile = FileTypeTool.GetInfo(inputStream, _hashTypes, keepReadOpen: true); + baseFile = FileTypeTool.GetInfo(stream, _hashTypes, keepReadOpen: true); // Get the output file name string outfile = Path.Combine(outDir, Core.Tools.Utilities.GetDepotPath(baseFile.SHA1, Depth)!); @@ -347,7 +347,7 @@ namespace SabreTools.FileTypes.Archives { // Compress the input stream XZStream outputStream = new(File.Create(outfile)); - inputStream.CopyTo(outputStream); + stream.CopyTo(outputStream); // Dispose of everything outputStream.Dispose(); @@ -361,7 +361,7 @@ namespace SabreTools.FileTypes.Archives } /// - public override bool Write(List inputFiles, string outDir, List? baseFiles) + public override bool Write(List files, string outDir, List? baseFiles) { throw new NotImplementedException(); } diff --git a/SabreTools.FileTypes/Archives/ZipArchive.cs b/SabreTools.FileTypes/Archives/ZipArchive.cs index 3450e3c7..1375ec4a 100644 --- a/SabreTools.FileTypes/Archives/ZipArchive.cs +++ b/SabreTools.FileTypes/Archives/ZipArchive.cs @@ -554,39 +554,39 @@ namespace SabreTools.FileTypes.Archives #region Writing /// - public override bool Write(string inputFile, string outDir, BaseFile? baseFile) + public override bool Write(string file, string outDir, BaseFile? baseFile) { // Check that the input file exists - if (!File.Exists(inputFile)) + if (!File.Exists(file)) { - _logger.Warning($"File '{inputFile}' does not exist!"); + _logger.Warning($"File '{file}' does not exist!"); return false; } - inputFile = Path.GetFullPath(inputFile); + file = Path.GetFullPath(file); // Get the file stream for the file and write out - using Stream inputStream = File.Open(inputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + using Stream inputStream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); return Write(inputStream, outDir, baseFile); } /// - public override bool Write(Stream? inputStream, string outDir, BaseFile? baseFile) + public override bool Write(Stream? stream, string outDir, BaseFile? baseFile) { bool success = false; string tempFile = Path.Combine(outDir, $"tmp{Guid.NewGuid()}"); // If either input is null or empty, return - if (inputStream == null || baseFile == null || baseFile.Filename == null) + if (stream == null || baseFile == null || baseFile.Filename == null) return success; // If the stream is not readable, return - if (!inputStream.CanRead) + if (!stream.CanRead) return success; // Seek to the beginning of the stream - if (inputStream.CanSeek) - inputStream.Seek(0, SeekOrigin.Begin); + if (stream.CanSeek) + stream.Seek(0, SeekOrigin.Begin); // Get the output archive name from the first rebuild rom string archiveFileName = Path.Combine(outDir, TextHelper.RemovePathUnsafeCharacters(baseFile.Parent) + (baseFile.Parent!.EndsWith(".zip") ? string.Empty : ".zip")); @@ -606,13 +606,13 @@ namespace SabreTools.FileTypes.Archives // If the archive doesn't exist, create it and put the single file if (!File.Exists(archiveFileName)) { - if (inputStream.CanSeek) - inputStream.Seek(0, SeekOrigin.Begin); + if (stream.CanSeek) + stream.Seek(0, SeekOrigin.Begin); zipReturn = zipFile.ZipFileCreate(tempFile); // Open the input file for reading - ulong istreamSize = (ulong)(inputStream.Length); + ulong istreamSize = (ulong)(stream.Length); DateTime dt = DateTime.Now; if (_realDates && !string.IsNullOrEmpty(baseFile.Date) && DateTime.TryParse(baseFile.Date!.Replace('\\', '/'), out dt)) @@ -629,7 +629,7 @@ namespace SabreTools.FileTypes.Archives // Copy the input stream to the output byte[] ibuffer = new byte[_bufferSize]; int ilen; - while ((ilen = inputStream.Read(ibuffer, 0, _bufferSize)) > 0) + while ((ilen = stream.Read(ibuffer, 0, _bufferSize)) > 0) { writeStream!.Write(ibuffer, 0, ilen); writeStream.Flush(); @@ -686,7 +686,7 @@ namespace SabreTools.FileTypes.Archives if (index < 0) { // Open the input file for reading - ulong istreamSize = (ulong)(inputStream.Length); + ulong istreamSize = (ulong)(stream.Length); DateTime dt = DateTime.Now; if (_realDates && !string.IsNullOrEmpty(baseFile.Date) && DateTime.TryParse(baseFile.Date!.Replace('\\', '/'), out dt)) @@ -703,7 +703,7 @@ namespace SabreTools.FileTypes.Archives // Copy the input stream to the output byte[] ibuffer = new byte[_bufferSize]; int ilen; - while ((ilen = inputStream.Read(ibuffer, 0, _bufferSize)) > 0) + while ((ilen = stream.Read(ibuffer, 0, _bufferSize)) > 0) { writeStream!.Write(ibuffer, 0, ilen); writeStream.Flush(); @@ -761,21 +761,21 @@ namespace SabreTools.FileTypes.Archives } /// - public override bool Write(List inputFiles, string outDir, List? baseFiles) + public override bool Write(List files, string outDir, List? baseFiles) { bool success = false; string tempFile = Path.Combine(outDir, $"tmp{Guid.NewGuid()}"); // If either list of roms is null or empty, return - if (inputFiles == null || baseFiles == null || inputFiles.Count == 0 || baseFiles.Count == 0) + if (files == null || baseFiles == null || files.Count == 0 || baseFiles.Count == 0) return false; // If the number of inputs is less than the number of available roms, return - if (inputFiles.Count < baseFiles.Count) + if (files.Count < baseFiles.Count) return false; // If one of the files doesn't exist, return - foreach (string file in inputFiles) + foreach (string file in files) { if (!File.Exists(file)) return false; @@ -803,7 +803,7 @@ namespace SabreTools.FileTypes.Archives // Map all inputs to index Dictionary inputIndexMap = new(); - for (int i = 0; i < inputFiles.Count; i++) + for (int i = 0; i < files.Count; i++) { inputIndexMap.Add(baseFiles[i].Filename!.Replace('\\', '/'), i); } @@ -819,8 +819,8 @@ namespace SabreTools.FileTypes.Archives int index = inputIndexMap[key]; // Open the input file for reading - Stream freadStream = File.Open(inputFiles[index], FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - ulong istreamSize = (ulong)(new FileInfo(inputFiles[index]).Length); + Stream freadStream = File.Open(files[index], FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + ulong istreamSize = (ulong)(new FileInfo(files[index]).Length); DateTime dt = DateTime.Now; if (_realDates && !string.IsNullOrEmpty(baseFiles[index].Date) && DateTime.TryParse(baseFiles[index].Date?.Replace('\\', '/'), out dt)) @@ -856,7 +856,7 @@ namespace SabreTools.FileTypes.Archives // Map all inputs to index Dictionary inputIndexMap = new(); - for (int i = 0; i < inputFiles.Count; i++) + for (int i = 0; i < files.Count; i++) { List oldZipFileContents = []; for (int j = 0; j < oldZipFile.LocalFilesCount(); j++) @@ -901,8 +901,8 @@ namespace SabreTools.FileTypes.Archives if (index < 0) { // Open the input file for reading - Stream freadStream = File.Open(inputFiles[-index - 1], FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - ulong istreamSize = (ulong)(new FileInfo(inputFiles[-index - 1]).Length); + Stream freadStream = File.Open(files[-index - 1], FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + ulong istreamSize = (ulong)(new FileInfo(files[-index - 1]).Length); DateTime dt = DateTime.Now; if (_realDates && !string.IsNullOrEmpty(baseFiles[-index - 1].Date) && DateTime.TryParse(baseFiles[-index - 1].Date?.Replace('\\', '/'), out dt)) diff --git a/SabreTools.FileTypes/BaseArchive.cs b/SabreTools.FileTypes/BaseArchive.cs index c9713694..b512cfd2 100644 --- a/SabreTools.FileTypes/BaseArchive.cs +++ b/SabreTools.FileTypes/BaseArchive.cs @@ -108,13 +108,13 @@ namespace SabreTools.FileTypes } /// - public abstract bool Write(string inputFile, string outDir, BaseFile? baseFile); + public abstract bool Write(string file, string outDir, BaseFile? baseFile); /// - public abstract bool Write(Stream? inputStream, string outDir, BaseFile? baseFile); + public abstract bool Write(Stream? stream, string outDir, BaseFile? baseFile); /// - public abstract bool Write(List inputFiles, string outDir, List? baseFiles); + public abstract bool Write(List files, string outDir, List? baseFiles); #endregion } diff --git a/SabreTools.FileTypes/Folder.cs b/SabreTools.FileTypes/Folder.cs index be7d6554..99da83f7 100644 --- a/SabreTools.FileTypes/Folder.cs +++ b/SabreTools.FileTypes/Folder.cs @@ -264,7 +264,7 @@ namespace SabreTools.FileTypes #region Writing /// - public bool Write(string inputFile, string outDir, BaseFile? baseFile) + public bool Write(string file, string outDir, BaseFile? baseFile) { using Stream inputStream = File.Open(inputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); return Write(inputStream, outDir, baseFile); diff --git a/SabreTools.FileTypes/IParent.cs b/SabreTools.FileTypes/IParent.cs index 2ca5a024..b91228f8 100644 --- a/SabreTools.FileTypes/IParent.cs +++ b/SabreTools.FileTypes/IParent.cs @@ -60,7 +60,7 @@ namespace SabreTools.FileTypes /// Output directory to build to /// BaseFile representing the new information /// True if the write was a success, false otherwise - bool Write(string inputFile, string outDir, BaseFile? baseFile); + bool Write(string file, string outDir, BaseFile? baseFile); /// /// Write an input stream to an output folder