mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Use simpler names for archive Write methods
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user