Use simpler names for archive Write methods

This commit is contained in:
Matt Nadareski
2025-01-05 20:44:05 -05:00
parent 0b7046fde5
commit 7be00c07fd
9 changed files with 106 additions and 106 deletions

View File

@@ -299,30 +299,30 @@ namespace SabreTools.FileTypes.Archives
#region Writing
/// <inheritdoc/>
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);
}
/// <inheritdoc/>
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
}
/// <inheritdoc/>
public override bool Write(List<string> inputFiles, string outDir, List<BaseFile>? baseFiles)
public override bool Write(List<string> files, string outDir, List<BaseFile>? baseFiles)
{
throw new NotImplementedException();
}